text
stringlengths 28
935k
| meta
stringlengths 137
139
| red_pajama_subset
stringclasses 1
value |
---|---|---|
\section{Introduction}
Imitation learning (IL), which tries to mimic the expert's behaviors, has been successfully applied to many tasks, \emph{e.g.}, self-driving \cite{bojarski2016end,li2017infogail}, navigation \cite{silver2008high}, and robot locomotion \cite{merel2017learning}. According to the information contained within the expert references, imitation learning can be divided into two categories, Learning from Demonstration (LfD) and Learning from Observation (LfO) \cite{goo2019one,wake2020learning}. Specifically, the only difference between LfD and LfO is the required input data, \emph{i.e.}, the former demands both states and actions while the latter only needs states.
Intuitively, without actions from the expert, it would be more challenging to duplicate behaviors in the imitation learning scenario. However, motivations for LfO are comparatively strong: (1) it is infeasible to record actions in various practical scenarios. For example, in the robot locomotion task, we often desire robots to clone human behaviors. However, it is significantly difficult for us to obtain human actions (\emph{e.g.}, the forces and torques acting on the joints and actuators \cite{peng2018deepmimic,wang2019imitation,park2019learning}). In these cases, LfD is impracticable due to the absence of human actions. By contrast, LfO could still work effectively by exploiting massive online videos \cite{peng2018sfv}; (2) it is quite unnatural to conduct imitation learning using actions as the guidance. Intelligent creatures primarily learn skills by observing how others accomplish tasks \cite{douglas2006observational}.
Thus, exploiting clues from actions in imitation learning would somewhat limit the intelligence of agents to a comparatively low level; (3) directly imitating actions is infeasible in situations where the expert and the learner are executing tasks in different environment dynamics \cite{Gangwani2020State-only}. Hence, naively asking the learner to copy actions of the expert would lead to performance degeneration or even control failure.
Though the three motivations mentioned above illustrate the necessity of LfO, a huge performance gap between LfO and LfD has been reported in previous works \cite{torabi2018behavioral,torabi2018generative,yang2019imitation}. The comparatively low performance of LfO compared to LfD imposes restrictions on LfO's potential in real-world applications. Intuitively, the learning process for LfD is more straightforward since expert references provide the direct action guidance to the imitator. On the contrary, in terms of LfO, the agent is required to figure out the right action to generate state transitions similar to the expert ones.
This is the conjecture for the existence of the performance disparity \cite{torabi2018generative}. Based on this conjecture, Yang et al. \cite{yang2019imitation} proved that the performance gap is primarily caused by the inverse dynamics disagreement between the imitator and the expert. They further pointed out that LfO is equivalent to LfD when the environment dynamics are injective. However, an abnormal phenomenon occurs that LfO can perform as well as LfD in simple environments that are not injective (\emph{e.g.,} Pendulum-v2) \cite{torabi2018generative,sun2019adversarial}.
Therefore, investigating the root for the performance gap and bridging the gap between these two methods are significantly beneficial to improve the employment of LfO in practice. In this paper, we prove that the inverse dynamics disagreement between the expert and the imitator approaches zero in deterministic robot tasks or robot tasks with bounded randomness, which means that LfO is almost equivalent to LfD.
In this paper, we conduct a deep investigation into the difference between LfO and LfD from the control theory. Based on the most representative imitation learning algorithms: Generative Adversarial Imitation Learning (GAIL) \cite{ho2016generative} and Generative Adversarial Imitation from Observation (GAIfO) \cite{torabi2018generative}, we first use the deterministic property of the environment to analyze the value of the inverse dynamics model in a more rigorous way. Then, we establish the Euler-Lagrange dynamical equation for typical Mujoco tasks, and prove the existence and uniqueness of the action for a feasible state transition $(s,s')$. Combing the above two results, we prove that, in the same deterministic robot environment, the inverse dynamics models for the imitator and the expert are almost equal everywhere.
Thus, the inverse dynamics disagreement between the expert and the imitator approaches zero, meaning that LfO is almost equivalent to LfD in deterministic robot tasks.
To further relax the deterministic constraint and better adapt to the environment in practice, we consider the bounded randomness in the robot environment and prove that the optimizing targets for LfD and LfO remain almost same in a more generalized setting.
Primary contributions of our paper are summarized as follows:
\begin{itemize}
\item By exploiting the Euler-Lagrange dynamical equation from control theory, we are the first to prove that in a deterministic robot environment, the performance gap between LfO and LfD approaches zero.
\item We further prove that the optimizing targets for LfO and LfD remain almost same even if bounded randomness is considered in the robot dynamics, which extends our conclusion to more generalized settings. Moreover, this makes it possible to employ LfO in practical applications.
\item Extensive experiments on various robot tasks illustrate that the performance of LfO is comparable to that of LfD. Furthermore, we give some discussions and suggestions on the factors which may affect the performance of LfO and LfD.
\end{itemize}
\section{Related Works}
Imitation Learning tries to reproduce a policy that can mimic an expert's specific behaviors using only expert references. From the perspective of the information contained in expert trajectories, imitation learning can be divided into Learning from Demonstration (LfD) and Learning from Observation (LfO) \cite{goo2019one,wake2020learning}.
\paragraph{LfD} LfD utilizes both states and actions to conduct imitation learning and can be divided into two categories, \emph{i.e.}, Behavior Cloning (BC) and Inverse Reinforcement Learning (IRL). Behavior Cloning, as indicated by its name, aims to clone expert's behaviors from expert trajectories which contain states and actions \cite{Bain95,Ross10,Ross11}. Thus, BC solves the imitation problem in a supervised learning manner, taking states as the inputs and actions as the labels. Given current states, the agent learns to predict actions as close as the expert ones. Inverse Reinforcement Learning imitates the expert from the perspective of reward shaping. IRL first reconstructs a reward function from expert trajectories, and then uses this reward function to guide a standard reinforcement learning process. A recent advance in IRL is Generative Adversarial Imitation Learning (GAIL) \cite{ho2016generative}, which makes no assumption on the form of the reward function. Instead, it utilizes a discriminator to measure the similarity of state-action pairs between the imitator and the expert and takes the similarity as the reward to perform forward reinforcement learning
\paragraph{LfO} LfO is developed in a scenario where expert actions are absent. Similar to BC and GAIL in LfD, corresponding LfO versions are proposed, \emph{i.e.}, Behavior Cloning from Observation (BCO) \cite{torabi2018behavioral} and Generative Adversarial Imitation from Observation (GAIfO) \cite{torabi2018generative}. BCO employs an inverse dynamics model to guess the possible expert actions, and then uses the guessed expert actions to conduct standard BC. Unlike GAIL which uses state-action pairs to generate the reward, GAIfO exploits state transitions to obtain the reward. Generally, the performance of GAIfO is inferior to that of GAIL due to the lack of direct action guidance. Another approach in LfO is to design a hand-crafted reward function with expert states and then employ ordinary reinforcement learning to maximize the episode cumulative reward \cite{peng2018deepmimic,peng2018sfv,peng2020learning}. However, it is not an easy task to design a proper hand-crafted reward function since there is no mature design paradigm for the reward function and it requires background knowledge from the given application field.
\paragraph{Relationship between LfD and LfO}
Several studies have empirically shown that LfO is more difficult than LfD \cite{torabi2018behavioral,torabi2018generative}. In other words, the performance of LfO is inferior to that of LfD. An intuitive explanation is that, expert references in LfD are able to teach the imitator the correct actions directly. By contrast, in LfO, the imitator is required to find out the right actions and generates the state-transitions that are similar to those of the expert via interacting with the environment. Evidently, this process brings higher complexity and difficulty. Specifically, Yang et al. \cite{yang2019imitation} investigated the reason for the performance gap between LfD and LfO using two representative IL algorithms, GAIL and GAIfO.
They believed that, in the complex real-world environment, the inverse dynamics disagreement is not zero, implying that a performance gap exists between LfD and LfO. They further presented a corollary that LfD is equivalent to LfO in injective dynamics. However, according to the definition of injectivity, injective dynamics indicate that a distinct state transition $(s,s')$ in its domain maps to a distinct action $a$ in its codomain. This is quite a harsh requirement and we could not find corresponding environments in practice.
Unlike previous works, we suggest that the performance gap between LfD and LfO approaches zero in the deterministic robot system (a class of common system). In particular, we do not require the environment dynamics to be injective. By contrast, we only need that there only exists a unique action $a$ for a feasible state transition $(s,s')$. But on the other hand, an action $a$ could correspond to many distinct state transitions, which means that the environment dynamics are not injective. As a result, our work tremendously relaxes the pre-requisite conditions for the equivalence between LfD and LfO, and extends the possible application domains of LfO in practice.
\section{Preliminaries}
To derive our theorem, prerequisite definitions and concepts are presented in advance.
\paragraph{Markov Decision Process} We consider a Markov Decision Process described by $(S,A,T,R,\gamma)$, where $S$ and $A$ represent state space and action space respectively, $T=T(s'|s,a)$ is the environment dynamics modeling the probability of states transitions over actions, $R:S \times A \rightarrow R$ is the reward function, and $\gamma$ is the discount factor. Let $\pi(a_t|s_t):S\times A\rightarrow[0,1]$ be a stochastic policy for the agent where $t$ is the current timestep, $J(\pi)=\mathbb{E}_{\mathbf{s}_{0},\mathbf{a}_{0},\cdots}\left[R_0\right]$ in which $R_t=\sum_{l=0}^{\infty}\gamma^l r_{t+l}$ denoting the expected discounted reward, where $\mathbf{s}_0\sim\rho_0(\mathbf{s}_0)$, $a_t\sim\pi(a_t|s_t)$, $\mathbf{s}_{t+1}\sim T(\mathbf{s}_{t+1}|\mathbf{s}_t,\mathbf{a}_t)$, and $\rho_0(\mathbf{s}_0)$ is the probability distribution of the initial state $s_0$. The goal of Reinforcement Learning (RL) algorithms is to find the optimal policy $\pi^{*}(a_t|s_t)$, which can achieve the maximum episode cumulative reward $J^*(\pi)$. \par
To measure the discrepancy between trajectories, we bring in the following definition which characterizes the property.
\begin{definition}[Occupancy Measure]\cite{puterman1994markov,torabi2018generative}
Define the state occupancy measure for a distribution as follows:
\begin{align*}
\rho_{\pi_\theta}(s) = \sum_{t=0}^{\infty} \gamma^t P(s_t = s|\pi_{\theta}),
\end{align*}
where $\gamma$ is a discount and $\pi_{\theta}(a|s)$ stands for the probability of a policy taking action $a$ given state $s$. For briefness, we omit the parameter of a policy and denote $\pi_{\theta}$ as $\pi$.
\end{definition}
In order to model the relationship between the state transitions and the actions, the inverse dynamics model is defined below.
\begin{definition}[Inverse Dynamics Model]\cite{spong1990adaptive}\label{definition:inversedynamicsmodel}
Given a policy $\pi$ and the dynamics of the environment $T(s'|s,a)$, we can define the density of the inverse dynamics model:
\begin{align}\label{equation:inversedynamicsmodel}
\rho_{\pi}(a|s,s') = \frac{T (s'|s,a)\pi(a|s)}{\int_{A} T (s'|s,\bar a)\pi(\bar a|s) d\bar a}.
\end{align}
\end{definition}
\paragraph{GAIL} GAIL tries to minimize the divergence between the expert trajectory and the agent trajectory. When the trajectory generated from the agent's current policy matches that of the expert, it suggests that the trained policy can achieve similar performance to the expert. The type of divergence could be Kullback–Leibler divergence \cite{kullback1951information} or Jensen–Shannon divergence \cite{lin1991divergence}, which measures the distribution distance between trajectories. It is formalized as follows:
\begin{align*
\begin{split}
\mathop{\min}\limits_{\theta} \mathop{\max}\limits_{\omega} \mathop{\mathbb{E}}\limits_{s,a \sim \rho_\theta}[\log D_w(s,a)]+\mathop{\mathbb{E}}\limits_{s,a \sim \rho_{E}}[\log(1- D_w(s,a))],
\end{split}
\end{align*}
where $D_w(s,a)$ is a discriminator which judges the similarity of a state-action pair $(s,a)$ to the reference one, and $w$ represents the weights of the discriminator network.
\paragraph{GAIfO} GAIfO is a modified version of GAIL, which only uses the observation pair $(s,s')$ to learn. Its objective is defined as follows:
\begin{align*
\begin{split}
\mathop{\min}\limits_{\theta} \mathop{\max}\limits_{\omega} \mathop{\mathbb{E}}\limits_{s, s' \sim \rho_\theta}[\log D_w(s,s')]+\mathop{\mathbb{E}}\limits_{s, s' \sim \rho_{E}}[\log(1- D_w(s, s'))].
\end{split}
\end{align*}
However, according to the literature \cite{torabi2018generative,yang2019imitation}, GAIfO performs worse than GAIL despite its merit of not requiring expert actions. An insight into the performance gap is presented below.
\paragraph{Inverse Dynamics Disagreement between LfD and LfO}
Yang et al. \cite{yang2019imitation} investigated the cause for the performance gap and revealed this cause with the following equation:
\begin{align*}
\begin{split}
\mathbb{D}_{KL}(\rho_{\pi}(a|s,s')||\rho_{E}(a|s,s'))=\mathbb{D}_{KL}(\rho_{\pi}(s,a)||\rho_{E}(s,a)) - \mathbb{D}_{KL}(\rho_{\pi}(s,s')||\rho_{E}(s,s')),
\end{split}
\end{align*}
where $\mathbb{D}_{KL}(\rho_{\pi}(a|s,s')||\rho_{E}(a|s,s'))$ is the inverse dynamics disagreement which induces the performance gap between LfD and LfO. Furthermore, they proved that LfD and LfO should be equivalent when the environment dynamics are injective. In this paper, we would further analyze the inverse dynamics disagreement in a stricter manner by utilizing the property of robot environment dynamics, and our analysis prove that the equivalence of LfD and LfO holds even when the environment dynamics are not injective.
\section{Method}
In this section, we will present our theoretical results---the almost equivalence between LfD and LfO in both deterministic robot environments and bounded randomness robot environments, which are organized into three subsections. More precisely, firstly, some properties of the deterministic robot environment and the Euler-Lagrange Dynamical Equations are presented; then, we prove that on deterministic robot tasks, LfD and LfO are almost the same in terms of the optimizing target, which means that the performance gap between them approaches zero; finally, by exploiting the bounded randomness of the environment and the Lipshitz continuity of policies, the almost equivalence between LfO and LfD is still guaranteed. Theoretically, we can see that LfO could perform as well as LfD essentially, and our findings increase the potential for LfO to be applied in real-world robot systems. In the next section, the experimental results validate our theoretical analysis. \par
\subsection{Deterministic Robot Environments}\label{subsection:deterministic}
For LfD and LfO considered in Ho et al. \cite{ho2016generative} and Torabi et al. \cite{torabi2018generative}, respectively, the learner policy is interacting with the same environment in which the expert reference is sampled. That is to say, we do not consider environment variations in the imitation learning process, and this setting is consistent with previous researches showing the performance discrepancy. Thus, to formalize this common situation in imitation learning, an assumption is made consequently.
\begin{assumption}\label{assum:samedynamics}
The environment dynamics for the learner and the expert remain same.
\end{assumption}
This assumption does make sense in reality because it is the most basic task to demand the learner to imitate the expert without environment dynamics change and morphology inconsistency \cite{ho2016generative,sun2019adversarial}. Furthermore, in this subsection, we focus on one kind of more specific environment, \emph{e.g.}, the deterministic robot environment, which is the most fundamental setting for robots and is of significance to investigate the difference between LfO and LfD given such environment.
The deterministic property means that there is no randomness in the environment, leading to the following lemma.
\begin{lemma}\label{lemma:dynamics}
For a deterministic environment, given the current state $s$, taking action $a$ will result in a certain next state $s'$. To distinguish this certain next state against the others, we denote it as $s_{d}'$ in which the subscript $d$ stands for determinacy. Consequently, the transition dynamics for both the imitator and the demonstrator can be further specified as:
\begin{align*}
T (s'|s,a)=\left\{
\begin{array}{rcl}
1.0 & & {s'=s_{d}' }\\
0.0 & & {s'\in S \ and \ s'\neq s_{d}'}
\end{array} \right .
\end{align*}
\end{lemma}
The zero-one property of the environment dynamics can help us simplify the inverse dynamics model in Eq. \eqref{equation:inversedynamicsmodel}. Besides, to present another feature of the deterministic robot environment, we would borrow the idea from the field of control science. In MDP, $T(s'|s,a)$ is employed to describe the environment dynamics, \emph{i.e}., the dynamical relationship between forces and motions. In contrast to $T(s'|s,a)$ in MDP, the control science community uses differential equations to represent this relationship. Under Lagrangian mechanics \cite{brizard2nd}, we obtain the dynamics model in control science as follows:
\begin{lemma}\label{lemma:lagrange} \cite{dubowsky1993kinematics,westervelt1st,nanos2012cartesian}
The differential equation, called Euler-Lagrange dynamical equation, which models the dynamics for deterministic robot environments, could be written in the following form:
\begin{align}\label{equation:Euler-La}
M(q)\ddot q + C(q,\dot q)\dot q + G(q)= u,
\end{align}
where $q$ is the generalized coordinates, $\dot q$ is the derivative of the generalized coordinates, and $u$ is the control input. $M(q)$ is the inertia matrix which is positive definite, $C(q,\dot q)$ describes the centripetal and Coriolis torques, and $G(q)$ is the vector of gravitational torques.
\end{lemma}
From the above lemma, Eq. \eqref{equation:Euler-La} is able to describe the system dynamics of the robot. Besides, both $q$ and $\dot q$ are defined as system states in control theory. However, to distinguish the states in MDP and Euler-Lagrange dynamical equation, we will merely use the term states for MDP and generalized coordinates for the control model, respectively. The connection between $s$ and $(q,\dot q)$ is illustrated by the following remark.
\begin{remark}\label{remark:equalqa}
The generalized coordinates $(q,\dot q)$ have the capacity to express all the dynamical information of the robot. Hence, the state $s$ in MDP is equivalent to $(q,\dot q)$ in the control theory via some specific transforms.
\end{remark}
It means that $s$ and $(q,\dot q)$ can replace each other. As a result, we can investigate $(q,\dot q)$ rather than $s$ in MDP. In robot control, the control inputs are often forces or torques acting on the joints. Under this setting, the control input $u$ is exact the action $a$. Hence, we can use the Euler-Lagrange dynamical equation to analyze the relationship between the generalized coordinates transition $((q_t,\dot q_t),(q_{t+1},\dot q_{t+1}))$ and the control input $u$ instead of analyzing the unknown environment dynamics $T(s'|s,a)$.
\subsection{Almost Equivalence between LfO and LfD in Deterministic Robot Environments}\label{subsection:eqdeterministic}
In this subsection, we first analyze the inverse dynamics models and the sufficient condition under which the inverse dynamics models of the imitator and the expert are equal everywhere. Then, we give the theorem proving that the inverse dynamics disagreement between LfD and LfO approaches zero, \emph{i.e.}, $\mathbb{D}_{KL}(\rho_{\pi}(a|s,s')||\rho_{E}(a|s,s'))\approx0$, leading to the almost equivalence of both considered approaches. \par
The difference lying between LfD and LfO is the inverse dynamics disagreement, that is,
\begin{align}\label{equation:detailinversedynamicsdis}
\begin{split}
\mathbb{D}_{KL}(\rho_{\pi}(a|s,s')||\rho_{E}(a|s,s')) = \int_{S\times A\times S} \rho_{\pi}(s,a,s') log \frac{\rho_{\pi}(a|s,s')}{\rho_{E}(a|s,s')} dsdads'.
\end{split}
\end{align}
Eq. \eqref{equation:detailinversedynamicsdis} indicates that the inverse dynamics models of the learner and the expert determine how large the performance gap would be.
As a result, based on Definition \ref{definition:inversedynamicsmodel} and Eq. \eqref{equation:detailinversedynamicsdis}, if the environment dynamics $T(s'|s,a)$ plusing the imitator policy $\pi_{\theta}(a|s)$ are able to guarantee that $\rho_{\pi}(a|s,s')=\rho_{E}(a|s,s')$ for every $(s,s',a)\in\{S\times S\times A\}$, then, $\mathbb{D}_{KL}(\rho_{\pi}(a|s,s')||\rho_{E}(a|s,s'))=0$ and no difference exists between the two focus approaches. For deterministic robot environments, the theorem on the almost equivalence of the inverse dynamics models for the learner and the expert is given as follows.
\begin{theorem}\label{theorem1}
Under Assumption \ref{assum:samedynamics}, for deterministic robot controlled plant, the inverse dynamics disagreement between the learner policy and the expert policy approaches zero.
\end{theorem}
\begin{proof}
Our analysis relies on the deterministic property and the Euler-Lagrange dynamical equation. We first use the deterministic character to simplify inverse dynamics models and obtain the sufficient condition to ensure the equality of inverse dynamics models between LfO and LfD. Subsequently, we employ the Euler-Lagrange dynamical equation to prove the uniqueness of the action for a feasible state transition $(s,s')$. \par
\textit{Sufficient Condition.} For a deterministic system, the state-action-state tuples $(s,a,s')$ recorded by interacting with the environment satisfy that $T(s'|s,a)=1$. Assume actions in set $A$ can be divided into two subsets, in which the actions belonging to the first subset can transfer state $s$ to $s'$ while the other could not. To better represent the first part of actions, we use symbol $A_{f}$ in which the subscript $f$ stands for feasibility. Thus, the inverse dynamics models for the imitator and the demonstrator could be simplified as follows:
\begin{align}
&\rho_{\pi}(a|s,s')=\frac{\pi_{\theta}(a|s)}{\int_{A_f} \pi_{\theta}(\bar a|s) d\bar a},\label{euqation:inversemodel0}\\
&\rho_{E}(a|s,s')=\frac{\pi_{E}(a|s)}{\int_{A_f} \pi_{E}(\bar a|s) d\bar a}.\label{euqation:inversemodel1}
\end{align}
Since that we have no access to the expert policy, the only way to guarantee $\rho_{\pi}(a|s,s')=\rho_{E}(a|s,s')$ is $\left| A_f\right|=1$, meaning that there is only one element in the set $A_f$. In other words, for a feasible state transition $(s,s')$, there is a unique action $a$ which can transfer the current state $s$ to the next $s'$. Thus, the inverse dynamics models are obtained as:
\begin{align*}
\rho_{\pi}(a|s,s')=\frac{\pi_{\theta}(a|s)}{\pi_{\theta}(a|s)}=1=\frac{\pi_{E}(a|s)}{\pi_{E}(a|s)}=\rho_{E}(a|s,s').
\end{align*}
Now, the equality of $\rho_{\pi}(a|s,s')$ and $\rho_{E}(a|s,s')$ turns into whether the unique existence of action $a$ holds for a feasible state transition $(s,s')$.\par
\textit{Uniqueness of the Action.} According to Remark \ref{remark:equalqa}, we would focus on whether there exist more than one control inputs $u$ which can transfer the generalized coordinates from $(q_t,\dot q_t)$ to $(q_{t+1},\dot q_{t+1})$ where $t$ is the current timestep. We assume that there exist at least two possible control inputs $u_0$ and $u_1$, which can bring the current state $(q_t,\dot q_t)$ to the next $(q_{t+1},\dot q_{t+1})$ and $u_0 \neq u_1$. When applying $u$ to the robot, accelerations $\ddot q$ are generated from Eq. \eqref{equation:Euler-La}. Based on Euler Methods \cite{butcher2008numerical} and Euler-Lagrange dynamical equation (Lemma \ref{lemma:lagrange}), we prove that:
\begin{align*}
u_0 \approx u_1.
\end{align*}
This result contradicts the assumption that there exist at least two different control inputs that can achieve the same generalized coordinates transition. Hence, it means that given a system generalized coordinates change, there is only one corresponding control input $u_{uni}$. Consequently, based on Remark \ref{remark:equalqa}, the existence and uniqueness of the action $a$ for a feasible state transition $(s,s')$ have been proved. Returning back to Eqs. \eqref{euqation:inversemodel0} and \eqref{euqation:inversemodel1}, we can guarantee that the inverse dynamics models for the learner and the expert are almost equal everywhere. In conclusion, for deterministic robot tasks, the almost equivalence between LfD and LfO holds.
\end{proof}
Theorem \ref{theorem1} tells us that LfO is almost equivalent to LfD, and thus, there would be no performance difference in deterministic robot environments. Hence, researchers could safely employ LfO in this kind of environments without worrying about performance degeneration, which greatly expands its application range. We provide a more detailed proof in the Appendix.
\subsection{Almost Equivalence between LfO and LfD in Robot Environments with Bounded Randomness}\label{subsection:random}
In the robot system, Eq. \eqref{equation:Euler-La} is an ideal analytical model of the robot system, which does not contain disturbances \cite{liu2000disturbance}, un-modeled dynamics \cite{nguyen2015adaptive}, and parameter uncertainties \cite{burkan2003upper}. These factors will lead to stochasticity in the environment dynamics and impair the universality of Theorem \ref{theorem1}. To further cope with the situation in reality, we assume bounded randomness in the robot environment dynamics \cite{lu2010experimental,lin2011modeling,li2017robustness}. This means that the environment dynamics $T(s'|s,a)$ can randomly transfer the current state $s$ with action $a$ to a range of next states $\{s'|s'\in(s'_d-\frac{\epsilon}{2},s'_d+\frac{\epsilon}{2})\}$, where $s'_d$ is the certain next state in the deterministic setting and $\epsilon$ is the bound of the randomness which is assumed to be small. This assumption is reasonable and is able to cover the environment dynamics in the real-world. Then, a corollary of the inverse dynamics disagreement between LfD and LfO in random robot environments is presented below.
\begin{corollary}\label{corollary1}
When the randomness of the environment dynamics is bounded by a small number $\epsilon$ and policies are Lipshitz continuous, the inverse dynamics disagreement between the learner policy and the expert policy approaches zero.
\end{corollary}
This means that even in the robot environment with bounded randomness LfO is almost equivalent to LfD. Corollary \ref{corollary1} extends the Theorem \ref{theorem1} to the stochastic setting, and enlarges the application fields of LfO. The proof of this corollary is in the Appendix. \par
It should be noted that the even the optimizing targets for LfD and LfO are almost same, this does not mean the performance of LfD and LfO could always be the same in the experiments because both LfD and LfO are not guaranteed to achieve the global optima especially with deep neural networks.
\section{Experiments}
In this section, we compare the experimental results of LfD and LfO on various Mujoco tasks ranging from toy tasks (\emph{e.g.,} InvertedPendulum-v2) to complicated ones (\emph{e.g.,} Humanoid-v2) in the OpenAI Gym \cite{brockman2016openai}. All of these environments satisfy Assumption \ref{assum:samedynamics} and Lemmas \ref{lemma:dynamics}-\ref{lemma:lagrange}, which indicates that they are deterministic robot locomotion tasks. We also provide some conjectures on the ``performance gap'', \emph{i.e.}, the factors that may lead to the performance gap.
\subsection{Setup}
In this paper, we use OpenAI Mujoco tasks (\emph{e.g.,} InvertedPendulum-v2 and Humanoid-v2) for our experiments, which are continuous deterministic robot locomotion tasks.
Specifically, the observation and action dimensions for InvertedPendulum-v2 are $4$ and $1$, respectively. Humanoid-v2 has 376-dimensional observation and 17-dimensional action. To generate the expert data, we first train an expert policy using the reinforcement learning (RL) algorithm SAC \cite{haarnoja2018soft}; then we execute the policy deterministically in the environment to collect expert trajectories composed of state transition tuples or state-action pairs. Each trajectory consists of 1000 state transitions or state-action pairs. \pa
As for the implementation of GAIfO and GAIL, we follow the implementation of GAIL in the OpenAI Baselines \cite{dhariwal2017baselines} and implement the GAIfO consequently. Following \cite{dhariwal2017baselines}, we use the RL algorithm TRPO \cite{schulman2015trust} to serve as the generator.
Commonly used hyper-parameters are as follows: the hidden size for all networks is $(100,100)$ and we use $tanh$ as the activation function; the learning rate for the discriminator is $3 \times 10^{-4}$ while that for the value network is $1 \times 10^{-3}$; the ratio between the update of the generator network and discriminator network is set to $3:1$. We only give the hidden layer size of neural networks since the input layer and output layer size varies in different environments. The input size of GAIL is defined by $(s,a)$ whereas that in GAIfO is determined by $(s,s')$, which distinguishes the discriminators in GAIL and GAIfO. More details are in the Appendix.
\begin{figure*}[htbp]
\centering
\subfigure[InvertedPendulum-v2]{
\includegraphics[width=0.3\textwidth]{InvertedPendulumA.pdf}
}
\subfigure[Hopper-v2]{
\includegraphics[width=0.3\textwidth]{HopperA.pdf}
}
\subfigure[Walker2d-v2]{
\includegraphics[width=0.3\textwidth]{WalkerA.pdf}
}
\subfigure[HalfCheetah-v2]{
\includegraphics[width=0.3\textwidth]{HalfCheetahAnew.pdf}
}
\subfigure[Humanoid-v2]{
\includegraphics[width=0.3\textwidth]{HumanoidAnew.pdf}
}
\subfigure[HumanoidStandup-v2]{
\includegraphics[width=0.3\textwidth]{HumanoidStandupA.pdf}
}
\caption{Performance of each approach on MuJoCo tasks. Performance is measured with average episode return and x-axis stands for time steps interacting with the environment. Each algorithm is evaluated with 5 random seeds.}
\label{learningcurve}
\end{figure*}
\begin{table*}[h!]
\centering
\caption{Environments and overall performances of compared algorithms. The numbers before and after the plus or minus symbol are average episode reward and standard error, respectively.}
\label{table2}
\centering
\begin{tabular}{c c c c}
\hline
Environment & Expert & GAIL & GAIfO\\
\hline
InvertedPendulum-v2 & 1000.0$\pm$0.0 & 995.4$\pm$9.2 & 992.7$\pm$13.1 \\
Hopper-v2 & 3491.8$\pm$37.3 & 3229.6$\pm$221.6 & 3251.6$\pm$195.5\\
Walker2d-v2 & 3999.6$\pm$10.5 & 3600.9$\pm$201.2 & 3731.3$\pm$424.8\\
HalfCheetah-v2 & 4993.4$\pm$65.0 & 3270.4$\pm$458.6 & 3381.6$\pm$202.8 \\
Humanoid-v2 & 5600.4$\pm$10.0 & 4764.8$\pm$227.0 & 4896.9$\pm$507.1\\
HumanoidStandup-v2 & 155525.8$\pm$2179.9 & 151093.4$\pm$2672.0 & 152898.4$\pm$1333.7\\
\hline
\end{tabular}
\end{table*}
\subsection{Results}
In this subsection, we provide the qualitative and quantitative results of GAIL and GAIfO on MuJoCo tasks, which are shown in Fig. \ref{learningcurve} and Tab. \ref{table2}. Each task is trained with 5 random seeds and the episode cumulative reward is employed to evaluate the performance of both methods. All the other settings, including the hyper-parameters, are kept the same for fair comparisons. More details are presented in the Appendix.
In Fig. \ref{learningcurve}, the mean and the standard deviation of the episode cumulative rewards are illustrated with a solid line and shaded area, respectively, while the numerical results for the expert, GAIL, and GAIfO are listed in Tab. \ref{table2}. From Fig. \ref{learningcurve} and Tab. \ref{table2}, it is clear that (1) both LfD and LfO can achieve the expert-level performance at the end of training; (2) LfO could achieve comparative performance to LfD, \emph{i.e.}, no performance gap between LfO and LfD is noticed. In addition, we adopt a third party open-sourced implementation of GAIL and GAIfO to validate their performance \cite{ota2020tf2rl}, whose learning curves are similar to ours and are presented in the Appendix. \par
In summary, in deterministic robot tasks, LfO is almost equivalent to LfD, which further confirms our theoretical finding in Theorem \ref{theorem1}.
\subsection{Discussion and Suggestions}
In this subsection, we aim to provide some conjectures and discussions on why previous studies hold the point that there exists a performance gap between LfD and LfO. As far as we are concerned, two factors may affect the performance of LfO and LfD.
\begin{itemize}
\item [1)]
It's well known that current reinforcement learning strategies are comparatively unstable and require elaborate implementation of the algorithms \cite{henderson2017deep,hutson2018artificial, dasagi2019ctrl}. Theorem \ref{theorem1} and Corollary \ref{corollary1} demonstrates that the optimizing targets for LfD and LfO in deterministic robot environments or robot environments with bounded randomness remain almost same, which proves that there would be almost no performance gap. However, in practice, many implementation factors may affect the final performance of these algorithms. Evidently, LfO is more difficult than LfD, since it needs to predict the right action from the expert trajectories. Thus, LfO is more likely to converge at a local optima compared to LfD if some implementation tricks in reinforcement learning or deep learning are not employed.
Specifically, the input normalization for the policy and value network plays a very important role among them. To illustrate the importance of input normalization, we further conduct an ablation experiment by training LfO with/without input normalization. As can be seen in Fig. \ref{discussion}, it is clear that the performance is boosted with input normalization. Though this technique helps improve the performance, it does not affect the core of LfO.
\item [2)]
Another possible reason is that the performance of LfO might be affected by the training instability of GAN \cite{gulrajani2017improved, zhang2019consistency}, since the exploration in LfO is more difficult than that in LfD. Suffering from the training problems of GAN (\emph{e.g.,} vanishing gradients, model collapse, \emph{etc.}), LfO may get stuck at a local optima and perform poorly. To further confirm this point and take full advantage of LfO, we adopt Spectral Normalization \cite{miyato2018spectral}, which is a commonly used technique to stabilize the GAN training. As shown in Fig. \ref{discussion}, after introducing Spectral Normalization, the performance of LfO and LfD are improved. The introduction of spectral normalization does not change the optimizing target and just helps stabilize the training process.
\end{itemize}\par
In summary, we believe that the performance gap previously reported might be caused by implementation details or training un-stability rather than the inverse dynamics disagreement. Our theoretical analysis and experiments suggest that LfO is almost equivalent to LfD. To further promote research, we will open source our code and dataset to help the reproducibility.
\begin{figure}[htbp]
\centering
\subfigure[Input Noramlization]{
\includegraphics[width=0.4\textwidth]{InputNormAnew2.pdf}
}
\subfigure[Spectral Normalization]{
\includegraphics[width=0.4\textwidth]{SpectralNormAnew.pdf}
}
\caption{Impact of input normalization and spectral normalization on LfO and LfD. The performance measurement criterion is same as described in Fig \ref{learningcurve}. In (a), we test the impact of input normalization on GAIL and GAIfO in Humanoid-v2, in which GAIL and GAIfO uses input normalization in their policy and value networks while GAILw/oIN and GAIfOw/oIN do not; In (b), the learning curves of GAIL and GAIfO against their spectral noramlizaed versions GAIL-sn and GAIfO-sn in HalfCheetah-v2 are presented.}
\label{discussion}
\end{figure}
\section{Conclusions}
In this paper, we delve into the difference between LfD and LfO specifically from two algorithms, GAIL and GAIfO, which are the two most commonly used imitation learning algorithms. From the perspective of control theory and inverse dynamics model, we prove that, for deterministic robot systems, the performance gap between LfO and LfD approaches zero, \emph{i.e.}, the almost equivalence between LfO and LfD is proved. To further relax the deterministic constraint and better adapt to the environment in practice, we consider the bounded randomness in the robot environment and prove that the optimizing targets for LfD and LfO remain almost same in a more generalized setting, which paves the way for the application of LfO in real-world. In other words, LfO is almost equivalent to LfD in deterministic robot environments or robot environments with bounded randomness. Extensive experiments on OpenAI MuJoCo tasks are conducted and empirically demonstrate that LfO achieves comparable performance to LfD.
Based on our studies, we provide the state-of-the-art implementation of GAIfO with the code and dataset open-sourced, which are beneficial for the imitation learning community. Our analysis gives a deep insight into imitation learning from observation and will for certain promote the applicability of LfO in real-world robot tasks. Future work would focus on the analysis of the difficulty for finding the right action with given state transitions for LfO.
\section{Ethics}
Like most imitation learning algorithms, generative adversarial imitation learning discussed in our paper has the potential to be applied in industrial production and robots for daily life. But applying the algorithms in the researches of artificial intelligence to real-world applications is not an easy task. Our work extends the possible application areas of imitation learning, and to some extent, our theoretical results mitigate the obstacles for employing imitation learning methods in reality. Since these learning methods do not require humans to intervene, if they are successfully applied in practice fewer workers will be needed. For example, the stable walking of Atlas robot in Boston Dynamics is achieved with the efforts from many engineers who work on control, planning, and perception. If imitation learning algorithms could be employed to teach Atlas to walk like humans, Boston Dynamics would not need to hire so many engineers. However, on the other hand, imitation learning can help increase industrial productivity and reduce production costs simultaneously, which will create large social values that most people can benefit from.
\bibliographystyle{ieee_fullname}
| {'timestamp': '2020-10-19T02:16:01', 'yymm': '2010', 'arxiv_id': '2010.08353', 'language': 'en', 'url': 'https://arxiv.org/abs/2010.08353'} | arxiv |
\section{Introduction}
Impersonation is where (sometimes malicious) users create social media accounts mimicking a legitimate account \cite{kooshaDeep}.
Fr example, impersonators or imposters maybe accounts that pretend to be someone popular or a representative of a known brand, company, \emph{etc. }\xspace{}
Such impersonators are found on all major social media platforms. Instagram is widely used by celebrities, influencers, businesses, and public figures with different levels of popularity.
Although many impersonators may be innocuous, there also exists malicious fake accounts. These often have clear plans, where they make accounts appear more popular than they are, produce pre-planned untrustworthy content, perform brand abuse or generate fake engagement \cite{zarei2020impersonators}.
Therefore several lawsuits have taken place in the United State (along with other countries), where criminal impersonation is a crime. It involves assuming a false identity with the intent to defraud another or pretending to be a representative of another person or organisation \cite{impersonaionlaw}.
However, identifying such activities is often slow and laborious --- hence, developing techniques for automated detection would have real value to social media companies. In this paper, we aim to identify impersonator-generated content in Instagram. Towards that end, we pick three different and important communities with verified genuine accounts inside each. Through the pool of collected public content, by using the methodology presented in \cite{Zare1910:Typification}, we identify a set of 2.2K impersonator accounts. Next, by using unsupervised learning techniques, we find two notable clusters: ({\em i}\/){} `\textit{Cluster 0 - Bots}' that represent bot entities, and ({\em ii}\/){} `\textit{Cluster 2 - Fans}' which represent fan entities.
In this study, bots are fake accounts or social bots that tend to mimic the real user and accomplish a specific purpose \cite{grimme2017social} and interacts with humans on social media \cite{Ferrara:2016:RSB:2963119.2818717}.
In contrast, fans are (semi-) human-operated accounts that are created and maintained by a fan or devotee about a celebrity, thing or particular phenomenon.
We then use these clusters to create necessary labels for building and training a Deep Neural Network to predict post types: ({\em i}\/){} bot-generated, ({\em ii}\/){} fan-generated, or ({\em iii}\/){} genuine content.
The contribution of this study can be summarised as follow:
\begin{itemize}
\item We assemble a novel dataset containing the content and activities of impersonators in three leading communities: Politicians, Sport Starts and Musicians.
\item We present a practical approach to cluster impersonators and generate content labels based on profile characteristics and user behaviours.
\item We propose a Deep Neural Network architecture in order to detect and predict impersonator-generated posts and genuine content.
\end{itemize}
\vspace{-0.2cm}
\section{Methodology \& Dataset}
\label{data_collection}
\subsection{Definition and Taxonomy}\label{impersonator_taxonomy}
\pb{Bots:} are (semi-) automatic agents that are designed to accomplish a specific purpose \cite{grimme2017social} and automatically produce content and interacts with humans on social media \cite{Ferrara:2016:RSB:2963119.2818717}. Bots are normally defined with the condition of mimicking human behaviour \cite{stieglitz2017social}.
\pb{Impersonator or Imposter:} is someone on social media who builds a profile using the information of another legitimate account and pretends to be that entity or copies the behaviour/actions of that profile \cite{zarei2020impersonators}.
\pb{Profile Similarity:} We use this term to indicate whether there is any similarity or correlation between two Instagram profiles. Similarity can be in ({\em i}\/){} text features \cite{10.1007/978-3-642-41278-3_74} such as username, full name, or biography \emph{e.g. }\xspace{} `\textit{@barackobama}' and `\textit{@barack\_\_obama}', or ({\em ii}\/){} profile photos (if the same person exists in both photos). The `\textit{Similarity Level}' could be high (similar in all metrics), low (just in one metric), or between. An example of the genuine Theresa May account and her impersonator with a high degree of similarity is shown in Figure \ref{fig_impersonator_example}.
In \cite{kooshaDeep} \cite{Zare1910:Typification} we introduced the problem of impersonation and discussed the identification methods. Then, we uncovered unknown groups of impersonators and examined their behaviours. For example, fan pages have a higher number of followers and are completely public pages. But bots, have very fewer followers and publish a lot of posts in a shorter period of time. Then, in \cite{zarei2020impersonators} we studied the comments they generated under the post of genuine figures in details. For example, bots produce much higher duplicated comments than others and give likes (passive reaction) faster.
Eventually, in this study, we divide impersonators into two broad types of public accounts:
(1) \textbf{Bot Impersonator (Bot)}: these public fake accounts or social bots tend to mimic the real user and generally generate specific content.
First, from profile characteristics, bots are usually simple accounts that use default Instagram settings: no full name, no biography, and sometimes no profile photos. The follower count is low and they follow a lot of other accounts.
From similarity viewpoint (compared to a genuine user), bots have weak profile similarity degrees: they have no similar profile photo and have low similarity in username, full name, or biography.
From activity viewpoint, bots receive very limited engagement (like or comment) per post, are lazy in publishing stories, are so active in giving comments and likes to others, and the rate of issuing duplicated comments is high.
Existing bots vary in sophistication. Some bots are very simple and merely re-publish posts, whereas others are sophisticated and can even interact with human users or post comment.
In this study, `\textit{Bot Impersonator}' and '\textit{bot}' terms are interchangeable.
(2) \textbf{Fan Impersonator (Fan)}: is a (semi-) human-operated account that is created and maintained by a fan or devotee about a celebrity, thing or particular phenomenon.
From profile perspective, fans have a greater follower number than bots, are completely public accounts, have a biography, and usually use a URL.
From impersonation viewpoint, fans have higher profile similarity in photo, username, full name, and biography metrics.
From behaviour viewpoint, fans are interested in publishing posts and stories, are more productive than bots, receive higher engagement within their posts (both like and comment), and the owner barely shares self-generated content.
From managing viewpoint (who controls the page), we can divide fans into two different types (Figure \ref{fig_impersonator_taxonomy}):
({\em i}\/){} A fan page which is regulated by `human'. In this situation, there is no automation movement and all content and activities are published by a human.
({\em ii}\/){} A fan page which is regulated by `human and bot'. In this type, page owner which is a human usually use some automation and bot services to gain attention. For example, using a bot to comment or like on related pages.
\subsection{Case Study Accounts}\label{case_studies}
To seed our analysis, we select a set of 15 ground-truth verified accounts from three communities: \textit{politicians}, \textit{sports stars}, and \textit{musicians (celebrities)}.
We pick these communities to compare the impersonation problem in divided societies. For each community, we select the top 5 most popular verified accounts manually, then we confirm the popularity by \cite{hypeauditor}:
\textbf{\textit{Politicians:}} Donald J. Trump (\textit{@realdonaldtrump}), Barack Obama (\textit{@barackobama}), Emmanuel Macron (\textit{@emmanuelmacron}), Boris Johnson (\textit{@borisjohnsonuk}), and Theresa May (\textit{@theresamay}).
\textbf{\textit{Sports Stars:}} Leo Messi (\textit{@leomessi}), Cristiano Ronaldo (\textit{@cristiano}), Rafael Nadal (\textit{@rafaelnadal}), Roger Federer (\textit{@rogerfederer}), and Novak Djokovic (\textit{@djokernole}).
\textbf{\textit{Musicians:}} Lady Gaga (\textit{@ladygaga}), Beyonce (\textit{@beyonce}), Taylor Swift (\textit{@taylorswift}), Adele (\textit{@adele}), and Madonna (\textit{@madonna}).
\begin{table}[h!]
\vspace{-0.25cm}
\centering
\caption{Use Cases and Corresponding Hashtags}
\vspace{-0.22cm}
\label{tbl_dataset_hashtags}
\resizebox{\columnwidth}{!}
\begin{tabular}{ll|ll|ll}
\multicolumn{2}{c}{\textbf{Politician}} & \multicolumn{2}{c}{\textbf{Sports Stars}} & \multicolumn{2}{c}{\textbf{Musician}} \\ \hline
\multicolumn{1}{l}{D. Trump} & \textit{\#donaldtrump} & L. Messi & \textit{\#leomessi} & L. Gaga & \multicolumn{1}{l}{\textit{\#ladygaga}} \\
\multicolumn{1}{l}{B. Obama} & \textit{\#barackobama} & C. Ronaldo & \textit{\#cristianoronaldo} & Beyonce & \multicolumn{1}{l}{\textit{\#beyonce}} \\
\multicolumn{1}{l}{E. Macron} & \textit{\#emmanuelmacron} & R. Federer & \textit{\#rogerfederer} & T. Swift & \multicolumn{1}{l}{\textit{\#taylorswift}} \\
\multicolumn{1}{l}{B. Johnson} & \textit{\#borisjohnson} & R. Nadal & \textit{\#rafaelnadal} & Madonna & \multicolumn{1}{l}{\textit{\#madonna}} \\
\multicolumn{1}{l}{T. May} & \textit{\#theresamay} & N. Djokovic & \textit{\#novakdjokovic} & Adele & \multicolumn{1}{l}{\textit{\#adele}} \\ \hline
\end{tabular}
}
\vspace{-0.35cm}
\end{table}
\subsection{Data Collection} \label{s:dataset_subsection}
\pb{Genuine Accounts:} First, we collect posts of our 15 genuine case studies (listed in section
``\ref{case_studies}") which are published between October 2018 and January 2020. Posts contain publicly available information including caption, hashtags, image/video, number of likes, number of comments, location, time, and tagged list. 1.3K posts across the three communities has been collected during the campaign. We use the crawler presented in \cite{kooshaDeep}.
\begin{figure}[t!]
\vspace{-0.3cm}
\centerline
{\includegraphics[width=0.42\textwidth]{Figures/impersonator_sample.jpg}}
\vspace{-0.2cm}
\caption{Identifying Impersonators through profile similarity.}
\label{fig_impersonator_example}
\vspace{-0.5cm}
\end{figure}
\pb{Identifying Impersonators:}\label{impersonator_detection}
To obtain a set of impersonators, we configure a crawler to collect public posts that contain associated hashtag with the name of each account (Table \ref{tbl_dataset_hashtags}) between September 2019 and January 2020. For example, in Trump, we gather posts include the \textit{\#donaldtrump} tag.
Next, based on the methodology that we presented in~\cite{kooshaDeep}, we measure the profile similarity of the publishers to identify impersonators across case studies.
The methodology is based on the Instagram profile similarity and we consider major profile metrics such as \textit{username (text), full name (text), biography (text), profile photo (image), follower count, followee count, media count, and account age}.
({\em i}\/){} For text metrics, we use the Cosine Similarity technique \cite{10.1007/978-3-642-41278-3_74} and we define the minimum threshold to 30\%. ({\em ii}\/){} To measure the photo similarity, we use a convolutional neural network face detection in \cite{FaceRecognitionLib}. We compare the face of all accounts (if exist) to the face of the genuine users (\emph{e.g. }\xspace{} R. Federer) and if the same person is detected, we mark it as similar photos.
Eventually, if an account has at least 30\% similarity in one of the text metrics or has a similar profile photo, we consider it as an impersonator. Otherwise, it is a non-similar account (\emph{not} impersonator) and we exclude it from the dataset.
In total, we discover 1.6K impersonators with different levels of similarity.
\pb{Followers/Followees:} We next crawl the follower and followee list of each impersonator from the previous phase (October 2018 to January 2020). As it is infeasible to collect \emph{all} followers/followees, we define a limitation of 1K for followers and 500 for followees. At the same time, we examined the profile similarity of them to see if they are impersonator or not. Finally, we have 2.3K impersonators.
\pb{Posts:} We crawled the 50 most recent posts published by the impersonator. Furthermore, we gather impersonators' ({\em i}\/){} profile information, ({\em ii}\/){} number of comments received on posts, and ({\em iii}\/){} number of likes attracted on posts. This task was running simultaneously between October 2018 and January 2020.
\pb{Validation:} We finally manually inspect the profiles of the impersonators to confirm they are impersonators. We filter any incorrectly identified impersonators alongside their posts. 36 Impersonators were identified incorrectly (1.5\% of the total population), and 42 accounts (1.8\%) change the application of the page or sell their account at some point during the measurement period.
In total, we obtain nearly 68K comments and 90K likes from 10K posts of 2.2K impersonators (Table \ref{tbl_dataset_summary}).
\begin{table}[h!]
\vspace{-0.35cm}
\centering
\caption{Summary of Dataset}
\vspace{-0.2cm}
\label{tbl_dataset_summary}
\scalebox{1}{
\begin{tabular}{lrrrr}
\hline
\textbf{Community} & \textbf{Imposter} & \textbf{post} & \textbf{comment} & \textbf{like} \\ \hline
Politician & 36\% & 30\% & 36\% & 35\% \\
Sport player & 34\% & 30\% & 34\% & 40\% \\
Musician & 30\% & 40\% & 30\% & 25\% \\ \hline
\textbf{Total} & \textbf{2.2K} & \textbf{10K} & \textbf{68K} & \textbf{90K}
\end{tabular}
}
\vspace{-0.4cm}
\end{table}
\pb{Ethics:} In line with Instagram policies and ethical consideration on user privacy defined by the community, we only collect publicly available data through public API excluding any potentially sensitive data.
\subsection{Data Pre-Processing}\label{text_pre_proce_sec}
\pb{Pre-Processing} Some features require pre-processing: ({\em i}\/){} For caption and Profile Biography, we remove all punctuation marks, stopwords and convert them to lowercase characters. We then filter words that contain fewer than three characters, and words are stemmed to reduce to their root forms.
({\em ii}\/){} We then remove and covert all emojis and emoticons to word format. Then we replace URLs with `website', emails with `email', new lines with `line', and phone numbers with `phones'.
({\em iii}\/){} We break down each Hashtag and Username into its constituent words, \emph{e.g. }\xspace ``\textit{makeamericagreatagain}" contains 4 meaningful words: ``make", ``america", ``great", and ``again" \cite{wninja}.
({\em iv}\/){} From posts and profile biographies, we extract hashtags (\#) and mentions (@) into separated lists.
({\em v}\/){} Wherever possible, we extract the text from post image thumbnail using Tesseract OCR \cite{10.5555/1304596.1304846} and apply text pre-processing steps.
The spaCy \cite{spacy2} is used for French Language Modeling.
\section{Who are Impersonators?}
\label{identification}
We start by making some primary analysis. Table \ref{tbl_imp_vs_real} presents some of the fundamental differences between real accounts and impersonators.
Impersonators tend to have few followers, but they follow many others. Normally, they do this to develop a network of relevant accounts (other impersonators) and increase their followers. Also, impersonators have a lower engagement rate.
\begin{table}[t!]
\centering
\caption{Real Accounts vs. Impersonators}
\vspace{-0.2cm}
\label{tbl_imp_vs_real}
\scalebox{0.75}{
\begin{tabular}{lrr|rr|rr|rr}
& \multicolumn{2}{c}{\textbf{follower}} & \multicolumn{2}{c}{\textbf{followee}} & \multicolumn{2}{r}{\textbf{\begin{tabular}[c]{@{}r@{}}avg. \#comment \\ per post\end{tabular}}} & \multicolumn{2}{r}{\textbf{\begin{tabular}[c]{@{}r@{}}avg. \#like\\ per post\end{tabular}}} \\ \cline{2-9}
\multirow{-2}{*}{\textit{\textbf{use case}}} & \textit{\begin{tabular}[c]{@{}r@{}}Imp\\ (avg)\end{tabular}} & \textit{\begin{tabular}[c]{@{}r@{}}real\\ account\end{tabular}} & \textit{\begin{tabular}[c]{@{}r@{}}Imp\\ (avg)\end{tabular}} & \textit{\begin{tabular}[c]{@{}r@{}}real\\ account\end{tabular}} & \textit{Imp} & \textit{\begin{tabular}[c]{@{}r@{}}real\\ account\end{tabular}} & \textit{Imp} & \textit{\begin{tabular}[c]{@{}r@{}}real\\ account\end{tabular}} \\ \hline
\multicolumn{1}{l|}{\textit{\textbf{D. Trump}}} & {\color[HTML]{680100} 528} & {\color[HTML]{036400} 16M} & {\color[HTML]{680100} 1.1K} & {\color[HTML]{036400} 8} & {\color[HTML]{680100} 27.14} & {\color[HTML]{036400} 19.5K} & {\color[HTML]{680100} 690.14} & {\color[HTML]{036400} 340K} \\
\multicolumn{1}{l|}{\textit{\textbf{B. Obama}}} & {\color[HTML]{680100} 256} & {\color[HTML]{036400} 2.5M} & {\color[HTML]{680100} 446} & {\color[HTML]{036400} 14} & {\color[HTML]{680100} 40.00} & {\color[HTML]{036400} 13.5K} & {\color[HTML]{680100} 1.4K} & {\color[HTML]{036400} 1M} \\
\multicolumn{1}{l|}{\textit{\textbf{E. Macron}}} & {\color[HTML]{680100} 435} & {\color[HTML]{036400} 1.5M} & {\color[HTML]{680100} 738} & {\color[HTML]{036400} 91} & {\color[HTML]{680100} 12.45} & {\color[HTML]{036400} 3.8K} & {\color[HTML]{680100} 302.03} & {\color[HTML]{036400} 65K} \\
\multicolumn{1}{l|}{\textit{\textbf{B. Johnson}}} & {\color[HTML]{680100} 431} & {\color[HTML]{036400} 367K} & {\color[HTML]{680100} 318} & {\color[HTML]{036400} 254} & {\color[HTML]{680100} 11.78} & {\color[HTML]{036400} 600} & {\color[HTML]{680100} 274.14} & {\color[HTML]{036400} 15K} \\
\multicolumn{1}{l|}{\textit{\textbf{T. May}}} & {\color[HTML]{680100} 312} & {\color[HTML]{036400} 157K} & {\color[HTML]{680100} 253} & {\color[HTML]{036400} 1} & {\color[HTML]{680100} 2.21} & {\color[HTML]{036400} 350} & {\color[HTML]{680100} 54.25} & {\color[HTML]{036400} 5.6K} \\ \hline
\multicolumn{1}{l|}{\textit{\textbf{Ch. Ronaldo}}} & {\color[HTML]{680100} 432} & {\color[HTML]{036400} 197M} & {\color[HTML]{680100} 832} & {\color[HTML]{036400} 445} & {\color[HTML]{680100} 12.16} & {\color[HTML]{036400} 35K} & {\color[HTML]{680100} 1.6K} & {\color[HTML]{036400} 5.5M} \\
\multicolumn{1}{l|}{\textit{\textbf{L. Messi}}} & {\color[HTML]{680100} 447} & {\color[HTML]{036400} 140M} & {\color[HTML]{680100} 650} & {\color[HTML]{036400} 227} & {\color[HTML]{680100} 13.08} & {\color[HTML]{036400} 28K} & {\color[HTML]{680100} 2.8K} & {\color[HTML]{036400} 4.1M} \\
\multicolumn{1}{l|}{\textit{\textbf{R. Nadal}}} & {\color[HTML]{680100} 121} & {\color[HTML]{036400} 8.4M} & {\color[HTML]{680100} 513} & {\color[HTML]{036400} 65} & {\color[HTML]{680100} 12.17} & {\color[HTML]{036400} 2.5K} & {\color[HTML]{680100} 768.23} & {\color[HTML]{036400} 290K} \\
\multicolumn{1}{l|}{\textit{\textbf{R. Federer}}} & {\color[HTML]{680100} 189} & {\color[HTML]{036400} 7.1M} & {\color[HTML]{680100} 479} & {\color[HTML]{036400} 71} & {\color[HTML]{680100} 9.45} & {\color[HTML]{036400} 2.9K} & {\color[HTML]{680100} 670.12} & {\color[HTML]{036400} 400K} \\
\multicolumn{1}{l|}{\textit{\textbf{N. Djokovic}}} & {\color[HTML]{680100} 148} & {\color[HTML]{036400} 6.6M} & {\color[HTML]{680100} 236} & {\color[HTML]{036400} 777} & {\color[HTML]{680100} 6.67} & {\color[HTML]{036400} 1.5K} & {\color[HTML]{680100} 320.05} & {\color[HTML]{036400} 220K} \\ \hline
\multicolumn{1}{l|}{\textit{\textbf{Lady Gaga}}} & {\color[HTML]{680100} 7.2K} & {\color[HTML]{036400} 39M} & {\color[HTML]{680100} 653} & {\color[HTML]{036400} 46} & {\color[HTML]{680100} 5.46} & {\color[HTML]{036400} 19.5K} & {\color[HTML]{680100} 219.46} & {\color[HTML]{036400} 1.1M} \\
\multicolumn{1}{l|}{\textit{\textbf{Beyonce}}} & {\color[HTML]{680100} 130} & {\color[HTML]{036400} 138M} & {\color[HTML]{680100} 701} & {\color[HTML]{036400} 0} & {\color[HTML]{680100} 3.92} & {\color[HTML]{036400} 25.8K} & {\color[HTML]{680100} 353.18} & {\color[HTML]{036400} 2.9M} \\
\multicolumn{1}{l|}{\textit{\textbf{Taylor Swift}}} & {\color[HTML]{680100} 2.4K} & {\color[HTML]{036400} 125M} & {\color[HTML]{680100} 1.3K} & {\color[HTML]{036400} 0} & {\color[HTML]{680100} 4.84} & {\color[HTML]{036400} 0.0$^{\mathrm{\textbf{*}}}$} & {\color[HTML]{680100} 177.83} & {\color[HTML]{036400} 1.8M} \\
\multicolumn{1}{l|}{\textit{\textbf{Adele}}} & {\color[HTML]{680100} 5.3K} & {\color[HTML]{036400} 33M} & {\color[HTML]{680100} 459} & {\color[HTML]{036400} 0} & {\color[HTML]{680100} 3.76} & {\color[HTML]{036400} 12.7K} & {\color[HTML]{680100} 291.15} & {\color[HTML]{036400} 1.3M} \\
\multicolumn{1}{l|}{\textit{\textbf{Madonna}}} & {\color[HTML]{680100} 6.6K} & {\color[HTML]{036400} 14.7M} & {\color[HTML]{680100} 842} & {\color[HTML]{036400} 243} & {\color[HTML]{680100} 4.74} & {\color[HTML]{036400} 1.8K} & {\color[HTML]{680100} 134.45} & {\color[HTML]{036400} 98K} \\
\multicolumn{4}{c}
{$^{\mathrm{\textbf{*}}}$T. Swift disabled comments.}
\end{tabular}%
}
\vspace{-0.5cm}
\end{table}
\begin{figure}[htbp]
\vspace{-0.2cm}
\centerline
{\includegraphics[width=0.4\textwidth]{Figures/clustering_overview.jpg}}
\vspace{-0.2cm}
\caption{The process of discovering impersonators.}
\label{fig_clustering_overview}
\vspace{-0.3cm}
\end{figure}
\pb{Clustering. }
\label{clustering}
To find the potential hidden impersonators, we do clustering. The whole process is explained in Figure \ref{fig_clustering_overview}. First, we use the impersonator dataset from section \ref{data_collection} as input and based on profile characteristics and behaviour activities, we perform unsupervised learning.
We experiment with a number of clustering methods, including K-means, Gaussian Mixture Modeling, and Spectral Clustering, finding similar results.
Our feature list consist several features listed in Table \ref{table_clustering_features}.
This identifies two clusters (the optimal number is obtained from the Elbow Method). The two derived clusters are highly diverse in profile characteristics and publishing behaviour (Table \ref{table_dataset_cluster_characteristics}). For the rest of this study, results are based on the K-means algorithm.
Based on manual confirmation we match discovered clusters with types of impersonators defined in section \ref{impersonator_taxonomy}. Inspection of these clusters reveals two clear populations:
\begin{table}[h!]
\vspace{-0.3cm}
\centering
\caption{Clustering Feature Set.}
\vspace{-0.2cm}
\label{table_clustering_features}
\scalebox{1}{
\begin{tabular}{lll}
\hline
similarity username & avg received like & follower \\
similarity full name & avg hashtag length & followee \\
similarity biography & avg caption length & media count \\
similarity photo & avg received comment & private \\
external url & account age & verified \\
MSF$^{\mathrm{\textbf{*}}}$ & LSF$^{\mathrm{\textbf{*}}}$ & \\ \hline
\multicolumn{3}{c}
{$^{\mathrm{\textbf{*}}}$The most and least number of features that have similarity.
}
\end{tabular}
}
\vspace{-0.4cm}
\end{table}
\textbf{Cluster 0 - Bot}: We believe this cluster captures bot entities (Section ``\ref{impersonator_taxonomy}") that exist to achieve specific tasks. In this study, bots are fake entities that are programmed to publish pre-defined content as posts, use a particular network of hashtags, and target specific issues.
Bots have a quite low similarity in all profile metrics (less than 20\%) and the number of followers is almost 6 times fewer than fans (Table \ref{table_dataset_cluster_characteristics}). However, the rate of post-distribution is higher in bots.
One of the important metrics is the received attention per post (passive or active) and bots earned nearly half of fans (almost 10 comments and 770 likes).
\textbf{Cluster 1 - Fan}: Based on assessing characteristics, we acknowledge that this cluster represents Fans.
Fans spread content regarding a genuine figure (in favour of or against). There is nearly 50\% similarity in the username, 40\% in the full name, 20\% in biography, and 70\% similarity in profile photos. Moreover, they hold similarity at most in 3 metrics. The number of followers is higher than the bots (avg. 101.6K vs. 16.5K) and on average, each post got 24 comments and nearly 1.6K likes (Table \ref{table_dataset_cluster_characteristics}).
\begin{table}[h!]
\vspace{-0.3cm}
\caption{Characteristics of the clusters.}
\begin{center}
\vspace{-0.3cm}
\scalebox{0.85}{
\begin{tabular}{lrr}
\hline
\textbf{Metrics} & \textbf{Fans} & \textbf{Bots} \\ \hline
avg. username similarity per imp* & \textbf{0.49} & 0.13 \\
avg. full\_name similarity per imp & \textbf{0.40} & 0.18 \\
avg. bio similarity per imp & 0.25 & 0.18 \\
avg. photo similarity per imp & \textbf{0.71} & 0.17 \\
the Least number of features that have similarity & 1 & 1 \\
the Most number of features that have similarity & 3.32 & 1.53 \\
avg. follower per imp & \textbf{101.6K} & 16.5K \\
avg. followee per imp & 757 & 927 \\
avg. media count per imp & \textbf{808} & 679 \\
avg. received comment per post & \textbf{24.15} & 10.01 \\
avg. received like per post & \textbf{1.6K} & 774 \\ \hline
\multicolumn{1}{c}
{$^{\mathrm{\textbf{*}}}$Impersonator}
\end{tabular}
}
\end{center}
\label{table_dataset_cluster_characteristics}
\vspace{-0.5cm}
\end{table}
\pb{Manual inspection for validation.}
\label{validation}
To validate the correctness of the proposed clustering, from each cluster we pick 80\% of profiles and check each one manually. Based on the definitions (Section \ref{impersonator_taxonomy}), 112 accounts were identified incorrectly. As we were not sure if those accounts represent a bot character or a fan entity, we recognized them as outliers and excluded from the clusters. The rest of this study is based on these validated impersonators.
\begin{figure*}[t!]
\vspace{-0.2cm}
\centerline
{\includegraphics[width=0.7\textwidth]{Figures/dnn_architecture.jpg}}
\vspace{-0.28cm}
\caption{The proposed Deep Neural Network architecture to detect impersonator content.}
\label{fig_dnn_architecture}
\vspace{-0.5cm}
\end{figure*}
\section{Identifying Impersonator Content}\label{classifier}
We next exploit the above dataset to explore the possibility of automatically identifying impersonator posts.
We believe that a bot, as a fake identity, also produces untrustworthy content and fake engagements. Likewise, fan pages, in some cases may distribute fake content \emph{e.g. }\xspace{}a political fan page may publish rumours.
So, we use the labelled data from the previous section and present a DNN classifier to distinguish content types. This classifier can predict whether a post is impersonator-generated (fan or bot) or genuine-generated.
Note that we do not consider the question of classifying the veracity of information shared by the accounts.
\subsection{Data Preparation}
\pb{Dataset Overview.} For classification, we use the post dataset obtained after clustering which is described in Section \ref{data_collection}. This dataset consists of 10K post from 2.2K impersonators across 3 communities.
Since we conduct manual annotation of impersonators, we are confident that posts are labelled correctly (pre-processing steps are discussed in Section \ref{s:dataset_subsection}).
\pb{Over-Sampling. }
Our dataset is highly unbalanced:
31\% genuine, 45\% fan-generated, and 34\% bot-generated post content.
To solve this problem, we use the combination of Synthetic Minority Over-sampling Technique (SMOTE) \cite{Chawla_2002} and Random Under-sampling algorithm \cite{JMLR:v18:16-365}. So, we produce similar examples from the minor class to increase the total number and, meanwhile, we under-sample the major class and randomly remove some samples. The final dataset contains an equal amount of samples from class types.
This helps us to increase the final accuracy by 8.5\%.
\begin{table}[h!]
\vspace{-0.2cm}
\centering
\caption{Feature Set used in Deep Neural Network. }
\vspace{-0.2cm}
\label{table_feature_engineering}
\scalebox{0.75}{
\begin{tabular}{llll}
\hline
\multicolumn{2}{c}{\textbf{Post Features}} & \multicolumn{2}{c}{\textbf{Publisher Features}} \\ \hline
\textbf{Feature} & \multicolumn{1}{l|}{\textbf{Type}} & \textbf{Feature} & \textbf{Type} \\ \hline
caption text & \multicolumn{1}{l|}{\textit{text}} & similarity username & \textit{numeric} \\
caption topics (LDA) & \multicolumn{1}{l|}{\textit{text}} & similarity fullname & \textit{numeric} \\
post hashtag & \multicolumn{1}{l|}{\textit{text}} & similarity bio & \textit{numeric} \\
tagged users in post & \multicolumn{1}{l|}{\textit{text}} & profile biography & \textit{text} \\
like count & \multicolumn{1}{l|}{\textit{numeric}} & similarity photo & \textit{numeric} \\
comment count & \multicolumn{1}{l|}{\textit{numeric}} & follower/followee/post & \textit{numeric} \\
tagged users count & \multicolumn{1}{l|}{\textit{numeric}} & full name & \textit{text} \\
mention users count & \multicolumn{1}{l|}{numeric} & biography & \textit{text} \\
hashtag count & \multicolumn{1}{l|}{numeric} & username & \textit{text} \\
overall sentiment of caption & \multicolumn{1}{l|}{numeric} & following followers ratio \cite{Yang_2020} & \textit{numeric} \\
overall sentiment of hashtag & \multicolumn{1}{l|}{numeric} & followers posts ratio & \textit{numeric} \\
media type (image or video) & \multicolumn{1}{l|}{\textit{numeric}} & bio emoji count & \textit{numeric} \\
emoji count & \multicolumn{1}{l|}{\textit{numeric}} & bio hashtag count & \textit{numeric} \\
url/website exist & \multicolumn{1}{l|}{\textit{numeric}} & & \textit{numeric} \\
date & \multicolumn{1}{l|}{\textit{numeric}} & & \textit{} \\ \hline
\end{tabular}
}
\vspace{-0.4cm}
\end{table}
\pb{Feature Engineering.} We build a set of features from post metadata and profile metrics that help us to train the proper model (Table \ref{table_feature_engineering}). We break the feature list into two principal categories:
``\textit{post features}" which comprises all features that are obtained from the content of the post such as number of likes, the caption, \emph{etc. }\xspace{} And ``\textit{publisher features}" that are extracted from the profile of the publisher profile.
To prepare the feature set, we directly use some features such as numbers. However, some others are derived from the content. For example, the account age is taken from the date of the first post and the profile similarities are calculated previously in section \ref{impersonator_detection}.
Then, to do text vectorization, the caption text, user biography, and other text metrics are vectorized using Keras Tokenizer \cite{chollet2015keras} class with 30000 num\_words. This class allows vectorizing a text corpus, by turning each text into either a sequence of integers.
\pb{Proposed DNN Architecture.}
Then, we propose a Deep Neural Network architecture that exploits CNN, LSTM, BERT and Dence Layers to process post content and profile metadata (Figure \ref{fig_dnn_architecture}). The workflow is as follows:
(1) First, in the input layer, we extract and pre-process all features that are listed in Table \ref{table_feature_engineering}. This architecture accepts two inputs types: ({\em i}\/){} text content (\emph{e.g. }\xspace{} post caption, hashtags, profile bio) which we combine them into a single corpus. ({\em ii}\/){} the metadata features (\emph{e.g. }\xspace{} like, comment, follower, followee) that come from both profile and post content and then are transformed into a single vector.
(2) Next, to transform the text into a form amenable for processing, we adopt a pre-trained language model, Bidirectional Encoder Representations from Transformers (BERT) \cite{devlin2018bert}. This, results in an output vector by BERT (vectorized text) and then given as input to a CNN layer.
(3) Then, the tokenized output of the BERT layer passes through a Convolution Neural Networks. This network contains 1D CNN with ReLU activation function (and 128 filters and a kernel size of 6) followed by a Dropout Layer (value of 0.2) for regularization, then a 1D Pooling Layer.
(4) Then, ({\em i}\/){} the result of CNN layer connects to a LSTM layer which processes vectorized text data and outputs a single 32-dimensions vector that is then fed forward through a ReLU activated Dense layer of size 16. ({\em ii}\/){} Meanwhile, numerical metadata passes through a Dense Layer with ReLU activation of size 16.
(5) Finally, we concatenate the output of the text and metadata layers into a single vector (size 32) that is then fed forward through a Dense layer with ReLU activation function and then an Output Layer which forms the type of the post (bot, fan, genuine). We develop this model using Tensorflow and Keras Functional API \cite{chollet2015keras}.
We pick a random split of 75\% (training set) and 25\% (test set) and run with 10-Fold Cross-Validation. The Accuracy, Precision, Recall, and F1-Score results are listed in Table \ref{table_model_performance}. We compare the proposed classifier with a tradition Random Forest Classifier.
The traditional RF Classifiers give approximately 77\% in all metrics (text tokenized using TF-IDF).
First, we do classification using the proposed DNN architecture with only `post content' (CNN + LSTM), and we observe an increase in overall result by nearly 2\% (Accuracy 78\%).
Then we re-run the classifier with both `\textit{post content}' and `\textit{profile metadata}' (CNN + LSTM). This helps to improve by almost 4.5\% (Accuracy 83\%).
Finally, we add the BERT layer to our architecture (BERT + CNN + LSTM). This step additionally assists us to improve the overall efficiency by almost 4\%, and we achieve the accuracy of 86\% in detecting post type.
\begin{table}[h!]
\vspace{-0.25cm}
\centering
\caption{Performance of the proposed architecture}
\vspace{-0.2cm}
\label{table_model_performance}
\scalebox{0.8}{
\begin{tabular}{lrrrr}
\hline
\textbf{Model} & \textbf{Accuracy} & \textbf{Precision} & \textbf{Recall} & \textbf{F1} \\ \hline
Random Forest Classifier & 0.76 & 0.78 & 0.77 & 0.76 \\
Proposed DNN (post) & 0.78 & 0.79 & 0.76 & 0.78 \\
Proposed DNN (post + profile) & 0.83 & 0.82 & 0.83 & 0.82 \\
Proposed DNN (post + profile) + BERT & \textbf{0.86} & \textbf{0.85} & \textbf{0.86} & \textbf{0.85} \\ \hline
\end{tabular}
}
\vspace{-0.45cm}
\end{table}
\section{Conclusion}\label{future}
This study focuses on impersonators problem and the challenge of identifying the impersonator-generated content on Instagram. First, by the help of clustering we recognised two clusters and based on their characteristics, we clustered them as Fans and Bots. Then, in order to detect what do they publish, we introduced a DNN which can correctly classify posts as `bot-generated', `fan-generated', or `genuine' content.
The results of this study help community on better understanding the phenomena of bot-generated content in social media.
\bibliographystyle{unsrt}
| {'timestamp': '2020-10-19T02:19:24', 'yymm': '2010', 'arxiv_id': '2010.08438', 'language': 'en', 'url': 'https://arxiv.org/abs/2010.08438'} | arxiv |
\subsection{Evaluation}
\begin{table*}[h
\caption{Revenue of algorithms on triangular and thick-z distribution with $n = 5$ advertisers (higher is better). The budget for each advertiser is the number of ads $m$ divided by $n$, so the offline optimal always equals to $m$ (note: one can easily calculate CR by dividing the result by $m$). We present the average revenue ($\pm$ standard deviation) on $100$ samples from each distribution.}
\label{table:5byx}
\centering
\begin{tabular}{ccccccc}
\toprule
Distr. & Ads ($m$)
& YaoLearner~ & MSVV & Greedy & Fixed-training\\
\midrule
& $25$
& $17.15(\pm 0.09)$ & $17.16 (\pm 0.36)$ & $17.12 (\pm 1.47)$ &$17.14 (\pm 0.45)$ \\
Triangular & $50$
& $34.29(\pm 0.14)$ & $34.29 (\pm 0.45)$ & $33.71(\pm 1.94)$ &$34.36(\pm 0.85)$ \\
& $100$
& $68.64(\pm 0.20)$ & $68.65 (\pm 0.47)$ & $69.44(\pm 2.71)$ &$65.98(\pm 5.71)$ \\
\midrule
& $25$
& $17.76(\pm 0.09)$ & $18.01 (\pm 0.59)$ & $15.9 (\pm 1.12)$ &$17.32 (\pm 0.43)$ \\
Thick-z & $50$
& $35.31(\pm 0.13)$ & $35.89 (\pm 0.46)$ & $31.59(\pm 1.82)$ &$34.67(\pm 0.78)$ \\
& $100$
& $70.21(\pm 0.22)$ & $71.83 (\pm 0.37)$ & $61.44(\pm 2.07)$ &$69.47(\pm 6.28)$ \\
\bottomrule
\end{tabular}
\end{table*}
\noindent
We present empirical evaluations to demonstrate the effectiveness of our framework.
We begin by observing that there is no known tractable way of certifying the competitive ratio of a given algorithm in general --- a brute force approach is infeasible even for $25 \times 5$ instances with $\{0, 1\}$ bids. Furthermore, formalizing the certification task yields a highly non-convex optimization problem, which we have no reason to believe is tractable.
Instead, we evaluate the learned networks it in several ways --- measuring the algorithm's performance on known hard benchmark inputs (Takeaway 1); tracing how the adversary network guides the algorithm's evolution towards an empirical CR that matches the optimal CR known in theory (Takeaway 2); testing whether the algorithm network has learned the ingredients of the optimal solution, namely, Greedy and Balance strategies (Takeaway 3). In addition, we evaluate whether the algorithm scales to input sizes beyond what it was trained for (Takeaway 4), and we present a number of results in the robust stochastic setting (Takeaway 5).
\textbf{Takeaway 1: YaoLearner~ finds an algorithm that is competitive with the optimal worst-case algorithm (MSVV) and strictly dominates the natural Greedy strategy on hard benchmark distributions; it also matches the algorithm explicitly trained on the benchmark distributions (``Fixed-training''), without requiring any knowledge of the hard distributions.} This is showcased in Table~\ref{table:5byx}
{\bf Greedy} is the simple strategy that assigns an ad slot to the advertiser with the highest bid (truncated by the advertiser's remaining budget), ties broken randomly. While Greedy is natural and effective, it is sub-optimal --- this can be seen on the thick-z distribution where it gets significantly weaker performance than the other strategies, including YaoLearner~.
\noindent
{\bf MSVV} is the optimal worst-case online algorithm for AdWords~\cite{MSVV07}. %
For the $j$-th arriving ad, the algorithm scales advertiser $i$'s bid $v^j_i$ to be $q^j_i := v^j_i (1-\exp(- s^j_i))$ where $s^j_i := r^j_i / B_i$ is the fraction of advertiser $i$'s budget remaining when ad $j$ arrives. The algorithm then runs Greedy on the scaled bids. In the unweighted case (i.e. bids are $\{0,1\}$), the strategy is known as {\em Balance} as it assigns ads to the advertiser with most remaining balance among those bidding $1$. The algorithm always guarantees at least a $(1-1/e) \approx 0.632$ fraction of the offline optimal revenue (with the small-bids assumption that we also make), which is asymptotically optimal for large $n$ and $m$; smaller instances can have better CRs. We see that the algorithm found by YaoLearner~ is competitive with MSVV on the two tested input distributions.
{\bf Fixed-training.} We recreate the general outline of the state-of-the-art in algorithmic learning for AdWords as described in~\cite{kong2018new}. Namely, we fix the input distribution to be a mixture of of the triangular and thick-z inputs (discussed below) and train the algorithmic network for it. Unsurprisingly, the resulting algorithm does well on both distributions; note that YaoLearner~ matches its performance, without being trained on these benchmark distributions (nor any human-picked distributions).
\noindent
{\bf Input Distributions.}
We use the distribution constructed from the triangular graph and the thick-z graph (see \Cref{sec:app-adwords-inputs} for details) as the benchmark (same as~\cite{kong2018new}). The triangular graph is canonical because a distribution generated by randomly permuting the columns of the triangular graph is the minmax input distribution for the AdWords problem --- i.e., no online algorithm can achieve a CR greater than $1 - 1/e$
The thick-z graph is also canonical --- column permutations of the thick-z graph are particularly bad for Greedy, leading to a CR of $0.5$ asymptotically (it is employed by~\cite{kong2018new} in their training to prevent the network to just learn Greedy).
\begin{table}[h
\caption{The revenue of YaoLearner~ that was trained on $25 \times 5$ instances evaluated against larger $m\times n$ instances. Uniform budget is set to $m/n$ so offline optimum equals $m$. Average revenue ($\pm$ std) over $100$ samples shown.}
\label{table:largern}
\centering
\begin{tabular}{ccccc}
\toprule
Distr. & $m\times n$ & YaoLearner~ & MSVV & Greedy \\
\midrule
Triangular & $100\times 10$ & $66.11(\pm1.18)$ & $66.27(\pm 0.97) $ & $65.47(\pm 2.92)$ \\
& $400\times 20$ & $259.13(\pm 2.51)$ & $259.26(\pm 0.97)$ & $259.40(\pm 5.64)$ \\
\midrule
Thick-z & $100\times 10$ & $68.48(\pm 1.37)$ & $70.02(\pm 0.63) $ & $58.54(\pm 2.49)$ \\
& $400\times 20$ & $260.48(\pm 2.75)$ & $277.02(\pm 1.02)$ & $221.21(\pm 3.80)$ \\
\bottomrule
\end{tabular}
\end{table}
\noindent
\textbf{Takeaway 2: The estimated CR of the adversarial training converges to the optimal CR. Moreover, the adversary network generates examples that are hard for both Greedy and Fixed-training.}
Here we estimate the CR by measuring the performance on the hardest inputs generated by the adversary network. This is showcased in \Cref{fig:adversary}. It can be seen that the empirical CR of YaoLearner~ converges to the textbook-optimal CR.
\begin{figure}[h]
\begin{center}
\includegraphics[width=0.7\textwidth,height=3.2cm]{figs/exp_history.pdf}
\caption{We plot the CRs of various algorithms on the input instances in the experience array generated during YaoLearner~ $m \times n = 25 \times 5$ training. Horizontal axis is the index of the instance in the experience array (if the adversary network works as intended, later instances should be ``harder''). The vertical axis is the CR of algorithms evaluated on these instances. As a reference, the black horizontal line is the optimal worst-case competitive ratio (achieved by MSVV) under the small-bid assumption. There are $250$ instances in the experience array. To smooth out noise, we group every $10$ consecutive instances as a batch, and plot the worst (minimum) CR on instances within each batch for the algorithms. }
\label{fig:adversary}
\end{center}
\end{figure}
We next address the question of whether the inputs generated by the adversary network are merely hard for the algorithm network, or are hard instances of the AdWords problem in a broader sense. The performance of MSVV on these instances, as shown in
Figure~\ref{fig:adversary}, clearly demonstrate that they force the worst-case performance of MSVV as well.
It also clearly shows YaoLearner~ generates instances of increasing difficulty as the training evolves.
Similarly,
the plot shows that for Greedy, YaoLearner~-generated instances are more difficult than the triangular graph. Also note the earlier instances are very easy as they are basically random $[0,1]$ matrices. MSVV, Greedy and YaoLearner~ are all able to exploit this and achieve very good competitive ratio. On the contrary, Fixed-training does even worse on these easy instances (comparing to the more difficult ones later), which can be explained since these easy instances look very different from the expert crafted instances used to train Fixed-training. Finally, we demonstrate the effectiveness of the adversary network by {\bf training the adversary against a fixed algorithm}: we effectively find hard examples for both Greedy and MSVV with CR close their theoretical worst-case CR (see \Cref{sec:adv-training-fixed}).
\begin{table*}[h
\caption{The average CR achieved with robust stochastic training via YaoLearner~ by using the Powerlaw distribution. For training, we used the Powerlaw$(5)$ distribution and trained multiple algorithms by varying the $\alpha$. We refer to these algorithms as pwl-100, pwl-95, pwl-90 where the number indicates the value of $\alpha$ in percentage. E.g., pwl-100 is trained exclusively with Powerlaw instances, and pwl-95 is to use instances from Powerlaw with probability $0.95$. We refer to the algorithm trained exclusively with the adversary network as tabula-rasa.}
\label{table:fulltable}
\centering
\begin{tabular}{ccccccc}
\toprule
Distr. & MSVV & Greedy & pwl-100 & pwl-95 & pwl-90 & tabula-rasa \\
\midrule
Thick-z$(5)$ & $0.714$ & $0.636$ & $0.622$ & $0.687$ & $0.708$ & $0.714$\\
Powerlaw$(5)$ & $0.939$ & $0.993$ & $0.989$ & $0.985$ & $0.984$ & $0.878$\\
Triangular-g$(5)$ & $0.861$ & $1.000$ & $0.997$ & $0.990$ & $0.984$ & $0.814$\\
\midrule
Thick-z$(10)$ & $0.700$ & $0.589$ & $0.568$ & $0.667$ & $0.706$ & $0.685$\\
Powerlaw$(10)$ & $0.956$ & $0.986$ & $0.977$ & $0.977$ & $0.970$ & $0.908$ \\
Triangular-g$(10)$ & $0.847$ & $0.998$ & $0.978$ & $0.981$ & $0.967$ & $0.844$ \\
\bottomrule
\end{tabular}
\end{table*}
\textbf{Takeaway 3: The algorithm learned by YaoLearner~ discovers the salient features of MSVV.} In Appendix~\ref{sec:app-adwords}, we further test the learned network using inputs crafted to create various critical scenarios. The results demonstrate that our algorithm follows very accurately the optimal strategy in these controlled settings. We provide a sample preview of these results in Fig~\ref{fig:yaogan-behavior-sample}
\textbf{Takeaway 4: the YaoLearner~ scales to larger instances than it was trained on.} This is showcased in Table~\ref{table:largern}: We perform the same YaoLearner~ training as described before (on instances of dimension $m \times n = 25 \times 5$), but then measure its performance on instances of larger size.
Notably, YaoLearner~ still maintains performance somewhat similar to the optimal worst-case MSVV and still clearly outperforms Greedy (on the thick-z distribution). This suggests that this approach of training on small examples and scaling is effective and provides multiple benefits: small examples can be easily interpreted and intuition can be garnered from them and the training is significantly faster.
\textbf{Takeaway 5: YaoLearner~ enables robust stochastic training to find algorithms that are both highly attuned to the distribution of interest and are robust to adversarial shocks.}
We use the extension of the YaoLearner~ framework to perform robust stochastic training. We specify a distribution of interest $D = \text{Powerlaw}$ (see below) and train multiple algorithms by varying $\alpha$. We measure the performance against the following three distributions:
\begin{figure}[hpbt]
\centering
\begin{subfigure}{.45\textwidth}
\centering
\includegraphics[width=.75\linewidth]{figs/greedy_only.pdf}
\caption{YaoLearner~ correctly exhibits Greedy behavior when advertisers have the same (remaining) budget: the MSVV response is to take the highest bid.}
\end{subfigure}%
\begin{subfigure}{0.05\textwidth}
\centering
\phantom{.}
\end{subfigure}
\begin{subfigure}{.45\textwidth}
\centering
\includegraphics[width=.75\linewidth]{figs/balance_only.pdf}
\caption{YaoLearner~ correctly exhibits Balance behavior on equal bids: the MSVV response is to assign the ad to the highest remaining budget advertiser.}
\end{subfigure}
\caption{We dissect YaoLearner~-trained algorithm and compare its behavior with MSVV in two regimes: the Greedy and Balance regime. In 3(a) we set up advertisers $0$ and $1$ with a fixed common remaining budget, vary $0$'s bid ($x$-axis) while fixing $1$'s bid (the black dotted line), and plot our algorithm's output allocation probabilities ($y$-axis). In 3(b) we fix the bids and vary the remaining budget for advertiser $0$. In both scenarios the (optimal) MSVV algorithm has a sharp $0 \to 1$ transition at the dotted line for advertiser $0$. In fact, an optimal algorithm for the fractional AdWords problem has allocation curves very close to the trained ones.}
\label{fig:yaogan-behavior-sample}
\end{figure}
\emph{Thick-z}$(n)$: the $n^2\times n$ sized (i.e. $m=n^2$) thick-z graph, and all advertisers have budget $n$.
\emph{Powerlaw}$(n)$: this distribution is inspired by high-level characteristics of real-world instances, generated by a preferential attachment process on $n^2\times n$ sized graphs.
Further, we set the budgets in a way that Greedy obtains the offline optimum, which also makes the MSVV algorithm overly conservative in its hedging (details are deferred to \Cref{sec:app-adwords-inputs}).
\emph{Triangular-g}$(n)$: the $n^2\times n$ sized triangular graph. Each non-zero bid is drawn i.i.d from the uniform distribution over $[0.5,1]$, and the bidders' budgets are set so the simple greedy strategy would achieve near perfect competitive ratio similar to the case of Powerlaw.
The robust stochastic training leads to algorithms (e.g. pwl-90) that are (near) optimal on both the distribution they were trained on (i.e. Powerlaw) and Triangular-g which, by the design of budgets, shares the same optimal Greedy strategy with Powerlaw. This indicates that robust stochastic training is effective in exploiting the correlations of the distribution it was trained on. Furthermore, as we decrease $\alpha$ (i.e., incorporate more adversarial samples), we see that the learned algorithm interpolates between the performance of tabula-rasa (trained exclusively with the adversary network) and $\alpha = 1$ (trained exclusively with Powerlaw). This indicates that the algorithm becomes more robust to adversarial shocks, as showcased in Thick-z of \Cref{table:fulltable} where including more adversarial training is effective at finding more robust algorithms that can avoid the common pitfalls of Greedy on these canonical adversarially constructed bad instances.
\section{AdWords}
\label{sec:adwords}
In this section, we discuss the application of our YaoLearner~ framework to the AdWords problem.
\textbf{Evaluation Environment.}
Given an instance of AdWords with $n$ advertisers and $m$ ad slots, we slice the input and feed it to the algorithm one ad slot at a time, while keeping track of the allocations made by the algorithm on ad slots already revealed as well as the remaining budgets of advertisers. That is, we make sure the algorithm cannot peek into the future and the decisions are irrevocable. The evaluation environment also computes the total revenue achieved by the algorithm network once the full instance is processed and uses a linear program solver to compute the offline optimum. We use the algorithm revenue and the offline optimum to compute the competitive ratio of the algorithm on the particular instance.
\textbf{Algorithm network.}
As the evaluation environment feeds the input to the algorithm one ad slot at a time, our algorithm network makes allocation decision for a single ad slot given the current states of the advertisers. Conceptually the algorithm network takes as input $n$ triples (one for each advertiser) that represent the bid $v_i^j$ to the incoming ad slot $j$, the fractional remaining budget $r_i^j / B_i$, and the total budget $B_i$. It computes, for each advertiser, the probability that the incoming ad slot will be allocated to that advertiser. We note that using the fractional remaining budget (instead of using the absolute value) is for scale-invariance and without loss of generality since it is well understood in theory that the problem retains all its difficulty in the case where all budgets are $1$.
To accomplish this, the algorithm network comprises a single-agent neural network that computes a score for a generic advertiser, and a soft-max layer that converts the scores into probability values.
The single-agent network takes a $6$-dimensional input vector
consisting of the three quantities $v_i^j$, $r_i^j/B_i$, and $B_i$, and the respective sums of these three quantities over all advertisers.
An important consequence of this architecture is that the structure and number of trainable weights is independent of the input size, and the resulting algorithm is \emph{uniform}, that is, it works for arbitrary-sized inputs even though we train it on instances of fixed size. Additionally, it guarantees that the learned algorithm has the desirable property of {\em permutation equivariant\/}, i.e. permute the advertisers in the input would permute the output probabilities the same way (See \Cref{sec:PE-networks} for details).
During training, we interpret the probability vector output of the network as a fractional allocation of the ad slot. This corresponds to treating the problem as a \emph{fractional} AdWords problem, and ensures differentiability (see Sec~\ref{sec:yaogan}); it is also without loss of generality: the fractional version of AdWords is known to be as hard as the integral version, its solution incorporates the salient features of the integral version. During testing, we interpret the output as actual probabilities and sample one advertiser to allocate to, thus evaluating the original integral version.
\textbf{Adversary network.} The output of the adversary network is an instance of the AdWords problem, which consists of an $m\times n$ matrix $A$. The $j,i$-th entry of $A$ is a real value in $[0,1]$ representing the bid of advertiser $i$ for the $j$-th arriving ad slot. In most of our experiments we fix the budget of each advertiser to be $m/n$, but we also have experiments (in robust stochastic training) where the adversary network additionally outputs an $n$-dimensional vector $B$ of individual budgets. The adversary network takes as input an $m$-dimensional random Gaussian vector to provide randomness to the search for the difficult instances.
Unlike the algorithm network, which is designed to work on arbitrary $m,n$, we do not need the adversary network to scale: in our training, we fix $m=25,n=5$ for the adversary network.
Since the role of the adversary network is to generate instances to train the algorithm network, we note that, in general, it is desirable for it to generate fixed small-size instances (that capture the essential difficulty of the problem) so that training time/resources may be minimized.
One may also want to use the adversary-generated instances to gain human-comprehensible intuition about the weakness of an algorithm, and again in this case small but not tiny instances would best serve the purpose.
\input{adwords-results.tex}
\section{AdWords}\label{sec:appendix-adwords}
\subsection{Notable input distributions for AdWords}\label{sec:app-adwords-inputs}
\paragraph{Triangular distribution (\Cref{fig:triangular-graph}).} The triangular distribution certifies no algorithm for AdWords in the worst-case can get better than a CR of $1 - 1/e$ asymptotically (i.e., for large enough $m$ and $n$). The triangular distribution is based on the triangular matrix\footnote{Can be equivalently viewed as a bipartite graph where edges connecting ads and advertisers with edge weights representing the bid values ($0$ bid if there is no edge between an ad and an advertiser).} with the following pattern. There are $B n$ ads, $n$ advertisers, and each advertiser has a budget of $B$. An advertiser $0 \le j < n$ bids $1$ for each of the first $(j+1) \cdot B$ arriving ads, and $0$ for the later ads. We permute the columns (i.e., advertiser ids) of the triangular matrix so the ids won't reveal the future, and the triangular distribution is the uniform distribution over all the column permuted matrices of the triangular matrix. The optimal offline solution has value $Bn$ by picking the block diagonal cells, while any algorithm (on a sufficiently large instance) cannot achieve better than $1 - 1/e$. The intuition behind this is that online algorithms has to guess and first allocate ads to the advertiser who is going to ``drop out'' early, which is impossible to do consistently when the columns are shuffled. The optimal allocation strategy is to make the spend of all advertisers as even as possible, i.e., Balance. See \cite{MSVV07} for details.
\paragraph{Thick-z distribution (\Cref{fig:thick-z-graph}).} The Thick-z distribution is an example for which the Greedy strategy under-performs compared to Balance. Suppose $n$ is even and let $B$ be an integer. There are $B n$ ads, $n$ advertisers, and each advertiser has a budget of $B$. An advertiser $0 \le i < n$ has bids $1$ with ads $\{iB, \ldots, (i+1)B - 1\}$ and, if $i \ge n/2$, also with $\{0, \ldots, Bn/2 - 1\}$. All other bids are $0$. The columns are then uniformly randomly permuted (to one of $n!$ permutations). The optimal offline solution has value $Bn$ again by picking the block diagonal cells in the thick-z graph. On the contrary, if some strategy (for example Greedy with randomized tie-breaking) is not smart at choosing the allocation for the earlier ads, it may allocate most of the first half of ads to the right half of the advertisers (in the unpermuted thick-z graph) and deplete their budget. When the second half of ads arrive, the advertisers with high bids for these ads already have their budget depleted, while those with remaining budget (i.e., the left half of advertisers) don't bid for the later ads.
\paragraph{Powerlaw distribution.} This distribution is inspired by high-level characteristics of real-world instances,
generated by a preferential attachment process on $m = n^2 \times n$ sized bipartite graphs. In particular, we refer to the $n$ advertisers as offline nodes and the $m$ ads as online nodes. For each online node $i$, we sample its degree from a log-normal distribution, that is, first sample $g_i \sim \mathrm{Gaussian}(1,1)$ and computes its degree as $d_i = \min(\exp(g_i), n)$. We then sample $d_i$ offline nodes (i.e., advertisers) to connect to the online node $i$ (i.e., bid non-zero for ad $i$), and the sampling probability of each offline node $j$ is proportional to the number of online nodes already connected to $j$. This random process generates instances where the degrees of offline nodes follow a powerlaw distribution, i.e., the long tail, which agrees with the observation of online advertising. The weights of these $d_i$ edges (i.e., the non-zero bids to ad $i$) are generated by first sampling its underlying value $v_i\sim \mathrm{Uniform}(0,1)$, and the individual bids are sampled i.i.d from the distribution $\mathrm{Gaussian}(v_i,0.1)$.
As to the budgets of the advertisers, they are set non-uniformly in a way that makes the Greedy obtain the offline optimum. More specifically, we first run Greedy without budgets on an instance and simply let the result spending of each advertiser be the advertiser's budget, so running Greedy under these generated budgets achieve the best possible. This again agrees with the observation in online advertising where big advertisers bid high on many queries and have large budget, and that Greedy can exploit such typical structure to achieve very good performances.
\paragraph{Triangular-g distribution.} Instances from this distribution are based on the $n^2\times n$ sized triangular graph. The differences between this distribution and the triangular distribution are as follows. First the bids are fractional instead of $0,1$, and each bid of $1$ in the triangular distribution is replaced by a random bid drawn i.i.d from $\mathrm{Uniform}(0.5,1)$ while bids of $0$ remain $0$. Furthermore, the budgets are no longer uniform in each instance and are computed the same way as in the Powerlaw distribution above.
\begin{figure}
\centering
\begin{subfigure}{.24\textwidth}
\centering
\includegraphics[width=0.5\textwidth,height=3cm]{figs/UTM.pdf}
\caption{The triangular graph}
\label{fig:triangular-graph}
\end{subfigure}%
\begin{subfigure}{.24\textwidth}
\centering
\includegraphics[width=0.5\textwidth,height=3cm]{figs/thickz.pdf}
\caption{The thick-z graph}
\label{fig:thick-z-graph}
\end{subfigure}
\caption{A graphical representation of the triangular and thick-z graphs as matrices. Ads are represented by rows and arrive from top to bottom, advertisers are represented by columns. A specific (ad, advertiser) cell represents the bid value where bright/dark cells indicate $1/0$. The graphs shown are of size $m\times n = 100\times 10$, and the same patterns generalize to larger instances.}
\label{fig:graphs}
\end{figure}
\subsection{The algorithm learned by YaoLearner~ discovers the salient features of MSVV}\label{sec:app-adwords}
In this section we demonstrate that YaoLearner~ training successfully reconstructs the salient features of textbook-optimal worst-case algorithms and gives samples from the experience array.
\iffalse
\begin{figure}[h]
\begin{center}
\includegraphics[width=\textwidth]{figs/Adwords_CR_3_by_9.pdf}
\caption{Competitive ratio at snapshots taken just before the triangular network is restarted. The x-axis represents the snapshot number and the y-axis shows the competitive ratios. The blue (adv) line represents the \ensuremath{\mathrm{CR}}\xspace of the fully trained adversarial network before its restart. The orange (exp) line at snapshot $i$ represents the \ensuremath{\mathrm{CR}}\xspace of the best response from the experience array at snapshot $i$ versus the trained algorithm at snapshot $i$. The green (alg) line at snapshot $i$ represents the \ensuremath{\mathrm{CR}}\xspace of the best response from the entire experience array (from the entire training) versus the trained algorithm at snapshot $i$.}
\label{fig:adwords-cr}
\end{center}
\end{figure}
\fi
\begin{figure}[h]
\begin{center}
\includegraphics[width=\textwidth]{figs/greedy_new.pdf}
\caption{Plots demonstrating Greedy aspect of YaoLearner~ learned algorithm.}
\label{fig:adwords-weights}
\end{center}
\end{figure}
\begin{figure}
\begin{center}
\includegraphics[width=\textwidth]{figs/balance_new.pdf}
\caption{Plots demonstrating Balance aspect of YaoLearner~ learned algorithm.}
\label{fig:adwords-budgets}
\end{center}
\end{figure}
\paragraph{Algorithm demonstrates both Greedy and Balance behavior.}
The result in this section is using the algorithm trained on $25\times 5$ instances. In Figure~\ref{fig:adwords-weights} and Figure~\ref{fig:adwords-budgets} we interactively examine the behavior of the learned algorithm upon the arrival of one single ad slot with bids and fractional remaining budget inputs constructed specifically to test the Greedy and Balance aspects of the learned algorithm. In both figures, we have two advertisers $0,1$ and the vertical axis is the probability of assigning the ad slot to the advertisers respectively. In Figure~\ref{fig:adwords-weights}, we fix the fractional remaining budget of both advertisers at various levels ($0.25,0.5,0.75,1.0$). In each case, we fix the bid of advertiser $1$ and vary the bid of advertiser $0$. The optimal strategy should assign the ad to the advertiser with the highest bid since they all have same budget remaining. Our algorithm clearly demonstrates the correct \emph{greedy behavior} of the optimal algorithm in this scenario. The probability that advertiser $0$ receives the ad increases with his/her bid, and the value it takes for advertiser $0$ to be the most favorable (i.e., highest probability) matches fairly accurately the threshold where his/her bid becomes the highest. In Figure~\ref{fig:adwords-budgets}, we test whether the learned algorithm behaves accurately regarding the Balance aspect of the optimal algorithm. That is, when the bids are the same among both advertisers, the one with the highest remaining budget should win the ad. We fix the bid of both advertisers for the ad slot at various levels ($0.25,0.5,0.75,1.0$), fix the fractional remaining budget of advertiser $1$, and vary the remaining budget of advertiser $0$. Our algorithm clearly demonstrates the \emph{balance behavior} of the optimal algorithm fairly accurately.
\begin{figure}
\centering
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.5\textwidth,height=3cm]{figs/YaoGAN_contour.pdf}
\caption{tabula-rasa YaoLearner~}
\label{fig:adv100-contour}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.5\textwidth,height=3cm]{figs/MSVV_contour.pdf}
\caption{MSVV}
\label{fig:msvv-contour}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.5\textwidth,height=3cm]{figs/pwl100_contour.pdf}
\caption{pwl-100}
\label{fig:pwl100-contour}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.5\textwidth,height=3cm]{figs/pwl90_contour.pdf}
\caption{pwl-90}
\label{fig:pwl90-contour}
\end{subfigure}
\caption{The contour plots of (a) YaoLearner~ trained algorithm (tabula-rasa), (b) MSVV, (c) pwl-100, (d) pwl-90 demonstrating how the algorithms trade-off greedy and balance. In each plot, all the (bid, fractional remaining budget) pairs on the same contour curve are equivalent in terms of getting the ad.}
\label{fig:contour-graphs}
\end{figure}
\paragraph{Algorithm demonstrates trade-off between Greedy and Balance.} We further probe the trained algorithm to see if it learns a good trade-off between Greedy and Balance. For this, we consider a scenario of two advertisers, where we vary both the bid and fractional remaining budget of advertiser $1$ while fixing the the bid and fractional remaining budget of advertiser $2$ to be $0.8$ and $0.5$ respectively, and both advertisers have total budget $5$. We consider all the $(x,y)$ pairs where $x,y$ are multiples of $1/100$ in $[0,1]$, i.e., we consider $100\times 100$ grid points over the $2$-dimensional space of $[0,1]\times[0,1]$. For each such $(x,y)$ pair, we set the bid and fractional remaining budget of advertiser $1$ to be $x$ and $y$ respectively, and run the YaoLearner~ trained algorithm on this ad and two advertisers to get the probability of allocating the ad to advertiser $1$ which we refer to as $Z(x,y)$. In Figure~\ref{fig:adv100-contour} draw the contour plot on the $2$-dimensional space of $x$ and $y$ based on the $Z(x,y)$ value, so that all the pairs on the same contour lead to the same probability of advertiser $1$ getting the ad. The shape of the contour curves tell us in this particular scenario how the algorithm trade-off between bid value and remaining budget, i.e., the Greedy behavior and the Balance behavior.
To provide some benchmark, we also consider how MSVV trade-off between bid value and remaining budget in general. For any $(x,y)$ pair representing the bid and fractional remaining budget of an advertiser for an ad, MSVV computes the scaled bid of $x \cdot (1-e^{-y})$ and pick the advertiser with the highest scaled bid. Thus we know all the $(x,y)$ pairs leading to the same scaled bid will be considered as equivalent to MSVV. In Figure~\ref{fig:msvv-contour} we draw the contour plot on the $2$-dimensional space of $x$ and $y$ based on the scaled bid value. The shape of the YaoLearner~ trained algorithm's contour curves is very similar to the MSVV contour curves qualitatively. On the other hand, consider the simple strategy of Greedy, since only the bid value matters for Greedy, if we draw the contour plot for Greedy where the same $(x,y)$ pairs are equivalent to Greedy, the curves would all be vertical lines.
We also draw the same contour plots for pwl-100 and pwl-90 (the algorithms trained by YaoLearner~ in the robust stochastic setup) in Figure~\ref{fig:contour-graphs}. For pwl-100 the curves are very similar to Greedy (i.e., vertical lines) and we need to zoom the $x$-axis to be $[0.7,0.9]$ to see the slight difference because the other advertiser's bid is fixed at $0.8$ so bids much lower (or higher) than $0.8$ would give allocation probability of almost $0$ (or $1$) to advertiser $0$. We can see that while pwl-100 behaves much like Greedy in this context, pwl-90 demonstrates more of the Balance behavior as the fully adversarial trained algorithm.
\paragraph{Detailed algorithm behavior on specific instances.} We further compare the spending behavior of the YaoLearner~ trained algorithm and MSVV on three particular examples. We observe that the spending observed by YaoLearner~ and MSVV are almost identical, which gives stronger evidence that YaoLearner~ reconstructs the optimal algorithm than simply comparing the CR.
The first example is the $100\times 10$ triangular graph, where we have $10$ advertisers $0,\ldots,9$. Advertiser $j$ bids $1$ for the first $10(j+1)$ ads and bid $0$ for the rest. In Figure~\ref{fig:spend-triangular} we plot how the spending evolves for each advertiser as ads arrive. The $x$-axis indicates what fraction of the entire input has been revealed, and the $y$-axis is the fraction of total budget already spent. The $10$ subplots correspond to the $10$ advertisers in order. We also plot the spending by MSVV on this example, and our learned algorithm has nearly identical behavior as MSVV very closely on this example. As a second example, in Figure~\ref{fig:spend-triangular} we have the same plot for the example of $100\time 10$ thick-z graph. Again our algorithm is nearly identical to MSVV on this example. In Figure~\ref{fig:spend-random} we present an additional $100\time 10$ example where all the (weighted) bids are generated i.i.d from the uniform distribution over $[0,1]$ and the budget is $5$ for all advertisers.
\begin{figure}[h]
\begin{center}
\includegraphics[width=\textwidth]{figs/spend_vs_balance.pdf}
\caption{The evolution of the advertisers’ spending by YaoLearner~ trained algorithm and MSVV for the (unpermuted) $100\times 10$ triangular matrix instance. Blue dotted curve is the expected spending of each advertiser if we run MSVV, and orange solid curve is the empirical expected spending over $100$ runs of YaoLearner~ trained algorithm.}
\label{fig:spend-triangular}
\end{center}
\end{figure}
\begin{figure}
\begin{center}
\includegraphics[width=\textwidth]{figs/spend_vs_balance_thickz.pdf}
\caption{The evolution of the advertisers’ spending by YaoLearner~ trained algorithm and MSVV for the (unpermuted) $100\times 10$ thick-z matrix instance. Blue dotted curve is the expected spending of each advertiser if we run MSVV, and orange solid curve is the empirical expected spending over $100$ runs of YaoLearner~ trained algorithm.}
\label{fig:spend-thickz}
\end{center}
\end{figure}
\begin{figure}[h]
\begin{center}
\includegraphics[width=\textwidth]{figs/random_spending.pdf}
\caption{The evolution of the advertisers’ spending by YaoLearner~ trained algorithm and MSVV on an randomly generated instance. Blue dotted curve is the empirical expected spending of each advertiser if we run MSVV, and orange solid curve is the empirical expected spending of YaoLearner~ trained algorithm, both averaged over $100$ runs of the algorithms.}
\label{fig:spend-random}
\end{center}
\end{figure}
\paragraph{Example instances generated by adversary network during YaoLearner~ training.} We present some instances sampled from the experience array at the end of YaoLearner~ training in Figure~\ref{fig:adv}. Recall these are instances with $5$ advertisers and $25$ ads and we only plot the bids of these instances without the advertisers' budgets (which are also generated by the adversary network) for easier visualization. In each matrix, ad slots are rows with the top row arriving first, brighter entries mean higher bids (between $0$ and $1$), and the matrices are ordered by when they are used to train the algorithm. Qualitatively, the first row depicts instances that teach the algorithm to reconstruct the Greedy strategy, while the rest resemble more difficulty instances that teach the algorithm the Balance strategy. These more difficulty instances have the following pattern: 1) many advertisers have high bids for the earlier ad slots, and 2) fewer advertisers have high bids for the ad slots arriving later. For such input, if the algorithm is not smart at choosing the allocation for the earlier ads, it may deplete the budget of some advertisers, and run into the situation where advertisers with high bids for the later ads already have their budget depleted, while those with remaining budget don't value highly of the later ads. Both the adversarial graph and thick-z graph have such structure. Although we don't have any quantitative measure, it is fairly clear that the pattern discussed above emerges as the training evolves. In particular, most of the instances generated later in the training clearly demonstrate the pattern that earlier ads (i.e., top rows) have more advertisers bidding highly (i.e., brighter cells), and later ads have less. It is very interesting that the adversarial neural network can come up with such pattern from scratch via interactively playing against the algorithm network.
\begin{figure}[h]
\begin{center}
\includegraphics[width=0.8\textwidth,height=12cm]{figs/samples_experience.pdf}
\caption{A set of random samples from the experience array after training. The $j^{th}$ row and $i^{th}$ column represent the bid of advertiser $i$ for ad slot $j$. Darker color represents a bid close to $0$, while brighter color represents a bid close to $1$.}
\label{fig:adv}
\end{center}
\end{figure}
\iffalse
We also show in Figure~\ref{fig:worstcr} the particular examples from the experience array that give the worst competitive ratio for MSVV, Greedy, Fixed-training and YaoLearner~-reg for our evaluation in Figure~\ref{fig:adversary}, that is, these are the most difficult examples in the experience array for these algorithms respectively.
\begin{figure}[h]
\minipage{0.24\textwidth}
\includegraphics[width=\linewidth]{figs/worst_yaogan.pdf}
\captionsetup{labelformat=empty}
\caption{YaoLearner~-reg}
\endminipage\hfill
\minipage{0.24\textwidth}
\includegraphics[width=\linewidth]{figs/worst_msvv.pdf}
\captionsetup{labelformat=empty}
\caption{MSVV}
\endminipage\hfill
\minipage{0.24\textwidth}%
\includegraphics[width=\linewidth]{figs/worst_greedy.pdf}
\captionsetup{labelformat=empty}
\caption{Greedy}
\endminipage\hfill
\minipage{0.24\textwidth}%
\includegraphics[width=\linewidth]{figs/worst_fixed.pdf}
\captionsetup{labelformat=empty}
\caption{Fixed-training}
\endminipage
\caption{Most difficult examples from experience arrary for various algorithms.}
\label{fig:worstcr}
\end{figure}
\fi
\subsection{Training the adversary network against fixed algorithms}\label{sec:adv-training-fixed}
In this section we isolate the training of the adversary network against a fixed algorithm and show that the adversary network can find bad examples for a fixed algorithm fairly fast. We consider two fixed algorithms, MSVV and Greedy, since we know these algorithms and can understand why they perform poorly or well on particular examples. For easier understanding the examples presented in this section, we let the adversary network to only generate the bids of $25\times 5$ examples while fixing the budget of every advertiser to be $5$.
In Figure~\ref{fig:adversary-greedy} we present the result against Greedy. The left plot is the CR of Greedy on the generated examples as time evolves. We plot the CR for the last example generated by the adversary network in every $100$ training steps (the blue curve), and the orange curve is the running minimum CR of Greedy on previous examples. We also reinitialize the adversary network every $500$ training steps. Greedy has a worst-case CR of $0.5$, and We can see that the adversary network finds bad examples approach the worst-case CR for Greedy fairly fast. In the right plot we draw the worst instance generated by adversary for Greedy with a CR of $0.512$. It is not hard to see why the instance is bad for Greedy, as the offline optimal allocation is to allocate the first half of ads between the first three advertisers and save the budget of the right-most two advertisers for the later ads. On the contrary, since the highest bids of the first half of ads are all among the right-most two advertisers, Greedy will allocate these ads to them and they run out of budget before seeing the later ads. In Figure~\ref{fig:adversary-msvv} we present the analogous plots for adversary training against MSVV. The lowest CR of MSVV on adversary generated examples is $0.640$, which is very close to its worst-case CR of $1-1/e$.
\begin{figure}[H]
\centering
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.5\textwidth,height=3cm]{figs/adversary_greedy_cr.pdf}
\label{fig:adv-cr-greedy}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.5\textwidth,height=3cm]{figs/adversary_greedy_example.pdf}
\label{fig:adv-greedy-input}
\end{subfigure}
\caption{The CR of adversary generated examples against Greedy and the worst instance found.}
\label{fig:adversary-greedy}
\end{figure}
\begin{figure}[H]
\centering
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.5\textwidth,height=3cm]{figs/adversary_msvv_cr.pdf}
\label{fig:adv-cr-msvv}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.5\textwidth,height=3cm]{figs/adversary_msvv_example.pdf}
\label{fig:adv-msvv-input}
\end{subfigure}
\caption{The CR of adversary generated examples against MSVV and the worst instance found.}
\label{fig:adversary-msvv}
\end{figure}
We note that beyond using the adversary network to generate difficult instances for a fixed algorithm as discussed above, we can easily modify the training objective to provide other intuitions that are valuable in understanding algorithms. For example, we can make the training loss of the adversary network be the difference between CRs of MSVV and Greedy on its output instances (instead of just the CR of one fixed algorithm), and use it to find instances where one algorithm out-performs another algorithm by the largest margin. In Figure~\ref{fig:diff_examples} we present the instances generated by the adversary network in this setting. The left plot is when we ask for an instance where MSVV outperforms Greedy, and the right plot is an instance where Greedy outperforms. Again it is very interesting that the adversary network can construct instances with such interesting structures from scratch. On the left example, the large bids of the first advertiser (the bright cells in the left-most column) are actually larger than the bright cells in the other columns by a tiny amount. Greedy on this example will only collect revenue on the first $5$ bright cells from the first advertiser and then that advertiser runs out of budget so we cannot collect revenue from the last $4$ bright cells of that advertiser. On the contrary, as the large bids have roughly the same value, MSVV will allocate the top bright cell to the first advertiser, and then for the subsequent $4$ ads where the first advertiser and another advertiser both bid high, MSVV will allocate to the other advertiser. Then for the last $4$ ads where the first advertiser bids high, there is still budget left (recall budget is $5$ for everyone) so we can allocate to that advertiser. The instance on the right is one where Greedy outperforms MSVV by a large margin. The structure of the instance is very similar to the triangular graph but weighted so the block diagonal cells have larger value in general. Greedy would behave very similarly to the offline optimal in allocating the block diagonal cells and get very good CR. On the contrary, MSVV would behave sub-optimally because of the Balance aspect of the algorithm.
\begin{figure}[H]
\centering
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.5\textwidth,height=3cm]{figs/msvv-greedy.pdf}
\label{fig:msvv-greedy}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.5\textwidth,height=3cm]{figs/greedy-msvv.pdf}
\label{fig:greedy-msvv}
\end{subfigure}
\caption{The instances generated by the adversary network where MSVV outperforms Greedy by the most (left) and vice versa (right).}
\label{fig:diff_examples}
\end{figure}
\subsection{Permutation equivariant algorithm network}\label{sec:PE-networks}
Recall our algorithm network takes as input $n$ triples (one for each advertiser) that represent the bid $v_i^j$ to the incoming ad slot $j$, the fractional remaining budget $r_i^j / B_i$, and the total budget $B_i$. It computes, for each advertiser, the probability that the incoming ad slot will be allocated to that advertiser. To accomplish this, the algorithm network comprises a single-agent neural network that computes a score for a generic advertiser, and a soft-max layer that converts the scores into probability values. The single-agent network takes a $6$-dimensional input vector
consisting of the three quantities $v_i^j$, $r_i^j/B_i$, and $B_i$, and the respective sums of these three quantities over all advertisers. Upon receiving a $3n$-dimensional input for an ad, the algorithm network cuts the input into $n$ individual vectors each of size $6$, feed each such vector to the (shared) single-agent network. The algorithm network collects the $n$ scalar outputs from the single-agent network and takes a softmax over them to generate the output $n$-dimensional allocation probabilities. Note the number of trainable weights in our algorithm network does not grow with $n$.
The motivation of using such a neural network structure for the algorithm is two-fold. Firstly, it guarantees that the learned algorithm is \emph{permutation equivariant} (PE), which means if we permute the $n$ advertisers in the input, then the output of the algorithm should undergo the same permutation. In other words, the algorithm should make decisions not based on the ids of the advertisers. This is a desirable property for algorithms of AdWords and also the correct property as long as the ids don't correlate with any future information. Secondly, as the structure and number of trainable weights of the single-agent network aren't affected by the number of advertisers $n$, it is straightforward to extend the trained algorithm to work on instances when $n$ changes. This together with the online nature of problem makes our learned algorithm an {\em uniform} algorithm, i.e., it can work on arbitrary sized input.
We note that we can use more involved network structure if required while still guaranteeing that the learned algorithm is PE and uniform. For interested readers, we refer to the work of~\citep{ZaheerKRPSS17,HartfordGLR18} for more detailed discussion of enforcing PE in neural networks, and~\citep{Rahme20} for an application in auction, which is another canonical multi-agent setting where PE is desired.
\section{Online Algorithms}
\label{app:theory}
In this section, we provide more background on the essential notions of online optimization for a broader audience.
Online algorithm is a very different computational model from the classical (offline) algorithm design, and arises broadly in practice in situations where one has to make decisions in real time without knowing the future.
In the online context, the input is revealed sequentially instead of all at once, and the algorithm needs to make irrevocable decisions during the process using the input revealed so far similar to the Online Learning problem. The difficulty comes from making irrevocable decisions without knowing future input, while the current decision will have implications in the future. Take AdWords as an example: the search engine can sell an ad slot (i.e., user impression) each time some user searches for some query. Advertisers specify their budgets (i.e., total amount of money they are willing to spend on all ads) at the beginning of the episode and then place bids each time a new ad slot arrives. The search engine has to decide in real time how to allocate the ad slot to advertisers given their bids and budgets. The goal for the search engine is to maximize its revenue over the entire input sequence. Once we display the ad from an advertiser, there is no way to change the decision later, and once the budget of an advertiser is depleted, the search engine cannot sell ads to the advertiser any more.
\smallskip
\noindent{\bf Inherent difficulties in online optimization.} Consider the instance with two bidders $A,B$ both having budget $1$, and two ad slots arriving sequentially. Suppose $A$ and $B$ both bid $1$ for the first ad. To whom do we allocate the ad? With out loss of generality, suppose we give the first ad to $A$, and collect payment of $1$ from $A$. Now suppose the second ad slot comes, and only $A$ bids $1$ for it (and $B$ bids $0$). We cannot collect any more revenue from $A$ as $A$’s budget is already spent on the first ad, and cannot collect any revenue from $B$ since $B$ values the second ad at $0$. In this case the total revenue we get is $1$. However, hypothetically, if we knew the entire input sequence before making any decision, we could have assigned the ads optimally (the first one to $B$ and the second to $A$), getting a total revenue of $2$. This revenue is called the \emph{offline optimal}, i.e., how well we could have done in retrospect. Note that in the AdWords problem as typically considered, we assume that each bid is small compared to the budget; the above example does not follow this assumption but is easier to understand (it is an instance of the Online Bipartite Matching problem). However, even with the small-bids assumption, we have essentially the same issue if we consider $A$ and $B$ to have budgets of $100$ each, and two groups of a $100$ ads arriving similarly. Further, the differences in the bid values create even more possibilities of incorrect decisions.
\smallskip
\noindent{\bf Competitive ratio (CR).}
The primary measure of the performance of online algorithms is the \emph{competitive ratio} (CR). For a fixed input instance this is the ratio of the (expected) objective value the online algorithm achieves for that instance to the \emph{offline optimal value} (the best possible objective value for the instance, knowing the entire sequence upfront). In the above example, we get a competitive ratio of $1/2$ on that particular instance for that algorithm. The competitive ratio of the algorithm is defined as its worst competitive ratio over all possible inputs. For the Adwords problem it is known that there is a deterministic algorithm (from~\citep{MSVV07}) achieving a CR of $1-1/e$ with the small-bids assumption.
\smallskip
\noindent{\bf Adversarial model.} There are various models specifying what assumptions we have on inputs (i.e., on what inputs we want the algorithm to achieve good CR), e.g. i.i.d, random order, or adversarial. In this paper we assume the, most general, \emph{adversarial model}. In it, we want the algorithm to achieve good CR against all possible inputs, and we refer to the CR of an algorithm as the worst CR the algorithm gets on any input. This model achieves the highest level of robustness since it does not put any assumptions on the input; making it a meaningful model to consider in mean real-world settings. For example, in online advertising, the ad slots supply (i.e. user searches) can change drastically when some events go viral. Moreover, advertisers spend a great amount of resources to reverse-engineer the search engine's algorithm and come up with sophisticated bidding strategies in response. So it is of great interest to design algorithm that performs well no matter how the inputs look like.
\noindent{\bf Robust stochastic model.} In a stochastic model, the inputs of interest come from a fixed distribution (which can be known in advance, or learned over time). It is known (see, e.g.,~\citep{Meh13}) that one can develop algorithms with much better performance (CRs), as expected. In this paper, we also study the \emph{Robust Stochastic Model}.
This model is motivated by the example mentioned above in which an algorithm designer may have very good estimates of the incoming data (lending itself to a stochastic model), but there can be arbitrary jolts or shocks in the system (e.g., some viral event), which can lead to completely different inputs. In the robust stochastic model, one wishes to design algorithms which perform really well (better than the CR for the adversarial model) when the inputs follow the estimates, but also degrade smoothly and have good guarantees when the inputs deviate adversarially.
\section{Additional plots for Ski Rental}
\label{app:ski-rental}
\begin{figure}[h]
\begin{center}
\includegraphics[width=\textwidth]{figs/sr_cont_alg_behaviour.pdf}
\caption{The learnt algorithm instantiated at various $(B,N)$ values as CDF of buying over time (blue curve). The orange x's correspond to the optimal strategy in each case.}
\label{fig:continuousskirental_more}
\end{center}
\end{figure}
\section{Conclusion}
We explore the idea of using adversarial training to learn algorithms that are robust to worst-case inputs. The distinct challenge is to design a paradigm that can work from first principles without any problem-specific expert knowledge, and we demonstrate the effectiveness of our framework on the AdWords problem. The ultimate goal of our investigation is to employ the power of machine learning to gain critical insights and to aid the design of new algorithms beating state-of-the-art on interesting open problems in previously unexplored ways. While our work is very preliminary, we make a solid step towards this long term goal by removing the fundamental limit of prior approaches requiring existing problem-specific expertise. We hope our research can inspire more work from both the ML side and algorithm side along this direction.
\textbf{Acknowledgement.} The authors would like to thank Manzil Zaheer for many helpful discussion that shaped the early version of this paper. We would also like to thank the anonymous reviewers whose suggestions greatly improved both the presentation and content.
\section{Related Work}\label{se:full-related-work}
The most relevant work is an approach in \citep{kong2018new} that uses reinforcement learning (RL) to find competitive algorithms for online optimization problems including the AdWords problem, online knapsack, and the secretary problem. The training there is not from scratch, but based on specific distributions known to be hard for the problem. Specifically, they introduce the notions of universal and high-entropy training set that are tailor-made to facilitate the convergence to worst-case competitive algorithm. In this context, our work takes a major step by eliminating the need for this problem specific knowledge. Further, as we explain in Section~\ref{sec:game-theory}, after viewing the problem of finding worst-case or robust algorithms with the lens of Game Theory, one can see that the previous approach --- significant as it was --- had some gaps, which are overcome by addressing the harder problem of learning tabula rasa.
Among other work on using ML to train algorithms (which are more loosely related to our work), \cite{deudon2018learning} and \cite{kool2018attention} use RL to solve the traveling salesman problem (TSP) in the two-dimensional plane. Both uniformly sample the input points from the unit square and teach the network to optimize the expected performance on this input distribution without having access to exact solutions. Nevertheless, the learned algorithms from both approaches seem competitive with state-of-the-art methods, at least for modest input sizes. \cite{vinyals2015pointer} introduces the Pointer Network, a sequence-to-sequence model that successfully manages to approximately find convex hulls, Delaunay triangulations and near-optimal planar TSPs. They assume access to an exact solution and use supervised learning to train the model, while their input is uniformly sampled from the unit square. \cite{graves2014neural} introduce the Neural Turing machines, a differentiable and computationally universal Turing machine model, and use supervised learning to teach them basic algorithms such as copying or sorting. \cite{kaiser2015neural} introduce the parallel and computationally universal Neural GPU and use supervised learning to teach it addition and multiplication that seemingly generalizes to arbitrary lengths.
We point out some other related results without going into details: the work of~\cite{bello2016neural} studies applying RL on combinatorial problems including TSP and Knapsack; the work of~\cite{Dai17} exploits embedding and RL to design heuristic algorithms for classic graph problems on specific distributions;~\cite{boutilier2016budget} uses RL to solve Budget Allocation problem;~\cite{Duetting0NPR19} applies deep learning techniques to designing incentive compatible auction mechanisms.
To the best of our knowledge, previous results either learn algorithms designed to work on specific input distributions of interest, or utilize supervised learning to mimic a known method, or (in the case of~\cite{kong2018new}) rely on domain expertise to provide hard input instances to train algorithms that are competitive in worst-case. For the specific problems we consider, readers interested in ski rental and AdWords can consult~\cite{Buchbinder:Naor:survey} and \cite{Meh13} for a more thorough coverage.
\section{Introduction}
A long-standing ambition of machine learning is to learn from \emph{first principles}, that is, an ML system that learns {\em without any human-provided data\/} beyond an appropriate definition of the task at hand~\citep{silver2018general}. There have been impressive strides towards this goal, most notably in the domain of tabletop games such as chess, Go, shogi~\citep{silver2018general} and poker~\citep{brown2018superhuman}, where programs have been trained to play at superhuman levels without consuming any game-specific human expertise except, naturally, the rules of the game.
Our work falls under the broad umbrella of using ML to {\em design algorithms for optimization problems\/}. Similar to tabletop games, algorithm design has succinct and well-defined objectives, so learning from first principles is plausible.
Conceptually, our goals are two-fold:
From a theoretical perspective, we would like to train online algorithms that are optimal in the {\em worst case\/}, as traditionally done in algorithm design and analysis. We aim to achieve this without any predetermined training data (\emph{tabula rasa}).
The second goal of our work is to design optimization algorithms that work well under distributions of inputs that arise in practice, while being \emph{robust} to (possibly adversarial) ``shocks,'' that is, sharp changes in the input distribution. We will refer to this as the {\em robust stochastic} setting.
In this work we focus on a concrete problem, \emph{AdWords}, which is a classic and complex online problem generalizing both the problems of online bipartite matching and online vertex-weighted bipartite matching. We note that AdWords (and online bipartite matching in general) has been extensively studied, and in the worst case setting the optimal algorithms as well as instances that certifies the hardness of the problem are both well understood. However, the significance of our result lies on the fact that we learn the algorithm without any human intervention in coming up with a training set and none of the expert knowledge is involved in training. We only apply the expert knowledge to validate that the learned algorithm is very close to the theoretically known optimal both qualitatively and quantitatively, and the self-generated hard instances indeed discover the essential hardness combinatorial structure of the problem. It is exactly this tabula rasa nature of our framework that distinguishes our result from (as far as we know) all prior work in the context of learning worst-case algorithms and makes our framework potentially interesting for learning algorithms of less well-understood problems.
\textbf{Overview of Techniques.}
We utilize \emph{adversarial training}~\cite{GSS14,madry2018} as our main technique. In the canonical setup of adversarial training, an adversary adds bounded perturbations to training instances to exploit the weakness of the algorithm and thus making it more robust. When learning worst-case algorithms, We essentially work in the extreme case where arbitrary perturbation is allowed, which is equivalent to constructing completely new instances, to get the most robust algorithm (i.e., worst-case optimal). Thus we need to design a more advanced adversary to tackle this challenge.
In contrast to most prior work that considers adversarial training through the lens of robust optimization, we draw insights from game theory and online learning (in particular,~\cite{FS96})
The game-theoretic viewpoint of algorithm design (see Appendix~\ref{sec:game-theory} for details) defines a zero-sum game between an algorithm player and an adversary player, where the optimal algorithm is the max-min strategy of the former. At a high-level, our technique learns an algorithm iteratively: we consider the current version of the algorithm, find its worst-case input (also called ``adversarial input'', since one can imagine a hostile adversary hand-picking it as a best response in the game), and change the algorithm to improve its performance on this input. Naturally, finding the worst-case input is often a hard problem in itself. We propose a framework that uses deep learning both to guide our search for worst-case inputs (using an adversary network) and to improve the algorithm (represented by an algorithm network). We will also show that the framework can be adapted to solve the problem of finding algorithms for the robust stochastic setting.
We note that the generic structure of a competitive game with two players implemented using neural networks is also reminiscent of GANs~\cite{GAN}. We point out that in spite of this high-level similarity, our framework is quite different from GANs in many ways. For example, the top level goal of a GAN is to construct a generator that mimics some fixed target data distribution, and it’s undesirable if the generator only finds best responses to the discriminator (i.e. mode collapsing) and much of the effort is to avoid this. On the contrary, our framework draws insight from no-regret dynamics (see Appendix \ref{sec:game-theory} for details), where convergence crucially relies on the adversary to quickly collapse to the best response to the algorithm, and thus most of our effort is to the exact opposite of GANs. Moreover, in our case the training eventually converges to an equilibrium between the two players, whereas in GANs the objective is mostly hinged upon the external fixed target distribution. For example, in GANs if we have a perfect generator, then it suffices to use a trivial discriminator that just flips coins. However, in our case, even if we start with an optimal algorithm, it’s still difficult to train the adversary to generate strong instances that push the optimal algorithm to its worst-case bound, and vice versa.
\textbf{Summary of results.}
The main contributions of this paper are two-fold: a concrete realization of the ideas outlined above in the form of a training framework (Algorithm~\ref{alg:yaogan} in Section~\ref{sec:yaogan}), and employing the framework to derive algorithms for the AdWords problem, a complex online optimization problem that generalizes the classic bipartite matching problem as well as the knapsack problem.
The \emph{AdWords} problem~\citep{MSVV07} is a central problem in the area of online advertising. In this problem, there are $n$ advertisers with budgets $B = (B_0, \ldots, B_{n-1})$, and $m$ ad slots. Each ad slot $j$ arrives sequentially along with a vector $v^j = (v^j_0, v^j_2, \ldots, v^j_{n-1})$ where $v^j_{i}$ is the bid of advertiser $i$ for slot $j$. Once a slot arrives the algorithm must irrevocably allocate it to an advertiser with sufficient remaining budget $r^j_i$, or to no one at all. If slot $j$ is allocated to advertiser $i$, the algorithm collects a revenue equal to $\min(r^j_i, v^j_i)$.
The remaining budget $r_i^j$ of advertiser $i$ is reduced accordingly: initially, $r_i^0 = B_i$ and then $r_i^{j+1} = r_i^j - \min(r^j_i, v^j_i)$ if slot $j$ is assigned to $i$ and $r_i^{j+1} =r_i^j$ otherwise. The objective of the algorithm is to maximize the total revenue over the entire sequence; due to the online nature of the problem, the allocation decisions have to be made without knowledge of the remaining sequence.
The primary measure of the performance of online algorithms is the \emph{competitive ratio} (CR). For a fixed input instance this is the ratio of the (expected) objective value the online algorithm achieves for that instance to the \emph{offline optimal value} (the best possible objective value for the instance, knowing the entire sequence upfront). The competitive ratio of the algorithm is defined as its worst competitive ratio over all possible inputs. In this paper we are interested in the regime for AdWords when the bids are small relative to the budgets, where the \emph{MSVV algorithm} of \citep{MSVV07} achieves a CR of $1 - 1/e$ (and this is optimal among all online algorithms).
There are two compelling reasons why we study the AdWords problem. From a conceptual perspective, its algorithmic solution \citep{MSVV07} involves subtle ideas that trade-off greedily picking high-value bids while carefully hedging on future bids by balancing the budgets spent; also, the ideas in establishing the optimality of the algorithm use carefully crafted worst-case inputs. Thus it is an archetypal example of a problem where it is of interest to know whether deep learning methods can step in for both these tasks. Secondly, from a practical perspective, we wish to learn policies that perform better than the worst-case guarantee on the input distributions that arise in practice; at the same time, since traffic patterns can change abruptly based on external events, and advertisers can change their bidding and targeting at any time, it is vital to derive algorithms that are robust to such shocks.
Besides the practical importance, the problem has also been of great interest in the online algorithms literature (see \citep{Meh13}); online bipartite matching is an actively studied area in algorithm design, e.g., ride-sharing platforms~\citep{Dickerson17,AshlagiBDJSS19}.
We demonstrate the success of our methods for the AdWords problem both for the worst-case and for the robust distributional setting. For the worst-case setting, we provide evidence in two main ways. Firstly, we show that the CR converges empirically to the correct optimal value. To be precise, since it is not tractable to certify the worst-case CR empirically (as that needs evaluation over all inputs of all sizes), we show that the learned algorithm achieves near-optimal competitive ratio over learned as well as known hard instances. Secondly, we show that the learned algorithm shares many salient features of the optimal algorithm: it infers both the \emph{Greedy strategy} and the \emph{Balance strategy}~\citep{KP00}, and seems to find the correct trade-off between them as does the optimal algorithm.
From the adversary side, the learned input instances successfully defeat several reasonable (but non-optimal) approaches like Greedy and the algorithm optimized on a fixed distribution (\Cref{sec:adwords}).
For the robust stochastic setting, we show that the learned algorithm smoothly interpolates between the optimal algorithm for the fixed distribution and the worst-case optimal algorithm; by doing so it remains competitive in all regimes --- when the input follows the fixed distribution and when it deviates arbitrarily --- while the optimal distribution-specific algorithm and the worst-case algorithms perform well only in the regime they were designed for.
\textbf{Generalizability.} While we focus solely on AdWords, we note that our high-level framework can, in principle, be generalized to find algorithms for any optimization problem (online or offline). Not surprisingly, evaluating on a new problem requires designing a problem-specific suite of representations and tests, and it takes considerable ingenuity and engineering effort to implement our framework on a different problem. However, our framework breaks the fundamental limit of previous approaches whose effectiveness crucially relies on strong training sets tuned with domain knowledge which is likely to be available only on well-understood problems.
Nevertheless, in Appendix~\ref{sec:appendix-skirental}, we take an initial step in this direction, and show that the framework can be used to derive algorithms for classic {\em ski-rental problem\/}~\citep{Karlin86}, matching the CR and the behavior of the optimal randomized algorithm.
Indeed, the larger ambition of our program is to design algorithms for problems for which the literature doesn't have satisfactory solutions; this will need considerably more innovation both to evaluate and to interpret the derived algorithms, and we leave this for future work.
\noindent\textbf{Related work.} The most relevant work is an approach in \cite{kong2018new} that uses reinforcement learning (RL) to find competitive algorithms for online optimization problems including the AdWords problem, online knapsack and the secretary problem. The training there is not from scratch, but based on specific distributions known to be hard for the problem. Specifically, they introduce the notions of universal and high-entropy training set that are tailor-made to facilitate the convergence to worst-case competitive algorithm. In this context, our work takes a major step by eliminating the need for this problem specific knowledge. Further, as we explain in Section~\ref{sec:game-theory}, after viewing the problem of finding worst-case or robust algorithms with the lens of Game Theory, one can see that the previous approach --- significant as it was --- had some gaps. \wadi{This is slightly expanded.} Essentially, the algorithm will suffer from over-fitting to the fixed training set, and thus although it performs competitively on the hand-crafted hard instances, it is not robust to different (and even much easier) examples. Our result overcomes this by addressing the harder problem of learning tabula rasa.
Besides this paper, there are several other recent results on the application of deep learning to solve combinatorial and other algorithmic problems, including \citep{deudon2018learning, kool2018attention, bello2016neural, Dai17, boutilier2016budget, Duetting0NPR19, vinyals2015pointer, graves2014neural, kaiser2015neural, gui2020review}; we defer the discussion of this related work to \Cref{se:full-related-work} but mention that besides \citep{kong2018new}, the other work is different as it does not tackle the problem of finding worst-case or adversarially robust algorithms.
\section{Introduction}
It has been a long-standing ambition of machine learning to learn from \emph{first principles}, that is, a machine learning program that learns \emph{without any human-provided data} beyond an appropriate definition of the task at hand~\citep{silver2018general}. The community has made impressive strides towards this goal in recent years, most notably in the domain of tabletop games such as chess, Go, shogi~\citep{silver2018general} and poker~\citep{brown2018superhuman}, where programs have been trained to play at superhuman levels without consuming any game-specific human expertise except, naturally, the rules of the game.
In this work, we look at the task of using ML to \emph{design algorithms for optimization problems}. Similar to tabletop games, the task of algorithm design has succinct and well-defined objectives, so learning from first principles is potentially feasible. Moreover, the task is very intriguing as it typically requires a significant amount of time and expertise for humans to accomplish. If successful, such an approach can have impactful ramifications: researchers could accelerate the speed of discovery by offloading to machines the time-consuming process of finding problem-specific insights, which can be crucial in improving the state of the art for many problems both in theory and in practice.
A typical ML approach to algorithm design is to define a model that represents the space of possible algorithms and train the model against a pre-defined training set. The assumption is that the training set is carefully chosen to capture future input distributions well, so the learned algorithm generalizes to future inputs of interest. However, designing this distribution requires domain-specific knowledge and is incompatible with learning from first principles.
We take a different approach: train the algorithm against \emph{worst-case inputs}. In other words, the fitness of an algorithm is only as good as its fitness on the worst possible input. This conceptually removes the need for pre-defining a training set. Worst-case algorithm design is motivated by theoretical computer science (TCS) that traditionally considers algorithms with worst-case guarantees due to their robustness against arbitrary inputs.
There have been very few prior attempts at learning worst-case algorithms.
A particularly relevant result is by \cite{kong2018new} that uses reinforcement learning to learn theoretically optimal algorithms for online optimization problems. They show how to learn worst-case algorithms using a training set by introducing the notion of universal and high-entropy training sets. Roughly speaking, such a training set serves as a very effective benchmark in the sense that the task of finding an algorithm with strong worst-case guarantee reduces to finding an algorithm that performs well against this training set. Not surprisingly, for a given optimization problem, coming up with such a training set can require significant domain expertise a priori. In the current work, the goal is different: we aim to both provide a new technique for worst-case learning and leverage it to remove the need for a training set.
We utilize \emph{adversarial training}~\cite{GSS14,madry2018} as our main technique. Notably, our methods draw insights from game theory, analysis of algorithms, online learning and generative adversarial networks (GANs)~\cite{GAN}. This is in stark contrast to prior work that considers adversarial training through the lens of robust optimization. This alternative view of the technique might be of independent interest to the ML community.
On a high-level, the technique learns an algorithm iteratively: by considering the current version of the algorithm, finding its worst-case input (also called adversarial input, since one can imagine a hostile adversary hand-picking it), and optimizing the algorithm's response on this input. Naturally, finding the worst-case input is often a hard problem in itself. For simpler optimization problems, rudimentary strategies such as random search or grid search can provide a fairly effective adversary. For problems with more interesting underlying space, we propose a general framework that uses deep learning to both guide our search for worst-case inputs and optimize the algorithm. In other words, we propose an end-to-end ML framework that can be roughly separated into two components: the algorithm agent and the adversary. Their goals are to learn the optimal algorithm and a set of input instances that captures the essential difficulty of the given optimization problem, respectively. Similar to a generative adversarial network (GAN), we use two neural networks, one for the algorithm agent and another for the adversary. We start from scratch, train these two networks against each other, and let them evolve simultaneously. We call our framework \emph{YaoGAN} due to this structural similarity to GAN and the connection to Yao's classic Lemma (see Section~\ref{sec:Yao} for details).
In this initial effort, we follow \cite{kong2018new} in focusing on \emph{online optimization problems}~\citep{BN09} where each input is a sequence arriving over time, and the algorithm needs to make an immediate and irrevocable decision at each time step without knowing the future input.
We consider two online optimization problems, the \emph{ski rental} problem and the \emph{AdWords} problem. Ski rental~\citep{Karlin86} has been a staple introductory example in online analysis due to the simplicity of the statement and non-triviality of the optimal solution. We use a straightforward application of the adversarial training concept and demonstrate its viability for learning algorithms with worst-case guarantees by reconstructing the optimal textbook algorithm for the problem.
We evaluate the full YaoGAN framework on a harder, AdWords problem~\citep{MSVV07}---a well-known problem motivated by online advertising. The AdWords problem is of particular importance in the online advertising as it captures the question of allocation of ad slots arriving over time to advertisers with budget constraints. Furthermore, having a robust algorithm is very important in such a setting -- one may learn better performing policies for specific input distributions, but in reality, traffic patterns can change abruptly based on external events, and advertisers can change their bidding and targeting at any time. Besides the practical importance, the problem has also been of great interest in the online algorithms literature, being closely related to numerous variants of the online bipartite matching problem~\citep{Meh13}, which remains an actively studied area in algorithm design, for example in the setting of ride-sharing platforms~\citep{Dickerson17,AshlagiBDJSS19}.
Our experiments for this specific hard problem demonstrate that our framework can be effective at finding algorithms as well as difficult input instances that are consistent with optimal results. We believe further study along this direction can lead to more exciting developments.
We use generic neural network architecture and ML methods (e.g., Adam optimizer~\citep{kingma2014adam}) in our experiments, and do not optimize the training set-up or hyperparameters, since our focus in this paper is not in extending ML techniques, but in applying our high-level paradigm to learn algorithms from first principles. We believe the co-evolution of new ML techniques tailored to this task will be essential to the ultimate success of this approach. We leave that aspect, as well as the tantalizing question of applying the framework to solve open algorithm design problems, to future work.
\noindent{\bf Related work.} The most relevant paper to ours is an approach by \cite{kong2018new} that uses reinforcement learning (RL) to find competitive algorithms for online optimization problems including the AdWords problem, online knapsack and the secretary problem. They introduce the notions of universal and high-entropy training set that are tailor-made to facilitate the convergence to worst-case competitive algorithm. \cite{deudon2018learning} and \cite{kool2018attention} use RL to solve the traveling salesman problem (TSP) in the two-dimensional plane. Both uniformly sample the input points from the unit square and teach the network to optimize the expected performance on this input distribution without having access to exact solutions. Nevertheless, the learned algorithms from both approaches seem competitive with state-of-the-art methods, at least for modest input sizes. \cite{vinyals2015pointer} introduce the Pointer Network, a sequence-to-sequence model that successfully manages to approximately find convex hulls, Delaunay triangulations and near-optimal planar TSPs. They assume access to an exact solution and use supervised learning to train the model, while their input is uniformly sampled from the unit square. \cite{graves2014neural} introduce the Neural Turing machines, a differentiable and computationally universal Turing machine model, and use supervised learning to teach them basic algorithms such as copying or sorting. \cite{kaiser2015neural} introduce the parallel and computationally universal Neural GPU and use supervised learning to teach it addition and multiplication that seemingly generalizes to arbitrary lengths.
We point out some other related results without going into details: the work of~\cite{bello2016neural} studies applying RL on combinatorial problems including TSP and Knapsack; the work of~\citet{Dai17} exploits embedding and RL to design heuristic algorithms for classic graph problems on specific distributions;~\citet{boutilier2016budget} uses RL to solve Budget Allocation problem;~\cite{Duetting0NPR19} applies deep learning techniques to designing incentive compatible auction mechanisms. Readers insterested in ski rental and AdWords can consult~\citet{Buchbinder:Naor:survey} and \citet{Meh13} for a more thorough coverage.
To the best of our knowledge, previous results mostly focus on the algorithm side, and either learn algorithms designed to work on specific input distributions of interest, or utilize supervised learning to mimic a known method, or (in the case of~\citet{kong2018new}) rely on domain expertise to provide hard input instances to train algorithms that are competitive in worst-case. We do not wish to detract from the value of optimizing an algorithm on a specific distribution if it is of special interest. Indeed, a practitioner optimizing for a distribution $\mc{D}$ could likely design algorithms that outperform classic solutions on $\mc{D}$ since classic solutions typically protect against worst-case inputs and might be overly pessimistic on $\mc{D}$. Our goal is different: facilitate the discovery of new algorithms with strong worst-case performance on open problems where we do not have a known difficult input distribution at hand. Such learned strategies could then potentially be later fine-tuned to adapt to specific input distributions, while retaining some worst case guarantees. We consider the results here as a significant step towards this eventual goal.
\subsection{Summary of results}
We apply the adversarial training to two classic problems in the area of online optimization: the \emph{ski rental} problem and the \emph{AdWords} problem (these are defined formally in \Cref{sec:prelims}). We demonstrate the success of our methods in two ways. Firstly, we show that the \emph{competitive ratio}---the primary figure of quality for an online optimization algorithm---converges to the correct value. To be precise, since it is not entirely possible to certify the worst-case CR empirically for the more complex problem of AdWords, we show that the learned algorithm achieves near-optimal competitive ratio over learned as well as known hard instances. Secondly, we show that the learned algorithm shares many salient features of the optimal textbook algorithm.
\textbf{Ski rental.} A typical instance of the ski rental problem is parameterized by multiple parameters, including the size of the input instance $N$. Algorithms accepting only one input size are relatively easier to find than the \emph{uniform algorithms} accepting multiple sizes. We focus on the latter, harder, task by applying proper scaling techniques and best-response learning; such task is beyond the scope of traditional optimization techniques. By applying a straightforward version of adversarial training we recover the optimal textbook uniform algorithm with its behavior matching the one of \cite{Karlin86} with the competitive ratio converging to $1.58$, within $10^{-2}$ of the optimum. We use this concept to demonstrate the effectiveness of the training concept. We include the results on ski rental in the supplementary material.
\textbf{AdWords.}
We solve a fixed-size instance of the fractional Adwords problem---a ``budgeted bipartite matching problem''---with 25 ad slots and 5 advertisers. While learning a uniform algorithm would be preferable, we note that learning how to solve $25 \times 5$ instances is a highly non-trivial task. Using chess or Go as examples, the relevant ML papers solve the games on fixed-size instances rather than on instances of arbitrary size. Of course the latter would be a much stronger result, but the fixed-size task is by no means easy. We use the full end-to-end YaoGAN framework since even finding worst-case inputs in the fractional AdWords is a hard non-convex global optimization problem. Our methods learn an algorithm competitive with the textbook optimal on various input distributions; the learned input instances successfully defeat several reasonable (but non-optimal) approaches like Greedy and the algorithm optimized on a fixed distribution (\Cref{sec:adwords}). Qualitatively, the trained algorithm infers both the \emph{greedy strategy} and the \emph{balance strategy}~\citep{KP00}, two salient properties of the optimal solution. Furthermore, the learned algorithm seems to find the correct trade-off between the strategies in our benchmark.
\section{The Game theoretic framing}
\label{sec:game-theory}
\subsection{The game-theoretic approach to adversarial training}
We start with a short discussion on how adversarial training can be seen through the lens of game theory.
One can frame the task of finding an optimal algorithm for a given problem in an abstract game-theoretic setting: Consider a (possibly infinite) two-player zero-sum game matrix $V$, in which
each row represents a deterministic algorithm $\mc{A}$, and each column represents an input instance $\mc{I}$. The entry $V(\mc{A},\mc{I})$ is the payoff (CR) to Row if it plays $\mc{A}$, and Column player plays $\mc{I}$.
The worst-case optimal (randomized) algorithm corresponds to Row's max-min strategy. By (von Neumann) strong duality,
Column's min-max strategy is therefore the worst (most difficult) input distribution for this problem (this application of duality is called Yao's Lemma~\citep{Yao77} in Theoretical CS).
\textbf{Yao's Lemma.} Online algorithms are often randomized since hedging between different input continuations can be elegantly achieved via randomization.
A randomized algorithm can be viewed as a distribution ${\bm{p}}$ over rows of $V$ (i.e., deterministic algorithms); an input distribution ${\bm{q}}$ can be viewed as a distribution over columns of $V$ (i.e., input instances). The optimal (potentially randomized) algorithm ${\bm{p}}^*$ is one whose expected payoff against the worst-case input is minimized, i.e., ${\bm{p}}^* = \arg\min_{{\bm{p}}} \max_{\mc{I}} {\bm{p}}^T V(:,\mc{I})$. A standard result in game-theory stipulates that once you fix a randomized algorithm, then maximizing over pure instances (columns) is equivalent to maximizing over input distributions. The namesake of our paper, Yao's Lemma~\citep{Yao77} says that there exists a distribution ${\bm{q}}^*$ over inputs such that the expected payoff of the best (deterministic) algorithm over ${\bm{q}}^*$ is the same as the value of the best randomized algorithm ${\bm{p}}^*$ over its worst possible (pure) input. In other words, $\max_{\mc{I}} ({\bm{p}}^*)^T V(:, \mc{I}) = \min_{\mc{A}} V(\mc{A}, :) {\bm{q}}^*$. This is, of course, simply an elegant application of von Neumann's minmax theorem aka strong duality to this specific game. Using classic game theory notations, we also refer to the best randomized algorithm as the row player's minmax strategy, and ${\bm{q}}^*$ the column player's maxmin strategy. Solving an online optimization problem corresponds to solving the above zero-sum game, specifically finding ${\bm{p}}^*$.
Prior work in~\citep{kong2018new} used this to train an algorithm network on the min-max input distribution for the Adwords problem. Besides the drawback that this needs problem expertise to know the min-max distribution, this approach also has a fatal flaw that Row's best response to a min-max strategy of Column need not be its own max-min strategy (e.g., in Rock-Paper-Scissors, any pure strategy is a best response to the max-min strategy of playing the three moves uniformly at random). Hence, the worst input distribution is not sufficient to recover the best algorithm; this is specifically true for the AdWords problem. Indeed, this issue was acknowledged in~\cite{kong2018new}: they combine multiple types of special input distributions (e.g., universal and high-entropy training sets).
To overcome this obstacle, we note that solving the game from scratch necessarily requires solving for both the algorithm and the adversary. We draw inspiration from online learning for game-solving \citep{FS96}, and show how we can view adversarial training in this manner. Adversarial training intuitively seems to be the ``right thing'' to train algorithms with worst-case guarantees, and we show that the unique challenge now is co-training the Adversary as well, which extends and strengthens the existing adversarial training framework.
\subsection{No regret dynamics and convergence to the MinMax}
One way to explain the success of YaoLearner~ is in that it loosely follows no-regret dynamics. There is a rich line of work on no regret dynamics~\citep{FS96,AHK} which lies at the center of various fields including game theory, online learning and optimization. In the context of two-player zero-sum games, this gives a method to approximately solve the value of the game without knowing the optimal column player strategy (i.e., the adversarial input distribution) in advance. We extend the notation to use $V({\bm{p}},{\bm{q}})$ to denote ${\bm{p}}^TV{\bm{q}}$.
More specifically, we can let the algorithm player maintain a randomized algorithm ${\bm{p}}^t$ over iterations $t=1,\ldots,T$. In each step the adversary plays the best response $\mc{I}^t$ (i.e., the worst-case input against the algorithm at that iteration). The algorithm ${\bm{p}}^{t+1}$ is then computed from ${\bm{p}}^t$ and $\mc{I}^t$ using a specific no-regret dynamic such as Hedge~\citep{FS96}. Define
\[
\tilde{{\bm{p}}} = \argmin_{{\bm{p}}^t}V({\bm{p}}^t,\mc{I}^t),\qquad
\tilde{{\bm{q}}} = \frac{1}{T}\sum_t \mc{I}^t .
\]
Classic results give us that the payoff of the pair $\tilde{{\bm{p}}},\tilde{{\bm{q}}}$ converges to the optimal minmax value for sufficiently large $T$.
Our YaoLearner~ training loosely follows this approach. It maintains a randomized algorithm ${\bm{p}}^t$ and searches for the best response $\mc{I}^t$. However, it does not follow the no-regret dynamics of prior algorithms, but rather uses simple gradient descent to optimize the payoff of the algorithm on $\mc{I}^t$.
\section{Ski Rental}\label{sec:appendix-skirental}
In this section, we describe how our framework can be applied to find a worst-case competitive algorithm for a different online optimization problem, Ski-Rental. We describe the problem, the techniques used, and the results which demonstrate that the framework has found a strategy extremely similar to the theoretically optimal randomized algorithm.
\subsection{Problem definition}\label{sec:def-skirental}
We formally define the ski rental problem and illustrate the notions of deterministic strategies and competitive ratios.
\begin{problem}[Ski rental]
Suppose we want to go skiing in the winter, which requires a set of skis. Each day we go skiing, we have two options: either rent the skis for $\$1$, or buy the skis for $\$B$, for some fixed $B$. Naturally, renting the skis allows us to ski only for that one day, while after buying we can use them for an unlimited number of days. The crux is that we do not know in advance the total number of days $k$ we will be able to ski (e.g., we might get injured or have some work come up, etc.). The objective is to minimize the total amount of money spent by strategically buying/renting skis.
\end{problem}
\noindent{\bf Deterministic algorithms.} A deterministic algorithm $\mc{A}$ takes the form of renting for up to some fixed number $x$ of days initially, and if it turns out that we go skiing for at least $x$ days, we buy on day $x$. If the eventual number of days we go skiing is $k$, the cost of this strategy will be $\min(k, B+x-1)$, and the offline optimal cost will be $\min(k,B)$. The corresponding entry in the payoff matrix $V$ is $\frac{\min(k,B+x-1)}{\min(k,B)}$, and the competitive ratio of this deterministic algorithm is $\max_{k\geq 1} \frac{\min(k,B+x-1)}{\min(k,B)}$, i.e., for the worst possible input $k$.
\noindent{\bf Randomized algorithms and the optimal algorithm.} As opposed to the AdWords problem, one interesting aspect here is that the optimal algorithm is randomized. A randomized algorithm for the ski rental problem is represented by a (marginal) probability distribution $(p_1, p_2, \ldots, p_N)$, with the semantics that for each $x \in \{1, 2, \ldots, N\}$, the value $p_x$ denotes the probability that the we rent skis for the first (up to) $x-1$ days and buy skis on day $x$, if the season extends that far. In the most interesting case $N \to \infty$ we note that the optimal choices are given by $p_i = (\frac{B-1}{B})^{B-i}\frac{c}{B}$ for $i=1,\ldots,B$, where $c=\frac{1}{ 1 - (1 - 1/B)^B}$ so these probabilities sum to $1$. It has a competitive ratio of $\frac{1}{1 - (1 - 1/B)^B}$, which tends to $\frac{e}{e - 1} \approx 1.582$ as $B \to \infty$~\citep{Karlin86}.
\subsection{Learning the optimal algorithm via adversarial training}
In this section, we show how the framework finds a strategy very close to the textbook-optimal randomized algorithm.
\textbf{Representation.} Our goal here is to learn an algorithm that works for {\em all} values of $B$ and $N \to \infty$. This is out of reach for traditional optimization methods for a number of reasons, the most obvious one being the infinite number of variables one needs to optimize over. As $B$ and $N$ can be (asymptotically) large, we instead work with a continuous space, where every parameter is essentially normalized by $N$. In this setting, time goes over the range $[0,1]$ indicating what fraction of the time horizon has passed. At time $\tau\in [0,1]$, if we are still skiing, the cost of renting from the beginning of time up to this point is captured by $\tau$. The cost of buying is captured by a real number $\beta\in [0,1]$, which is the fraction of the time one needs to go skiing in order to make buying the skis worthwhile. If the season ends at point $\alpha$ of the continuous timeline, the optimal offline cost is $\min(\alpha,\beta)$. The algorithm's cost is $\beta + \tau$, if we choose to buy at point $\tau\in [0,1]$ where $\tau\leq \alpha$, and the cost is $\alpha$ if we don't buy before point $\alpha$.
The algorithm network takes $\beta$ as input, and outputs a randomized algorithm for the particular $\beta$ as a cumulative distribution function (cdf) of buying probabilities over time.
We access the algorithm by querying the cdf.
To instantiate the algorithm for a particular pair of $B,N$ values, we run it with $\beta=B/N$, and query the returned cdf at $\tau = i/N$ for $i=1,\ldots,N$.
\textbf{Adversarial training.}
For the ski rental problem, we apply a subset of the full YaoLearner~ framework. Specifically, we train a deep neural network to represent the algorithm, but for the adversary, we don't resort to deep neural networks. This decouples the algorithmic from the adversarial training and showcases that best-response training is effective.
The training goes as follows: fix an algorithm network, find (via a search) the worst-case input in terms of CR to this fixed network, optimize the algorithm network on this input and repeat. The {\bf algorithm network} is a deep neural network that takes $\alpha,\beta\in[0,1]$ as inputs, computes the CDF of a probability distribution $p_\beta$, and outputs the value of the CDF at $\alpha$. As for the architecture of the algorithm neural network, we use $50$ Gaussian kernels $N(x_i,\sigma)$ for $i=1,\ldots,50$ with fixed means (i.e., $x_i$'s equally spaced over $[0,1]$) and standard deviation $\sigma=2/50$, and take a weighted average of these Gaussian kernels as the distributions learned by our neural network. In particular, given any $(\alpha,\beta)$ as input, the neural network uses $\beta$ to derive weights $w_i$'s over the Gaussian kernels (where $\sum_i w_i=1$), and returns the weighted sum of the CDF of these fixed Gaussian kernels at point $\alpha$ as the output of the algorithm. We use a fairly generic neural network structure to learn the kernel weights: the network takes $(\alpha, \beta)$ as inputs and first applies 4 hidden ReLU-activated layers with 256 neurons. The last hidden layer, the one that outputs $w$, is a softmax-activated. Adam optimizer~\citep{kingma2014adam} with the default parameters is used to train the network
On the {\bf adversary} side, in each training iteration, we randomly sample a small number of values for $\beta$, and for each sampled $\beta$ we use an $\epsilon$-net over $[0,1]$ as values of $\alpha$ with $\epsilon$ chosen to be $0.01$. We approximately evaluate the competitive ratios (up to certain precision) of the current algorithm for these $(\alpha,\beta)$ instances, and train the algorithm neural network with the instance where it gets the worst competitive ratio. The approximation is due to not really taking a integral over the learned cdf but rather a step function approximation of it.
\begin{figure}[h]
\begin{center}
\includegraphics[width=\textwidth,height = 6cm]{figs/sr_cont_alg_behaviour.pdf}
\caption{The learnt algorithm instantiated at various $(B,N)$ values as CDF of buying over time (blue curve). The x-axis denotes the number of days the algorithm has seen so far and the y-axis denotes the buying probability. The blue curve is the trained agent's output, while the orange correspond to the theoretical optimal strategy.}
\label{fig:continuousskirental}
\end{center}
\end{figure}
We demonstrate the trained algorithm in Figure~\ref{fig:continuousskirental} by instantiating it at various values of $B$ and $N$. The result is very close to the optimal strategy in all cases
We also note here that the competitive ratio achieved by this algorithm converges approximately to $1.59$ within a few minutes of training, about $0.01$ worse than the optimal value ($1.582$).
\section{Preliminaries and training framework}\label{sec:prelims}
Consider a (possibly infinite) two-player zero-sum game matrix $V$, where we denote the row player as the \emph{algorithm player}, and the column player as the \emph{adversary} who determines the inputs to the algorithm. Each row represents a deterministic algorithm $\mc{A}$, and each column represents a specific input instance $\mc{I}$, and the corresponding entry $V(\mc{A},\mc{I})$ specifies the payoff to the adversary if the algorithm player plays strategy $\mc{A}$, and the adversary plays strategy $\mc{I}$. We follow the custom that the algorithm player aims to minimize the payoff to the adversary, while the adversary tries to achieve the opposite. In the case of online algorithms, if we are working with a problem with minimization objective, the payoff $V(\mc{A},\mc{I})$ will be the competitive ratio (CR) of $\mc{A}$ for input $\mc{I}$. Similarly, for a maximization problem, we take $V(\mc{A},\mc{I})$ as the negation of the above competitive ratio. We note that general (non-online) algorithmic problems can be cast in the language of two-player zero-sum games as well.
\textbf{Yao's Lemma.} Online algorithms are often randomized since hedging between different input continuations can be elegantly achieved via randomization.
A randomized algorithm can be viewed as a distribution ${\bm{p}}$ over rows of $V$ (i.e., deterministic algorithms); an input distribution ${\bm{q}}$ can be viewed as a distribution over columns of $V$ (i.e., input instances). The optimal (potentially randomized) algorithm ${\bm{p}}^*$ is one whose expected payoff against the worst-case input is minimized, i.e., ${\bm{p}}^* = \arg\min_{{\bm{p}}} \max_{\mc{I}} {\bm{p}}^T V(:,\mc{I})$. A standard result in game-theory stipulates that once you fix a randomized algorithm, then maximizing over pure instances (columns) is equivalent to maximizing over input distributions. The namesake of our paper, Yao's Lemma~\citep{Yao77} says that there exists a distribution ${\bm{q}}^*$ over inputs such that the expected payoff of the best (deterministic) algorithm over ${\bm{q}}^*$ is the same as the value of the best randomized algorithm ${\bm{p}}^*$ over its worst possible (pure) input. In other words, $\max_{\mc{I}} ({\bm{p}}^*)^T V(:, \mc{I}) = \min_{\mc{A}} V(\mc{A}, :) {\bm{q}}^*$. This is, of course, simply an elegant application of von Neumann's minmax theorem aka strong duality to this specific game. Using classic game theory notations, we also refer to the best randomized algorithm as the row player's minmax strategy, and ${\bm{q}}^*$ the column player's maxmin strategy. Solving an online optimization problem corresponds to solving the above zero-sum game, specifically finding ${\bm{p}}^*$.
\textbf{Fixed distribution vs. adversarial training.} Most prior work explores algorithmic learning by fixing some input distribution ${\bm{q}}$ and training only the ${\bm{p}}$ side. We argue this leads to some major issues in learning robust algorithms. Firstly, we know from basic game theory that optimizing ${\bm{p}}$ under a fixed ${\bm{q}}$ converges to a deterministic algorithm, which could be significantly sub-optimal compared to a randomized ${\bm{p}}^*$ (this is indeed the case in ski rental).
For a simple example, consider the game of rock-paper-scissors. The optimal row strategy is to play the three moves uniformly at random. However, if one fixes the column strategy (e.g., 30\% rock, 40\% paper, 30\% scissors), the optimal response is always a deterministic strategy (e.g., always play scissors). Secondly, even if the optimal algorithm is deterministic (as in AdWords), there is no guarantee that it can be found as the optimal response to a fixed distribution of inputs. In fact, if we were to train against the fixed ${\bm{q}}^*$, there may be other best responses besides ${\bm{p}}^*$. In rock-paper-scissors, any row (and any mixed row strategy) is a best response to the maxmin column strategy $(1/3, 1/3, 1/3)$. This issue has been acknowledged in~\cite{kong2018new}: they combine multiple types of special input distributions (e.g., universal and high-entropy training sets) and use the implicit regularization of reinforcement learning to train robust algorithms.
Indeed, solving the game requires co-training both the row (algorithm) and column (input) sides. Adversarial training seems to be the ``right thing'' to train algorithms with worst-case guarantees, and the unique challenge in our case requires co-training the Adversary as well, which extends and strengthens the existing adversarial training framework. We note in \Cref{sec:adwords} that training an algorithm via YaoGAN is appears significantly easier than with previous fixed-distribution approaches. Furthermore, we give an indirect theoretical justification for the power of adversarial learning for solving zero-sum games using no-regret dynamics (see supplementary material).
\section{YaoLearner}\label{sec:yaogan}
\section{The YaoLearner~framework}\label{sec:yaogan}
We next describe how we implement and stabilize adversarial training for finding max-min strategies through a training framework that we call \emph{YaoLearner} due to the inspiration from Yao's Lemma (Appendix~\ref{sec:game-theory}).
However, a straightforward implementation of the classic max-min strategy algorithm of \citep{FS96} will be infeasible since finding the best response is often a hard non-convex global optimization problem. Indeed, adversarial responses for the problem require complicated structures to be inferred. One needs to develop a sound strategy to finding good adversarial responses and a mitigation strategy when the search is unsuccessful.
\begin{figure}
\centering
\resizebox{0.55\textwidth}{!}{
\begin{tikzpicture}
\node[draw, text width=1.8cm, text centered] at (0,0) (ALG) {Algorithm Network};
\node[draw, text width=1.8cm, text centered] at (-4,-4) (EXP) {Experience Array};
\node[draw, text width=1.8cm, text centered] at (4,-4) (ADV) {Adversary network};
\path (ALG) -- node[draw] (E1) {Evaluation $V(\cdot, \cdot)$} (ADV);
\draw (ALG) -- (E1);
\draw[->, -{Latex[width=3mm]}] (E1) --node{Restart + train} (ADV);
\draw[->, -{Latex[width=3mm]}] (ADV) --node[above]{Append} (EXP);
\path (EXP) -- node[draw] (E2) {Evaluation $V(\cdot, \cdot)$} (ALG);
\draw (EXP) --node{Fix best input} (E2);
\draw[->, -{Latex[width=3mm]}] (E2) --node{Train} (ALG);
\end{tikzpicture}}
\caption{The YaoLearner~framework}
\label{fig:yaogan-framework}
\end{figure}
The YaoLearner~framework can be conceptually divided into four components: the algorithm network, the adversary network, the evaluation environment $V(\cdot, \cdot)$ and the experience array (see \Cref{fig:yaogan-framework}). The algorithm network takes the problem-specific online request as input (e.g., arriving bid in the AdWords), and outputs an irrevocable decision (e.g., assignment of the bid in AdWords). Its weights start of at random and are trained until the learned algorithm converges. The adversary network takes random noise as input and outputs the full input (e.g., a complete sequence of bid weights). The weights of the adversary network are frequently reinitialized in order to maximize the probability of finding the worst-case input to a moving algorithm network. Naturally, these two networks require us to model the space of algorithms and inputs with the parameters of the networks.
\textbf{An evaluation environment} evaluates the algorithm network \ensuremath{\text{\normalfont\scshape alg\ }}} %{\ensuremath{\mathrm{ALG}}\xspace on an input $i$ and assigns to it a competitive ratio $V(ALG, i)$. We assume in this section that the algorithm wants to maximize the CR and the adversary wants to minimize it. As a reminder, the CR is equal to the ratio of the algorithm's reward to the offline optimum. Specifically, to obtain the algorithm's reward, the evaluation environment feeds the online requests to the algorithm network one-by-one, observes the irrevocable decision, executes the decision and repeats until all requests in the input are exhausted. Furthermore, to obtain the offline optimum, the environment finds the solution with brute force for simple problems or using a linear programming solver (in the case of AdWords).
\textbf{Differentiability issues.} To facilitate backpropagation, we assume that the evaluation measure (namely, competitive ratio) $V(\ensuremath{\text{\normalfont\scshape alg\ }}} %{\ensuremath{\mathrm{ALG}}\xspace, i)$ is differentiable --- this applies both to the algorithm's reward (numerator) and to the offline optimum (denominator). This is often a priori not the case and measures need to be taken to appropriately relax the problem. For example, in the AdWords problem the algorithm outputs a discrete bid-to-advertiser assignment value; this discrete assignment is incompatible with differentiability. We circumvent the issue by allowing fractional bid-to-advertiser assignments and show the learned fractional algorithm retains the salient properties of the discrete optimal.
On the other hand, we ensure the differentiability of the offline optimums by computing the optimum (via a brute force search or a linear program solver) for a few perturbed instances and then calculating the (sub)gradient. These issues are problem-specific and we leave them outside of the YaoLearner~framework.
\begin{figure}[t]
\centering
\begin{minipage}{0.6\textwidth}
\begin{algorithm}[H]
\begin{algorithmic}{\small
\STATE \textbf{Input:}
\STATE Differentiable evaluation function $V(\cdot, \cdot)$
\STATE Parameters $T, \ensuremath{T_{\text{alg}}}\xspace,\ensuremath{T_{\text{adv}}}\xspace,\ensuremath{T_{\text{add}}}\xspace, \ensuremath{T_{\text{restart}}}\xspace,\ensuremath{n_{\text{batch}}}\xspace$.
\STATE {\color{blue}Optional: fixed distribution $D$, parameter $\alpha$}
\vspace*{2ex}
\STATE Initialize algorithm and adversary networks \ensuremath{\text{\normalfont\scshape alg\ }}} %{\ensuremath{\mathrm{ALG}}\xspace and \ensuremath{\text{\normalfont\scshape adv\ }}} %{\ensuremath{\mathrm{ADV}}\xspace.
\STATE Initialize the experience array $E$.
\STATE Populate $E$ with $\ensuremath{n_{\text{batch}}}\xspace$ random inputs.
\STATE \textbf{For $t=1,\ldots,T$}
\STATE \textbf{~~~~~~For $u=1,\ldots,\ensuremath{T_{\text{alg}}}\xspace$}
\STATE ~~~~~~~~~~~~{\color{blue}With probability $\alpha$:
\STATE ~~~~~~~~~~~~~~~$I \gets \ensuremath{n_{\text{batch}}}\xspace$ random instances from $D$.
\STATE ~~~~~~~~~~~~~~~Update $\ensuremath{\text{\normalfont\scshape alg\ }}} %{\ensuremath{\mathrm{ALG}}\xspace$ via $\nabla_{\ensuremath{\text{\normalfont\scshape alg\ }}} %{\ensuremath{\mathrm{ALG}}\xspace} \frac{1}{\ensuremath{n_{\text{batch}}}\xspace}\sum_{i\in I}V(\ensuremath{\text{\normalfont\scshape alg\ }}} %{\ensuremath{\mathrm{ALG}}\xspace, i)$.
\STATE ~~~~~~~~~~~~With probability $1-\alpha$:}
\STATE ~~~~~~~~~~~~~~~$I \gets \ensuremath{n_{\text{batch}}}\xspace$ random instances from $E$.
\STATE ~~~~~~~~~~~~~~~$i^* \gets \arg \min_{i \in I} V(\ensuremath{\text{\normalfont\scshape alg\ }}} %{\ensuremath{\mathrm{ALG}}\xspace, i)$
\STATE ~~~~~~~~~~~~~~~Update $\ensuremath{\text{\normalfont\scshape alg\ }}} %{\ensuremath{\mathrm{ALG}}\xspace$ via $\nabla_{\ensuremath{\text{\normalfont\scshape alg\ }}} %{\ensuremath{\mathrm{ALG}}\xspace} V(\ensuremath{\text{\normalfont\scshape alg\ }}} %{\ensuremath{\mathrm{ALG}}\xspace, i^*)$.
\STATE \textbf{~~~~~~For $u=1,\ldots,\ensuremath{T_{\text{adv}}}\xspace$}
\STATE{~~~~~~~~~~~~Sample $\ensuremath{n_{\text{batch}}}\xspace$ random Gaussian tensors $z$}.
\STATE{~~~~~~~~~~~~Update $\ensuremath{\text{\normalfont\scshape adv\ }}} %{\ensuremath{\mathrm{ADV}}\xspace$ via $-\nabla_{\ensuremath{\text{\normalfont\scshape adv\ }}} %{\ensuremath{\mathrm{ADV}}\xspace} V(\ensuremath{\text{\normalfont\scshape alg\ }}} %{\ensuremath{\mathrm{ALG}}\xspace, \ensuremath{\text{\normalfont\scshape adv\ }}} %{\ensuremath{\mathrm{ADV}}\xspace(z))$}.
\STATE \textbf{~~~~~~If} $t \bmod \ensuremath{T_{\text{add}}}\xspace = 0$
\STATE ~~~~~~~~~~~~Generate $\ensuremath{n_{\text{batch}}}\xspace$ inputs using \ensuremath{\text{\normalfont\scshape adv\ }}} %{\ensuremath{\mathrm{ADV}}\xspace.
\STATE ~~~~~~~~~~~~Sample $\ensuremath{n_{\text{batch}}}\xspace$ inputs from $E$.
\STATE ~~~~~~~~~~~~$I \gets$ the above $2 n_{batch}$ inputs
\STATE ~~~~~~~~~~~~$i^* \gets \arg\min_{i \in I} V(\ensuremath{\text{\normalfont\scshape alg\ }}} %{\ensuremath{\mathrm{ALG}}\xspace, i)$
\STATE ~~~~~~~~~~~~Append $i^*$ to $E$.
\STATE \textbf{~~~~~~If} $t \bmod \ensuremath{T_{\text{restart}}}\xspace = 0$
\STATE ~~~~~~~~~~~~Reinitialize \ensuremath{\text{\normalfont\scshape adv\ }}} %{\ensuremath{\mathrm{ADV}}\xspace to produce random inputs.
}\end{algorithmic}
\caption{Generic YaoLearner~Training Paradigm.}
\label{alg:yaogan}
\end{algorithm}
\end{minipage}
\end{figure}
\textbf{An experience array} contains the historical best responses generated by the adversary network. The adversary network goes through cycles of weight re-initialization, training until convergence and storing its final result into the experience array. Moreover, the algorithm network is trained via the experience array and not via the adversary network directly. At each training step of the algorithm, we take some number of samples from the experience array, evaluate the algorithm's performances by computing the CR, find the worst input (smallest CR) among them for the current algorithm, and train the algorithm against that input.
The experience array stabilizes the training and resolves a multitude of issues. The most apparent one is that training the adversary network to convergence takes significantly more time than one step of the algorithm training. Experience arrays amortize the time spent during adversarial training with an equal amount of algorithm network training. Furthermore, an empirical issue that hinders the training is that the adversary network can often fail to find the best response possible. This is not at all unexpected since the question can be intractable in general. Experience arrays allow the adversary networks to use multiple tries in finding the best counterexample. This counterexample might then be used multiple times since one often needs to train on it a few times in succession or revisit it during later training.
One explanation on why such training is effective is that hard distributions often have small support (a small number of different inputs). This is the case in \cite{kong2018new} where the handcrafted adversarial distributions often comprise a small number of different inputs (although their structure might be complex). Furthermore, even if all sets are of large size, one might still find a satisfactory small-set approximation that converges to the right set.
\textbf{Extension to the robust stochastic setting.} The training algorithm takes an optional distribution $D$ of input instances and a parameter $\alpha \in [0,1]$; in each training iteration for the algorithm network, with probability $\alpha$ we train using samples drawn from $D$, and otherwise we train using samples drawn from the experience array. Moreover, in iterations where we train with samples from $D$, we use the average performance of the algorithm on these instances as the reward function. This extension allows us to learn algorithms in the robust stochastic setting; $\alpha$ controls the trade-off between the distributional and adversarial shock regimes.
\textbf{Pseudocode.} The pseudocode of YaoLearner~is given in \Cref{alg:yaogan}. For the worst-case, \emph{tabula rasa}, training we skip the {\color{blue}optional segments marked in blue}. Robust stochastic setting includes the blue segments (e.g., provides $D$, $\alpha$). We make a final note that our adversary network takes $\ensuremath{n_{\text{noise}}}\xspace$-dimensional Gaussian noise as input and generates a problem instance. The random noise was typically attenuated during training, but we empirically found that it helped with input space exploration. We use hyperparameters $\ensuremath{n_{\text{batch}}}\xspace = 100$, $\ensuremath{n_{\text{noise}}}\xspace = 100$, $\ensuremath{T_{\text{alg}}}\xspace=\ensuremath{T_{\text{adv}}}\xspace=4$, $\ensuremath{T_{\text{add}}}\xspace=100$, and $\ensuremath{T_{\text{restart}}}\xspace = 100$. The Adam~\cite{kingma2014adam} optimizer is used with paper-suggested parameters. All our experiments were done using TensorFlow 2.0 on a single desktop PC.
| {'timestamp': '2020-10-19T02:18:25', 'yymm': '2010', 'arxiv_id': '2010.08418', 'language': 'en', 'url': 'https://arxiv.org/abs/2010.08418'} | arxiv |
\section{Technical Proofs}
\subsection{Proof of Lemma~\ref{lem:bold}}\label{app:L2}
\newcommand{K_\infty\models\varphi}{K_\infty\models\varphi}
\newcommand{t\to t'}{t\to t'}
Let $\mathsf{BSCC}$ denote the set of BSCCs of the chain-automaton product and $\mathsf{SCC}$ the set of its SCCs.
For a subset $K$ of states of the product, $\skcand k(K)$ denotes the event (random predicate) of $K$ being a candidate with strength at least $k$ on a run of the product.
Further, the ``weak'' version $\kcand k(K)$ denotes the event that $K$ has strength $k$ when counting visits even prior to discovery of $K$, i.e. each state of $K$ has been visited and exited at least $k$ times on a prefix $\path$ of the run with $K(\path)=K$.
Previous work bounds the probability that a non-BSCC can be falsely deemed BSCC based on the high strength it gets.
\begin{lemma}[\cite{DacaHKP17}
For every set of states $K\notin\mathsf{BSCC}$, and every $s\in K$, $k\in\mathbb N$,
$$
\mathbb P_s[\kcand k (K)]\leq (1-\mathsf{p}_{\mathsf{min}})^k\,.
$$
\end{lemma}
\begin{proof}
Since $K$ is not a BSCC, there is a state $t\inK$ with a transition to $t'\notinK$.
The set of states $K$ becomes a $k$-candidate of a run starting from $s$, only if $t$ is visited at least $k$ times by the path and was never followed by $t'$ (indeed, even if $t$ is the last state in the path, by definition of a $k$-candidate, there are also at least $k$ previous occurrences of $t$ in the path).
Further, since the transition from $t$ to $t'$ has probability at least $\mathsf{p}_{\mathsf{min}}$, the probability of not taking the transition $k$ times is at most $(1-\mathsf{p}_{\mathsf{min}})^k$.
\end{proof}
In contrast to \cite{DacaHKP17}, we need to focus on runs where $\varphi$ is satisfied.
For clarity of notation, we let $K\models\varphi$ denote that $K$ is good, and $K\not\models\varphi$ denote that $K$ is bad.
In particular, $K_\infty\models\varphi$
denotes the event that the run satisfies $\varphi$.
\begin{lemma}\label{lem:one-cand}
For every set of states $K\notin\mathsf{BSCC}$, and every $s\in K$, $k\in\mathbb N$,
$$
\mathbb P_s[\kcand k (K)\mid K_\infty\models\varphi]\leq (1-\mathsf{p}_{\mathsf{min}})^k\,.
$$
\end{lemma}
\begin{proof}
The previous argument applies also in the case where we assume that after this strength is reached the run continues in any concrete way (also satisfying $\varphi$) due to the Markovian nature of the product:
\begin{align*}
&\mathbb P_s[\kcand k (K)\mid K_\infty\models\varphi]\\
=& \sum_{t\to t'}\mathbb P_s[\kcand k (K), K\text{ exited by }t\to t'\mid K_\infty\models\varphi]\\
=& \sum_{t\to t'}\mathbb P_s[\kcand k (K), K\text{ exited by }t\to t', K_\infty\models\varphi]/\mathbb P_s[ K_\infty\models\varphi]\\
=& \sum_{t\to t'}\mathbb P_s[\kcand k (K), K\text{ exited by }t\to t'] \cdot \mathbb P_s[K_\infty\models\varphi\mid \kcand k (K), K\text{ exited by }t\to t'] /\mathbb P_s[ K_\infty\models\varphi]\\
\stackrel{(1)}=& \sum_{t\to t'}\mathbb P_s[\kcand k (K), K\text{ exited by }t\to t'] \cdot\mathbb P_s[K_\infty\models\varphi\mid K\text{ exited by }t\to t'] /\mathbb P_s[K_\infty\models\varphi]\\
\stackrel{(2)}=& \sum_{t\to t'}\mathbb P_s[\kcand k (K), K\text{ exited by }t\to t'] \cdot\mathbb P_{t'}[K_\infty\models\varphi] /\mathbb P_s[ K_\infty\models\varphi]\\
\leq&\sum_{t\to t'\text{ exiting }K}\mathbb P_s[\text{reach }t]\mathbb P_t[\text{not take }t\to t'\text{in }k\text{ visits of }t]\cdot\mathbf{P}(t,t') \cdot\mathbb P_{t'}[K_\infty\models\varphi] /\mathbb P_s[ K_\infty\models\varphi] \\
=&\sum_{t\to t'\text{ exiting }K}\mathbb P_t[\text{not take }t\to t'\text{in }k\text{ visits of }t] \mathbb P_s[\text{reach }t]\cdot\mathbf{P}(t,t')\cdot\mathbb P_{t'}[K_\infty\models\varphi] /\mathbb P_s[ K_\infty\models\varphi] \\
\leq&\sum_{t\to t'\text{ exiting }K}(1-\mathsf{p}_{\mathsf{min}})^k\mathbb P_s[\text{reach $t'$ as the first state outside $K$}] \cdot\mathbb P_{t'}[K_\infty\models\varphi] /\mathbb P_s[ K_\infty\models\varphi]\\
=& (1-\mathsf{p}_{\mathsf{min}})^k \mathbb P_s[K_\infty\models\varphi] /\mathbb P_s[ K_\infty\models\varphi]\\
=&(1-\mathsf{p}_{\mathsf{min}})^k
\end{align*}
\noindent where (1) follows by the Markov property and by a.s. $K\neqK_\infty$, (2) by the Markov property.
\end{proof}
In the next lemma, we lift the results from fixed designated candidates to arbitrary discovered candidates, at the expense of requiring the (strong version of) strength instead of only the weak strength.
To that end, let \emph{birthday} $b_i$ be the moment when $i$th candidate on a run is discovered, i.e., a run is split into $\rho=\path b_i\rho'$ so that $K_i=K(\path b_i)\neqK(\path)$.
In other terms, $b_i$ is the moment we start counting the occurences for the strength, whereas the weak strength is already 1 there.
\begin{lemma}\label{lem:ith-cand}
For every $i,k\in\mathbb N$, we have $$\mathbb P[\skcand k(K_i) \mid K_i\notin\mathsf{BSCC},K_\infty\models\varphi]\leq (1-\mathsf{p}_{\mathsf{min}})^k\,.$$
\end{lemma}
\begin{proof}
\begin{align*}
&\mathbb P[\skcand k(K_i) \mid K_i\notin\mathsf{BSCC},K_\infty\models\varphi]\\[0.2cm]
&= \frac{\mathbb P[\skcand k(K_i), K_i\notin\mathsf{BSCC},K_\infty\models\varphi]}{\mathbb P[K_i\notin\mathsf{BSCC},K_\infty\models\varphi]}\\
&= \frac1{\mathbb P[K_i\notin\mathsf{BSCC},K_\infty\models\varphi]} \sum_{\substack{C\in\mathsf{SC}\setminus\mathsf{BSCC}\\s\in C}}\mathbb P[\skcand k(C),K_i=C,b_i=s,K_\infty\models\varphi]\\
&= \frac1{\mathbb P[K_i\notin\mathsf{BSCC},K_\infty\models\varphi]} \sum_{\substack{C\in\mathsf{SC}\setminus\mathsf{BSCC}\\s\in C}}\mathbb P[K_i=C,b_i=s]\cdot\mathbb P_s[\kcand k (C),K_\infty\models\varphi] \\
&= \frac1{\mathbb P[K_i\notin\mathsf{BSCC},K_\infty\models\varphi]} \sum_{\substack{C\in\mathsf{SC}\setminus\mathsf{BSCC}\\s\in C}}\mathbb P[K_i=C,b_i=s]\cdot\mathbb P_s[\kcand k (C)\midK_\infty\models\varphi]\cdot\mathbb P_s[K_\infty\models\varphi] \\
&\leq \frac{(1-\mathsf{p}_{\mathsf{min}})^k }{\mathbb P[K_i\notin\mathsf{BSCC},K_\infty\models\varphi]} \sum_{\substack{C\in\mathsf{SC}\setminus\mathsf{BSCC}\\s\in C}}\mathbb P[K_i=C,b_i=s]\cdot\mathbb P_s[K_\infty\models\varphi]\tag{by Lemma~\ref{lem:one-cand}}\\
&\leq \frac{(1-\mathsf{p}_{\mathsf{min}})^k }{\mathbb P[K_i\notin\mathsf{BSCC},K_\infty\models\varphi]} \sum_{\substack{C\in\mathsf{SC}\setminus\mathsf{BSCC}\\s\in C}}\mathbb P[K_i=C,b_i=s,K_\infty\models\varphi]\\
&= (1-\mathsf{p}_{\mathsf{min}})^k
\end{align*}
with the last equality due to $$K_i\notin\mathsf{BSCC}\capK_\infty\models\varphi=\biguplus_{\substack{C\in\mathsf{SC}\setminus\mathsf{BSCC}\\s\in C}}K_i=C,b_i=s,K_\infty\models\varphi$$
\end{proof}
The set $\mathcal E\mathit{rr}$ of the next lemma is actually exactly the set considered in Lemma~\ref{lem:bold} but in a more convenient notation for the computation.
\begin{lemma}\label{lem:more-cand}
For $(k_i)_{i=1}^\infty\in\mathbb N^\mathbb N$, let
$\mathcal E\mathit{rr}$ be the set of runs such that for some $i\in\mathbb N$, we have $\skcand {k_i}(K_i)$ despite $K_i\not\models\varphi$ and $K_{\infty}\models\varphi$.
Then $$\displaystyle\mathbb P[\mathcal E\mathit{rr}]<p_\varphi\sum_{i=1}^\infty (1-\mathsf{p}_{\mathsf{min}})^{k_i}\,.$$
\end{lemma}
\begin{proof}
\begin{align*}
\mathbb P[\mathcal E\mathit{rr}]
&=\mathbb P\left[\bigcup_{i=1}^{\infty} \Big( \skcand {k_i}(K_i) \cap K_i\not\models\varphi\capK_\infty\models\varphi\Big)\right]\\
&\leq\mathbb P\left[\bigcup_{i=1}^{\infty} \Big( \skcand {k_i}(K_i) \cap K_i\notin\mathsf{BSCC}\capK_\infty\models\varphi\Big)\right]\\
&\leq\sum_{i=1}^{\infty}\mathbb P[\skcand {k_i}(K_i)\cap K_i\notin\mathsf{BSCC} \cap K_\infty\models\varphi] \tag{by the union bound}\\
&=\sum_{i=1}^{\infty}\mathbb P[\skcand {k_i}(K_i) \mid K_i\notin\mathsf{BSCC}\capK_\infty\models\varphi]\cdot\mathbb P[K_i\notin\mathsf{BSCC}\midK_\infty\models\varphi]\cdot\mathbb P[K_\infty\models\varphi]\\
&\leq \sum_{i=1}^{\infty}\mathbb P[\skcand {k_i}(K_i) \mid K_i\notin\mathsf{BSCC}\capK_\infty\models\varphi]\cdot 1\cdot p_\varphi\\
&=p_\varphi\sum_{i=1}^{\infty}(1-\mathsf{p}_{\mathsf{min}})^{k_i}~. \tag{by Lemma~\ref{lem:ith-cand}}
\end{align*}
\end{proof}
\begin{proof}[of Lemma~\ref{lem:bold}]
Recall that Lemma~\ref{lem:bold} claims that
$$\mathbb P[\mathcal E\mathit{rr}]\leq \rc{\varepsilon}p_\varphi$$
for $k_i:=(i\rc{-\log\varepsilon})\cdot\frac{-1}{\log(1-\mathsf{p}_{\mathsf{min}})}$.
Directly from previous lemma by plugging in these $k_i$, we obtain
$$\mathbb P[\mathcal E\mathit{rr}]\leq p_\varphi\sum_{i=1}^\infty (1-\mathsf{p}_{\mathsf{min}})^{k_i}=p_\varphi\sum_{i=1}^\infty 2^{-i}\rc{2^{\log\varepsilon}}=p_\varphi \rc{\varepsilon}\,.$$
\end{proof}
\subsection{Proof of Theorem~\ref{thm:performance-known-pmin}}\label{app:performance-known-pmin}
\begin{proof}[of Theorem~\ref{thm:performance-known-pmin}]
Let $I_{ji,k}$ be the number of steps between the $j$-th and $(j+1)$th reset such that the current candidate is $K_i$, and its strength is
$k$. Observe that for a Markov chain with $n$ states we have $I_{ji,k} = 0$ if $i > n$ or $j > \alpha(i- \log\varepsilon)$. Indeed, if the Markov chain has $n$ states,
then along the run there are at most $n$ candidates; moreover, the strength of the $K_i$ stays strictly below
$\alpha(i-\log\varepsilon)$, because otherwise the run is aborted. So we have
\begin{equation}
\label{eq:T}
T = \sum_{j=1}^\infty T_j = \sum_{j=1}^\infty T_{j}^\bot + \sum_{j=1}^\infty T_{j}^C = \sum_{j=1}^\infty T_{j}^\bot +
\sum_{j=1}^\infty \sum_{i=1}^n \sum_{k=1}^{\alpha(i- \log\varepsilon)} I_{ji,k}
\end{equation}
\noindent and so, by linearity of expectations,
\renewcommand{\arraystretch}{1.5}
\begin{equation}
\label{eq:Tbound}
\begin{aligned}
\mathbb E(T) & = \mathbb E\left( \sum_{j=1}^{\infty} \left( T_{j}^\bot + \sum_{i=1}^n \sum_{k=1}^{\alpha(i- \log\varepsilon)} I_{ji,k} \right) \right) \\
& = \mathbb E\left( \sum_{j=1}^{\infty} T_{j}^\bot \right) +
\sum_{i=1}^n \sum_{k=1}^{\alpha(i- \log\varepsilon)} \sum_{j=1}^{\infty} \mathbb E\left( I_{ji,k} \right)
\end{aligned}
\end{equation}
Let us bound the first summand. Since $K(\pi)= \bot$ only holds when the
last state of $\path$ is visited for the first time, we have $T_j^\bot \leq n$. Moreover, $T_j^\bot = 0$ for every $j \geq R$, the number of resets.
So we get
\begin{equation}
\label{eq:Tbound2}
\mathbb E\left( \sum_{j=1}^{\infty} T_{j}^\bot \right) \leq \mathbb E(n \cdot R) = n \cdot \mathbb E(R)
\end{equation}
Consider now the variables $I_{ji,k}$. If $j \geq R$ then $I_{ji,k}=0$ by definition, since there is no $(j+1)$-th reset. Moreover, under the condition
$j < R$ the variables $I_{ji,k}$ and $I_{(j+1)i,k}$ have the same expectation, because they refer to different runs. By Theorem \ref{thm:bold}(a) $R$ is geometrically distributed
with parameter at least $\mathsf{p}_{\varphi}(1-\varepsilon)$, and so we get
\begin{equation}
\label{eq:Tbound3}
\mathbb E(I_{(j+1)i,k}) \le \mathbb E(I_{ji,k}) \cdot (1-\mathsf{p}_{\varphi}(1-\varepsilon))
\end{equation}
Plugging (\ref{eq:Tbound}) and (\ref{eq:Tbound2}) into (\ref{eq:T}), and taking into account that $\mathbb E(R) \leq 1/ \mathsf{p}_{\varphi} (1 - \varepsilon)$, we obtain
\begin{equation}
\label{eq:Tbound4}
\begin{aligned}
\mathbb E(T) & \leq \mathbb E(n \cdot R) + \sum_{i=1}^n \sum_{k=1}^{\alpha(i- \log\varepsilon)} \left(\mathbb E(I_{0i,k}) \sum_{j=0}^{\infty} (1-\mathsf{p}_{\varphi}(1-\varepsilon))^j \right) \\
& = n \cdot \mathbb E(R) + \sum_{i=1}^n \sum_{k=1}^{\alpha(i- \log\varepsilon)} \frac{\mathbb E(I_{0i,k})}{\mathsf{p}_{\varphi}(1- \varepsilon)} \\
& \leq \frac{1}{\mathsf{p}_{\varphi}(1 - \varepsilon)} \left( n + \sum_{i=1}^n \sum_{k=1}^{\alpha(i- \log\varepsilon)} \mathbb E(I_{0i,k})\right)
\end{aligned}
\end{equation}
If we can find an upper bound $I \geq \mathbb E(I_{0i,k})$ for every $i, k$, then we finally get:
\begin{equation}
\label{eq:Tbound5}
\begin{aligned}
\mathbb E(T) & \leq \frac{1}{\mathsf{p}_{\varphi}(1 - \varepsilon)} \cdot n \cdot \left( 1 + \alpha (n- \log\varepsilon) \cdot I \right) \\
& \leq \frac{1}{\mathsf{p}_{\varphi}(1 - \varepsilon)} \cdot 2 n \alpha (n- \log\varepsilon) I
\end{aligned}
\end{equation}
Before estimating the bound $I$ let us consider the family of chains of Figure \ref{fig:smallscc},
and the property ${\ensuremath{\mathbf{F}}} p$. In this case the candidates contain only one state, and their strength increases whenever the self-loop
on the state is traversed. So $\mathbb E(I_{0i,k}) \leq 1$ holds for every $i, k$, and so we can take $I := 1$.
We now compute a bound $I \geq \mathbb E(I_{0i,k})$ valid for arbitrary chains. Recall that $\mathbb E(I_{0i,k})$ is the number of steps it takes to increase the
strength of the $i$-th candidate $K_i$ of the $0$-th run from $k$ to $k+1$. This is bounded by the number of steps it takes to visit every state of $K_i$ once. Let $\mathsf{{\scriptsize mxsc}} \in O(n)$ be the maximal
size of a SCC. Given any two states $s, s'$ of an SCC, the probability of reaching $s'$ from $s$ after at most $\mathsf{{\scriptsize mxsc}}$ steps is at least $\mathsf{p}_{\mathsf{min}}^{\mathsf{{\scriptsize mxsc}}}$.
So the expected time it takes to visit every state of an SCC at least once is bounded by $\mathsf{{\scriptsize mxsc}} \cdot \mathsf{p}_{\mathsf{min}}^{-\mathsf{{\scriptsize mxsc}}}$. So taking $I := \mathsf{{\scriptsize mxsc}} \cdot \mathsf{p}_{\mathsf{min}}^{-\mathsf{{\scriptsize mxsc}}}$
we obtain the final result.
\qed
\end{proof}
\section{The bold monitor}
We proceed in two steps. In Section \ref{subsec:chainwithpmin}, inspired by \cite{DacaHKP17}, we design a bold controller that knows the minimum probability $\mathsf{p}_{\mathsf{min}}$ appearing in
$\mathcal{M}$ (more precisely, a lower bound on it). In Section \ref{subsec:arbitrarychain} we modify this controller to produce another one that works correctly without any prior knowledge
about $\mathcal{M}$, at the price of a performance penalty.
\subsection{Chains with known minimal probability}
\label{subsec:chainwithpmin}
The cautious controller aborts a run if the strength of the current candidate exceeds a fixed threshold that remains constant throughout the execution.
In contrast, the bold controller dynamically increases the threshold, depending on
the number of different candidates it has seen since the last reset. Intuitively, the controller becomes bolder over time,
which prevents it from resetting too soon on the family of Figure \ref{fig:smallscc}, independently of the length of the chain.
The controller is designed so that it resets almost all bad runs and only a fixed fraction~$\varepsilon$ of the good runs.
Lemma~\ref{lem:bold} below shows how to achieve this. We need some additional definitions.
\paragraph{Strength of a candidate and strength of a path.} Let $\path$ be a path of $\mathcal{M}\otimes \mathcal{A}$.
The \emph{strength of $K(\path)$} in $\path$ is undefined if $K(\path) = \bot$.
Otherwise, write $\path = \path' \, s \, \kappa$, where $\path'$ is the shortest prefix of $\path$ such that $K(\path' s) = K(\path)$; the strength of $K(\path)$ is the largest $k$ such that every state of $K(\path)$ occurs at least $k$ times in $s \, \kappa$, and the last element of $s \, \kappa$ occurs at least $k+1$ times. Intuitively, if the strength is $k$ then every state of the candidate has been been exited at least $k$ times but, for technical reasons, we start counting only after the candidate is discovered. The function $\textsc{Str}(\path)$ returns the strength of $K(\path)$ if $K(\path) \neq \bot$, and $0$ otherwise.
\begin{example}
The following table illustrates the definition of strength.
$$\begin{array}{l|l|l|l|l|c}
\path & K(\path) & \path' & s & \kappa & \textsc{Str}(\path) \\ \hline
p_0p_1 & \bot & - & - & - & 0 \\
p_0p_1p_1 & \{p_1\} & p_0p_1 & p_1 & \epsilon & 0 \\
p_0p_1p_1p_1 & \{p_1\} & p_0p_1 & p_1 & p_1 & 1 \\
p_0p_1p_1p_1p_0 & \{p_0,p_1\} & p_0p_1p_1p_1 & p_0 & \epsilon & 0 \\
p_0p_1p_1p_1p_0p_1& \{p_0,p_1\} & p_0p_1p_1p_1 & p_0 & p_1 & 0 \\
p_0p_1p_1p_1p_0p_1p_0 & \{p_0,p_1\} & p_0p_1p_1p_1 & p_0 & p_1 p_0 & 1 \\
p_0p_1p_1p_1p_0p_1p_0p_0 p_1& \{p_0,p_1\} & p_0p_1p_1p_1 & p_0 & p_1 p_0 p_0 p_1& 2
\end{array}$$
\end{example}
\paragraph{Sequence of candidates of a run.} Let $\rho=s_0s_1\cdots$ be a run of $\Mc \otimes \dra$. Consider the sequence of random variables defined by $K(s_0\ldots s_j)$ for $j\geq 0$, and let $(K_i)_{i\geq 1}$ be the subsequence without undefined elements and with no repetition of consecutive elements.
For example, for $\varrho=p_0p_1p_1p_1p_0p_1p_2p_2\cdots$, we have $K_1=\{p_1\}$, $K_2=\{p_0,p_1\}$, $K_3=\{p_2\}$, etc.
Given a run $\rho$ with a sequence of candidates $K_1, K_2 \ldots, K_k$, we call $K_k$ ithe final candidate. We define the \emph{strength} of $K_i$ in $\rho$ as the supremum of the strengths of $K_i$ in all prefixes $\path$ of $\rho$ such that $K(\path) = K_i$. %
For technical convenience, we define $K_\ell:=K_j$ for all $\ell>j$ and $K_\infty:=K_j$. Observe that $\rho$ satisfies $\varphi$ if{}f its final candidate is good.
\begin{lemma} \label{lem:strength-increases}
W.p.1 the final candidate of a run $\rho$ is a BSCC of $\Mc \otimes \dra$. Moreover, for every $k$ there exists a prefix $\path_k$ of $\rho$ such that
$K(\pi_k)$ is the final candidate and $\textsc{Str}(\pi_k) \geq k$.
\end{lemma}
\begin{proof}
Follows immediately from the definitions, and the fact that w.p.1 the runs of a finite-state Markov chain eventually get trapped in a BSCC and visit
every state of it infinitely often.
\end{proof}
\paragraph{The bold monitor.} We bold monitor for chains with minimal probability
$\mathsf{p}_{\mathsf{min}}$, shown in Algorithm \ref{alg:boldalpha}. For every $\rho$ and $i \geq 1$, we define two random variables:
\begin{itemize}
\item $\textsc{Str}_i(\rho)$ is the strength of $K _i(\rho)$ in $\rho$;
\item $\textsc{Bad}_i(\rho)$ is \textbf{true} if $K _i(\rho)$ is a bad candidate, and \textbf{false} otherwise.
\end{itemize}
Let $\alpha_0 := \max\{1, - 1/\log(1-\mathsf{p}_{\mathsf{min}})\}$. The lemma states that, for every $\alpha \ge \alpha_0$ and $\varepsilon > 0$, the runs that satisfy $\varphi$ and in which some bad candidate, say $K_i$, reaches a strength of at least $\alpha(i-\log \varepsilon)$, have probability at most $\varepsilon \mathsf{p}_{\varphi}$. This leads to the following strategy for the controller: when the controller is considering the $i$-th candidate, abort only if the strength reaches $\alpha(i-\log\varepsilon)$.
\begin{lemma}
\label{lem:bold}
Let $\mathcal{M}$ be a finite-state Markov chain with minimum probability $\mathsf{p}_{\mathsf{min}}$, let
$\varphi$ be an LTL formula with positive probability $\mathsf{p}_{\varphi}$.
For every Markov chain $\mathcal{M}$ with minimal probability $\mathsf{p}_{\mathsf{min}}$, for every $\alpha \ge \alpha_0$ and $\varepsilon > 0$: $$\mathbb P \left[ \; \big\{ \rho \mid \rho \models \varphi \wedge \exists i \geq 1 \, . \,
\textsc{Bad}_i(\rho) \wedge \textsc{Str}_i(\rho) \geq \alpha(i\rem{+j}\rc{-\log\varepsilon}) \big\} \; \right] \leq \rem{2^{-j}}\rc{\varepsilon} \mathsf{p}_{\varphi}$$
\end{lemma}
\begin{proof}
The proof is quite technical and can be found in Appndix~\ref{app:L2} and is inspired by \cite{DacaHKP17}.
The main technical difficulty, compared to \cite{DacaHKP17} is omnipresent conditioning on the property $\varphi$ being satisfied.
This also allows for strengthening the bound by the factor of the probability to satisfy it.
\end{proof}
The monitor is parametric in $\alpha$ and~$\varepsilon$. The variable $C$ stores the current candidate, and is used to detect when the candidate changes. The variable $i$ maintains the index of the current candidate, i.e., in every reachable configuration of the algorithm, if $C \neq \bot$ then $C:= K_i$.
\begin{algorithm}[ht]
\caption{\textsc{BoldMonitor}$_{\alpha,\epsilon}$}
\label{alg:boldalpha}
\begin{algorithmic}[1]
\While {\textbf{true}}
\State $\path \gets \lambda$ \Comment{Initialize path}
\State $C \gets \bot$, $i \gets 0$ \Comment{Initialize candidate and candidate counter}
\Repeat
\State $\path \gets \path \,.\, \mathsf{NextState}(\path)$ \Comment{Extend path}
\If {$\bot \neq K(\path) \neq C$}
\State $C \gets K(\path)$; $i \gets i+1$ \Comment{Update candidate and candidate counter}
\EndIf
\Until {$\textsc{Bad}(\path)$ \textbf{and} $\textsc{Str}(\path) \geq \alpha(i\rem{+j}\rc{-\log\varepsilon})$}
\EndWhile
\end{algorithmic}
\end{algorithm}
The infinite-state Markov chain $\mathcal{B}$ of the bold monitor is defined as the chain $\mathcal{C}$ for the
cautious monitor; we just replace the condition that $\pi$ is bad (and thus has strength at least 1) by the condition that $K(\path)$ is bad and has strength $\alpha(i - \log \varepsilon)$. The random variable $R$ and the event $S_\varphi$ are also defined as for \textsc{CautiousMonitor}.
\begin{theorem}
\label{thm:bold}
Let $\mathcal{M}$ be a finite-state Markov chain with minimum probability $\mathsf{p}_{\mathsf{min}}$, and let
$\varphi$ be an LTL formula with probability $\mathsf{p}_{\varphi} > 0$ in $\mathcal{M}$.
Let $\mathcal{B}$ be the Markov chain, defined as above, corresponding to the execution of \textsc{BoldMonitor}$_{\alpha,\epsilon}$ on $\Mc \otimes \dra$, where $\alpha \ge \alpha_0$ and $\varepsilon > 0$. We have:
\begin{itemize}
\item[(a)] The random variable $R$ is geometrically distributed, with parameter (success probability) at least $\mathsf{p}_{\varphi}(1-\varepsilon)$. Hence, we have $\mathbb P_\mathcal{B}[R < \infty] = 1$ and $\mathbb E_\mathcal{B}(R) \leq
\rc{1/\mathsf{p}_{\varphi}(1-\varepsilon)}$ for every $\varepsilon >0$.
\item[(b)] $\mathbb P_\mathcal{B}[S_\varphi | R < \infty] = \mathbb P_\mathcal{B}[S_\varphi]=1$.
\end{itemize}
\end{theorem}
\begin{proof}
(a) By Lemma~\ref{lem:strength-increases}, almost all bad runs are reset.
By Lemma~\ref{lem:bold}, runs, conditioned under being good, are reset with probability at most~$\varepsilon$.
It follows that the probability that a run is good and not reset is at least $\mathsf{p}_{\varphi}(1-\varepsilon)$.
(b)~In runs satisfying $R < \infty$, the suffix after the last reset almost surely reaches a BSCC of $\mathcal{M}\otimes \mathcal{A}$ and visits all its states infinitely often, increasing the strength of the last candidate beyond any bound. So runs satisfying $R < \infty$ belong to $S_\varphi$ with probability 1.
\end{proof}
\paragraph{Performance.} Recall that $T$ is the random variable that assigns to a run the number of steps until the last reset.
Let $T_j$ be the number of steps between the $j$-th and $(j+1)$th reset. Observe that all the $T_j$ are identically distributed.
We have $T_j = T_{j}^\bot + T_{j}^C$, where $T_j^\bot$ and $T_{j}^C$ are the number of prefixes $\path$ such that $K(\path) = \bot$
(no current candidate) and $K(\path) \neq \bot$ (a candidate), respectively.
By deriving bounds on $\mathbb E(T_j^\bot)$ and $\mathbb E(T_j^C)$, we obtain:
\begin{theorem} \label{thm:performance-known-pmin}
Let $\mathcal{M}$ be a finite-state Markov chain with $n$ states, minimum probability $\mathsf{p}_{\mathsf{min}}$, and maximal SCC size $\mathsf{{\scriptsize mxsc}}$. Let
$\varphi$ be an LTL formula with probability $\mathsf{p}_{\varphi} > 0$ in $\mathcal{M}$.
Let $\alpha \ge \alpha_0$ and $\varepsilon > 0$.
Let $T$ be the number of steps taken by \textsc{BoldMonitor}$_{\alpha,\epsilon}$ until the
last reset (or $\infty$ if there is no last reset). We have:
\begin{equation}
\label{eq:Tbound6}
\begin{aligned}
\mathbb E(T) & \leq \frac{1}{\mathsf{p}_{\varphi}(1 - \varepsilon)} \cdot 2 n \alpha (n- \log\varepsilon) \mathsf{{\scriptsize mxsc}} \left( \frac{1}{\mathsf{p}_{\mathsf{min}}}\right)^{\mathsf{{\scriptsize mxsc}}}
\end{aligned}
\end{equation}
\end{theorem}
\noindent Here we observe the main difference with \textsc{CautiousMonitor}: Instead of the exponential dependence on $n$ of Theorem \ref{thm:bold}, we only have an exponential dependence on $\mathsf{{\scriptsize mxsc}}$. So for chains satisfying
$\mathsf{{\scriptsize mxsc}} <\!\!< n$ the bold controller performs much better than the cautious one.
\subsection{General chains}
\label{subsec:arbitrarychain}
We adapt \textsc{BoldMonitor} so that it works for arbitrary finite-state Markov chains, at the price of a performance penalty.
The main idea is very simple: given any non-decreasing sequence
$\{\alpha_n\}_{n=1}^\infty$ of natural numbers such that $\alpha_1 = 1$ and $\lim_{n\rightarrow \infty} \alpha_n = \infty$, we sample as in
\textsc{BoldMonitor}$_{\alpha,\epsilon}$ but, instead of using the same value $\alpha$ for every sample, we use $\alpha_j$ for the $j$-th sample
(see Algorithm~\ref{alg:bold}). The intuition is that $\alpha_j \geq \alpha_0$ holds from some index $j_0$ onwards, and so, by the previous analysis, after the $j_0$-th reset the monitor a.s.\ only executes a finite number of resets.
Let $\textsc{Sample}(\alpha)$ be the body of the while loop of \textsc{BoldMonitor}$_{\alpha,\varepsilon}$ for a given value of $\alpha$.
\begin{algorithm}[t]
\caption{\textsc{BoldMonitor}$_\varepsilon$ for $\{\alpha_n\}_{n=1}^\infty$}
\label{alg:bold}
\begin{algorithmic}[1]
\State $j \gets 0$
\While {\textbf{true}}
\State $j = j+1$
\State \textsc{Sample}$(\alpha_j)$
\EndWhile
\end{algorithmic}
\end{algorithm}
More formally, the correctness follows from the following two properties.
\begin{itemize}
\item For every $j \geq 1$, if \textsc{Sample}$(\alpha_j)$ does not terminate then it executes a good run a.s..\\
Indeed, if \textsc{Sample}$(\alpha_j)$ does not terminate then it a.s.\ reaches a BSCC of $\Mc \otimes \dra$ and visits all its states infinitely often. So from some moment on $K(\path)$ is and remains equal to this BSCC, and $\textsc{Str}(\path)$ grows beyond any bound. Since \textsc{Sample}$(\alpha_j)$ does not terminate, the BSCC is good, and it executes a good run.
\item If $\alpha_j \ge \alpha_0$ then the probability that \textsc{Sample}$(\alpha_j)$ does not terminate is at least \rc{$\varepsilon \mathsf{p}_{\varphi}$}. \\
Indeed, by Lemma \ref{lem:bold}, if $\alpha_j \ge \alpha_0$, the probability is already at least \rc{$\varepsilon \mathsf{p}_{\varphi}$}. Increasing $\alpha$ strengthens the exit condition of the until loop. So the probability that the loop terminates is lower, and the probability of non-termination higher.
\end{itemize}
These two observations immediately lead to the following proposition:
\begin{proposition}
\label{prop:bold2}
Let $\mathcal{M}$ be an arbitrary finite-state Markov chain, and let
$\varphi$ be an LTL formula such that $\mathsf{p}_{\varphi} := \mathbb P[\mathcal{M} \models \varphi] > 0$.
Let $\mathcal{B}$ be the Markov chain corresponding to the execution of \textsc{BoldMonitor}$_\varepsilon$ on $\Mc \otimes \dra$ with sequence $\{\alpha_n\}_{n=1}^\infty$.
Let $\mathsf{p}_{\mathsf{min}}$ be the minimum probability of the transitions of $\mathcal{M}$ (which is unknown to \textsc{BoldMonitor}$_\varepsilon$). We have
\begin{itemize}
\item[(a)] $\mathbb P_\mathcal{B}[R < \infty] = 1$.
\item[(b)] $\mathbb P_\mathcal{B}[S_\varphi | R < \infty] = \mathbb P_\mathcal{B}[S_\varphi]=1$.
\item[(c)] $\mathbb E(R) \leq j_{\text{min}} + \rc{1 / \mathsf{p}_{\varphi}(1 - \epsilon)}$, where $j_{\text{min}}$ is the smallest index $j$ such that
$\alpha_j \geq \alpha_0$.
\end{itemize}
\end{proposition}
\paragraph{Performance.} Difference choices of the sequence $\{\alpha_n\}_{n=1}^\infty$ lead to versions of \textsc{BoldMonitor}$_\varepsilon$ with different
performance features. Intuitively, if the sequence grows very fast, then $j_{\text{min}}$ is very small, and the expected number of resets $\mathbb E(R)$
is only marginally larger than the number for the case in which the monitor knows $\mathsf{p}_{\mathsf{min}}$. However, in this case
the last $\rc{1 / \mathsf{p}_{\varphi}(1 - \epsilon)}$ aborted runs are performed for very large values $\alpha_j$, and so they take many steps.
If the sequence grows slowly, then the opposite happens; there are more resets, but aborted runs have shorter length. Let us analyze two extreme cases:
$\alpha_j := 2^j$ and $\alpha_j := j$.
Denote by $f(\alpha)$ the probability that a run is reset, i.e., the probability that a call \textsc{Sample}$(\alpha)$ terminates.
Let further $g(\alpha)$ denote the expected number of steps done in \textsc{Sample}$(\alpha)$ of a run that is reset (taking the number of steps as $0$ if the run is not reset).
According to the analysis underlying Theorem~\ref{thm:performance-known-pmin}, for $\alpha \ge \alpha_0$ we have $g(\alpha) \le c \alpha$ with $c := 2 n (n- \log\varepsilon) \mathsf{{\scriptsize mxsc}}\,\mathsf{p}_{\mathsf{min}}^{-\mathsf{{\scriptsize mxsc}}}$.
We can write $T = T_1 + T_2 + \cdots$, where $T_j = 0$ when either the $j$-th run or a previous run is not aborted, and otherwise $T_j$ is the number of steps of the $j$-th run.
For $j \le j_{\text{min}}$ we obtain $\mathbb E(T_j) \le g(\alpha_{j_\text{min}})$ and hence we have:
\begin{align*}
\mathbb E(T) \ &=\ \sum_{j=0}^\infty \mathbb E(T_j) \ \le\ j_{\text{min}} g(\alpha_{j_{\text{min}}}) + \sum_{i=0}^\infty f(\alpha_{j_{\text{min}}})^i g(\alpha_{j_{\text{min}}+i})
\end{align*}
By Theorem~\ref{thm:bold}(a) we have $f(\alpha_{j_{\text{min}}}) \le 1 - \mathsf{p}_{\varphi}(1-\varepsilon)$.
It follows that choosing $\alpha_j := 2^j$ does not in general lead to a finite bound on $\mathbb E(T)$.
Choosing instead $\alpha_j := j$, we get
\begin{align*}
\mathbb E(T) \ &\le \ c j_{\text{min}}^2 + \sum_{i=0}^\infty (1 - \mathsf{p}_{\varphi}(1-\varepsilon))^i c (j_{\text{min}}+i) \\
&\le \ \left( j_{\text{min}}^2 + \frac{j_{\text{min}}}{\mathsf{p}_{\varphi}(1-\varepsilon)} + \frac{1}{(\mathsf{p}_{\varphi}(1-\varepsilon))^2}\right) c\,,
\end{align*}
where $j_\text{min}$ can be bounded by $j_\text{min} \le - 1/\log(1-\mathsf{p}_{\mathsf{min}}) + 1 \le 1/\mathsf{p}_{\mathsf{min}}$.
So with $c = 2 n (n- \log\varepsilon) \mathsf{{\scriptsize mxsc}}\,\mathsf{p}_{\mathsf{min}}^{-\mathsf{{\scriptsize mxsc}}}$ we arrive at
\begin{equation}
\mathbb E(T) \ \le \ \left( \frac{1}{\mathsf{p}_{\mathsf{min}}^2} + \frac{1}{\mathsf{p}_{\mathsf{min}} \mathsf{p}_{\varphi}(1-\varepsilon)} + \frac{1}{(\mathsf{p}_{\varphi}(1-\varepsilon))^2}\right) 2 n (n- \log\varepsilon) \mathsf{{\scriptsize mxsc}}\,\mathsf{p}_{\mathsf{min}}^{-\mathsf{{\scriptsize mxsc}}}\,,
\end{equation}
a bound broadly similar to the one from Theorem~\ref{thm:performance-known-pmin}, but with the monitor not needing to know $\mathsf{p}_{\mathsf{min}}$.
\section{The cautious monitor} \label{sec:cautious}
All our monitors assume the existence of a deterministic Rabin automaton $\mathcal{A} = (Q, {2^{Ap}}, \gamma, q_o, Acc)$ for $\varphi$. They monitor the path $\path$ of the chain $\mathcal{M}\otimes \mathcal{A}$ corresponding to the path of $\mathcal{M}$ executed so far. In order to present the cautious monitor we need some definitions and notations.
\paragraph{Candidate of a path.}
Given a finite or infinite path $\rho=s_0 s_1\cdots$ of $\mathcal{M}\otimes \mathcal{A}$, the \emph{support} of $\rho$ is the set $\support{\rho}=\{s_0,s_1,\ldots\}$. The \emph{graph of $\rho$} is $G_\rho = (\support{\rho}, E_\rho)$, where $E_\rho=\{(s_i,s_{i+1})\mid i=0,1,\ldots\}$.
Let $\path$ be a path of $\mathcal{M}\otimes \mathcal{A}$. If
$\path$ has a suffix $\kappa$ such that $G_\kappa$ is a BSCC of $G_\path$, we call $\support{\kappa}$ the \emph{candidate of $\path$}. Given a path $\path$, we define $K(\path)$ as follows: If $\path$ has a candidate $\support{\kappa}$, then $K(\path) := \support{\kappa}$; otherwise, $K(\path) := \bot$, meaning that $K(\path)$ is undefined.
\begin{example}
Consider the family of Markov chains of Figure \ref{fig:largescc}. We have e.g. $K(s_0) = K(s_0s_1) = K(s_0s_0s_1) = \bot$, $K(s_0 s_0) = \{s_0\}$, and $K(s_0s_1s_0s_1) = \{s_0,s_1\}$. In the family of Figure \ref{fig:smallscc} we have e.g. $K(s_0s_1s_1)=\{s_1\}$, $K(s_0s_1s_1s_2)= \bot $, and $K(s_0s_1s_1s_2s_2)= \{s_2\}$.
\end{example}
\begin{figure}
\centering
\scalebox{0.8}{
\begin{tikzpicture}
\node[state,initial,initial text=] (s0) at (0,1){$s_0$};
\node[state] (s1) at (2,1){$s_1$};
\node[state] (s2) at (4,1){$s_2$};
\node (dots) at (5,1){\large $\cdots$};
\node[state] (s3) at (6,1){$s_{n-1}$};
\node[state] (s4) at (8,1){$s_n$};
\node[state] (sg) at (10,2){$s_{\text{good}}$};
\node[state] (sb) at (10,0){$s_{\text{bad}}$};
\path[->]
(s0) edge[loop above] node[above=-1pt]{$1/2$} ()
(s0) edge node[below]{$1/2$} (s1)
(s1) edge node[below]{$1/2$} (s2)
(s3) edge node[below]{$1/2$} (s4)
%
(s1) edge[bend right=25] node[above=-2pt]{$1/2$} (s0)
(s2) edge[bend right=50] node[above=-2pt]{$1/2$} (s0)
(s3) edge[bend right=60] node[above=-2pt]{$1/2$} (s0)
(sg) edge[loop above] node[above=-2pt]{$1$} ()
(sb) edge[loop above] node[above=-2pt]{$1$} ()
(s4) edge node[above]{$1/2$} (sg)
(s4) edge node[below]{$1/2$} (sb);
\end{tikzpicture}}
\caption{A family of Markov chains}
\label{fig:largescc}
\end{figure}
\begin{figure}[ht]
\centering
\scalebox{0.8}{
\begin{tikzpicture}
\node[state,initial,initial text=] (s0) at (0,1){$s_0$};
\node[state] (s1) at (2,1){$s_1$};
\node[state] (s2) at (4,1){$s_2$};
\node (dots) at (5,1){\large $\cdots$};
\node[state] (s3) at (6,1){$s_{n-1}$};
\node[state] (sg) at (8,1){$s_{\text{good}}$};
\path[->]
(s0) edge node[below]{$1/2$} (s1)
(s1) edge node[below]{$1/2$} (s2)
(s3) edge node[below]{$1/2$} (sg)
%
(s0) edge[loop above] node[above=-2pt]{$1/2$} ()
(s1) edge[loop above] node[above=-2pt]{$1/2$} ()
(s2) edge[loop above] node[above=-2pt]{$1/2$} ()
(s3) edge[loop above] node[above=-2pt]{$1/2$} ()
(sg) edge[loop above] node[above=-2pt]{$1$} ();
\end{tikzpicture}}
\caption{A family of Markov chains with small SCCs}
\label{fig:smallscc}
\end{figure}
\paragraph{Good and bad candidates.} A candidate $K$ is \emph{good} if there exists a Rabin pair $(E,F) \in Acc$ such that $K \cap (S\times E) = \emptyset$ and $K_i \cap (S\times F) \neq \emptyset$. Otherwise, $K$ is \emph{bad}.
A path $\path$ of $\mathcal{M}\otimes \mathcal{A}$ is \emph{bad} if $K(\path)\neq \bot$ and $K(\path)$ is a bad candidate.
The function $\textsc{Bad}(\path)$ returns \textbf{true} if $\path$ is bad, and \textbf{false} otherwise.
\begin{proposition}
\label{prop:suspect}
\begin{itemize}
\item[(a)] Bad runs of $\Mc \otimes \dra$ almost surely have a bad finite prefix.
\item[(b)] If the good runs of $\Mc \otimes \dra$ have nonzero probability, then the set of runs without bad prefixes also has nonzero probability.
\end{itemize}
\end{proposition}
\begin{proof}
(a) By standard properties of Markov chains, bad runs of $\Mc \otimes \dra$ almost surely reach a BSCC of $\Mc \otimes \dra$ and then traverse all edges of that BSCC infinitely often.
Therefore, a bad run~$\rho$ almost surely has a finite prefix~$\path$ that has reached a bad BSCC, say $B$, of~$\Mc \otimes \dra$ and has traversed all edges of~$B$ at least once.
Then $K(\path) = B$, and so $\path$ is bad.
\medskip \noindent (b) Suppose the good runs of $\Mc \otimes \dra$ have nonzero probability.
We construct a finite path, $\path$, starting at $s_0$ so that $K(\path')$ is good for all extensions $\path'$ of~$\path$, and $K(\path'')$ is good or undefined for all prefixes $\path''$ of~$\path$.
Since the good runs of $\Mc \otimes \dra$ have nonzero probability, $\Mc \otimes \dra$ has a good BSCC $B$.
Let $\path_1'$ be a simple path from~$s_0$ to a state $s_1 \in B \cap (S \times F)$.
Extend~$\path_1'$ by a shortest path back to $\support{\path_1'}$ (forming a lasso) and denote the resulting path by~$\path_1$.
Observe that $K(\path_1) \subseteq B$ is good, and $K(\path') = \bot$ holds for all proper prefixes $\path'$ of~$\path_1$.
If $K(\path_1) = B$, then we can choose $\path := \path_1$ and $\path$ has the required properties.
Otherwise, let $\path_2'$ be a shortest path extending~$\path_1$ such that $\path_2'$ leads to a state in $B \setminus K(\path_1)$.
Extend that path by a shortest path back to $K(\path_1)$ and denote the resulting path by~$\path_2$.
Then we have $K(\path_1) \subsetneq K(\path_2) \subseteq B$, and $K(\path_2)$ is good, and $K(\path') \in \{K(\path_1), \bot\}$ holds for all paths~$\path'$ that extend~$\path_1$ and are proper prefixes of~$\path_2$.
Repeat this process until a path $\path$ is found with $K(\path) = B$.
This path has the required properties.
\end{proof}
\paragraph{The cautious monitor.} The cautious monitor is shown in Algorithm \ref{alg:cautious}.
The algorithm samples a run of $\Mc \otimes \dra$ step by step, and resets whenever the current path $\path$ is bad.
\begin{algorithm}[ht]
\caption{\textsc{CautiousMonitor}}
\label{alg:cautious}
\begin{algorithmic}[1]
\While {\textbf{true}}
\State $\path \gets \lambda$ \Comment{Initialize path}
\Repeat
\State $\path \gets \path \,.\, \mathsf{NextState}(\path)$ \Comment{Extend path}
\Until {$\textsc{Bad}(\path)$}
\EndWhile
\end{algorithmic}
\end{algorithm}
We formalize its correctness with respect to the specification given in the introduction. Consider the infinite-state Markov chain $\mathcal{C}$ (for cautious) defined as follows.
The states of $\mathcal{C}$ are pairs $\tup{\path, r}$, where $\path$ is a path of $\Mc \otimes \dra$, and $r\geq 0$. Intuitively, $j$ counts the number of resets so far. The initial probability distribution assigns probability $1$ to $\tup{\lambda,0}$, and $0$ to all others. The transition probability matrix $\mathbf{P}_\mathcal{C}(\tup{\path, r}, \tup{\path',r'})$ is defined as follows.
\begin{itemize}
\item If $\path$ is bad, then
$$
\mathbf{P}_\mathcal{C}(\tup{\path, r}, \tup{\path',r'}) =
\begin{cases}
1 & \mbox{if $\path' = \lambda$ and $r' = r+1$} \\
0 & \mbox{otherwise}
\end{cases}
$$
\noindent We call such a transition a \emph{reset}.
\item If $\path$ is not bad, then
$$
\mathbf{P}_\mathcal{C}(\tup{\path, r}, \tup{\path',r}) =
\begin{cases}
\mathbf{P}(p, p') & \mbox{if $r'=r$, $\path = \path'' \,.\, p$ and $\path' = \path \,.\, p'$} \\
0 & \mbox{otherwise.}
\end{cases}
$$
\end{itemize}
A run of \textsc{CautiousMonitor} corresponds to a run $\rho = \tup{\path_1, r_1} \tup{\path_2, r_2} \cdots$ of~$\mathcal{C}$. Let $R$ be the random variable that assigns to $\rho$ the supremum of $r_1, r_2 \cdots$. Further, let $S_\varphi$ be the the set of runs such that $R(\rho)<\infty$ and the suffix of $\rho$ starting immediately after the last reset satisfies $\varphi$.
The following theorem states that \textsc{CautiousMonitor} is correct with respect to the specification described in the introduction. The proof is an immediate consequence of Proposition \ref{prop:suspect}.
\begin{theorem}
Let $\varphi$ be a LTL formula such that $\mathbb P[\mathcal{M} \models \varphi] > 0$.
Let $\mathcal{C}$ be the Markov chain defined as above. We have
\begin{itemize}
\item[(a)] $\mathbb P_\mathcal{C}[R < \infty] = 1$.
\item[(b)] $\mathbb P_\mathcal{C}[S_\varphi | R < \infty] = \mathbb P_\mathcal{C}[S_\varphi]=1$.
\end{itemize}
\end{theorem}
\paragraph{Performance.} Let $T$ be the random variable that assigns to $\rho$ the number of steps till the last reset, or $\infty$ if the number of resets is infinite. First of all, we observe that without any assumption on the system $\mathbb E(T)$ can grow exponentially in the number of states of the chain. Indeed, consider the family of Markov chains of Figure \ref{fig:largescc} and the property ${\ensuremath{\mathbf{F}}} p$. Assume the only state satisfying $p$ is $s_{\text{good}}$. Then the product of each chain in the family with the DRA for ${\ensuremath{\mathbf{F}}} p$ is essentially the same chain, and the good runs are those reaching $s_{\text{good}}$. We show that even if the controller has full knowledge of the chain $\mathbb E(T)$ grows exponentially. Indeed, since doing a reset brings the chain to $s_0$, it is clearly useless to abort a run that has not yet reached $s_n$. In fact, the optimal monitor is the one that resets whenever the run reaches $s_\text{bad}$. The average number of resets for this controller is clearly 1, and so $\mathbb E(T)$ is the expected number of steps needed to reach $s_\text{bad}$, under the assumption that it is indeed reached. It follows $\mathbb E(T) \ge 2^n$. We formulate this result as a proposition.
\begin{fact}
Let ${\cal M}_n$ be the Markov chain of Figure \ref{fig:largescc} with $n$ states. Given a monitor ${\cal N}$ for the property ${\ensuremath{\mathbf{F}}} p$, let $T_{\cal N}$ be the random variable that assigns to a run of the monitor on ${\cal M}_n$ the number of steps till the last reset, or $\infty$ if the number of resets is infinite. Then $\mathbb E(T_{\cal N}) \geq 2^n$ for every monitor ${\cal N}$.
\end{fact}
We learn from this example that all monitors have problems when the time needed to traverse a non-bottom SCC of the chain can be very large. So we conduct a parametric analysis in the maximal size $\mathsf{{\scriptsize mxsc}}$ of the SCCs of the chain. This reveals the weak point of \textsc{CautiousMonitor}: $\mathbb E(T)$ remains exponential even for families satisfying $\mathsf{{\scriptsize mxsc}}=1$. Consider the family of Figure \ref{fig:smallscc}.
\textsc{CautiousMonitor} resets whenever it takes any of the self-loops in states $s_i$. Indeed, after taking a self-loop in state, say $s_i$, the current path $\path$ ends in $s_i s_i$, and so we have $K(\path) = \{s_i\}$, which is a bad candidate.
So after the last reset the chain must follow the path $s_0 s_1 s_2 \cdots s_{\text{good}}$. Since this path has probability $1/2^n$, we get $\mathbb E(T) \geq 2^n$.
In the next section we introduce a ``bold'' monitor. Intuitively, instead of resetting at the first suspicion that the current path may not yield a good run, the bold monitor ``perseveres''.
\section{Conclusions}
We have shown that monitoring of arbitrary $\omega$-regular properties is possible for finite-state Markov chains, even if the monitor has no information \emph{at all} about the chain, its probabilities, or its structure. More precisely, we have exhibited
monitors that ``force'' the chain to execute runs satisfying a given property $\varphi$ (with probability 1). The monitors reset the chain whenever the current run is suspect of not satisfying $\varphi$. They work even if $\varphi$ is a liveness property without any ``good prefix'', i.e., a prefix after which any extension satisfies $\varphi$.
Unsurprisingly, the worst-case behaviour of the monitor, measured as the number of steps until the last reset,
is bad when the probability of the runs satisfying $\varphi$ or the minimal probability of the transitions of the chain are very small, or when the strongly connected components of the chain are very large. We have given performance estimates that quantify the relative weight of each of these parameters. The design of dedicated monitors that exploit information on this parameters is an interesting topic for future research.
\section{Experimental results}
In this section, we illustrate the behaviour of our monitors on concrete models from the PRISM Benchmark Suite \cite{DBLP:conf/qest/KwiatkowskaNP12} and compare the obtained theoretical bounds to the experimental values.
To this end, we have re-used the code provided in \cite{DacaHKP17}, which in turn is based on the PRISM model checker \cite{prism}.
Whenever the obtained candidate is actually an accepting BSCC, we have a guarantee that no restart will ever happen and we terminate the experiment.
Table~\ref{tab:exper} shows the results on several models.
For the bluetooth benchmark, the optimal number of restarts is $1/0.2=5$ and with $\varepsilon=0.5$ it should be smaller than 10.
We see that while the bold monitor required $6.6$ on average, the cautious one indeed required a bit more.
For Hermann's stabilization protocol, almost all sufficiently long runs have a good candidate.
In this model, we have not even encountered any bad candidate on the way.
This can be easily explained since only 38 states out of the half million are outside of the single BSCC.
They are spread over 9 non-bottom SCCs and some states are transient; however, no runs got stuck in any of the tiny SCCs.
A similar situation occurs for the case of gridworld, where on average every tenth run is non-satisfying.
However, in our five repetitions (each with a single satisfying run), we have not encountered any.
Finally, we could not determine the satisfaction probability in crowds since PRISM times out on this model with more than two million states.
However, one can still see the bold monitor requiring slightly less resets than the cautious one, predicting $\mathsf{p}_{\varphi}$ to be in the middle of the $[0,1]$-range.
It is also worth mentioning that the large size preventing a rigorous numeric analysis of the system did not prevent our monitors from determining satisfaction on single runs.
\newcommand{{\ensuremath{\mathbf{G}}}{\ensuremath{\mathbf{F}}}}{{\ensuremath{\mathbf{G}}}{\ensuremath{\mathbf{F}}}}
\newcommand{{\ensuremath{\mathbf{F}}}{\ensuremath{\mathbf{G}}}}{{\ensuremath{\mathbf{F}}}{\ensuremath{\mathbf{G}}}}
\begin{table}[t]
\caption{Experimental comparison of the monitors, showing the average number of restarts and average length of a restarted run. The average is taken over five runs of the algorithm and $\varepsilon=0.5$.}
\label{tab:exper}
\begin{tabular}{llr@{\hskip 2mm}lr@{\hskip 4mm}lrr}
Model &Property &States&$\mathsf{p}_{\mathsf{min}}$&$\mathsf{p}_{\varphi}$&Monitor&Avg. $R$&Avg. $\frac T R$\\\hline
bluetooth&{\ensuremath{\mathbf{G}}}{\ensuremath{\mathbf{F}}}&143,291&$0.008$&0.20&Cautious &9.0 & 4578\\
&&&&&Bold&6.6&3758\\
hermann&{\ensuremath{\mathbf{F}}}{\ensuremath{\mathbf{G}}}&524,288&$1.9\cdot 10^{-6}$&1&Cautious&0&-\\
&&&&&Bold&0&-\\
gridworld&${\ensuremath{\mathbf{G}}}{\ensuremath{\mathbf{F}}}\to{\ensuremath{\mathbf{F}}}{\ensuremath{\mathbf{G}}}$& 309,327&0.001& 0.91& Cautious & 0 & -\\
&&&&&Bold&0&-\\
crowds& {\ensuremath{\mathbf{F}}}{\ensuremath{\mathbf{G}}}&2,464,168& 0.066&?&Cautious& 0.8 & 63\\
&&&&&Bold&0.6&90\\
\end{tabular}
\end{table}
\subsection{Implementing the bold monitor}
A straightforward implementation of the bold monitor in which the candidate $K(\path)$ and its strength are computed anew
each time the path is extended is very inefficient. We present a far more efficient algorithm that continuously maintains the candidate of the current
candidate and its strength. The algorithm runs in $O(n \log n)$ amortized time for a path $\path$ of length $n$, and uses $O(s_n \log s_n)$ space,
where $s_n$ denotes the number of states visited by $\path$ (which can be much smaller than $n$ when states are visited multiple times).
Let $\path$ be a path of $\mathcal{M}\otimes \mathcal{A}$, and let $s \in \path$.
(Observe that $s$ now denotes a state of $\mathcal{M}\otimes \mathcal{A}$, not of $\mathcal{M}$.) We let $G_\path = (V_\path, E_\path)$
denote the subgraph of $\mathcal{M}\otimes \mathcal{A}$ where $V_\path$ and $E_\path$ are the sets of states and edges visited by $\path$, respectively.
Intuitively, $G_\path$ is the fragment of $\mathcal{M}\otimes \mathcal{A}$ explored by the path $\path$. We
introduce some definitions.
\begin{itemize}
\item The \emph{discovery index} of a state $s$, denoted $d_\path(s)$, is the number of states that appear in the prefix of $\path$ ending
with the first occurrence
of $s$. Intuitively, $d_\path(s) = k$ if $s$ is the $k$-th state discovered by $\path$. Since different states have different discovery times,
and the discovery time does not change when the path is extended, we also call $d_\path(s)$ the \emph{identifier} of $s$.
\item A \emph{root} of $G_\path$ is a state $r \in V_\path$ such that $d_\path(r) \leq d_\path(s)$ for every state $s \in \mathsf{SCC}_\path(r)$,
where $\mathsf{SCC}_\path(r)$ denotes the SCC of $G_\path$ containing $s$. Intuitively, $r$ is the first state of $\mathsf{SCC}_\path(r)$ visited by $\path$.
\item The \emph{root sequence} $R_\path$ of $\path$ is the sequence of roots of $G_\path$, ordered by ascending discovery index.
\item Let $R_\path = r_1 \, r_2 \cdots r_m$. We define the sequence $S_\path = S_\path(r_1) \, S_\path(r_2) \cdots S_\path(r_m)$ of sets, where
$$S_\path(r_i) := \{s \in V_\path \mid d_\path(r_i) \leq d_\path(s) < d_\path(r_{i+1}) \}$$
\noindent for every $1 \leq i < m$, i.e., $S_\path(r_i)$ is the set of states discovered after $r_i$ (including $r_i$) and before $r_{i+1}$ (excluding $r_i$); and
$$S_\path(r_m) := \{s \in V_\path \mid d_\path(r_m) \leq d_\path(s)\} \ . $$
\item $\mathit{Birthday}_\path$ is defined as $\bot$ if $K(\path) = \bot$, and as the length of the shortest prefix $\path'$ of $\path$ such that $K(\path') = K(\path)$ otherwise. Intuitively, $\mathit{Birthday}_\path$ is the time at which the current candidate of $\path$ was created.
\item For every state $s$ of $\path$, let $\path_s$ be the longest prefix of $\pi$ ending at $s$.
We define $\mathit{Visits}_\path(s)$ as the pair $(\mathit{Birthday}_{\path_s}, v)$, where $v$ is $0$ if $\mathit{Birthday}_{\path_s}=\bot$, and $v$ is the number of times $\pi_s$ has visited $s$ since $\mathit{Birthday}_{\path_s}$ otherwise. We define a total order on these pairs: $(b, v) \preceq (b',v')$ if{}f $b > b'$ (where $\bot > n$ for every number $n$), or $b=b'$ and $v \leq v'$. Observe that, if $\path$ has a candidate, then the smallest pair w.r.t. $\preceq$ corresponds to the state that is among the states visited since the creation of the candidate, and has been visited the least number of times.
\end{itemize}
\noindent The following lemma is an immediate consequence of the definitions.
\begin{lemma}
Let $G_\path = (V_\path, E_\path)$. The SCCs of $G_\path$ are the sets of $S_\path$. Further, let
$(b,v)= \min \{ \mathit{Visits}_\path(s) \mid s \in V_\path \}$, where the minimum is over $\preceq$. We have $\textsc{Str}(\path) = v$.
\end{lemma}
By the lemma, in order to efficiently implement \textsc{Monitor} it suffices to maintain $R_\path$, $S_\path$, and
a mapping $\mathit{Visits}_\path$ that assigns $\mathit{Visits}_\path(s)$ to each state $s$ of $\path$.
More precisely, assume that \textsc{Monitor} has computed so far a path $\path$ leading to a state $s$, and now it extends $\pi$
to $\path' = \path \cdot s'$ by traversing a transition $s \rightarrow s'$ of $\mathcal{M}\otimes \mathcal{A}$;
it suffices to compute $R_{\path'}$, $S_{\path'}$ and $\mathit{Visits}_{\path'}$
from $R_\path$, $S_\path$, and $\mathit{Visits}_{\path'}$ in
$O(\log n)$ amortized time, where $n$ is the length of $\path$. We first show how to update
$R_\path$, $S_\path$, and $\textsc{Str}(S_\path)$, and then we describe data structures to maintain them in $O(n \log n)$ amortized time. We consider three cases:
\begin{itemize}
\item $s' \notin V_\path$. That is, the monitor discovers the state $s'$ by traversing $s \rightarrow s'$. Then the SCCs of $G_{\path'}$ are the
SCCs of $G_\path$, plus a new trivial SCC containing only $s$, with $s$ as root. So $R_{\path'} = R_\path \cdot s$, $S_{\path'} = S_\path \cdot \{s\}$. Since $s'$ has just been discovered, there is no candidate, and so $\mathit{Visits}_{\path'}(s') = (\bot, 0)$, because .
\item $s' \in V_\path$, and $d_\path(s) \leq d_\path(s')$. That is, the monitor had already discovered $s'$, and it had discovered it after $s$.
Then $G_{\path'} = (V_\path, E_\path \cup \{(s, s')\}$, but the SCCs of $G_\path$ and $G_{\path'}$ coincide, and so
$R_{\path'} = R_\path$, $S_{\path'} = S_\path$, and $\textsc{Str}(S_{\path'}) = \min \{ \#_{\path'}(s'), \textsc{Str}(S_{\path})\}$.
\item $s' \in V_\path$, and $d_\path(s) > d_\path(s')$. That is, the monitor discovered $s'$ before $s$. Let $R_\path = r_1 \, r_2 \cdots r_m$ and
let $r_i$ be the root of $\mathsf{SCC}_\path(s')$. Then $G_{\path'}$ has a path
$$r_i \trans{*} r_{i+1} \trans{*} \cdots \trans{*} r_{m-1} \trans{*} r_m \trans{*} s \trans{} s' \trans{*} r_i \ .$$
So we have
\begin{align*}
R_{\path'} & = r_1 \, r_2 \cdots r_i \\
S_{\path'} & = S_\path(r_1) \cdots S_\path(r_{i-1}) \, \left(\bigcup_{j = i}^m S_{\path}(r_j) \right)
\end{align*}
Moreover, $K(\path') = S_{\path'}$, because we have discovered a new candidate.
Since the strength of a just discovered candidate is $0$ by definition, we set $\textsc{Str}(\path')=0$.
\end{itemize}
In order to efficiently update $R_\path$, $S_\path$ and $\min_\path$ we represent them using the following data structures.
\begin{itemize}
\item The number $N$ of different states visited so far.
\item A hash map $D$ that assigns to each state $s$ discovered by $\path$ its discovery index. When
$s$ is visited for the first time, $D(s)$ is set to $N+1$. Subsequent lookups return $N+1$.
\item A structure $R$ containing the identifiers of the roots of $R_\path$, and supporting the following operations in
amortized $O(\log n)$ time: $\textsc{insert}(r)$, which inserts the identifier of $r$ in $R$; $\textsc{extract-max}$, which returns the largest identifier
in $R$; and $\textsc{find}(s)$, which returns the largest identifier of $R$ smaller than or equal to the identifier of $s$. (This is the identifier of the root of
the SCC containing $s$.) For example, this is achieved by implementing $R$ both as a search tree and a heap.
\item For each root $r$ a structure $S(r)$ that assigns to each state of $s \in S(r)$ the value $\mathit{Visits}_\path(s)$,
and supports the following operations in amortized $O(\log n)$ time: $\textsc{find-min}$, which returns the minimum value of the states of $S(r)$; $\textsc{increment-key}(s)$, which increases the value of $s$ by 1, and $\textsc{merge}$, which returns the union of two given maps.
For example, this is achieved by implementing $S(r)$ as a Fibonacci heap.
\end{itemize}
When the algorithm explores an edge $s \rightarrow s'$ of the Markov chain $\mathcal{M}\otimes \mathcal{A}$, it
updates these data structures as follows. The algorithm first computes $D(s')$, and then proceeds according to the three cases above:
\begin{itemize}
\item[(1)] If $s'$ had not been visited before (i.e., $D(s') = N+1$), then the algorithm sets $N := N+1$, inserts $D(s')$ in $R$, and creates a new Fibonacci heap $S(s')$ containing only the state $s'$ with key 1.
\item[(2)] If $s'$ had been visited before (i.e., $D(s') \leq N$), and $D(s) \leq D(s')$, then the algorithm executes
$\textsc{find}(s)$ to find the root $r$ of the SCC containing $s$, and then increments the key of $s$ in $S(r)$ by 1.
\item[(3)] If $s'$ had been visited before (i.e., $D(s') \leq N$), and $D(s) > D(s')$, then the algorithm
executes the following pseudocode, where $\sigma$ is an auxiliary Fibonacci heap:
\begin{center}
\begin{minipage}{5cm}
\begin{algorithmic}[1]
\State $\sigma \gets \emptyset$
\Repeat
\State $r \gets \textsc{extract-max}(R)$
\State $\sigma \gets \textsc{merge}(\sigma, S(r))$
\Until{$D(r) \leq D(s')$}
\State $\textsc{insert}(r, R)$
\end{algorithmic}
\end{minipage}
\end{center}
\end{itemize}
At every moment in time the current candidate is the set $S(r)$, where $r = \textsc{extract-max}(R)$, and its strength can be obtained from $\textsc{find-min}(S(r))$.
Let us now examine the amortized runtime of the implementation. Let $n_1, n_2, n_3$ be the number of steps executed by the algorithm corresponding to the cases (1), (2), and (3) above. In cases (1) and (2), the algorithm executes a constant
number of heap operations per step, and so it takes $O((n_1 + n_2) \log n)$ amortized time for all steps together.
This is no longer so for case (3) steps. For example, if the Marvov chain is a big elementary circuit $s_0 \trans{} s_1 \trans{} \cdots \trans{} s_{n-1} \trans{} s_0$, then at each step but the last one we insert one state into the heap, and at the last step we extract them all; that is, the last step takes $O(n)$ heap operations. However, observe that each state is inserted in the heap exactly once, when it is discovered, and extracted at most once. So the algorithm executes at most $n$
\textsc{extract-max} and \textsc{merge} heap operations for all case (3) steps together, and the amortized time over all of them is $O(n_3 \log n)$. This gives an overall amortized runtime of $O(n \log n)$.
\section{Introduction}
Runtime verification, also called runtime monitoring, is the problem of checking at runtime whether an execution of a system satisfies a given correctness property (see e.g. \cite{HavelundR04a,LeuckerS09,FalconeHR13,BartocciFFR18}). It can be used to automatically evaluate test runs, or to steer the application back to some safety region if a property is violated. Runtime verification of LTL or $\omega$-regular properties has been thoroughly studied \cite{BauerLS06,LeuckerS09,BauerLS11,BartocciBNR18}. It is conducted by automatically translating the property into a monitor that inspects the execution online in an incremental way, and (in the most basic setting) outputs ``yes'', ``no'', or ``unknown'' after each step.
A fundamental limitation of runtime verification is that, if the system is not known \textit{a priori}, then many properties, like for example ${\ensuremath{\mathbf{G}}}{\ensuremath{\mathbf{F}}} p$ or ${\ensuremath{\mathbf{F}}}{\ensuremath{\mathbf{G}}} p$, are not monitorable. Loosely speaking, since every finite execution can be extended to a run satisfying ${\ensuremath{\mathbf{G}}}{\ensuremath{\mathbf{F}}} p$ and to another run satisfying its negation, monitors can only continuously answer ``unknown'' (see \cite{BartocciBNR18} for a more detailed discussion). Several approaches to this problem have been presented, which modify the semantics of LTL in different ways to refine the prediction and palliate the problem \cite{PnueliZ06,BauerLS07,BauerLS10,MorgensternGS12,ZhangLD12,BartocciBNR18}, but the problem is of fundamental nature.
Runtime monitoring of stochastic systems modeled as Hidden Markov Chains (HMM) has been studied by Sistla \textit{et al.\ } in a number of papers \cite{SistlaS08,GondiPS09,SistlaZF11}. Given a HMM $H$ and an $\omega$-regular language $L$,
these works construct a monitor that (a) rejects executions of $H$ not in $L$ w.p.1, and (b) accepts executions of $H$ in $L$ with positive probability (this is called a \emph{strong monitor} in \cite{SistlaS08}). Observe, however, that the monitor knows $H$ in advance. The case where $H$ is not known in advance is also considered in \cite{SistlaS08}, but in this case strong monitors only exist for languages recognizable by deterministic, possibly infinite state, B\"{u}chi automata. Indeed, it is easy to see that, for example, a monitor that has no information about the HMM cannot be strong for a property like ${\ensuremath{\mathbf{G}}}{\ensuremath{\mathbf{F}}} p$.
Summarizing, the work of Sistla \textit{et al.\ } seems to indicate that one must either know the HMM in advance, or has to give up monitorability of liveness properties. In this paper we leverage a technique introduced in \cite{DacaHKP17} to show that there is a third way: Assume that, instead of only being able to observe the output of a state, as in the case of HMM, we can observe the state itself. In particular, we can observe that the current state is the same we visited at some earlier point. We show that this allows us to design monitors for all $\omega$-regular properties that work without any knowledge of the system in the following simple setting. We have a finite-state Markov chain, but we have no information on its size, probabilities, or structure; we can only execute it. We are also given an arbitrary $\omega$-regular property $\varphi$, and the purpose of monitoring is to abort runs of the system that are ``unlikely'' to satisfy the specification until the system executes a correct run. Let us make this informal idea more precise. The semantics of the system is a finite-state Markov chain, but we have no information on its size, probabilities, or structure. We know that the runs satisfying $\varphi$ have nonzero probability, but the probability is also unknown. We are allowed to monitor runs of the system and record the sequence of states it visits; further, we are allowed to abort the current run at any moment in time, and reset the system back to its initial state. The challenge is to design a controller for the reset action that satisfies the following property w.p.1: the number of resets is finite, and the run of the system after the last reset satisfies $\varphi$.
Intuitively, the controller must abort the right number of executions: If it aborts too many, then it may reset infinitely often with positive probability; if it aborts too few, the run after the last reset might violate $\varphi$.
For a safety property like ${\ensuremath{\mathbf{G}}} p$ the controller can just abort whenever the current state does not satisfy $p$; indeed, since ${\ensuremath{\mathbf{G}}} p$ has positive probability by assumption, eventually the chain executes a run satisfying ${\ensuremath{\mathbf{G}}} p$ a.s., and this run is not aborted. Similarly, for a co-safety property like ${\ensuremath{\mathbf{F}}} p$, the controller can abort the first execution after one step, the second after two, steps etc., until a state satisfying $p$ is reached. Since ${\ensuremath{\mathbf{F}}} p$ has positive probability by assumption, at least one reachable state satisfies $p$, and with this strategy the system will almost surely visit it.
But for ${\ensuremath{\mathbf{G}}}{\ensuremath{\mathbf{F}}} p$ the problem is already more challenging. Unlike the cases of ${\ensuremath{\mathbf{G}}} p$ and ${\ensuremath{\mathbf{F}}} p$, the controller can never be sure that every extension of the current execution will satisfy the property or will violate it.
In our first result we show that, perhaps surprisingly, notions introduced in \cite{DacaHKP17} can be used to show that the problem has very simple solution. Let $\mathcal{M}$ be the (unknown) Markov chain of the system, and let $\mathcal{A}$ be a deterministic Rabin automaton for $\varphi$. Say that a run of the product chain $\mathcal{M} \times \mathcal{A}$ is \emph{good} if it satisfies $\varphi$, and \emph{bad} otherwise.
We define a set of \emph{suspect} finite executions satisfying two properties:
\begin{itemize}
\item[(a)] bad runs a.s. have a suspect prefix; and
\item[(b)] if the set of good runs has nonzero probability, then the set of runs without suspect prefixes also has nonzero probability.
\end{itemize}
The controller resets whenever the current execution is suspect. We call it the \emph{cautious controller}. By property (a) the cautious controller aborts bad runs w.p.1, and by property (b) w.p.1 the system eventually executes a run without suspect prefixes, which by (a) is necessarily good.
The performance of a controller is naturally measured in terms of two parameters: the expected number of resets $R$, and the expected number $S$ of steps to a reset (conditioned on the occurrence of the reset). While the cautious controller is very simple, it has poor performance: In the worst case, both parameters are exponential in the number of states of the chain. A simple analysis shows that, without further information on the chain, the exponential dependence in $S$ is unavoidable. However, the exponential dependence on $R$ can be avoided: using a technique of \cite{DacaHKP17}, we define a \emph{bold controller} for which the expected number of resets is almost optimal.
\paragraph{Related work.} Sistla \textit{et al.\ } have also studied the power of finite-state probabilistic monitors for the analysis of non-probabilistic systems, and characterized the monitorable properties \cite{ChadhaSV09}. This is also connected to work by Baier \textit{et al.\ } \cite{BaierGB12}. There is also a lot of work on the design of monitors whose purpose is not to abort runs that violate a property, say $\varphi$, but gain information about the probability of the runs that satisfy $\varphi$. This is often called statistical model checking, and we refer the reader to \cite{LegayDB10} for an overview.
\paragraph{Appendix.} Some proofs have been moved to an Appendix available at \\
\url{https://www7.in.tum.de/~esparza/tacas2021-134.pdf}
\section{Preliminaries}
\paragraph{Directed graphs.} A directed graph is a pair $G=(V, E)$, where $V$ is the set of vertices and $E \subseteq V\times V$ is the set of edges. A path (infinite path) of $G$ is a finite (infinite) sequence $\path = v_0, v_1 \ldots$ of vertices such that $(v_i, v_{i+1}) \in E$ for every $i=0,1 \ldots$. We denote the empty path by $\lambda$ and concatenation of paths $\path_1$ and $\path_2$ by $\path_1\,.\,\path_2$. A graph $G$ is strongly connected if for every two vertices $v, v'$ there is a path leading from $v$ to $v'$. A graph $G'=(V',E')$ is a subgraph of $G$, denoted $G' \preceq G$, if $V' \subseteq V$ and $E' \subseteq E \cap V' \times V'$; we write $G' \prec G$ if $G' \preceq G$ and $G'\neq G$. A graph $G' \preceq G$ is a strongly connected component (SCC) of $G$ if it is strongly connected and no graph $G''$ satisfying $G' \prec G'' \preceq G$ is strongly connected. An SCC $G'=(V',E')$ of $G$ is a bottom SCC (BSCC) if $v \in V'$ and $(v, v') \in E$ imply $v' \in V'$.
\paragraph{Markov chains.} A \emph{Markov chain (MC)} is a tuple $\mathcal{M} = (S, \mathbf{P}, \mu)$, where
\begin{itemize}
\item $S$ is a finite set of states,
\item $\mathbf{P} \;:\; S \times S \to [0,1]$ is the transition probability matrix, such that for every $s\in S$ it holds $\sum_{s'\in S} \mathbf{P}(s,s') = 1$,
\item $\mu$ is a probability distribution over $S$.
\end{itemize}
The graph of $\mathcal{M}$ has $S$ as vertices and $\{ (s, s') \mid \mathbf{P}(s,s') > 0\}$ as edges. Abusing language,
we also use $\mathcal{M}$ to denote the graph of $\mathcal{M}$.
We let $\mathsf{p}_{\mathsf{min}}:=\min(\{\mathbf{P}(s,s') > 0\mid s,s'\inS\})$ denote the smallest positive transition probability in $\mathcal{M}$.
A \emph{run} of $\mathcal{M}$ is an infinite path $\rho = s_0 s_1 \cdots$ of $\mathcal{M}$; we let $\rho[i]$ denote the state $s_i$.
Each path $\path$ in $\mathcal{M}$ determines the set of runs $\mathsf{Cone}(\path)$ consisting of all runs that start with $\path$.
To $\mathcal{M}$ we assign the probability space
(\mathsf{Runs},\mathcal F,\mathbb P)$, where $\mathsf{Runs}$ is the set of all runs in $\mathcal{M}$, $\mathcal F$ is the $\sigma$-algebra generated by all $\mathsf{Cone}(\path)$,
and $\mathbb P$ is the unique probability measure such that
$\mathbb P[\mathsf{Cone}(s_0s_1\cdots s_k)] =
\mu(s_0)\cdot\prod_{i=1}^{k} \mathbf{P}(s_{i-1},s_i)$, where the empty product equals $1$.
The respective expected value of a random variable $f:\mathsf{Runs}\to\mathbb R$ is $\mathbb E[f]=\int_\mathsf{Runs} f\ d\,\mathbb P$.
Given a finite set $Ap$ of atomic propositions,
a \emph{labelled Markov chain} (LMC) is a tuple $\mathcal{M} = (S, \mathbf{P}, \mu, Ap, L)$, where $(S,\mathbf{P}, \mu)$ is a MC and $L : S \to 2^{Ap}$ is a labelling function.
Given a labelled Markov chain $\mathcal{M}$ and an LTL formula $\varphi$, we are interested in the measure $\mathbb P[\mathcal{M} \models \varphi] := \mathbb P[\{\rho\in\mathsf{Runs} \mid L(\rho) \models \varphi\}],$
where $L$ is naturally extended to runs by $L(\rho)[i]=L(\rho[i])$ for all $i$.
\paragraph{Deterministic Rabin Automata.} For every $\omega$-regular property $\varphi$ there is a \emph{ deterministic Rabin automaton} (DRA) $\mathcal{A} = (Q, {2^{Ap}}, \gamma, q_o, Acc)$ that accepts all runs that satisfy $\varphi$~\cite{BK08}.
Here
$Q$ is a finite set of states, $\gamma : Q \times {2^{Ap}} \to Q$ is the transition function, $q_o \in Q$ is the initial state, and $Acc \subseteq 2^Q \times 2^Q$ is the acceptance condition.
\paragraph{Product Markov Chain.} The product of
a MC $\mathcal{M}$ and DRA $\mathcal A$ is the Markov chain $\Mc \otimes \dra =(S \times Q, \mathbf{P}', \mu')$, where $\mathbf{P}'((s,q),(s',q')) = \mathbf{P}(s,s')$ if $q'=\gamma(q,L(s'))$ and $\mathbf{P}'((s,q),(s',q'))=0$ otherwise, and $\mu'(s,q) = \mu(s)$ if $\gamma(q_o, L(s))=q$ and $\mu'(s,q)=0$ otherwise.
An SCC $B$ of $\Mc \otimes \dra$ is \emph{good} if
there exists a Rabin pair $(E,F) \in Acc$ such that $B \cap (S\times E) = \emptyset$ and $B \cap (S\times F) \neq \emptyset$. Otherwise, the SCC is \emph{bad}. Observe that the runs of $\Mc \otimes \dra$ satisfying $\varphi$ almost surely reach a good BSCC, and the runs that do not satisfy $\varphi$ almost surely reach a bad BSCC.
| {'timestamp': '2020-10-19T02:15:53', 'yymm': '2010', 'arxiv_id': '2010.08347', 'language': 'en', 'url': 'https://arxiv.org/abs/2010.08347'} | arxiv |
\section{INTRODUCTION}
Multi-robot systems promise solutions for construction at much larger scales than the robots themselves. With many robots working in parallel, construction can be completed in a fast and efficient manner. Decentralization might also result in a robust solution with no single point of failure, paving the way for uncrewed construction of colonies in adverse environments such as the Moon or Mars.
The design space of possible approaches to collective construction is vast, and it encompasses a careful co-design of both hardware, software, and fabrication \cite{CollectiveConstruction}. A particularly important open problem is how to coordinate the construction process autonomously. In this paper, we frame this problem as the study of \textit{how intelligence should be distributed across the system}.
To answer this research question, we explore a novel concept for multi-robot construction that comprises two types of robots. The first is a collection of \emph{smart construction blocks} behaving as a form of growing smart matter. By communicating, the smart blocks monitor the state of the structure and its construction progress in a decentralized fashion. The second type of robot is the \emph{builder}, unaware of the global target structure but able to manipulate and transport blocks in 3D thanks to its inchworm-shaped body. Builders perform localization and path planning by communicating with the smart blocks, which perform the necessary computation. The two types of robots constitute a \emph{symbiotic} system in that their continuous collaboration is necessary for success. For this reason, we called our approach \emph{SMAC} --- \emph{Symbiotic Multi-Agent Construction}.
We envision our system as a technology for in-orbit or planetary construction. In addition, while the smart blocks could be used as actual construction material, they would also be suitable as \emph{smart scaffolding} \cite{komendera2011assembly}. The latter idea would enable reusable, cost-effective technology for remote, large-scale, autonomous construction.
\begin{figure}
\centering
\includegraphics[width=.8\columnwidth]{images/system_diagram.pdf}
\caption{Overview of proposed concept.}
\label{fig:system_architecture}
\end{figure}
\textbf{Related work.} The idea of performing construction in which a robot interacts with the environment is inspired by stigmergy in social insects \cite{theraulaz1999brief}. Several approaches have been proposed in this context, both in simulation \cite{theraulaz1995coordination,grushin2006stigmergic,werfel2007collective,Pinciroli:ANTS2018} and with real robotic platforms \cite{martinoli1999understanding,napp2014distributed,soleymani2015bio,SROCS}. In particular, SROCS introduces the concept of \textit{smart blocks} capable of communicating with a builder robot, and of storing and retrieving information. SMAC\xspace differs from SROCS in two crucial ways:
\begin{inparaenum}[\it (i)]
\item in SMAC\xspace, smart blocks communicate with each other, acting as an intelligent swarm;
\item in SROCS, the builder robot is a crane incapable of traversing the ongoing structure, making it impossible to build structures beyond the builder's own size.
\end{inparaenum}
The problem of navigating and localizing within an ongoing structure has been the subject of several influential works. TERMES \cite{petersen_termes} pioneered a concept in which a wheg-equipped robot, co-designed with a convex block, constructs 2.5D structures by block deposition and removal. The robot follows a predefined plan calculated by an optimization algorithm \cite{deng2019scalable}, with limited capabilities to recover from placing errors. Bill-E \cite{Bill-E} is a bipedal, inchworm-shaped robot designed to navigate and build versatile 3D structures composed of special blocks. Both TERMES and Bill-E handle passive blocks, and localization is achieved by tracking the number of blocks covered since the entry point of the structure.
\textbf{Novelty and contributions.}
To the best of our knowledge, this work is the first to explore the co-design space of collective construction with symbiotic robot teams comprising growing active matter and mobile robots. In this domain, our paper provides four main contributions:
\begin{enumerate}
\item We propose the co-design of two types of robots, both of which present novel challenges and solutions;
\item We introduce planning algorithms for both types of robots that achieve 3D construction and navigation;
\item We characterize the class of structures that are achievable through our system;
\item We demonstrate the effectiveness of our approach through simulations (particularly regarding scalability) and real-world experiments (to validate the hardware design).
\end{enumerate}
The paper is organized as follows. In Sec.\ \ref{sec:problem_statement} we list the main requirements. In Sec.\ \ref{sec:robot_platforms} we illustrate the hardware design, and in Sec.\ \ref{sec:planning_navigation} we describe our algorithms for planning and navigation. We report the results of the evaluation of our approach in Sec.\ \ref{sec:experimental_evaluation} and conclude the paper in Sec.\ \ref{sec:conclusions}.
\section{PROBLEM STATEMENT}
\label{sec:problem_statement}
SMAC\xspace is a multi-robot construction platform designed with the intent of exploring novel questions regarding large-scale, multi-robot, 3D construction. In particular, we aim to separate the planning/monitoring logic involved with multi-robot construction from the physical aspects of construction, such as navigation and block placement. This will enable the study of novel research questions centered around the concept of \textit{``active'' stigmergy}, in which simple, reactive robots build smart structures composed of modules capable of dynamic monitoring and (re)planning.
For the purposes of this work, we consider three high-level design requirements to achieve this vision:
\begin{enumerate}
\item We want our builders to navigate over challenging 3D structures. These robots must also be capable of manipulation/placement of building blocks in any part of the structure.
\item We want our smart blocks to locally compute and communicate information pertinent to the ongoing construction task. Communication must occur both among blocks and between a block and an attached inchworm.
\item Finally, we aim to demonstrate the potential of this kind of distributed, spatial intelligence by devising algorithms that achieve construction in an efficient and scalable manner.
\end{enumerate}
\section{ROBOT PLATFORMS}
\label{sec:robot_platforms}
\subsection{Inchworm Builder and Smart Block Co-Design}
\label{sec:co_design}
We start our presentation by defining the parameters and decisions that dictate the inchworm and block co-design.
\textbf{Smart block side length.}
The first design parameter is the side length $L$ of the smart blocks, which we consider the ``unit'' of the lattice constituting any target structure. A large side length would allow for better electronics and mechanical capabilities for a block, but it would also increase the size and weight of the inchworm. A short length, on the other hand, would allow for a smaller, lighter inchworm, while limiting the capabilities of the smart block.
\textbf{Inchworm-block docking interface.}
The docking interface between an inchworm and a block face dictates how the inchworm climbs a structure and manipulates a block, as well as how the blocks assemble to become a structure. We selected a 4-dowel pin-to-hole design for two reasons:
\begin{inparaenum}[\it (i)]
\item This type of interface can sustain sufficient shear loads; and
\item it fosters alignment, which is beneficial for both inchworms and newly placed blocks onto the structure. For the robots and blocks to exert an attachment force onto the structure, we used an actuated threaded screw. This interface is shown in Fig. \ref{fig:interface_cad}.
\end{inparaenum}
\textbf{Inchworm-block communication.}
The communication interface between an inchworm and a block occurs between the inchworm feet and any face of a block. This allows the inchworm to both communicate and localize itself on the structure without ambiguity.
\subsection{Inchworm Builders}
In the literature, robots such as whegged \cite{petersen_termes}, aerial \cite{stuart_swarm_const_drone}, quadrupedal \cite{jpl_lemur}, and bipedal robots \cite{Bill-E} have demonstrated the traversal of simple 3D structures to place building material with varying levels of dexterity and control complexity \cite{CollectiveConstruction}. In the quest for a versatile design with low control complexity, we identified an inchworm-shaped platform as a satisfactory solution \cite{Bill-E}. An inchworm can traverse over almost all block structures. Furthermore, an inchworm robot can pick and place blocks onto structures at any position and orientation in their workspace. This capability does not compromise other important factors such as weight and cost.
\textbf{Inchworm design summary.} Our inchworm robot is formally defined as a symmetric, bipedal 6-link serial-linkage robot with 5 rotational joints (see Fig.\ \ref{fig:inchworm_cad}). Two of these joints are wrist joints located at each end effector, which enables the inchworm to manipulate the blocks' positions and orientation along 2 axes of rotation and traverse 3D structures.
\begin{figure}[t]
\centering
\includegraphics[width=.9\columnwidth]{images/block_gripper.png}
\caption{CAD model of the inchworm end effector and smart block. This figures shows the common interface mechanism used by both designs.}
\label{fig:interface_cad}
\end{figure}
\begin{figure}[t]
\centering
\includegraphics[width=.9\columnwidth]{images/inchworm_CAD_figure.png}
\caption{CAD design of the inchworm builder.}
\label{fig:inchworm_cad}
\end{figure}
\begin{figure}[t]
\centering
\includegraphics[width=.9\columnwidth]{images/motion_diagram_edited.png}
\caption{Navigation capabilities of the inchworm.}
\label{fig:navigation}
\end{figure}
\textbf{Link design and analysis.} We derived a relationship between the required link lengths and the fundamental inchworm motion configurations to ensure versatile 3D navigation. Fig.\ \ref{fig:navigation} reports the fundamental motions that we considered. For this analysis, the side view of the inchworm allows us to simplify its analysis by considering a 4-link robot with links labeled A through D.
The block side length $L$ affects the lengths of links B and C. The minimum link length is constrained by the robot's ability to navigate a convex corner without collision as shown on the right of Fig.\ \ref{fig:navigation}. To determine a relationship between the inchworm link length and block side length $L$, we expressed the link lengths as vector loop equations \cite{mechanisms}. To solve these equations in the convex corner configuration, we set the length of the A and D links to \unit[1.375$L$] and the clearance vector between the middle joint and the block corner to \unit[0.25$L$]. By solving the vector loop equations, the relationship between the block side length, $L$, and the inchworm link lengths are expressed by $L_\text{A} = L_\text{D} = 1.375 L$ and $L_\text{B} = L_\text{C} = 1.506 L$. Furthermore, if we define a worst-case scenario as a static fully extended robot that is perpendicular to the direction of gravity, as the robot becomes longer and heavier, the required joint torque increases quadratically. Based on budget considerations and a review of available customer off-the-shelf actuator options, the standard form factor servo was the strongest candidate for joint actuators. We therefore defined the block side length as $L=\unit[3]{in}$ and the current inchworm prototype is realized using servo motors. The link lengths of the inchworm were determined based on the above analysis and are reported in Fig.\ \ref{fig:inchworm_cad}. Preliminary testing of the inchworm validated that these link lengths are large enough to enable the inchworm to fully enclose the necessary electromechanical components.
\textbf{Motor selection.}
To specify a suitable motor, we calculated the dynamic torques for the worst-case scenario where each joint has a positive instantaneous velocity and acceleration. For this calculation, we considered a joint speed of \unit[30]{$^\circ$/s}, while the maximum acceleration was determined from a trapezoidal velocity profile \cite{spong_control}. Using a point mass dynamic model of the robot, the worst-case dynamic joint torque resulted in \unit[17.5]{kg-cm}. We chose a standard-form-factor JX PDI-HV5932mg \unit[30]{kg-cm} servo as it provides a safety factor of 1.5 based on the worst dynamical joint torque. We also added high-resolution absolute position magnetic encoders to the joints.
\textbf{Gripper end effector design.}
The end effector design, depicted in Fig.\ \ref{fig:interface_cad}, consists of a flat disk with four, half-inch dowel pins integrated into the surface, as seen on the right of Fig. \ref{fig:interface_cad}. These dowel pins absorb the shear loads on the robot-to-structure interface and align the end effector with the block. We use a single, actuated 4-40 threaded rod to screw into the structure and absorb the normal load acting on the interface. The rod and pin ensure that the overall connection can sustain the loads required to be attached to the structure. Based on the dynamic model of the inchworm, the maximum torque between the inchworm and structure was calculated to be \unit[26.21]{kg-cm} during fast movements. The maximum expected load on the screw is \unit[67.6]{N}, which is well within the proof load of the gripper screw. In order to attach a block, the gripper has an actuated Allen key that is used to turn the block screwing mechanism. Lastly, each gripper has a Near-Field Communication (NFC) antenna that is used to communicate with the structure. NFC is discussed in more detail in Sec.\ \ref{sec:smartblock}.
\textbf{Electronic design.}
The inchworm uses a Teensy 3.6 micro controller and Raspberry Pi Zero for low-level control and joint trajectory planning. The AS5048B magnetic encoders were chosen for the joint sensor because of their compact size. These encoders provide a 14-bit joint angle measurement with a $\unit[0.02]{^\circ}$ resolution. Lastly, the current prototype of the robot is powered by a $\unit[9]{volt}$ power supply instead of a battery for simplicity in conducting experiments.
\textbf{Inchworm behaviors.}
We structured the behaviors of the inchworm into a behavior tree \cite{behaviortrees}. We found that this approach fits well with the reactive nature of the inchworm behavior, while being simple and extendable. The main subtrees involve
\begin{inparaenum}[\it (i)]
\item receiving updates from the structure;
\item waiting (do nothing);
\item moving to a specified location; and
\item building sections of the structure.
\end{inparaenum}
Each of these subtrees is composed of lower-level subtrees that encode simpler behaviors such as picking up blocks, pathfinding, and placing blocks. With reference to Fig. \ref{fig:behavior_tree}, the behaviors are executed top to bottom, left to right.
\begin{figure}
\centering
\includegraphics[width=.9\columnwidth]{images/behavior_tree_update.pdf}
\caption{Inchworm robot behavior tree.}
\label{fig:behavior_tree}
\end{figure}
\subsection{Smart Blocks}
\label{sec:smartblock}
To address the second design goal in Sec. \ref{sec:problem_statement}, our smart blocks need to physically attach to other blocks and communicate with nearby blocks and inchworms. This way, blocks can know the current status of a structure and detect failed or detached blocks. Furthermore, an inchworm can directly communicate with a structure for localization and to determine the status of the structure.
\textbf{Communication.}
For communication to be possible across the 6 faces of a smart block, we considered multiple methods including mesh networks, Universal Asynchronous Receiver/Transmitter (UART) and NFC. We settled on an NFC-based approach with six NXP PN532 NFC controllers and antennas, one for each face, which are all controlled by an Arduino Mini microcontroller. For two separate block faces to communicate over NFC, one NFC controller must be in card emulation mode and one in card reader mode. For a block to receive messages, the NFC controller goes into card emulation mode and the microcontroller polls each block face for an incoming message. For a block to send a message, the NFC controller goes into card reader mode and the message is relayed to the receiving NFC face. The microcontroller keeps the NFC block faces in card reader mode until the message transmission has been confirmed. As shown in Fig.\ \ref{fig:smart_block_struct}, the blocks communicate through a flooding algorithm in which every block broadcasts messages on all its faces.
\textbf{Inchworm-block connections.}
Each block has five female connection faces and one male connection face. The male connection face uses a 4-40 threaded screw, like the robot gripper, to attach to a structure. The top female face has an Allen key input that the inchworm uses to operate the block screwing mechanism. This is shown in Fig. \ref{fig:interface_cad}.
\textbf{Power and LEDs.}
Each block has a 600 mAh battery which provides an average battery life of about 4 hours.
Each face on a block has programmable Neopixel LEDs. This feature is used to convey the state of the block to the user. For an example, a green block is incorporated into a structure, a flashing yellow block is waiting to be added to the structure, and a flashing red block is visually alerting the user that an adjacent block has been removed or failed.
\textbf{Home blocks.}
A variation of the smart block, the \textit{home block}, serves as the structure seed and the initial planner for the entire system. Multiple home blocks can be deployed to parallelize construction starting from several locations. The home block is equipped with a Raspberry Pi Zero.
\begin{figure}
\centering
\includegraphics[width=.9\columnwidth]{images/smart_block_structure.png}
\caption{Structure made of smart blocks showing the flooding communication strategy.}
\label{fig:smart_block_struct}
\end{figure}
\subsection{Structure Perception Functionality}
Three key functions leverage the symbiosis between the blocks and the inchworms:
\begin{enumerate}
\item Structure Status: The smart blocks update the structure's current configuration as blocks are dynamically added.
\item Robot Position: Each inchworm robot requests its own position and the position of other robots with respect to the structure, enabling localization in 3D space.
\item Heartbeat Protocol: The structure can identify if a block is missing or has failed by regularly updating the structure’s current configuration and comparing it to the previous configuration. This is performed by checking the status of neighboring blocks.
\end{enumerate}
\section{PLANNING AND NAVIGATION}
\label{sec:planning_navigation}
To fulfill the third requirement, we devised algorithms for planning and navigation that take advantage of the hardware design presented in Sec.\ \ref{sec:robot_platforms}.
\subsection{Planning}
\label{sec:planning}
\begin{figure}
\centering
\includegraphics[width=.9\columnwidth]{images/building_alg_pictures.png}
\caption{Examples of steps of building algorithm.}
\label{fig:building_alg}
\end{figure}
The planning algorithm (see Fig. \ref{fig:sequence_diagram}), is responsible for calculating the sequence of operations that must be accomplished to build the target structure. These operations include retrieving and placing blocks in the locations indicated in the blueprint of the target structure. The planning algorithm is executed by the home block (or blocks, in case multiple home blocks are deployed).
\textbf{Divisions.}
Because navigation is a time-consuming activity for the inchworms, the planning algorithm splits the structure into \textit{divisions}. Each inchworm claims a specific division. Inside of a division, the inchworm receives instructions from and communicates to the planner through the smart blocks. For example, the home block informs the inchworms that a new block is available for placement.
\textbf{Ferrying.}
When inchworms are notified that a new block is available for placement, the inchworm in the nearest division picks it up and either places it in its own division, or it brings it to the border of the division nearest to the target location. The inchworm responsible for that division picks up the block and repeats the above procedure. We call \textit{ferrying} the act of passing blocks across divisions until the target division is reached. Ferrying, akin to a bucket-brigade, is a form of task partitioning \cite{ratnieks1999task,pini2011task} that lowers the navigation cost of the inchworms. The planner provides instructions to the inchworms by changing the state of blocks.
\textbf{Division creation.}
Divisions are created by subdividing a given structure into areas where an inchworm is meant to perform work, as shown in Fig. \ref{fig:building_alg} (division creation). While the divisions extend to 3D shapes, only a layer of the structure, defined as a group of blocks 1 unit high, is considered at a time. The size and shape of divisions can vary, but ultimately they are meant to minimize the amount of inching the inchworms must perform to either ferry or build blocks. Next, a partial ordering of the divisions is established as a means to determine the order at which divisions should be built. This partial ordering is used to construct a priority queue. An assumption made as part of the system is that a location on the structure, designated as the feeding location, would be where a human operator would introduce new blocks into the system. For simplicity, the system uses a single feeding location at the home block. The partial ordering is determined as the relative distance from the feeding location and calculated using the wavefront algorithm. Divisions that are closer to the feeding location are built first. Once these divisions are built, the inchworms traverse the built divisions to ferry blocks to divisions farther away from the feeding location.
\textbf{Division claiming.}
Once the partial ordering is established for a given layer of the structure, the inchworm robots are tasked with dispersing themselves into the different divisions, as shown in Fig. \ref{fig:building_alg} (division claiming). The divisions are considered in the order of the priority queue. Using the communication capabilities of the smart blocks, each inchworm calculates its position in the different divisions. Each inchworm then communicates the nearest division and the distance to that division. The distance to the division is considered the amount the inchworm is bidding for a division, such that a larger distance corresponds to a higher vote. The inchworm with the highest bid (largest distance) claims the division, and the process is repeated until each inchworm has claimed a division. This process is done such that each inchworm minimizes the distance it must travel (inch) to reach a division.
\textbf{Block placement.}
After the inchworms are distributed, the operator introduces new smart blocks into the system, which signal to the inchworms that there are new blocks to move or build. If an inchworm is in a division that has already been built, it passes the block (ferry) to another division, as shown in Fig.\ \ref{fig:building_alg} (ferrying behavior). If the division has not been built, the inchworms query the planner for the blueprint of that division and place the blocks accordingly, as shown in Fig.\ \ref{fig:building_alg} (building behavior). When moving blocks, whether ferrying or building, the inchworms place blocks in a spiral fashion, starting from the center of the division and moving outwards. This was chosen so that after the first block is placed at the center of the division, the inchworm can climb onto the block and act as a fixed-base robot arm, pivoting around the block to place additional blocks. If the shape and size of divisions prevent the inchworm from reaching each location, the robot will inch to place a block. When ferrying, the inchworms place blocks towards the outer edges of their own division such that a robot in an adjacent division has to extend as little as possible into the initial division, thus minimizing the chances of collision or periods where an inchworm must wait for another inchworms to move.
\textbf{Reactive replanning.}
Once the inchworms have finished building or ferrying a division, the inchworms will disperse themselves again and repeat the process of either building or ferrying blocks. This minimizes the time the inchworms spend waiting for other inchworms to finish. The procedure of dividing a layer into divisions, dispersing the inchworms, and then building or ferrying blocks through the divisions is repeated for each layer in the structure until the entire structure is built.
\textbf{Achievable structures.}
Based off of the manner in which the planner performs construction, it is possible to characterize the types of buildings that can be built using our algorithm. Specifically, our algorithm can build any structure that does not present upside-down L-shape overhangs. This can be informally explained by noting that the building algorithm proceeds in a bottom-up (positive $z$ direction) manner, such that it will never remove a block from a layer below one that has already been built. Thus, our building algorithm is capable of building structures with overhangs, excluding those with overhangs that extend into the negative $z$ direction, characterized as an upside down L-shape. We wish to stress that this limitation concerns the building algorithm and not the hardware capabilities of the robots. Removing this algorithmic limitation is left as future work.
\subsection{Navigation}
In order to reach any given location on the structure, the inchworm robots must be capable of producing a traversable path to the given location.
\textbf{Face*.}
We developed a simple path planning algorithm, called \textit{Face*}, that takes advantage of the versatile mobility of the robots. Face* is an extension of the A* algorithm that considers the various legal motions of the inchworms, such as the fact that it can climb vertically and upside-down, while minimizing the amount of inching performed. The algorithm works by considering the faces of each block as nodes in a network, and using the Manhattan distance to each node as the cost associated with reaching that node. Analogously to the A* algorithm, Face* selects the node with the lowest associated cost. For each node, an inverse kinematics simulation is performed to ensure no collisions with the structure are possible. The collision detection analysis is only run three times for each node to simplify complexity: once when the robot has disengaged from the current node, once when the robot has moved above the goal node, and once when the robot has engaged with the goal node. If, at any point in this process, a node is unreachable or causes a collision, the node is removed and the next lowest cost node is considered. Only when a complete, collision-free, traversable path is created does the algorithm returns a successful path. The pseudocode of Face* is shown in Alg.\ \ref{face*}.
It is important to note that a path is only generated for the end effector closest to the goal, not for both end effectors. The second end effector does not require a separate path to be generated as it can follow in the footsteps of the first end effector. Also note that if an end effector is not engaged to the structure, Face* first considers if the already disengaged end effector is capable of reaching the given position. This allows the inchworm to swing in place like a fixed-base robot arm and reduce unnecessary inching.
\begin{figure}
\centering
\includegraphics[width=.7\columnwidth]{images/sequence_diagram_building_alg.pdf}
\caption{Sequence diagram of building algorithm for structure and N number of inchworms that is repeated for every layer within the given structure.}
\label{fig:sequence_diagram}
\end{figure}
\begin{algorithm}
\caption{Inchworm path planning for navigation}
\label{face*}
\begin{footnotesize}
\begin{algorithmic}[1]
\Procedure{Face*}{\textit{structure}, \textit{start}, \textit{goal}}
\State \textit{frontier} $\gets$ PriorityQueue((\textit{start}, 0))
\State \textit{cameFrom} $\gets$ $\{(None, 0)\}$
\While{\textbf{not} \textit{frontier}.empty()}
\State \textit{current} $\gets$ \textit{frontier}.get()
\If{\textit{current} == \textit{goal}}
\State \textbf{break}
\EndIf
\For{\textit{next} \textbf{in} \textit{structure}.neighbors(\textit{current})}
\State \textit{newCost} $\gets$ \textit{cameFrom}[\textit{current}[1] + \textit{structure}.cost(\textit{current}, \textit{next})
\If{\textit{next} \textbf{not in} \textit{cameFrom} \textbf{or} \textit{cameFrom}[1] \textless \textit{\textit{current}}[\textit{next}]}
\If{\textit{structure}.isReachableAndCollisionFree(\textit{next})}
\State \textit{cameFrom}[\textit{next}][1] $\gets$ (\textit{current}, \textit{newCost})
\State \textit{priority} $\gets$ \textit{newCost} + heuristic(\textit{goal}, \textit{next})
\State \textit{frontier}.put(\textit{next}, priority)
\EndIf
\EndIf
\EndFor
\EndWhile
\State \textbf{return} \textit{path}
\EndProcedure
\end{algorithmic}
\end{footnotesize}
\end{algorithm}
\section{EXPERIMENTAL EVALUATION}
\label{sec:experimental_evaluation}
To gauge the performance of our approach, we ran both simulated and real-world experiments.
\subsection{Simulated Experiments}
We developed a custom simulation environment to visualize and collect statistics of the system. The simulation environment was built using the Visualization Tool Kit (VTK).\footnote{\url{https://vtk.org/}} The experiments were run on a 2015 MacBook Pro.
\textbf{Metrics.} The performance metrics we considered for the simulated experiments are
\begin{inparaenum}[\it (i)]
\item whether the construction process succeeded; and
\item the speed at which the structure was constructed, measured in simulated time steps.
\end{inparaenum}
\textbf{Setup.}
We tested our approach with diverse structures including pyramids, temples, churches, castles, the Empire State Building, and the Star Trek Reliant ship, among others (see Fig.\ \ref{fig:simulated_buildings}). We compared the construction speed across different numbers of inchworms to investigate the effect of adding additional robots on construction time. In the simulation experiments, inchworms were randomly placed on a surface composed of smart blocks. The inchworms were then tasked with distributing themselves according to the distribution algorithm explained in Sec.\ \ref{sec:planning}. After the inchworms had distributed themselves, a virtual operator sets smart blocks down in a corner of the layer, designated as the feeding location. Prompted by the introduction of a new block into the system, the inchworms reacted by moving the blocks throughout the system as explained in Sec.\ \ref{sec:planning_navigation}. For all simulations, the inchworms were able to place all blocks as required.
\begin{figure}[t]
\centering
\includegraphics[width=.8\columnwidth]{images/Simulated_Buildings.png}
\caption{Examples of structures achievable by our system.}
\label{fig:simulated_buildings}
\end{figure}
\textbf{Scalability study.}
The results of two experiments are reported in Fig.\ \ref{fig:results_plane}. The experiments involve 1 to 4 robots tasked with building a $10 \times 10$ plane and a pyramid consisting of 316 blocks. As shown in Fig.\ \ref{fig:results_plane}, the time decreases with additional robots, especially when comparing a single robot and four robots. The results appear to follow a sublinear trend, which we approximated with a second-order polynomial curve.
\textbf{Task specialization.}
To analyze how the collaboration between inchworms affects performance, we recorded the total amount of time spent in each behavior by the inchworms. The main behaviors tracked were receiving updates from other robots and the structure (\textit{Update}), moving (\textit{Move}), waiting (\textit{Wait}), building (\textit{Build}), and ferrying (\textit{Ferry}). The results shown in Fig.\ \ref{fig:behavior_time} refer to the same structures considered in the scalability study. For the single inchworm experiment, the inchworm spends almost all its time either ferrying or building. Almost no time is spent waiting, and a very small portion of time is spent receiving updates. This is expected, as there are no other inchworms with which it must coordinate.
For the experiments with multiple robots, we observed that the time spent across the different behaviors is very heterogeneous. Although capable of exhibiting all the behaviors, the inchworms specialized themselves into different groups, in which some of the inchworms focus more on ferrying while others focus more on building. In particular, we observed that one inchworm did most of the ferrying, while the other inchworms mainly focused on the building. This task specialization is an interesting emergent property of our approach whose appearance depends on the type of structure to build. We also observed that the waiting time and the time spent receiving updates of all inchworms is much higher compared to the single inchworm experiment. This is expected, as by increasing the number of inchworms, maintaining coordination demands communication between the inchworms and the smart blocks. Samples of these tests are reported in the video at \url{https://youtu.be/zLDa8vK0HpM}.
\begin{figure}
\centering
\begin{subfigure}{.9\columnwidth}
\includegraphics[width=.9\columnwidth]{images/TimetoBuildPlane.pdf}
\label{fig:sub1}
\end{subfigure}
\begin{subfigure}{.9\columnwidth}
\includegraphics[width=.9\columnwidth]{images/TimetoBuildPyramid.pdf}
\label{fig:sub2}
\end{subfigure}
\caption{Time required to build structures for different numbers of inchworms.}
\label{fig:results_plane}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=.7\columnwidth]{images/experimental_behavior_times.pdf}
\caption{Time spent performing specific behaviors for different numbers of robots.}
\label{fig:behavior_time}
\end{figure}
\subsection{Real-world Experiments}
The goal of the real-world experiments was to validate the hardware, as well as to investigate whether some of the results found in the simulation would be consistent in the real world. We constructed one inchworm and five smart blocks.
\textbf{Unit testing.}
We performed a successful campaign of unit tests to validate the fundamental motions of the inchworm. We also tested the smart blocks to detect when new blocks were added or removed, or when a block went offline, which could be attributed to a fault, dead battery, or other physical error. The tests were all successful. Samples of these tests are reported in the video at \url{https://youtu.be/zLDa8vK0HpM}.
\textbf{Inching precision test.}
We validated the precision of the inchworm to estimate how often an inchworm may fail. The inchworm was made to take an inching step and retract 10 times. This experiment was also replicated while an inchworm was taking a step with a block. It was found that the inchworm was able to successfully step and grip 100\% of the time and step while carrying a block 80\% of the time. The results from the second test is attributed to the disturbance the block applies on the inchworm which can cause occasional inching errors.
\textbf{Inching and gripping test.}
We also tested the capability of our inchworm to take three steps on a plane while carrying a block. We estimated the inching speed to be 1 step every \unit[40]{s}. The majority of this time came from the grippers, with about \unit[20]{s} on average for engaging with the structure and about \unit[10]{s} for disengaging with the structure.
\textbf{Inchworm system test.}
A complete system-level test was also performed to demonstrate that the inchworm is able to inch, traverse a structure, manipulate a block, and place it on the structure. A series of snapshots from the demonstration are shown in Fig. \ref{fig:system_inch_test}, and the footage is available in the video at \url{https://youtu.be/zLDa8vK0HpM}.
\begin{figure}
\centering
\includegraphics[width=.9\columnwidth]{images/Inchworm_System_Unit_Test.png}
\caption{Robot inching and placing a block.}
\label{fig:system_inch_test}
\end{figure}
\textbf{Smart block communication.}
We performed a series of tests to validate that a new block is detected when it is added into the structure, and that the structure can detect when a block is removed from the structure. The images in Fig.\ \ref{fig:block_test} show that the blocks change the color of their LEDs to convey the change in the structure. Experimentally, the average time for two smart blocks to exchange a 62-byte package was \unit[500]{ms}, which corresponds to an average bit rate of \unit[992]{bit/s}. We also estimated the impact of a large structure on communication latency. The number of hops between any block and the home block is given by the Manhattan distance between them. A message originating from block at $(x,y,z)$ of a 3D structure must traverse $x+y+z$ blocks to reach a home block at $(0,0,0)$. To put this in perspective, a message sent by a block placed in the corner of a $10 \times 10 \times 10$ cube would take \unit[15]{s} to reach the opposite diagonal corner. This has important implications when building large structures, motivating the need for multiple home blocks to decrease this latency. We will study these aspects in future work.
\begin{figure}
\centering
\includegraphics[width=.9\columnwidth]{images/block_experiment.png}
\caption{
1) A block is added to the structure. 2) The top block turns green to indicate ``all OK.'' 3) The bottom block changes color to red after it detects an error in the top block, which has gone offline.}
\label{fig:block_test}
\end{figure}
\section{CONCLUSIONS AND FUTURE WORK}
\label{sec:conclusions}
This paper proposes SMAC\xspace, a robotic platform for collective construction composed of two types of robot:
\begin{inparaenum}[\it (i)]
\item a collection of smart blocks, forming an intelligent network capable of dynamic planning and monitoring; and
\item an inchworm-shaped, builder robot, able to navigate a 3D structure and deposit blocks under the guidance of the smart blocks.
\end{inparaenum}
We presented the hardware design of our platform, along with a set of simulated and real-world experiments aimed at showing its capabilities.
Our work is a step in the study of ``active'' stigmergy in multi-robot construction, a promising concept in which the structure being built is an active component of the process. This idea makes it possible to simplify the design of the builder robots. In addition, the smart blocks could be used as a form of \textit{smart scaffolding}. This would make it possible to reuse the same robotic platforms in multiple construction projects, thus paving the way for affordable, cost-effective construction in space applications and remote terrestrial environment.
Future work will concentrate on improving the capabilities of our robotic platforms and devising/studying novel planning algorithms to exploit the concept of active stigmergy in collective construction.
\section*{ACKNOWLEDGMENT}
We thank Prof.\ Raghvendra Cowlagi for guidance and fruitful conversations and Cameron Collins for his assistance in the manufacturing of the hardware of the platform.
\section{INTRODUCTION}
Multi-robot systems promise solutions for construction at much larger scales than the robots themselves. With many robots working in parallel, construction can be completed in a fast and efficient manner. Decentralization might also result in a robust solution with no single point of failure, paving the way for uncrewed construction of colonies in adverse environments such as the Moon or Mars.
The design space of possible approaches to collective construction is vast, and it encompasses a careful co-design of both hardware, software, and fabrication \cite{CollectiveConstruction}. A particularly important open problem is how to coordinate the construction process autonomously. In this paper, we frame this problem as the study of \textit{how intelligence should be distributed across the system}.
To answer this research question, we explore a novel concept for multi-robot construction that comprises two types of robots. The first is a collection of \emph{smart construction blocks} behaving as a form of growing smart matter. By communicating, the smart blocks monitor the state of the structure and its construction progress in a decentralized fashion. The second type of robot is the \emph{builder}, unaware of the global target structure but able to manipulate and transport blocks in 3D thanks to its inchworm-shaped body. Builders perform localization and path planning by communicating with the smart blocks, which perform the necessary computation. The two types of robots constitute a \emph{symbiotic} system in that their continuous collaboration is necessary for success. For this reason, we called our approach \emph{SMAC} --- \emph{Symbiotic Multi-Agent Construction}.
We envision our system as a technology for in-orbit or planetary construction. In addition, while the smart blocks could be used as actual construction material, they would also be suitable as \emph{smart scaffolding} \cite{komendera2011assembly}. The latter idea would enable reusable, cost-effective technology for remote, large-scale, autonomous construction.
\begin{figure}
\centering
\includegraphics[width=.8\columnwidth]{images/system_diagram.pdf}
\caption{Overview of proposed concept.}
\label{fig:system_architecture}
\end{figure}
\textbf{Related work.} The idea of performing construction in which a robot interacts with the environment is inspired by stigmergy in social insects \cite{theraulaz1999brief}. Several approaches have been proposed in this context, both in simulation \cite{theraulaz1995coordination,grushin2006stigmergic,werfel2007collective,Pinciroli:ANTS2018} and with real robotic platforms \cite{martinoli1999understanding,napp2014distributed,soleymani2015bio,SROCS}. In particular, SROCS introduces the concept of \textit{smart blocks} capable of communicating with a builder robot, and of storing and retrieving information. SMAC\xspace differs from SROCS in two crucial ways:
\begin{inparaenum}[\it (i)]
\item in SMAC\xspace, smart blocks communicate with each other, acting as an intelligent swarm;
\item in SROCS, the builder robot is a crane incapable of traversing the ongoing structure, making it impossible to build structures beyond the builder's own size.
\end{inparaenum}
The problem of navigating and localizing within an ongoing structure has been the subject of several influential works. TERMES \cite{petersen_termes} pioneered a concept in which a wheg-equipped robot, co-designed with a convex block, constructs 2.5D structures by block deposition and removal. The robot follows a predefined plan calculated by an optimization algorithm \cite{deng2019scalable}, with limited capabilities to recover from placing errors. Bill-E \cite{Bill-E} is a bipedal, inchworm-shaped robot designed to navigate and build versatile 3D structures composed of special blocks. Both TERMES and Bill-E handle passive blocks, and localization is achieved by tracking the number of blocks covered since the entry point of the structure.
\textbf{Novelty and contributions.}
To the best of our knowledge, this work is the first to explore the co-design space of collective construction with symbiotic robot teams comprising growing active matter and mobile robots. In this domain, our paper provides four main contributions:
\begin{enumerate}
\item We propose the co-design of two types of robots, both of which present novel challenges and solutions;
\item We introduce planning algorithms for both types of robots that achieve 3D construction and navigation;
\item We characterize the class of structures that are achievable through our system;
\item We demonstrate the effectiveness of our approach through simulations (particularly regarding scalability) and real-world experiments (to validate the hardware design).
\end{enumerate}
The paper is organized as follows. In Sec.\ \ref{sec:problem_statement} we list the main requirements. In Sec.\ \ref{sec:robot_platforms} we illustrate the hardware design, and in Sec.\ \ref{sec:planning_navigation} we describe our algorithms for planning and navigation. We report the results of the evaluation of our approach in Sec.\ \ref{sec:experimental_evaluation} and conclude the paper in Sec.\ \ref{sec:conclusions}.
\section{PROBLEM STATEMENT}
\label{sec:problem_statement}
SMAC\xspace is a multi-robot construction platform designed with the intent of exploring novel questions regarding large-scale, multi-robot, 3D construction. In particular, we aim to separate the planning/monitoring logic involved with multi-robot construction from the physical aspects of construction, such as navigation and block placement. This will enable the study of novel research questions centered around the concept of \textit{``active'' stigmergy}, in which simple, reactive robots build smart structures composed of modules capable of dynamic monitoring and (re)planning.
For the purposes of this work, we consider three high-level design requirements to achieve this vision:
\begin{enumerate}
\item We want our builders to navigate over challenging 3D structures. These robots must also be capable of manipulation/placement of building blocks in any part of the structure.
\item We want our smart blocks to locally compute and communicate information pertinent to the ongoing construction task. Communication must occur both among blocks and between a block and an attached inchworm.
\item Finally, we aim to demonstrate the potential of this kind of distributed, spatial intelligence by devising algorithms that achieve construction in an efficient and scalable manner.
\end{enumerate}
\section{ROBOT PLATFORMS}
\label{sec:robot_platforms}
\subsection{Inchworm Builder and Smart Block Co-Design}
\label{sec:co_design}
We start our presentation by defining the parameters and decisions that dictate the inchworm and block co-design.
\textbf{Smart block side length.}
The first design parameter is the side length $L$ of the smart blocks, which we consider the ``unit'' of the lattice constituting any target structure. A large side length would allow for better electronics and mechanical capabilities for a block, but it would also increase the size and weight of the inchworm. A short length, on the other hand, would allow for a smaller, lighter inchworm, while limiting the capabilities of the smart block.
\textbf{Inchworm-block docking interface.}
The docking interface between an inchworm and a block face dictates how the inchworm climbs a structure and manipulates a block, as well as how the blocks assemble to become a structure. We selected a 4-dowel pin-to-hole design for two reasons:
\begin{inparaenum}[\it (i)]
\item This type of interface can sustain sufficient shear loads; and
\item it fosters alignment, which is beneficial for both inchworms and newly placed blocks onto the structure. For the robots and blocks to exert an attachment force onto the structure, we used an actuated threaded screw. This interface is shown in Fig. \ref{fig:interface_cad}.
\end{inparaenum}
\textbf{Inchworm-block communication.}
The communication interface between an inchworm and a block occurs between the inchworm feet and any face of a block. This allows the inchworm to both communicate and localize itself on the structure without ambiguity.
\subsection{Inchworm Builders}
In the literature, robots such as whegged \cite{petersen_termes}, aerial \cite{stuart_swarm_const_drone}, quadrupedal \cite{jpl_lemur}, and bipedal robots \cite{Bill-E} have demonstrated the traversal of simple 3D structures to place building material with varying levels of dexterity and control complexity \cite{CollectiveConstruction}. In the quest for a versatile design with low control complexity, we identified an inchworm-shaped platform as a satisfactory solution \cite{Bill-E}. An inchworm can traverse over almost all block structures. Furthermore, an inchworm robot can pick and place blocks onto structures at any position and orientation in their workspace. This capability does not compromise other important factors such as weight and cost.
\textbf{Inchworm design summary.} Our inchworm robot is formally defined as a symmetric, bipedal 6-link serial-linkage robot with 5 rotational joints (see Fig.\ \ref{fig:inchworm_cad}). Two of these joints are wrist joints located at each end effector, which enables the inchworm to manipulate the blocks' positions and orientation along 2 axes of rotation and traverse 3D structures.
\begin{figure}[t]
\centering
\includegraphics[width=.9\columnwidth]{images/block_gripper.png}
\caption{CAD model of the inchworm end effector and smart block. This figures shows the common interface mechanism used by both designs.}
\label{fig:interface_cad}
\end{figure}
\begin{figure}[t]
\centering
\includegraphics[width=.9\columnwidth]{images/inchworm_CAD_figure.png}
\caption{CAD design of the inchworm builder.}
\label{fig:inchworm_cad}
\end{figure}
\begin{figure}[t]
\centering
\includegraphics[width=.9\columnwidth]{images/motion_diagram_edited.png}
\caption{Navigation capabilities of the inchworm.}
\label{fig:navigation}
\end{figure}
\textbf{Link design and analysis.} We derived a relationship between the required link lengths and the fundamental inchworm motion configurations to ensure versatile 3D navigation. Fig.\ \ref{fig:navigation} reports the fundamental motions that we considered. For this analysis, the side view of the inchworm allows us to simplify its analysis by considering a 4-link robot with links labeled A through D.
The block side length $L$ affects the lengths of links B and C. The minimum link length is constrained by the robot's ability to navigate a convex corner without collision as shown on the right of Fig.\ \ref{fig:navigation}. To determine a relationship between the inchworm link length and block side length $L$, we expressed the link lengths as vector loop equations \cite{mechanisms}. To solve these equations in the convex corner configuration, we set the length of the A and D links to \unit[1.375$L$] and the clearance vector between the middle joint and the block corner to \unit[0.25$L$]. By solving the vector loop equations, the relationship between the block side length, $L$, and the inchworm link lengths are expressed by $L_\text{A} = L_\text{D} = 1.375 L$ and $L_\text{B} = L_\text{C} = 1.506 L$. Furthermore, if we define a worst-case scenario as a static fully extended robot that is perpendicular to the direction of gravity, as the robot becomes longer and heavier, the required joint torque increases quadratically. Based on budget considerations and a review of available customer off-the-shelf actuator options, the standard form factor servo was the strongest candidate for joint actuators. We therefore defined the block side length as $L=\unit[3]{in}$ and the current inchworm prototype is realized using servo motors. The link lengths of the inchworm were determined based on the above analysis and are reported in Fig.\ \ref{fig:inchworm_cad}. Preliminary testing of the inchworm validated that these link lengths are large enough to enable the inchworm to fully enclose the necessary electromechanical components.
\textbf{Motor selection.}
To specify a suitable motor, we calculated the dynamic torques for the worst-case scenario where each joint has a positive instantaneous velocity and acceleration. For this calculation, we considered a joint speed of \unit[30]{$^\circ$/s}, while the maximum acceleration was determined from a trapezoidal velocity profile \cite{spong_control}. Using a point mass dynamic model of the robot, the worst-case dynamic joint torque resulted in \unit[17.5]{kg-cm}. We chose a standard-form-factor JX PDI-HV5932mg \unit[30]{kg-cm} servo as it provides a safety factor of 1.5 based on the worst dynamical joint torque. We also added high-resolution absolute position magnetic encoders to the joints.
\textbf{Gripper end effector design.}
The end effector design, depicted in Fig.\ \ref{fig:interface_cad}, consists of a flat disk with four, half-inch dowel pins integrated into the surface, as seen on the right of Fig. \ref{fig:interface_cad}. These dowel pins absorb the shear loads on the robot-to-structure interface and align the end effector with the block. We use a single, actuated 4-40 threaded rod to screw into the structure and absorb the normal load acting on the interface. The rod and pin ensure that the overall connection can sustain the loads required to be attached to the structure. Based on the dynamic model of the inchworm, the maximum torque between the inchworm and structure was calculated to be \unit[26.21]{kg-cm} during fast movements. The maximum expected load on the screw is \unit[67.6]{N}, which is well within the proof load of the gripper screw. In order to attach a block, the gripper has an actuated Allen key that is used to turn the block screwing mechanism. Lastly, each gripper has a Near-Field Communication (NFC) antenna that is used to communicate with the structure. NFC is discussed in more detail in Sec.\ \ref{sec:smartblock}.
\textbf{Electronic design.}
The inchworm uses a Teensy 3.6 micro controller and Raspberry Pi Zero for low-level control and joint trajectory planning. The AS5048B magnetic encoders were chosen for the joint sensor because of their compact size. These encoders provide a 14-bit joint angle measurement with a $\unit[0.02]{^\circ}$ resolution. Lastly, the current prototype of the robot is powered by a $\unit[9]{volt}$ power supply instead of a battery for simplicity in conducting experiments.
\textbf{Inchworm behaviors.}
We structured the behaviors of the inchworm into a behavior tree \cite{behaviortrees}. We found that this approach fits well with the reactive nature of the inchworm behavior, while being simple and extendable. The main subtrees involve
\begin{inparaenum}[\it (i)]
\item receiving updates from the structure;
\item waiting (do nothing);
\item moving to a specified location; and
\item building sections of the structure.
\end{inparaenum}
Each of these subtrees is composed of lower-level subtrees that encode simpler behaviors such as picking up blocks, pathfinding, and placing blocks. With reference to Fig. \ref{fig:behavior_tree}, the behaviors are executed top to bottom, left to right.
\begin{figure}
\centering
\includegraphics[width=.9\columnwidth]{images/behavior_tree_update.pdf}
\caption{Inchworm robot behavior tree.}
\label{fig:behavior_tree}
\end{figure}
\subsection{Smart Blocks}
\label{sec:smartblock}
To address the second design goal in Sec. \ref{sec:problem_statement}, our smart blocks need to physically attach to other blocks and communicate with nearby blocks and inchworms. This way, blocks can know the current status of a structure and detect failed or detached blocks. Furthermore, an inchworm can directly communicate with a structure for localization and to determine the status of the structure.
\textbf{Communication.}
For communication to be possible across the 6 faces of a smart block, we considered multiple methods including mesh networks, Universal Asynchronous Receiver/Transmitter (UART) and NFC. We settled on an NFC-based approach with six NXP PN532 NFC controllers and antennas, one for each face, which are all controlled by an Arduino Mini microcontroller. For two separate block faces to communicate over NFC, one NFC controller must be in card emulation mode and one in card reader mode. For a block to receive messages, the NFC controller goes into card emulation mode and the microcontroller polls each block face for an incoming message. For a block to send a message, the NFC controller goes into card reader mode and the message is relayed to the receiving NFC face. The microcontroller keeps the NFC block faces in card reader mode until the message transmission has been confirmed. As shown in Fig.\ \ref{fig:smart_block_struct}, the blocks communicate through a flooding algorithm in which every block broadcasts messages on all its faces.
\textbf{Inchworm-block connections.}
Each block has five female connection faces and one male connection face. The male connection face uses a 4-40 threaded screw, like the robot gripper, to attach to a structure. The top female face has an Allen key input that the inchworm uses to operate the block screwing mechanism. This is shown in Fig. \ref{fig:interface_cad}.
\textbf{Power and LEDs.}
Each block has a 600 mAh battery which provides an average battery life of about 4 hours.
Each face on a block has programmable Neopixel LEDs. This feature is used to convey the state of the block to the user. For an example, a green block is incorporated into a structure, a flashing yellow block is waiting to be added to the structure, and a flashing red block is visually alerting the user that an adjacent block has been removed or failed.
\textbf{Home blocks.}
A variation of the smart block, the \textit{home block}, serves as the structure seed and the initial planner for the entire system. Multiple home blocks can be deployed to parallelize construction starting from several locations. The home block is equipped with a Raspberry Pi Zero.
\begin{figure}
\centering
\includegraphics[width=.9\columnwidth]{images/smart_block_structure.png}
\caption{Structure made of smart blocks showing the flooding communication strategy.}
\label{fig:smart_block_struct}
\end{figure}
\subsection{Structure Perception Functionality}
Three key functions leverage the symbiosis between the blocks and the inchworms:
\begin{enumerate}
\item Structure Status: The smart blocks update the structure's current configuration as blocks are dynamically added.
\item Robot Position: Each inchworm robot requests its own position and the position of other robots with respect to the structure, enabling localization in 3D space.
\item Heartbeat Protocol: The structure can identify if a block is missing or has failed by regularly updating the structure’s current configuration and comparing it to the previous configuration. This is performed by checking the status of neighboring blocks.
\end{enumerate}
\section{PLANNING AND NAVIGATION}
\label{sec:planning_navigation}
To fulfill the third requirement, we devised algorithms for planning and navigation that take advantage of the hardware design presented in Sec.\ \ref{sec:robot_platforms}.
\subsection{Planning}
\label{sec:planning}
\begin{figure}
\centering
\includegraphics[width=.9\columnwidth]{images/building_alg_pictures.png}
\caption{Examples of steps of building algorithm.}
\label{fig:building_alg}
\end{figure}
The planning algorithm (see Fig. \ref{fig:sequence_diagram}), is responsible for calculating the sequence of operations that must be accomplished to build the target structure. These operations include retrieving and placing blocks in the locations indicated in the blueprint of the target structure. The planning algorithm is executed by the home block (or blocks, in case multiple home blocks are deployed).
\textbf{Divisions.}
Because navigation is a time-consuming activity for the inchworms, the planning algorithm splits the structure into \textit{divisions}. Each inchworm claims a specific division. Inside of a division, the inchworm receives instructions from and communicates to the planner through the smart blocks. For example, the home block informs the inchworms that a new block is available for placement.
\textbf{Ferrying.}
When inchworms are notified that a new block is available for placement, the inchworm in the nearest division picks it up and either places it in its own division, or it brings it to the border of the division nearest to the target location. The inchworm responsible for that division picks up the block and repeats the above procedure. We call \textit{ferrying} the act of passing blocks across divisions until the target division is reached. Ferrying, akin to a bucket-brigade, is a form of task partitioning \cite{ratnieks1999task,pini2011task} that lowers the navigation cost of the inchworms. The planner provides instructions to the inchworms by changing the state of blocks.
\textbf{Division creation.}
Divisions are created by subdividing a given structure into areas where an inchworm is meant to perform work, as shown in Fig. \ref{fig:building_alg} (division creation). While the divisions extend to 3D shapes, only a layer of the structure, defined as a group of blocks 1 unit high, is considered at a time. The size and shape of divisions can vary, but ultimately they are meant to minimize the amount of inching the inchworms must perform to either ferry or build blocks. Next, a partial ordering of the divisions is established as a means to determine the order at which divisions should be built. This partial ordering is used to construct a priority queue. An assumption made as part of the system is that a location on the structure, designated as the feeding location, would be where a human operator would introduce new blocks into the system. For simplicity, the system uses a single feeding location at the home block. The partial ordering is determined as the relative distance from the feeding location and calculated using the wavefront algorithm. Divisions that are closer to the feeding location are built first. Once these divisions are built, the inchworms traverse the built divisions to ferry blocks to divisions farther away from the feeding location.
\textbf{Division claiming.}
Once the partial ordering is established for a given layer of the structure, the inchworm robots are tasked with dispersing themselves into the different divisions, as shown in Fig. \ref{fig:building_alg} (division claiming). The divisions are considered in the order of the priority queue. Using the communication capabilities of the smart blocks, each inchworm calculates its position in the different divisions. Each inchworm then communicates the nearest division and the distance to that division. The distance to the division is considered the amount the inchworm is bidding for a division, such that a larger distance corresponds to a higher vote. The inchworm with the highest bid (largest distance) claims the division, and the process is repeated until each inchworm has claimed a division. This process is done such that each inchworm minimizes the distance it must travel (inch) to reach a division.
\textbf{Block placement.}
After the inchworms are distributed, the operator introduces new smart blocks into the system, which signal to the inchworms that there are new blocks to move or build. If an inchworm is in a division that has already been built, it passes the block (ferry) to another division, as shown in Fig.\ \ref{fig:building_alg} (ferrying behavior). If the division has not been built, the inchworms query the planner for the blueprint of that division and place the blocks accordingly, as shown in Fig.\ \ref{fig:building_alg} (building behavior). When moving blocks, whether ferrying or building, the inchworms place blocks in a spiral fashion, starting from the center of the division and moving outwards. This was chosen so that after the first block is placed at the center of the division, the inchworm can climb onto the block and act as a fixed-base robot arm, pivoting around the block to place additional blocks. If the shape and size of divisions prevent the inchworm from reaching each location, the robot will inch to place a block. When ferrying, the inchworms place blocks towards the outer edges of their own division such that a robot in an adjacent division has to extend as little as possible into the initial division, thus minimizing the chances of collision or periods where an inchworm must wait for another inchworms to move.
\textbf{Reactive replanning.}
Once the inchworms have finished building or ferrying a division, the inchworms will disperse themselves again and repeat the process of either building or ferrying blocks. This minimizes the time the inchworms spend waiting for other inchworms to finish. The procedure of dividing a layer into divisions, dispersing the inchworms, and then building or ferrying blocks through the divisions is repeated for each layer in the structure until the entire structure is built.
\textbf{Achievable structures.}
Based off of the manner in which the planner performs construction, it is possible to characterize the types of buildings that can be built using our algorithm. Specifically, our algorithm can build any structure that does not present upside-down L-shape overhangs. This can be informally explained by noting that the building algorithm proceeds in a bottom-up (positive $z$ direction) manner, such that it will never remove a block from a layer below one that has already been built. Thus, our building algorithm is capable of building structures with overhangs, excluding those with overhangs that extend into the negative $z$ direction, characterized as an upside down L-shape. We wish to stress that this limitation concerns the building algorithm and not the hardware capabilities of the robots. Removing this algorithmic limitation is left as future work.
\subsection{Navigation}
In order to reach any given location on the structure, the inchworm robots must be capable of producing a traversable path to the given location.
\textbf{Face*.}
We developed a simple path planning algorithm, called \textit{Face*}, that takes advantage of the versatile mobility of the robots. Face* is an extension of the A* algorithm that considers the various legal motions of the inchworms, such as the fact that it can climb vertically and upside-down, while minimizing the amount of inching performed. The algorithm works by considering the faces of each block as nodes in a network, and using the Manhattan distance to each node as the cost associated with reaching that node. Analogously to the A* algorithm, Face* selects the node with the lowest associated cost. For each node, an inverse kinematics simulation is performed to ensure no collisions with the structure are possible. The collision detection analysis is only run three times for each node to simplify complexity: once when the robot has disengaged from the current node, once when the robot has moved above the goal node, and once when the robot has engaged with the goal node. If, at any point in this process, a node is unreachable or causes a collision, the node is removed and the next lowest cost node is considered. Only when a complete, collision-free, traversable path is created does the algorithm returns a successful path. The pseudocode of Face* is shown in Alg.\ \ref{face*}.
It is important to note that a path is only generated for the end effector closest to the goal, not for both end effectors. The second end effector does not require a separate path to be generated as it can follow in the footsteps of the first end effector. Also note that if an end effector is not engaged to the structure, Face* first considers if the already disengaged end effector is capable of reaching the given position. This allows the inchworm to swing in place like a fixed-base robot arm and reduce unnecessary inching.
\begin{figure}
\centering
\includegraphics[width=.7\columnwidth]{images/sequence_diagram_building_alg.pdf}
\caption{Sequence diagram of building algorithm for structure and N number of inchworms that is repeated for every layer within the given structure.}
\label{fig:sequence_diagram}
\end{figure}
\begin{algorithm}
\caption{Inchworm path planning for navigation}
\label{face*}
\begin{footnotesize}
\begin{algorithmic}[1]
\Procedure{Face*}{\textit{structure}, \textit{start}, \textit{goal}}
\State \textit{frontier} $\gets$ PriorityQueue((\textit{start}, 0))
\State \textit{cameFrom} $\gets$ $\{(None, 0)\}$
\While{\textbf{not} \textit{frontier}.empty()}
\State \textit{current} $\gets$ \textit{frontier}.get()
\If{\textit{current} == \textit{goal}}
\State \textbf{break}
\EndIf
\For{\textit{next} \textbf{in} \textit{structure}.neighbors(\textit{current})}
\State \textit{newCost} $\gets$ \textit{cameFrom}[\textit{current}[1] + \textit{structure}.cost(\textit{current}, \textit{next})
\If{\textit{next} \textbf{not in} \textit{cameFrom} \textbf{or} \textit{cameFrom}[1] \textless \textit{\textit{current}}[\textit{next}]}
\If{\textit{structure}.isReachableAndCollisionFree(\textit{next})}
\State \textit{cameFrom}[\textit{next}][1] $\gets$ (\textit{current}, \textit{newCost})
\State \textit{priority} $\gets$ \textit{newCost} + heuristic(\textit{goal}, \textit{next})
\State \textit{frontier}.put(\textit{next}, priority)
\EndIf
\EndIf
\EndFor
\EndWhile
\State \textbf{return} \textit{path}
\EndProcedure
\end{algorithmic}
\end{footnotesize}
\end{algorithm}
\section{EXPERIMENTAL EVALUATION}
\label{sec:experimental_evaluation}
To gauge the performance of our approach, we ran both simulated and real-world experiments.
\subsection{Simulated Experiments}
We developed a custom simulation environment to visualize and collect statistics of the system. The simulation environment was built using the Visualization Tool Kit (VTK).\footnote{\url{https://vtk.org/}} The experiments were run on a 2015 MacBook Pro.
\textbf{Metrics.} The performance metrics we considered for the simulated experiments are
\begin{inparaenum}[\it (i)]
\item whether the construction process succeeded; and
\item the speed at which the structure was constructed, measured in simulated time steps.
\end{inparaenum}
\textbf{Setup.}
We tested our approach with diverse structures including pyramids, temples, churches, castles, the Empire State Building, and the Star Trek Reliant ship, among others (see Fig.\ \ref{fig:simulated_buildings}). We compared the construction speed across different numbers of inchworms to investigate the effect of adding additional robots on construction time. In the simulation experiments, inchworms were randomly placed on a surface composed of smart blocks. The inchworms were then tasked with distributing themselves according to the distribution algorithm explained in Sec.\ \ref{sec:planning}. After the inchworms had distributed themselves, a virtual operator sets smart blocks down in a corner of the layer, designated as the feeding location. Prompted by the introduction of a new block into the system, the inchworms reacted by moving the blocks throughout the system as explained in Sec.\ \ref{sec:planning_navigation}. For all simulations, the inchworms were able to place all blocks as required.
\begin{figure}[t]
\centering
\includegraphics[width=.8\columnwidth]{images/Simulated_Buildings.png}
\caption{Examples of structures achievable by our system.}
\label{fig:simulated_buildings}
\end{figure}
\textbf{Scalability study.}
The results of two experiments are reported in Fig.\ \ref{fig:results_plane}. The experiments involve 1 to 4 robots tasked with building a $10 \times 10$ plane and a pyramid consisting of 316 blocks. As shown in Fig.\ \ref{fig:results_plane}, the time decreases with additional robots, especially when comparing a single robot and four robots. The results appear to follow a sublinear trend, which we approximated with a second-order polynomial curve.
\textbf{Task specialization.}
To analyze how the collaboration between inchworms affects performance, we recorded the total amount of time spent in each behavior by the inchworms. The main behaviors tracked were receiving updates from other robots and the structure (\textit{Update}), moving (\textit{Move}), waiting (\textit{Wait}), building (\textit{Build}), and ferrying (\textit{Ferry}). The results shown in Fig.\ \ref{fig:behavior_time} refer to the same structures considered in the scalability study. For the single inchworm experiment, the inchworm spends almost all its time either ferrying or building. Almost no time is spent waiting, and a very small portion of time is spent receiving updates. This is expected, as there are no other inchworms with which it must coordinate.
For the experiments with multiple robots, we observed that the time spent across the different behaviors is very heterogeneous. Although capable of exhibiting all the behaviors, the inchworms specialized themselves into different groups, in which some of the inchworms focus more on ferrying while others focus more on building. In particular, we observed that one inchworm did most of the ferrying, while the other inchworms mainly focused on the building. This task specialization is an interesting emergent property of our approach whose appearance depends on the type of structure to build. We also observed that the waiting time and the time spent receiving updates of all inchworms is much higher compared to the single inchworm experiment. This is expected, as by increasing the number of inchworms, maintaining coordination demands communication between the inchworms and the smart blocks. Samples of these tests are reported in the video at \url{https://youtu.be/zLDa8vK0HpM}.
\begin{figure}
\centering
\begin{subfigure}{.9\columnwidth}
\includegraphics[width=.9\columnwidth]{images/TimetoBuildPlane.pdf}
\label{fig:sub1}
\end{subfigure}
\begin{subfigure}{.9\columnwidth}
\includegraphics[width=.9\columnwidth]{images/TimetoBuildPyramid.pdf}
\label{fig:sub2}
\end{subfigure}
\caption{Time required to build structures for different numbers of inchworms.}
\label{fig:results_plane}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=.7\columnwidth]{images/experimental_behavior_times.pdf}
\caption{Time spent performing specific behaviors for different numbers of robots.}
\label{fig:behavior_time}
\end{figure}
\subsection{Real-world Experiments}
The goal of the real-world experiments was to validate the hardware, as well as to investigate whether some of the results found in the simulation would be consistent in the real world. We constructed one inchworm and five smart blocks.
\textbf{Unit testing.}
We performed a successful campaign of unit tests to validate the fundamental motions of the inchworm. We also tested the smart blocks to detect when new blocks were added or removed, or when a block went offline, which could be attributed to a fault, dead battery, or other physical error. The tests were all successful. Samples of these tests are reported in the video at \url{https://youtu.be/zLDa8vK0HpM}.
\textbf{Inching precision test.}
We validated the precision of the inchworm to estimate how often an inchworm may fail. The inchworm was made to take an inching step and retract 10 times. This experiment was also replicated while an inchworm was taking a step with a block. It was found that the inchworm was able to successfully step and grip 100\% of the time and step while carrying a block 80\% of the time. The results from the second test is attributed to the disturbance the block applies on the inchworm which can cause occasional inching errors.
\textbf{Inching and gripping test.}
We also tested the capability of our inchworm to take three steps on a plane while carrying a block. We estimated the inching speed to be 1 step every \unit[40]{s}. The majority of this time came from the grippers, with about \unit[20]{s} on average for engaging with the structure and about \unit[10]{s} for disengaging with the structure.
\textbf{Inchworm system test.}
A complete system-level test was also performed to demonstrate that the inchworm is able to inch, traverse a structure, manipulate a block, and place it on the structure. A series of snapshots from the demonstration are shown in Fig. \ref{fig:system_inch_test}, and the footage is available in the video at \url{https://youtu.be/zLDa8vK0HpM}.
\begin{figure}
\centering
\includegraphics[width=.9\columnwidth]{images/Inchworm_System_Unit_Test.png}
\caption{Robot inching and placing a block.}
\label{fig:system_inch_test}
\end{figure}
\textbf{Smart block communication.}
We performed a series of tests to validate that a new block is detected when it is added into the structure, and that the structure can detect when a block is removed from the structure. The images in Fig.\ \ref{fig:block_test} show that the blocks change the color of their LEDs to convey the change in the structure. Experimentally, the average time for two smart blocks to exchange a 62-byte package was \unit[500]{ms}, which corresponds to an average bit rate of \unit[992]{bit/s}. We also estimated the impact of a large structure on communication latency. The number of hops between any block and the home block is given by the Manhattan distance between them. A message originating from block at $(x,y,z)$ of a 3D structure must traverse $x+y+z$ blocks to reach a home block at $(0,0,0)$. To put this in perspective, a message sent by a block placed in the corner of a $10 \times 10 \times 10$ cube would take \unit[15]{s} to reach the opposite diagonal corner. This has important implications when building large structures, motivating the need for multiple home blocks to decrease this latency. We will study these aspects in future work.
\begin{figure}
\centering
\includegraphics[width=.9\columnwidth]{images/block_experiment.png}
\caption{
1) A block is added to the structure. 2) The top block turns green to indicate ``all OK.'' 3) The bottom block changes color to red after it detects an error in the top block, which has gone offline.}
\label{fig:block_test}
\end{figure}
\section{CONCLUSIONS AND FUTURE WORK}
\label{sec:conclusions}
This paper proposes SMAC\xspace, a robotic platform for collective construction composed of two types of robot:
\begin{inparaenum}[\it (i)]
\item a collection of smart blocks, forming an intelligent network capable of dynamic planning and monitoring; and
\item an inchworm-shaped, builder robot, able to navigate a 3D structure and deposit blocks under the guidance of the smart blocks.
\end{inparaenum}
We presented the hardware design of our platform, along with a set of simulated and real-world experiments aimed at showing its capabilities.
Our work is a step in the study of ``active'' stigmergy in multi-robot construction, a promising concept in which the structure being built is an active component of the process. This idea makes it possible to simplify the design of the builder robots. In addition, the smart blocks could be used as a form of \textit{smart scaffolding}. This would make it possible to reuse the same robotic platforms in multiple construction projects, thus paving the way for affordable, cost-effective construction in space applications and remote terrestrial environment.
Future work will concentrate on improving the capabilities of our robotic platforms and devising/studying novel planning algorithms to exploit the concept of active stigmergy in collective construction.
\section*{ACKNOWLEDGMENT}
We thank Prof.\ Raghvendra Cowlagi for guidance and fruitful conversations and Cameron Collins for his assistance in the manufacturing of the hardware of the platform.
| {'timestamp': '2020-10-19T02:20:26', 'yymm': '2010', 'arxiv_id': '2010.08473', 'language': 'en', 'url': 'https://arxiv.org/abs/2010.08473'} | arxiv |
\section{Related Works}
For a long time, researchers have been interested in Automatic Question Answering \cite{woods1977lunar} to build intelligent search engines and browse large-scale unstructured documents databases such as Wikipedia \cite{chen2017reading,ryu2014open,wang2017r,yang2019end,lee2018ranking}. This kind of system is often designed with several layers that successively select a smaller but more precise piece of text. It generally starts with a one-stage or a multiple-stage \textit{Information Retrieval} step (Ad-hoc retrieval) that identifies relevant documents for the question at hand. Then, an algorithm designed for \textit{eQA} is applied to identify the answer spans within the selected passages.
\subsection{Ad-hoc Retrieval}
Consider a user query that reflects a need for information. To look for relevant items within a large set of documents, web pages, the general approach consists in: (i) applying an encoding model to all documents, (ii) encoding the query as well, (iii) applying a ranker that produces a relevance score for each query-document pair based on their encodings, and finally (iv) sorting the documents accordingly \cite{manning2008introduction,mitra2018introduction,buttcher2016information}. For the encoding part, proposals go from vocabulary and frequency based strategies such as bag-of-words or TF-IDF \cite{baeza1999modern,hiemstra2000probabilistic}, to word2vec embeddings averaging \cite{mikolov2013distributed,ganguly2015word} to even strongly contextualized embeddings with Bert \cite{devlin2019bert,macavaney2019cedr,nogueira2019passage,yang2019simple}. For the relevance score part, the most popular choice is a fixed similarity/distance measure (cosine or Euclidean) but researchers have explored others strategies such as siamese networks \cite{das2016together}, histograms \cite{guo2016deep}, convolutional networks \cite{dai2018convolutional}, etc. In the recent litterature \cite{macavaney2019cedr}, several combinations between contextualized embedding techniques (Elmo and Bert) and rankers (DRMM, KNRM, PACRR) have been tried. By fine-tuning BERT for IR and exploiting the representation of its [CLS] token, the authors obtained state-of-the-art results on several reference IR benchmarks.
On another side, there is an old and proven IR baseline called BM25 \cite{robertson1995okapi}, a weighted similarity function based on TF-IDF statistics, which until today remains very competitive with neural methods \cite{lin2019neural}, and moreover is extremely fast and benefits from decades of fine engineering, for instance in its implementation in Lucene \cite{yang2018anserini,yang2017anserini,bialecki2012apache}.
\subsection{Extractive Question Answering}
The extractive Question Answering task consists in identifying a question's answer as a text span within a rather small passage. The most popular dataset for this task is the Stanford Question Answering Dataset (SQuAD) \cite{rajpurkar2016squad} which consists in more than a hundred thousand questions, each paired with a Wikipedia article paragraph. The state of art algorithms for this task are transformer-based language models such as Bert \cite{devlin2019bert} or Albert \cite{lan2019albert}. They are usually composed of an input embedding layer, followed by a succession of $l$ encoder blocs (which implement, in particular, a self-attention mechanism) and finally an output layer. On the eQA task, they take as input a text sequence that is the concatenation of the question and the associated passage. The whole sequence is tokenized and a special [CLS] (resp. [SEP]) token is added at the beginning (resp. between the question and the passage and at the end). Then, the associated features (token ids, segments, positions...) are fed to the model which predicts two probabilities for each token to be the beginning and the end of the answer span (Figure \ref{encoder_for_qa}).
\begin{figure}[t]
\centering
\includegraphics[width=0.87\columnwidth]{figures/encoder_architecture.pdf}
\caption{General architecture of transformer-based language models ($l$ blocs) designed for extractive Question Answering. Start logit (resp. end logit) refers to a relevance score predicted by the model for each token to be the beginning (resp. the end) of the answer.}
\label{encoder_for_qa}
\end{figure}
\subsection{Open Domain Question Answering}
Open Domain Question answering solutions generally combine a retriever that solves the Ad-hoc Retrieval task by selecting relevant documents and a reader that solves the extractive Question Answering task on the selected passages. An emblematic example is DrQA \cite{chen2017reading}, a bot developed at Facebook which is able to answer to questions by searching in the entire English Wikipedia in real-time. It consists in a TF-IDF + cosine retriever that selects 5 relevant documents followed by a multi-layer RNN reader \cite{chen2016thorough}. Later, other proposals were able to surpass its quality of answer with a paragraph reranker \cite{lee2018ranking,wang2017r} and then with a "minimal" retriever that selects small but relevant portions of text \cite{min2018efficient}. In the meantime, Bert was released and \citet{yang2019end} proposed a first successful usage for ODQA, by simply combining answerini/Lucene with a Bert base fine-tuned on SQuAD, which achieved the new state-of-the art performance on the reference benchmark OpenSQuAD \cite{chen2017reading}. Since then, a few proposals \cite{lee2019latent,feldman2019multi,wang2019multi, ren2020multi} have been focusing on better selection of passages and a better pooling of answers from them.
In all of these proposals, the scaling issue is always tackled from the retriever's perspective. Yet, the ODQA setting offers many opportunities to address it from the reader's side, which is the main motivation behind this work.
\section{Delaying Interaction Layers}
\label{sec:proposal}
In the ODQA setting, the set of documents is rather static. If $q$ questions are asked and there are $p$ documents in the database, without any retrieval step, transformer-based readers will consider all the $q\times p$ possible pairs, split them into fixed-length examples and run inference on them. Not only this is very costly but all computations are done interactively. More precisely, in the encoder layers, the attention mechanism makes the representation of the documents tokens dependent on the question tokens, so there is no possibility to pre-compute intermediate representations of the database's documents without knowing the question beforehand.
\paragraph{Key Idea}
To better face this setting, we consider a structural modification of existing models to allow reducing computations and make preprocessing possible. The key idea is to "delay" the interaction between question and paragraph so that a part of the computations can be done independently. Also, we limit ourselves to (i) changes that are not specific to a given model so that the proposal can be applied to a maximum of transformer-based language models and (ii) do not introduce new parameters so that we can benefit from existing pre-trained weights.
\paragraph{Algorithm and Variants}
We start by splitting the input between its two segments after the separator [SEP]. We apply the input layer and the first $k$ encoder blocs independently on both parts, then concatenate the two outputs and finally apply the last $l - k$ encoder blocs and the output layer (Figure \ref{dil_encoder_for_qa}). We refer to the first $k$ blocs as the non interaction layers and the last $l-k$ as the interaction layers. The impact of hyperparameter $k$ is studied in the experimental section.
\begin{figure}[t]
\centering
\includegraphics[width=0.97\columnwidth]{figures/dilbert_encodeer.pdf}
\caption{Structural change in the transformer-based architecture (see original one in Figure \ref{encoder_for_qa}): here the first $k$ non interaction layers/blocs are applied independently to question and paragraph and the last $l-k$ interaction layers are applied to the whole.}
\label{dil_encoder_for_qa}
\end{figure}
Several variants can be considered when fine-tuning a model with the delayed interaction framework: non interaction layers, applied to the question or to the paragraph, can either have the same weights or not; for specific cases such as Albert in which the $l$ blocs share their weights, the weights of the first $k$ blocs and the last $l-k$ blocs can either evolve independently or not. In the following, we will consider the variant that does not increase the number of weights as compared to the original model. Our proposal is implemented in Python and is based on original models' implementation from the \textit{transformers} python library, version 2.7.0 \cite{wolf2019huggingfaces}.
\paragraph{Complexity}
Delayed interaction reduces the complexity of the first $k$ blocs. Specifically, the self-attention mechanism requires a number of computations proportional to $n_s^2$ where $n_s$ is the input sequence length. $n_s$ can be decomposed into the sum of the question length $n_q$ (including the [CLS] and the first [SEP]) and the paragraph length $n_p$ (including the last [SEP]). Therefore, the complexity is reduced from $O(n_q^2 + n_p^2 + 2n_p\times n_q)$ to $O(n_q^2 + n_p^2)$.
Although it already makes a difference, this can be negligible especially when the paragraph length is much larger than the question length and when the hardware has a great parallelization power (e.g. a GPU). The big difference takes place in the ODQA setting. Let us consider that a single encoder bloc has a forward complexity of $C\times n_s^2$. Therefore, the whole encoder part in a transformer-based model has a complexity of $l\times C \times n_s^2$ to process a single example, and $l\times C \times q\times p\times n_s^2$ to process a set of $q$ questions and $p$ paragraphs (for the sake of simplicity, we assume here that paragraphs are cut such that question-paragraph pairs fit in the model input size $n_s$). With delayed interaction, the computations in the first $k$ blocs for each question (resp. paragraph) do not have to be redone for each paragraph (resp. question). Therefore, the complexity becomes $k \times C \times (q \times n_q^2 + p \times n_p^2) + (l-k) \times C \times q \times p \times n_s^2$. Even with $p$ and $q$ only of the order of $10^2$, the quadratic term with $p \times q$ largerly dominates. Also note that the paragraph processing in the first $k$ blocs (i.e. the term $k \times C \times p \times n_p^2$) can be done as an initialization step in the ODQA setting and does not need to be computed interactively at inference time when users ask questions. Therefore, delayed interaction entails a complexity decrease which roughly boils down to the ratio $\frac{l-k}{l}$ between the number of interaction layers in the Dil variant and the total number of layers in the original model.
\section{Experimental Study}
To assess the interest of delayed interaction, we run experiments on the reference Open Domain Question Answering challenge OpenSQuAD as \citet{yang2019end}, starting by the associated extractive Question Answering sub-task SQuAD v1.1 \cite{rajpurkar2016squad}.
We consider two language models as baselines. The first one is Bert since it is the most used\footnote{\url{https://huggingface.co/models}} and also the one with the largest set of different pre-trained weights. And, to test our framework in a challenging way, the second one is Albert because it has the specificity of using the same weights in all of its $l$ encoder blocs and this could have an unexpected impact on the mechanism that we explore. We refer to our variant as DilBert (resp. DilAlbert) which stands for "Delaying Interaction Layers" in Bert (resp. Albert).
We start by evaluating DilBert/DilAlbert on the eQA sub-task to know how delayed interaction impacts the predictive performance with respect to the hyperparameter $k$. Then, we analyze the GPU/CPU speedup and the performance in the ODQA setting.
\subsection{Extractive QA}
For the eQA task, we train Bert, DilBert, Albert and DilAlbert on the SQuaD v1.1 train set. We consider the base version of each model and, as a starting point, we consider the English pre-trained weights: \textit{bert-based-uncased} for Bert and DilBert and \textit{albert-base-v2} for Albert and DilAlbert.
The training (single run) is carried on with the \textit{run\_squad.py} script from the \textit{transformer} library using the default hyperparameters\footnote{\url{https://github.com/huggingface/transformers/tree/master/examples/question-answering}}: 2 epochs, an input sequence length $n_s$ of 384, a batch size of 12, and a learning rate of 3e-5. The models are then evaluated on the SQuAD v1.1 dev set using the two official metrics for the task (Exact Match and F1-score). For DilBert and DilAlbert, we make the hyperparameter $k$ vary from $0$ to $l-1$ and analyze how this impacts the performance (Figure \ref{evo_performance_dilbert} and \ref{evo_performance_dilalbert}).
\begin{figure}[t]
\centering
\includegraphics[width=0.87\columnwidth]{figures/Dilbert_vs_bert.pdf}
\caption{Evolution of DilBert's Exact Match (EM) and F1-score (F1) on the SQuAD v1.1 dev set with respect to the number of non interaction layers $k$. The performance of Bert is also displayed as a horizontal line.}.
\label{evo_performance_dilbert}
\end{figure}
\begin{figure}[t]
\centering
\includegraphics[width=0.87\columnwidth]{figures/DilAlbert_vs_Albert.pdf}
\caption{Evolution of DilAlbert's Exact Match (EM) and F1-score (F1) on the SQuAD v1.1 dev set with respect to number of non interaction layers $k$. The performance of Albert is also displayed as a horizontal line.}
\label{evo_performance_dilalbert}
\end{figure}
As a sanity check, we can observe that without delayed interaction ($k=0$), our implementation of DilBert (resp. DilAlbert) provides the same results as Bert (resp. Albert). Then, as $k$ increases, the performance remains very competitive and it only decreases significantly for $k=11=l-1$.
For $k=l$, there is no interaction anymore so start logits and end logits associated to paragraph tokens do not depend on the question and the performance dramatically drops to an exact match of around 13 (not reported in the Figure). We note a slight difference between the behavior of DilBert and DilAlbert. Whereas the latter seem to have a smooth evolution with respect to $k$, the former has two plateaus from $k=0$ to $k=4$ and from $k=5$ to $k=10$ and a decrease of performance in between. With inspiration from \citet{clark2019does}, our hypothesis is that since each bloc in Bert has its own set of weights, it could have been that the pre-trained attention heads in the $6^{th}$ layer had a component useful for the targeted eQA task.
We also add that completely removing $k$ layers in the original models provide results significantly lower than the proposed Dil variants with $k$ non interaction layers. For instance, a 2-layer Bert, trained with the same protocol, obtains an exact match of 26.4 and an F1-score of 36.2 on the SQuAD v1.1 dev set.
Experiments are all carried on SQuAD v1.1 because OpenSQuAD is based on it. Nevertheless, the variants also apply, to some extent, to SQuAD v2.0. For instance, Albert, DilAlbert$_{k=6}$ and DilAlbert$_{k=10}$ respectively obtain an F1-Score of 81.4, 80.3 and 72.4 on its dev set.
\subsection{Speedup}
To analyze the speedup entailed by delayed interaction, we consider a simple open domain question answering setting where $q = 100$ questions are asked and the RC model (e.g. Bert) searches for the answers in a database of $p = 100$ passages. We measure the total time required by Bert, Albert, DilBert and DilAlbert to process all question-paragraph pairs (Table \ref{time_consumption_encoder_dilencoder}). For the Dil variants, we detail the time required in the non interaction layers to do the independent processing on questions and paragraphs and in the interaction layers to do the dependent processing on question-paragraph pairs. We consider two values for the number of non interaction layers: $k=10$ because it allows preserving most of the eQA performance and $k=11$, the largest possible value here.
\begin{table*}[t]
\centering
\resizebox{.95\textwidth}{!}{
\begin{tabular}{cccccccc}
\toprule
& & Bert & DilBert$_{k=10}$ & DilBert$_{k=11}$ & AlBert & DilAlBert$_{k=10}$ & DilAlBert$_{k=11}$\\
\midrule
& NI Q & &1.0 (1e-3)&0.9 (8.2e-4)& &1.2 (1.2e-3)& 1.4 (1.3e-3)\\
GPU & NI P & &0.8 (8e-4)&1.1 (1e-3)& &1.0 (1.0e-3)& 1.1 (1.0e-3)\\
& I Q-P &117.9 (9.8e-4)&17.0 (8.5e-4)&9.9 (9.9e-4)&142.2 (1.2e-3)&22.4 (1.1e-3)& 13.1 (1.3e-3)\\
& Total &117.9&18.8 &11.9&142.2&24.6& 15.6 \\
& Speedup & x1 &x6.3&x9.9& x1 &x5.8& x9.1\\
\midrule
& NI Q && 3.5 (3.5e-3) & 3.9 (3.6e-3) & &4.1 (4.1e-3)& 4.8 (4.3e-3)\\
10-threads & NI P & & 12.0 (1.2e-2)& 13.34 (1.2e-2) & &16.7 (1.7e-2)& 17.6 (1.6e-2)\\
CPU & I Q-P &2602.6 (2.2e-2)&258.7 (1.3e-2) & 126.7 (1.3e-2) & 2597.6 (2.2e-2)&346.8 (1.7e-2)& 176.3 (1.7e-2)\\
&Total&2602.6&274.2&144.0&2597.6&367.7&198.7 \\
& Speedup & x1 & x9.5& x18.1 & x1 & x7,1 & x13.1 \\
\bottomrule
\end{tabular}
}\caption{Time consumption to search for the answer of 100 questions in 100 passages with Bert, Albert, DilBert and DilAlbert on GPU and on a 10-threads CPU. "NI Q" (resp. "NI P") refers to the time required to process the $q$ questions (resp the $p$ passages) in the Non Interaction layers, and "I Q-P" refers to time required to process the $p\times q$ pairs in the Interaction layers. We also report in brackets a time consumption normalized with respect to the number of blocs ($l$, $k$ or $l-k$) and inputs ($p$, $q$ or $p\times q$).}
\label{time_consumption_encoder_dilencoder}
\end{table*}
Experiments are carried on a bull server with a Nvidia Tesla V100 GPU and a 5-cores/10-threads Intel Xeon Gold 6132 (2.6-3.7 GHz) CPU.
The empirical results confirm the theoretical intuitions of the \textit{Complexity} paragraph. Firstly, since in-bloc computations are parallelizable and a GPU device has a great parallelization power, we can observe on GPU that the processing time per bloc per input sequence is approximately always the same (around 1e-3) whereas it depends more on the sequence length on CPU (around 4e-3 for the question with a length of $n_q \approx 16$ and 1.3e-2 for the question-paragraph concatenation with a length of $n_s = 384$). Secondly, in such an ODQA setting where the answers of multiple ($q$) questions will be searched in multiple paragraphs ($p$), computations that depend on couples of question-passage (i.e. in interaction blocs for Dil variants and in all blocs for original models) take most of the time because they are proportional to the number of pairs $p\times q$ which is largely superior to $p$ and $q$. Since original models have $l=12$ interaction layers and Dil variants only have $l-k$ ($1$ or $2$) interaction layers, it results that the speedup factor in the encoder entailed by delayed interaction tend to $\frac{l}{l-k}$ for a large number of questions and passages. We therefore empirically observe a speedup of around one order of magnitude for Dil variants in Table \ref{time_consumption_encoder_dilencoder}.
\subsection{Open Domain QA}
Apart from speedup, it is necessary to check whether delayed interaction has an impact on the quality of answers in Open Domain QA. Therefore, we finally focus here, as \citet{chen2017reading}, on the ODQA challenge referred to as OpenSQuAD. It consists in confronting algorithms to the task of answering to questions using the entire English Wikipedia\footnote{We consider a dump from December 2016 as proposed by \citet{chen2017reading}.}. More precisely, it considers the 10570 questions from the SQuAD v1.1 dev set but does not provide the associated paragraph containing the answer so the algorithms have to search in a larger set of 5,075,182 articles.
Since our proposal specifically focuses on the reader part of the classical retriever + reader ODQA pipeline, we mainly analyze its impact on the global performance. More precisely, for the remaining parts, we will arbitrarily choose a proven baseline approach from the literature as long as it relies on a transformer-based reader, and we will simply substitute the latter with the model that we want to evaluate. The baseline BertSerini \cite{yang2019end} is a good candidate framework for our experiment as it uses a robust retriever and Bert as a reader. Since its implementation is not available, we detail ours below (Figure \ref{odqa_pipeline}).
\paragraph{ODQA Pipeline}
We first apply a preprocessing step to properly index the Wikipedia dump with Lucene using the pyserini library, version 0.9.4.0 \cite{yang2017anserini,yang2018anserini}. As Wikipedia articles are rather long and sometimes cover multiple topics, they are difficult to process as such for both the retriever and the reader \cite{yang2019end,wang2017r,lee2018ranking}, so we start by splitting them into paragraphs. We consider two strategies:
\begin{itemize}
\item Using a double newline as a delimiter. We then discard all items with less than 30 characters leading to a number of paragraphs of around 29.1 millions approximately as in \cite{yang2019end}.
\item Using a fixed length of 100 words with a sliding window of 50 words as in \cite{wang2019multi}.
\end{itemize}
We obtain close end-to-end results with both techniques but retain the slightly better second strategy for the final pipeline. The splitted paragraphs are then processed with the pyserini script \textit{index}\footnote{\url{https://github.com/castorini/pyserini}} which outputs all the necessary inverted indices for retrieval.
\begin{figure}[t]
\centering
\includegraphics[width=0.95\columnwidth]{figures/ODQA_pipeline.pdf}
\caption{General architecture of the question answering pipeline used in our experiments.}
\label{odqa_pipeline}
\end{figure}
Once preprocessing is over, we can start making predictions. The retriever is a pyserini SimpleSearcher that relies on the computed inverted indices, and that uses BM25 (pyserini's default parameters) as a relevance score. For each question, it returns the $p$ paragraphs with the top score $s_{bm25}$. We choose $p=29$ and $p=100$ as in BertSerini. This retrieval step takes less than 0.15s on CPU with the hardware configuration described in the previous section. Then, the reader is applied to each paragraph and produces a start logit score $s_s$ and an end logit score $s_e$ for each token. To aggregate the results into a final prediction, we consider two variants: one that excludes the retriever score and selects the text span with the highest reader score $s_r = \frac{s_s + s_e}{2}$ across all paragraphs, and one that includes it by replacing $s_r$ with $\mu s_r + (1-\mu)s_{bm25}$ where $\mu$ is a hyperparameter between 0 and 1. A cross validation on a subset of the SQuAD v1.1 train set questions shows that, from 0.1 to 0.9 in steps of 0.1, the value of $\mu = 0.5$ leads to an optimal end-to-end performance for all considered readers. The latter are the trained models (Bert, DilBert$_{k=10}$, Albert and DilAlbert$_{k=10}$) from section \textit{eQA performance}. We add the multilingual version of Bert \cite{pires2019multilingual,devlin2019bert} as it is currently by far the most downloaded model from the Huggingface platform.
\paragraph{Results}
We evaluate the ODQA pipeline with the exact match (EM) and the F1-score (F1) between the text predicted from the Wikipedia dump and the expected answer. Obviously, the task here is more difficult than eQA since the paragraph containing the answer is not provided, so the performance is excepted to be lower than in Figure \ref{evo_performance_dilbert} and \ref{evo_performance_dilalbert}. Not only the IR part will select $p$ paragraphs that might not contain the answer, but additional difficulties that we discuss in the next section emerge when the search space is large and diverse. To give an idea of the impact of the retriever part on the end-to-end result, we compute the percentage of questions for which the expected answer at least appears in the $p$ selected paragraphs (column $R$ in Table \ref{table:main}). Since the paragraph splitting methodology and the version of pyserini were not detailed by \citet{yang2019end} we were only able to obtain the same IR performance as Bertserini for $p = 29$ but we obtained a lower $R$ for $p=100$.
\begin{table}[t]
\centering\resizebox{\columnwidth}{!}{
\begin{tabular}{lccccc}
\toprule
Model & \multicolumn{2}{c}{EM} & \multicolumn{2}{c}{F1} & R \\
& w/o & w/ & w/o & w/ & \\
\midrule
DrQA \cite{chen2017reading} & 27.1 & - & - & - & 77.8 \\
$R^3$ \cite{wang2017r} & - &29.1 & - & 37.5 & - \\
Par. R. \cite{lee2018ranking} & - & 28.5 & - & - & 83.1 \\
\textsc{Minimal}~\cite{min2018efficient} & - & 34.7 & - & 42.5 & 64.0 \\
\midrule
\citet{yang2019end}: & & & \\
Bertserini ($p=29$) & - & 36.6 & - & 44.0 & 75.0 \\
Bertserini ($p=100$) & - & 38.6 & - & 46.1 & 85.8 \\
\midrule
Ours: & & & \\
Bert ($p=29$) & 37.4 & 43.5 & 44.1 & 50.9 & 74.6 \\
DilBert ($p=29$) & 38.8 & 42.0 & 46.7 & 50.4 & 74.6 \\
\cmidrule{2-6}
Bert ($p=100$) & 31.8 & 44.3 & 38.0 & 51.8 & 82.4 \\
DilBert ($p=100$) & 36.5 & 43.2 & 43.8 & 51.6 & 82.4 \\
\cmidrule{2-6}
mBert ($p=29$) & 34.4 & 41.9 & 40.6 & 49.1 & 74.6 \\
DilmBert ($p=29$) & 38.5 & 42.8 & 45.8 & 50.5 & 74.6 \\
\cmidrule{2-6}
mBert ($p=100$) & 28.3 & 42.3 & 34.1 & 49.3 & 82.4 \\
DilmBert ($p=100$) & 34.7 & 43.8 & 41.7 & 51.6 & 82.4 \\
\cmidrule{2-6}
Albert ($p=29$) & 40.6 & 44.1 & 47.0 & 51.3 & 74.6 \\
DilAlbert ($p=29$) & 39.7 & 43.6 & 47.7 & 51.8 & 74.6 \\
\cmidrule{2-6}
Albert ($p=100$) & 36.2 & 44.9 & 42.1 & 52.1 & 82.4 \\
DilAlbert ($p=100$) & 36.8 & 44.8 & 43.8 & 52.9 & 82.4 \\
\bottomrule
\end{tabular}}
\caption{End-to-end performance (EM, F1) of our ODQA pipeline with several models as readers (Bert, DilBert, multilingual Bert or mBert, DilmBert, Albert and DilAlbert). Results when excluding the IR score (w/o) and when including it (w/) are detailed. Previous results from the literature are also reported above.}
\label{table:main}
\end{table}
The final end-to-end ODQA results exhibit interesting properties (columns EM/F1 in Table \ref{table:main}). First we can notice that, although the variants with delayed interaction were a little worse than original models on the eQA task (e.g. Figure \ref{evo_performance_dilbert}), they almost always outperform them for ODQA when the IR score is not used, and sometimes by a significant margin (e.g. when there is a high number of candidate paragraphs $p$). When exploiting the IR score, the conclusion are more mixed. A potential explanation is that delayed interaction acts like a sort of regularization similarly to dropout \cite{srivastava2014dropout}, in the sense that the resulting architecture is the same as the original one except that some connections are removed in the first $k$ blocs. Therefore, the proposed variants are more prone to generalization and produce less noisy predictions from passages with a low IR relevance score, whereas original models tend to do so \cite{yang2019end,xie2020distant}. Using the IR score, all models are able to focus on their predictions from the most relevant passages which helps improving the overall performance. In this case, original models manage to catch up with delayed interaction variants.
The results with the multilingual weights are slightly worse than with the English ones, but mostly for the Bert model. In fact, the variant DilmBert is always better than the original mBert. As for the results with Albert, they are close to those of Bert but a little better in general.
\begin{table*}[t]
\centering\resizebox{\textwidth}{!}{
\begin{tabular}{ccc}
\toprule
Question & Expected Answer & Predicted Answer \\
\midrule
When did Zwilling and Karistadt become active at Wittenberg? & June 1521 & mid-1521 \\
The Los Angeles Angels of Anaheim are from which sport? & MLB & Major League Baseball \\
How many fumbles did Von Miller force in Super Bowl 50? & 2 & two \\
What is the AFC short for? & American Football Conference & Asian Football Confederation \\
How many graduate students does Harvard have? & 14000 & 15000 \\
What position did Newton play during Super Bowl 50? & quarterback & QB \\
\bottomrule
\end{tabular}}
\caption{Examples of questions, expected answers, and answers predicted by an ODQA pipeline on OpenSQuAD.}
\label{table:odqa_example}
\end{table*}
On a final side note, the best performance (EM: 44.3, F1: 51.8) obtained in this study with a Bert Base English uncased, simply fine-tuned for the eQA task on SQuAD v1.1 and combined with BM25, is significantly better than that of Bertserini while the latter uses the same building blocks, and have a higher IR score (R). This improvement is mainly due to engineering (documents splitting, Lucene's version), and it does not surprise us as a similar observation was made in the recent \cite{xie2020distant} which reports updated higher results for BertSerini (EM: 41.8, F1: 49.5, R: 86.3).
Our update (EM:44.3, F1:51.8) continues to bring an accessible baseline BM25 + Bert Base closer to the state-of-the-art results on OpenSQuAD which, to the best of our knowledge, are achieved by Multi-Passage Bert (EM:51.2, F1:59.0). The latter exploits additional mechanisms to improve the results: a Bert-based reranker for the IR part, and a global normalization process, for the predictions of the reader, specifically trained in a multi-passage setting.
\section{Discussion}
Our study shows that interesting opportunities arise when tackling Open Domain Question Answering from the angle of the reader's architecture. Our initial objective was to exploit specificities in the nature of the ODQA problem to reduce computations. The complexity of algorithms is a major industrial and societal issue in today's research as it controls the efficiency of systems in production but also their carbon footprint \cite{thakur2016towards}. As shown in Table \ref{time_consumption_encoder_dilencoder}, the proposed variants, with $k=10$ allow to reduce the number of interaction blocs from $12$ to $2$ in the widely spread Bert and Albert, which entails a 85\% (6x) speedup in the ODQA setting. The approach is generic: it can be applied to several transformer-based architectures, and still benefit from their available sets of model weights (e.g. English uncased, multilingual) to avoid the costly pre-training. It is also compatible with standard retriever + reader ODQA pipeline in several ways. We considered in this work a framework where a transformer-based model is used as the reader part because it is the case for the entirety of recent ODQA proposals. In some of them, the retriever/reranker is also based on a language model \cite{wang2019multi}, so delayed interaction could be applied to this part of the pipeline as well.
In addition to having achieved our initial speedup objective, the proposed variants have also proven to be highly competitive in terms of quality of answer for Open Domain Question Answering. In particular, they can outperform original models when it comes to search for the answer in a large variety of passages. This could be a matter of generalization. The SQuAD v1.1 dataset is based on a few hundreds of Wikipedia articles, hence the measured eQA performance on the dev set can be partly due to overspecialization on a few topics \cite{xie2020distant}. The regularization entailed by delayed interaction reduces the performance for the most relevant passage (Figure \ref{evo_performance_dilbert} and \ref{evo_performance_dilalbert}) but makes up for it by reducing unexpected behaviour on irrelevant passages (Table \ref{table:main}). Solutions to help on that issue with Bert have been recently explored \cite{wang2019multi,xie2020distant} and they consist in using global normalization or distant supervision with irrelevant passages during training to make the model more robust to a multiple passage setting. These interesting ideas allow a significant improvement of the performance and they do not exclude the possibility of using DilBert instead of Bert, at least to benefit from its speedup.
One last important point to mention is the current absolute state-of-the-art results on the ODQA dataset OpenSQuAD. Although they appear low (especially in comparison with the eQA setting), they can be explained by challenges and biases in the OpenSQuAD dataset and the associated metrics. Apart from the IR bottleneck that entails a 15\%-18\% unavoidable loss for the reader, there are questions from the SQuAD v1.1 dev set that (see Table \ref{table:odqa_example}):
\begin{enumerate}
\item simply become unanswerable in OpenSQuAD because of their ambiguity. For instance, the question "What is the AFC short for?" needs to be associated to a specific paragraph to have a specific meaning.
\item have several valid answers, located in multiple paragraphs and under different forms. It mostly affects the exact match but sometimes the F1-score is also penalized: for instance, for the question "What position did Newton play during Super Bowl 50?", although the model finds the correct answer "QB", its recall is really low because it is expected to predict "quarterback".
\end{enumerate}
\section{Conclusion}
In this work we used a Delayed Interaction mechanism in transformer-based RC models which allowed a performance improvement and a speedup of up to an order of magnitude. It is rather generic and can benefit from existing resources (architectures, pre-trained weights). \textit{A posteriori}, we could establish a connection with very recent proposals such as Big Bird \cite{zaheer2020big} and more generally, with a global strategy of restricted/partial attention which tends to develop in current research trends. Our study allows to show the effectiveness of partial attention for ODQA but there remains many paths to explore. One of them is to improve the training by (i) introducing non interaction layers in the pre-training task and (ii) following the ideas of \citet{xie2020distant,wang2019multi} for a multi-passage fine-tuning. Another interesting direction is to address the memory management issue in the ODQA problem. In particular, storing pre-computed representations of documents for either IR or eQA can become costly for large scale databases, and it could be interesting to explore the impact of compressing them with sparsification \cite{sun2016sparse} or binarization \cite{tissier2019near} for instance.
| {'timestamp': '2020-10-19T02:18:32', 'yymm': '2010', 'arxiv_id': '2010.08422', 'language': 'en', 'url': 'https://arxiv.org/abs/2010.08422'} | arxiv |
\subsection{Traditional Syntax} \label{sec:BI_trad}
The logic BI has a well-studied metatheory admitting familiar categorical, algebraic, and truth-functional semantics which have the expected dualities~\cite{Pym2004resource,Galmiche05,Pym02,Docherty19,Pym19} .
In practice, it is the free combination (or, more precisely, the fibration \cite{Gabbay1998,Pym02}) of intuitionistic logic (IL) and the multiplicative fragment of intuitionistic linear logic (MILL), which imposes the presence of two distinct context-formers in its sequent presentation. That is to say, the two conjunctions $\land$ and $*$ are represented at the meta-level by context-formers $;$ and $,$ in place of the usual commas for IL and MILL respectively.
\begin{definition}[Formula]
Let \emph{\textsf{P}} be a denumerable set of propositional letters. The \emph{formulas} of BI, denoted by small Greek letters ($\phi, \psi, \chi, \ldots$), are defined by the following grammar, where $A \in \emph{\textsf{P}}$,
$$\phi ::= \top \mid \bot \mid \i \mid A \mid (\phi \land \phi) \mid ( \phi \lor \phi ) \mid (\phi \to \phi) \mid (\phi * \phi) \mid (\phi \wand \phi) $$
If $\circ \in \{ \land, \lor, \to, \top \}$ then it is an additive connective and if $\circ \in \{ *, \wand, \i \}$ then it is a multiplicative connective. The set of all formulas is denoted $\Formulas$.
\end{definition}
\begin{definition}[Bunch]
A \emph{bunch} is constructed from the following grammar, where $\phi \in \Formulas$,
$$\Delta ::= \phi \mid \emptyset_+ \mid \emptyset_\times \mid (\Delta ; \Delta) \mid (\Delta , \Delta)$$
The symbols $\emptyset_+$ and $\emptyset_\times$ are the additive and multiplicative units respectively, and the symbols $;$ and $,$ are the additive and multiplicative context-formers respectively. A bunch is \emph{basic} if it is a formula, $\emptyset_+$, or $\emptyset_{\times}$ and \emph{complex} otherwise. The set of all bunches is denoted $\B$, the set of complex bunches with additive root context-former by $\B^+$, and the set of complex bunches with multiplicative root context-former by $\B^\times$.
\end{definition}
For two bunches $\Delta, \Delta' \in \B$ if $\Delta'$ is a sub-tree of $\Delta$, it is called a \emph{sub-bunch}.
We may use the standard notation $\Delta(\Delta')$ (despite its slight inpracticality) to denote that $\Delta'$ is a sub-bunch of $\Delta$, in which case $\Delta(\Delta'')$ is the result of replacing the occurrence of $\Delta'$ by $\Delta''$.
If $\delta$ is a sub-bunch of $\Delta$, then the context-former $\circ$ is said to be its principal context-former in $\Delta(\Delta' \circ \delta)$ (and $\Delta(\delta \circ \Delta')$).
\begin{example}\label{ex:abunch} Let $\phi$, $\psi$ and $\chi$ be formulas, and let $\Delta = (\phi,(\chi;\emptyset_+));(\psi;(\psi;\emptyset_\times))$. The bunch may be written for example as $\Delta(\phi,(\chi;\emptyset_+))$ which means that we can have $\Delta(\phi;\phi)=(\phi;\phi);(\psi;(\psi;\emptyset_\times))$.
\end{example}
\begin{definition}[Bunched Sequent]
A bunched sequent is a pair of a bunch $\Delta$, called the context, and a formula $\phi$, denoted $\Delta \seq \phi$.
\end{definition}
Bunches are intended to be considered up-to \emph{coherent equivalence} $(\equiv)$.
It is the least relation satisfying:
\begin{itemize}
\item Commutative monoid equations for $;$ with unit $\emptyset_+$,
\item Commutative monoid equations for $,$ with unit $\emptyset_{\times}$,
\item Congruence: if $\Delta'\equiv\Delta'' $ then $\Delta(\Delta') \equiv \Delta(\Delta'')$.
\end{itemize}
It will be useful to have a measure on sub-bunches which can identify their distance from the root node.
\begin{definition}[Rank]
If $\Delta'$ is a sub-bunch of $\Delta$, then $\rho(\Delta')$ is the number of alternations of additive and multiplicative context-formers between the principal context-former of $\Delta'$, and the root context-former of $\Delta$.
\end{definition}
Let $\Delta$ be a complex bunch, we use $\Delta' \in \Delta$ to denote that $\Delta'$ is a (proper) top-most sub-bunch; that is, $\Delta$ is a sub-bunch satisfying $\Delta \neq \Delta'$ but $\rho(\Delta') = 0$.
\begin{example} Let $\Delta$ be as in Example \ref{ex:abunch}, then $\rho(\emptyset_+)=2$ whereas $\rho(\emptyset_\times)=0$;
hence, $\psi$, $\emptyset_{\times}$ and $(\phi,(\chi, \emptyset_{\times})) \in\Delta$. Consider the parse-tree of $\Delta$:
\[
\xymatrix@R=2mm@C=2mm{
& & & ; \ar@{-}[dll] \ar@{-}[dr] & & &\\
& ,\ar@{-}[dl] \ar@{-}[dr] & & & ; \ar@{-}[dl] \ar@{-}[dr] & &\\
\phi & & ; \ar@{-}[dl] \ar@{-}[dr] & \psi & & ; \ar@{-}[dl] \ar@{-}[dr]&\\
&\chi & & \emptyset_+ & \psi & & \emptyset_{\times}
}
\]
Reading upward from $\emptyset_+$ one encounters first $;$ which changes into $,$ and then back to $;$ so the rank is $2$; whereas counting up from $\emptyset_\times$ one only encounters $;$ so the rank is $0$.
\end{example}
\subsection{Sequent Calculus} \label{sec:BI_calc}
The proof theory of BI is well-developed including familiar Hilbert, natural deduction, sequent calculi, tableaux systems, and display calculi ~\cite{Pym02,Galmiche05,Brotherston10a}. In the foregoing we restrict attention to the sequent calculus as it more amenable to studying proof-search as computation, having local correctness while enjoying the completeness of analytic proofs.
\begin{definition}[System $\lbi$]
The bunched sequent calculus $\lbi$ is composed of the rules in Figure \ref{fig:lbi}.
\end{definition}
The classification of $\land$ as additive may seem dubious upon reading the $\rrn\land$ rule, but the designation arises from the use of the structural rules; that is, the $\rrn\land$ and $\rrn\to$ rules may be replaced by \emph{additive} variants without loss of generality. The presentation in Figure \ref{fig:lbi} is as in \cite{Pym02} and simply highlights the nature of the additive and multiplicative context-formers. Nonetheless, the choice of rule does affect proof-search behaviours, and the consequences are discussed in more detailed in Section \ref{sec:foc_pol}.
\LBI
\begin{lemma}[Cut-elimination]\label{lem:LBI-cutelim}
If $\phi$ has a $\lbi$-proof, then it has a $\cut$-free $\lbi$-proof, i.e., a proof with no occurence of the $\cut$ rule.
\end{lemma}
Throughout, unless specified otherwise, we take proof to mean $\cut$-free proof. Moreover, if $\mathsf{L}$ is a sequent calculus we use $\vdash_\mathsf{L }\Delta \seq \phi$ to denote that there is an $\mathsf{L}$-proof of $\Delta \seq \phi$. Further, if $\mathsf{R}$ is a rule, then we may denote $\mathsf{L+R}$ to denote the sequent calculus combining the rules of $\mathsf{L}$ with $\mathsf{R}$.
The following result, that a generalised version of the axiom is derivable in $\lbi$, will allow for such sequents to be used in proof-construction later on.
\begin{lemma}\label{lem:formulaAx}
For any formula $\phi$, $\vdash_{\lbi} \phi \seq \phi$.
\end{lemma}
\begin{proof}
Follows from induction on size of $\phi$.
\qed \end{proof}
The remainder of this section is the meta-theory required to control the structural rules, which pose the main issue to the study of proof-search in BI.
\begin{lemma}\label{lem:weakelim}
The following rules are derivable in $\lbi$, and replacing $\weak$ with them does not affect the completeness of the system.
$$
\infer[\rn{Ax'}]{\Delta;A \seq A}{}
\quad
\infer[\rrn{{\i}'}]{\Delta;\emptyset_\times \seq \i}{}
\quad
\infer[\rrn{\top'}]{\Delta;\emptyset_+ \seq \top}{}
$$
$$
\infer[\rrn{\ast'}]{(\Delta,\Delta');\Delta'' \seq \phi*\psi }{\Delta \seq \phi & \Delta' \seq \psi}
\quad
\infer[\lrn{\wand'}]{\Delta(\Delta',\Delta'',(\Delta''';\phi \wand \psi)) \seq \chi }{\Delta' \seq \phi & \Delta(\Delta'', \psi) \seq \chi}
$$
\end{lemma}
\begin{proof}
We can construct in $\lbi$ derivations with the same premisses and conclusion as these rules by use of the structural rules. Let $\lbi'$ be $\lbi$ without $\weak$ but with these new rules (retaining also $\rrn\ast,\lrn\wand,\rrn\i,\rrn\top,$ and $\rn{Ax}$), then $\weak$ is admissible in $\lbi'$ using standard permutation argument.\qed \end{proof}
One may regard the above modification to $\lbi$ as forming a new calculus, but since all the new rules are derivable it is really a restriction of the calculus, in the sense that all proofs in the new system have equivalent proofs in $\lbi$ differing only by explicitly including instances of weakening.
\subsection{Nested Calculus} \label{sec:BI_nests}
Originally, sequents in the calculi for classical and intuitionistic logics (\textsf{LK} and \textsf{LJ}, respectively) were introduced as lists, and a formal \emph{exchange} rule was required to permute elements when needed for a logical rule to be applied~\cite{Gentzen1969}. However, in practice, the exchange rule is often suppressed, and contexts are simply presented as multisets of formulas. This reduces the number of steps/choices being made during proof-search without increasing the complexity of the underlying data structure. Bunches have considerably more structure than lists, but a quotient with respect to coherent equivalence can be made resulting in two-sorted nested multisets; this was first suggested in \cite{Donnelly05}, though never formally realised.
\begin{definition}[Two-sorted Nest]
Nests $(\Gamma)$ are formulas or multisets, ascribed either additive $(\Sigma)$, or multiplicative $(\Pi)$ kind, containing nests of the opposite kind:
\begin{align*}
\Gamma := \Sigma \mid \Pi \qquad \Sigma := \phi \mid \{\Pi_1,...,\Pi_n\}_+ \qquad \Pi := \phi \mid \{\Sigma_1,...,\Sigma_n\}_\times
\end{align*}
The constructors are multiset constructors which may be empty in which case the nests are denoted $\varnothing_+$ and $\varnothing_\times$ respectively. No multiset is a singleton; and the set of all nests is denoted $\nests$.
\end{definition}
Given nests $\Lambda$ and $\Gamma$, we write $\Lambda \in \Gamma$ to denote either that $\Lambda =\Gamma$, if $\Gamma$ is a formula, or that $\Lambda$ is an element of the multiset $\Gamma$ otherwise. Furthermore, we write $\Lambda \subseteq \Gamma$ to denote $\forall \gamma \in \nests$ if $\gamma \in \Lambda$ then $\gamma \in \Gamma$.
We will depart from the standard, yet impractical subbunch notation, and adopt a context notation for nests instead.
We write $\Gamma\{\cdot\}_+$ (resp. $\Gamma\{\cdot\}_\times$) for a nest with a hole within one of its additive (resp. multiplicative) multisets
The notation $\Gamma\{\Lambda\}_+$ (resp. $\Gamma\{\Lambda\}_\times$), denotes that $\Lambda$ is a sub-nest of $\Gamma$ of additive (resp. multiplicative) kind; we may use $\Gamma\{\Lambda\}$ when the kind is not specified. In either case $\Gamma\{\Lambda'\}$ denotes the substitution of $\Lambda$ for $\Lambda'$. A promotion in the syntax tree may be required after a substitution either to handle a singleton or an improper alternation of constructor types.
\begin{example}\label{ex:nests} The following inclusions are valid,
\[
\{\phi \,, \chi \, \}_\times \in \Big \{ \, \{\phi \,, \chi \, \}_\times , \psi \Big \}_+ \subseteq \Big\{ \, \{\phi \,, \chi \, \}_\times , \psi \,, \psi \,, \emptyset_\times \, \Big\}_+ = \Gamma\{\{\phi \,, \chi \, \}_\times\}_+
\]
It follow that $\Gamma\{\{\phi\,,\phi\}_+\}_+ = \{ \, \phi \,, \phi \,, \psi \,, \psi \,, \emptyset_\times \, \}_+$. Note the absence of the $\{ \cdot \}_+$ constructor after substitution, this is due to a promotion in the syntax tree to avoid having two nested additive constructors. Similarly, since $\emptyset_\times$ denotes the empty multiset of multiplicative kind, substituting $\chi$ with it gives $\{ \phi , \psi \,, \psi \,, \emptyset_\times \, \}_+ $; that is, first the improper $\{\phi, \emptyset_\times\}_\times$ becomes $\{\phi\}_\times$; then, the resulting singleton $\{\phi\}_\times$ is promoted to $\phi$.
\end{example}
Typically we will only be interested in fragments of sub-nests so we have the following abuse of notation, where $\circ \in \{+,\times\}$:
\[\Gamma\{\{\Pi_1,...,\Pi_i\}_\circ, \Pi_{i+1},..,\Pi_n\}_\circ := \Gamma\{\Pi_1,...,\Pi_n\}_\circ \]
The notion of rank has a natural analogue in this setting.
\begin{definition}[Depth, Rank]
Let $\circ \in \{+\,,\times\}$ be a nest, we define the depth on $\B$ as follows:
$$
\delta(\phi) := 0 \qquad \delta(\{\Gamma_1,...,\Gamma_n\}_\circ) := \max\{\delta(\Gamma_1),...,\delta(\Gamma_n)\}+1 $$
\end{definition}
The equivalence of the two presentations, bunches and nests, follows from a moral (in the sense that bunches are intended to be considered modulo congruence) inverse between a \emph{nestifying} function $\eta$ and a \emph{bunching} function $\beta$. The transformation $\beta$ is simply going from a tree with arbitrary branching to a binary one, and $\eta$ is the reverse.
\begin{definition}[Canonical Translation]
The canonical translation $\nestify:\B \to \nests$ is defined recursively as follows,
$$
\nestify(\Delta) :=
\begin{cases}
\Delta & \text{if } \Delta \in \Formulas \cup \{\emptyset_+,\emptyset_\times\} \\
\{\nestify(\Delta') \in \nests \mid \rho(\Delta')=1 \text{ and } \Delta' \in \B^\times \}_+ & \text{if } \Delta \in \B^+ \\
\{\nestify(\Delta') \in \nests \mid \rho(\Delta')=1 \text{ and } \Delta' \in \B^+ \}_\times & \text{if } \Delta \in \B^\times
\end{cases}
$$
The canonical translation $\bunch:\nests \to \B$ is defined recursively as follows,
$$
\bunch(\Gamma) :=
\begin{cases}
\Gamma & \text{ if } \Gamma \in \Formulas \cup \{\emptyset_+, \emptyset_\times\} \\
\bunch(\Pi_1);(\bunch(\Pi_2);...) & \text{ if } \Gamma = \{\Pi_1, \Pi_2,...\}_+ \\
\bunch(\Sigma_1),(\bunch(\Sigma_2),...) & \text{ if } \Gamma = \{\Sigma_1, \Sigma_2,...\}_\times
\end{cases}
$$
\end{definition}
\begin{example} Applying $\eta$ to the bunch in Example \ref{ex:abunch} gives the nest in Example~\ref{ex:nests}:
$$
\xymatrix@R=2mm@C=2mm{
& & & + \ar@{-}[dll] \ar@{-}[dl] \ar@{-}[dr] \ar@{-}[drr] & & \\
&\times \ar@{-}[dl] \ar@{-}[dr] &\psi& & \psi& \emptyset_\times \\
\psi& &\chi & & &
}
$$
\end{example}
\begin{lemma} \label{lem:transinverse}
The translations are inverses up-to congruence; that is,
\begin{enumerate}
\item if $\Delta \in \B$ then $(\bunch \circ \eta)(\Delta) \equiv \Delta$;
\item if $\Gamma \in \nests$ then $(\nestify \circ \bunch)(\Gamma) \equiv \Gamma$;
\item let $\Delta, \Delta' \in \B$, then $\Delta \equiv \Delta'$ if and only if $\nestify(\Delta) = \nestify(\Delta')$.
\end{enumerate}
\end{lemma}
\begin{proof}
The first two statements follow by induction on the depth (either for bunches or nests), where one must take care to consider the case of a context consisting entirely of units. The third statement employs the first in the forward direction, and proceeds by induction on depth in the reverse direction.
\qed \end{proof}
\begin{definition}[System $\eta\lbi$]
The nested sequent calculus $\eta\lbi$ is composed of the rules in Figure~\ref{fig:taulbi}, where the metavariables denote possibly empty nests.
\end{definition}
Observe the use of metavariable $\Gamma'$ instead of $\Pi$ (resp. $\Sigma$) as sub-contexts in Figure~\ref{fig:taulbi}. This allows classes of inferences such as
\[
\infer[\rrn\ast]{\{\Sigma_0,...,\Sigma_n \}_\times \seq \phi *\psi}{
\{\Sigma_0,...,\Sigma_i\}_\times \seq \phi
&
\{\Sigma_{i+1},...,\Sigma_n \}_\times \seq \phi
}
\]
to be captured by a single figure. In practice it implements the abuse of notation given above: $$\{\{\Sigma_0,...,\Sigma_i\}_\times, \{\Sigma_{i+1},...,\Sigma_n\}_\times \}_\times \seq \phi *\psi$$
\etalbi
This system is a new and very convenient presentation of $\lbi$, not \emph{per se} a development of the proof theory for the logic.
\begin{lemma}[Soundness and Completeness of $\nestify \lbi$] \label{lem:etalbi}
Systems $\lbi$ and $\eta\lbi$ are equivalent:
\begin{enumerate}
\item[] Soundness: If $\vdash_{\eta\lbi} \Gamma \seq \phi$ then $\vdash_{\lbi} \beta(\Gamma) \seq \phi$;
\item[] Completeness: If $\vdash_{\lbi} \Delta \seq \phi$ then $\vdash_{\eta\lbi} \nestify(\Delta) \seq \phi$.
\end{enumerate}
\end{lemma}
\begin{proof}
Each claim follows by induction on the context, appealing to Lemma \ref{lem:transinverse} to organise the data structure for the induction hypothesis, without loss of generality.
\end{proof}
\begin{example}\label{ex:nestedproof}
The following is a proof in $\eta \lbi$.
\[\scalebox{.9}{$
\infer[\rrn\wand]{\emptyset_\times \seq (A * (B \land C)) \wand ((A * B)\land (A * C))}{
\infer[\lrn\ast]{A * (B \land C) \seq (A * B)\land (A * C)}{
\infer[\rrn\land]{\{A , (B \land C) \}_\times \seq (A * B)\land (A * C)}{
\infer[\lrn\land]{\{A , (B \land C) \}_\times \seq A * B}{
\infer[\rrn\ast]{\{A , \{B , C\}_+ \}_\times \seq A * B}{
\infer[\rn{Ax}]{A \seq A}{}
&
\infer[\rn{Ax}]{\{B, C\}_+ \seq B }{}
}
}
&
\infer[\rrn\ast]{\{A , (B \land C) \}_\times \seq A * C}{
\infer[\rn{Ax}]{A \seq A}{}
&
\infer[\lrn\land]{B\land C \seq C}{
\infer[\rn{Ax}]{\{B, C\}_+ \seq C}{}
}
}
}
}
}
$}\]
\end{example}
We expect no obvious difficulty in studying focused proof-search with bunches instead of nested multisets; the design choice is simply to reduce the complexity of the argument by pushing all uses of exchange (\rn{E}) to Lemma~\ref{lem:etalbi}, rather than tackle it at the same time as focusing itself. In particular, working without the nested system would mean working with a weaker notion of focusing since the exchange rule must then be permissible during both focused and unfocused phases of reduction.
\section{Introduction}
\input{introduction}
\section{Re-presentations of BI} \label{sec:BI}
\input{background}
\section{A Focused System} \label{sec:foc}
\input{focusedsystem}
\section{Conclusion}\label{sec:conclusion}
\input{conclusion}
\bibliographystyle{splncs04}
\subsection{Polarisation} \label{sec:foc_pol}
Polarity in the focusing principle is determined by the invariance of provability under application of a rule, that is, by the proof rules themselves. One way the distinction between positive and negative connectives is apparent is when their rule behave either \emph{synchronously} or \emph{asynchronously}. For example, the $\rrn\ast$ and $\lrn\wand$ highlight the {synchronous} behaviour of the multiplicative connectives since the structure of the context affects the applicability of the rule. Displaying such a synchronous behaviour on the left makes $\wand$ a negative connective, while having it on the right makes $\ast$ a positive connective.
Another way to characterise the polarity of a connective is the study of the inveribility properties of the corresponding rules.
For example, consider the inverses of the $\lrn\lor$ rule,
\[\scalebox{.9}{$
\infer[\text{$\lrn[1]{\lor^{inv}}$}]{\Gamma\{\phi\} \seq \chi}{\Gamma\{\phi\lor\psi\} \seq \chi }
\qquad\qquad
\infer[\text{$\lrn[2]{\lor^{inv}}$}]{\Gamma\{\psi\} \seq \chi}{\Gamma\{\phi\lor\psi\} \seq \chi}
$}\]
They are derivable in $\lbi$ with $\cut$ (below -- the left branch being closed using Lemma~\ref{lem:formulaAx}) and therefore admissible in $\lbi$ without $\cut$ (by Lemma~\ref{lem:LBI-cutelim}).
\[\scalebox{.9}{$
\infer[\cut]{\Gamma\{\phi\} \seq \chi}{
\infer[\rrn\lor]{\phi \seq \phi\lor\psi}{
\phi \seq \phi
}
&
\Gamma\{\phi\lor\psi\} \seq \chi
}
\qquad
\infer[\cut]{\Gamma\{\psi\} \seq \chi}{
\infer[\rrn\lor]{\psi \seq \phi\lor\psi}{
\psi \seq \psi
}
&
\Gamma\{\phi\lor\psi\} \seq \chi
}
$}\]
This means that provability is invariant in general upon application of $\lrn\lor$ since it can always be reverted if needed, as follows
\[\scalebox{.9}{$
\infer[\lrn\lor]{\Gamma\{\phi\lor\psi\} \seq \chi}{
\infer[\text{$\lrn[1]{\lor^{inv}}$}]{\Gamma\{\phi\} \seq \chi}{
\Gamma\{\phi\lor\psi\} \seq \chi
}
&
\infer[\text{$\lrn[2]{\lor^{inv}}$}]{\Gamma\{\psi\} \seq \chi}{
\Gamma\{\phi\lor\psi\} \seq \chi
}
}
$}
\]
Note however that dual connectives do not necessarily have dual behaviours in terms of provability invariance, on the left and on the right. For example, consider all the possible rules for $\land$, of which some qualify as positive and others as positive.
\[\scalebox{.9}{$
\begin{array}{c@{\quad}c}
\infer[\text{$\lrn[1]{\land^-}$}]{\Gamma\{\phi\land \psi\} \seq \chi}{\Gamma\{\phi\} \seq \chi}
\quad
\infer[\text{$\lrn[2]{\land^-}$}]{\Gamma\{\phi\land \psi\} \seq \chi}{\Gamma\{\psi\} \seq \chi}
&
\infer[\rrn{\land^- }]{\Gamma \seq \phi \land \psi}{\Gamma \seq \phi &\Gamma \seq \psi }
\\[2ex]
\infer[\lrn{\land^+}]{\Gamma\{\phi\land\psi\} \seq\chi}{\Gamma\{\{\phi,\psi\}_+\} \seq\chi}
&
\infer[\rrn{\land^+}]{\{\Gamma, \Delta \}_+ \seq \phi \land \psi}{\Gamma \seq \phi & \Gamma\{\{\phi\land\psi\}_+\} \seq\chi}
\end{array}
$}\]
All of these rules are sound, and replacing the conjunction rules in $\lbi$ with any pair of a left and right rule will result in a sound and complete system. Indeed, the rules are inter-derivable when the structural rules are present, but otherwise they can be paired to form two sets of rules which have essentially different proof-search behaviours. That is, the rules in the top-row make $\land$ negative while the bottom row make $\land$ positive. Each conjunction also comes with an associated unit, that is, $\top^-$ for negative conjunctio and $\top^+$ for positive conjunction.
We choose to add all of them to our system in order to have access to those different proof search behaviours at will.
Finally, the polarity of the propositional letters can be assigned arbitrarily as long as only once for each.
\begin{definition}[Polarised Syntax]
Let $\mathsf{P}^+ \sqcup \mathsf{P}^-$ be a partition of $\mathsf{P}$, and let $A^+ \in \mathsf{P}^+$ and $A^- \in \mathsf{P}^-$, then the polarised formulas are defined by the following grammar,
\begin{align*}
P,Q &::= L \mid P \lor Q \, \, \mid \, P * Q \, \, \, \, \mid P \land^+ Q \, \mid \top^+ \mid \i \mid \bot &L ::= \downshift N \mid A^+ \\
N,M &::= R \mid P \to N \mid P \wand N \mid N \land^- M \mid \top^- &R ::= \upshift P \mid A^-
\end{align*}
The set of positive formulas $P$ is denoted $\Formulas^+$; the set of negative formulas $N$ is denoted $\Formulas^-$; and the set of all polarised formulas is denoted $\Formulas^\pm$. The sub-classifications $L$ and $R$ are left-neutral and right-neutral formulas respectfully.
\end{definition}
The shift operators have no logical meaning; they simply mediate the exchange of polarity, and thus the \emph{shifting} into a new phase of proof-search. Consequently, to reduces cases in subsequent proofs, we will consider formulas of the form $\upshift \downshift N$ and $\downshift \upshift P$, but not $ \downshift \upshift \downshift N$, $\downshift \upshift \downshift \upshift P$, etc.
\begin{definition}[Depolarisation]
Let $\circ \in \{\lor\,, *\,, \to\,, \wand\}$, and let $A^+ \in \mathsf{P}^+$ and $A^- \in \mathsf{P}^-$, then the depolarisation function $\floor{\cdot}:\Formulas^\pm \to \Formulas$ is defined as follows:
\[\begin{array}{l}
\floor{A^+} := \floor{A^-} := A
\quad
\floor{\upshift \phi} := \floor{\downshift \phi} := \floor{\phi}
\quad
\floor{\bot} := \bot
\quad\floor{\i} := \i
\\
\floor{\top^+} := \floor{\top^-} := \top
\quad
\floor{\phi \circ \psi} := \floor{\phi} \circ \floor{\psi}
\quad
\floor{\phi \land^+ \psi} := \floor{\phi \land^- \psi} := \floor{\phi} \land \floor{\psi}
\end{array}\]
\end{definition}
Since proof-search is controlled by polarity, the construction of sequents in the focused system must be handled carefully to avoid ambiguity.
\begin{definition}[Polarised Sequents]
\emph{Positive} and \emph{neutral} nests, denoted by $\Gamma$ and $\vec{\Gamma}$ resp., are defined according to the following grammars
\[\begin{array}{l@{\ :=\ }l@{\ \mid\ }l@{\qquad}l@{\ :=\ }l@{\qquad}l@{\ :=\ }l@{\quad}}
\Gamma& \Sigma & \Pi
&
\Sigma & P \mid \{\Pi_1,...,\Pi_n\}_+
&
\Pi& P \mid \{\Sigma_1,...,\Sigma_n\}_\times
\\
\vec{\Gamma}&\vec{\Sigma} & \vec{\Pi}
&
\vec{\Sigma} & L \mid \{\vec{\Pi}_1,...,\vec{\Pi}_n\}_+
&
\vec{\Pi}& L \mid \{\vec{\Sigma}_1,...,\vec{\Sigma}_n\}_\times
\end{array}\]
A pair of a polarised nest and a polarised formula is a \emph{polarised sequent} if it falls into one of the following cases
$$
\Gamma \seq N \quad \mid \quad \vec{\Gamma} \seq \foc{P} \quad \mid \quad \vec{\Gamma}\{\foc{N}\} \seq R
$$
\end{definition}
The decoration $\foc{\phi}$ indicates that the formula is in focus; that is, it is a positive formula on the right, or a negative formula on the left. Of the three possible cases for well-formed polarised sequents, the first may be called \emph{unfocused}, with the particular case of being \emph{neutral} when of the form $\vec{\Gamma} \seq R$; and the latter two may be called \emph{focused}.
\begin{definition}[Depolarised Nest]
The depolarisation map extends to polarised nests $\floor{\cdot}:\nests^\pm \to \nests$ as follows:
$$\floor{\{\Pi_1,...,\Pi_n\}_+} = \{\floor{\Pi_1},...,\floor{\Pi_n} \}_+ \qquad \floor{\{\Sigma_1,...,\Sigma_n\}_\times} = \{\floor{\Sigma_1},...,\floor{\Sigma_n} \}_\times
$$
\end{definition}
\subsection{Focused Calculus} \label{sec:foc_calc}
We may now give the focused system. That is, the operational semantics for focused proof-search in $\lbi$. All the rules, with the exception of $\rn P$ and $\rn N$, are polarised versions of the rules from $\nestify\lbi$.
\focbi
\begin{definition}[System $\fbi$]
The focused system $\fbi$ is composed of the rules on Figure \ref{fig:fbi}.
\end{definition}
Note the absence of a $\cut$-rule, this is because the above system is intended to encapsulate precisely \emph{focused} proof-search. Below we show that a $\cut$-rule is indeed admissible, but proofs in $\fbi+\cut$ are not necessarily focused themselves. Here the distinction between the methodologies for establishing the focusing principle becomes present since one may show completeness without leaving $\fbi$ by a permutation argument instead of a $\cut$-elimination one.
The $\rn P$ and $\rn N$ rules will allow us to move a formula from one side to another during the proof of the completeness of $\fbi+\cut$ (Lemma~\ref{lem:compFBIcut})
The depolarised version are not directly present in $\lbi$, but are derivable in $\lbi$ (Lemma \ref{lem:formulaAx}). However, the way they are focused renders them not provable in $\fbi$ because it forces one to begin with a potentially \emph{bad} choice; for example, $A \lor B \seq A \lor B$ has no proof beginning with $\rrn\lor$. In practice, they are a feature rather than a bug since they allow one to terminate proof-search early, without unnecessary further expansion of the axiom.
In related works, such as~\cite{Chaudhuri16a,Chaudhuri16b}, the analogous rules are eliminated by initially working with a weaker notion of focused proof-search, and it is reasonable to suppose that the same may be true for BI. We leave this to future investigation.
Note also that, although it is perhaps proof-theoretically displeasing to incorporate weakening into the operational rules as in $\lrn{\wand'}$ and $\rrn{\ast'}$, it has good computational behaviour during focused proof-search since the reduction of $\phi \wand \psi$ can only arise out of an explicit choice made earlier in the computation.
Soundness follows immediately from the depolarisation map; that is, the interpretation of polarised sequents as nested sequents, and hence proofs in $\fbi$ actually are focused proofs in $\nestify\lbi$.
\begin{theorem}[Soundness of $\fbi$]
Let $\Gamma$ be a polarised nest and $N$ a negative formula.
If $\vdash_{\fbi} \Gamma \seq N$ then $\vdash_{\nestify\lbi} \floor{\Gamma} \seq \floor{N}$
\end{theorem}
\begin{proof}
Every rule in $\fbi$ except the shift rules, as well as the $\rn P$ and $\rn N$ axioms, become a rule in $\nestify \bi$ when the antecedent(s) and consequent are depolarised. Instance of the shift rule can be ignored since the depolarised versions of the consequent and antecedents are the same. Finally, the depolarised versions of $\rn P$ and $\rn N$ follow from Lemma \ref{lem:formulaAx} with the use of some weakening.\qed \end{proof}
\begin{example}
Consider the following proof in $\fbi$, we suppose here that propositional letters $A$ and $C$ are negative, but $B$ is positive.
\[\scalebox{.9}{$
\infer[\rrn\wand]{\emptyset_\times \seq (\downshift A * \downshift(\upshift B\land^- C)) \wand (\upshift (\downshift A * B)\land^- \upshift (\downshift A * \downshift C))}{
\infer[\lrn\ast]{\downshift A * \downshift(\upshift B\land^- C) \seq \upshift (\downshift A * B)\land^- \upshift (\downshift A * \downshift C)}{
\infer[\rrn{\land^-}]{\{ \downshift A , \downshift(\upshift B\land^- C) \}_\times \seq \upshift (\downshift A * B)\land^- \upshift (\downshift A * \downshift C)}{
\infer[\lrn\upshift\ {\color{blue}(1)}]{\{ \downshift A , \downshift(\upshift B\land^- C) \}_\times \seq \upshift (\downshift A * B)}{
\infer[\text{$\lrn[1]{\land^-}$}]{\{ \downshift A , \foc{\upshift B\land^- C} \}_\times \seq \upshift (\downshift A * B)}{
\infer[\lrn\upshift]{\{ \downshift A , \foc{\upshift B}\}_\times \seq \upshift (\downshift A * B)}{
\infer[\rrn\upshift]{\{ \downshift A , \ B\}_\times \seq \upshift (\downshift A * B) }{
\infer[\rrn\ast]{\{ \downshift A , B\}_\times \seq \foc{\downshift A * B} }{
\infer[\rrn\downshift]{\downshift A \seq \foc{\downshift A }}{
\infer[\lrn\downshift]{\downshift A \seq A }{
\infer[\rn{Ax^-}]{\foc{A} \seq A }{}
}
}
&
\infer[\rn{Ax^+}]{B \seq \foc{B}}{}
}
}
}
}
}
&
\infer[\rrn\upshift\ {\color{blue}(2)}]{\{ \downshift A , \downshift(\upshift B\land^- C) \}_\times \seq \upshift (\downshift A * \downshift C)}{
\infer[\rrn\ast]{\{ \downshift A , \downshift(\upshift B\land^- C) \}_\times \seq \foc{\downshift A * \downshift C}}{
\infer[\rrn\downshift]{\downshift A \seq \foc{\downshift A }}{
\infer[\lrn\downshift]{\downshift A \seq A }{
\infer[\rn{Ax^-}]{\foc{A} \seq A }{}
}
}
&
\infer[\rrn\downshift]{\downshift(\upshift B\land^- C) \}_\times \seq \foc{\downshift C }}{
\infer[\lrn\downshift]{\downshift(\upshift B\land^- C) \seq C}{
\infer[\text{$\lrn[2]{\land^-}$}]{ \foc{\upshift B\land^- C} \seq C}{
\infer[\rn{Ax^-}]{ \foc{C} \seq C }{}
}
}
}
}
}
}
}
}
$}\]
It is a focused version of the proof given in Example~\ref{ex:nestedproof}. Observe that the only non-deterministic choices are which formula to focus on, such as in steps (1) and (2), where different choices have been made for the sake of demonstration. The point of focusing is that \emph{only} at such points do choices that affect termination occur. The assignment of polarity to the propositional letters is what forced the shape of the proof; for example, if $B$ had been negative the above would not have been well-formed. This phenomenon is standarly observed in focused systems (e.g.~\cite{Chaudhuri06}).
\end{example}
We now introduce the tool which will allow us to show that if there is a proof of a sequent (\emph{a priori} unstructured), then there is necessarily a focused one.
\begin{definition}
All instances of the following rule where the sequents are well-formed are instances of $\cut$, where $\vec{\phi}$ denotes that $\phi$ is possibly prenexed with an additional shift
\[
\infer[\cut]{\Gamma\{\Delta\} \seq \chi}{\Delta \seq \phi & \Gamma \{\vec{\phi}\} \seq \chi}
\]
\end{definition}
Admissibility follows from the usual argument, but within the focused system; that is, through the upward permutation of cuts until they are eliminated in the axioms or are reduced in some other measure.
\begin{definition}[Good and Bad Cuts]
Let $\mathcal{D}$ be a $\fbi+\cut$ proof, a cut is a quadruple $\langle \mathcal{L}, \mathcal{R}, \mathcal{C}, \phi \rangle$ where $\mathcal{L}$ and $\mathcal{R}$ are the premises to a $\cut$ rule, concluding $\mathcal{C}$ in $\D$, and $\phi$ is the $\cut$-formula. They are classified as follows:
\begin{enumerate}
\item[] \textbf{Good} - If $\phi$ is principal in both $\mathcal{L}$ and $\mathcal{R}$.
\item[] \textbf{Bad} - If $\phi$ is not principal in one of $\mathcal{L}$ and $\mathcal{R}$.
\begin{enumerate}
\item[] Type 1: If $\phi$ is not principal in $\mathcal{L}$.
\item[] Type 2: If $\phi$ is not principal in $\mathcal{R}$.
\end{enumerate}
\end{enumerate}
\end{definition}
\begin{definition}[Cut Ordering]
The $\cut$-rank of a cut $\langle \mathcal{L}, \mathcal{R}, \mathcal{C}, \phi \rangle$ in a proof is the triple $\langle \cut$-complexity, $\cut$-duplicity, $\cut$-level$\rangle$, where the $\cut$-complexity is the size of $\phi$, the $\cut$-duplicity is the number of contraction instances above the cut, the $\cut$-level is the sum of the heights of the sub-proofs concluding $\mathcal{L}$ and $\mathcal{R}$.
Let $\D$ and $\D'$ be two $\fbi+\cut$ proofs, let $\sigma$ and $\sigma'$ denote their multiset of cuts respectively. Proofs are ordered by $\D \prec\D' \iff \sigma < \sigma'$, where $<$ is the multiset ordering derived from the lexicographic ordering on $\cut$-rank.
\end{definition}
It follows from a result in \cite{Dershowitz79} that the ordering on proofs is a well-order, since the ordering on cuts is a well-order.
\begin{lemma}[Good Cuts Elimination]\label{lem:goodcutelim}
Let $\D$ be a $\fbi+\cut$ proof of $S$; there is a $\fbi+\cut$ proof $\D'$ of $S$ containing no good cuts such that $\D' \preceq \D$.
\end{lemma}
\begin{proof}
Let $\D$ be as in hypothesis, if it contains no good cuts then $\D =\D'$ gives the desired proof. Otherwise, there is at least one good cut $\langle \mathcal{L}, \mathcal{R}, \mathcal{C}, \phi \rangle$. Let $\partial$ be the sub-proof in $\D$ concluding $\mathcal{C}$, then there is a transformation $\partial \mapsto \partial'$ where $\partial'$ is a $\fbi+\cut$ proof of $S$ with $\partial' \prec \partial$ such that the multiset of good cuts in $\partial'$ is smaller (with respect to $\prec$) than the multiset of good cuts in $\partial$. Since $\prec$ is a well-order indefinitely replacing $\partial$ with $\partial'$ in $\D$ for various cuts yields the desired $\D'$.
The key step is that a cut of a certain $\cut$-complexity is replaced by cuts of lower $\cut$-complexity, possibly increasing the $\cut$-duplicity or $\cut$-level of other cuts in the proof, but not modifying their complexity.
\scalebox{.85}{$
\infer[\cut]{\vec{\Gamma}\{\{\vec{\Gamma}' , A^+\}_+\} \seq \foc{A^+}}{
\infer[\rn{Ax^+}]{ \{\vec{\Gamma}', A^+\}_+ \seq \foc{A^+} }{}
&
\vec{\Gamma}\{A^+\} \seq \foc{A^+}
}
$}
$\quad\mapsto\quad$
\scalebox{.85}{$
\infer=[\weak]{\vec{\Gamma}\{\{\vec{\Gamma}' , A^+\}_+\} \seq \foc{A^+}}{\vec{\Gamma}\{A^+\} \seq \foc{A^+} }
$}\\
\scalebox{.85}{$
\infer[\cut]{\vec\Gamma\{\vec{\Delta},\vec{\Delta}',\{\vec{\Delta}'',\vec{\Delta}'''\}_+\}_\times \seq R}{
\infer[\rrn\wand]{\vec{\Delta}''' \seq P\wand N}{
\{\vec{\Delta}''', P\}_\times \seq N
}
&
\infer[\lrn\wand]{\vec\Gamma\{\vec{\Delta},\vec{\Delta}',\{\vec{\Delta}'',\foc{P\wand N}\}_+\}_\times \seq R}{
\vec{\Delta} \seq \foc{P}
&
\Gamma\{\vec{\Delta}', \foc{N}\}_\times \seq R
}
}
$}
\hspace*{2.5cm}
$\mapsto\quad$
\scalebox{.85}{$
\infer=[\weak]{\vec\Gamma\{\vec{\Delta},\vec{\Delta}',\{\vec{\Delta}'',\vec{\Delta}'''\}_+\}_\times \seq R}{
\infer[\cut]{\vec\Gamma\{\vec{\Delta},\vec{\Delta}',\vec{\Delta}''\}_\times \seq R}{
\vec{\Delta} \seq \foc{P}
&
\infer[\cut]{\vec\Gamma\{\vec{\Delta},\vec{\Delta}'',P\}_\times \seq R}{
\{\vec{\Delta}'', P\}_\times \seq N
&
\vec\Gamma\{\vec{\Delta}', \foc{N}\}_\times \seq R
}
}
}
$}\\
We denote by a double-line the fact that we do not actually use a weakening, but only the fact that it is admissible in $\fbi$ by construction (Lemma~\ref{lem:weakelim}).
\qed
\end{proof}
\begin{lemma}[Bad Cuts Elimination]\label{lem:badcutelim}
Let $\D$ be a $\fbi+\cut$ proof of $S$ that contains only one cut which is bad, then there is a $\fbi+\cut$ proof $\D'$ of $S$ such that $\D' \prec \D$.
\end{lemma}
\begin{proof}
Without loss of generality suppose the cut is the last inference in the proof, then it may be replaced by other cuts whose $\cut$-level or $\cut$-duplicity is smaller, but with same $\cut$-complexity.
First we consider bad cuts when $\mathcal{L}$ and $\mathcal{R}$ are both axioms. There are no Type 1 bad cuts on axioms as the formula is always principal, meanwhile the Type $2$ bad cuts can trivially be permuted upwards or ignored; for example,\\
\scalebox{.85}{
$
\infer[\cut]{\vec\Gamma\{\vec\Delta,\vec\Delta',\{\vec\Delta'', \vec\Delta''', A_+,\foc{P\wand N}\}_+\}_\times \seq R}{
\infer[\rn{Ax^+}]{\{\vec\Delta''',A_+\}_+ \seq \foc{A_+}}{}
&
\infer[\lrn\wand]{\vec\Gamma\{\vec\Delta,\vec\Delta',\{\vec\Delta'', A_+,\foc{P\wand N}\}_+\}_\times \seq R}{
\vec\Delta \seq \foc P
&
\vec\Gamma\{\vec\Delta', \foc N\}_\times \seq R
}
}
$
}\\
\hspace*{2.5cm}
$\mapsto\quad$
\scalebox{.85}{
$
\infer=[\weak]{\vec\Gamma\{\vec\Delta,\vec\Delta',\{\vec\Delta'', \vec\Delta''', A_+,\foc{P\wand N}\}_+\}_\times \seq R}{
\infer[\lrn\wand]{\vec\Gamma\{\vec\Delta,\vec\Delta',\{\vec\Delta'', A_+,\foc{P\wand N}\}_+\}_\times \seq R}{
\vec\Delta \seq \foc P
&
\vec\Gamma\{\vec\Delta', \foc N\}_\times \seq R
}
}
$
}
Here again we are using an appropriate version of Lemma~\ref{lem:weakelim}.
For the remaining cases the cuts are commutative in the sense that they may be permuted upward thereby reducing the $\cut$-level. An example is given below.\\
\scalebox{.85}{
$
\infer[\cut]{\vec\Gamma\{\vec\Delta\{\foc{N_1 \land^- N_2}\}\} \seq R}{
\infer[\text{$\lrn[1]{\land^-}$}]{\vec\Delta\{\foc{N_1 \land^- N_2}\} \seq M}{
\vec\Delta\{\foc{N_1}\} \seq M
}
&
\vec\Gamma\{ M\} \seq R
}
$
}
$\mapsto\quad$
\scalebox{.85}{
$
\infer[\text{$\lrn[1]{\land^-}$}]{\Gamma\{\Delta\{\foc{N_1 \land^- N_2}\}\} \seq R}{
\infer[\cut]{\Gamma\{\Delta\{\foc{N_1}\}\} \seq R}{
\Delta\{\foc{N_1}\} \seq M
&
\Gamma\{ M\} \seq R
}
}
$
}
The exceptional case is the interaction with contraction where the cut is replaced by cuts of possibly equal $\cut$-level, but $\cut$-duplicity decreases.\\
\scalebox{.85}{
$
\infer[\cut]{\vec\Gamma\{\vec{\Delta}\{\vec\Delta'\}\} \seq R}{
\vec\Delta' \seq \foc{L}
&
\infer[\cont]{\vec\Gamma\{\vec{\Delta}\{L\}\} \seq R}{
\vec\Gamma\{\{\vec{\Delta}\{L\}, \vec{\Delta}\{L\}\}_+\} \seq R
}
}
$
}
\hspace*{2.5cm}
$\quad\mapsto\quad$
\scalebox{.85}{
$
\infer[\cont]{\vec\Gamma\{\vec{\Delta}\{\vec\Delta'\}\} \seq R}{
\infer[\cut]{\vec\Gamma\{\{\vec{\Delta}\{\vec\Delta'\}, \vec{\Delta}\{\vec\Delta'\}\}_+\} \seq R }{
\vec\Delta' \seq \foc L
&
\infer[\cut]{\vec\Gamma\{\{\vec{\Delta}\{\vec\Delta'\}, \vec{\Delta}\{L\}\}_+\} \seq R}{
\vec\Delta' \seq \foc L
&
\vec\Gamma\{\{\vec{\Delta}\{L\}, \vec{\Delta}\{L\}\}_+\} \seq R
}
}
}
$
}
\qed\end{proof}
\begin{theorem}[Cut-elimination in $\fbi$]\label{lem:fbicutadmi}
Let $\Gamma$ be a positive nest and $N$ a negative formula. Then,
$\vdash_{\fbi} \Gamma \seq N$ if and only if $ \vdash_{\fbi+\cut} \Gamma \seq N$.
\end{theorem}
\begin{proof}
($\seq$) Trivial as any $\fbi$-proof is a $\fbi+\cut$-proof. ($\Leftarrow$) Let $\D$ be a $\fbi+\cut$-proof of $\Gamma \seq N$, if it has no cuts then it is a $\fbi$-proof so we are done. Otherwise, there is at least one $\cut$, and we proceed by well-founded induction on the ordering of proofs and sub-proofs of $\D$ with respect to $\prec$.
\textbf{Base Case.} Assume $\D$ is minimal with respect to $\prec$ with at least one cut; without loss of generality, by Lemma \ref{lem:goodcutelim}, assume the cut is bad. It follows from Lemma \ref{lem:badcutelim} that there is a proof strictly smaller in $\prec$-ordering, but this proof must be $\cut$-free as $\D$ is minimal.
\textbf{Inductive Step.} Let $\D$ be as in the hypothesis, then by Lemma \ref{lem:goodcutelim} there is a proof $\partial$ of $\Gamma \seq N$ containing no good cuts such that $\D' \preceq \D$. Either $\D'$ is $\cut$-free and we are done, or it contains bad cuts. Consider the topmost cut, and denote the sub-proof by $\partial$, it follows from Lemma \ref{lem:badcutelim} that there is a proof $\partial'$ of the same sequent such that $\partial' \prec \partial$. Hence, by inductive hypothesis, there is a $\cut$-free proof the sequent and replacing $\partial$ by this proof in $\D$ gives a proof of $\Gamma \seq \phi$ strictly smaller in $\prec$-ordering, thus by inductive hypothesis there is a $\cut$-free proof as required.
\qed \end{proof}
\subsection{Completeness of $\fbi$} \label{sec:foc_comp}
The completeness theorem of the focused system, the operational semantics, is with respect to an interpretation (i.e. a polarisation). Indeed, any polarisation may be considered; for example, both $(\downshift A^-*B^+) \land^+ \downshift A^-$ and $\downshift (A^+*\downshift B^-) \land^+ A^+$ are correct polarised versions of the formulas $(A*B) \land A$. Taking arbitrary $\phi$ the process is as follows: first, fix a polarised syntax (i.e. a partition of the propositional letters into positive and negative sets), then assign a polarity to $\phi$ with the following steps:
\begin{itemize}
\item If $\phi$ is a propositional atom, it must be polarised by default;
\item If $\phi = \top$, then \emph{choose} polarisation $\top^+$ or $\top^-$;
\item If $\phi = \psi_1 \land \psi_2$, first polarise $\psi_1$ and $\psi_2$, then \emph{choose} an additive conjunction and combine accordingly, using shifts to ensure the formula is well-formed;
\item If $\phi = \psi_1 \circ \psi_2$ where $\circ \in\{*, \wand, \to, \lor\}$, then polarise $\psi_1$ and $\psi_2$ and combine with $\circ$ accordingly, using shifts where necessary.
\end{itemize}
\begin{example}
Suppose $A$ is negative and $B$ is positive, then $(A*B) \land A$ may be polarised by choosing the additive conjunction to be positive resulting in $(\downshift A*B) \land^+ \downshift A$ (when $\downshift (A*\downshift B) \land^+ A)$ would not be well-formed). Choosing to shift one can ascribe a negative polarisation $\upshift ((\downshift A*B) \land^+ \downshift A)$.
\end{example}
The above generates the set of all such polarised formulas when all possible choices are explored. The free assignment of polarity to formulas means several distinct focusing procedures are captured by the completeness theorem.
\begin{lemma}[Completeness of $\fbi+\cut$] \label{lem:compFBIcut}
For any unfocused sequent $\Gamma \seq N$, if $\vdash_{\nestify \lbi}\floor{\Gamma \seq N}$ then $\vdash_{\fbi+\cut} \Gamma \seq N$.
\end{lemma}
\begin{proof}
We show that every rule in $\nestify\lbi$ is derivable in $\fbi+\cut$, consequently every proof in $\nestify\lbi$ may be simulated; hence, every provable sequent has a focused proof. For unfocused rules $\rrn\to, \rrn\wand, \rrn{\land^-}, \lrn{\land^+}, \lrn\lor, \lrn\ast, \lrn\bot, \rrn{\top^-}, \lrn{\top^+}, \lrn\i$, this is immediate; as well as for $\rn{Ax}$ and $\cont$. Below we give an example on how to simulate a focused rule.
Where it does not matter (e.g. in the case of inactive nests), we do not distinguish the polarised and unpolarised versions; each of the simulations can be closed thanks to the presence of the $\rn P$ and $\rn N$ rules in $\fbi$.\\
\noindent\scalebox{.9}{
$
\infer[\rrn\ast]{\{\{\Gamma,\Delta\}_\times,\Delta'\}_+ \seq \phi * \psi}{\Gamma \seq \phi & \Delta \seq \psi}
$
}
in $\nestify\lbi$ is simulated in $\fbi+\cut$ by
\scalebox{.9}{
$
\infer[\cut]{\{\{ \Gamma, \Delta \}_\times,\Delta'\}_+ \seq \upshift(\phi^+*\psi^+)}{
\infer[\rrn\ast]{\{ \Gamma,\Delta \}_\times \seq \foc{\downshift\upshift\phi^+*\downshift\upshift\psi^+} }{
\infer[\rrn\downshift]{\Gamma \seq \foc{\downshift\upshift\phi^+}}{
\Gamma \seq \upshift\phi^+
}
&
\infer[\rrn\downshift]{\Delta \seq \foc{\downshift\upshift\psi^+}}{\Delta \seq \upshift\psi^+}
}
&
\infer[\lrn\ast]{\{ \downshift\upshift\phi^+*\downshift\upshift\psi^+,\Delta'\}_+ \seq \upshift(\phi^+*\psi^+)}{
\infer[\rrn\upshift]{\{\{ \downshift\upshift\phi^+,\downshift\upshift\psi^+ \}_\times,\Delta'\}_+ \seq \upshift(\phi^+*\psi^+)}{
\infer[\rrn\ast]{ \{\{ \downshift\upshift\phi^+,\downshift\upshift\psi^+ \}_\times,\Delta'\}_+ \seq \foc{\phi^+*\psi^+}}{
\infer[\rn P]{\downshift\upshift\phi^+ \seq \foc{\phi^+}}{}
&
\infer[\rn P]{\downshift\upshift\psi^+ \seq \foc{\psi^+}}{}
}
}
}
}
$
}
\qed \end{proof}
\begin{theorem}[Completeness of $\fbi$]
For any unfocused $\Gamma \seq N$, if $\vdash_{\nestify\lbi} \floor{\Gamma \seq N}$ then $\vdash_{\fbi} \Gamma \seq N$.
\end{theorem}
\begin{proof}
It follows from Lemma \ref{lem:compFBIcut} that there is a proof of $\Gamma \seq N$ in $\fbi+\cut$, and then it follows from Lemma \ref{lem:fbicutadmi} that there is a proof of $\Gamma \seq N$ in $\fbi$.
\qed \end{proof}
Given an arbitrary sequent the above theorem guarantees the existence of a focused proof, thus the focusing principle holds for $\eta \lbi$ and therefore for $\lbi$.
| {'timestamp': '2021-01-27T02:16:38', 'yymm': '2010', 'arxiv_id': '2010.08352', 'language': 'en', 'url': 'https://arxiv.org/abs/2010.08352'} | arxiv |
\section{Introduction}
As a challenging problem in computer vision, person-level action recognition has been applied in many applications, including human behavior analysis, human-computer interaction, and video surveillance.
Recently, significant progress has been made in this area~\cite{slowfast2019ava, aia2020}. However, the person-level action recognition in complex events~\cite{lin2020human} is still relatively new and a challenging problem. In this challenge of person-level action recognition on crowded scenes and complex events, we propose to utilize the scenes information by semantic segmentation model and mine more diversity scenes in data from the internet.
Our overall approach for person-level action recognition in complex events can be divided into two parts, respectively human detection and spatio-temporal action recognition (Figure~\ref{fig:framework}), where the second part is very similar to the methods used by the champion team in the AVA Spatio-temporal Action Localization challenge 2019~\cite{slowfast2019ava}, but we utilize more diversity data and adaptively apply the AVA model to HIE dataset. Firstly, we train a very strong person detector to detect the persons in the video frames. We then build an action detection model using a modified version of the Asynchronous Interaction Aggregation
network~\cite{aia2020}. Finally, we extract the scenes information by semantic segmentation model to boost the performance.
\section{Human Detection}
The first step of spatio-temporal action localization is to detect the bounding boxes of person. As no validation set in HIE dataset~\cite{lin2020human}, we split the original training set as new training set and validation set. Two splitting strategies are tried: splitting by image frames (5k for validation, 27k for training) and splitting by videos. We found that splitting by image will cause over-fitting and far away from the data distribution of testing set. So we adopt the video-splitting strategy and split video 3,7,8 and 17 as the validation set and the rest videos as train data, in which 5.7k image frames for validation and the reset 27k images frames for training. Based on the train and validation set, we can conduct detection experiments on HIE. All the performance of models is tested by two metrics, Averaged Precision (AP) and MMR~\cite{dollar2011pedestrian}. AP reflects both the precision and recall ratios of the detection results; MMR is the log-average Miss Rate on False Positive Per Image (FPPI) in $[0.01,100]$, is commonly used in pedestrian detection. MR is very sensitive to false positives (FPs), especially FPs with high confidences will significantly harm the MMR ratio. Larger AP and smaller MMR indicates better performance.
\begin{figure*} [h]
\centering
\includegraphics[width=0.9\textwidth]{HIE_track4.pdf}
\caption{The framework of our person-level action recognition.}
\label{fig:framework}
\vspace{-5mm}
\end{figure*}
\begin{table}[]
\begin{center}
\fontsize{8pt}{12pt}\selectfont
\caption{Performance comparison (AP and mMR) among different detection backbone and methods on HIE dataset. }
\begin{tabular}{l|c|c}
\toprule
Methods or Modules & AP (\%) & MMR (\%) \\
\midrule
Baseline (ResNet50 + Faster RCNN) & 61.68 & 74.01 \\
ResNet152 + Faster RCNN &67.32 & 68.17\\
ResNet152 + Faster RCNN + FPN &69.77 & 64.83\\
SENet154 + Faster RCNN + FPN &65.77 & 68.46\\
ResNeXt101 + Faster RCNN + FPN &69.53 & 63.91\\
ResNeXt101 + Cascade RCNN + FPN &71.32 & 61.58\\
ResNet152 + Cascade RCNN + FPN &71.06 & 62.55\\
\bottomrule
\end{tabular}
\label{tab:det_methods}
\end{center}
\vspace{-4mm}
\end{table}
\subsection{Detection Frameworks on HIE}
There are mainly two different types of common detection frameworks: one-stage (unified) frameworks~\cite{redmon2016you, redmon2016yolo9000, liu2016ssd} and two-stage (region-based) framework~\cite{girshick2014rich, girshick2015fast, ren2015faster, he2017mask}. Since RCNN~\cite{girshick2014rich} has been proposed, the two-stage detection methods have been widely adopted or modified~\cite{ren2015faster, lin2017focal, lin2017FPN, cai2018cascade, zhou2018object, wang2019few, wang2019distilling}. Normally, the one-stage frameworks can run in real-time but with the cost of a drop in accuracy compared with two-stage frameworks, so we mainly adopt two-stage frameworks on HIE dataset.
We first investigate the performance of different detection backbone and framework on HIE dataset, including backbone: ResNet152~\cite{he2016deep}, ResNeXt101~\cite{xie2017aggregated} and SeNet154~\cite{hu2018squeeze}, and different framework: Faster-RCNN~\cite{ren2015faster}, Cascade R-CNN~\cite{cai2018cascade}, and Feature-Pyramid Networks (FPN)~\cite{lin2017feature}. The experimental results on different backbone and methods are given in Table~\ref{tab:det_methods}. The baseline model is Faster RCNN with ResNet50, and we search hyper-parameters on the baseline model then apply to the larger backbone. From table~\ref{tab:det_methods}, we can find that the better backbone (ResNet152 and ResNeXt101) and combining advanced methods (Cascade and FPN) can improve the detection performance, but the SENet154 does not get better performance than ResNet152 even it has superior classification performance on ImageNet. So in our final detection solution, we only adopt ResNet152 and ResNeXt101 as the backbone.
\begin{table}[]
\begin{center}
\fontsize{8pt}{12pt}\selectfont
\caption{The effects of using extra data for human detection on HIE dataset.}
\begin{tabular}{l|c|c}
\toprule
Validation set & AP (\%) & MMR (\%) \\
\midrule
HIE data & 61.68 & 74.01 \\
HIE + COCO person &65.83 & 69.75\\
HIE + CityPerson &63.71 & 67.43\\
HIE + CrowdHuman &\textbf{78.22} & \textbf{58.33}\\
HIE + self-collected data &\textbf{69.39} & \textbf{60.82}\\
HIE + CrowdHuman + COCO + CityPerson &78.53 & 58.63\\
\textbf{HIE + CrowdHuman + self-collected data} &\textbf{81.03} & \textbf{55.58}\\
HIE + all extra data &81.36 & 55.17\\
\bottomrule
\end{tabular}
\label{tab:det_data}
\end{center}
\vspace{-4mm}
\end{table}
\subsection{Extra Data for HIE}
In the original train data, there are 764k person bounding boxes in 19 videos with 32.9k frames, and the testing set contains 13 videos with 15.1k frames. Considering the limited number of videos and duplicated image frames, the diversity of train data is not enough. And the train data and test data have many different scenes, thus extra data is crucial for training a superior detection model. Here we investigate the effects of different human detection dataset on HIE, including all the person images in COCO (COCO person, 64k images with 262k boxes)~\cite{lin2014microsoft}, CityPerson (2.9k image with 19k boxes)~\cite{zhang2017citypersons}, CrowndHuman (15k images with 339k boxes)~\cite{shao2018crowdhuman} and self-collected data (2k images with 30k boxes). We investigate the effects on different data based on Faster-RCNN with ResNet50 as the backbone. The experimental results are shown in Table~\ref{tab:det_data}. We can find that the CrowdHuman dataset achieves the most improvement compared with other datasets, because the CrowdHuman is the most similar dataset with HIE, and both of the two datasets contain plenty of crowded scenes. COCO person contains two times of images than HIE train data, but merging the COCO person does not bring significant improvement and suffer more than three times train time, thus we only merge HIE with CrowdHuman and self-collected data to take a trade-off between detection performance and train time.
\begin{table}[]
\begin{center}
\fontsize{8pt}{12pt}\selectfont
\caption{Detection in Crowded Scenes on HIE dataset.}
\begin{tabular}{l|c|c}
\toprule
Validation set & AP (\%) & MMR (\%)\\
\midrule
ResNet50 + Faster RCNN + extra data & 81.36 & 55.17 \\
+ emd loss &81.73 & 53.20\\
+ refine module &81.96 & 50.85\\
+ set NMS &82.05 & 49.63\\
\bottomrule
\end{tabular}
\label{tab:det_crowded}
\end{center}
\vspace{-4mm}
\end{table}
\subsection{Detection in Crowded Scenes}
As there are lots of crowded scenes in HIE2020 dataset, the highly-overlapped instances are hard to detect for the current detection framework. We apply a method aiming to predict instances in crowded scenes~\cite{chu2020detection}, named as ``CrowdDet''. The key idea of CrowdDet is to let each proposal predict a set of correlated instances rather than a single one as the previous detection method. The CrowdDet includes three main contributions for crowded-scenes detection: (1) an EMD loss to minimize the set distance between the two sets of proposals~\cite{tang2014detection}; (3). Set NMS, it will skip normal NMS suppression when two bounding boxes come from the same proposal, which has been proved works in crowded detection; (2). A refine module that takes the combination of predictions and the proposal feature as input, then performs a second round of predicting. We conduct experiments to test the three parts on HIE2020 dataset, and the results are shown in Table~\ref{tab:det_crowded}. Based on the results in the Table, we can find that the three parts do improve the performance in crowded detection. Meanwhile, we apply KD regularization~\cite{yuan2019revisit} in the class's logits of the detection model, which can consistently improve the detection results by 0.5\%-1.4\%.
Finally, based on the above analysis, we train two detection models on HIE by combining extra data with the crowded detection framework: (1). ResNet152 + Cascade RCNN + extra data + emd loss + refine module + set NMS + KD regularization, whose AP is 83.21; (2). ResNeXt101 + Cascade RCNN + extra data + emd loss + refine module + set NMS + KD regularization, whose AP is 83.78; Then two models are fused with weights 1:1.
\section{Person-level Action Recognition}
The HIE ~\cite{hie2020} training set contains 33559 human action instances from 14 action categories. The actions are annotated for all individuals in every 20 frames, we call the frames which contain action annotations as the \textbf{key frames}. As mentioned in ~\cite{hie2020}, the distribution of all action classes is extremely unbalanced. Some action classes such as running-alone, running-together, sitting-talking, fighting and fall-over each have less than 400 action instances, while there are 11.7k actions labeled as walking-alone. Moreover, the spatial sizes of the persons in HIE only occupy less than 2\% of the area of the whole frame on average. Therefore it is an extremely challenging task to perform spatio-temporal action localization on this dataset. To mitigate the problem of lack of data, we collected some extra data as mentioned previously and annotated around 2.9k action instances on them.
Next, we will describe the methods we used for the person-level action recognition task. For every key frame, We first sample frames temporally-centered around the key frame to form a short trimmed video clip. The trimmed clip is then fed into the backbone video feature extractor model which outputs feature maps representing the video clip. We then apply RoIAlign~\cite{he2017mask} along the spatial dimensions, and global average pooling along the temporal dimension following ~\cite{feichtenhofer2019slowfast} to extract features for each person. The person features of the current clip together with the features in the neighbor clips are then combined for a few interaction modules for the final action prediction.
\subsection{Action detection Model}
We employ the Asynchronous Interaction Aggregation (AIA) network~\cite{aia2020} as the main action detection model for this task. The backbone of the model is SlowFast 8×8 ResNet-101 (SlowFast8x8-R101) ~\cite{feichtenhofer2019slowfast} which is pretrained on the Kinetics-700 dataset~\cite{k700}. The whole AIA model (with dense serial Interaction Aggregation) is then trained on the AVA dataset~\cite{gu2018ava} which is a large-scale spatio-temporal action localization dataset. We take the AVA trained model open-sourced by the authors of AIA~\cite{aia2020} as our base model. As the actions in HIE are all human-centric and have no interactions with other objects, unlike the actions in AVA, we remove the person-object interactions modules in the AIA. Moreover, as the duration for each video in HIE is much shorter than AVA, and the movement of the persons are generally much quicker in HIE, we reduce the number of neighbor clip $L$ to 1 for the temporal interactions in AIA.
\subsection{Dataset split}
We tried splitting the dataset by videos to train and validation set similarly to the detection training. However, several action labels would have very few positive instances in the training and/or validation set, which makes it hard to evaluate performance using this kind of split strategy. Therefore, we performed a few rounds of initial experiments with the above train-validation split to verify the correctness of our implementation. After that, we switch to training with the full training set without validation, and perform testing on the official testing set given.
\subsection{Training Details}
For each trimmed clip around a key frame, we sample 32 frames and 8 frames within the clip for the slow and fast branch in the feature extractor respectively. For the spatial dimensions, during training, we resize the shorter side of the frames to a length randomly sampled from (320, 352, 384, 416, 448), and pad the longer side to 2.5 times of the shorter side. We apply bounding box jittering of 10\% and random horizontal flipping to improve the generalization ability. We use a dropout rate of 0.2 before the classification prediction, and employ the binary cross-entropy loss on sigmoid activated logits as supervision during training. Training is performed with SGD optimizer for a total of 160k iterations with BatchNorm~\cite{ioffe2015batch} statistics being frozen. We train each model on 8 GPUs with 2 clips per GPU, which makes the total batch-size 16. The initial learning rate is 0.01, and is reduced by a factor of 10 after 96k and 128k iterations. We warm-up the learning rate linearly for the first 2k iterations following~\cite{aia2020}.
\subsection{Weighted sampling}
Due the lack of training samples for some classes, we observed that the score distribution for the rare classes is near zero after the training. To mitigate the imbalance problem among the action classes, we perform weighted clip sampling during training where we assign higher weights to clips that contain rare actions (such as sitting, running, etc) and lower weights to clips that contain frequent actions (such as walking and standing). After applying the weighted sampling strategy, the ratio of the number of occurrence of maximum sampled action to the minimum sampled action is reduced from around 120 to around 10 during training.
\begin{figure}[t!]
\begin{center}
\end{center}
\subfigure{
\includegraphics[scale=0.0535]{25_rgb.jpg}}
\subfigure{
\includegraphics[scale=0.16]{30_rgb.jpg}}
\caption{Scene parsing visualization for video 25 and 30. }
\label{fig:visualization}
\vspace{-6mm}
\end{figure}
\subsection{Inference Details}
For inference, the process is similar to that of training, except that instead of ground-truth person boxes, we used the predicted person boxes to perform RoIAlign after the feature extraction. We performed multi-scale and flip testing with 5 scales at (320, 352, 384, 416, 448), and average the predictions scores as the prediction output by the model. For the final submission, we made we only used one single AIA (SlowFast8x8-R101) model without a multi-model ensemble.
We noticed that certain actions such as walking-up-down-stairs is closely related to staircases in the scene, as they are supposed to be. We can confidently say that the action label of a person is walking-up-down-stairs when the person is above the staircase. Therefore, we use a semantic segmentation model trained on the ADE20K~\cite{zhou2016semantic, zhou2017scene} dataset to perform scene parsing on the videos, so that we can re-weight the scores depending on the location of the person bounding box in the scene. Figure ~\ref{fig:visualization} are the visualizations of scene parsing of hm\_in\_passage (ID:25) and hm\_in\_stair (ID:30) respectively.
Moreover, certain similar actions such as walking-together, running-together and gathering are group actions that require other people to be physically around. Therefore depending on the maximum intersection-over-union (IoU) among the neighbor person boxes to the target person bounding box, we re-weight the score from 'together' actions to the corresponding 'alone' actions if there is no other person around the target person.
\section{Person-level Action Recognition Results}
Our final submission achieved 26.05\% wf-mAP@avg on the official testing set, which ranked 1st in the competition. The detailed results for each video and the overall performance of the top two teams are shown in table \ref{tab:act_result}. As we can see we perform much better on a few videos such as hm\_in\_bus, hm\_in\_subway\_station, hm\_in\_fighting4 and hm\_in\_restaurant. However, there are also several videos that we did not perform as well as the 2nd place submission, such as the hm\_in\_dining\_room2 video. We suspect that this is because our person detection model is able to detect persons even when they are occluded, but it is hard for the downstream action model to classify the actions correctly, hence hurting the overall performance.
\begin{table} [t]
\fontsize{8pt}{12pt}\selectfont
\begin{center}
\caption{The top-2 results of HIE2020 testing set. The evaluation metric is wf-mAP@avg(\%).}
\label{tab:act_result}
\begin{tabular}{l|r|r}
\toprule
Video Name & 1st Place (Ours) & 2nd Place (VM) \\
\midrule
hm\_in\_waiting\_hall & 27.57 & 23.90 \\
hm\_in\_bus & 49.30 & 4.73 \\
hm\_in\_dining\_room2 & 12.23 & 16.71 \\
hm\_in\_lab2 & 36.27 & 37.87 \\
hm\_in\_subway\_station & 28.89 & 10.07 \\
hm\_in\_passage & 29.77 & 22.20 \\
hm\_in\_fighting4 & 44.10 & 22.08 \\
hm\_in\_shopping\_mall3 & 31.36 & 41.08 \\
hm\_in\_restaurant & 20.61 & 10.18 \\
hm\_in\_accident & 32.78 & 27.99 \\
hm\_in\_stair3 & 29.87 & 30.03 \\
hm\_in\_crossroad & 57.92 & 49.08 \\
hm\_in\_robbery & 17.36 & 11.79 \\
\midrule
Overall & \textbf{26.05} & 25.48 \\
\bottomrule
\end{tabular}
\end{center}
\vspace{-5mm}
\end{table}
\section{Conclusion}
In this paper, we describe the approach we used in the Person-level Action Recognition in Complex Events track in the HIE2020 Challenge, which achieved 1st place on the testing set. The overall framework is similar to other state-of-the-art spatio-temporal action localization methods where we first detect the persons in some key frames, and then perform action classification using with the help of 3D RoIAlign on the features extracted on a trimmed video clip. We perform extensive experiments and tuning for our person detector which helps to reduce the number of possible false negatives due to missing to localize a person. Then we employ a state-of-the-art action detection model and trained with extra self-collected data in addition to the whole training set. Furthermore, we add some post-processing operations according to human understanding of the actions.
\bibliographystyle{ACM-Reference-Format}
| {'timestamp': '2020-10-19T02:16:40', 'yymm': '2010', 'arxiv_id': '2010.08365', 'language': 'en', 'url': 'https://arxiv.org/abs/2010.08365'} | arxiv |
\section{Introduction}
Isolation, commonly using OS processes, is a cornerstone abstraction
for security. It allows us to isolate and limit software compromises
to one {\em fault domain} within an application and is the basis for
implementing the design principle of privilege separation. In the last
few years, user-level enclaves have become available in commodity CPUs
that support TEEs. A prime example of enclaved TEEs is Intel
SGX~\cite{sgxexplained}. Conceptually, enclaves are in sharp contrast
to processes in that they do not trust the privileged OS, promising a
drastic reduction in the TCB of a fault domain. This is why the design
of enclaved TEEs is of fundamental importance to security.
One of the big challenges with using today's enclaves is {\em
performance}. For example, many prior efforts have reported $1$--$2$
orders of magnitude slowdowns when supporting common
applications on SGX~\cite{ratel,graphene-sgx, scone, haven,occlum}.
This raises the question whether one can design enclaved TEEs which
have substantially better performance.
As a step towards this goal, we point towards one of the key
abstractions provided by enclaved TEEs---their memory model. The memory
model used in several existing TEEs
~\cite{armtrustzone,amd-sev,ferraiuolo2017komodo,
sgx,mckeen2016sgx,costan2016sanctum}, including SGX,
which originates from a long line of prior
works~\cite{bastion,overshadow}, follows what we call the {\em spatial
isolation model}. In this model, the virtual memory of the enclave is
statically divided into two types: {\em public} and {\em private}
memory
regions. These types are fixed throughout the region's lifetime. The
spatial isolation model is a simple but a rigid model, as its
underlying principle breaks compatibility with the most basic of data
processing patterns where data needs to privately computed on before
being made public or shared externally. In the spatial model,
traditional applications will need
to create multiple data copies when sharing across enclave
boundaries, and additionally encrypt data, if they desire security
from an untrusted OS. Consequently, to support abstractions like
shared memory, pipes, fast synchronization, IPC, file I/O, and others
on spatially-isolated memory, data has to be copied between public to
private memory regions frequently. This results in very high
overheads, a phenomenon reported in many frameworks
trying to re-enable compatibility on TEEs that use the spatial
model~\cite{ratel,occlum,graphene-sgx,scone,haven,dayeol2020keystone}.
In this work, we revisit the spatial isolation memory model adopted by
modern TEEs. We propose a new memory model called \textsc{Elasticlave}\xspace which
allows enclaves to share memory across enclaves and with the OS, with
more flexible permissions than in spatial isolation.
While allowing flexibility, \textsc{Elasticlave}\xspace does not make any simplistic
security assumptions or degrade its security guarantees over the
spatial isolation model. We view enclaves as a fundamental
abstraction for partitioning applications in this work, and therefore,
we assume that enclaves do {\em not} trust each other and can become
compromised during their lifetime.
The \textsc{Elasticlave}\xspace design directly eliminates the need for expensive data
copy operations, which are necessary in the spatial isolation model to
ensure security. The end result is that \textsc{Elasticlave}\xspace offers
$10\times$--$100\times$ better performance than spatially-isolated
TEEs with the same level of application-desired security.
The main challenge designing \textsc{Elasticlave}\xspace is providing sufficient
flexibility in defining security over shared memory regions, while
{\em minimizing complexity}. Relaxing the spatial isolation model such
that it allows enclaves to privately share memory between them,
without trusting a trusted OS as an intermediary, requires careful
consideration.
In particular, we want to allow enclaves to share a memory region and
be able to alter their permissions on the region over time, thereby
eliminating the need to create private copies. The permission
specification mechanism should be flexible enough to allow non-faulty
(uncompromised) enclaves to enforce any desirable sequence of
permission changes on the region which the application demands. At the
same time, we do {\em not} want the compromised OS or any other
enclaves that may have become compromised during runtime to be able to
escalate their privileges arbitrarily, beyond what was initially
agreed upon.
For instance, simply providing the equivalent of the traditional
shared memory and IPC interfaces (e.g., POSIX) can leave several
avenues of attacks unaddressed. The untrusted OS or
compromised enclaves may modify/read shared memory out of turn, create
TOCTOU attacks, intentionally create race conditions, re-delegate
permissions, and so on.
Thus, the \textsc{Elasticlave}\xspace interface is designed with abstractions that relax
the spatial model {\em minimally}. Further, a simple interface design
makes it easy to analyze the final security, and simultaneously, keeps
the implementation impact small.
We implement our design on an open-source, RTL-level \mbox{RISC-V}\xspace
$800$~MHz{}
processor~\cite{rocket}.
We evaluate performance and chip area impact of \textsc{Elasticlave}\xspace using a
cycle-level simulator~\cite{DBLP:conf/isca/KarandikarMKBAL18} on
several synthetic as well as real-world benchmarks. We observe that \textsc{Elasticlave}\xspace enables performance improvements of {\em $1$--$2$ orders of magnitude} over the spatial isolation model implemented in the same
processor configuration. We also show that \textsc{Elasticlave}\xspace has a modest cost
on implementation complexity. First, we show that the additional TCB
is than $7,000$ LoC.
Second, our benchmarking highlights that the performance overhead is
affected primarily by the number of enclave-to-enclave context
switches, i.e, it is independent of the size of shared data in a
region. Further, the increased hardware register pressure due to
\textsc{Elasticlave}\xspace does {\em not} increase the critical path of the synthesized
core for all tested configurations.
Third, the hardware area footprint scales well with the maximum number
of shared regions \textsc{Elasticlave}\xspace is configured to support. Specifically,
our estimated hardware area increase is below $1\%$ of our baseline
\mbox{RISC-V}\xspace processor, for every $8$ additional shared memory regions
\textsc{Elasticlave}\xspace TEE is configured to support.
\paragraph{Contributions.}
The paper proposes a new memory model for enclaved TEEs called
\textsc{Elasticlave}\xspace. We show that its design can result in significantly better
performance than the spatial isolation model. We offer a prototype
implementation on a \mbox{RISC-V}\xspace processor, with a modest hardware area impact.
\section{Problem}
\label{sec:problem}
TEE provides the abstraction of enclaves to isolate components of an application, which run with user-level privileges.
The TEE implementation (privileged hardware) is trusted and assumed to be bug-free.\footnote{TEEs are typically implemented in hardware and firmware. Our TEE implementation uses \mbox{RISC-V}\xspace hardware feature along with a privileged software monitor, executing in the firmware-equivalent software privileged layer.}
We want to design an efficient memory model for TEEs that support enclaves.
In our setup, a security-sensitive application is partitioned into multiple potentially
compromised (or faulty) components. Each component runs in a
separate enclave created by the TEE, which serves as a basic isolation primitive.
Enclaves are assumed to be {\em mutually-distrusting}, since they can
be compromised by the adversary during their execution, e.g., due to
software exploits. This assumption is of fundamental importance, as it
captures the essence of why the application is partitioned to begin
with. The memory model adopted by Intel SGX serves as a tangible
baseline to explain how a rigid security models can induce prohibitive
performance costs.
\begin{figure*}[!ht]
\centering
\subfloat[Producer-consumer\label{fig:problems-prod-cons}]{
\raisebox{-0.5\height}{\includegraphics[scale=0.33]{prod-cons-compact.pdf}}
}
\hspace*{0.05\linewidth}
\subfloat[Proxy\label{fig:problems-proxy}]{
\raisebox{-0.5\height}{\includegraphics[scale=0.35]{proxy-compact.pdf}}
}
\hspace*{0.05\linewidth}
\subfloat[Client-server\label{fig:problems-client-server}]{
\raisebox{-0.5\height}{\includegraphics[scale=0.35]{server-client-compact.pdf}}
}
\caption{Spatial ShMem\xspace baseline cost.
Gray color indicates public memory;
double-line border indicates the trusted coordinator.}
\label{fig:problems}
\end{figure*}
\subsection{Baseline: The Spatial Isolation Model}
\label{sec:baseline-model}
Most enclaves available on commodity processors, use a memory model
which we call the \emph{spatial isolation}
model~\cite{sgx,sgx2014progref, bastion, xom, aegis, mi6}, including Intel SGX, which follows many prior
proposals~\cite{bastion,overshadow}. In this model, each enclave
comprises two different types of non-overlapping virtual memory regions:
\begin{enumerate}
\item \emph{Private memory:}
exclusive to the enclave itself and inaccessible to all other
enclaves running on the system.
\item \emph{Public memory:}
fully accessible to the enclave and the untrusted OS, who may then
share it with other enclaves.
\end{enumerate}
The spatial model embodies the principle of dividing trust in an ``all
or none'' manner~\cite{ratel}. For each enclave, every other enclave
is fully trusted to access the public memory, whereas the private
memory is accessible only to the enclave itself.
This principle is in sharp contrast to any form of memory sharing,
which is extensively used when an enclave wants to exchange data with
the outside world, including with other enclaves. Memory sharing is
key to efficiency in I/O operations, inter-process communication,
multi-threading, memory mapping, signal-handling, and other standard
abstractions. Although shared memory is not directly possible to
implement in the spatial isolation model, it can be {\em simulated}
with message-passing abstractions instead. To discuss the limitations
of the spatial isolation concretely, we present a baseline for
implementing shared memory functionality in the spatial model next.
We refer to this baseline as the {\em spatial ShMem\xspace baseline.} Note
that this baseline is frequently utilized in many prior frameworks
that offer compatibility with Intel SGX~\cite{ratel, scone, graphene-sgx}.
\paragraph{The Spatial ShMem\xspace Baseline.}
This baseline simulates a shared memory abstraction between two
spatially isolated enclaves.
Observe that the two enclaves can keep a private copy of the shared
data. However, as the enclaves do not trust each other they cannot
access each other's local copy. Therefore, the shared data must
either reside in public memory, which may be mapped in the address
space of both the enclaves, or they must use message-passing (e.g., via
RPC) which itself must use the public memory. Any data or exchanged
messages using public memory are exposed to the untrusted OS.
Therefore, the spatial ShMem\xspace baseline requires a cryptographically secure
channel to be implemented on top of the public memory. Specifically,
the two enclaves encrypt data and messages before writing them to
public memory and decrypt them after reading them. We call this
a {\em secure public memory}. We can assume that the cryptographic
keys are pre-exchanged or pre-established securely by the enclaves.
A secure public memory is not sufficient to implement a shared memory
abstraction in the spatial ShMem\xspace baseline. Concurrently executing
enclaves may access data simultaneously and such accesses may require serialization in order to
maintain typical application consistency guarantees.
Notice that reads and writes to the secure public channel involves
encryption and decryption sub-steps, the atomicity of which is not
guaranteed by the TEE. No standard synchronization primitives
such as semaphores, counters, and futexes---which often rely on
OS-provided atomicity---remain trustworthy in the enclave threat model
we consider. Therefore, one simple way to serialize access is to use a
trusted mediator or coordinator enclave.
In the spatial ShMem\xspace baseline, we designate a third enclave as a
{\em trusted coordinator}. For achieving memory consistency, accesses
to shared memory are simulated with message-passing, i.e., read/writes
to shared memory are simulated with remote procedure calls to the
trusted coordinator, which implements the ``shared'' memory by
keeping its content in its private memory. For example, to implement a
shared counter, the trusted coordinator enclave keeps the counter in
its private memory, and the counter-party enclave can send messages to
the trusted coordinator for state updates.
We have assumed in our baseline that the coordinator is not faulty or
compromised. Attacks on the trusted coordinator can subvert the
semantic correctness of the shared memory abstraction. One can
consider augmenting this baseline to tolerate faulty coordinators
(e.g., using BFT-based mechanisms). But these mechanisms would only {\em increase} the performance costs and latencies,
reducing the overall throughput.
\subsection{Illustrative Performance Costs}
\label{sec:pattern-costs}
The spatial ShMem\xspace baseline is significantly more expensive to
implement than the original shared memory abstraction in a non-enclave
(native) setting. We refer readers to Section~\ref{sec:eval} for the
raw performance costs of the spatial ShMem\xspace baseline over the native.
The overheads can be $1$-$2$ orders of magnitude higher. This is
primarily because of the encryption-decryption steps and additional memory
copies that are inherent in the implementation of secure channel and
trusted coordinator. Several recent works have reported these costs
over hundreds of programs on the Intel SGX platform~\cite{occlum,
graphene-sgx, scone, ratel}. For instance Occlum reported overheads up
to $14\times$ as compared to native Linux execution~\cite{occlum}. We
present $3$ representative textbook patterns of data sharing that ubiquitously arise
in real-world applications and illustrate how spatial isolation incurs
such significant cost.
\paragraph{Pattern 1: Producer-Consumer.}
In this pattern, the producer enclave writes a stream of
data objects to shared memory for a consumer enclave to read and
process. Several applications use this for signaling completion of
sub-steps of a larger task, such as in MapReduce~\cite{vc3, m2r}. For
supporting this pattern with the spatial ShMem\xspace baseline, the producer
has to copy its output data to public memory first and then the
consumer enclave copies it to private memory. In summary, at least $2$
additional copies of the original shared data are created. Further,
the data is encrypted and decrypted once leading to $2$ compute
operations per byte and $1$ private copy in the trusted coordinator.
Figure~\ref{fig:problems-prod-cons} depicts the steps.
\paragraph{Pattern 2: Proxy.}
Many applications serve as a intermediate proxy between a producer and
consumer. For example, consider packet monitoring/filtering
application like \texttt{Bro}, \texttt{snort}, or \texttt{bpf} which
modifies the data shared between two end-point
applications. Proxy designs can be implemented using two instances of
the producer-consumer pattern, where the proxy acts as the consumer
for the first instance and producer for the second. However, in
practice, proxies often optimize by performing {\em in-place} changes
to the shared data rather than maintaining separate queues with the
end points~\cite{vif, sgx-box}. Such in-place memory processing is not
compatible with the spatial memory model. Applications which
originally use this pattern must incur additional memory copies. The
data stream must be placed in public memory, so that it can be passed to
the proxy enclave that acts as a trusted coordinator. But at the same
time, the proxy cannot operate on public memory in-place, or else it
would risk modifications by other enclaves. Therefore, there are at
least $2$ memory copies of the $2$ original shared data contents,
totaling $4$ copies when supporting this pattern with the spatial
ShMem\xspace baseline, as shown in Figure~\ref{fig:problems-proxy}. Further,
the data is encrypted and decrypted twice leading to $4$ compute
operations per byte.
\paragraph{Pattern 3: Client-Server.}
Two enclaves, referred to a client and a server, read and write shared
data to each other in this pattern. Each enclave reads the data
written by the other, performs private computation on it, and writes
back the computed result back to the shared memory. As explained, the
shared memory abstraction cannot directly be implemented with data
residing in a shared region of public memory since the OS and other
enclaves on the system are not trusted. For supporting such sharing
patterns, there will be at least $4$ data copies---one in server
private memory, one client private memory, and two for passing data
between them via a public memory. Further, the data is encrypted and
decrypted twice leading to $4$ compute operations per byte
(Figure~\ref{fig:problems-client-server}).
\begin{table}[!t]
\centering
\resizebox{0.4\textwidth}{!}{
\begin{tabular}{@{}lllllc@{}}
\toprule
\multicolumn{2}{c}{\multirow{2}{*}{\textbf{Pattern}}} & \multicolumn{3}{c}{\textbf{\begin{tabular}[c]{@{}c@{}}Spatial\end{tabular}}} & \textbf{\textsc{Elasticlave}\xspace} \\ \cmidrule(l){3-6}
\multicolumn{2}{c}{} & \textbf{Enc} & \textbf{Dec} & \textbf{Cpy} & \textbf{Instructions} \\ \midrule
1 & Producer-Consumer & $L$ & $L$ & $3 \cdot L$ & $2$ \\
2 & Proxy & $2 \cdot L$ & $2 \cdot L$ & $6 \cdot L$ & $4$ \\
3 & Client-Server & $L$ & $L$ & $3 \cdot L$ & $2$ \\ \bottomrule
\end{tabular}
}
\caption{Data sharing overheads of spatial isolation vs.
\textsc{Elasticlave}\xspace. $L$: data size (memory words) in the shared region.
}
\label{tab:overheads_summary}
\end{table}
\paragraph{Summary.} The spatial ShMem\xspace baseline requires
multiple data copies (see Figure~\ref{fig:problems}) to avoid attacks from the OS. Table~\ref{tab:overheads_summary} summarizes the encrypt/decrypt and copy operations incurred in our presented data patterns, assuming a region of $L$ memory words is shared and each word
is accessed once.
\subsection{Problem Formulation}
\label{sec:desired-properties}
The spatial isolation forces a rigid memory model. The type of
permissions of a memory region cannot change over time. The authority
which controls the permissions is fixed, i.e., the OS for public
memory and an enclave for private memory, regardless of the trust
model desired by the application.
We ask the following research question: {\em Does there exist a
minimal relaxation of the spatial model, which retains its
security guarantees, while eliminating its performance bottlenecks?}
\paragraph{Security Model.}
We assume that the OS is arbitrarily malicious and untrusted. The target application is partitioned into enclaves, which share one or more regions of memory. Each enclave has a {\em pre-agreed set of permissions}, which the application desires for its legitimate functionality. This set
does not change, and in a sense, is the maximum permissions an enclave
needs for that region at any point of time in the region's lifetime.
Any subset of enclaves can become compromised during the execution. We
refer to compromised enclaves as {\em faulty} which can behave arbitrarily.
While providing better performance, there are $2$ security properties we desire from our TEE. First, the TEE interface does not allow faulty (and non-faulty) enclaves to escalate their privileges beyond the pre-agreed set. The second property, loosely speaking, ensures that faulty enclaves cannot obtain access permissions to the shared region, i.e., outside of the sequence that non-faulty enclaves desire to enforce. We detail these $2$ properties in Section~\ref{sec:security_discussion}.
We additionally desire two soft goals.
\paragraph{Goal 1: Flexibility vs. Security.}
We aim to design a TEE memory model that offers security
comparable or better than our proposed baseline. A naive design, which
allows unfettered flexibility to control a region's permissions, can
expose enclaves to a larger attack surface than the baseline. Enclaves
may maliciously compete to become an arbiter of permissions for a
region. It may be difficult to enforce a single consistent global view
of the permissions that each enclave has to a shared region, if
permissions can change dynamically. This in turn may create TOCTOU
bugs, since enclaves may end up making trust decisions based on a
stale view of another enclave's current permissions.
Therefore, our goal is to strike a balance between flexibility
and security.
\paragraph{Goal 2: Minimizing Implementation Complexity.}
Enabling a new memory model may incur significant
implementation complexity. A complex memory model could introduce
expensive security metadata in hardware, increase the number of
signals, and introduce a large number of instructions. These can
directly lead to performance bottlenecks in the hardware
implementation, or have an unacceptable cost in chip area or power
consumption. Our goal is thus to keep the memory model {\em simple}
and minimize implementation complexity.
\paragraph{Scope.}
The TEE implementation is assumed to be bug-free. We aim to provide integrity,
confidentiality, and access control for shared memory data. We do not
aim to provide availability hence denial-of-service (DoS) attacks on
shared memory are not in-scope, since the OS may legitimately kill an
enclave or revoke access to memory. Further, our focus is on defining
a memory interface---micro-architectural implementation flaws and
side-channels are out of our scope. Lastly, if the TEE wishes to
safeguard the physical RAM or bus interfaces, it may require
additional defenses (e.g., memory encryption), which
are orthogonal and not considered here.
\begin{figure*}[!tb]
\centering
\subfloat[Producer-consumer (two-way
isolated) \label{fig:prod-cons-soln2}]{
\raisebox{-0.5\height}{\includegraphics[scale=0.325]{prod-cons-soln-1}}
}
\hfill
\subfloat[Proxy\label{fig:proxy-soln}]{
\raisebox{-0.5\height}{\includegraphics[scale=0.325]{proxy-soln-1}}
}
\hfill
\subfloat[Client-server\label{fig:client-server-soln}]{
\raisebox{-0.5\height}{\includegraphics[scale=0.325]{client-server-soln-1}}
}
\caption{Data sharing patterns with \textsc{Elasticlave}\xspace.
}
\label{fig:data-patt-solutions}
\end{figure*}
\section{The \textsc{Elasticlave}\xspace Memory Interface}
\label{sec:memory-interface}
\textsc{Elasticlave}\xspace is a relaxation of the spatial isolation model i.e.,
It allows enclaves to share memory regions more
flexibly.
\subsection{Overview}
\label{sec:overview}
\textsc{Elasticlave}\xspace
highlights the importance of $3$ key first-class abstractions that allow interacting enclaves to:
(a)~have individual {\em asymmetric
permission views} of shared memory regions, i.e., every enclave can
have their local view of their memory permissions;
(b)~{\em dynamically} change these permissions as long as
they do not exceed a pre-established maximum; and
(c)~obtain {\em exclusive} access rights over shared memory regions,
and transfer it atomically in a controlled manner to other enclaves.
As a quick point of note, we show that the above three abstractions
are sufficient to drastically reduce the performance costs highlighted
in Section~\ref{sec:pattern-costs}. In particular,
Table~\ref{tab:overheads_summary} shows that in \textsc{Elasticlave}\xspace, the number
of instructions is a small constant and
the number of data copies reduces to $1$ in all cases.
Whereas the spatial
ShMem\xspace baseline requires operations linear in the size $L$ of the
shared data accessed. We
will explain why such reduction is achieved in
Section~\ref{sec:patterns-solution}. But, in a brief glance at Figure~\ref{fig:data-patt-solutions} shows how the $3$ patterns can be implemented with a single shared memory copy, if the abstractions (a)-(c) are available. Notice how enclaves require different permission limits in
their views, which need to be exclusive sometimes, and how permissions change over time. For security, it is necessary that accesses made by enclaves are serialized in particular (shown) order.
Our recommendation for the $3$ specific \textsc{Elasticlave}\xspace abstractions is
intentional. Our guiding principle is simplicity and security---one could easily relax the spatial memory model further, but this comes at the peril of subtle security issues and increased implementation complexity. We discuss these considerations in Section~\ref{sec:security_discussion} after our design details.
\begin{figure*}[!ht]
\centering
\raisebox{-0.5\height}{\begin{minipage}[b]{0.68\linewidth}
{ \footnotesize
\begin{tabularx}{\linewidth}{XXX}
\toprule
\textbf{Instruction} &
\textbf{Permitted Caller} & \textbf{Semantics}\\
\midrule
\texttt{uid =
create(size)} & owner of \texttt{uid} & create a region \\
\texttt{err = map(vaddr, uid)} & accessor of \texttt{uid} & map
VA range to a region \\
\texttt{err = unmap(vaddr, uid)} & accessor of \texttt{uid} & remove
region mapping \\
\texttt{err = share(uid, eid, P)} & owner of \texttt{uid} &
share region with an
enclave \\
\texttt{err = change(uid, P)} & accessor of
\texttt{uid} & adjust the actual access permission to a memory
region \\
\texttt{err = destroy(uid)} & owner of \texttt{uid} & destroy a memory
region\\
\texttt{err = transfer(uid, eid)} & current lock holder & transfer lock to another
accessor \\
\bottomrule
\end{tabularx}
}
\captionof{table}{Summary of security instructions in \textsc{Elasticlave}\xspace.}
\label{tab:instructions}
\end{minipage}}
\hfill
\raisebox{-0.5\height}
{\begin{minipage}[b]{0.3\linewidth}
\centering
\includegraphics[width=0.65\linewidth]{lattice.pdf}
\captionof{figure}{Lattice for the permission hierarchy, or $\leq$ relation for permissions.}
\label{fig:permission_lattice}
\end{minipage}}
\end{figure*}
\subsection{\textsc{Elasticlave}\xspace Abstractions}
\textsc{Elasticlave}\xspace relaxes spatial isolation by allowing enclaves to define and
change permissions of regions shared externally. Our design works at
the granularity of {\textsc{Elasticlave}\xspace} {\em memory regions}. These
regions are an abstraction defined by our model; each region maps to a
contiguous range of virtual memory addresses in the enclave. From the view of each enclaves, an \textsc{Elasticlave}\xspace memory region has $4$ permission bits: standard {\em read}, {\em
write}, {\em execute}, and a protection {\em lock} bit.
For each memory region, we have two types of enclaves.
The first are {\em owners}, who have the sole privilege to create,
destroy, and initiate sharing of regions. The second kind of enclaves
are {\em accessors}. Owners can share and grant the permission to
accessors only for the regions they own. An enclave can be both an
owner and an accessor of a region.
\textsc{Elasticlave}\xspace gives $3$ first-class abstractions: {\em
asymmetry}, {\em dynamicity}, and {\em exclusivity} in an enclave's permission
views.
\paragraph{Asymmetric Permission Views.}
In several data patterns shown in Section~\ref{sec:pattern-costs},
one can see that different enclaves require different permissions of
the shared memory. For example, one enclave has read accesses whereas
others have write-only access. The spatial model is a ``one size fits
all'' approach that does not allow enclaves to setup asymmetric
permissions for a public memory region securely---the OS can always
undo any such enforcement that enclaves might specify via normal
permission bits in hardware.
In \textsc{Elasticlave}\xspace, different enclaves are allowed to specify their own set
of permissions (or {\em views}) over the same shared region, which are
enforced by the TEE. This directly translates to avoiding the costs of
creating data copies into separate regions, where each region has a
different permission.
For example, in Pattern 1 the producer has read-write permissions and
the consumer has read-only permissions for the shared queue.
\paragraph{Dynamic Permissions.}
In \textsc{Elasticlave}\xspace, enclaves can change their permissions over time,
without seeking consent from or notifying other enclaves. In the
spatial isolation model, if enclaves need different permissions over
time on the same shared data, separate data copies are needed.
\textsc{Elasticlave}\xspace eliminates the need for such copies.
For example, in Pattern 2, when the source enclave generates data it
has read-write permissions, while the proxy enclave has no
permissions. After that, the source drops all its permissions, and
proxy enclave gains read-write permissions to process the data. This
way, both source and proxy enclaves do not interfere with each others
operations on the shared region.
While enabling dynamic permissions, \textsc{Elasticlave}\xspace does not allow enclaves
to arbitrarily escalate their permissions over time. In \textsc{Elasticlave}\xspace,
only the owner can share a memory region with other accessors during the
lifetime of the memory region. When the owner shares a memory region, it sets
the {\em static maximum} permissions it wishes to allow for the
specified accessor at any time. This static maximum cannot be changed
once set by the owner for a specified enclave. Accessors can escalate
or reduce their privileges dynamically. But if the accessor tries to
exceed the static maximum at any given point in time, \textsc{Elasticlave}\xspace
delivers a general protection fault to the accessor enclave.
\paragraph{Exclusive Locks.}
\textsc{Elasticlave}\xspace incorporates a special bit for each memory region called the
{\em lock} bit. This bit serves as a synchronization mechanism between
enclaves, which may not trust each other. \textsc{Elasticlave}\xspace ensures that at
any instance of time only one accessor has this bit set, thereby
enforcing that it has an exclusive access to a region. When this bit
is on, only that accessor is able to access it---all other accessors
have their permissions temporarily disabled. When the lock is acquired
and released by one enclave, all accessors and the owner of that
region are informed through a hardware exception/signal. Lock holders
can release it generically without specifying the next holder or can
atomically transfer the lock to other accessors through {$\tt{transfer}$}\xspace
instruction. Atomic transfers become useful for flexible but
controlled transfer of exclusive access over regions. For example, in
Pattern 2, the source holds the lock bit for exclusive access to the
region for writing its request. Thus, no one can tamper with the
packet while the source writes to it.
Then, the source transfers the lock directly
to the proxy. Proxy exclusively accesses the region to update the
packet and then transfers the lock to the destination. Only then the destination can read
the updated packet.
\subsection{Design Details}
\label{sec:design}
\textsc{Elasticlave}\xspace is a memory interface specification consisting of $7$
instructions, summarized in Table~\ref{tab:instructions}, which
operate on \textsc{Elasticlave}\xspace memory regions. Each \textsc{Elasticlave}\xspace region is
addressable with a {\em universal} identifier that uniquely identifies
it in the global namespace. Universal identifiers can be mapped to
different virtual addresses in different enclaves, and at the same
time, are mapped to physical addresses by a \textsc{Elasticlave}\xspace implementation.
The \textsc{Elasticlave}\xspace interface semantics are formalized as pre- and post-conditions
in Appendix~\ref{sec:appx}, which any secure implementation of this interface should satisfy.
Next, we explain the
\textsc{Elasticlave}\xspace design by walking through the typical lifecycle of a region.
\paragraph{Owner View.}
Each memory region $r$ has a unique owner enclave throughout its
lifetime.
An enclave $p$ can create a new memory region $r$ with {$\tt{create}$}\xspace instruction, which takes the memory region size
and returns a universal id ({$\tt{uid}$}\xspace). The enclave $p$ is the owner of
the new memory region $r$.
The owner permissions are initialized to an owner-specified safe
maximum. These permissions
are bound to a
memory region. The owner, just like any accessor, can bind the memory
region to its virtual address space by using {$\tt{map}$}\xspace and {$\tt{unmap}$}\xspace
instructions. The {$\tt{map}$}\xspace instruction takes a {$\tt{uid}$}\xspace for the region
and the virtual address range to map to it. A memory region can be
mapped at multiple virtual address in an enclave, but the static
permissions bound to the region at the time of creation apply to all
instances mapped in the virtual address space.
The owner can then share the memory with any other enclave using the
{$\tt{share}$}\xspace instruction, which specifies the {$\tt{uid}$}\xspace of the memory
region, the enclave id of the other accessor, and the static maximum
permissions allowed for that accessor.
Every accessor, including the owner, can dynamically change the
permissions of a memory as long as the permissions are strictly more
restrictive (fewer privileges) than the static maximum for the
enclave. For the owner, the static maximum is the full set of
permissions, and for other accessors, it is determined by the {$\tt{share}$}\xspace
instruction granting the access. The changes to such permissions are
local to each accessor, i.e., permission changes are not globally
effected for all accessors; rather they apply to each enclave
independently. The lattice shown in
Figure~\ref{fig:permission_lattice} defines the permission hierarchy.
Finally, the owner can destroy the memory region at any point in time
by invoking the {$\tt{destroy}$}\xspace instruction. \textsc{Elasticlave}\xspace sends all accessors a
signal when the owner destroys a memory region. Destroying a region
ends the lifetime in all enclaves. The OS can invoke the {$\tt{destroy}$}\xspace
instruction on an enclave to reclaim the memory region or to protect
itself from denial-of-service via the enclave.
\paragraph{Accessor's View.}
The accessor binds a memory region in its virtual address space using
the {$\tt{map}$}\xspace instruction; the same way as owners do. The initial
permissions of the memory region are set to static maximum allowed by
the owner (specified by the owner in the {$\tt{share}$}\xspace instruction). The
accessor can restrict its permissions dynamically further at any time
as long as the resulting permissions are below this static maximum
using the {$\tt{change}$}\xspace instruction. Such changes, as mentioned previously,
remain locally visible to the accessor enclave.
\paragraph{Permission Checks.}
The \textsc{Elasticlave}\xspace TEE implementation enforces the permissions defined by
enclaves in their local views. A permission bit is set to $1$ if the
corresponding memory access (read, write, or execute) is allowed, and
set to $0$ otherwise. For memory accesses, the security checks
can be summarized by two categories:
(1) availability check of the requested resources (e.g., memory
regions and enclaves), which ensures that instructions will not be
performed on non-existing resources; and (2) permission checks of the
caller, which ensures that the caller has enough privilege to perform
the requested instruction. Table~\ref{tab:instructions} defines the permitted caller for each instruction. For example, {$\tt{share}$}\xspace and {$\tt{destroy}$}\xspace
instructions can only be performed by the owner of the region.
The {$\tt{change}$}\xspace instruction is the mechanism for dynamically updating
permissions of a \textsc{Elasticlave}\xspace region. \textsc{Elasticlave}\xspace requires that the newly requested permissions ($perm$) by an enclave fall within the limits of its static maximum permissions ($max$).
Specifically, \textsc{Elasticlave}\xspace checks that $perm \leq max$, where
the $\leq$ relation is defined by the lattice shown in Figure~\ref{fig:permission_lattice}. The lock bit
can only be held (set to $1$) in the local view of a single
enclave at any instance of time. When it is set for one enclave,
that enclave's local permission bits are enforced, and
all other enclaves have no access to the region.
When lock is set to $0$ in the local views of all enclaves, permissions of each enclave are as specified in its local view.
\begin{figure}[!tb]
\end{figure}
\paragraph{Lock Acquire \& Release.}
Accessors can attempt to ``acquire'' or ``release'' the lock by using
the {$\tt{change}$}\xspace instruction. It returns the accessor's modified
permissions, including the lock bit that indicates whether the acquire
/ release was successful. \textsc{Elasticlave}\xspace ensures that at any instance of
time, only a single enclave is holding the lock. If any other enclave
accesses the region or tries to issue a {$\tt{change}$}\xspace instruction on that
region's permissions, these requests will be denied.
A lock holder can use the {$\tt{change}$}\xspace instruction to release locks;
however, there are situations where the holder wishes to explicitly
specify who it intends to be next holder of the lock. \textsc{Elasticlave}\xspace allows
lock holder to invoke a {$\tt{transfer}$}\xspace instruction which specifies the
enclave id of the next desired accessor. The next holder must have the
memory region mapped in its address space for the transfer to be
successful.
\paragraph{\textsc{Elasticlave}\xspace Exceptions \& Signals.}
\textsc{Elasticlave}\xspace issues exceptions whenever memory operations violating any
permission checks are made by an enclave. \textsc{Elasticlave}\xspace notifies enclaves
about events that affect the shared memory region via asynchronous
signals.
Signals are issued under two scenarios.
First, when the owner destroys a memory region $r$, permissions
granted to other enclaves will be invalidated since the memory region
is not in existence. In order to prevent them from continuing without
knowing that the memory region can no longer be accessed, the security
enforcement layer will send signals to notify all accessors who had an
active mapping (i.e., mapped but not yet unmapped) for the destroyed
memory region.
The second scenario for signals is to notify changes on lock bits.
Each time an accessor successfully acquires or releases the lock
(i.e., using {$\tt{change}$}\xspace or {$\tt{transfer}$}\xspace instructions), a signal is issued to
the owner. The owner can mask such signals if it wishes to, or it can
actively monitor the lock transfers if it desires. When a transfer
succeeds, the new accessor is notified via a signal.
Lastly, we point out that \textsc{Elasticlave}\xspace explicitly does not introduce
additional interface elements, for example, to allow enclaves to
signal to each other about their intent to acquire locks, or to prevent starvation. Section~\ref{sec:security_discussion} discusses these considerations to avoid interface complexity.
\subsection{Performance Benefits}
\label{sec:patterns-solution}
\textsc{Elasticlave}\xspace relaxes the spatial isolation model by introducing
flexibility in specifying permissions over shared regions. We now
revisit the example patterns discussed in
Section~\ref{sec:pattern-costs} to show these patterns can be
implemented with significantly lower costs (summarized in
Table~\ref{tab:overheads_summary}) with \textsc{Elasticlave}\xspace.
\paragraph{Revisiting Pattern 1: Producer-Consumer.}
Application writers can partition the producer and consumer into two
enclaves that share data efficiently with \textsc{Elasticlave}\xspace. We can consider
two scenarios of faulty enclaves. The first allows one-way protection,
where the producer safeguards itself from a faulty consumer. The
second offers mutual protection where faults in either enclave do not
spill over to the other.
\begin{figure}[!tb]
\centering
\includegraphics[width=0.8\linewidth]{prod-cons-soln1}
\caption{One-way isolated producer-consumer pattern with \textsc{Elasticlave}\xspace.
The producer writes to a memory region (R1) shared with consumer; consumer
is only allowed to read.
}
\label{fig:prod-cons-soln1}
\end{figure}
In the one-way isolation scenario, the producer can create a memory
region and share it with the consumer with the maximum permission set
to $\tt{r{}-{}-{}-}$. The producer and the consumer can then keep
their permissions to $\tt{r{}w{}-{}-}$ and $\tt{r{}-{}-{}-}$
respectively, which allow the producer to read and write data and the
consumer to only read data in the memory region
(Figure~\ref{fig:prod-cons-soln1}). The producer can directly write
its data to the shared memory region, and the consumer can directly
read from it without needing to moving the data back and forth between
the shared memory region and their private memory. The producer can
ensure that the consumer, even if compromised, cannot maliciously race
to modify the data while it is being updated in a critical section by
the producer. The whole process does not involve any extra data copies
or a cryptographically secure public memory, and only introduces fixed
costs of setting up and destroying the memory regions.
Two-way isolation is desired when both producer and consumer wish to
modify shared data in-place, while assuming that the other is faulty.
As a simple example, counters in shared queue data structures often
require atomic updates. In general, the producer and consumer may want
to securely multiplex their access to any amount of shared data (e.g.,
via shared files or pipes) for performing in-place updates. \textsc{Elasticlave}\xspace
makes this possible without creating any additional memory copies or
establishing secure channels. The shared memory region can be created
by (say) the producer and shared with the consumer with a static
maximum permission of $\mathtt{r{}w{}-{}l}$ as shown in
Figure~\ref{fig:prod-cons-soln2}. When either of them wish to acquire
exclusive access temporarily, they can use the {$\tt{change}$}\xspace instruction,
setting it from $0$ to $1$. Therefore, the only overhead incurred is
that of the execution of the {$\tt{change}$}\xspace instruction itself, which is in
sharp contrast to the $2$ copies of the entire shared data required in
spatial isolation model.
\paragraph{Revisiting Pattern 2: Proxy.}
The proxy example can be seen as a straight-forward sequential
stitching of two producer-consumer instances. The shared data would
first be written by the producer, then the proxy atomically reads or
updates it, and then the consumer would read it. All three entities
can hold the lock bit in this order to avoid any faulty enclave to
access the shared memory where unintended.
\textsc{Elasticlave}\xspace transfer instruction eliminates windows of attack when
passing the locks from one enclave to another.
Specifically, it allows the source to atomically transfer the lock to
proxy, who then atomically transfers it to the consumer. In this way,
the proxy workflow can be implemented without any extra copy of the
shared data as shown in Figure~\ref{fig:proxy-soln}.
\paragraph{Revisiting Pattern 3: Client-Server.}
The client-server workflow can similarly be executed by keeping a
single copy of the shared data, as shown in
Figure~\ref{fig:client-server-soln}, which reduces the number of data
copies from $6$ in the case of spatial isolation to $1$.
\paragraph{Compatibility with Spatial Isolation.}
It is easy to see that \textsc{Elasticlave}\xspace is strictly more expressive than
spatial isolation model, and hence keeps complete compatibility with
designs that work in the spatial isolation model. Setting up the
equivalent of the public memory is simple---the owner can create the
region and share it with $\mathtt{r{}w{}x{}-}$ for all. Private memory
simply is not shared after creation by the owner.
\paragraph{Privilege De-escalation Built-in.}
In \textsc{Elasticlave}\xspace, enclaves can self-reduce their privileges below the
allowed maximum, without raising any signals to other enclaves. This
design choice enables compatibility with several other low-level
defenses which enclaves may wish to deploy for their own internal
safety---for example, making shared object be non-executable, or
write-protecting shared security metadata.
\subsection{Security \& Simplicity}
\label{sec:security_discussion}
We begin by observing that it is straight-forward to implement the
\textsc{Elasticlave}\xspace interface with an (inefficient) trusted enforcement layer
using spatially isolated memory\footnote{The
enforcement layer would be implemented by a trusted enclave, which
would keeps the shared memory content and the permission matrix in its
{\em private} memory. Each invocation of a \textsc{Elasticlave}\xspace instruction
would translate to a RPC call to the enforcement enclave, which could
simply emulate the stated checks in Table~\ref{tab:instructions} and
Appendix~\ref{sec:appx} as
checks on its matrix.}. It follows that any memory permission
configurations which may be deemed as ``attacks'' on the \textsc{Elasticlave}\xspace
would also be admissible in a faithful emulation on the spatial
isolation model. In this sense, \textsc{Elasticlave}\xspace does {\em not degrade
security} over the spatial isolation model. The primary highlight of
\textsc{Elasticlave}\xspace is the performance gains it enables without degrading security.
We point out two desirable high-level security properties that
immediately follow from the \textsc{Elasticlave}\xspace interface
(Table~\ref{tab:instructions}). Application writers can rely on these
properties without employing any extra security mechanisms.
\paragraph{Property 1: Bounded Escalation.}
If an owner does not explicitly authorize an enclave $p$ access to a
region $r$ with a said permission, $p$ will not be able to obtain that
access.
This property follows from three design points:
(a)~Only the owner can change the set of enclaves that can access a
region. Non-owner enclaves cannot grant access permissions to other
enclaves since there is no permission re-delegation instruction in the
interface.
(b)~Each valid enclave that can access a region has its permissions
bounded by an owner-specified static maximum.
(c)~For each access or instruction, the accessor enclave and the
permission is checked to be legitimate by each instruction in the
interface (see Table~\ref{tab:instructions}).
\paragraph{Property 2: Enforceable Serialization of Non-faulty Enclaves.}
If the application has a pre-determined sequence in which accesses of
non-faulty enclaves should be serialized, then \textsc{Elasticlave}\xspace can guarantee
that accesses obey that sequence or will be aborted. Specifically, let
us consider any desired sequence of memory accesses on an \textsc{Elasticlave}\xspace
region $a_1,a_2,\dots,a_n$ and assume that all enclaves performing
these accesses are uncompromised.
Then, using \textsc{Elasticlave}\xspace, the application writer can guarantee that its
sequence of accesses will follow the desired sequence, even in the
presence of other faulty enclaves, or can be aborted safely.
The property can be enforced by composing two \textsc{Elasticlave}\xspace abstractions:
(a)~For each access $a_i$ by an enclave $e(a_i)$ in the pre-determined
sequence, the accessor can first acquire the lock to be sure that no
other accesses interfere.
(b)~When the accessor changes, say at access $a_j$, the
current enclave $e(a_j)$ can safely hand-over the lock to the next
accessor $e(a_{j+1})$ by using the {$\tt{transfer}$}\xspace instruction. Faulty
enclaves cannot acquire the lock and access the region at any
intermediate point in this access chain. For example, in
Pattern 2 (proxy), once the proxy enclave modifies
the data in-place, simply releasing the lock is not {\em safe}. A
faulty source enclave can acquire the lock before the destination does
and tamper with the data. However, the proxy can eliminate such an
attack from a racing adversary using the {$\tt{transfer}$}\xspace instruction.
\paragraph{Simplicity.}
Several additional design decisions make \textsc{Elasticlave}\xspace simple to reason
about. We discuss two of these: forcing applications to use {\em
local-only views} in making trust decisions and {\em minimizing
interface complexity}.
Each enclave is asked to make security decisions based only on its own
{\em local} view of its current and static maximum permissions. This
is an intentional design choice in \textsc{Elasticlave}\xspace to maintain simplicity. One
could expose the state of the complete access control (permission)
matrix of all enclaves to each other, for enabling more flexible or
dynamic trust decisions between enclaves.
However, this would also add complexity to application writers.
All enclaves would need to be aware of any changes to the global
access permissions, and be careful to avoid any potential TOCTOU
attacks when making any trust decisions based on it.
To simplify making trust decisions, the only interface in \textsc{Elasticlave}\xspace
where an enclave assumes a global restriction on the shared memory is
the lock bit. When using this interface, the lock holder can assume
that it is the only holder of the lock globally.
\textsc{Elasticlave}\xspace admits a simpler TEE implementation. The interface avoids
keeping any metadata that changes based on shared memory state (or
content). The TEE hardware can keep all security-relevant metadata in
access control tables, for instance. Since enclaves do not have
visibility into the global view of permissions of all other enclaves,
the TEE does not need to set up additional mechanisms to notify
enclaves on changes to this table (e.g., via signals). Further,
\textsc{Elasticlave}\xspace does {\em not} provide complete transaction memory
semantics, i.e., it does not provide atomic commits or memory
rollbacks, which come with their own complexity~\cite{rote}.
Similarly, consider starvation: A malicious or buggy
enclave may not release the lock. A more complex interface than
\textsc{Elasticlave}\xspace would either require the TEE to arbitrate directly or allow
the owner to do so, say to have memory be released within a time
bound.
However, such a solution would come with considerable interface
complexity. It would open up subtle attack avenues on the lock holder.
For instance, the enclave could lose control of the shared memory when
its contents are not yet safe to be exposed.
Instead, \textsc{Elasticlave}\xspace simply allows owners to be notified when enclaves
issue requests to acquire locks via the {$\tt{change}$}\xspace instruction. Enclaves
can implement any reasonable policy for starvation---for example, to
tear down the memory securely if a lock holder is unresponsive or
repeatedly acquiring locks to the region.
\section{Implementation on \mbox{RISC-V}\xspace}
\label{sec:implementation}
We build a prototype implementation of \textsc{Elasticlave}\xspace on an open-source
RocketChip quad-core SoC~\cite{riscvpriv, rocket}. We utilize $2$
building blocks from the \mbox{RISC-V}\xspace architecture, namely its physical
memory protection (PMP) feature and the programmable machine-mode
($\tt{m-mode}$). Note that \textsc{Elasticlave}\xspace does not make any
changes to the hardware.
We use Keystone---an open-source framework for
instantiating new security TEEs such as
\textsc{Elasticlave}\xspace~\cite{dayeol2020keystone}. Keystone provides a Linux driver
and a convenient SDK to create, start, resume, and terminate enclaves
by using the aforementioned features. It supports
$\tt{gcc}$ compiler and has C/C++ library to
build enclave applications. Keystone originally uses the spatial
isolation model, which we do not.
\paragraph{\mbox{RISC-V}\xspace PMP and $\tt{m-mode}$.}
The physical memory protection (PMP) feature of \mbox{RISC-V}\xspace allows software
in machine-mode (the highest privilege level in \mbox{RISC-V}\xspace) to restrict
physical memory accesses of software at lower privilege levels
(supervisor- and user-modes). Machine-mode software achieves this by
configuring PMP entries, which are a set of registers in each CPU
core. Each PMP register holds an entry specifying one contiguous
physical address range and its corresponding access permissions.
Interested readers can refer to the \mbox{RISC-V}\xspace standard PMP
specifications~\cite{riscvpriv}.
The \textsc{Elasticlave}\xspace TEE implementation runs as $\tt{m-mode}$ software. All the
meta-data about the memory regions, owners, static maximums, and the
current view of the permission matrix are stored in here.
The $\tt{m-mode}$ is the only privilege-level that can modify PMP entries.
Thus, the OS ($\tt{s-mode}$) and the enclave ($\tt{u-mode}$) cannot read
or update any PMP entries or meta-data.
When the enclave invokes any \textsc{Elasticlave}\xspace instruction, the execution traps
and the hardware redirects it to the $\tt{m-mode}$. This control-flow
cannot be changed by $\tt{s-mode}$ or $\tt{u-mode}$ software.
After entering $\tt{m-mode}$, \textsc{Elasticlave}\xspace first checks whether
the caller of the instruction is permitted to make the call. If it is a valid entity who is permitted to invoke this instruction, \textsc{Elasticlave}\xspace performs the meta-data, and if necessary, PMP updates.
\textsc{Elasticlave}\xspace keeps two mappings in its implementation:
(a)~virtual address ranges of each enclave and the corresponding
\textsc{Elasticlave}\xspace region universal identifier (uid); and (b)~the effective physical address range to which each uid is mapped.
Thus, when an enclave tries to access a virtual address, \textsc{Elasticlave}\xspace
performs a two-level translation: from virtual address to a uid and
subsequently to the physical address.
The {$\tt{map}$}\xspace and {$\tt{unmap}$}\xspace instruction only require updating the
first mapping, as they update virtual to uid mappings only. The
{$\tt{change}$}\xspace, {$\tt{share}$}\xspace, and {$\tt{transfer}$}\xspace only update the second
mapping because they only change permission bits without affecting
virtual memory to uid bindings. The {$\tt{create}$}\xspace and {$\tt{destroy}$}\xspace
instructions update both mappings. For enforcing access checks, the
\textsc{Elasticlave}\xspace TEE additionally maintains a permissions matrix of the
current and the static maximum permissions of each enclave.
Permissions are associated with uids, not with virtual addresses.
For enforcement, the TEE translates uid permissions in the permission
matrix to physical memory access limits via PMP entries. Whenever the
permission matrix is updated by an enclave, the permission updates
must be reflected into the access limits in PMP entries. Further, one
PMP entry is reserved by \textsc{Elasticlave}\xspace to protects is internal mappings
and security data structures.
The \mbox{RISC-V}\xspace specification limits the number of PMP registers to $16$.
Since each region is protected by one PMP entry, this fixes the
maximum number of regions allowable across all enclaves simultaneously.
This limit is not due to \textsc{Elasticlave}\xspace design, and one can increase the
number of PMP entries and \textsc{Elasticlave}\xspace only increases the needed PMP
entries by $1$.
When context-switching from one enclave to another, apart from
the standard register-save restore, Keystone modifies PMP entries to
disallow access to enclave private memory---this is because it uses a
spatial isolation design.
We modify this behavior to allow continued access to shared regions
even when the owner is not executing for \textsc{Elasticlave}\xspace.
\section{Evaluation}
\label{sec:eval}
We aim at evaluate the following research questions:
\begin{itemize}
\item How does the performance of \textsc{Elasticlave}\xspace compare with
spatial ShMem\xspace baseline on
\mbox{RISC-V}\xspace?
\item What is the impact of \textsc{Elasticlave}\xspace on privileged software
trusted code base (TCB) and hardware complexity?
\end{itemize}
We implement the spatial ShMem\xspace baseline and \textsc{Elasticlave}\xspace on the same hardware
core, in order to singularly measure the difference between the
spatial and our \textsc{Elasticlave}\xspace design.
Production-grade TEEs, such as Intel SGX, often have additional
mechanisms (e.g., hardware-level memory encryption, limited size of private physical memory,
etc.) which are orthogonal to the performance gains due to our
proposed memory model. Our implementation and evaluation exclude these
overheads.
\paragraph{Benchmarks.}
We experiment with $2$ types of benchmarks, using both our \textsc{Elasticlave}\xspace
implementation and the described spatial ShMem\xspace baseline (Section~\ref{sec:baseline-model}) on the same \mbox{RISC-V}\xspace core:
(a) simple synthetic programs we constructed that
implement the $3$ data patterns with varying number of regions and
size of data. We also construct synthetic thread synchronization
workloads with controllable contention for locks.
(b)
standard pre-existing real-world benchmarks, which include I/O
intensive workloads (IOZone~\cite{iozone}), parallel computation
(SPLASH-2~\cite{splash,splash-summary}), and CPU-intensive benchmarks (machine
learning inference with Torch~\cite{privado,
torch}). We manually modify these benchmarks to add \textsc{Elasticlave}\xspace
instructions, since we do not presently have a compiler for \textsc{Elasticlave}\xspace.
\paragraph{Experimental Setup.}
We use a cycle-accurate, FPGA-accelerated
(FireSim~\cite{DBLP:conf/isca/KarandikarMKBAL18}) simulation of
RocketChip~\cite{rocket}. Each system consists of $4$ RV64GC
cores, a 16KB instruction and data caches, $16$ PMP
entries per core (unless stated otherwise), and a
shared 4MB L2 cache. Area numbers were computed using a commercial
22nm process with Synopsys Design Compiler version L-2016.03-SP5-2
targeting $800$~MHz{}. Other than varying the number of PMP entries, we
do not make any changes to RocketChip.
\subsection{Performance of \textsc{Elasticlave}\xspace}
\label{sec:temporal_vs_spatial}
To evaluate the performance of \textsc{Elasticlave}\xspace vs. spatial isolation, we
first used synthetic benchmarks that cover common types of data
sharing behaviors in applications, including the data sharing patterns
introduced in Section~\ref{sec:baseline-model}.
\begin{figure*}[!tb] \centering
\subfloat[Producer-consumer]{
\includegraphics[width=0.27\linewidth]{icall-consumer.pdf}
}
\subfloat[Proxy]{
\includegraphics[width=0.27\linewidth]{icall-proxy.pdf}
}
\subfloat[Client-server]{
\includegraphics[width=0.27\linewidth]{icall-server.pdf}
}
\caption{Performance of the $3$ data-sharing patterns.}
\label{fig:icall_results} \end{figure*}
\begin{figure*}[!tb] \centering
\subfloat[\textsc{Elasticlave}\xspace-full]{
\includegraphics[width=0.27\linewidth]{icall-breakdown-temporal.pdf}
}
\subfloat[\textsc{Elasticlave}\xspace-nolock\label{fig:breakdown_nolock}]{
\includegraphics[width=0.27\linewidth]{icall-breakdown-nolock.pdf}
}
\subfloat[\stname{spatial}\xspace]{
\includegraphics[width=0.27\linewidth]{icall-breakdown-spatial.pdf}
}
\caption{Performance breakdown for the proxy pattern.}
\label{fig:icall_breakdown}
\end{figure*}
\paragraph{Synthetic Benchmark: Data-Sharing Patterns.}
We construct synthetic benchmarks for
the $3$ patterns in Section~\ref{sec:baseline-model} and
measure data sharing overhead (excluding any actual data processing). We set up $2$ (for producer-consumer and client-server)
or $3$ (for the proxy pattern) enclaves and compare: (a)~full
\textsc{Elasticlave}\xspace support as described in Section~\ref{sec:design}
(\textsc{Elasticlave}\xspace-full); (b)~\textsc{Elasticlave}\xspace without the lock permission bit design
(\textsc{Elasticlave}\xspace-nolock); and (c)~spatial isolation which transfers data
through secure public memory. Figure~\ref{fig:icall_results} shows the
performance for $3$ patterns. Figure~\ref{fig:icall_breakdown} shows the
breakdown for the proxy pattern.
\emph{Observations:}
The results exhibit a huge performance improvement of \stname{\textsc{Elasticlave}\xspace}\xspace-full
over \stname{spatial}\xspace, which increases with an increase in the record size.
When the record size is $512$ bytes, \stname{\textsc{Elasticlave}\xspace}\xspace-full provides over
$60\times$ speedup compared with \stname{spatial}\xspace; when the record size
increases to $64$KB the speedup also increases and reaches
$600\times$. In \stname{\textsc{Elasticlave}\xspace}\xspace-full, although invoking security
instructions is a large contributor to the overhead, by doing this the
application eliminates copying and communication through secure public
memory. As a result, the total overhead of \stname{\textsc{Elasticlave}\xspace}\xspace-full does not
increase with the size of the transferred data, unlike \stname{spatial}\xspace.
Note that \stname{\textsc{Elasticlave}\xspace}\xspace-full corresponds to a two-way isolation paradigm
highlighted in Section~\ref{sec:pattern-costs}.
\stname{\textsc{Elasticlave}\xspace}\xspace-nolock, the design of \textsc{Elasticlave}\xspace with the lock permission
bit removed, is shown to be more costly than \stname{\textsc{Elasticlave}\xspace}\xspace-full with
overhead that increases with the data size.
Figure~\ref{fig:icall_breakdown} indicates that this is because
\stname{\textsc{Elasticlave}\xspace}\xspace-nolock does not completely eliminate data copying.
\paragraph{Synthetic Benchmark: Thread Synchronization.}
We implement a common workload for spinlocks between threads, each
of which runs in a separate enclave, but both do not trust the OS.
For \textsc{Elasticlave}\xspace, we further distinguish simple spinlocks
(\textsc{Elasticlave}\xspace-spinlock) and {$\tt{futex}$}\xspace{}es (\textsc{Elasticlave}\xspace-futex). For spinlocks,
we keep the lock state in a shared region with no access to the OS.
For futexes, the untrusted OS has read-only access to the lock states,
which allows enclaves to sleep while waiting for locks and be woken up
by the OS when locks are released. This form of sharing corresponds
the one-way isolation described in Section~\ref{sec:pattern-costs},
where the OS has read-only permissions.
For \stname{spatial}\xspace, we implement a dedicated trusted
coordinator enclave to manage the lock states, with
enclaves communicating with it through secure public memory for lock
acquisition and release.
\emph{Observations:}
We report that \textsc{Elasticlave}\xspace-futex and \textsc{Elasticlave}\xspace-spinlock
achieve much higher performance compared with \stname{spatial}\xspace (Figures~\ref{fig:lock-basic}), especially
when the contention is low (the lock is acquired and released often).
For higher contention where the time spent waiting for
the lock overshadows the overhead of acquiring and releasing the lock,
the $3$ settings have comparable performance.
In addition,
\textsc{Elasticlave}\xspace-futex achieves up to $1.5\times$ CPU-time performance
improvement over \textsc{Elasticlave}\xspace-spinlock despite having no advantage in
terms of real-time performance (wall-clock latency).
Figure~\ref{fig:lock-futex} shows the performance of
\stname{\textsc{Elasticlave}\xspace}\xspace-futex vs \stname{\textsc{Elasticlave}\xspace}\xspace-spinlock.
\begin{figure}[!tb]
\centering
\includegraphics[width=0.75\linewidth]{lock-basic.pdf}
\caption{Synthetic Thread Synchronization Performance. Cycles
(normalized by the contention).}
\label{fig:lock-basic}
\end{figure}
\begin{figure}[!tb]
\centering
\includegraphics[width=0.7\linewidth]{lock-colour.pdf}
\caption{
\stname{\textsc{Elasticlave}\xspace}\xspace-futex vs \stname{\textsc{Elasticlave}\xspace}\xspace-spinlock.}
\label{fig:lock-futex}
\end{figure}
\paragraph{Real-World Benchmark 1: File I/O.}
We run the IOZone benchmark ~\cite{iozone}; it makes frequent file I/O
calls from enclave into the untrusted host process. Here, for \stname{spatial}\xspace, the communication
does not need to be protected with secure public memory. Figures~\ref{subfig:iozone-writer-native} and ~\ref{subfig:iozone-reader-native}
shows write and read bandwidth.
\begin{figure*}[!t] \centering
\begin{minipage}[b]{0.5\linewidth}
\subfloat[IOZone Writer \label{subfig:iozone-writer-native}]{
\includegraphics[width=.45\linewidth]{writer_native.pdf}
}
\subfloat[IOZone Reader \label{subfig:iozone-reader-native}]{
\includegraphics[width=.45\linewidth]{reader_native.pdf}
}
\captionof{figure}{IOZone Bandwidth for 8M and 512M byte files.}
\label{fig:iozone}
\end{minipage}
\hfill
\begin{minipage}[b]{0.45\linewidth}
{
\includegraphics[width=0.95\linewidth]{splash2-with-native.pdf}
}
\captionof{figure}{SPLASH-2 wall-clock time, measured in cycles.}
\label{fig:splash2}
\end{minipage}
\end{figure*}
\emph{Observations:}
Even without secure public memory
communication in \stname{spatial}\xspace,
\textsc{Elasticlave}\xspace achieves a higher bandwidth than \stname{spatial}\xspace, when the record
size grows above a threshold ($16$KB). The bandwidth increase reaches
as high as $0.4$ for the writer workload and around $0.5$ for the
reader workload when the record size is sufficiently large.
\paragraph{Real-World Benchmark 2: Parallel Computation.}
We ran $7$ SPLASH-2 workloads in a two-enclave setting. We adapted the
workloads to multi-enclave implementations by collecting together the
data shared across threads in a memory region which would be shared
across the enclaves. For \stname{spatial}\xspace, load/store instructions that
operate on the memory region are trapped and emulated with RPCs by the
enclave runtime.
Figure~\ref{fig:splash2} shows numbers of cycles to execute parallel workloads in two
enclaves (excluding initialization).
We were not able to run
$\tt{libsodium}$ inside the enclave runtime, so we did not use
encryption-decryption when copying data to-and-from secure
public memory for \stname{spatial}\xspace in this experiment.
So the actual overhead in a secure implementation would be
higher than reported in here. Thus, even if the
processor had support for cryptographic accelerators (e.g., AES-NI)
that may speedup \stname{spatial}\xspace, \textsc{Elasticlave}\xspace speedups just due to
zero-copies are still significant and out-perform \stname{spatial}\xspace.
\emph{Observations:}
On all the workloads measured, \stname{\textsc{Elasticlave}\xspace}\xspace is $2$-$3$ orders of
magnitude faster than \stname{spatial}\xspace.
\paragraph{Real-World Benchmark 3: ML Inference.}
We run $4$ machine learning models for image
classification~\cite{privado} to measure \textsc{Elasticlave}\xspace performance on applications with minimal
data sharing needs (Figure~\ref{fig:privado}).
Each of the inference models runs with a single enclave thread
and one shared region between
the enclave and the OS to loads input images.
\begin{figure}[!tb]
\centering
\includegraphics[width=.75\linewidth]{privado.pdf}
\caption{Cycles spent running each ML model.}
\label{fig:privado}
\end{figure}
\emph{Observations:}
The $3$ settings have similar performance. Thus, \textsc{Elasticlave}\xspace does not
slow-down CPU-intensive applications that do not share data
extensively.
\begin{framed}
Compared to \stname{spatial}\xspace, \textsc{Elasticlave}\xspace improves I/O-intensive
workload performance up to
$600\times$ (data size $ > 64$KB) and demonstrates $50$\% higher
bandwidth. For shared-memory benchmarks, it gains
up to a $1000\times$ speedup.
\end{framed}
\paragraph{Comparison to Native.}
\textsc{Elasticlave}\xspace
is up to $90\%$ as performant as \stname{native}\xspace (traditional Linux
processes no enclave isolation) for a range of our benchmarks (Figures~\ref{fig:splash2} and ~\ref{fig:privado}).
\textsc{Elasticlave}\xspace performs comparable to \stname{native}\xspace for frequent data
sharing over large-size (Figures~\ref{subfig:iozone-writer-native} and ~\ref{subfig:iozone-reader-native}).
\subsection{Impact on Implementation Complexity}
\label{sec:overhead}
We report on the \textsc{Elasticlave}\xspace TCB, hardware chip area, context switch cost, and critical path latency.
\paragraph{TCB.}
\textsc{Elasticlave}\xspace does not incur any change to the hardware. Its only
requires additional PMP entries, one entry per shared region.
\textsc{Elasticlave}\xspace TCB is $6814$ \loc (Table~\ref{table:tcb}). $3085$ \loc
to implement the \textsc{Elasticlave}\xspace interface in $\tt{m-mode}$, $3729$ \loc to use the interface in an enclave.
\begin{table}[!tb]
\centering
\resizebox{0.4\textwidth}{!}{
\begin{tabular}{lrr}
\toprule
\textbf{Function} & \textbf{\textsc{Elasticlave}\xspace} & \textbf{Enclave} \\
& \textbf{Privileged TCB} & \textbf{Runtime} \\
\midrule
{$\tt{uid}$}\xspace management & 1070 & 0 \\
Permission matrix enforcement & 574 & 0 \\
\textsc{Elasticlave}\xspace instruction interface & 219 & 82 \\
Argument marshaling & 0 & 88 \\
Wrappers for \textsc{Elasticlave}\xspace interface & 0 & 1407 \\
Miscellaneous & 960 & 1869 \\
\midrule
Total & 3085 & 3729 \\
\bottomrule
\end{tabular}
}
\caption{Breakdown in LoC of \textsc{Elasticlave}\xspace TCB \& Enclave runtime libraries (not in \textsc{Elasticlave}\xspace TCB).}
\label{table:tcb}
\end{table}
\paragraph{Context Switches.}
Context switching between enclaves and the OS
incurs PMP changes.
Thus, the overhead may change with
numbers of PMP-protected memory regions. To empirically measure this,
we record the percentage of cycles spent on
context switches in either direction for a workload that
never explicitly switches out to the OS (therefore all context
switches from the enclave to the OS are due to interrupts).
The percentage overhead increases
linearly with the number of memory regions but is negligibly
small: $0.1\%$ for $1$ memory region and $0.15\%$ for $4$ memory
regions.
\newcommand{$1$ GHz}{$1$ GHz}
\paragraph{Hardware Critical Path Delay.}
To determine the
critical path of the hardware design
and examine if the PMP entries are on this path,
we push the design to a target frequency of
$1$ GHz{}\footnote{We set the frequency higher than
$800$~MHz{} (which is what we have for our successful synthesis) to
push the optimization limit of the hardware design so we can
find out the bottleneck of the hardware design.}. We measure
the global critical path latency, which is of the whole core, and the
critical path through the PMP registers.
With this, we compute the slack, which is the desired delay minus the actual delay---a larger slack corresponds to a smaller actual delay in comparison to the desired delay. We find that the slack through PMP is significantly better than global critical path. With $16$ PMP entries, the slack through PMP is $-44.1$ picoseconds compared to $-190.1$ picoseconds for the global critical path.
In other words, the PMP would allow for a higher clock speed, but the rest of the design prevents it.
Thus, the number of PMP entries is {\em not the bottleneck of the
timing of the hardware design}.
We also tested that PMPs are not on the critical path for 8 and 32 PMP settings as well (details elided due to space). As a direct result, the number of PMP entries does not create a performance bottleneck for any instruction (e.g., load/store, PMP read/write), in our tests.
\paragraph{Area.}
The only impact of \textsc{Elasticlave}\xspace on \mbox{RISC-V}\xspace hardware is on the increased
PMP pressure (i.e., we require more PMP entries per region), which
increases chip area requirements. We synthesize RocketChip with
different numbers of PMP registers and collect the area statistics.
The range we explore goes beyond the limit of $16$ in the standard
\mbox{RISC-V}\xspace ISA specification. Figure~\ref{fig:area-breakdown}
exhibits the increase in the total area with increasing numbers of PMP
entries. The increase is not significant. Starting with $0$ PMP
entries, every $8$ additional PMP entries only incurr $1\%$
increase in the total area.
\begin{figure}[!tb]
\centering
\includegraphics[width=0.6\linewidth]{area-breakdown.pdf}
\caption{ RocketChip Area vs. numbers of PMP entries.}
\label{fig:area-breakdown}
\end{figure}
\begin{framed}
\textsc{Elasticlave}\xspace does not significantly increases software TCB size
(\textasciitilde{}$6800$ LOC), critical path delay, or
hardware area pressure
(\textasciitilde{}$1\%$ per 8 PMP entries), which shows that
the design scales well with number of regions.
\end{framed}
\section{Related Work}
\label{sec:related}
Isolation abstractions are of long-standing importance to security.
There has been extensive work on partitioning security-critical
applications using software isolation abstractions using namespace
isolation (e.g., containers), software-based techniques (e.g.,
SFI~\cite{sfi}, native-client~\cite{nacl}), language-based isolation
(java-capabilities~\cite{mettler2010joe},
web-sandboxing~\cite{jit-sandboxing}), OS-based
sandboxing~\cite{tx-box}, and using hypervisors (e.g., virtual
machines~\cite{xen, sp3}). Our work is on hardware support for
isolation, namely using enclave TEEs.
\textsc{Elasticlave}\xspace draws attention to a single point in the design space of
memory models that TEEs support, specifically, its memory model and
its impact on memory sharing. The pre-dominant model used today is
that of spatial isolation, which is used in Intel SGX, as well as
others (e.g., TrustZone~\cite{armtrustzone}, AMD SEV~\cite{amd-sev,
amd-sev-es}). \textsc{Elasticlave}\xspace explains the conceptual drawbacks of this
model and offers a relaxation that enables better performance. Intel
SGX v2 follows the spatial isolation design, with the exception that
permissions and sizes of private regions can be changed
dynamically~\cite{mckeen2016sgx, xing2016sgx}. As a result, the
"all-or-none" trust division between enclaves remains the same as
in v1.
TEEs, including SGX, has received extensive security scrutiny. Recent
works have shown the challenges of leakage via side-channels. New TEEs
have focused on providing better micro-architectural resistance to
side-channels~\cite{mi6}. Designs providing stronger confidentiality
due to oblivious execution techniques have been
proposed~\cite{maas2013phantom}. Keystone is a framework for
experimenting with new enclave designs, which uses the spatial
isolation model~\cite{dayeol2020keystone}.
Several TEE designs have been proposed prior to Intel SGX which show
the promise and feasibility of enclave
TEEs~\cite{bastion,shinde2015podarch, secureme,
secureblue, xom, aegis}.
After the availability of SGX in commercial
CPUs~\cite{sgx2014progref}, several works have shed light on the
security and compatibility improvements possible over the original SGX
design~\cite{costan2016sanctum,dayeol2020keystone,ferraiuolo2017komodo,mckeen2016sgx,xing2016sgx,park2020nestedenclave,mi6,sanctuary}.
They allow for better security,
additional classes of applications, better memory allocation,
and hierarchical security protection.
Nevertheless, they largely adhere to the {\em spatial isolation
model}, and have not explicitly challenged the assumptions.
TEE-based designs for memory sharing and TCB reduction are similar in
spirit to mechanisms used in hypervisors and microkernels---for
example, as used in page-sharing via EPT tables~\cite{cloudvisor,
chaos}, IOMMU implementations for memory-mapped devices such as GPUs
or NICs~\cite{damn}.
The key difference is in the trust model: Hypervisors~\cite{xen} and
microkernels~\cite{liedtke1995microkernel} are entrusted to make
security decisions on behalf of VMs, whereas in enclaved
TEEs, the privileged software is untrusted and enclaves self-arbitrate
security decisions. Further, microkernels and monolithic kernels
operate in system mode (e.g., S-mode in \mbox{RISC-V}\xspace) which is in the
TCB. They are larger compared to (say) the \textsc{Elasticlave}\xspace TCB.
Emerging proposals such as Intel TDX~\cite{tdx}, Intel MKTME~\cite{mktme},
Intel MPK~\cite{mpk}, Donky~\cite{donky} enable hardware-enforced domain protection.
However, they protect entire virtual machines or
groups of memory pages (in contrast to enlcaves in Intel
SGX).
Notably, they extend fast hardware support to protect physical memory
of a trust domain (e.g., from a physical adversary) but
adhere to spatial model. They can benefit from \textsc{Elasticlave}\xspace memory model. \section{Conclusion}
We present \textsc{Elasticlave}\xspace, a new TEE memory model that allows enclaves to
selectively and temporarily share memory with other enclaves and the
OS.
We demonstrate that \textsc{Elasticlave}\xspace eliminates expensive data copy operation
and maintains same level of application-desired security.
Our \textsc{Elasticlave}\xspace prototype on RISC-V FPGA core offers $1$ to $2$ order of
magnitude performance improvements over existing models.
\section*{Acknowledgments}
We thank
Aashish Kolluri,
Burin Amornpaisannon,
Dawn Song,
Dayeol Lee,
Jialin Li,
Li-Shiuan Peh,
Roland Yap,
Shiqi Shen,
Yaswanth Tavva,
Yun Chen, and
Zhenkai Liang.
for their feedback on improving earlier drafts of the paper.
The authors acknowledge the support from the Crystal Center and
Singapore National Research Foundation ("SOCure`` grant
NRF2018NCR-NCR002-0001 www.green-ic.org/socure).
This material is in part based upon work supported by the National
Science Foundation under Grant No. DARPA N66001-15-C-4066 and Center
for Long-Term Cybersecurity. Any opinions, findings, and conclusions
or recommendations expressed in this material are those of the
authors and do not necessarily reflect the views of the National
Science Foundation.
\bibliographystyle{plain}
| {'timestamp': '2020-10-19T02:19:24', 'yymm': '2010', 'arxiv_id': '2010.08440', 'language': 'en', 'url': 'https://arxiv.org/abs/2010.08440'} | arxiv |
\section{INTRODUCTION}
\IEEEPARstart{U}{ltra}-reliable and low-latency communication (URLLC) is one of fifth generation (5G) driven use cases, for which the third partnership project (3GPP) and the International Mobile Telecommunications 2020 and beyond (IMT-2020) specified stringent latency and reliability requirements to fulfill. The 3GPP Rel. 14 has defined these requirements to at most 1 ms latency with an outage probability of less than $10^{-5}$ for a 32 byte packet \cite{rel14,Pacovi2018}. In fact, the set of URLLC services with these demanding requirements in the real world, is inappropriate with the best effort manner of long term evolution (LTE) \cite{strodthoff}. To this end, the 5G New Radio (NR) has been standardized with a set of specifications in Rel. 15, which incorporates basic URLLC features. Indeed, the NR covers implicitly the air interface latency aspect by the considered 5G numerology, however, it is not developed enough to fully achieve the required latencies. In fact, still the retransmission process across the air-interface unclear, in particular, the hybrid automatic repeat request (HARQ) roundtrip time (RTT) which has to be shortened to fit in the assumed 1 ms latency budget. Otherwise, the contribution of HARQ to URLLC is too critical and might be then, limited \cite{srveyURLLC}. However, recently, as part of Rel. 16, different areas of improvements have been specified for the NR URLLC foundation. One of these enhancements focused on the uplink control information (UCI), eventually, the HARQ feedback. In fact, the main purpose is to enable the NR support for applications with latency requirements in the range of 0.5 to 1 ms and where network reliability is critical \cite{rel16_stg2}. Along with this, other technological capabilities have been included to enable real-time situations, namely, the sidelink concept specifically for cellular-vehicle-to-everything (C-V2X) communications and integrated access backhaul (IAB) that points out mainly the relay concept upon 3GPP NR. Yet, several extensions will be supported by a Rel. 17 work item in order to bring several IAB improvements in terms of spectral efficiency (SE), latency, and performance. In other words Rel. 17 will rejuvenate the interest toward full-duplex (FD) transmission mode by proposing a multiplexing option for transmissions between the backhaul and access links, referred as, IAB-node full-duplex \cite{rel17}. These changes mark undeniably the dawn of 6G era toward which the rich theory of FD cooperative communications is getting unleashed to aid the full sustainability of the next generation driving use cases with stringent requirements in terms of latency and reliability \cite{rel16_2}.
Cooperative relaying and FD radio communication have been extensively identified as a promising network technology to improve wireless communications reliability. In other words, as the capacity improvement is promoted by the SE improvement, the adoption of FD communication at the relay node is more advantageous and efficient. Meanwhile, thanks to recent advances noted in antenna technology and signal processing techniques, it is practical to use the FD communication mode on cooperative relaying systems even with the presence of a significant loop interference \cite{rsiCancel1,FDcancel,FD2}. Furthermore, in the perspective of a low latency, FD relaying mode allows fast device-to-device discovery, and hence, contributes on the delay reduction. Accordingly, all these practical growth have incited authors to adopt FD communications in their researches, thus, get rid of the spectral inefficiency caused by half-duplex (HD) relaying mode \cite{FD1,c3}.
Likewise, cooperative relay communications have been always the focus of several works in the literature. Nevertheless, to the best of our knowledge their full-fledged implementation has never occurred. Indeed, the relaying concept has been introduced in 3GPP Rel. 10 as a part of LTE-Advanced, and currently, it get covered again in some study item (SI) proposals for the NR 3GPP rel. 17, specifically, pertain to SL and IAB concepts \cite{rel17 , rel17_2}. In fact, relay nodes were formerly, used for the coverage extension purpose, i.e., the in-coverage user equipment (UE) assists the communication between an evolved node B (eNB) and an out-of-coverage UE \cite{c1}, there is no combining of signals. Yet recently, cooperative relaying recurs intensively in the literature with great interest for competitive edge of wireless networks while targeting far-reaching use cases \cite{c2,c3,c4,c5,c6,c7,c8,c9,c10}. In support of this vision and combined with HARQ, cooperative relaying can substantially improve the system reliability and thus aid upgrading the new functions of Rel. 16 \cite{jaz62}. Packet retransmission in a cooperative network involves a source terminal, a destination terminal and at
least one relay terminal, and it consists on recovering corrupted
data packets from neighboring nodes. In other words, if the destination
fails to decode the received signal, it requests the retransmission
of the packet from neighboring nodes, i.e., relays, rather than asking
the source node. This provides the system with a spatial diversity
gain since the receiver obtains multiple copies of the same packet
on channels experiencing independent fading. Therefore, link reliability
as well as overall throughput can be improved.
However, when adopting cooperative relay communications, a drastic change will affect the communication latency which may bring further challenges to establish a successful quasi-real time radio communication. Generally, the supplementary latency due to relaying depends mainly on the investigated relaying technique. These techniques can be classified into regenerative and non-regenerative classes, among which we distinct respectively, the most commonly used selective decode and forward (SDF) and amplify-and-forward (AF) \cite{SDF, Lan}. In order to recognize the impact of the relay processing delay on the system latency, an exhaustive comparison between AF and SDF techniques under the framework of full-duplex (FD) relaying has been conducted in \cite{airod}. Simulations results proved that the SDF block-based transmission scheme is no longer practical to adopt for FD signal-combining mode, where direct and relay links are combined at the receiver side, especially, with the extra latency induced due to the complexity of encoding and decoding algorithms. Still the AF scheme represents better choice in terms of outage performance and latency.
In the literature, HARQ and relaying have been studied extensively.
In \cite{harq_litt1}, authors have investigated the performance of
relay networks in the presence of HARQ feedback and adaptive power
allocation. The throughput and the outage probability of different
HARQ protocols were studied for independent and spatially-correlated
fading channels. In \cite{han63}, with the joint optimization of
transmission power and rate, authors have adopted and have compared between many
packet retransmissions schemes to find out the most appropriate one
that yields to the best spectrum efficiency performance over multi-hop
relay networks. In \cite{Harq_litt2,harq_litt3}, new types of ARQ
based on a selective and opportunistic AF relaying method have been
developed. Through simulations, authors showed that the proposed
ARQ schemes are more effective for throughput enhancements, and can
provide cell-edge users almost three times the throughput gain in
comparison with ARQ with no relay-assisted forwarding. However, in
the different mentioned studies, authors have applied some features
to the existing retransmission mechanism with a specific purpose:
Increasing the system reliability. However, this increase in reliability
comes at the cost of higher latency at the system air-interface. In
\cite{harq_litt4}, authors have investigated diamond relay systems
with HARQ protocol under delay constraints and have employed the effective
capacity as a performance metric. However, the studied system has
assumed a disconnected source and destination, which means that there
is no direct link between the two nodes. In \cite{harq_litt5}, authors have investigated a performance evaluation of HARQ-assisted hybrid satellite-terrestrial relay systems. They considered as a key performance metric, the delay limited throughput, then provided a convenient approach that includes different HARQ schemes, different relay protocols, and different key parameters. Authors in \cite{harq_litt6}, conduct a generic analysis of HARQ with code combining (HARQ-CC) over double Rayleigh channels, which they consider as a typical framework that can be applied to scenarios pertains to urban vehicle-to-vehicle communication systems, amplify-and-forward relaying, as well as keyhole channels.
To the best of our knowledge, none of the cited works have build up or evaluated packet retransmission mechanisms relative to latency purpose under the framework of full-fledged implemented FD cooperative systems with non-negligible direct link. Motivated by this fact, and inspired by the comparative study results between
FD-AF and FD-SDF relaying schemes presented in \cite{airod}, we investigate a hybrid FD AF-SDF relay-based system for URLLC. The proposed hybrid relay assists the communication using the low latency FD-AF relaying scheme during the initial transmission. If the destination fails in decoding the received packet, the hybrid relay retransmits the same message but processed using SDF relaying.
The main contributions of this paper can be summarized as follows:
\begin{enumerate}
\item From cross-layer perspective, this article points out the conflicting
contribution of the HARQ mechanism for URLLC services. In this work, our main concern is to improve the system reliability while respecting the 1 ms latency budget requested by URLLC. Thereby, we propose the use of FD-AF during the first transmission which highly improves the signal quality at the destination side and thereby reduces the retransmission probability.
\item For the adopted hybrid relay-assisted scheme, we propose two HARQ-based
procedures aiming at keeping a trade-off between an extreme reliability
and a low latency. Both of procedures were not considered before under
the framework of FD cooperative systems with non-negligible direct
link. We first propose the conventional HARQ procedure for a relay-based
system where the retransmission of erroneous packets is taken over
by the relay node. Then we focus on latency and reliability issues.
So as to face the latency issue, we assume a reduced HARQ roundtrip
time as well as a consecutive transmission time intervals (TTIs) assignment
using multiple HARQ processes. The enhanced HARQ procedure is then
proposed to deal with the reliability issue in the case of bad source-to-relay
link.
\item We evaluate the outage behavior of this relay based HARQ system within
its different procedures. Note that the analytical development for the first transmission is similar to \cite{airod}. Thereby, this work's main technical contribution in term of outage probability concerns the second transmission where the multiple copies of the signal (from the source and the hybrid FD AF-SDF relay) are combined coherently.
\item For the purpose of reducing the latency, we assume a short TTI of 0.125 ms obtained at subcarrier spacing of 120 kHz. Then to evaluate the performance of our two proposed
HARQ procedures, we investigate extensive simulation performance analysis where we
include as a reference, the source-to-destination (S2D) HARQ-based
system where no relay assists the communication between the source
and the destination, the AF relaying scheme as the low latency relay
processing scheme, and the SDF relaying scheme that requires complex
encoding and decoding algorithms.
\end{enumerate}
The rest of the paper is organized as follows: Section \ref{sec:Relay-System-model}
presents the system model. In Section \ref{sec:HARQ procedures},
HARQ procedures are elaborated in detail. Outage probability is derived
in Section \ref{sec:Outage-Probability}. In Section \ref{sec:Numerical-Results},
numerical results are shown and discussed. The paper is concluded
in Section \ref{sec:Conclusion}.
\section{\label{sec:Relay-System-model}System Model}
We consider a single relay cooperative system, where one relay $(\mathrm{R})$
assists the communication between a source $(\mathrm{S})$ and a destination
$(\mathrm{D})$. Since the relay operates in FD mode, we take into
account the residual self-interference (RSI) generated from relay's
input to relay's output. In this work, we assume the direct link between
the source and the destination nodes is non-negligible and all channels
$h_{\mathrm{AB}}$, with $\mathrm{A}\in\left\{ \mathrm{S},\,\mathrm{R}\right\} $
and $\mathrm{B}\in\left\{ \mathrm{R},\,\mathrm{D}\right\} $
are i.i.d zero mean circularly symmetric complex Gaussian $\sim\mathcal{CN}(0,\sigma_{\mathrm{AB}}^{2})$. Moreover, we assume a limited channel
state information (CSI) at the source node, i.e., the source transmitter is only aware
of the processing delay at the relay, and we suppose perfect CSI at the relay and the
destination receivers.
The proposed HARQ-based system consists of three phases. Phase I represents
the packet initial transmission where the source sends the data packet
to the destination by the mean of a single relay, using FD-AF relaying.
In phase II, the destination checks the correctness of the received
packet and transmits either a positive or negative acknowledgment
(ACK/NACK) in order to convey the success or failure of data decoding.
Phase III is the packet retransmission phase activated if the destination
responds with a NACK. In fact, if the destination fails in decoding
a message, it stores the received signal and responds with a NACK.
During the retransmission phase (Phase III), the relay resends the
same message but processed using SDF relaying instead of AF relaying.
At the destination, the phase I received signal is combined with phase
III received signal using maximum ratio combining (MRC). In this work,
we suppose perfect packet error detection and assume that the NACK
feedback message is error free. Hereafter, we investigate the communication
model explicitly.
During Phase I, the source first broadcasts its signal $x_{\mathrm{s}}$,
to both the relay and destination nodes. Due to the processing delay
at the relay, the destination node will receive the source node transmitted
signal $x_{\mathrm{s}}$ at different channel uses. In order to alleviate
the inter-symbol interference (ISI) caused by the delayed signal,
a cyclic-prefix (CP) transmission can be used at the source side \cite{airod}.
Therefore, before transmitting, the source node appends a CP of length
$\tau$ to the transmitted signal, with $\tau$ represents the AF
processing delay at the relay. The FD relay forwards then, the amplified
signal, i.e., $x_{\mathrm{R}},$ to the destination upon the same
time slot and starts the SDF processing %
\footnote{The proposed FD relay decodes the received signal then reencodes it
in order to retransmit it to the destination during Phase III. Note
that, if the relay decoding outcome is erroneous, the relay keeps
silent during the retransmission phase (Phase III).%
}.
The received signal at the destination side, during Phase I, and after
the CP removal, is expressed as
\begin{align}
y_{\mathrm{D}}^{I}(t) & =\underset{\mathrm{Direct\,+\, Relayed\, signal}}{\underbrace{\sqrt{P_{\mathrm{s}}}h_{\mathrm{SD}}x_{\mathrm{s}}(t)+\beta\sqrt{P_{\mathrm{s}}}h_{\mathrm{RD}}h_{\mathrm{SR}}x_{\mathrm{s}}\left[(t-\tau)\,\mathrm{mod}\, T\right]}}\label{eq:2-1}\\
& +\underset{\mathrm{RSI}}{\underbrace{\beta h_{\mathrm{RD}}h_{\mathrm{RR}}x_{\mathrm{R}}(t-\tau)}}+\underset{\mathrm{Noise}}{\underbrace{\beta h_{\mathrm{RD}}n_{\mathrm{R}}(t-\tau)+n_{\mathrm{D}}(t)}},\nonumber
\end{align}
with $\beta=\sqrt{\frac{P_{\mathrm{R}}}{P_{\mathrm{s}}|h_{\mathrm{SR}}|^{2}+P_{\mathrm{R}}\sigma_{\mathrm{RR}}^{2}+N_{R}}}$
is the amplification constant factor \textcolor{black}{chosen to satisfy
the total power constraint at the relay} \cite{amplif}, $P_{\mathrm{s}}$
and $P_{\mathrm{R}}$ denote, respectively, the transmit power at
the source and the relay, and $h_{\mathrm{RR}}x_{\mathrm{R}}(t)$
is the RSI after undergoing any
cancellation techniques and practical isolation at the relay \cite{rsiCancel1,rsiCancel2}.
$n_{\mathrm{R}}\sim\mathcal{CN}(0,N_{R})$ and $n_{\mathrm{D}}\sim\mathcal{CN}(0,N_{\mathrm{D}})$
denote, respectively, a zero-mean complex additive white Gaussian
noise at the relay and the destination. Without loss of generality,
we assume that the source transmitted signals are independent $\mathbb{{E}}\left[x_{\mathrm{s}}(i)x_{\mathrm{s}}^{\star}(i')\right]=\delta_{i,i'}$.
In this paper, we assume that all channel gains change independently
from one block to another and remain constant during one block of
$T+\tau$ channel uses, with $T$ represents the number of transmitted
codewords. Hence, we can rewrite (\ref{eq:2-1}) in vector form to
jointly take into account the $T+\tau$ received signal as \cite{turbo}
\begin{equation}
\mathbf{y_{\mathrm{D}}^{I}}=\boldsymbol{{\mathcal{H}}}\mathbf{x}_{\mathrm{s}}+\beta h_{\mathrm{RD}}h_{\mathrm{RR}}\mathbf{x}_{\mathrm{R}}+\mathbf{n},
\end{equation}
where $\mathbf{y_{\mathrm{D}}^{I}}=\left[y_{D}\left(0\right),...,y_{D}\left(T-1\right)\right]^{\top}\in\mathbb{C}^{T\times1}$,
$\mathbf{x}_{\mathrm{s}}=\left[x_{\mathrm{s}}\left(0\right),...,x_{\mathrm{s}}\left(T-1\right)\right]^{\top}\in\mathbb{C}^{T\times1}$,
$\mathbf{x}_{\mathrm{R}}=\left[\tilde{x}_{\mathrm{R}}\left(0\right),...,\tilde{x}_{\mathrm{R}}\left(T-1\right)\right]^{\top}\in\mathbb{C}^{T\times1}$
with $\tilde{x}_{\mathrm{R}}(i)=x_{\mathrm{R}}(t-\tau)$, $\mathbf{n}=\left[n\left(0\right),...,n\left(T-1\right)\right]^{\top}\in\mathbb{C}^{T\times1}$
with $n(t)=\beta h_{\mathrm{RD}}n_{\mathrm{R}}(t-\tau)+n_{\mathrm{D}}(t)$,
and $\boldsymbol{{\mathcal{H}}}\in\mathbb{C}^{T\times T}$ is a circulant
matrix whose first column matrix is $\left[\sqrt{P_{\mathrm{s}}}h_{\mathrm{SD}},\boldsymbol{{0}}_{1\times\tau-2},\beta\sqrt{P_{\mathrm{s}}}h_{\mathrm{RD}}h_{\mathrm{SR}},\boldsymbol{{0}}_{1\times T-\tau}\right]^{\top}$.
Note that the circulant matrix $\boldsymbol{{\mathcal{H}}}$, can
be decomposed as
\begin{equation}
\boldsymbol{{\mathcal{H}}}=\mathbf{U}_{T}^{H}\boldsymbol{{\Lambda}}\mathbf{U}_{T},
\end{equation}
where $\mathbf{U}_{T}$\footnote{Generally, for $\mathbf{x}\in\mathbb{C}^{T\times1}$, $\mathbf{x}_{f}$
denotes the discrete Fourier transform (DFT) of $\mathbf{x}$, i.e. $\mathbf{x}_{f}=\mathbf{U}_{T}\mathbf{x}$.} is a unitary $T\times T$ matrix whose $\left(m,n\right)th$ element is $\left(\mathbf{U}_{T}\right)_{m,n}=\frac{1}{\sqrt{T}}e^{-j(2\pi mn/T)}$ , $j=\sqrt{-1}$
and $\boldsymbol{{\Lambda}}$ is a diagonal matrix whose $\left(i,i\right)$-th
element is
\begin{equation}
\lambda_{i}=\sqrt{P_{\mathrm{s}}}h_{\mathrm{SD}}+\beta\sqrt{P_{\mathrm{s}}}h_{\mathrm{RD}}h_{\mathrm{SR}}e^{-j\left(2\pi i\frac{\tau}{T}\right)}.
\end{equation}
The signal $\mathbf{y^{I}}_{\mathrm{D}}$ can be therefore represented
in the frequency domain as
\begin{equation}
\mathbf{y_{\mathrm{D}_{f}}^{I}}=\boldsymbol{{\Lambda}}\mathbf{x}_{\mathrm{s}_{f}}+\beta h_{\mathrm{RD}}h_{\mathrm{RR}}\mathbf{x}_{R_{f}}+\mathbf{n}_{f}.
\end{equation}
At the destination side, the instantaneous end-to-end equivalent signal-to-interference
and noise ratio (SINR), during Phase I, is expressed as
\begin{equation}
\begin{aligned}\gamma_{i}^{I}= & \frac{\lambda_{i}\lambda_{i}^{H}}{\beta^{2}|h_{\mathrm{RD}}|^{2}(P_{\mathrm{R}}\sigma_{\mathrm{RR}}^{2}+N_{R})+N_{\mathrm{D}}}\\
= & \rho_{I}+2\left|\mu_{I}\right|\cos\left(2\pi i\frac{\tau}{T}+\theta\right),
\end{aligned}
\label{eq:phase1}
\end{equation}
with {$\rho_{I}=\frac{P_{\mathrm{S}}|h_{\mathrm{\mathrm{S}D}}|^{2}+\beta^{2}P_{\mathrm{S}}|h_{\mathrm{SR}}|^{2}|h_{\mathrm{RD}}|^{2}}{\beta^{2}|h_{\mathrm{RD}}|^{2}(P_{\mathrm{R}}\sigma_{\mathrm{RR}}^{2}+N_{R})+N_{\mathrm{D}}}$,}\\
{$\mu_{I}=\frac{\beta P_{\mathrm{s}}h_{\mathrm{SD}}h_{\mathrm{RD}}h_{\mathrm{SR}}}{\beta^{2}|h_{\mathrm{RD}}|^{2}(P_{\mathrm{R}}\sigma_{\mathrm{RR}}^{2}+N_{R})+N_{\mathrm{D}}}$}, and {$\theta=\textrm{angle}\left(h\mathrm{_{SD}},h_{\mathrm{RD}}^{*}\right)$.}
During Phase II, the destination verifies the correctness of the received
data packet. If the decoding outcome is correct, the communication
moves on to Phase I and starts the transmission of a new information
block. When the destination fails in decoding a message, it stores
the received signal and the packet retransmission phase is activated.
The retransmission strategy depends on the considered HARQ procedure.
In general, the received signal at the destination, during Phase III,
can be expressed as
\begin{equation}
y_{\mathrm{D}}^{III}(t)=\left(\underset{\mathrm{Retransmitted\, signal}}{\underbrace{\sqrt{P_{\mathrm{X}}}h_{\mathrm{\mathrm{X}D}}^{III}x_{\mathrm{s}}(t)}}+n_{\mathrm{D}}^{III}(t)\right)\times a,\label{eq:combinDest-2-1}
\end{equation}
with $a=\begin{cases}
1 & \textrm{if Phase III is activated}\\
0 & \textrm{Otherwise}
\end{cases}$ \\and $\textrm{X}\in\left\{ \textrm{S,R}\right\} $ is the retransmitter
node.
After combining the resulted copies of the same data packet at the
destination using MRC technique, the instantaneous end-to-end SINR,
at the destination and during Phase III is given by \textcolor{red}{{} }
\begin{align}
\gamma_{i}^{III} & =\frac{P_{\mathrm{S}}|h_{\mathrm{\mathrm{S}D}}|^{2}+\beta^{2}P_{\mathrm{S}}|h_{\mathrm{SR}}|^{2}|h_{\mathrm{RD}}|^{2}}{\beta^{2}|h_{\mathrm{RD}}|^{2}(P_{\mathrm{R}}\sigma_{\mathrm{RR}}^{2}+N_{R})+N_{\mathrm{D}}}+\label{eq:}\\
& \frac{2\left|\beta P_{\mathrm{s}}h_{\mathrm{SD}}h_{\mathrm{RD}}h_{\mathrm{SR}}\right|cos\left(2\pi i\frac{\tau}{T}+\theta\right)}{\beta^{2}|h_{\mathrm{RD}}|^{2}(P_{\mathrm{R}}\sigma_{\mathrm{RR}}^{2}+N_{R})+N_{\mathrm{D}}}+\frac{P_{\textrm{X}}|h_{\mathrm{XD}}^{III}|^{2}}{N_{\mathrm{D}}}\times a.\nonumber
\end{align}
\section{\label{sec:HARQ procedures}Relay-based HARQ Procedures}
The goal of this section is to propose HARQ procedures for a relay
assisted system in order to improve the latency performance. For that
purpose, we first present the proposed conventional HARQ procedure
for a relay-based system and focus on latency and reliability issues.
To face the latency issue, we assume a reduced HARQ RTT \cite{RTT1, RTT2, RTT3} as well
as a consecutive TTI assignment using multiple HARQ processes. The
enhanced HARQ procedure is then proposed to deal with the reliability
issue in the case of a bad source-to-relay link.
\subsection{Relay-based Conventional HARQ Procedure}
In the conventional system, the destination checks the correctness
of the Phase I received packet and transmits either a NACK or ACK
in order to convey the failure or success of data decoding. When the
destination fails in decoding a message, it stores the received signal
and responds with NACK. The NACK is broadcasted to both relay and
source nodes, as represented in Fig. \ref{fig:System-model-of2}. While
the source keeps silent, the relay retransmits the SDF processed packet.
The received signal at the destination, during Phase III, is expressed
as in (\ref{eq:combinDest-2-1}) with $\textrm{X}=\textrm{R}$.
\begin{figure}[tbh]
\begin{centering}
\includegraphics[scale=0.55]{Drawing3}
\par\end{centering}
\protect\caption{\label{fig:System-model-of2}Conventional HARQ procedure diagram. }
\end{figure}
\subsubsection{Latency Issue}
The additional delay on the transmission due to HARQ is named HARQ
RTT. The HARQ RTT incorporates unavoidable physical delays, such as
processing times, propagation delays, and TTI duration. In \cite{Pacovi2018,strodthoff,Pocovi2017,Pedersen2017,RTT_reduction},
it has been shown that assuming LTE-alike asynchronous HARQ operation
with a minimum RTT of 8 TTIs, even with a very short TTI duration
of 0.143 ms, the HARQ RTT would not satisfy the 1 ms URLLC latency
target. This is the main reason of HARQ abandonment for the 1 ms end-to-end
latency use case of URLLC, at least for the initial URLLC specification
in Rel.15 \cite{rel15}. In this work, in order to allow room for
one HARQ retransmission, the reduced HARQ RTT of 4 TTIs has been adopted
\cite{Pocovi2017}. The proposed HARQ RTT for one FD-relay based system
is presented in Fig. \ref{fig:Diagram-of-Relay-based} %
\footnote{In this work, the propagation delay is neglected. In fact, the propagation
delay depends on the distance between two nodes, however as the latter
is out of the scope of this work, all nodes are supposed to have the
same time offset. %
}. We consider $1$ TTI for the initial transmission, $1$ TTI for
the destination processing required to decode the initial transmission%
\footnote{In parellel with the destination processing, the relay performs the
SDF relay processing of the received packet.%
}, $1$ TTI for the NACK feedback, and $1$ TTI for retransmitter processing
of NACK.
\begin{figure}[tbh]
\begin{centering}
\includegraphics[scale=0.55]{relay_retransmit}
\par\end{centering}
\protect\caption{RTT diagram of the proposed conventional HARQ procedure.\label{fig:Diagram-of-Relay-based}}
\end{figure}
In order to allow continuous transmission while previous blocks are
being decoded, four consecutive TTI assignment using multiple HARQ
processes is adopted \cite{rel15SW}. As shown in Fig. \ref{fig:Multiple_Access_HARQ} %
\footnote{The NACK processing and the SDF processing are covered by the baseband processor (BP), while the NACK reception and the data packet transmission/retransmission are performed by the radio frequency (RF) front-end. %
} \footnote{The NACK processing is generally based on repetition code, whereas the SDF processing is based on LDPC or polar codes. Thereby, the NACK processing would be completed earlier than the SDF processing. %
},
the consecutive assignment using multiple HARQ processes allows the
resources to be assigned in consecutive TTIs to the same transmitting
source node. At the relay and destination nodes, simultaneous HARQ
processes operate in parallel to decode consecutive assignments. At
the destination%
\footnote{The ACK/NACKs of received data packets are transmitted on a separate reverse link control channel, i.e., the NR physical uplink control channel (PUCCH), with orthogonal resources to the one in which forward link data packets are transmitted.}, each HARQ process is responsible for decoding one
assignment, and transmitting the associated ACK or NACK $2$ TTIs after
the end of that assignment. By using four consecutive TTI assignment,
the system can achieve a maximum data rate that is four times greater
than the non consecutive assignment if every block is decoded correctly.
\begin{figure*}[tbh]
\begin{centering}
\includegraphics[scale=0.50]{2TTI_late}
\par\end{centering}
\protect\caption{RTT diagram of conventional HARQ procedure with multiple HARQ processes.\label{fig:Multiple_Access_HARQ}}
\end{figure*}
\subsubsection{Reliability Issue}
In order to achieve higher reliability, at least one retransmission
is needed over a time varying channel. However, in the conventional
system, presented above, the retransmission is activated only if the
relay can correctly decode the received signal. In the next subsection,
we propose an enhanced HARQ procedure that can solve this reliability
issue.
\subsection{Relay-based Enhanced HARQ Procedure}
In the conventional system, presented above, the retransmission is
activated only if the relay can correctly decode the received signal
which reduces the relay-based HARQ system performance. To solve this
problem, we propose an enhanced HARQ procedure that makes use of the modified SDF extensively studied in the literature\cite{turbo, Maham, Maaz}. In the proposed procedure,
when the relay decoding outcome is erroneous, the relay broadcasts
a NACK to both the destination and the source to indicate that the
source will play the retransmitter role during Phase III, as shown
in Fig. \ref{fig:RTT-diagram-Enhanced}. In this enhanced procedure,
the received signal at the destination, during Phase III, is expressed
as
\begin{equation}
y_{\mathrm{D}}^{III}(t)=\left(\underset{\mathrm{Retransmitted\, signal}}{\underbrace{\sqrt{P_{\mathrm{e}}}h_{\mathrm{e}}^{III}x_{\mathrm{s}}(t)}}+n_{\mathrm{D}}^{III}(t)\right)\times a,\label{eq:combinDest-2-1-1}
\end{equation}
with
\[
a=\begin{cases}
1 & \textrm{upon a reception of NACK from the destination}\\
0 & \textrm{Otherwise},
\end{cases}
\]
\[
P_{\mathrm{e}}=\begin{cases}
P_{\textrm{S}} & \textrm{upon a reception of NACK from the relay}\\
P_{\mathrm{R}} & \textrm{Otherwise},
\end{cases}
\]
and
\[
h_{\mathrm{e}}^{III}=\begin{cases}
h_{\mathrm{SD}}^{III} & \textrm{upon a reception of NACK from the relay}\\
h_{\mathrm{RD}}^{III} & \textrm{Otherwise}.
\end{cases}
\]
\begin{figure}[tbh]
\begin{centering}
\includegraphics[scale=0.50]{DL_retransmit}
\par\end{centering}
\protect\caption{RTT diagram of enhanced HARQ procedure.\label{fig:RTT-diagram-Enhanced}}
\end{figure}
\section{\label{sec:Outage-Probability}Outage Probability}
In this section, we derive the outage probability of the proposed
system where packet retransmission is activated only if the destination
fails to decode the transmitted data packet. Note that, the system
outage occurs when both transmissions, i.e., Phase I and Phase III
are in outage. Therefore, the system outage probability is given by
\begin{equation}
\begin{aligned}P_{\mathrm{out}} & =P_{\mathrm{out}}^{I}\times P_{\mathrm{out}}^{III},\end{aligned}
\label{eq:-1}
\end{equation}
where $P_{\mathrm{out}}^{I}$ and $P_{\mathrm{out}}^{III}$ represent
respectively, the system outage probability related to Phase I and
Phase III. Overall, to derive the system outage probability, i.e.,
$P_{\mathrm{out}}$, the received instantaneous SINR of $\mathrm{S}\rightarrow\mathrm{D}$,
$\mathrm{S}\rightarrow\mathrm{R}$, and $\mathrm{R}\rightarrow\mathrm{D}$
links need to be provided. They are, respectively, given as, $\gamma_{\mathrm{SD}}=\frac{P_{\textrm{S}}|h_{\mathrm{SD}}|^{2}}{N_{D}}$,
$\gamma_{\mathrm{RD}}=\frac{P_{\mathrm{R}}|h_{\mathrm{RD}}|^{2}}{N_{D}}$,{\footnotesize{}
} and $\gamma_{\mathrm{SR}}=\frac{P_{\textrm{S}}|h_{\mathrm{\mathrm{SR}}}|^{2}}{P_{\mathrm{R}}\sigma_{\mathrm{RR}}^{2}+N_{R}}$.
Note that all SINRs are exponentially distributed random variables. \\
Indeed, URLLC is known to cope with the finite-blocklength regime. However, for the sake of simplicity, we proceed in this study, with the case of sufficiently long codes since it has been proven to provide very close performance to the case with finite block-length \cite{zorzi, alouini}.
First, let's derive the outage probability expression, relative to
Phase I as \cite{airod}
\begin{align}
\begin{aligned}P_{out}^{I} & =\mathrm{Pr}\left(\frac{T}{T+\tau}I(\mathbf{x}_{\mathrm{s}_{f}},\mathbf{y_{\mathrm{D}_{f}}^{I}})<R\right)\\
& =\mathrm{Pr}\left(\frac{1}{T+\tau}{\displaystyle \sum_{i=0}^{T-1}}\log_{2}\left(1+\gamma_{i}^{I}\right)<R\right),
\end{aligned}
\label{eq:OutPh1}
\end{align}
with $R$ is the bit rate per channel use, the factor $\frac{T}{T+\tau}$
means that the transmission of $T$ useful codewords occupies $T+\tau$
channel uses, and $I$ represents the overall AF system average mutual
information which is manipulated as below
{\footnotesize{}
\begin{equation}
\begin{alignedat}{1}I(\mathbf{x}_{\mathrm{s}_{f}},\,\mathbf{y_{\mathrm{D}_{f}}^{I}}) & =\frac{1}{T}\sum_{i=0}^{T-1}\mathrm{log_{2}}(1+\gamma_{i}^{I})\\
& =\frac{1}{T}\sum_{i=0}^{T-1}\mathrm{log_{2}}\left[(1+\rho_{I})\left(1+\frac{2\left|\mu_{I}\right|cos\left(2\pi i\frac{\tau}{T}+\theta\right)}{1+\rho_{I}}\right)\right]\\
& =\mathrm{log_{2}}(1+\rho_{I})+\frac{1}{T}\sum_{i=0}^{T-1}\mathrm{log_{2}}\Biggl(1+\Biggl(\frac{2\left|\mu_{I}\right|}{1+\rho_{I}}\\
& \times\mathrm{cos}\left(2\pi i\frac{\tau}{T}+\theta\right)\Biggr)\Biggr).
\end{alignedat}
\label{eq:Mutual_Info}
\end{equation}
}
According to the arithmetic-geometric mean inequality, $\rho_{I}\geq2\left|\mu_{I}\right|$,
we have {\footnotesize{$1+\rho_{I}>2\left|\mu_{I}\right|cos\left(2\pi i\frac{\tau}{T}+\theta\right)$}}.
Thus, by using the first order Taylor expansion, we have $\mathrm{ln}\left(1+\frac{2\left|\mu_{I}\right|cos\left(2\pi i\frac{\tau}{T}+\theta\right)}{1+\rho_{I}}\right)\thickapprox\frac{2\left|\mu_{I}\right|cos\left(2\pi i\frac{\tau}{T}+\theta\right)}{1+\rho_{I}}.$
Noting that {\small{${\displaystyle \sum_{i=0}^{T-1}}cos\left(2\pi i\frac{\tau}{T}+\theta\right)=0$}},
the mutual information, in (\ref{eq:Mutual_Info}), can be approximated
as
\begin{align}
I(\mathbf{x}_{\mathrm{s}_{f}},\mathbf{y_{\mathrm{D}_{f}}^{I}}) & \thickapprox\mathrm{log_{2}}(1+\rho_{I})
\end{align}
Therefore, (\ref{eq:OutPh1}) can be represented as
\begin{eqnarray}
P_{out}^{I} & \approx & \mathrm{Pr}\left(\frac{T}{T+\tau}\log_{2}\left(1+\rho_{I}\right)<R\right),\nonumber \\
& = & F_{\rho_{I}}\left(\eta_{I}\right),
\end{eqnarray}
with $F_{\rho_{I}}\left(.\right)$ is the CDF of $\rho_{I}$ and $\eta_{I}=2^{\left(\frac{T+\tau}{T}\right)R}-1$.
By substituting $\mathrm{S}\rightarrow\mathrm{D}$, $\mathrm{S}\rightarrow\mathrm{R}$,
and $\mathrm{R}\rightarrow\mathrm{D}$ links received instantaneous
SINR into $\rho_{I}$, we get
\begin{equation}
\begin{aligned}\rho_{I}= & \frac{\gamma_{\mathrm{SR}}\gamma_{\mathrm{RD}}+\gamma_{\mathrm{SD}}\gamma_{\mathrm{SR}}+\gamma_{\mathrm{SD}}}{1+\gamma_{\mathrm{SR}}+\gamma_{\mathrm{RD}}}.\end{aligned}
\end{equation}
Thus, the CDF of $\rho_{I}$ can be derived as
\begin{align}
\begin{aligned}F_{\rho_{I}}\left(x\right) & =\mathrm{Pr}(\rho_{I}<x)\\
& =\mathrm{Pr}\left(\gamma_{\mathrm{SD}}\leq\underset{\mathrm{\Delta}}{\underbrace{\frac{(1+\gamma_{\mathrm{SR}}+\gamma_{\mathrm{RD}})x-\gamma_{\mathrm{SR}}\gamma_{\mathrm{RD}}}{1+\gamma_{\mathrm{SR}}}}}\right)\\
& =\iint_{\Delta\geq0}F_{\gamma_{\mathrm{SD}}}\left(\Delta\right)\times f_{\gamma_{\mathrm{SR}}}(y)\times f_{\gamma_{\mathrm{RD}}}(z)dydz
\end{aligned}
\label{eq:9}
\end{align}
where $F_{\gamma_{\mathrm{SD}}}\left(\Delta\right)=\mathrm{Pr}(\gamma_{\mathrm{SD}}<\Delta)=1-\textrm{e}^{-\alpha_{\mathrm{SD}}\triangle}$,
$f_{\gamma_{\mathrm{SR}}}(y)=\textrm{\ensuremath{\alpha_{\mathrm{SR}}}e}^{-\alpha_{\mathrm{SR}}y}$, and $f_{\gamma_{\mathrm{RD}}}(z)=\textrm{\ensuremath{\alpha_{\mathrm{RD}}}e}^{-\alpha_{\mathrm{RD}}z}$, with $\alpha_{\mathrm{SD}}=\frac{1}{P_{\mathrm{S}}\sigma_{\mathrm{SD}}^{2}}$,
$\alpha_{\mathrm{SR}}=\frac{1}{P_{\mathrm{S}}\sigma_{\mathrm{SR}}^{2}}$,
and $\alpha_{\mathrm{RD}}=\frac{1}{P_{\mathrm{R}}\sigma_{\mathrm{RD}}^{2}}$.
Then, after some manipulations, (\ref{eq:9}) can be derived as
\begin{equation}
\begin{alignedat}{1}F_{\rho_{I}}\left(\eta_{I}\right) & =1-\alpha_{\mathrm{SR}}\intop_{\eta_{I}}^{\infty}e^{-\alpha_{\mathrm{SR}}y}\times e^{-\alpha_{\mathrm{RD}}\left(\frac{1+y}{y-\eta_{I}}\right)\eta_{I}}dy\\
& -\alpha_{\mathrm{RD}}\times\alpha_{\mathrm{SR}}\times e^{(-\alpha_{\mathrm{SD}}\eta_{I})}\times\\
& \Biggl(\intop_{0}^{\infty}\frac{e^{-\alpha_{\mathrm{SR}}y}}{\left(\alpha_{\mathrm{RD}}+\left(\frac{\eta_{I}-y}{1+y}\right)\alpha_{\mathrm{SD}}\right)}dy-\\
& e^{-\alpha_{\mathrm{SD}}\eta_{I}}\intop_{\eta_{I}}^{\infty}\frac{e^{-\left(\alpha_{\mathrm{SR}}y+\alpha_{\mathrm{RD}}\left(\frac{1+y}{y-\eta_{I}}\right)\eta_{I}\right)}}{\left(\alpha_{\mathrm{RD}}+\left(\frac{\eta_{I}-y}{1+y}\right)\alpha_{\mathrm{SD}}\right)}dy\Biggr).
\end{alignedat}
\label{eq:out_phase1}
\end{equation}
Note that all integrals in (\ref{eq:out_phase1}) do not generate
a closed form expression, but can be evaluated numerically using Matlab
software.
The Phase III outage probability $P_{\mathrm{out}}^{III}$ depends
on the adopted HARQ procedure. In general, the $P_{\mathrm{out}}^{III}$
can be expressed as \cite{wcnc18}
\begin{equation}
\begin{aligned}P_{\mathrm{out}}^{III} & =P_{\mathrm{out}}^{\mathrm{S\rightarrow R}}\mathcal{X}+P_{\mathrm{out}}^{\mathrm{S,R\rightarrow D}}\left(1-P_{\mathrm{out}}^{\mathrm{S\rightarrow R}}\right),\end{aligned}
\label{eq:out_syst}
\end{equation}
where $P_{out}^{\mathrm{S\rightarrow R}}$ denotes, the outage probability
of $\mathrm{S\rightarrow R}$ link, and can be expressed as
\begin{eqnarray}
P_{out}^{\mathrm{S\rightarrow R}}= & \mathrm{Pr}(\gamma_{\mathrm{SR}}<\eta)= & 1-\textrm{e}^{-\frac{\eta\left(P_{\mathrm{R}}\sigma_{\mathrm{RR}}^{2}+1\right)}{P_{\textrm{S}}\sigma_{\mathrm{SR}}^{2}}},\label{eq:SR_SD-1}
\end{eqnarray}
where $\eta=2^{R}-1$. In the conventional HARQ procedure, the only
retransmitter node is the relay and the retransmission happens only
if the $\mathrm{S}\rightarrow\mathrm{R}$ link is not in outage. Therefore,
$\mathcal{X}=1$ and $P_{\mathrm{out}}^{\mathrm{S,R\rightarrow D}}$
represents the outage probability of the combined signal, i.e., Phase
I and Phase III received signals, at the destination side when the
relay is the retransmitter node. In the enhanced HARQ procedure,
when the $\mathrm{S}\rightarrow\mathrm{R}$ link is in outage, the
source plays the role of the retransmitter instead of the relay during
Phase III. Consequently, $\mathcal{X}=P_{\mathrm{out}}^{\mathrm{S,S\rightarrow D}}$
with $P_{\mathrm{out}}^{\mathrm{S,S\rightarrow D}}$ represents the
outage probability of the combined signal, at the destination side
when the source is the retransmitter node.
In multiple HARQ processes system, when one block $u$ ($0\leq u\leq3$)
is correctly decoded at the destination side, its retransmission TTI
$u+4$ is used for the initial transmission of the next block $v$
in the buffer ($4\leq v\leq7$). However, for the sake of simplicity,
we assume that the TTI $u+4$ is allocated for packet retransmission
even if Phase III is deactivated. Therefore, the $8$-TTI relaying
system can be viewed as a repetition coding scheme where $8$ parallel
sub-channels are used to transmit $4$ symbols message \cite[p.194]{Tse}.
The outage probability $P_{\mathrm{out}}^{\mathrm{S,R\rightarrow D}}$
in (\ref{eq:out_syst}) can be derived as follows
\begin{align}
P_{\mathrm{out}}^{\mathrm{S,R\rightarrow D}} & =\mathrm{Pr}\left(\frac{1}{2T}{\displaystyle \sum_{i=0}^{T-1}}\log_{2}\left(1+\gamma_{i}^{III}\right)<R\right),\nonumber \\
& \approx\mathrm{Pr}\left(\frac{1}{2}\log_{2}\left(1+\rho_{III}\right)<R\right),\label{eq:SRD outage}
\end{align}
with $\rho_{III}$ is given by
\begin{equation}
\rho_{III}=\frac{\gamma_{\mathrm{SR}}\gamma_{\mathrm{RD}}+\gamma_{\mathrm{SD}}\gamma_{\mathrm{SR}}+\gamma_{\mathrm{SD}}}{1+\gamma_{\mathrm{SR}}+\gamma_{\mathrm{RD}}}+\gamma_{\mathrm{RD}},
\end{equation}
thereby, $P_{\mathrm{out}}^{\mathrm{S,R\rightarrow D}}$ can be derived
as
{\footnotesize{}
\begin{align}
\begin{aligned}\mathrm{Pr}(\rho_{III}<x) & =\mathrm{Pr}\left(\gamma_{\mathrm{SD}}\leq\underset{\mathrm{\varphi}}{\underbrace{\frac{(1+\gamma_{\mathrm{SR}}+\gamma_{\mathrm{RD}})(x-\gamma_{\mathrm{RD}})-\gamma_{\mathrm{SR}}\gamma_{\mathrm{RD}}}{1+\gamma_{\mathrm{SR}}}}}\right)\\
& =\iint_{\varphi\geq0}F_{\mathrm{SD}}\left(\varphi\right)\times f_{\gamma_{\mathrm{SR}}}(y)\times f_{\gamma_{\mathrm{RD}}}(z)dydz.
\end{aligned}
\label{eq:19-1-1}
\end{align}
}{\footnotesize \par}
To proceed, let's denote $g(\gamma_{\mathrm{SR}},z)=\left(1-\textrm{e}^{-\alpha_{\mathrm{SD}}\varphi}\right)\times f_{\gamma_{\mathrm{RD}}}(z)$.
First, we have to integrate $g(\gamma_{\mathrm{SR}},z)$ while considering
$\gamma_{\mathrm{SR}}$ as constant. Thereby, we extract limit bounds
for z variable in a way to satisfy $\left((1+\gamma_{\mathrm{SR}}+\gamma_{\mathrm{RD}})(x-\gamma_{\mathrm{RD}})-\gamma_{\mathrm{SR}}\gamma_{\mathrm{RD}}\right)>0$,
after some manipulations we found so, the corresponding bounds, i.e.,
$z\in\left[0,\,\frac{\sqrt{\left(\left(2\gamma_{\mathrm{SR}}+1-x\right)^{2}+4x(\gamma_{\mathrm{SR}}+1)\right)}+\left(x-\left(2\gamma_{\mathrm{SR}}+1\right)\right)}{2}\right],\,\forall\gamma_{\mathrm{SR}}$.
Applying \cite[2.33.3*]{tabl_int52}, we get therefore, the first
integral resolution, then, we integrate the resulting expression,
depending to the variable $\gamma_{\mathrm{SR}}$, i.e., $y\in\left[0,\,\infty\right]$,
to get thus, the system outage probability as in (\ref{eq:out_phase3}),
with $\eta_{III}=2^{2R}-1$ and $erfi$ represents the imaginary error function.
\begin{flushleft}
{\small{}}
\begin{algorithm*}[tbh]
\begin{raggedright}
{\small{}
\begin{equation}
\begin{aligned}P_{\mathrm{out}}^{\mathrm{S,R\rightarrow D}} & =1-\alpha_{\mathrm{SR}}e^{-\frac{\left(\eta_{III}-1\right)\alpha_{\mathrm{RD}}}{2}}\intop_{0}^{\infty}\left(e^{-\left(\left(\alpha_{\mathrm{SR}}-\alpha_{\mathrm{RD}}\right)y+\alpha_{\mathrm{RD}}\left(\frac{\sqrt{\left(\left(2y+1-\eta_{III}\right)^{2}+4\eta_{III}(y+1)\right)}}{2}\right)\right)}\right)\, dy\\ & -\frac{\alpha_{\mathrm{SR}}\alpha_{\mathrm{RD}}e^{-\alpha_{\mathrm{SD}}\eta_{III}}}{2}\intop_{0}^{\infty}\Biggl(\sqrt{\frac{\pi\left(y+1\right)}{\alpha_{\mathrm{SD}}}}\times e^{-\left(\frac{\left(2y+1-\eta_{III}+\alpha_{\mathrm{RD}}\right)^{2}}{y+1}\right)}\times\textrm{e}^{-\alpha_{\mathrm{SR}}y}\\ & \times\Biggl(\mathrm{erfi}\Biggl(\sqrt{\frac{\alpha_{\mathrm{SD}}}{y+1}}\times\Biggl(\left(y-\frac{(\eta_{III}-1)}{2}\right)+\frac{\sqrt{\left(\left(2y+1-\eta_{III}+\alpha_{\mathrm{RD}}\right)^{2}+4\eta_{III}(y+1)\right)}}{2}\Biggr)\Biggr)\\ & -\mathrm{erfi}\Biggl(\sqrt{\frac{\alpha_{\mathrm{SD}}}{y+1}}\times\mathrm{\left(2y+1-\mathit{\eta_{III}+\alpha_{\mathrm{RD}}}\right)\Biggr)}\Biggr)\Biggr)\, dy,\end{aligned}
\label{eq:out_phase3}
\end{equation}
}
\par\end{raggedright}{\small \par}
\end{algorithm*}
\par\end{flushleft}{\small \par}
\begin{flushleft}
The outage probability $P_{\mathrm{out}}^{\mathrm{S,S\rightarrow D}}$
in (\ref{eq:out_syst}) is given by
\begin{alignat}{1}
P_{\mathrm{out}}^{\mathrm{S,S\rightarrow D}} & \approx\mathrm{Pr}\left(\frac{\gamma_{\mathrm{SR}}\gamma_{\mathrm{RD}}+\gamma_{\mathrm{SD}}\gamma_{\mathrm{SR}}+\gamma_{\mathrm{SD}}}{1+\gamma_{\mathrm{SR}}+\gamma_{\mathrm{RD}}}+\gamma_{\mathrm{SD}}<\eta_{III}\right),\label{eq:outage-SSD}
\end{alignat}
we get then
\par\end{flushleft}
{\small{}
\begin{equation}
\begin{aligned}P_{\mathrm{out}}^{\mathrm{S,S\rightarrow D}} & =\textrm{Pr}\left(\underset{\mathrm{\rho_{I}}}{\underbrace{\frac{\gamma_{\mathrm{SR}}\gamma_{\mathrm{RD}}+\gamma_{\mathrm{SD}}\gamma_{\mathrm{SR}}+\gamma_{\mathrm{SD}}}{1+\gamma_{\mathrm{SR}}+\gamma_{\mathrm{RD}}}}}\leq\underset{\mathrm{\Psi}}{\underbrace{\left(\eta_{III}-\gamma_{\mathrm{SD}}\right)}}\right)\\
& =\int_{\Psi\geq0}F_{\rho_{I}}\left(\Psi\right)\times f_{\gamma_{\mathrm{SD}}}(x)dx.
\end{aligned}
\end{equation}
}Let's first develop the first term in (\ref{eq:out_phase1}), $X=1-\alpha_{\mathrm{SR}}\intop_{\eta_{I}}^{\infty}e^{-\alpha_{\mathrm{SR}}y}\times e^{-\alpha_{\mathrm{RD}}\left(\frac{1+y}{y-\eta_{I}}\right)\eta_{I}}dy$,
using the integration by change of variables, $u=y-\eta_{I}$, while
applying \cite[3.471.9]{tabl_int52}, we get
{\small{}
\begin{align}
\begin{alignedat}{1}X & =1-\alpha_{\mathrm{SR}}e^{-(\alpha_{\mathrm{SR}+}\alpha_{\mathrm{RD}})\eta_{I}}\intop_{0}^{\infty}e^{-\alpha_{\mathrm{RD}}\left(\frac{1+\eta_{I}+u}{u}\right)\eta_{I}-\alpha_{\mathrm{SR}}u}du\\
& =1-\Biggl(2e^{-(\alpha_{\mathrm{SR}+}\alpha_{\mathrm{RD}})\eta_{I}}\sqrt{\alpha_{\mathrm{SR}}\alpha_{\mathrm{RD}}\left(1+\eta_{I}\right)\eta_{I}}\\
& \times K_{1}\left(2\sqrt{\alpha_{\mathrm{SR}}\alpha_{\mathrm{RD}}\left(1+\eta_{I}\right)\eta_{I}}\right)\Biggr)
\end{alignedat}
\label{eq:firstTerm}
\end{align}
}Next, we insert (\ref{eq:firstTerm}) into (\ref{eq:out_phase1}).
Then, we integrate $\left[F_{\rho_{I}}\left(\eta_{III}-x\right)\times f_{\gamma_{\mathrm{SD}}}(x)\right]$
with respect to the variable $\gamma_{\mathrm{SD}}$, i.e., $x$,
that shall fall within the interval defined by $\left[0,\,\eta_{III}\right]$.
We get thus, the system outage probability as in (\ref{eq:System_CDF_sdPhase3}). With $A(x)=\alpha_{\mathrm{SR}}\alpha_{\mathrm{RD}}\left(1+\eta_{III}-x\right)\left(\eta_{III}-x\right).$
\begin{algorithm*}[tbh]
{\small{}
\begin{align}
\begin{aligned}P_{U}^{\mathrm{S,S\rightarrow D}} & =1-e^{-\alpha_{\mathrm{SD}}\eta_{III}}-2\alpha_{\mathrm{SD}}e^{-(\alpha_{\mathrm{SR}+}\alpha_{\mathrm{RD}})\eta_{III}}\intop_{0}^{\eta_{III}}\sqrt{A(x)}\times K_{1}\left(2\sqrt{A(x)}\right)\times e^{-\left(\alpha_{\mathrm{SD}}-\left(\alpha_{\mathrm{SR}+}\alpha_{\mathrm{RD}}\right)\right)x}\, dx\\
& -\alpha_{\mathrm{SR}}\alpha_{\mathrm{RD}}e^{-\alpha_{\mathrm{SD}}\eta_{III}}\Biggl(\intop_{0}^{\eta_{III}}\Biggl(\intop_{0}^{\infty}\frac{e^{-\left(\alpha_{\mathrm{SR}}y-\alpha_{\mathrm{SD}}x\right)}}{\left(\alpha_{\mathrm{RD}}+\left(\frac{\eta_{III}-y-x}{1+y}\right)\alpha_{\mathrm{SD}}\right)}dy-\\
& e^{-\alpha_{\mathrm{SD}}\eta_{III}}\intop_{\eta_{III}-x}^{\infty}\frac{e^{-\left(\alpha_{\mathrm{SR}}y+\alpha_{\mathrm{RD}}\left(\frac{1+y}{y-\eta_{III}+x}\right)\left(\eta_{III}-x\right)+2\alpha_{\mathrm{SD}}x\right)}}{\left(\alpha_{\mathrm{RD}}+\left(\frac{\eta_{III}-y-x}{1+y}\right)\alpha_{\mathrm{SD}}\right)}dy\Biggr)dx\Biggr)
\end{aligned}
\label{eq:System_CDF_sdPhase3}
\end{align}
}{\small \par}\end{algorithm*}
{\small \par}Integrals in (\ref{eq:System_CDF_sdPhase3}) do not generate a closed
form expression, but can be evaluated numerically using Matlab software.
Finally, by substituting (\ref{eq:out_phase1}), (\ref{eq:SR_SD-1}),
(\ref{eq:out_phase3}), and (\ref{eq:System_CDF_sdPhase3}) into (\ref{eq:out_syst}),
we get the expression of the system outage probability.
\section{\label{sec:Numerical-Results}Numerical Results}
In this section, the performance of the proposed relay-based HARQ procedures are studied through numerical results, and are labeled respectively as, "conventional sim" and "enhanced sim" in all figures. We used for that purpose, Monte-Carlo simulations to confirm theoretical findings derived in Section
\ref{sec:Outage-Probability}. We then represent the performance simulations
in comparison with the two main relaying schemes with no retransmission
procedure, i.e., the AF as the relaying scheme that includes a very
negligibile latency and the SDF with a latency of $3$ times the transmission
time interval, i.e., $3\times TTI$. We also use the S2D HARQ-based
system where no relay assists the communication between the source
and the destination as a reference to evaluate the performance of
the proposed relay-assisted HARQ procedures %
\footnote{Similar to the proposed system, in the S2D HARQ-based system, only
one HARQ retransmission is allowed.%
}. We assumed for simulation purposes, an equal power allocation among
the source and the relay, i.e., $P=P_{\mathrm{s}}=P_{\mathrm{R}}$,
and $T_{TTI}=125\,\textrm{\ensuremath{\mu}s}$%
\footnote{To achieve a target of 1 ms latency's requirement, we consider a frame
structure for 5G NR that offers a shorten duration of the TTI. Thus
according to a 3rd Generation Partnership Project 3GPP, using the
scalable OFDM numerology, while assuming a subcarrier spacing of 120$\,\textrm{KHZ}$
\cite{zaidi61_latency,70}, the $14$ symbols TTI duration is $T_{\textrm{TTI}}=125\,\textrm{\ensuremath{\mu}s}$
.%
}. The relay and the destination noise powers are assumed to be normalized
to $1$. For a fair comparison, we have set the sum of the transmitted power from the source and the relay nodes of the cooperative system equal to that of
the non-cooperative system (S2D). We note that, $\sigma_{\mathrm{SD}}^{2}$, $\sigma_{\mathrm{SR}}^{2}$, $\sigma_{\mathrm{RD}}^{2}$, and $\sigma_{\mathrm{RR}}^{2}$ stand respectively for, the source-to-destination link gain, the source-to-relay link gain, the relay-to-destination link gain, and the RSI level.
\begin{figure}[h]
\centering{}\includegraphics[scale=0.50]{Latency}\protect
\caption{\label{fig:Lat-versusSNRdB} \small \textbf{The latency budget at satisfied level of reliability.}
\\$\sigma_{\mathrm{SR}}^{2}=\sigma_{\mathrm{RD}}^{2}=10\,\mathrm{dB}$,
$\sigma_{\mathrm{SD}}^{2}=0\,\mathrm{dB}$, and negligible RSI. }
\end{figure}
First, through Fig. \ref{fig:Lat-versusSNRdB}, we assert enhancements noted with both proposed procedures in term of latency. We represent indeed, the latency level versus the transmit SNR, at a satisfied level of reliability. We compare improvements respectively between, the enhanced procedure, the conventional procedure, and the direct transmission, i.e., S2D. Note that, for the sake of clarity, results are given with a relaxed latency constraint of 1.5 ms, i.e., two allowed retransmissions. The aim is to affirm the flexibility of both procedures as they maintain their gain even with more than one retransmission. As clearly noticed, a significant enhancement is noted with what we propose, specifically, with the enhanced procedure. It is observed that the 1 ms latency constraint with a satisfied level of reliability can be achieved at less than 10 dB for the enhanced procedure whereas it requires more than 20 dB for the S2D scheme. The purpose of this work is to satisfy the 1 ms use case of URLLC, thus, all outage performance results below, are obtained on the basis of one allowed retansmission.\\
\\
At first, we notice overall, that simulation results match perfectly
with theoretical analysis obtained in Section$\,$\ref{sec:Outage-Probability}. Fig.
\ref{fig:Outage-probabilityhigh-versusSD}$.a$
and Fig. \ref{fig:Outage-probabilitylow-versusSD}$.a$, depict the
outage performance with respect to data transmission rate, $R$. In
Fig. \ref{fig:Outage-probabilityhigh-versusSD}$.a$, we clearly see
that when the direct link between the source and the destination is
negligible ($\sigma_{\mathrm{SD}}^{2}=-10\,\textrm{dB}$), the
S2D transmission fails even after two transmission rounds and using
a relay with better transmission links becomes mandatory. Due to the
SDF relaying high latency, the AF relaying offers the best performance
for one round transmissions. Using a second round transmission in
the relay-based system boosts the cooperative diversity and leads
to a better performance. In Fig. \ref{fig:Outage-probabilitylow-versusSD}$.a$,
we clearly see that implementing HARQ procedure in a relay based system
enhances the system outage probability from $2\times10^{-2}$ to $2\times10^{-4}$
at $R=1$. Moreover, we notice that while for low direct link gains
($\sigma_{\mathrm{SD}}^{2}=-10\,\textrm{dB}$), the proposed HARQ
procedures have almost similar performance, the enhanced HARQ procedure
tends to outperform the conventional one as the direct link becomes
prominent ($\sigma_{\mathrm{SD}}^{2}=5\,\textrm{dB}$).
In Fig. \ref{fig:Outage-probabilityhigh-versusSD}$.b$ and Fig. \ref{fig:Outage-probabilitylow-versusSD}$.b$,
we plot the percentage of each node cooperation during the second
round when the destination fails to decode the first round transmission.
For S2D system, the percentage of the source cooperation during the
second round is given by $P_{\mathrm{out}}^{\mathrm{S\rightarrow D}}\%$.
For relay-assisted system, the percentage of the relay cooperation
during the second round is given by $\left(1-P_{\mathrm{out}}^{\mathrm{S\rightarrow R}}\right)\times P_{\mathrm{out}}^{I}\%$
while the percentage of the source cooperation during the second round
for enhanced procedure is given by $P_{\mathrm{out}}^{\mathrm{S\rightarrow R}}\times P_{\mathrm{out}}^{I}\%$.
As observed from Fig. \ref{fig:Outage-probabilityhigh-versusSD}$.b$,
in a relay-based system, the source cooperation steadily increases
with the increase of transmission rate starting from zero cooperation
at very low rates. On the other hand, the relay cooperation gives
different performance trends. At low transmission rates, the relay cooperation
increases with the increase of $R$. After some point, it starts decreasing
until it reaches zero cooperation at high rates. This is due to the
fact that, at very low rates the destination can correctly decode
the first round received packet. As the source increases its information
rate, the first round transmission outage takes place with high probability
and thereby the relay is activated to retransmit the packet. As the
source further increases its rate, the $\mathrm{S\rightarrow R}$
link outage occurs more frequently which means that the relay becomes
unable to cooperate using SDF and the system has either to keep silent
during the second round when using the conventional HARQ procedure
or to rely more on the source cooperation in the case of enhanced
HARQ procedure. In Fig. \ref{fig:Outage-probabilitylow-versusSD}$.b$,
when the direct link is non negligible ($\sigma_{\mathrm{SD}}^{2}=5\,\textrm{dB}$),
the S2D source cooperation curve during the second round has same
shape as the relay-based source cooperation curve. However, thanks
to the good relaying links ($\sigma_{\mathrm{SR}}^{2}=\sigma_{\mathrm{RD}}^{2}=10\,\mathrm{dB}$)
the relay-based system outage probability is very low during the first
round compared to the S2D system and thereby the system nodes cooperation
is reduced during the second round with a better outage performance.
\begin{figure}[H]
\begin{centering}
\includegraphics[scale=0.50]{fig5a}
\par\end{centering}
$\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;} a)${\small{}
Outage probability versus} $R$.
\begin{centering}
\includegraphics[scale=0.50]{fig5b}
\par\end{centering}
$\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;} b)$ {\small{}Percentage
of retransmission.}{\small \par}
\protect\caption{\label{fig:Outage-probabilityhigh-versusSD}\small \textbf{The impact of transmission rate for negligible direct link}.
\\ $\sigma_{\mathrm{SR}}^{2}=\sigma_{\mathrm{RD}}^{2}=10\,\mathrm{dB}$,
$\sigma_{\mathrm{SD}}^{2}=-10\,\mathrm{dB}$, $\sigma_{\mathrm{RR}}^{2}=-10\,\mathrm{dB}$,
and $P=5\,\mathrm{dB}$. }
\end{figure}
\begin{figure}[h]
\begin{centering}
\includegraphics[scale=0.50]{fig6a}
\par\end{centering}
$\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;} a)$
{\small{}Outage probability versus }$R$.
\begin{centering}
\includegraphics[scale=0.50]{fig6b}
\par\end{centering}
$\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;} b)$ {\small{}Percentage
of retransmission.}{\small \par}
\protect\caption{\label{fig:Outage-probabilitylow-versusSD} \small \textbf{The impact of transmission rate for moderate direct link}.
\\$\sigma_{\mathrm{SR}}^{2}=\sigma_{\mathrm{RD}}^{2}=10\,\mathrm{dB}$,
$\sigma_{\mathrm{SD}}^{2}=5\,\mathrm{dB}$, $\sigma_{\mathrm{RR}}^{2}=-10\,\mathrm{dB}$,
and $P=5\,\mathrm{dB}$. }
\end{figure}
We further highlight the previously mentioned conclusions from different
perspectives in Fig. \ref{fig:Outage-probabilitylow-versusSD-1} and
Fig. \ref{fig:Outage-probabilitylow-versusSR-1-1}, where we investigate
the outage performance respectively, according to $\sigma_{\mathrm{SD}}^{2}$
and $\sigma_{\mathrm{SR}}^{2}$. Clearly Fig. \ref{fig:Outage-probabilitylow-versusSD-1}$.a$
points out the boosting effect of the direct link gain as it tends
to become gradually prominent. This favors mainly the use of a second
round transmission whether over a relay-based system, i.e., enhanced
HARQ or upon a S2D transmission. As can be seen, both of schemes have the
same slope with a large noted diversity gain regarding the first
round transmissions. However the proposed enhanced HARQ
procedure still the best in term of outage performance, mainly
due to the additional cooperative diversity brought through incorporating the $\mathrm{R}\rightarrow\mathrm{D}$
link. Indeed, with the increase of the direct link gain, the retransmission
opportunity results into more gains in terms of reliability. Specifically,
this gain is exhibited through the use of the direct link that interposes
to retransmit, whenever the relay is in outage.
Regarding the nodes cooperation during the second round, Fig. \ref{fig:Outage-probabilitylow-versusSD-1}$.b$,
thanks to the good relaying links ($\sigma_{\mathrm{SR}}^{2}=\sigma_{\mathrm{RD}}^{2}=10\,\mathrm{dB}$),
the outage event on the relay-based system is less likely to happen
during the first round and thus the system nodes cooperation is reduced
during the second round. More specifically, at low $\mathrm{S\rightarrow D}$
link gains ($\sigma_{\mathrm{SD}}^{2}<0\,\textrm{dB}$), once a second
round transmission is required, the relay-based system will count
more on the relay involvement. On the other hand, at low direct link
gains, the outage probability of the S2D transmission is very high,
thereby the source cooperation becomes a necessity. Then, after the
sharp increase in the direct link gain, the system nodes cooperation
is extremely excluded. Nevertheless, the system nodes cooperation
in the relay-based system is still slightly higher than the S2D system
with a very negligible gain in term of outage probability. In summary,
for low $\mathrm{S\rightarrow D}$ link gains, the enhanced relay-based
HARQ system offers the best performance with low power consumption
during the second round. However, as the $\mathrm{S\rightarrow D}$
link becomes dominant, shutting down the relay seems to be the best
solution in term of both outage performance and power consumption.
For the rest of this section, we focus our analysis on low $\mathrm{S\rightarrow D}$
link case, i.e. $\sigma_{\mathrm{SD}}^{2}=0\,\textrm{dB}$.
\begin{flushleft}
\begin{figure}[tbh]
\begin{centering}
\includegraphics[scale=0.50]{Figure7a}
\par\end{centering}
$\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;} a)$
{\small{}Outage probability versus} $\sigma_{\mathrm{SD}}^{2}$.
\begin{centering}
\includegraphics[scale=0.50]{Figure7b}
\par\end{centering}
$\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;}\hphantom{\;} b)$ {\small{}Percentage
of retransmission.}{\small \par}
\centering{}\protect\caption{\label{fig:Outage-probabilitylow-versusSD-1} \small \textbf{The boosting impact of the direct link}.
\\ $\sigma_{\mathrm{SR}}^{2}=\sigma_{\mathrm{RD}}^{2}=10\,\mathrm{dB}$,
$R=1$, and $\sigma_{\mathrm{RR}}^{2}=-10\,\mathrm{dB}$. }
\end{figure}
\par\end{flushleft}
Now, we consider in Fig. \ref{fig:Outage-probabilitylow-versusSR-1-1},
the scenario where the $\mathrm{S}\rightarrow\mathrm{R}$ and the
$\mathrm{R}\rightarrow\mathrm{D}$ link are varying equally, and the
direct link gain is brought to noise level, i.e., $\sigma_{\mathrm{SD}}^{2}=0\,\textrm{dB}$.
As noticed, all cooperative schemes yield almost lower performance for a weak first hop link, where generally, the relay is likely to be in outage, thereby no information will successfully reach the destination by the mean of the relay.
Otherwise, adopting a second round transmission for relay-based systems
(conventional and enhanced HARQ procedures) offers indeed better outage
performance as the $\mathrm{R}\rightarrow\mathrm{D}$ and $\mathrm{S}\rightarrow\mathrm{R}$
link gains become stronger. Note that whatever the first and second
hop link strengths, the enhanced HARQ procedure outperforms the conventional one however, with a reduced performance gap. This happens obviously because of the non apparent
use of the direct link that favors mainly the enhanced HARQ procedure.
On the other hand, for one round transmissions, still AF relaying
the best in term of outage performance.
\begin{figure}[tbh]
\begin{centering}
\includegraphics[scale=0.50]{Figure8}
\par\end{centering}
\centering{}\protect\caption{\label{fig:Outage-probabilitylow-versusSR-1-1} \small \textbf{The relaying link impact on the outage performance}.
\\$\sigma_{\mathrm{SR}}^{2}=\sigma_{\mathrm{RD}}^{2}$,
$\sigma_{\mathrm{SD}}^{2}=0\,\mathrm{dB}$, $R=1$, and $\sigma_{\mathrm{RR}}^{2}=-10\,\mathrm{dB}$. }
\end{figure}
To evaluate the diversity order of the different schemes, we plot,
in Fig. \ref{fig:Outage-probabilitylow-versusSNR_NoRSI}, Fig. \ref{fig:Outage-probabilitylow-versusSNR_RSI0dB},
and Fig. \ref{fig:Outage-probabilitylow-versusSNR_RSI_minus10dB},
the outage probability versus the transmit SNR level at the source
and the relay, both set to $P$. In Fig. \ref{fig:Outage-probabilitylow-versusSNR_NoRSI},
we ignore the RSI effect at the relay for all FD relaying schemes.
As shown, the first round S2D and the AF curves have the same slope
indicating a unity diversity order. As expected, using a second round
increases the diversity order for both direct and relay-based transmissions.
Using HARQ, the S2D transmission scheme and the conventional HARQ procedure reach the same classical diversity order of $2$. Indeed, despite the advantage of the good relaying links, the limited increase in the diversity order for the conventional procedure is
mainly due to the fact that when the $\mathrm{S\rightarrow R}$ is
in outage, the second round transmission is deactivated. On the other
hand, from Fig. \ref{fig:Outage-probabilitylow-versusSNR_NoRSI}, we notice that the enhanced HARQ procedure, where the source is involved during
the second round whenever the $\mathrm{S\rightarrow R}$ link is in
outage, enjoys of a much higher diversity order of $3$.
\begin{center}
\begin{figure}[h]
\centering{}\includegraphics[scale=0.50]{Figure9}\protect\caption{\label{fig:Outage-probabilitylow-versusSNR_NoRSI} \small \textbf{The perfect scenario}.
\\$\sigma_{\mathrm{SR}}^{2}=\sigma_{\mathrm{RD}}^{2}=10\,\mathrm{dB}$,
$\sigma_{\mathrm{SD}}^{2}=0\,\mathrm{dB}$, and negligible RSI. }
\end{figure}
\par\end{center}
In Fig. \ref{fig:Outage-probabilitylow-versusSNR_RSI0dB}, we consider
the case where the RSI gain in $\gamma_{\mathrm{SR}}=\frac{P_{\textrm{S}}|h_{\mathrm{\mathrm{SR}}}|^{2}}{P_{\mathrm{R}}\sigma_{\mathrm{RR}}^{2}+N_{R}}$
scales linearly with the relay transmit power, i.e., $\sigma_{\mathrm{RR}}^{2}=0\,\mathrm{dB}$.
We notice that all FD-relaying schemes diversity are badly affected
by the loop-back interference at the relay side, i.e., the conventional
HARQ procedure experiences an error floor while the enhanced HARQ
procedure diversity order drops to $1$. Still the proposed schemes
offer the best performance for moderate transmit power values.
However, as shown in the Fig. \ref{fig:Outage-probabilitylow-versusSNR_RSI_minus10dB},
the performance of the FD-relaying schemes can be significantly enhanced if
the adopted loopback interference isolation and cancellation techniques
can dramatically reduce the RSI effect, i.e., $\sigma_{\mathrm{RR}}^{2}=-10\,\mathrm{dB}$.
\begin{figure}[h]
\centering{}\includegraphics[scale=0.50]{Figure10}\protect\caption{\label{fig:Outage-probabilitylow-versusSNR_RSI0dB} \small \textbf{A worst-case scenario}.
\\$\sigma_{\mathrm{SR}}^{2}=\sigma_{\mathrm{RD}}^{2}=10\,\mathrm{dB}$,
$\sigma_{\mathrm{SD}}^{2}=0\,\mathrm{dB}$, and $\sigma_{\mathrm{RR}}^{2}=0\,\mathrm{dB}$. }
\end{figure}
\begin{figure}[h]
\centering
\captionsetup{justification=centering}
\includegraphics[scale=0.50]{Figure11}\protect
\caption{\label{fig:Outage-probabilitylow-versusSNR_RSI_minus10dB} \small \textbf{A realistic-case scenario}.
\\$\sigma_{\mathrm{SR}}^{2}=\sigma_{\mathrm{RD}}^{2}=10\,\mathrm{dB}$,
$\sigma_{\mathrm{SD}}^{2}=0\,\mathrm{dB}$, and $\sigma_{\mathrm{RR}}^{2}=-10\,\mathrm{dB}$. }
\end{figure}
\section{\label{sec:Conclusion}Conclusion}
In this paper, we investigated a hybrid FD AF-SDF relay-based system
and we proposed two retransmission procedures within which the HARQ
RTT is shortened as a path towards URLLC. Once a packet is received
in error, the studied system might move along one of suggested retransmission
procedures, namely, the conventional and the enhanced HARQ procedures.
Thereby, to capture their inherent performance difference, we derived the
analytical outage probability expression
respectively, for the conventional and the enhanced mechanisms. Then
we compared them to the most known relaying techniques, i.e., AF as
the low latency relay processing scheme, and the SDF scheme that requires
complex encoding and decoding algorithms. Furthermore for a fair comparison,
we included the non-cooperative mode, where the direct link handles
both, the transmission and the retransmission whenever a second round
transmission becomes a necessity. Indeed, both of procedures allow
a prompt processing, however as simulation results have revealed,
the enhanced one offers additional improvements in term of reliability
and eventually further available diversity via the direct link whenever
the RSI is negligible.
| {'timestamp': '2020-12-14T02:23:13', 'yymm': '2010', 'arxiv_id': '2010.08455', 'language': 'en', 'url': 'https://arxiv.org/abs/2010.08455'} | arxiv |
\section{Code Generation}
\sectionlabel{codegen}
Our compiler parses the code, performs language-specific optimization passes on the AST, and then
generates code for either CPU or GPU using a code generator built on top of the LLVM toolchain
\cite{LLVM:CGO04}.
The rest of this section is structured as follows. \sectionref{codegen-language-features} describes
how various language features are compiled to LLVM IR, including closures and distribution
objects. \sectionref{codegen-stack} describes the implementation of the call stack and how different
language constructs interact with it. \sectionref{codegen-delimcont} describes how delimited
continuations are implemented for CPU. Finally \sectionref{codegen-inference} describes the code
generation for the inference methods on CPU, using delimited continuations, and GPU, using custom
generated NVVM IR.
\subsection{Language Features}
\sectionlabel{codegen-language-features}
\subsection{Call Stack}
\sectionlabel{codegen-stack}
The generated LLVM IR does not use the \llvmir{call} operator. Instead it uses a combination of
\llvmir{indirectbr} and a custom ``managed stack''. This allows for more complex stack operations
necessary for implementing delimited continuations as discussed in \sectionref{codegen-delimcont}.
The managed stack is stored in region of heap allocated memory, allocated when the program starts. A
stack pointer is also stored. LLVM IR is generated for the operations that modify the stack:
\begin{itemize}
\item
Push and pop work just like a conventional stack.
\item
The stack save operation copies a chosen number of bytes from the top of the stack into a newly
allocated region on the heap, and returns a pointer to it, and then pops this region off of the
stack. This operation is used by delimited continuations to capture the current state of the
program up to the last reset, as part of the implementation of \code{shift} discussed in
\sectionref{codegen-delimcont}.
\item
The stack restore operation pushes a previously saved stack region onto the top of the
stack. This operation is used to restore the state of the stack when calling a continuation that
was captured by the \code{shift} operator, as detailed in \sectionref{codegen-delimcont}.
\end{itemize}
\subsubsection{Closures}
The LLVM IR code for a closure begins with a labelled basic block. A closure is called using an
\llvmir{indirectbr} to the address of this block (obtained using \llvmir{blockaddress}). This label
is annotated with all possible predecessor blocks, as required by LLVM IR. These are statically
known, but may be a superset of all possibly call sites at runtime.
A closure value is represented by an LLVM IR struct of type \llvmir{\{i64,i64\}}, containing a
pointer to its code and and some memory storing its environment. The environment of a closure is
represented by an LLVM IR struct containing the values of its captured variables. If the environment
is empty, this struct has type \llvmir{\{\}}. The instructions in the entry block of the closure
first unpack this environment into registers, before continuing with the execution of the closure.
When calling a closure, the LLVM IR \llvmir{call} instruction is not used, so that more complex
stack operations can be handled. This requires the code generator to generate code for entry and
return from the call. The code generation strategy is summarised by the pseudocode in
\figureref{codegen-closures}.
\begin{figure}
\begin{pseudocodenumbered}
generateClosureCall(entryPtr, envPtr, args) {
retBlk = llvm::BasicBlock::Create();
retAddr = llvm::BlockAddress::get(retBlk);
for (var in symTab)
generateStackPush(var);
generatePush(retAddr);
generatePush(envPtr);
for (arg in args)
generateStackPush(arg);
builder.CreateIndirectBr(entryPtr);
builder.SetInsertPoint(retBlk);
result = generatePop();
for (var in reverse(symTab))
symTab.update(var, generateStackPop());
return result;
}
\end{pseudocodenumbered}
\begin{pseudocodenumbered}
generateClosureEntry(argVars, freeVars) {
for (var in reverse(argVars))
symTab.update(var, generateStackPop());
envPtr = generateStackPop();
for (var in freeVars)
symTab.update(var, unpack(envPtr, var));
}
\end{pseudocodenumbered}
\begin{pseudocodenumbered}
generateClosureExit(result) {
retAddr = generateStackPop();
generateStackPush(result);
builder.CreateIndirectBr(returnAddress);
}
\end{pseudocodenumbered}
\caption{Code generation strategy for closures}
\figurelabel{codegen-closures}
\end{figure}
\subsubsection{Distribution Values}
Built-in distributions are represented by a struct of type \llvmir{\{int32, int64, int64,
int64\}}. The first element is a tag determining the type of the distribution, and the subsequent
elements contain distribution specific data. These three values provide sufficient space to store
parameters for any of the built-in distributions. This fixed sized encoding of distribution values
allows them to be treated as plain values in LLVM IR, avoiding the need for heap allocation. This
makes them suitable for use on a GPU where heap allocations are expensive.
\subsubsection{Built-in Functions and Runtime Library}
CuPPL\xspace includes a runtime library which implements the built-in functions that are not directly
available in the LLVM IR instruction set. For example, sampling and scoring distributions is
implemented in the runtime library. Separate implementations of this library are provided for CPU
and CUDA GPUs.
\subsubsection{Garbage Collection}
On CPU, where it is needed, the Boehm-Demers-Weiser Garbage Collector \cite{bdwgc} is used. On GPU,
garbage collection is not feasible. Static shape analysis is used to determine a fixed upper bound
for the size of any vectors used so that they can be stack allocated. If the size of a vector cannot
be statically determined the code generator will fall back to making a heap allocation. Depending on
the structure of the program, this heap allocation fallback may exhaust the heap space available on
the GPU, in which case the program will have to be reworked.
\subsection{Delimited Continuations}
\sectionlabel{codegen-delimcont}
The \code{reset} operator marks the current state of the program. It does this by pushing the value
of the stack pointer onto the top of a separate ``reset stack''. When the reset operator exits, the
value is popped off of the reset stack.
The \code{shift} operator captures the current program state as closure value that can be called at
some later point. It creates a closure value containing a pointer to the current instruction and the
contents of the stack up to the last call to \code{reset}. The address of the current instruction is
obtained by starting a new basic block before that instruction and obtaining its address using
\llvmir{blockaddress}. A copy of the stack is obtained using the stack copy operation, to save the
region from the current stack pointer up to the stack pointer stored on the top of the reset stack.
The environment for the captured continuation differs from that of a regular closure. Instead of a
struct containing the values of any captured variables, it is a struct containing the saved stack
region. It has type \llvmir{\{int32, int8*\}} -- storing the size of the captured stack and a
pointer to it.
When a captured continuation is called the same steps are taken as calling a regular
closure. However, instead of unpacking the environment structure into local variables, the saved
stack from the environment structure and is pushed onto the top of the call stack. This restores the
stack (up to the last reset) to the same state it was in when the continuation was captured.
Pseudocode for the implementation of this code generation is shown in \figureref{codegen-delimcont}.
\pseudo{generateResetEntry} generates code for the entry into a \code{reset} expression, and returns
the exit block so that the caller can pass it to \pseudo{generateResetExit} later.
\pseudo{generateResetExit} is called, with the exit block and the return value of the
sub-expression, after code has been generated for the sub-expression in the \code{reset}.
\pseudo{generateShiftEntry} and \pseudo{generateShiftExit} generate code for the entry and exit from
a \code{shift} expression.
\begin{figure}
\begin{pseudocodenumbered}
generateResetEntry() {
for (var in symTab)
generateStackPush(var);
exitBlock = llvm::BasicBlock::Create();
exitAddress = llvm::BlockAddress::get(
exitBlock);
generateStackPush(exitAddress);
stackPtr = generateGetStackPtr();
generateResetStackPush(stackPtr);
return exitBlock;
}
\end{pseudocodenumbered}
\begin{pseudocodenumbered}
generateResetExit(exitBlock, value) {
returnAddress = generateStackPop();
generateStackPush(value);
builder.CreateIndirectBr(returnAddress);
builder.SetInsertPoint(exitBlock);
result = generateStackPop();
generateResetStackPop();
for (var in reverse(symTab))
symtab.update(var, generateStackPop());
return result;
}
\end{pseudocodenumbered}
\begin{pseudocodenumbered}
generateShiftEntry() {
for (var in symTab)
generateStackPush(var);
kBlock = llvm::BasicBlock::Create();
kAddress = llvm::BlockAddress::Get(kBlock);
startPtr = generateResetStackPeek();
capturedStack = generateStackSave(startPtr);
k = builder.CreateStruct(
kAddress, capturedStack);
return builder.CreateStruct(
k, kBlock);
}
\end{pseudocodenumbered}
\begin{pseudocodenumbered}
generateShiftExit(k, kBlock, value) {
returnAddress = generateStackPop();
generateStackPush(value);
builder.CreateIndirectBr(returnAddress);
builder.SetInsertPoint(kBlock);
argument = generateStackPop();
capturedStack = generateStackPop();
generateStackRestore(capturedStack);
for (var in reverse(symTab))
symTab.upate(var, generateStackPop());
return argument;
}
\end{pseudocodenumbered}
\caption{
Pseudocode for code generation of delimited continuation operators \code{shift} and \code{reset}
}
\figurelabel{codegen-delimcont}
\end{figure}
\subsection{Inference}
\sectionlabel{codegen-inference}
Code is generated for the model function, which uses \code{shift} expressions to capture the model
functions continuation and pass it to \code{sample-impl} and \code{factor-impl}, as described in
\sectionref{sample-and-factor}, and in the previous section.
Code is generated for the inference methods \code{importance} and \code{mcmc}, first by converting
them to calls to \code{infer-impl}, as described in \sectionref{infer-impl}, and then generating the
code for the resulting abstract syntax tree.
\section{Conclusions and Future Work}
\sectionlabel{conclusion}
In this paper, we have presented CuPPL\xspace, a probabilistic programming language that generates highly
efficient code for both CPUs and CUDA GPUs. The language is functional in style, and the toolchain
is built on top of LLVM. Our implementation uses delimited continuations on CPU to perform
inference, and custom CUDA codes on GPU.
Compared to other state of the art PPLs Anglican \cite{tolpin2016design} and webppl \cite{dippl},
CuPPL\xspace achieves significantly better performance across a range of benchmarks, and scales linearly to
large numbers of samples. Our implementation of delimited continuations is also competitive with
Racket \cite{plt-tr1}.
In future, we plan to extend our language to support a greater variety of inference methods on both
CPU and GPU. We are investigating parallelizable particle-based inference methods
\cite{paige-nips-2014} for use on GPU.
\section{Evaluation}
\label{sec:evaluation}
This section explores the performance of CuPPL\xspace.
In \sectionref{ppl-performance} we compare CuPPL\xspace against webppl \cite{dippl} and Anglican
\cite{tolpin2016design} across a range of benchmarks, including probabilistic models and
micro-benchmarks.
In \sectionref{delimcont-performance} we compare the performance of our implementation of delimited
continuations against Racket \cite{plt-tr1}.
\subsection{Performance vs Other PPLs}
\sectionlabel{ppl-performance}
The experiments were run on an i7-5820K CPU with 16 GB of main memory and an NVIDIA GTX 710. The
wall clock execution time of the entire program is measured for 10 repeats. Error bars in the plots
show the standard deviation of the measured data.
The benchmark programs are summarized in \tableref{benchmarks}. Each benchmark was implemented in
Anglican \cite{tolpin2016design}, webppl \cite{dippl} and CuPPL\xspace. The CuPPL\xspace versions of the benchmark
code were compiled for both CPU and GPU and run separately. Anglican does not support exact
inference, therefore the \verb|enumerate_geometric| benchmark is omitted for this language.
For models using importance sampling, each language is configured to generate 2 million samples, For
MCMC inference, each language is configured to generate 100 thousand samples and for exact
inference, 10 thousand maximum executions are used. These values were chosen to provide execution
times of the order of a few seconds across most benchmarks.
\begin{figure}
\footnotesize
\rowcolors{2}{white}{gray!25}
\begin{tabular}{lp{5cm}}
\verb|biasedcoin| & Importance sampling to compute expected value of a biased coin,
conditioned on observed coin flips \\
\verb|customdist| & Importance sampling from a custom distribution
(sum of two gaussians) \\
\verb|linear_regression| & Linear regression using MCMC \\
\verb|logistic_regression| & Logistic regression using MCMC \\
\verb|binomial| & Importance sampling to generate a binomial distribution \\
\verb|sevenscientists| & Importance sampling for the seven scientists problem \\
\verb|linefitting| & n-degree polynomial line fitting using importance sampling \\
\verb|enumerate_geometric| & Exact inference to generate a geometric distribution \\
\end{tabular}
\caption{Benchmark programs}
\tablelabel{benchmarks}
\end{figure}
The results are shown in \figureref{results}. This plot shows that CuPPL\xspace is significantly more
performant that both webppl and Anglican across all but one of the benchmarks.
webppl fails to run the line fitting benchmark -- the program was terminated
after 10 minutes without producing a result.
The GPU implementation of CuPPL\xspace improves performance compared to the CPU implementation, for most of
the importance sampling benchmarks. GPU inference does not yet support MCMC or exact inference. The
customdist benchmark performs similarly on CPU and GPU, most likely due to the branching nature of
the benchmark. The more complex line fitting benchmark also shows less of a performance improvement
on GPU compared to CPU. This is also likely due to the branching nature of the program, which is
dependent on an integer sampled from the uniform discrete distribution.
\begin{figure}
\includegraphics[width=0.98\columnwidth]{benchmarks/results.pdf}
\caption{
Execution time across all benchmarks and languages.
Error bars show one standard deviation for 10 repeated measurements.
Where data is omitted, the benchmark is either not supported by that language or takes more than
10 minutes to run.
}
\figurelabel{results}
\end{figure}
The scalability for two of the benchmarks is shown in \figureref{scaling-ppl}. \verb|linefitting| is
the more complex of the importance sampling benchmarks, and \verb|linear_regression| uses
Lightweight MH inference. These results show that each language scales similarly, however the slope
for CuPPL\xspace is reduced.
\begin{figure}
\includegraphics[width=0.98\columnwidth]{benchmarks/scaling-ppl.pdf}
\caption{
Performance two benchmarks using different inference methods.
Error bars show one standard deviation for 10 repeated measurements.
}
\figurelabel{scaling-ppl}
\end{figure}
\subsection{Micro-benchmarks}
\figureref{scaling-microbench} compares the scalability of CuPPL\xspace, webppl, Anglican and Racket for
two microbenchmarks. \verb|fibonacci| implements the naive recursive fibonacci algorithm to test
function call performance. \verb|vectorsum| sums a vector of $n$ ones, to test memory bound
performance.
The results show that CuPPL\xspace, Anglican and Racket all perform similarly for function call
performance, whereas webppl performance is initially similar but does not scale well. For memory
bound performance, webppl performs poorly. The other languages all scale similarly, however CuPPL\xspace is
significantly faster.
\begin{figure}
\includegraphics[width=0.98\columnwidth]{benchmarks/scaling-microbench.pdf}
\caption{
Performance results for two micro-benchmarks.
Error bars show one standard deviation for 10 repeated measurements.
}
\figurelabel{scaling-microbench}
\end{figure}
\subsection{Delimited Continuation Performance}
\sectionlabel{delimcont-performance}
The prefix algorithm, shown in \figureref{prefix-code} is used to compare our implementation against
Racket \cite{plt-tr1}. The results are shown in \figureref{prefix-results}, and show that the
performance of our implementation is competitive.
\begin{figure}
\begin{novacode}
type List : (+ (Cons : (int, List))
(Nil : unit));
visit <- function (lst) {
case (lst) {
Nil = shift(k, Nil())
Cons (a, rst) =
(Cons(a,
shift(k,
append(k(Nil()),
reset(k(visit(rst)))))))
}
};
prefix <- function(lst) {
reset(visit(lst))
}
\end{novacode}
\caption{
Code for the prefix benchmark in CuPPL\xspace. \code{append} is omitted for brevity.
For input \code{[1, 2, 3]}, this outputs \code{[1, 1, 2, 1, 2, 3]}.
}
\figurelabel{prefix-code}
\end{figure}
\begin{figure}
\includegraphics[width=0.95\columnwidth]{benchmarks/prefix.pdf}
\caption{
Execution time against input size for the prefix benchmark,
comparing CuPPL\xspace to Racket.
}
\figurelabel{prefix-results}
\end{figure}
\section{Introduction}
\sectionlabel{introduction}
Probabilistic Programming Languages (PPLs) are a powerful machine learning tool, allowing highly
expressive generative models to be expressed succinctly, and complex inference to be applied to
them. They typically provide a range of built-in distributions from which samples can be drawn and
scored, along with a range of inference algorithms.
CuPPL\xspace is a functional programming language, with all of the standard control flow constructs
including let expressions, conditional expressions, recursive functions, algebraic datatypes and
case statements. It also includes a \code{vector} data type and a suite of built-in vector operators
such as \code{map}, \code{reduce} and \code{repeat}.
CuPPL\xspace provides two basic probabilistic primitives: \code{sample} and \code{factor}. These can be
used within a generative model to sample from and score a suite of built-in distributions and user
defined distribution objects.
These primitives are implemented in using delimited continuations and the operators \code{shift} and
\code{reset} \cite{Felleisen1988}.
CuPPL\xspace then provides inference methods that can be applied to a model function in order to generate
the posterior distribution from the model.
\subsection{PPL Example}
An example of a generative model is given in \figureref{ppl-example2}, which
demonstrates the diverse control flow that CuPPL\xspace allows within the model function, and which gives
PPLs their expressive power.
This model finds the $n$-degree polynomial that best fits some given data. The degree of the
polynomial is sampled from a uniform prior, and its coefficients from gaussian priors. The
polynomial is then conditioned on a measure of its ``distance'' from the data. The model returns the
polynomial, as a vector of coefficients. Running inference on this model produces an empirical
distribution over polynomials, and the mode of this distribution is the ``line of best fit'' for the
data.
\begin{figure}
\begin{novacode}
model <- function() {
n <- sample(uniform-discrete(2,5));
line <- repeat(
function(i) { sample(normal(0,10)) },
n);
factor(-distance(line, data));
line
}
\end{novacode}
\caption{
An example program that demonstrates the use of universal language features in a model
function. The implementation of \code{distance} is omitted for brevity.
}
\figurelabel{ppl-example2}
\end{figure}
\subsection{Delimited Continuations}
Whenever the model function calls \code{sample} or \code{factor}, or returns a value, the inference
algorithm needs to make decisions about its execution -- more specifically the probability of a
trace of execution through the model needs to be tracked and samples need to be generated.
We use delimited continuations (the \code{shift} and \code{reset} operators) to allow the inference
algorithm to manipulate the execution of the model function and generate samples from its posterior
distribution.
\code{shift(k, e)} captures the current state of the program up to the last enclosing
\code{reset(.)}, creates a function from this that can be called via $k$, and evaluates $e$. $e$ may
call $k$ as few or as many times as it likes.
Using \code{shift} whenever \code{sample} or \code{factor} are called captures the current state of
execution of the model function (up to the start of the execution of the model function) and allows
the inference algorithm to decide what to execute next.
\sectionref{language} describes our implementation of \code{sample} and \code{factor} in more detail.
\subsection{Contributions}
In this paper, we make the following contributions:
\begin{itemize}
\item
We describe a probabilistic programming language that is functional in nature, and supports
delimited continuations using the shift and reset operators described in \cite{asai07}. The
language uses answer type polymorphism in its type system to statically type check the code
enabling statically typed LLVM IR to be generated from it.
\item
A novel implementation strategy for delimited continuations in LLVM IR that enables inference to
be implemented in LLVM IR in a similar style to that described in \cite{Goodman2013}.
\item
The code generated by our compiler performs significantly better than both Anglican
\cite{tolpin2016design} and webppl \cite{dippl} over a range of benchmark programs.
\item
Moreover, the code generated by our compiler also scales well to large numbers of samples.
\end{itemize}
\subsection{Structure}
The rest of the paper is structured as follows. In \sectionref{relatedwork} we discuss related work,
in \sectionref{language} we give an overview of the features and type system CuPPL\xspace, and in
\sectionref{codegen} we discuss the design and implementation of the code generator. This is
followed in \sectionref{evaluation} by a performance analysis of our language across a range of
benchmarks, comparing against both webppl \cite{dippl} and Anglican
\cite{tolpin2016design}. \sectionref{conclusion} concludes the paper.
\section{The Language}
\sectionlabel{language}
CuPPL\xspace is a statically-typed functional language, and its design is centered around vectors and data
parallel operations. It is also designed to allow high-level language transformations such as
deforestation of vector operations, closure conversion and other high level optimization passes.
The rest of this section is structured as follows.
\sectionref{language-features} describes the salient features of CuPPL\xspace.
\sectionref{delimited-continuations} describes how delimited
continuations are expressed, \sectionref{sample-and-factor} details how these are used to implement
\code{sample} and \code{factor}, and finally \sectionref{type-system} details how the polymorphic
type system treats delimited continuations using answer types.
\subsection{Language Features}
\sectionlabel{language-features}
CuPPL\xspace includes the usual control flow constructs you would expect from a functional language
including lambda expressions, let-expressions, conditionals, case statements and recursion.
The language also includes first class vector data types of arbitrary dimensions, and a suite of
parallel operators that work over them, including:
\begin{itemize}
\item
\code{map} applies a function to every element of the vector
\item
\code{repeat} generates a vector by running a function a given number of times
\item
\code{reduce} performs a parallel reduction over a vector
\item
\code{filter} constructs a new vector that includes only those elements from the input vector
for which a given predicate returns true
\end{itemize}
\subsubsection{Type Generalization and Specialization}
CuPPL\xspace allows type generalization and specialization, in a similar manner to System F.
Polymorphic types can be defined as follows:
\begin{novacode}
type List 'a :
(+ (Nil : unit)
(Cons : ('a, (List 'a))));
\end{novacode}
This example demonstrates both type generalization and type specialization. List is the type
constructor:
\begin{novacode}
forall 'a .
(+ (Nil : unit)
(Cons : ('a, (List 'a))))
\end{novacode}
This type can be specialized to store a list of integers by using a type application:
\begin{novacode}
(List int)
\end{novacode}
This produces the concrete type:
\begin{novacode}
(+ (Nil : unit)
(Cons : (int, (List int))))
\end{novacode}
We impose a few restrictions on the use of generalized types, \code{forall} types and type
applications. Firstly, general types can only be constructed at the start of a module, as the type
constructors need to be unique within a module. Secondly, after type checking a program, all types
must be specialized, or turned into concrete types. This is because the LLVM IR target environment
requires all types to be concrete. If an expression is discovered whose type is not specialized to a
concrete type (such as partial application of a parallel operator), the compiler complains that it
could not statically determine the concrete type of the expression.
\subsection{Distribution Values}
The type system includes a distribution type, denoted \code{\~t} which is a distribution over values
of type \code{t}. It also includes a suite of built-in distributions, including gaussian, bernoulli,
poisson and many others. Built-in functions to perform operations on distribution values are also
provided, such as \code{sample*} which produces a sample from a distribution, \code{dist-score}
which scores a sample from a distribution and \code{dist-var} which returns the variance of a
distribution.
\subsection{Delimited Continuations}
\sectionlabel{delimited-continuations}
CuPPL\xspace allows delimited continuations through the use of the \code{shift} and \code{reset}
constructs \cite{Felleisen1988, asai07}.
Informally, the meaning of \code{shift} is to capture the current execution state up to the last
\code{reset}, wrap it in a function, and bind a name to that function.
For example, consider the following:
\begin{novacode}
reset(1 + shift(k, k(2)))
\end{novacode}
When \code{shift} is encountered, it captures the current program as a function named $k$. In this
case $k$ is:
\begin{novacode}
function (x) { 1 + x }
\end{novacode}
It then executes the body of the shift expression, which executes \code{k(2)}, so the program
returns 3.
Reset limits the scope to which shift will capture the state of the program. For example, consider
the following:
\begin{novacode}
1 + reset(3 + shift(k, 1))
\end{novacode}
When \code{shift} is encountered, it captures the current program as a function $k$ up to the last
reset. In this case $k$ is:
\begin{novacode}
function (x) { 3 + x }
\end{novacode}
It then executes the body of the shift expression, which simply returns \code{1} and does not
execute $k$, so the program returns 2 as its result.
\subsection{Inference, sample and Factor}
\sectionlabel{sample-and-factor}
The two basic PPL primitives \code{sample} and \code{factor} are expressed in terms of delimited
continuations. \figureref{sample-factor-observe-impl} gives the definition of \code{sample} and
\code{factor} (and the \code{observe} helper function) in terms of \code{shift} and \code{reset}.
\begin{figure}
\begin{novacode}
sample <- function (dist : ~a) : a {
shift (k : a => b) {
x <- sample-impl(dist, k);
(x[0])(x[1])
}
}
\end{novacode}
\begin{novacode}
factor = function (log-p : a) : unit {
shift k {
f <- factor-impl(log-p, k);
f()
}
}
\end{novacode}
\begin{novacode}
observe = function (dist, x) : unit {
factor(dist-score(dist, x))
}
\end{novacode}
\caption{
Implementation of \code{sample}, \code{factor} and \code{observe} using delimited continuations
}
\figurelabel{sample-factor-observe-impl
}
\figurelabel{sample-factor-observe-impl}
\end{figure}
\code{sample} uses the \code{shift} operator to capture the current execution state of the model
function as a function $k$. When inference starts, \code{reset} is called to limit the scope of this
capture up to the start of the execution of the model function. \code{sample} then calls
\code{sample-impl} with the distribution object that was sampled from and $k$. The implementation of
\code{sample-impl} depends on the choice of inference algorithm, however it always returns a tuple
of type \code{(a => b, a)}. This function represents what the program should do next: the first
element of the tuple is a continuation, with the same type as $k$, and the second element of the
tuple is a sample from the distribution, of type \code{a}.
\code{factor} also uses \code{shift} operator to capture the current execution state of the model
function as a function $k$. It then calls \code{factor-impl} with the log probability with which to
update the program trace. The implementation of \code{sample-impl} depends on the choice of
inference algorithm, however it always returns a function of type \code{unit => unit}. This is a
function denoting what the program should do next, and has the same type as $k$.
\code{observe} is a wrapper function around \code{factor} that makes altering the log probability of
the execution trace based on observing data from a distribution simpler. It calls \code{factor} with
the score of the given sample \code{x} from the given distribution \code{dist}.
CuPPL\xspace provides two inference methods that implement \code{sample-impl} and \code{factor-impl}. They
are invoked via built-in functions called \code{importance} (for running importance sampling) and
\code{mcmc} (for running Monte Carlo Marov Chain based inference. More details on the implementation
of these functions can be found in \sectionref{codegen}.
\subsection{Type System}
\sectionlabel{type-system}
CuPPL\xspace uses Hindley-Milner type inference, augmented with polymorphic answer types
\cite{asai07}. \figureref{type-rules} gives a subset of the type rules. Te following notation is
used:
\begin{itemize}
\item
Types are denoted $\tau$.
\item
Type schemes are denoted $\sigma$. They have the syntax
$\sigma = \tau \mid \forall A . \tau$ where $A$ is a set of type variables.
\item
$\tau \prec \sigma$ denotes that type $\tau$ is an instance of type scheme
$\sigma$
\item
Answer types are denoted $\alpha$, $\beta$, $\gamma$. Answer types can be any type
$\tau$ or the empty type, denoted $\bot$
\item
Expressions are denoted $e$.
\item
Constant values are denoted $c$.
\item
Variable identifiers are denoted $x$.
\item
Type environments are denoted $\Gamma$. These map variable identifiers $x$ to
type schemes $\sigma$. The notation $\Gamma\{x : \sigma\}$ denotes mapping
$\Gamma$ updated with identifier $x$ mapped to type scheme $\sigma$.
$\Gamma_0$ denotes an empty type environment, that does not map any
identifiers to type schemes.
\item
There are two forms of type judgements:
\begin{itemize}
\item
\emph{Pure} type judgments are written $\Gamma \vdash_p e : \tau$. This means that
expression $e$ has type $\tau$, given type environment $\Gamma$.
\item
\emph{Impure} type judgments are written $\Gamma,\alpha \vdash e : \tau,\beta$.
This means that expression $e$ has type $\tau$, given type environment
$\Gamma$ and the execution of $e$ changes the answer type from $\alpha$ to
$\beta$.
\end{itemize}
\end{itemize}
\begin{figure}
\begin{typerules}
\typerule{lambda}
{\Gamma\{x : \tau_1\}, \alpha_1 \vdash e : \tau_2, \alpha_2}
{\Gamma \vdash_p \term{function [}\alpha_1 \alpha_2\term{] (} x \term{:} \tau_1 \term{):} \tau_2 \term{ \{ } e \term{ \}} : \tau_1 \term{/} \alpha_1 \rightarrow \tau_2 \term{/} \alpha_2} \\
\typerule{apply}
{\Gamma,\alpha_1 \vdash e_1 : \tau_2 \term{/} \alpha \rightarrow \tau \term{/} \alpha_2, \beta \and
\Gamma,\alpha_2 \vdash e_2: \tau_2,\alpha_1}
{\Gamma,\alpha \vdash e_1 \term{(} e_2 \term{)} : \tau,\beta} \\
\typerule{reset}
{\Gamma,\alpha \vdash e : \alpha,\tau}
{\Gamma \vdash_p \term{reset \{ } e \term{ \}} : \tau} \\
\typerule{shift}
{\Gamma\{x : \forall t.( \tau \term{/} t \rightarrow \alpha \term{/} t )\}, \tau_2 \vdash e : \tau_2,\beta }
{\Gamma,\alpha \vdash \term{shift } (x : \tau_1) : \tau_2 \term{ \{ } e \term{ \}} : \tau,\beta} \\
\typerule{expr}
{\Gamma \vdash_p e : \tau}
{\Gamma,\alpha \vdash e : \tau,\alpha}
\end{typerules}
\caption{
Subset of the type rules for CuPPL\xspace.
}
\figurelabel{type-rules}
\end{figure}
The \rulename{expr} rule allows an expression with the same input and output answer types to be type
checked as a pure expression.
\subsection{Inference Methods}
\sectionlabel{infer-impl}
CuPPL\xspace supports three inference methods.
\subsubsection{Enumeration}
Enumeration performs precise inference on the model function, by executing all possible paths
through the function. The probabilistic branching points are when the model calls
\code{sample}. Whenever \code{sample} is called, the inference algorithm executes the model function
from that point for all values in the support of the distribution. This only works for distributions
with finite support, and returns a runtime error if a continuous distribution is encountered. This
performs a breadth first traversal through the model function, and the depth of this traversal can
be limited to a maximum depth if desired.
\subsubsection{Importance Sampling}
This performs importance sampling \cite{StochasticSimulation} on the model function. This is done by
repeatedly running the model function. The calls to \code{sample} and \code{factor} made by each
execution prescribe a log probability the value returned by the model function. The model function
is repeated up to a chosen number of times, and the posterior distribution is computed by
normalizing the log probabilities of the returned values.
\subsubsection{Lightweight Metropolis-Hastings}
This inference method \cite{pmlr-v15-wingate11a} uses the Metrolpolis-Hastings algorithm to generate
samples from the posterior distribution of the model function. First, the model function is run once
to memorize the return values of any calls to \code{sample}. To generate a new sample, One of the
memorized return values is chosen uniformly randomly, re-sampled, and the model function is
re-executed from this point. Subsequent calls to sample reuse memorized values where possible. This
may not be possible if the modification affects the control flow of the program, in which case new
values are sampled and memorized. When the model function completes, the Metropolis-hasting
acceptance criteria is used to either accept or reject the sample.
\section{Related Work}
\sectionlabel{relatedwork}
The probabilistic programming languages most similar to our own are Anglican \cite{tolpin2016design}
and webppl \cite{dippl}, however both of these languages are embedded in other programming
languages. The semantics of our language also borrows heavily from \cite{Goodman2013} which
describes many of the principles behind implementing probabilistic languages.
Anglican \cite{tolpin2016design} is embedded in Clojure \cite{clojure}, a dialect of Lisp that works
in the Java Virtual Machine. In is built on top of continuations and trampolines in order to capture
control and pass it to the inference algorithm.
webppl \cite{dippl} is written in Javascript, on top of the NodeJS ecosystem \cite{nodejs}. It uses
coroutines to capture control and pass it to the inference algorithm.
Similarly to Anglican and webppl, Kiselyov et al \cite{Kiselyov2009} describe a domain specific
probabilistic language that is embedded in OCaml. They also use the delimited continuation approach
to explore programs as models.
Edward \cite{tran2016edward,tran2017deep} is a probabilistic modelling library for TensorFlow
\cite{tensorflow2015-whitepaper}. This is not a true PPL as it does not allow arbitrary control
flow, and is limited by the graph structures that are representable in TensorFlow.
Compiler based techniques to producing PPL code include \cite{pmlr-v15-wingate11a}. This approach
translates a PPL problem into MCMC code, rather than compiling the model function in the language
itself. TerpreT \cite{TerpreT} is a domain specific probabilistic language for program induction,
generating programs from a PPL model.
Earlier approaches to probabilitic programming and modelling include BUGS \cite{BUGS}, which is
restricted to Bayesian modelling and cannot handle the complex control structure that true PPLs can.
Stan \cite{Stan}, similarly to BUGS, is restricted to Bayesian modelling. Bindings exist for
embedding Stan in either R or Python.
Other early, and similar, approaches include Church \cite{Church}.
Borgstrom et al \cite{Borgstrom2016} present a rigorous lambda calculus for probabilistic
programming, in the style of CuPPL\xspace, Anglican, webbpl and Church. They use this to prove that they
perform MCMC inference on program traces correctly.
| {'timestamp': '2020-10-19T02:19:40', 'yymm': '2010', 'arxiv_id': '2010.08454', 'language': 'en', 'url': 'https://arxiv.org/abs/2010.08454'} | arxiv |
\section{Acknowledgments}
\label{sec:ack}
This work was supported by Prophesee, the Swiss National Center of Competence in
Research Robotics (NCCR), through the Swiss National Science Foundation, and the
SNSF-ERC starting grant. The authors would like to thank Alessio Tonioni
(Google Zurich) and Federico Tombari (TU Munich) for their valuable
feedback and insights to accomplish this work.
\section{Results on Synthetic Data}
\label{sec:appendixa}
We show quantitative and qualitative results of our method in the DENSE
dataset. Fig~\ref{fig:carla_results} shows the qualitative results on the DENSE
test sequence corresponding with Town10 in CARLA. We also show the quantitative
results for two validation datasets, Town06, and Town07 (see
Table~\ref{tab:carla_metrics}). The results show metric numbers within the
range of state of the art image-based methods in popular datasets like KITTI.
This emphasizes our statement that events have enough information to estimate
dense monocular depth.
\section{Conclusion}
\label{sec:conclusion}
In this paper, we presented the first work on monocular dense estimation from events. Our
solution exploits the benefits of recurrent convolutional neural networks to infer dense depth from a stream of asynchronous events. We reported
results on the Multi Vehicle Stereo Event Camera Dataset (MVSEC) which is the
only currently public dataset comprised of events, frames, and ground-truth depth. We showed that training on synthetic data is beneficial
for several reasons: it helps the network converge faster, depth maps have
a better quality due to perfect ground truth, and simulation captures a larger
variety of conditions. Finally, we showed that our methodology produces dense
depth maps with more accuracy than existing methods.
\section{Experiments}
\label{sec:results}
In this section, we present qualitative and quantitative results and compare them with
previous methods~\cite{Zhu19cvpr} on the MVSEC dataset. We focus our evaluation
on real event data while the evaluation on synthetic data is detailed in
Appendix A
\begin{table*}[t!]
\centering
\resizebox{1.0\textwidth}{!} %
{
\begin{tabular}{l | c | c c c c c|c c c }
\toprule
\textbf{Training set} & \textbf{Dataset} &
\textbf{Abs Rel}$\downarrow$ & \textbf{Sq Rel} $\downarrow$ &
\textbf{RMSE}$\downarrow$ & \textbf{RMSE log}$\downarrow$ &
\textbf{SI log}$\downarrow$ & $ \boldsymbol{\delta < 1.25\uparrow}$ &
$\boldsymbol{\delta < 1.25^2 \uparrow}$ & $\boldsymbol{\delta < 1.25^3 \uparrow}$ \\
\toprule
S & & 0.698& 3.602 & 12.677 & 0.568& 0.277 & 0.493 & 0.708 & 0.808\\
R & outdoor day1 & 0.450& 0.627 & 9.321 & 0.514& 0.251 & 0.472 & 0.711 & 0.823\\
S* $\rightarrow$ R & & 0.381& \textbf{0.464} & 9.621 & 0.473& 0.190 & 0.392 & 0.719 & 0.844\\
S* $\rightarrow$ (S+R) & & \textbf{0.346} & 0.516 & \textbf{8.564} & \textbf{0.421}& \textbf{0.172} & \textbf{0.567} & \textbf{0.772} & \textbf{0.876}\\
\hline
S & & 1.933 & 24.64 & 19.93 & 0.912& 0.429 & 0.293 & 0.472 & 0.600\\
R & outdoor night1 & 0.770 & 3.133 & \textbf{10.548} & 0.638& 0.346 & 0.327 & 0.582 & 0.732\\
S* $\rightarrow$ R & & \textbf{0.554} & \textbf{1.798} & 10.738 & \textbf{0.622}& \textbf{0.343} & 0.390 & 0.598 & 0.737\\
S* $\rightarrow$ (S+R) & & 0.591 & 2.121 & 11.210 & 0.646& 0.374 &
\textbf{0.408} & \textbf{0.615} & \textbf{0.754}\\
\hline
S & & 0.739 & 3.190 & 13.361 & 0.630& 0.301 & 0.361 & 0.587 & 0.737\\
R & outdoor night2 & 0.400 & 0.554 & \textbf{8.106} & \textbf{0.448}& \textbf{0.176} & 0.411 & 0.720 & 0.866\\
S* $\rightarrow$ R & & 0.367 & \textbf{0.369} & 9.870 & 0.621& 0.279 & 0.422 & 0.627 & 0.745\\
S* $\rightarrow$ (S+R) & & \textbf{0.325} & 0.452 & 9.155 &
0.515& 0.240 & \textbf{0.510} & \textbf{0.723} & \textbf{0.840}\\
\hline
S & & 0.683 & 1.956 & 13.536 & 0.623& 0.299 & 0.381 & 0.593 & 0.736\\
R & outdoor night3 & 0.343 & 0.291 & \textbf{7.668} &
\textbf{0.410} & \textbf{0.157} & 0.451 & 0.753 & \textbf{0.890}\\
S* $\rightarrow$ R & & 0.339 & 0.230 & 9.537 & 0.606& 0.258 & 0.429 & 0.644 & 0.760\\
S* $\rightarrow$ (S+R) & & \textbf{0.277} & \textbf{0.226} & 8.056 & 0.424 & 0.162 & \textbf{0.541} & \textbf{0.761} & \textbf{0.890}\\
\bottomrule
\end{tabular}%
}
\caption{Ablation study and evaluation of MVSEC. All rows are the same
network with the change in the training set. The Training set is denoted with $S$
(synthetic data from the DENSE training split), $R$ (real data from the
training split in~\textit{outdoor day2} sequence), $S^*$ (first 1000 samples of the
DENSE training split), $S^*\rightarrow R$ (pretrained on $S^*$ and retrained on
$R$), $S^*\rightarrow (S+R)$ (pretrained on $S^*$ and retrained on both
datasets). $\downarrow$ indicates lower is better and $\uparrow$ higher is
better. The results are the driving sequences of MVSEC (except
for~\textit{outdoor day2}). Best values are shown in bold.}
\label{tab:ablation_metrics}
\end{table*}
\begin{figure*}[t!]
\centering
$\begin{array}{ccc}
\hspace{-0.12cm}
\subcaptionbox{\label{fig:ablation_events} Events}
{
\includegraphics[width=0.33\textwidth,keepaspectratio]{images/results/ablation/outdoor_day1_events_white_0000003562}
}
\hspace{-0.1cm}
\subcaptionbox{\label{fig:simu} Depth trained only on $S$ data}
{
\includegraphics[width=0.33\textwidth,keepaspectratio]{images/results/ablation/outdoor_day1_simu_0000003562}
}
\hspace{-0.1cm}
\subcaptionbox{\label{fig:real} Depth trained only on $R$ data}
{
\includegraphics[width=0.33\textwidth,keepaspectratio]{images/results/ablation/outdoor_day1_real_0000003562}
}
\end{array}$
$\begin{array}{ccc}
\hspace{-0.12cm}
\subcaptionbox{\label{fig:simu_real} Depth trained on $S^*\rightarrow R$ }
{
\includegraphics[width=0.33\textwidth,keepaspectratio]{images/results/ablation/outdoor_day1_sim+real_0000003562}
}
\hspace{-0.1cm}
\subcaptionbox{\label{fig:mixed} Depth trained on $S^*\rightarrow (S+R)$ }
{
\includegraphics[width=0.33\textwidth,keepaspectratio]{images/results/ablation/outdoor_day1_mixed_0000003562}
}
\hspace{-0.1cm}
\subcaptionbox{\label{fig:ablation_gt} Depth ground truth }
{
\includegraphics[width=0.33\textwidth,keepaspectratio]{images/results/day1_target_0000003562}
}
\end{array}$
\caption{Ablation study of our method trained with different training sets
(see Table~\ref{tab:ablation_metrics}). Fig.~\ref{fig:ablation_events} shows
the events, from Fig.~\ref{fig:simu} to Fig.~\ref{fig:mixed} the predicted
dense monocular depth using different training sets.
Fig.~\ref{fig:ablation_gt} depicts the corresponding ground truth. The depth
maps are shown in logarithmic scale and correspond to sample $3562$ in
the~\textit{outdoor day1} sequence of MVSEC.}
\label{fig:ablation_visual}
\end{figure*}
\begin{table*}[t!]
\centering
\resizebox{1.0\textwidth}{!} %
{
\begin{tabular}{c|c|c c c|c c c c c}
\toprule
\multirow{2}{*}{\textbf{Dataset}} & \multirow{2}{*}{\textbf{Distance}} &
\multicolumn{3}{c|}{\textbf{Frame based}} & \multicolumn{5}{c}{\textbf{Event based}} \\
& & MonoDepth~\cite{Godard17cvpr} & MegaDepth~\cite{Li18cvpr}
& MegaDepth$^{+}$~\cite{Li18cvpr} & Zhu et
al.~\cite{Zhu19cvpr} & Ours$^{S}$ & Ours$^{R}$&
Ours$^{S^* \rightarrow R}$ & Ours$^{\#}$\\
\toprule
& 10\text{m} & 3.44 & 2.37 & 3.37 & 2.72 & 4.60 & 2.70 & 2.13 & \textbf{1.85} \\
\multirow{1}{*}{outdoor day1} & 20\text{m} & 7.02 & 4.06 & 5.65 & 3.84 & 5.66 & 3.46 & 2.68 & \textbf{2.64} \\
& 30\text{m} & 10.03 & 5.38 & 7.29 & 4.40 & 6.10 & 3.84 & 3.22 & \textbf{3.13} \\
\hline
& 10\text{m} & 3.49 & 2.54 & \textbf{2.40} & 3.13 & 10.36 & 5.36 & 3.31 & 3.38 \\
\multirow{1}{*}{outdoor night1} & 20\text{m} & 6.33 & 4.15 & 4.20 & 4.02 & 12.97 & 5.32 & \textbf{3.73} & 3.82 \\
& 30\text{m} & 9.31 & 5.60 & 5.80 & 4.89 & 13.64 & 5.40 & \textbf{4.32} & 4.46 \\
\hline
& 10\text{m} & 5.15 & 3.92 & 3.39 & 2.19 & 6.14 & 2.80 & 1.99 & \textbf{1.67} \\
\multirow{1}{*}{outdoor night2} & 20\text{m} & 7.80 & 5.78 & 4.99 & 3.15 & 8.64 & 3.28 & 3.14 & \textbf{2.63} \\
& 30\text{m} & 10.03 & 7.05 & 6.22 & 3.92 & 9.57 & 3.74 & 4.14 & \textbf{3.58} \\
\hline
& 10\text{m} & 4.67 & 4.15 & 4.56 & 2.86 & 5.72 & 2.39 & 1.76 & \textbf{1.42} \\
\multirow{1}{*}{outdoor night3} & 20\text{m} & 8.96 & 6.00 & 5.63 & 4.46 & 8.29 & 2.88 & 2.98 & \textbf{2.33} \\
& 30\text{m} & 13.36 & 7.24 & 6.51 & 5.05 & 9.27 & 3.39 & 3.98 & \textbf{3.18} \\
\bottomrule
\end{tabular}
}
\caption{Average absolute depth errors (in meters) at different
cut-off depth distances (lower is better). MegaDepth$^{+}$ refers to
MegaDepth~\cite{Li18cvpr} using E2VID~\cite{Rebecq19pami} reconstructed
frames and Ours$^{\#}$ refers to our method trained using
$S^* \rightarrow (S+R)$. Our results outperform state of the art image-based
monocular depth prediction methods~\cite{Godard17cvpr, Li18cvpr} while
outperforming state of the art event-based methods~\cite{Zhu19cvpr}.}
\label{tab:results}
\end{table*}
\begin{figure*}[t!]
\centering
$\begin{array}{cccc}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/day1_events_white_0000003741}
}
\hspace{0.05cm}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/night1_events_white_0000000288}
}
\hspace{0.05cm}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/night2_events_white_0000002837}
}
\hspace{0.05cm}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/night3_events_white_0000002901}
}
\end{array}$
$\begin{array}{cccc}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/day1_prediction_0000003741}
}
\hspace{0.05cm}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/night1_prediction_0000000288}
}
\hspace{0.05cm}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/night2_prediction_0000002837}
}
\hspace{0.05cm}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/night3_prediction_0000002901}
}
\end{array}$
$\begin{array}{cccc}
\hspace{0.05cm}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/day1_target_0000003741}
}
\hspace{0.05cm}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/night1_target_0000000288}
}
\hspace{0.05cm}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/night2_target_0000002837}
}
\hspace{0.05cm}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/night3_target_0000002901}
}
\end{array}$
$\begin{array}{cccc}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/day1_davis_0000003741}
}
\hspace{0.05cm}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/night1_davis_0000000288}
}
\hspace{0.05cm}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/night2_davis_0000002837}
}
\hspace{0.05cm}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/night3_davis_0000002901}
}
\end{array}$
$\begin{array}{cccc}
\hspace{-0.12cm}
\subcaptionbox{\label{fig:outdoor_day1} outdoor day1}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/day1_megadepth_0000003741}
}
\hspace{-0.12cm}
\subcaptionbox{\label{fig:outdoor_night1} outdoor night1}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/night1_megadepth_0000000288}
}
\hspace{-0.12cm}
\subcaptionbox{\label{fig:outdoor_night2} outdoor night2}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/night2_megadepth_0000002837}
}
\hspace{-0.12cm}
\subcaptionbox{\label{fig:outdoor_night3} outdoor night3}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/night3_megadepth_0000002901}
}
\end{array}$
\caption{Qualitative comparison of the four test sequences of MVSEC dataset.
The first row shows the events. Second row our dense depth
map predictions. Third row the ground truth depth maps. The Fourth row shows
DAVIS grayscale frames and the fifth row the MegaDepth prediction using the
grayscale frames.~\textit{outdoor day1} corresponds to sample $3741$ in the
sequence.~\textit{outdoor night1} to sample $288$ in the sequence.
~\textit{outdoor night2} corresponds to sample $2837$ in the sequence
and~\textit{outdoor night3} to sample $2901$ in the sequence.}
\label{fig:results_visual}
\end{figure*}
We perform an ablation study by training on synthetic and real events
to show the benefits of using synthetic training data from the simulation. We train
our recurrent network using the training split of the DENSE dataset (5000
samples) and train for $300$ epochs (75000 iterations). We convert the events to
a voxel grid synchronized with the ground truth depth which is 30
FPS in simulation. We use each depth image to supervise the training by first converting the
absolute depth to a logarithmic scale. A sample is formed by a voxel grid of
events between two consecutive frames and the ground truth label. Consecutively,
the network is also trained with real data using the
MVSEC~\footnote{\url{https://daniilidis-group.github.io/mvsec/}} dataset in the same
manner. We unpack the available online data in ROS bag format and pack the
stream of events in voxel grid synchronized with the ground truth depth which
is 20 FPS. We use~\textit{outdoor day2} sequence of MVSEC to train the network
as in~\cite{Zhu19cvpr}. More specifically we split the sequence into training,
validation, and testing. The training split consist of 8523 samples, the
validation split contains 1826 samples and the test split comprise the rest with
another 1826 samples. We also train for 300 epochs in the real data (127800
iterations). We perform data augmentation, in synthetic and real data, by random
cropping and horizontal flip of the training samples. The network and data loader
are implemented in Pytorch.
The quantitative results are shown in Table~\ref{tab:ablation_metrics}, and are
supported with qualitative depth maps in Fig~\ref{fig:ablation_visual}. The
network predicts depth in the logarithmic scale, which is normalized and
restored to absolute values by multiplying by the maximum depth clipped at
$80$~\text{m}. We compare the results for different combinations of training
sets. We first show the results by training only with synthetic data $S$.
Afterward, we show that training in real data $R$ drastically improve the
metrics with respect to only synthetic data $S$. The incorporation of real
events improves all metrics, especially the Absolute relative error - Abs. Rel,
which is the most informative value. This is because the network is capable of
closing the domain gap when seeing data from the real world. We also notice that
pretraining the network with a subset ($1000$ samples) of the synthetic
data $S^*$ and then training in real data helps the network to converge faster
(first $100$ epochs). This is depicted by $S^* \rightarrow R$ in
Table~\ref{tab:ablation_metrics} and the results increase the performance in
almost all values with respect to training only with real data $R$. The penalty
of training with real data is in the qualitative depth map (see
Fig.~\ref{fig:real} and~\ref{fig:simu_real}). This is because having perfect
align ground truth data with events is hard to obtain in the real world. The
lack of perfect ground truth prevents the network to predict depth with sharp
edges and have difficulties to mask the sky. For that reason, we mixed synthetic
and real data, denoted by $(S+R)$, to fine tune the network and get the
best of both. Training with real reduces the errors by predicting
the correct metric while using synthetic data helps to estimate qualitatively
better depth maps. The combination of synthetic and real training data is
possible without changing the loss function since both datasets mimic the
DAVIS346B sensor resolution and focal length.
The ablation study shows that synthetic data enhance the results. It also shows
that the potential of monocular depth prediction grows with respect to the
amount of training data. We now further compare our method against the state of the
art monocular depth: two image-based techniques, MonoDepth~\footnote{MonoDepth
performs more accurately than MonoDepth2 for the MVSEC dataset}~\cite{Godard17cvpr}
and MegaDepth~\cite{Li18cvpr}, and the event-based approach
from~\cite{Zhu19cvpr} (see Table~\ref{tab:results}). MegaDepth is further
applied to frames reconstructed from events using E2VID~\cite{Rebecq19pami}. The
evaluation is done using the average mean error at depths of $10$\text{m},
$20$\text{m}, and $30$\text{m} since these are the available metrics reported
until now in the MVSEC dataset. The values for MonoDepth are directly taken from
the evaluation in~\cite{Zhu19cvpr}. Our work gives more accurate depth
prediction at all distances with an average improvement overall sequence of
26.25\% at 10\text{m}, 25.25\% at 20\text{m} and 21.0\% at 30\text{m} with
respect to values reported in~\cite{Zhu19cvpr}. Our method produces dense depth
results up to 50.0\% improvement with respect to previous methods in
\textit{outdoor night3} sequence of MVSEC. Image-based methods have difficulties
to predict depth in low light conditions. MegaDepth applied to reconstructed
frames performs more accurately in night sequences. However, the direct use of
events (i.e.: end to end without parsing through image reconstruction) in our
method gives a better estimate since the events capture increments in contrast
at a higher temporal resolution. Appendix B further explains this fact in a
high dynamic range situation. In all the night sequences our method outperforms
previous approaches except for \textit{outdoor night1} at
$10$\text{m}. This is because~\textit{outdoor night1}, compared to other
sequences, has a higher amount of moving objects in front of the car. This
creates spurious measurements in the path of such objects which have not been
removed from the ground truth depth in the dataset.
None of the methods uses samples from night driving sequences at training time,
neither image-based methods nor event-based solutions. MegaDepth is trained with
the MD dataset from images available on the Internet and this achieves superior
generalizability than MonoDepth which is trained with KITTI~\cite{Geiger13ijrr}
and reported the values from Zhu et al~\cite{Zhu19cvpr}.
Fig.~\ref{fig:results_visual} contains a visual comparison. Each column
corresponds to an MVSEC sequence
(Fig.~\ref{fig:outdoor_day1}-\ref{fig:outdoor_night3}). The first and second row
depict DAVIS frames and depth prediction from MegaDepth using standard frames.
The third row shows the events warped to a frame at the same synchronized
sample. The last two rows are our dense prediction and ground truth. It can be
noticed that~\textit{outdoor night2} and~\textit{outdoor night3} are
particularly dark scenes making predictions a challenging task for conventional
image-based methods. Our method better preserves the car shapes at both sides of
the road, while they are completely neglected by standard images and therefore
omitted in the prediction from MegaDepth.
\begin{table*}[t!]
\centering
\resizebox{1.0\textwidth}{!} %
{
\begin{tabular}{l | c c c c c|c c c | c c c }
\toprule
\textbf{Dataset} &
\textbf{Abs Rel}$\downarrow$ & \textbf{Sq Rel} $\downarrow$ &
\textbf{RMSE}$\downarrow$ & \textbf{RMSE log}$\downarrow$ &
\textbf{SI log}$\downarrow$ & $ \boldsymbol{\delta < 1.25\uparrow}$ &
$\boldsymbol{\delta < 1.25^2 \uparrow}$ & $\boldsymbol{\delta <
1.25^3 \uparrow}$ & \textbf{Avg. error 10\text{m}$ \downarrow$} &
\textbf{Avg. error 20\text{m}$\downarrow$} & \textbf{Avg. error 30\text{m}$\downarrow$ } \\
\toprule
Town06 & 0.120 & 0.083 & 6.640 & 0.188 & 0.035 & 0.855 & 0.956 &
0.987 & 0.31 & 0.74 & 1.32\\
Town07 & 0.267 & 0.535 & 10.182 & 0.328 & 0.098 & 0.774 & 0.878 &
0.927 & 1.03 & 2.35 & 3.06\\
\hline
Town10 & 0.220 & 0.279 & 11.812 & 0.323 & 0.093 & 0.724 & 0.865 &
0.932 & 0.61 & 1.45 & 2.42\\
\bottomrule
\end{tabular}%
}
\caption{Quantitative results on the DENSE dataset. We train the network only on
synthetic events from the training split $S$. The first two sequences are
used for validation and the Town10 sequence for testing.}
\label{tab:carla_metrics}
\end{table*}
\begin{figure*}[t!]
\centering
$\begin{array}{cccc}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/synthetic/town10_frame_0000000143}
}
\hspace{0.05cm}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/synthetic/town10_events_white_0000000143}
}
\hspace{0.05cm}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/synthetic/town10_prediction_0000000143}
}
\hspace{0.05cm}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/synthetic/town10_target_0000000143}
}
\end{array}$
$\begin{array}{cccc}
\hspace{-0.12cm}
\subcaptionbox{\label{fig:icarla_rgb} Frame}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/synthetic/town10_frame_0000000547}
}
\hspace{-0.12cm}
\subcaptionbox{\label{fig:carla_events} Events}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/synthetic/town10_events_white_0000000547}
}
\hspace{-0.12cm}
\subcaptionbox{\label{fig:carla _prediction} Ours on events}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/synthetic/town10_prediction_0000000547}
}
\hspace{-0.12cm}
\subcaptionbox{\label{fig:carla_gt} Ground truth}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/synthetic/town10_target_0000000547}
}
\end{array}$
\caption{Qualitative results on DENSE for the Town10 sequence. The first row
corresponds to sample $143$ and the second row to sample $547$ in the
sequence.}
\label{fig:carla_results}
\vspace{-0.5cm}
\end{figure*}
\section{Introduction}
\label{sec:intro}
Event cameras, such as the Dynamic Vision Sensor (DVS)~\cite{Lichtsteiner08ssc}
or the ATIS~\cite{Posch10isscc}, are bio-inspired vision sensors with radically
different working principles compared to conventional cameras. While standard
cameras capture intensity images at a fixed rate, event cameras only report
changes of intensity at the pixel level and do this asynchronously at the time
they occur. The resulting stream of events encodes the time, location, and sign
of the change in brightness. Event cameras possess outstanding properties
when compared to standard cameras. They have a very high dynamic range (140 dB
versus 60 dB), no motion blur, and high temporal resolution (in the order of
microseconds). Event cameras are thus sensors that can provide high-quality
visual information even in challenging high-speed scenarios and high dynamic
range environments, enabling new application domains for vision-based
algorithms. Recently, these sensors have received great interest in various
computer vision fields, ranging from computational photography
\cite{Rebecq19pami,
Rebecq19cvpr,Scheerlinck18accv,Scheerlinck20wacv}\footnote{\url{https://youtu.be/eomALySSGVU}}
to visual odometry
\cite{Rosinol18ral,Rebecq17ral,Rebecq17bmvc,Zhu17cvpr,Zhu19cvpr,Kim14bmvc} and
depth prediction
\cite{Kim16eccv,Rebecq17ral,Rebecq16bmvc,Zhou18eccv,Zhu18eccv,Tulyakov19iccv,Zhu19cvpr}.
The survey in \cite{Gallego20pami} gives a good overview of the applications
for event cameras.
\begin{figure}[t]
\centering
\includegraphics[trim=0 350 0 0, clip, width=\linewidth]{images/e2depth_method.pdf}
\caption{Method overview, the network receives asynchronous events
inputs and predicts normalized log depth $\mathcal{\hat{D}}_k$. Our method
uses $N_R$ recurrent blocks to leverage the temporal consistency in the
events input.}
\label{fig:eye_catcher}
\vspace{-0.0cm}
\end{figure}
Monocular depth prediction has focused primarily on on
standard cameras, which work synchronously, i.e., at a fixed frame rate. State-of-the-art
approaches are usually trained and evaluated in common datasets such as
KITTI~\cite{Geiger13ijrr}, Make3D~\cite{Saxena09pami} and
NYUv2~\cite{Silberman12eccv}.
Depth prediction using event cameras has
experienced a surge in popularity in recent years~\cite{Rosinol18ral, Rebecq16bmvc,
Zhou18eccv, Rebecq17ral,Rebecq17bmvc, Kim16eccv,Zhu19cvpr, Zhou18eccv,
Zhu18eccv,Tulyakov19iccv}, due to its potential in
robotics and the automotive industry. Event-based depth prediction is the task
of predicting the depth of the scene at each pixel in the image plane, and is
important for a wide range of applications, such as robotic grasping
\cite{Lenz15ijrr} and autonomous driving, with low-latency obstacle avoidance
and high-speed path planning.
\begin{table}[t!]
\centering
\resizebox{1.0\linewidth}{!} %
{
\begin{tabular}{c|cccc}
\hline
\textbf{Method} & \textbf{Density} &
\textbf{Monocular} & \textbf{Metric} &
\textbf{Learning} \\
& &
& \textbf{depth} &
\textbf{based} \\ \hline
\cite{Rebecq17bmvc} & \textcolor{red}{sparse} & \textcolor{green}{yes} & \textcolor{green}{yes} & \textcolor{red}{no} \\
\cite{Zhu17cvpr} &\textcolor{red}{sparse} & \textcolor{green}{yes} & \textcolor{green}{yes} & \textcolor{red}{no} \\
\cite{Kim16eccv} & \textcolor{orange}{semi-dense} & \textcolor{green}{yes} & \textcolor{red}{no} &\textcolor{red}{no} \\
\cite{Rebecq17ral} & \textcolor{orange}{semi-dense} & \textcolor{green}{yes} & \textcolor{green}{yes} &\textcolor{red}{no} \\
\cite{Zhou18eccv} & \textcolor{orange}{semi-dense} & \textcolor{red}{no} & \textcolor{green}{yes} & \textcolor{red}{no} \\
\cite{Zhu18eccv} & \textcolor{orange}{semi-dense} &\textcolor{red}{no} & \textcolor{green}{yes} & \textcolor{red}{no} \\
\hline
\cite{Zhu19cvpr} & \textcolor{orange}{semi-dense} & \textcolor{green}{yes} & \textcolor{green}{yes}& \textcolor{green}{yes}\\
\cite{Tulyakov19iccv} & \textcolor{green}{dense} & \textcolor{red}{no} & \textcolor{green}{yes} & \textcolor{green}{yes}\\
\textbf{Ours} & \textcolor{green}{dense} & \textcolor{green}{yes} & \textcolor{green}{yes} & \textcolor{green}{yes} \\ \hline
\end{tabular}
}
\caption{A literature review on event-based depth: model-based methods are
listed top, learning-based methods are listed bottom. The type of output
density is
denoted with "sparse" (depth at pixels when only events occurred),
"semi-dense" (depth at the reconstructed edges on the image), and "dense"
(depth prediction at all pixels). Note than only~\cite{Tulyakov19iccv}
addresses dense per-pixel depth, but their work uses a stereo
setup.}
\vspace{-0.0cm}
\label{tab:soa}
\end{table}
However, while event-cameras have appealing properties they also present unique
challenges. Due to the working principles of the event camera, they respond
predominantly to edges in the scene, making event-based data inherently sparse
and asynchronous. This makes dense depth estimation with an event camera
challenging, especially in low contrast regions, which do not trigger events
and, thus, need to be filled in. Prior work in event-based depth estimation has
made significant progress in this direction, especially since the advent of deep
learning. However, most existing works are limited: they can reliably only
predict sparse or semi-dense depth maps~\cite{Rosinol18ral, Rebecq16bmvc,
Zhou18eccv, Rebecq17ral,Rebecq17bmvc, Kim16eccv,Zhu19cvpr, Zhou18eccv,
Zhu18eccv} or rely on a stereo setup to generate dense depth predictions
\cite{Tulyakov19iccv}.
In this work, we focus on dense, monocular, and metric depth estimation using an
event camera, which addresses the aforementioned limitations. To the best of our
knowledge, this is the first time that dense monocular depth is predicted using only
events (see Fig.~\ref{fig:eye_catcher}). We show that our approach reliably generates dense depth maps
overcoming the sparsity in a stream of events. Our methodology is based on
learning methods and gives reliable results, setting a baseline for dense depth
estimation using events. We release DENSE, a dataset recorded in CARLA, which comprises events, intensity frames, semantic labels, and depth maps. Our contributions are the following:
\begin{itemize}
\item A recurrent network that predicts
dense per-pixel depth from a monocular event camera.
\item The implementation of an event camera plugin in the CARLA~\cite{Dosovitskiy17corl} simulator.
\item DENSE - Depth Estimation oN Synthetic Events: a
new dataset with synthetic events and perfect ground truth.
\item Evaluation of our method on the popular Multi-Vehicle Stereo Event-Camera
(MVSEC) Dataset \cite{Zhu18ral} where we show improved performance with
respect to the state of the art.
\end{itemize}
\section{Depth Estimation Approach}
\label{sec:method}
Events cameras output events at independent pixels and do this asynchronously.
Specifically, their pixels respond to changes in the spatio-temporal log
irradiance $L(\mathbf{u},t)$ that produces a stream of asynchronous events. For
an ideal sensor, an event $e_i=(\mathbf{u}_i,t_i,p_i)$ is triggered at time
$t_i$ if the brightness change at the pixel $\mathbf{u}_i=(x_i, y_i)^\intercal$
exceeds a threshold of $\pm C$. The event polarity $p_i$ denotes the sign of
this change.
Our goal is to predict dense monocular depth from a continuous stream of events.
The method works by processing subsequent non-overlapping windows of events
$\epsilon_k=\{e_i\}_{i=0}^{N-1}$ each spanning a fixed interval $\Delta T =
t^k_{N-1}-t^k_0$. For each window, we predict log depth maps
$\{\mathcal{\hat{D}}_k\}$, with $\mathcal{\hat{D}}_k\in [0,1]^{W\times H}$. We
implement log depth prediction as a recurrent convolutional neural network with
an internal state $\mathbf{s}_k$. We train our network in a supervised manner,
using ground truth depth maps. The network is first trained in simulation using
perfect ground truth and synthetic events and finetuned in a real
sequence.
\subsection{Event Representation}
Due to the sparse and asynchronous nature of event data, batches of events
$\epsilon_k$ need to be converted to tensor-like representations $\textbf{E}_k$.
One way to encode these events is by representing them as a spatio-temporal
voxel grid \cite{Zhu19cvpr,Gehrig19iccv} with dimensions $B \times H \times W$.
Events within the time window $\Delta T$ are collected into $B$ temporal bins
according to
\begin{equation}
\textbf{E}_k(\mathbf{u}_k,t_n)=\sum_{e_i}p_i \delta(\mathbf{u}_i-\mathbf{u}_k)\max(0,1-\vert t_n - t^*_i\vert)
\end{equation}
where $t_i^*=\frac{B-1}{\Delta T}(t_i-t_0)$ is the normalized event timestamp.
In our experiments, we used $\Delta T = 50 ms$ of events and $B=5$ temporal bins.
To facilitate learning, we further normalize the non-zero values in the voxel
grid to have zero mean and unit variance.
\subsection{Network Architecture}
\begin{figure}[t!]
\centering
\includegraphics[width=\linewidth]{images/method1.pdf}\\
\caption{Our network architecture, image adapted
from~\cite{Rebecq19pami}. The event stream is grouped into non-overlapping
windows of events and converted to tensor-like voxel grids~\cite{Zhu19cvpr}.
These voxel grids are passed to our recurrent fully convolutional neural
network to produce normalized log depth predictions.}
\label{fig:arch}
\end{figure}
It consists of a recurrent, fully convolutional neural network, based on the UNet
architecture \cite{Ronneberger15icmicci}. The network input is first processed
by a head layer $\mathcal{H}$ and then $N_E$ recurrent encoder layers
($\mathcal{E}^i)$ followed by $N_R$ residual blocks ($\mathcal{R}^j$) and $N_E$
decoder layers $\mathcal{D}^l$. A final depth prediction layer $\mathcal{P}$
produces the output of our network. The head layer produces an output with
$N_b$ channels, which is doubled at each encoder layer, resulting in a feature
map with $N_b \times 2^{N_E}$ output channels.~$\mathcal{P}$ performs a
depth-wise convolution with one output channel and kernel size 1. We use skip
connections between symmetric encoder and decoder layers (see
Fig.~\ref{fig:arch}). At the final layer, the activations are squashed by a
sigmoid activation function. Each encoder layer is composed of a downsampling
convolution with kernel size 5 and stride 2 and a ConvLSTM \cite{Shi15nips}
module with kernel size 3. The encoding layers maintain a state $c_k^i$ which is
at 0 for $k=0$. The residual blocks use a kernel size of 3 and apply summation
over the skip connection. Finally, each decoder layer is composed of a bilinear
upsampling operation followed by convolution with kernel size 5. We use ReLU
except for the prediction layer, and batch normalization \cite{Ioffe15icml}. In
this work we use $N_E=3$, $N_R=2$ and $N_b=32$ and we unroll the network for
$L=40$ steps.
\subsection{Depth Map Post-processing}
As usual, in recent work on depth prediction, we train our network to predict
a normalized log depth map. Log depth maps have the advantage of representing
large depth variations in a compact range, facilitating learning. If
$\mathcal{\hat{D}}_k$ is the depth predicted by our model, the metric depth can
be recovered by performing the following operations:
\begin{equation}
\mathcal{\hat{D}}_{m,k} = \mathcal{D}_{\text{max}}\exp(-\alpha
(1-\mathcal{\hat{D}}_{k}))
\end{equation}
Where $\mathcal{D}_{\text{max}}$ is the maximum expected depth and $\alpha$ is a
parameter chosen, such that a depth value of 0 maps to minimum observed depth.
In our case, $\mathcal{D}_{\text{max}}=80$ meters and $\alpha=3.7$ corresponding
to a minimum depth of $~2$ meters.
\subsection{Training Details}
We train our network in a supervised fashion, by minimizing the scale-invariant
and multi-scale scale-invariant gradient matching losses at each time step.
Given a sequence of ground truth depth maps $\{\mathcal{D}_k\}$, denote the
residual $\mathcal{R}_k=\mathcal{\hat{D}}_{k}-\mathcal{D}_{k}$. Then the
scale-invariant loss is defined as
\begin{equation}
\mathcal{L}_{k,\text{si}} =
\frac{1}{n}\sum_\textbf{u}(\mathcal{R}_k(\textbf{u}))^2-\frac{1}{n^2}\left(\sum_\textbf{u} \mathcal{R}_k(\textbf{u})\right)^2,
\end{equation}
where $n$ is the number of valid ground truth pixels $\textbf{u}$. The
multi-scale scale-invariant gradient matching loss encourages smooth depth
changes and enforces sharp depth discontinuities in the depth map prediction. It
is computed as follows:
\begin{equation}
\mathcal{L}_{k,\text{grad}}=\frac{1}{n}\sum_s \sum_\textbf{u} \vert \nabla_x \mathcal{R}^s_k(\textbf{u})\vert + \vert \nabla_y \mathcal{R}^s_k(\textbf{u}) \vert.
\end{equation}
Here $\mathcal{R}^s_k(\textbf{x})$ refers to the residual at scale $s$ and the
$L_1$ norm is used to enforce sharp depth discontinuities in the prediction. In
this work, we consider four scales, similar to \cite{Li18cvpr}. The resulting
loss for a sequence of $L$ depth maps is thus
\begin{equation}
\mathcal{L}_{\text{tot}} = \sum_{k=0}^{L-1} \mathcal{L}_{k,\text{si}}+\lambda \mathcal{L}_{k,\text{grad}}.
\end{equation}
The hyper-parameter $\lambda = 0.5$ was chosen by cross-validation. We train
with a batch size of 20 and a learning rate of $10^{-4}$ and use the Adam
\cite{Kingma15iclr} optimizer.
Our network requires training data in the form of events sequences with
corresponding depth maps. However, it is difficult to get perfect dense ground
truth depth maps in real datasets. For this reason, we propose to first train the
network using synthetic data and get the final metric scale by finetuning the
network using real events from the MVSEC dataset.
We implement an event camera sensor in CARLA~\cite{Dosovitskiy17corl} based on
the previous event simulator ESIM~\cite{Rebecq18corl}. The event camera sensor
takes the rendered images from the simulator environment and computes
per-pixel brightness change to simulate an event camera. The computation is done
at a configurable but fixed high framerate (we use $20$ times higher than the images
frame rate) to approximate the continuous signal of a real event
camera. The simulator allows us to capture a variety of scenes with
different weather conditions and illumination properties. The camera parameters
are set to mimic the event camera at MVSEC with a sensor size of $346 \times
260$ pixels (resolution of the DAVIS346B) and a focal length of $83^\circ$
horizontal field of view.
We split DENSE, our new dataset with synthetic events, into five sequences for
training, two sequences for validation, and one sequence for testing (a total of
eight sequences). Each sequence consists of 1000 samples at $30$ FPS
(corresponding to $33$ seconds), each sample is a tuple of one RGB image, the
stream of events between two consecutive images, ground truth depth, and
segmentation labels. Note that only the events and the depth, maps are used by
the network for training. RGB images are provided for visualization and
segmentation labels complete the dataset with richer information. CARLA Towns 01
to 05 are the scenes for training, Town 06 and 07 for validation, and the test
sequence is acquired using Town 10. This split results in an overall of $5000$
samples for training, $2000$ samples for validation, and $1000$ samples for
testing.
\section{Related Work}
\label{sec:soa}
\subsection{Classical Monocular Depth Estimation }
Early work on depth prediction used probabilistic methods and feature-based
approaches. The K-means clustering approach was used by
Achanta~\emph{et~al}~\cite{Acharta12pami} to generate superpixel methods
to improve segmentation and depth. Another work proposed multi-scale features with
Markov Random Field (MRF)~\cite{Saxena06nips}. These methods tend to suffer
in uncontrolled settings, especially when the horizontal alignment condition
does not hold.
Deep Learning significantly improved the estimate driven by convolutional
neural networks (CNN) with a variety of methods. The standard approach is to
collect RGB images with ground truth labels and train a network to predict depth
on a logarithmic scale. The network is trained in standard datasets that are
captured with a depth sensor such as laser scanning.
Eigen~\emph{et~al}~\cite{eigen2015predicting} presented the first work training
a multi-scale CNN to estimate depth in a supervised fashion. More
specifically, the architecture consists of two parts, a first estimation based on
Alexnet and a second refinement prediction. Their work led to successively major
advances in depth prediction~\cite{Godard17cvpr, godard2019digging,
wang2018learning, Li18cvpr, fu2018deep}. Better losses such as ordinal
regression, multi-scale gradient, and reverse Huber (Berhu) loss were proposed in
those works. Another set of approaches is to jointly estimate poses and depth
in a self-supervised manner. This is the case of
Zhou~\emph{et~al}~\cite{zhou2017unsupervised}. Their work proposes to simultaneously
predict both pose and depth with an alignment loss computed from the warped
consecutive images. Most of the previous works, except for
of~\cite{Li18cvpr}, are specific for the scenario where they have been trained
and, thus, they are not domain independent.
\subsection{Event-based Depth Estimation}
Early works on event-based depth estimation used multi-view
stereo~\cite{Rebecq16bmvc} and later Simultaneous Localization and Mapping
(SLAM) \cite{Rebecq17ral,Rosinol18ral,Zhu17cvpr, Kim16eccv} to build a
representation of the environment (i.e.: map) and therefore derivate metric
depth. These approaches are model-based methods that jointly calculate pose and
map by solving a non-linear optimization problem. Model-based methods can be divided into
feature-based methods that produce sparse point clouds and direct methods that
generate semi-dense depth maps. Both methods either use
the scale given by available camera poses or rely on auxiliary sensors such as
inertial measurement units (IMU) to recover metric depth.
Purely vision-based methods have investigated the use of stereo event cameras
for depth estimation \cite{Zhou18eccv,Zhu18eccv} in which they rely on
maximizing a temporal (as opposed to photometric) consistency between the pair
of event camera streams to perform disparity and depth estimation. Recently,
several learning-based approaches have emerged that have led to significant
improvements in depth estimation \cite{Zhu19cvpr,Tulyakov19iccv}. These methods
have demonstrated more robust performance since they can integrate several cues
from the event stream. Among these, \cite{Zhu19cvpr} presents a feed-forward
neural network that jointly predicts relative camera pose and per-pixel
disparities. Training is performed using stereo event camera data, similar
to~\cite{Godard17cvpr}, and testing is done using a single input. However, this
method still generates semi-dense depth maps, since a mask is applied to generate event frame depths at pixels where an event occurred.
The work in \cite{Tulyakov19iccv} overcomes these limitations by fusing data from
stereo setup to produce dense metric depth but still relies on a stereo setup
and a standard feed-forward architecture. Our work compares to the
learning-based approaches but goes one step further by predicting dense metric
depth for a single monocular camera. We achieve this by exploiting the temporal
consistency of the event stream with a recurrent convolution network
architecture and training on synthetic and real data. Table~\ref{tab:soa}
provides a comparison of among state of the art methods, model-based and
learning-based, where our proposed approach exceeds by grouping all the listed
features.
\section{Why using events for Depth prediction?}
\label{sec:appendixb}
\begin{figure*}[t!]
\centering
$\begin{array}{cc}
\subcaptionbox{\label{fig:tunnel_frame} Frame}
{
\includegraphics[width=0.5\textwidth,keepaspectratio]{images/results/morning_tunnel_davis_0000000637}
}
\hspace{-0.1cm}
\subcaptionbox{\label{fig:tunnel_megadepth} MegaDepth on frames~\cite{Li18cvpr}}
{
\includegraphics[width=0.5\textwidth,keepaspectratio]{images/results/morning_tunnel_megadepth_0000000637}
}
\end{array}$
$\begin{array}{cc}
\hspace{-0.1cm}
\subcaptionbox{\label{fig:tunnel_events} Events}
{
\includegraphics[width=0.5\textwidth,keepaspectratio]{images/results/morning_tunnel_events_white_0000000637}
}
\hspace{-0.1cm}
\subcaptionbox{\label{fig:tunnel_prediction} Ours on events}
{
\includegraphics[width=0.5\textwidth,keepaspectratio]{images/results/morning_tunnel_prediction_0000000637}
}
\end{array}$
\caption{Qualitative results in a high dynamic range (HDR) situation facing the
sun when driving a car on a highway.~\ref{fig:tunnel_frame} grayscale frame from
a DAVIS camera.~\ref{fig:tunnel_megadepth} Depth prediction from
MegaDepth.~\ref{fig:tunnel_events} Events and~\ref{fig:tunnel_prediction} our depth map prediction using events}
\label{fig:tunnel_result}
\end{figure*}
\begin{figure*}[t!]
\centering
$\begin{array}{cc}
\subcaptionbox{\label{fig:e2vid} E2VID\cite{Rebecq19pami}}
{
\includegraphics[width=0.5\textwidth,keepaspectratio]{images/results/e2vid/e2vid_0000001731}
}
\hspace{-0.12cm}
\subcaptionbox{\label{fig:megadepth_e2vid} MegaDepth on E2VID}
{
\includegraphics[width=0.5\textwidth,keepaspectratio]{images/results/e2vid/megadepth_e2vid_0000001731}
}
\end{array}$
$\begin{array}{cc}
\hspace{-0.12cm}
\subcaptionbox{\label{fig:qualitative_events} Events}
{
\includegraphics[width=0.5\textwidth,keepaspectratio]{images/results/e2vid/events_white_0000001731}
}
\hspace{-0.12cm}
\subcaptionbox{\label{fig:qualitative_prediction} Ours on events}
{
\includegraphics[width=0.5\textwidth,keepaspectratio]{images/results/e2vid/prediction_0000001731}
}
\end{array}$
\caption{Qualitative results comparing depth prediction using MegaDepth on reconstructed
frames from E2VID and our method using events.}
\label{fig:e2vid_comparison}
\end{figure*}
State of the art research in computer vision has demonstrated that salient edges
and texture are more relevant than color to estimate depth~\cite{huiccv19}.
Event cameras capture salient edges as well as detailed changes in brightness
with high temporal-spatial resolution. This makes event cameras suitable sensors
to predict depth. We present two qualitative cases in this Appendix.
Fig.~\ref{fig:tunnel_result} shows a comparison by estimating depth from events
in an HDR scenario. Our method predicts depth directly from events while MegaDepth
uses the greyscale frame. MegaDepth shows difficulties to mask the sky due to
overexposure while the prediction from events better approximates the structure
of the scene. However, our method has some difficulties to predict the truck on
the right side of the image. This is because our DENSE dataset and
the~\textit{outdoor day2} sequence from MVSEC do not have moving trucks, so the
network has never seen such a situation during training.
Fig.~\ref{fig:e2vid_comparison} depicts the case of predicting depth from a
reconstructed frame using E2VID~\cite{Rebecq19pami}, which has HDR and does not
suffer from motion blur. The reconstruction shows that depth prediction directly
from events has more level of detail than from a reconstructed frame.
\section{Why using events for Depth prediction?}
\label{sec:appendixb}
\begin{figure*}[t!]
\centering
$\begin{array}{cccc}
\subcaptionbox{\label{fig:tunnel_frame} Frame}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/morning_tunnel_davis_0000000637}
}
\hspace{-0.1cm}
\subcaptionbox{\label{fig:tunnel_megadepth} MegaDepth on frames~\cite{Li18cvpr}}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/morning_tunnel_megadepth_0000000637}
}
\hspace{-0.1cm}
\subcaptionbox{\label{fig:tunnel_events} Events}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/morning_tunnel_events_white_0000000637}
}
\hspace{-0.1cm}
\subcaptionbox{\label{fig:tunnel_prediction} Ours on events}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/morning_tunnel_prediction_0000000637}
}
\end{array}$
\caption{Qualitative results in a high dynamic range (HDR) situation facing
the sun when driving a car on a highway. Fig.~\ref{fig:tunnel_frame}
grayscale frame from a DAVIS camera. Fig.~\ref{fig:tunnel_megadepth} Depth
prediction from MegaDepth. Fig.~\ref{fig:tunnel_events} Events and
Fig.~\ref{fig:tunnel_prediction} our depth map prediction using events}
\label{fig:tunnel_result}
\end{figure*}
\begin{figure*}[t!]
\centering
$\begin{array}{cccc}
\subcaptionbox{\label{fig:e2vid} E2VID\cite{Rebecq19pami}}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/e2vid/e2vid_0000001731}
}
\hspace{-0.12cm}
\subcaptionbox{\label{fig:megadepth_e2vid} MegaDepth on E2VID}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/e2vid/megadepth_e2vid_0000001731}
}
\hspace{-0.12cm}
\subcaptionbox{\label{fig:qualitative_events} Events}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/e2vid/events_white_0000001731}
}
\hspace{-0.12cm}
\subcaptionbox{\label{fig:qualitative_prediction} Ours on events}
{
\includegraphics[width=0.25\textwidth,keepaspectratio]{images/results/e2vid/prediction_0000001731}
}
\end{array}$
\caption{Qualitative results comparing depth prediction using MegaDepth on reconstructed
frames from E2VID and our method using events.}
\label{fig:e2vid_comparison}
\end{figure*}
State of the art research in computer vision has demonstrated that salient edges
and texture are more relevant than color to estimate depth~\cite{huiccv19}.
Event cameras capture salient edges as well as detailed changes in brightness
with high temporal-spatial resolution. This makes event cameras suitable sensors
to predict depth. We present two qualitative cases in this Appendix.
Fig.~\ref{fig:tunnel_result} shows a comparison by estimating depth from events
in an HDR scenario. Our method predicts depth directly from events while MegaDepth
uses the greyscale frame. MegaDepth shows difficulties to mask the sky due to
overexposure while the prediction from events better approximates the structure
of the scene. However, our method has some difficulties to predict the truck on
the right side of the image. This is because our DENSE dataset and
the~\textit{outdoor day2} sequence from MVSEC do not have moving trucks, so the
network has never seen such a situation during training.
Fig.~\ref{fig:e2vid_comparison} depicts the case of predicting depth from a
reconstructed frame using E2VID~\cite{Rebecq19pami}, which has HDR and does not
suffer from motion blur. The reconstruction shows that depth prediction directly
from events has more level of detail than from a reconstructed frame.
| {'timestamp': '2020-10-23T02:14:09', 'yymm': '2010', 'arxiv_id': '2010.08350', 'language': 'en', 'url': 'https://arxiv.org/abs/2010.08350'} | arxiv |
\section*{Introduction}
In December 2019, a novel coronavirus disease (COVID-19) emerged in Wuhan, China~\cite{HUI:IJID:2020}, and has since spread out to the rest of the world, evolving into a pandemic~\cite{WOROBEY:SCIENCE:2020}. Due to its high infection rate, the virus SARS-CoV-2 is not only causing mortality, but it is also stressing national health systems due to the large number of infected people that need hospitalization, also causing a profound economic impact~\cite{MILLER:NATUREMEDICINE:2020,PHUA:LANCETRESPIRATORYMEDICINE:2020,KAWOHL:LANCETPSY:2020}.
In the absence of a vaccine or an effective treatment for COVID-19, the role of public health measures mostly comprehends the so-called \emph{non-pharmaceutical interventions} (NPIs)~\cite{imperial:report9:2020}, including social distancing and isolation, reducing economic activities, enforcing home office, moving to remote classes and closing social venues where people tend to agglomerate in close proximity.
Initially, sanitary authorities opted for strict NPIs.
As the pandemic evolved, other factors emerged and started an interplay with the health crisis.
Therefore, measures were revisited and, oftentimes, relaxed.
However, a critical question is still unresolved:
What is the impact of reopening the school system for in-person classes~\cite{science:Lordan:2020,lancet:jasmina:2020}?
When to start reopening schools and the reopening policy are particularly important questions for multiple reasons: $i)$ education is a basic human necessity;
$ii)$ in-person classes enable other economic activities because parents can go to work while their children are at school~\cite{lancet:viner:2020}, besides other markets associated with schools, such as transportation, food, clothing, among others;
$iii)$ in-person classes are often hard to replace with online learning, especially in developing countries and for impoverished families, due to lower availability of broadband Internet and fast laptop computers with cameras;
$iv)$ due to the relatively long time children spend in proximity to each other in schools, the potential for exposure is much higher, requiring several workarounds to reduce the transmission rate~\cite{vermund:2020}, especially because young people tend to be asymptomatic while carrying high viral loads~\cite{Hildenwall:2020}, which increases the chances of an exponential transmission growth, thereby requiring additional quarantines to prevent a health system collapse; and
$v)$~a well-crafted policy for returning to school may help preventing new waves of the pandemic, save lives, and reduce the amount of psychological stress due to the health crisis~\cite{LANCETEDITORIALPSY:LANCETPSY:2020}.
To understand the impact of the pandemic on schools and develop policies to deal with it, mathematical and computer simulation modeling is crucial~\cite{science:Metcalf:2020}.
In this work, we set out to evaluate a range of strategies for opening the school system of the São Paulo Metropolitan Area~(SPMA) using computer simulation.
We chose this region as a case study because Brazil is one of the current epicenters of the pandemic~\cite{BARBERIA:LANCET:2020,imperial:report21:2020}, and the SPMA is the most relevant of the country due its huge population and economical importance.
The region contains 39 cities and 21.7 million inhabitants, representing about 10\% of Brazil's population~\cite{sus:datasus:tabnet}.
We analyze 3 different strategies of school reopening: (i) reopen schools with all students at once; (ii) reopen schools following a strategy based on the official plan of the São Paulo government~\cite{PlanoSP:2020}, which consists of 3 stages, carefully increasing the amount of students in each stage; and (iii) reopen schools only when a vaccine becomes available. We show results regarding the total amount of COVID-19 cases, critical cases and number of deaths.
\section*{Materials and Methods}
Most models to analyze pandemics employ compartmental models, such as SIS, SIR, SEIR or SEIHR~\cite{AbouIsmail:2020}.
However, the assumptions of homogeneous random mixing in those models can lead to wrong projections.
Also, the effects of non-pharmaceutical interventions (NPIs)~\cite{imperial:report9:2020} are difficult to implement in those models.
To overcome these issues, we developed a heterogeneous and dynamic network stochastic model~\cite{Enright:2018, Brauer:2017, Graham:2013}.
The model was implemented as a simulator written in the C++ language, which was chosen due its high performance, low overhead and powerful object-oriented features.
The network was modeled as an undirected graph $G = (V, E)$, in which the vertices $V$ represent the people and the edges $E$ the relations between people, which have an infection rate.
Given two people $v_1$ and $v_2$, such that $v_1 \in V$ and $v_2 \in V$, if we have an edge $e \in E$ such that $e = (v_1, v_2)$, the person $v_1$ can infect the person $v_2$.
To support heterogeneous infection rates, we color the edges of the graph, such that we can attribute different infection rates for each color.
The color represents the type of relation.
Although it is possible to have any kind of relations modeled, for this work we modeled the following relation types: home, community, workplace, schools and Inter-city.
Since our model supports heterogeneous networks, it can provide a better representation of the population~\cite{science:Britton:2020}.
Each person can have an arbitrary number of edges in the graph, and the relation type (color) of each edge is also arbitrary.
Therefore, as in real life, each person can have different infection rates depending on the number of relations they have, as well as the type of each relation.
Since each person has a different infection rate, each person also has a different basic reproduction rate ($R_0$). Therefore, to set the overall $R_0$, we calibrate the infection rates over the entire network such that the average $R_0$ among all people is equal to the target value.
As our model supports dynamic networks, we can change relations at any time during the simulation.
We are able to modify the infection rates, as well as add and remove edges from the graph.
This is useful to implement sanitary interventions.
We based our model in the SEIR compartmental model~\cite{AbouIsmail:2020}, but extended it to support more compartments.
Each person can be in one of the following states:
\begin{description}[noitemsep]
\item[Susceptible] The person can be infected.
\item[Infected] The person is currently infected. An infected person can have different sub-states, as we will explain later.
\item[Immune] The person is immune, either from recovering from the disease or from taking a vaccine. The person will not contract the disease anymore.
\item[Dead] The person died.
\end{description}
As for infected people, each one can be in the following sub-states:
\begin{description}[noitemsep]
\item[Incubation] The person was infected but has not developed any symptoms yet and is not contagious.
\item[Unreported] The person is contagious but either is asymptomatic or has such light symptoms that it does not receive any health care. This person, in real life, would not be part of any official statistics, hence a sub-notified case.
\item[Pre-symptomatic] The person is contagious, but did not develop any symptoms yet.
\item[Mild] The person has mild symptoms and can recover at home.
\item[Severe] The person has severe symptoms and requires health care in a hospital.
\item[Critical] The person has critical symptoms and requires health care in an Intensive Care Unit (ICU). After recovering from critical symptoms, the state is set to severe.
\end{description}
The disease spreads from infected people to susceptible people according to the infection rate of each edge in the graph, which is evaluated using a Monte Carlo based approach.
The probability of a susceptible person $p$ to get infected in a simulation cycle is given by Equations~\ref{eq:propagation:1} to~\ref{eq:propagation:4}.
Equation~\ref{eq:propagation:3} defines the number of neighbors of each vertex (person) that are infected -- $N(p)$.
In Equation~\ref{eq:propagation:4}, the function $InfectRate(p, n)$ returns the infection rate between $p$ and $n$ in the network.
\begin{gather}
G = (V, E)
\label{eq:propagation:1}\\
p \in V
\label{eq:propagation:2}\\
N(p) = \bigcup v \in V \mid \exists e \in E, e = (v, p), state(v) = infected
\label{eq:propagation:3}\\
InfectProbability(p) = 1 - \displaystyle\prod_{n \in N(p)} (1 - InfectRate(p, n))
\label{eq:propagation:4}
\end{gather}
In the simulation, we consider all the cities and population that comprehend the SPMA, including the demographic distribution.
Data used to set the simulation parameters were extracted from the literature and official available data.
Since our model is stochastic, each execution of the program generates a different network and a different disease transmission sample path.
Therefore, our results derive from 10 executions and are shown within a 95\% confidence interval following Student's t-distribution.
A comprehensive discussion on the simulation parameters, how we generate the relation network and handle sanitary interventions, as well as figures containing additional results, can be found in the supplementary material.
\section*{Results and discussion}
In the first strategy, we evaluate what could happen if all students went back to school at once, but following sanitary measures, such as wearing masks and frequently washing their hands.
Figure~\ref{fig:strategy:all:students} presents the results for this scenario.
In the left column, we show results regarding the general population of SPMA.
In the right column, we show results regarding only people that attend school, students and teachers.
Results considering the sub-population of teachers and families of people that attend school can be found in the supplementary material.
Predicting how much the infection rate in schools differs from the infection rate in the community is a difficult task. Similarly, it is nearly impossible to predict how strictly students will follow the sanitary measures.
Consequently, we evaluate two different infection rates in schools: a best case and a worst case scenario, in which the school infection rates are 2 and 4 times the community infection rate, respectively.
Also, for these results, we consider a 50\% social isolation level inside the same classroom (we consider two students as isolated when they do not have any contact with each other, and therefore have no relation between them in the network).
We show results regarding the expected number of reported COVID-19 cases, critical cases, which require intensive care units (ICU) for their treatment, and number of deaths.
In the simulations, we consider that the health system is always able to handle the demand, such that we can evaluate the peak ICU usage; thereby, no one dies from health system collapse.
In all results, day~0 corresponds to February 26th, 2020, which is the date corresponding to the first documented case in Brazil.
School reopening is set to day~224, which corresponds to October 7th, 2020, which is when the São Paulo State plans to open schools.
Opening schools without any kind of constraint on the number of students per classroom, using its total capacity, can increase the number of reported COVID-19 cases by up to \mbox{835,639}, and \mbox{40,860} more deaths occur compared to when schools do not reopen, with a peak of \mbox{12,748} people in critical condition that will require ICU treatment.
In the SPMA, there are about \mbox{5,000} ICUs available for COVID-19~\cite{seade:github}.
Therefore, the health care system would collapse in case all students returned to school at once.
By analyzing the data only in the school sub-population, we first note that the ratio of critical patients and deaths are small compared to the entire population.
While the average death rate of infected people in the population was \mbox{5.3\%}, the death rate in the school sub-population was only \mbox{0.2\%}.
This is because most students are young and, according to the official COVID-19 statistics, younger people have a smaller probability to develop the critical symptoms of the disease.
Nevertheless, we can observe that the COVID-19 reported cases among people that frequent schools increase to up to \mbox{3.6$\times$} when compared to the scenario where schools do not reopen.
This result shows that, although the opening of schools with full capacity does not present a huge risk for the students, students act as vectors of the virus, causing a big impact in the entire metropolitan area.
It is also important to note that, if we consider that people in critical state that do not receive ICU treatment dies, the amount of deaths would be much higher, since the health system would collapse if this strategy were adopted.
In the second strategy, we analyze a school opening strategy based on the plan of the S\~{a}o Paulo state government~\cite{PlanoSP:2020}.
The plan consists of 3 stages.
In the first stage, about a third of the students per class attend school each day.
In the second stage, about two thirds of the students go to school.
In the last stage, all students go back to school.
Every student and professional must obey sanitary measures such as wearing masks and frequently washing their hands.
In our evaluation, stage~1 lasts 4~weeks and stage~2 lasts 17~weeks.
The results of using this strategy are depicted in Figure~\ref{fig:strategy:sp:plan}, following the same organization of the previous strategy (Figure~\ref{fig:strategy:all:students}).
For this experiment, we consider an isolation level of 50\%.
Compared to when all students go to school, we can observe that the total number of reported infected people, in the worst case, reduces by \mbox{96,216}.
This translates to \mbox{4,437} fewer deaths, as well as reduction of the critical patients peak to \mbox{4,890} (after schools opened), which represents an ICU occupancy of only 97.8\%.
In the best case, the maximum ICU occupancy is~48.8\% after schools open.
Results only considering the school sub-population follow the same trend of the general results.
Considering the worst case, we can reduce the number of reported cases by \mbox{29,200} people and the number of deaths by 54 people compared to when all students go to school.
Regarding the deaths expected for the worst case, there would be a total of 541 deaths inside the school sub-population, in which 356 deaths correspond to teachers, representing 65.8\% of school-related deaths.
Although there are many more students than teachers, teachers are older than the students, and hence have a higher mortality rate.
If students strictly follow the sanitary measures, as considered by the best case, the difference between opening the schools with all students or with São Paulo's plan is lower, but still very significant.
Overall, results show that, although the difference in the number of cases is low compared to when all students come back at once, using an opening strategy with several phases avoids the health system collapse, which would have a big impact in the actual number of deaths.
In Figure~\ref{fig:strategy:sp:explore}, we analyze several isolation levels for the São Paulo strategy.
An isolation level of 100\% means that students inside the same classroom have no interaction between each other, while an isolation level of 0\% means that each student is able to infect any other student inside the same classroom.
As in previous experiments, we evaluate two different rates.
If students follow the social distancing and sanitary measures very strictly, with a 100\% isolation, there would be up to \mbox{678,729} less reported cases than students have a 0\% of isolation, reflecting in \mbox{32,817} fewer deaths.
Although 0\% and 100\% isolation levels may be infeasible, there is no way to predict which isolation level would be achieved.
If we compare an 80\% isolation to a 20\% isolation, we reduce the number of deaths by up to \mbox{16,844}.
While comparing a range from 60\% isolation to a 40\% isolation, we still reduce the number of deaths significantly, by up to \mbox{4,748}.
Even with a 0\% isolation, although the amount of deaths is higher, the maximum number of required ICUs was \mbox{5,212} after schools opened, only a little higher than the capacity of SPMA.
As expected, results show that student behavior is a key factor for the success of this strategy.
The major problem is that there is no way to predict how students are going to behave.
The last strategy we evaluate, shown in Figure~\ref{fig:strategy:vaccine}, is to return to classes and open schools only on day~341, which corresponds to February 1st, 2021.
We consider that all students return to school but follow sanitary measures (masks and hygiene).
For this strategy, we analyze two different scenarios: (1) no vaccines are available; (2) vaccines are available since day~310 (January 1st, 2020).
For the vaccines scenario, the vaccines are administered with a procedure divided into four phases, in the following order: people who are over 50 years old, teachers, students and, finally, the rest of the population.
We consider that \mbox{300,000} people can receive the vaccine per day with 90\% effectiveness rate and the vaccine takes 14 days to generate the individual immune response.
The most important thing to note is that, in the scenario without vaccines, regardless if schools open on day~224 or~341, opening schools with all students at once has a deep impact in the number of cases, deaths and health care system.
On the other hand, with the vaccines, we can observe that schools can be reopened without any major concerns about ICU beds availability.
In this case, up to \mbox{37,753} lives could be saved compared to the previous controlled reopen strategy.
Besides the overall immunity of the population, by prioritizing teachers and students, we are able to cut the transmission chain of COVID-19 inside the schools.
\section*{Conclusions}
By analyzing all strategies, we conclude that opening schools with all students at once is a strategy that imposes a high risk, such that any government that adopts it, regardless if this or next year, should proceed very carefully.
It can lead to a collapse of the health care system and thereby to the need of further quarantine periods, which could have a catastrophic impact on economics.
It is also important to note that the students, due to their age, are the least affected by the opening of schools.
However, they can act as infection vectors, causing massive spreads to more sensitive people, such as their family and teachers.
Adopting a controlled reopening, with several stages, carefully increasing the number of students, it is notorious that it is able to reduce the speed of the spread of the virus, with a maximum ICU usage peak between 48.8\% and 97.8\% depending on how much people that attend the school follow the sanitary measures (considering a 50\% isolation), such that the health care system is able to handle the demand of new cases.
Finally, by opening schools only when vaccination campaigns be available, within the SPMA alone, up \mbox{37,753} lives could be saved compared to a controlled strategy.
Since we are likely within a few months of a vaccine, we consider the last the most appropriate strategy.
\bibliographystyle{science}
\fancyhead{}
\input{preprint.bbl}
\section*{Acknowledgments}
This research was partially supported by a machine allocation on the Kabr\'e supercomputer at the Costa Rica National High Technology Center.
We would like to thank Marco A. Amato for reviewing an earlier version of this manuscript.
\textbf{Financial support}
This work received no direct funding.
\textbf{Conflict of interest}
Conflicts of Interest: None.
\textbf{Data and materials availability}
In case the paper gets accepted for publication, we will fully disclose all data underlying the study in a public repository.
\clearpage
\section*{Figures}
\begin{figure}[!h]
\centering
\begin{subfigure}{0.46\linewidth}
\includegraphics[width=\textwidth]{graphics-fig-1/graphics-fig-1-global-ac_reported.pdf}
\caption{General -- accumulated reported cases.}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.46\linewidth}
\includegraphics[width=\textwidth]{graphics-fig-1/graphics-fig-1-school-ac_reported.pdf}
\caption{Schools -- accumulated reported cases.}
\end{subfigure}
\begin{subfigure}{0.46\linewidth}
\includegraphics[width=\textwidth]{graphics-fig-1/graphics-fig-1-global-ac_infected_state_ST_CRITICAL.pdf}
\caption{General -- critical cases (ICU).}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.46\linewidth}
\includegraphics[width=\textwidth]{graphics-fig-1/graphics-fig-1-school-ac_infected_state_ST_CRITICAL.pdf}
\caption{Schools -- critical cases (ICU).}
\end{subfigure}
\begin{subfigure}{0.46\linewidth}
\includegraphics[width=\textwidth]{graphics-fig-1/graphics-fig-1-global-ac_state_ST_DEAD.pdf}
\caption{General -- accumulated deaths.}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.46\linewidth}
\includegraphics[width=\textwidth]{graphics-fig-1/graphics-fig-1-school-ac_state_ST_DEAD.pdf}
\caption{Schools -- accumulated deaths.}
\end{subfigure}
\caption{Curves of infected people when schools reopen with all students at once.}
\label{fig:strategy:all:students}
\end{figure}
\begin{figure}[!h]
\centering
\begin{subfigure}{0.44\linewidth}
\includegraphics[width=\textwidth]{./graphics-fig-2/graphics-fig-2-global-ac_reported.pdf}
\caption{General -- accumulated reported cases.}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.44\linewidth}
\includegraphics[width=\textwidth]{./graphics-fig-2/graphics-fig-2-school-ac_reported.pdf}
\caption{Schools -- accumulated reported cases.}
\end{subfigure}
\begin{subfigure}{0.44\linewidth}
\includegraphics[width=\textwidth]{./graphics-fig-2/graphics-fig-2-global-ac_infected_state_ST_CRITICAL.pdf}
\caption{General -- critical cases (ICU).}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.44\linewidth}
\includegraphics[width=\textwidth]{./graphics-fig-2/graphics-fig-2-school-ac_infected_state_ST_CRITICAL.pdf}
\caption{Schools -- critical cases (ICU).}
\end{subfigure}
\begin{subfigure}{0.44\linewidth}
\includegraphics[width=\textwidth]{./graphics-fig-2/graphics-fig-2-global-ac_state_ST_DEAD.pdf}
\caption{General -- accumulated deaths.}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.44\linewidth}
\includegraphics[width=\textwidth]{./graphics-fig-2/graphics-fig-2-school-ac_state_ST_DEAD.pdf}
\caption{Schools -- accumulated deaths.}
\end{subfigure}
\caption{Curves of infected people when schools reopen following São Paulo's strategy.}
\label{fig:strategy:sp:plan}
\end{figure}
\begin{figure}[!h]
\centering
\begin{subfigure}{0.43\linewidth}
\includegraphics[width=\textwidth]{./graphics-fig-3/global-ac_reported.pdf}
\caption{General -- accumulated reported cases.}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.43\linewidth}
\includegraphics[width=\textwidth]{./graphics-fig-3/school-ac_reported.pdf}
\caption{Schools -- accumulated reported cases.}
\end{subfigure}
\begin{subfigure}{0.43\linewidth}
\includegraphics[width=\textwidth]{./graphics-fig-3/global-peak_icu.pdf}
\caption{General -- peak of critical cases (ICU) after schools reopen.}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.43\linewidth}
\includegraphics[width=\textwidth]{./graphics-fig-3/school-peak_icu.pdf}
\caption{Schools -- peak of critical cases (ICU) after schools reopen.}
\end{subfigure}
\begin{subfigure}{0.43\linewidth}
\includegraphics[width=\textwidth]{./graphics-fig-3/global-ac_state_ST_DEAD.pdf}
\caption{General -- accumulated deaths.}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.43\linewidth}
\includegraphics[width=\textwidth]{./graphics-fig-3/school-ac_state_ST_DEAD.pdf}
\caption{Schools -- accumulated deaths.}
\end{subfigure}
\caption{Curves of infected people when schools reopen following São Paulo's strategy, evaluating different isolation levels.}
\label{fig:strategy:sp:explore}
\end{figure}
\begin{figure}[!h]
\centering
\begin{subfigure}{0.46\linewidth}
\includegraphics[width=\textwidth]{graphics-fig-4/graphics-fig-4-global-ac_reported-none.pdf}
\caption{No vaccine -- accumulated reported cases.}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.46\linewidth}
\includegraphics[width=\textwidth]{graphics-fig-4/graphics-fig-4-global-ac_reported-priorities.pdf}
\caption{With vaccine -- accumulated reported cases.}
\end{subfigure}
\begin{subfigure}{0.46\linewidth}
\includegraphics[width=\textwidth]{graphics-fig-4/graphics-fig-4-global-ac_infected_state_ST_CRITICAL-none.pdf}
\caption{No vaccine -- critical cases (ICU).}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.46\linewidth}
\includegraphics[width=\textwidth]{graphics-fig-4/graphics-fig-4-global-ac_infected_state_ST_CRITICAL-priorities.pdf}
\caption{With vaccine -- critical cases (ICU).}
\end{subfigure}
\begin{subfigure}{0.46\linewidth}
\includegraphics[width=\textwidth]{graphics-fig-4/graphics-fig-4-global-ac_state_ST_DEAD-none.pdf}
\caption{No vaccine -- accumulated deaths.}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.46\linewidth}
\includegraphics[width=\textwidth]{graphics-fig-4/graphics-fig-4-global-ac_state_ST_DEAD-priorities.pdf}
\caption{With vaccine -- accumulated deaths.}
\end{subfigure}
\caption{Curves of infected people when schools reopen with all students on day~341.}
\label{fig:strategy:vaccine}
\end{figure}
\clearpage
\vspace{5cm}
{\huge Supplementary Material}
\vspace{2cm}
\textbf{The supplementary Material includes}:
\begin{description}[noitemsep]
\item Materials and Methods
\item Figs. 5 to 11
\item Tables 1 to 4
\item References
\end{description}
\textbf{Other Supplementary Materials for this manuscript include the following}:
\begin{description}[noitemsep]
\item Repository address of the simulator source code and input data: Will be disclosed upon paper approval.
\end{description}
\clearpage
\section{Materials and Methods}
\label{sec:methodology}
\subsection{Generating the Relation Network}
\label{sec:methodology:network}
The initial network was created in 5 stages.
Note that the initial network considers a normal scenario with no pandemic and interventions.
We explain how we handle the interventions in Section~\ref{sec:methodology:interventions}.
The initial network was created as follows:
\begin{description}[noitemsep]
\item[Home relations] The number of people in the same home follows a distribution described in Table~\ref{tb:dist:network} and Figure~\ref{fig:dist:network:home}, which was derived from the microdata of the last official census from the Brazilian Institute of Geography and Statistics (IBGE) \cite{ibge:censo:2010:microdata}.
Inside the same home, every person is connected to all other people within the same home.
\item[Community relations] The number of relations of each person follows a distribution described in Table~\ref{tb:dist:network} and Figure~\ref{fig:dist:network:community}.
\item[Workplace relations] The number of people per company follows a distribution described in Table~\ref{tb:dist:network} and Figure~\ref{fig:dist:network:workplace}.
We only model as workplace relations jobs that involve agglomeration of people, such as people that work in the commerce, offices, industry and public sectors.
Other jobs, such as people that are autonomous workers or people that work with agriculture, are indirectly modeled in the community relations.
The data regarding the number of employed people and per job type was extracted from IBGE~\cite{ibge:pnad:jan2020, ibge:pnad:jan2020:notice, ibge:censo:2010:microdata}.
In summary, 64\% of people with 18 years old or above work.
Among people that work, 45\% were modeled using workplace relations.
Also, inside the same workplace, we consider that the probability of two people to be connected in the network as 50\%.
\item[School relations] The number of students inside the same class and the number of students within each school follow the distributions described in Table~\ref{tb:dist:network}, Figure~\ref{fig:dist:network:school:classroom} and Figure~\ref{fig:dist:network:school:total}.
For the relations between students from different classrooms, two students have a $0.5\%$ of probability of having a relation in the network.
For the relations between students within the same classroom, two students have a $50\%$ of probability of having relation in the network.
We add one teacher for each classroom, in which the teacher has a relation to all the students of the same class in the network.
According to the census~\cite{ibge:censo:2010:microdata}, $77.8\%$ of people with 18 years old or below frequent the school.
\item[Inter-city relations] The number of people that routinely travel between the different cities relations was gathered from the census~\cite{ibge:censo:2010:microdata}, which indicates a $17.8\%$ of mobility between cities in the metropolitan region of São Paulo.
However, the data does not show the cities, only if the person goes to a different city.
To overcome this issue, we assume that $90\%$ of the traffic from satellite cities go to the capital, and the rest is divided between the other cities in proportion to their population size.
Regarding the traffic from the capital to satellite cities, the traffic is divided proportionally to their population size.
\end{description}
\subsection{Handling Interventions}
\label{sec:methodology:interventions}
To handle interventions, we can modify the infection rates, as well as add and remove edges from the graph.
Different types of intervention require different modifications.
We handled the interventions evaluated in the paper as follows:
\begin{description}[noitemsep]
\item[Quarantine]
To implement the quarantine, we first reduce the infection rates inside schools to zero. Afterwards, we remove the workplace relations corresponding to 50\% of the workplaces.
The 50\% of the relations that are left correspond to essential services that can not be interrupted.
Finally, we reduce the infection rate of community, workplace and inter-city relations to match the reduced reproduction rate, which also simulates other sanitary measures such as wearing masks.
Home relations are not affected by quarantines.
\item[Re-opening of economic activities]
During the quarantine, we zeroed the infection rate of half of the workplaces. To re-open the economic activities, we just increase the infection rate of such edges.
\item[Re-opening schools with all students]
We only increase the infection rate of school relations, which was zeroed by the quarantine.
\item[Re-opening schools with the São Paulo government strategy]
We first remove all school relations from the graph, backing up the data regarding which students and teachers belonged to the same classroom.
We create 3 more relation types to represent each group of students.
Afterwards, we divide each classroom in 3 and re-create the edges using the newly created relation types.
To select which students go to school in a day, we just need to adjust the infection rates of the new relations, zeroing the relations corresponding to the students that will not go to school that day.
\item[Vaccine]
To simulate the vaccines, we only need to change the state of the person being vaccinated to the immune state, carefully considering that it takes some time to the vaccine to make effect, and that not everyone that gets vaccinated will be immunized.
\end{description}
\subsection{Other Simulations Parameters}
\label{sec:methodology:others}
Several simulation parameters can be found in Table~\ref{tb:prob:other:params}~\cite{ibge:pnad:jan2020, ibge:pnad:jan2020:notice, ibge:censo:2010:microdata, sus:datasus:tabnet, Rees2020, PHUA:LANCETRESPIRATORYMEDICINE:2020, sus:opendata}.
The frequency distributions found in the table can be seen in Figure~\ref{fig:params:dist}.
In Table~\ref{tb:prob:symptoms}, we present the probabilities of an infected person to develop symptoms per-age.
The biggest challenge to generate this information is that there is no official data regarding the number of unreported cases per age, as expected by the own definition of unreported.
Therefore, we need to make several transformations with the reported data to take into account the unreported cases in the simulation.
We now describe how we generated these information of Table~\ref{tb:prob:symptoms}.
We first define some functions and variables that return the input data of the algorithm:
\begin{itemize}[noitemsep]
\item Function $people(age)$ returns the number of people of age $age$ in the entire population, which we extracted from the census~\cite{sus:datasus:tabnet}.
\item Functions $reportedMild(age)$, $reportedSevere(age)$ and $reportedCritical(age)$ should return the number of people with mild, severe and critical symptoms per age, respectively.
We extracted this information from the microdata published by the Health Ministry~\cite{sus:opendata}.
\item Variable $globalRatioUnreported$ is the ratio of unreported cases in the entire population. We set it to 0.85 in this paper, since the vast majority of COVID infections are unreported~\cite{science:li:2020}.
\end{itemize}
Next, we define some variable and functions to be used later.
\begin{gather}
totalReportedMild = \sum_{age=0}^{9} reportedMild(age) \\
totalReportedSevere = \sum_{age=0}^{9} reportedSevere(age) \\
totalReportedCritical = \sum_{age=0}^{9} reportedCritical(age)\\
reported(age) = reportedMild(age) + reportedSevere(age) + reportedCritical(age)\\
totalReported = \sum_{age=0}^{9} reported(age)
\end{gather}
To calculate the probability of a person to be unreported, we first calculate the ratio of reported cases:
\begin{gather}
ratioReportedMild(age) = \dfrac{reportedMild(age)}{reported(age)} \\
ratioReportedSevere(age) = \dfrac{reportedSevere(age)}{reported(age)} \\
ratioReportedCritical(age) = \dfrac{reportedCritical(age)}{reported(age)}
\end{gather}
Then, we use Equation~\ref{eq:prob:unreported}, which finds a value $u$ that forces the mean number of unreported people to the desired value.
In the equation, $weight(age)$ returns the proportion of people of age $age$ that should be unreported. Since there is no data for unreported (as expected by the own definition of unreported), we assume that $weight$ has the same ratio of mild cases per age, as it is the softer symptom recorded by official data.
Find $u$, such that:
\begin{gather}
weight(age) = ratioReportedMild(age) \\
u \cdot \dfrac{\sum_{age=0}^{9} weight(age) \cdot people(age)}{\sum_{age=0}^{9} people(age)} = globalRatioUnreported
\label{eq:prob:unreported}
\end{gather}
After finding $u$, we calculate a temporary ratio of unreported cases by age, just used to calculate the symptomatic ratios:
\begin{align}
tmpRatioUnreported(age) &= weight(age) \cdot u
\end{align}
Now that we know the ratio of unreported cases by age, we can calculate the relative proportion (weight) of symptomatic people:
\begin{gather}
weightMild(age) = ratioReportedMild(age) \cdot (1 - tmpRatioUnreported(age)) \\
weightSevere(age) = ratioReportedSevere(age) \cdot (1 - tmpRatioUnreported(age)) \\
weightCritical(age) = ratioCriticalMild(age) \cdot (1 - tmpRatioUnreported(age))
\end{gather}
Now we define our target averages for the ratio of mild, severe and critical cases relative to the entire population (not only relative to reported cases).
\begin{gather}
targetMildRatio = \dfrac{totalReportedMild}{totalReported} \cdot (1 - globalRatioUnreported) \\
targetSevereRatio = \dfrac{totalReportedSevere}{totalReported} \cdot (1 - globalRatioUnreported) \\
targetCriticalRatio = \dfrac{totalReportedCritical}{totalReported} \cdot (1 - globalRatioUnreported)
\end{gather}
Then, we use Equations~\ref{eq:prob:mild}, \ref{eq:prob:severe} and \ref{eq:prob:critical}, which find values $m$, $s$ and $c$ that force the mean ratio of people to the target value.
Find $m$, such that:
\begin{equation}
m \cdot \dfrac{\sum_{age=0}^{9} weightMild(age) \cdot people(age)}{\sum_{age=0}^{9} people(age)} = targetMildRatio
\label{eq:prob:mild}
\end{equation}
Find $s$, such that:
\begin{equation}
s \cdot \dfrac{\sum_{age=0}^{9} weightSevere(age) \cdot people(age)}{\sum_{age=0}^{9} people(age)} = targetSevereRatio
\label{eq:prob:severe}
\end{equation}
Find $c$, such that:
\begin{equation}
c \cdot \dfrac{\sum_{age=0}^{9} weightCritical(age) \cdot people(age)}{\sum_{age=0}^{9} people(age)} = targetCriticalRatio
\label{eq:prob:critical}
\end{equation}
Finally, we calculate the ratios relative to the entire population:
\begin{gather}
ratioMild(age) = weightMild(age) \cdot m \\
ratioSevere(age) = weightSevere(age) \cdot s \\
ratioCritical(age) = weightCritical(age) \cdot c \\
ratioUnreported(age) = 1 - ratioMild(age) - ratioSevere(age) - ratioCritical(age)
\end{gather}
Our model allows us to put different infection rates depending on the patient symptoms.
For patients with severe and critical symptoms, we reduce the infection rate by 50\% to simulate the more controlled environments inside hospitals.
For any symptomatic patients, we zero the infection rates to school and workplace relations.
For patients with severe and critical symptoms, we zero the infection rates to home relations.
Table~\ref{tb:prob:death} shows the death probability of each person depending on the symptoms and age.
As we can observe, the age of each person has a deep impact on the symptoms and death rate.
Due to that, we use real demographic data from the census~\cite{sus:datasus:tabnet}.
Since the last census is from 2010, we scale the number of people per age such that the total number of people corresponds to the estimated population size in 2019~\cite{sus:datasus:tabnet}.
The demographic data of the entire São Paulo Metropolitan Area can be seen in Figure~\ref{fig:demographics}.
\subsection{Calibrating the Simulation to Match Real-World Behavior}
\label{sec:methodology:calibration}
Figure~\ref{fig:cmpmatch} contains a comparison of the simulator behavior to the real-world data of the São Paulo Metropolitan Area.
The calibration process involves setting the interventions, as explained in Section~\ref{sec:methodology:interventions}, as well as manipulating the infection rates.
In Figure~\ref{fig:cmpmatch:g}, we compare the estimated number of people in the infected state at a day (do not confuse with the number of newly infected people per day).
In Figure~\ref{fig:cmpmatch:ac}, we compare the accumulated number of people in the infected state.
In Figure~\ref{fig:cmpmatch:critical}, we compare the number of critical patients, which represents the ICU occupancy.
It is important to mention that a perfect match between simulator and real-world behavior is impossible, mostly because of the fact that the vast majority of cases are unreported~\cite{science:li:2020}, such that it is impossible to accurately measure real behavior with the official published data.
Nevertheless, we were able to configure the simulation parameters to reflect the real behavior with a reasonable precision, as can be seen in the figures.
\clearpage
\subsection*{Figs. 5 to 11}
\begin{figure}[H]
\captionsetup[sub]{justification=centering}
\centering
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{graphics-dists/network-home.pdf}
\caption{Home.}
\label{fig:dist:network:home}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{graphics-dists/network-community.pdf}
\caption{Community.}
\label{fig:dist:network:community}
\end{subfigure}
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{graphics-dists/network-workplace.pdf}
\caption{Workplace.}
\label{fig:dist:network:workplace}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{graphics-dists/network-school-classroom.pdf}
\caption{School -- classroom.}
\label{fig:dist:network:school:classroom}
\end{subfigure}
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{graphics-dists/network-school-schoolsize.pdf}
\caption{School -- total.}
\label{fig:dist:network:school:total}
\end{subfigure}
\caption{Frequency distributions used to create the network of relations of the population.}
\label{fig:dist:network}
\end{figure}
\begin{figure}[H]
\captionsetup[sub]{justification=centering}
\centering
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{graphics-dists/incubation.pdf}
\caption{COVID-19 incubation time.}
\label{fig:params:dist:incubation}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{graphics-dists/icu-los.pdf}
\caption{ICU length of stay (critical cases).}
\label{fig:params:dist:icu:los}
\end{subfigure}
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{graphics-dists/hospital-los.pdf}
\caption{Infirmary length of stay (severe cases).}
\label{fig:params:dist:infirmary:los}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{graphics-dists/age-teachers.pdf}
\caption{Age of teachers.}
\label{fig:params:dist:age:teachers}
\end{subfigure}
\caption{Frequency distributions of the parameters of Table~\ref{tb:prob:other:params}.}
\label{fig:params:dist}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[]{graphics-other/demographics.pdf}
\caption{Demographic data of the population of the S\~{a}o Paulo metropolitan area.}
\label{fig:demographics}
\end{figure}
\begin{figure}[H]
\captionsetup[sub]{justification=centering}
\centering
\begin{subfigure}{\linewidth}
\includegraphics[]{graphics-other/cmp-real-sim.pdf}
\caption{Estimated number of reported infected people.}
\label{fig:cmpmatch:g}
\end{subfigure}
\begin{subfigure}{\linewidth}
\includegraphics[]{graphics-other/cmp-real-sim-accumulated.pdf}
\caption{Accumulated number of reported infected people.}
\label{fig:cmpmatch:ac}
\end{subfigure}
\begin{subfigure}{\linewidth}
\includegraphics[]{graphics-other/cmp-critical-icu.pdf}
\caption{Critical cases -- number of required ICUs.}
\label{fig:cmpmatch:critical}
\end{subfigure}
\caption{Comparison of simulator behavior to the real-world behavior.}
\label{fig:cmpmatch}
\end{figure}
\begin{figure}[H]
\captionsetup[sub]{justification=centering}
\centering
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{graphics-fig-1/graphics-fig-1-family-ac_reported.pdf}
\caption{Student's families -- accumulated reported cases.}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{graphics-fig-1/graphics-fig-1-professors-ac_reported.pdf}
\caption{Teachers -- accumulated reported cases.}
\end{subfigure}
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{graphics-fig-1/graphics-fig-1-family-ac_infected_state_ST_CRITICAL.pdf}
\caption{Student's families -- critical cases (ICU).}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{graphics-fig-1/graphics-fig-1-professors-ac_infected_state_ST_CRITICAL.pdf}
\caption{Teachers -- critical cases (ICU).}
\end{subfigure}
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{graphics-fig-1/graphics-fig-1-family-ac_state_ST_DEAD.pdf}
\caption{Student's families -- accumulated deaths.}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{graphics-fig-1/graphics-fig-1-professors-ac_state_ST_DEAD.pdf}
\caption{Teachers -- accumulated deaths.}
\end{subfigure}
\caption{Curves of infected people when schools reopen with all students at once.}
\label{fig:strategy:all:students}
\end{figure}
\begin{figure}[H]
\captionsetup[sub]{justification=centering}
\centering
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{./graphics-fig-2/graphics-fig-2-family-ac_reported.pdf}
\caption{Student's families -- accumulated reported cases.}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{./graphics-fig-2/graphics-fig-2-professors-ac_reported.pdf}
\caption{Teachers -- accumulated reported cases.}
\end{subfigure}
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{./graphics-fig-2/graphics-fig-2-family-ac_infected_state_ST_CRITICAL.pdf}
\caption{Student's families -- critical cases (ICU).}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{./graphics-fig-2/graphics-fig-2-professors-ac_infected_state_ST_CRITICAL.pdf}
\caption{Teachers -- critical cases (ICU).}
\end{subfigure}
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{./graphics-fig-2/graphics-fig-2-family-ac_state_ST_DEAD.pdf}
\caption{Student's families -- accumulated deaths.}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{./graphics-fig-2/graphics-fig-2-professors-ac_state_ST_DEAD.pdf}
\caption{Teachers -- accumulated deaths.}
\end{subfigure}
\caption{Curves of infected people when schools reopen following São Paulo's strategy.}
\label{fig:strategy:sp:plan}
\end{figure}
\begin{figure}[H]
\captionsetup[sub]{justification=centering}
\centering
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{./graphics-fig-3/family-ac_reported.pdf}
\caption{Student's families -- accumulated reported cases.}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{./graphics-fig-3/professors-ac_reported.pdf}
\caption{Teachers -- accumulated reported cases.}
\end{subfigure}
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{./graphics-fig-3/family-peak_icu.pdf}
\caption{Student's families -- peak of critical cases (ICU) after schools reopening.}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{./graphics-fig-3/professors-peak_icu.pdf}
\caption{Teachers -- peak of critical cases (ICU) after schools reopening.}
\end{subfigure}
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{./graphics-fig-3/family-ac_state_ST_DEAD.pdf}
\caption{Student's families -- accumulated deaths.}
\end{subfigure}
\hspace{0.05\linewidth}
\begin{subfigure}{0.46\linewidth}
\includegraphics[]{./graphics-fig-3/professors-ac_state_ST_DEAD.pdf}
\caption{Teachers -- accumulated deaths.}
\end{subfigure}
\caption{Curves of infected people when schools reopen following São Paulo's strategy, evaluating different isolation levels.}
\label{fig:strategy:sp:explore}
\end{figure}
\clearpage
\subsection*{Tables 1 to 4}
\begin{table}[H]
\centering
\small
\begin{tabular}{@{}lllrrrr@{}}
\toprule
Relation & Description & Type & Mean & StdDev & Min & Max \\
\midrule
Home & Number of people per home & Gamma & 3.3 & 1.7 & 1 & 10 \\
Community & Number of community relations per person & Gamma & 15.0 & 10.0 & 5 & 50 \\
Workplace & Number of people per company & Gamma & 8.0 & 7.0 & 2 & 50 \\
School -- classroom & Number of people per classroom & Gamma & 30.0 & 10.0 & 15 & 50 \\
School -- total & Number of people per school & Gamma & 500.0 & 500.0 & 300 & 4,000 \\
\bottomrule
\end{tabular}
\caption{Frequency distributions used to generate the relation network.}
\label{tb:dist:network}
\end{table}
\clearpage
\begin{table}[H]
\centering
\small
\begin{tabular}{@{}ll@{}}
\toprule
Parameter & Value \\
\midrule
$R_0$ (basic reproduction rate) & 3.0 (at the start of the pandemic). \\
Pre-symptomatic time & 1 day. \\
Time for which people with unreported &\\
and mild symptoms are contagious & 4 days. \\
Incubation time & Gamma, mean: 4.6 days, Stddev: 3.2, Min: 1, Max: 14. \\
Time from symptomatic to hospitalization & 5 days. \\
Days in ICU for critical patients & Gamma, mean: 15.0 days, Stddev: 15.0, Min: 1, Max: 60.\\
Days in hospital for severe patients (infirmary) & Gamma, mean: 6.5 days, Stddev: 5.5, Min: 1, Max: 60.\\
Age of the teachers & Gamma, mean: 41.2 years, Stddev: 9.9, Min: 20, Max: 70. \\
\midrule
Vaccine -- time to be effective & 14 days. \\
Vaccine -- number of people vaccinated per day & 300,000 people per day. \\
Vaccine -- immunity rate & 90\%. \\
\midrule
Infection rate -- home & $\times3.0$ the community rate considering the beginning \\
& of the pandemic (not changed by any intervention). \\
Infection rate -- workplace & $\times1.5$ the community rate. \\
Infection rate -- school & We evaluated both $\times2$ and $\times4$ the community rate. \\
Infection rate -- inter-city & Equal to the community rate. \\
Infection rate -- community & We calculate it such that the average reproduction rate \\
& among all people matches the target reproduction rate. \\
\bottomrule
\end{tabular}
\caption{Other simulation parameters.}
\label{tb:prob:other:params}
\end{table}
\clearpage
\begin{table}[H]
\centering
\begin{tabularx}{0.8\linewidth}{@{}YYYYY@{}}
\toprule
Age & Unreported & Mild & Severe & Critical \\
\midrule
0-10 & 0.8916 & 0.1051 & 0.0024 & 0.0008 \\
10-20 & 0.9613 & 0.0384 & 0.0003 & 0.0001 \\
20-30 & 0.9447 & 0.0545 & 0.0006 & 0.0002 \\
30-40 & 0.8987 & 0.0985 & 0.0022 & 0.0006 \\
40-50 & 0.8340 & 0.1577 & 0.0064 & 0.0019 \\
50-60 & 0.7211 & 0.2513 & 0.0202 & 0.0074 \\
60-70 & 0.5560 & 0.3379 & 0.0737 & 0.0323 \\
70-80 & 0.5079 & 0.1459 & 0.2274 & 0.1188 \\
80-90 & 0.4939 & 0.2276 & 0.1854 & 0.0930 \\
90+ & 0.4931 & 0.2283 & 0.1901 & 0.0886 \\
\midrule
Mean & 0.8500 & 0.1235 & 0.0182 & 0.0084 \\
\bottomrule
\end{tabularx}
\caption{Probability of an infected person to develop specific symptoms depending on the age.}
\label{tb:prob:symptoms}
\end{table}
\clearpage
\begin{table}[H]
\centering
\begin{tabularx}{0.75\textwidth}{@{}YYY@{}}
\toprule
Age & Death (severe cases) & Death (critical cases) \\
\midrule
0-10 & 0.0109 & 0.0649 \\
10-20 & 0.0304 & 0.1405 \\
20-30 & 0.0217 & 0.1545 \\
30-40 & 0.0347 & 0.1601 \\
40-50 & 0.0574 & 0.2214 \\
50-60 & 0.1035 & 0.3086 \\
60-70 & 0.1804 & 0.4349 \\
70-80 & 0.2643 & 0.5128 \\
80-90 & 0.3944 & 0.5549 \\
90+ & 0.5230 & 0.5576 \\
\midrule
Mean & 0.1518 & 0.3742 \\
\bottomrule
\end{tabularx}
\caption{Probability of a person to die depending on their symptoms and age.}
\label{tb:prob:death}
\end{table}
\end{document}
| {'timestamp': '2020-10-19T02:18:38', 'yymm': '2010', 'arxiv_id': '2010.08426', 'language': 'en', 'url': 'https://arxiv.org/abs/2010.08426'} | arxiv |
\section{Introduction}
\label{sec:intro}
Several studies have inferred the presence of considerable amount of correlation in network traffic data~\cite{SIVAREP,anand_sigcomm_08, anand_sigcomm_09, anand_sigmetrics_09,Spring2000}.
Specifically, we may broadly define correlation in two dimensions:
\begin{enumerate}
\item Temporal correlation within content from an information source being delivered to a client.
\item Spatial correlation across content from different information sources delivered to the same/different clients.
\end{enumerate}
Network traffic abounds with the first dimension of temporal correlation, which is well understood.
For example, if traffic contains mostly English text, there is significant correlation within the content.
The existence of the second dimension of correlation is also confirmed in several real data experiments~\cite{SIVAREP,anand_sigcomm_08, anand_sigcomm_09, anand_sigmetrics_09, Spring2000}.
This has motivated the employment of correlation elimination techniques for network traffic data.\footnote{Within the networking community, these are known as correlation elimination (RE) techniques but since redundancy has a specific meaning within the universal compression community, as shall be formally defined in the sequel, we chose to refer to these techniques as correlation elimination for the clarity of discussion.}
The present correlation elimination techniques are mostly based on content caching mechanisms used by solutions such as web-caching~\cite{web-cache}, CDNs~\cite{CDN}, and P2P networks~\cite{P2P-app}. However, caching approaches that take place at the application layer, do not effectively leverage the spatial correlation, which exists mostly at the packet level~\cite{SIVAREP,anand_sigcomm_08, anand_sigcomm_09, anand_sigmetrics_09}. To address these issues, a few studies have considered ad-hoc methods such as packet-level correlation elimination (deduplication) in which redundant transmissions of segments of a packet that are seen in previously sent packets are avoided~\cite{anand_sigcomm_09, anand_sigmetrics_09}. However, these techniques are limited in scope and can only eliminate exact duplicates from the segments of the packets leaving statistical correlations intact.
It is natural to consider universal compression algorithms for correlation elimination from network traffic data.
While universal compression algorithms, e.g., Lempel-Ziv algorithms~\cite{LZ77,LZ78} and context tree weighting (CTW)~\cite{CTW95}, have been very successful in many domains, they do not perform very well on limited amount of data as learning the unknown source statistics imposes an inevitable redundancy (compression overhead). This redundancy depends on the richness of the class of the sources with respect to which the code is universal~\cite{Davisson_noiseless_coding,Rissanen_1984, Merhav_Feder_IT, Barron_MDL, ISIT11}.
Further, traditional universal compression would only attempt to deal with temporal correlation from a stationary source and lacks the structure to leverage the spatial correlation dimension.
In this paper, as an abstraction of correlation elimination from network traffic, we study universal compression with side information from a correlated source. The organization of the paper and our contributions are summarized below.
\begin{itemize}
\item In Section~\ref{sec:motivation}, we demonstrate that universal compression of finite-length sequences (up to hundreds of kilobytes) fundamentally suffers from a significant compression overhead. This motivates using side information for removing this redundancy.
\item In Section~\ref{sec:setup}, we present the formal problem setup. We define a notion of correlation between two parametric information sources, and study strictly lossless and almost lossless compression when side information from a correlated source is available to the encoder and/or the decoder.
\item In Section~\ref{sec:correlation}, we establish several nice properties of correlated information sources. We show that the degree of correlation is tuned with a single hyperparameter, which results in independent information sources in one end and duplicate sources in the other end.
\item In Section~\ref{sec:redundancy}, we characterize the average maximin redundancy with side information from a correlated source. We also show that if permissible error is sufficiently small the redundancy of almost lossless compression dominates the reduction in codeword length due to the permissible error.
\item In Section~\ref{sec:gain}, we define and characterize a notion of side information gain and establish a sufficient condition on the length of a side information string that would guarantee almost all of the benefits. We show that the side information gain can be considerable in many scenarios and derive a cutoff threshold on the size of memory needed to obtain all of the side information gain.
\item In Section~\ref{sec:one-to-one}, we show that the side information gain is largely preserved even if the prefix constraint on the code is dropped.
\item In Section~\ref{sec:network}, we provide a case study that shows how these benefits would be extended in a network setting.
\item Finally, the conclusions are summarized in Section~\ref{sec:conclusion}.
\end{itemize}
\begin{figure}
\centering
\includegraphics[height=1.2in]{figures/example_cloud}
\caption{The basic abstraction of universal compression with side information.}
\label{fig:single_basic}
\end{figure}
\section{Motivation}
\label{sec:motivation}
We describe universal compression with side information from a correlated source in the most basic scenario. We use the notation $x^n = (x_1,...,x_n)$ to denote a string of length $n$ on the finite alphabet $\mathcal{X}$. For example, for an 8-bit alphabet that has 256 characters, each $x_i$ is a byte and $x^n$ denotes a packet at the network layer. We assume that, as shown in Fig.~\ref{fig:single_basic}, the network consists of content server nodes $S_1$ and $S_2$, an intermediate memory-enabled (relay or router) node $M$, and client nodes $C_1$ and $C_2$.
Let's assume that the content at $S_1$ is stationary and correlated with the content at $S_2$. Assume that $y^m$ has already been routed through $S_2 \to M\to C_2$ path. Also, assume that all nodes in the route, i.e., $S_2$, $M$ and $C_2$, have memorized the content $y^m$.
Now, assume that $x^n$ is to be routed through $S_1 \to M \to C_1$ path. In this case, at the $S_1 \to M$ link the side information string is only available to the decoder, while at the $M \to C_1$ link, the side information is only available to the encoder. If $x^n$ was to be routed through $S_1 \to M \to C_2$ path, in this case, the side information would be available to both the encoder and the decoder at $M \to C_2$ link.
As such, we wish to study universal compression with side information that is available to the encoder and/or the decoder in this paper.
Given the side information gain, in~\cite{TON14}, we analyzed the network-wide benefits of introducing memory-enabled nodes to the network and provided results on memory placement and routing for extending the gain to the entire network. However,~\cite{TON14} did not explain how to characterize the side information gain.
Let redundancy be the overhead in the number of bits used for describing a random string drawn from an unknown information source compared to the optimal codeword length given by the Shannon code.
In the universal compression of a family of information sources that could be parametrized with $d$ unknown parameters, Rissanen showed that the expected redundancy asymptotically scales as $\frac{d}{2}\log n + o(\log n)$ for almost all sources in the family~\cite{Rissanen_1984}.\footnote{$f(n) = o(g(n))$ if and only if $\lim_{n\to \infty}\frac{f(n)}{g(n)} = 0.$} Clarke and Barron~\cite{Clarke_Barron} derived the asymptotic average minimax redundancy for memoryless sources to be $\frac{d}{2} \log n + O_n(1)$.\footnote{$f(n) =O(g(n))$ if and only if $\lim_{n\to \infty} \sup \frac{f(n)}{g(n)} < \infty$.} This was later generalized by Atteson to Markov information sources~\cite{atteson_markov}. The average minimax redundancy is concerned with the redundancy of the worst parameter vector for the best code, and hence, does not provide much information about the rest of the source parameter values. However, in light of Rissanen's result one would expect that asymptotically almost all information sources in the family behave similarly. The question remains as how these would behave in the finite-length regime.
In~\cite[Theorem 1]{ISIT11}, using a probabilistic treatment, we derived sharp lower bounds on the probability of the event that the redundancy in the compression of a random string of length $n$ from a parametric source would be larger than a certain fraction of $\frac{d}{2}\log n$.
\cite[Theorem 1]{ISIT11} provides, for any $n$, a lower bound on the probability measure of the information sources for which the average redundancy of the best universal compression scheme would be larger than ${\frac{d}{2}\log n}$. To demonstrate the implications of this result in the finite-length regime of interest in this paper, we consider an example using a first-order Markov information source with alphabet size $k=256$. This information source is represented using $d = 256 \times 255 = 62580$ parameters. We further assume that the source entropy rate is $0.5$ bit per byte ($H^n(\theta)/n = 0.5$). This assumption is inspired by experiments on real network data traffic in~\cite[Section IV.A]{TON14}.
It is implied by \cite[Theorem 1]{ISIT11} that the compression overhead is more than $75\%$ for strings of length $256$kB. We conclude that redundancy is significant in the compression of finite-length low-entropy sequences, such as the Internet traffic packets that are much shorter than $256$kB. It is this redundancy that we hope to suppress using side information from a correlated source. The compression overhead becomes negligible for very long sequences (e.g., it is less than $2\%$ for strings of length $64$MB and above), and hence, the side information gain vanishes as $O\left(\log n/n\right)$ when the sequence length grows large.
It is also worth noting the scope of benefits expected from universal compression of network traffic with side information is significant since file sharing and web data comprise more than $50\%$ of network traffic~\cite{cisco-vni} for which, the correlation levels may be as high as $90\%$~\cite{SIVAREP}. Further, universal compression with side information is applicable to storage reduction in cloud and distributed storage systems, traffic reduction for Internet Service Providers, and power and bandwidth reduction in wireless communications networks (e.g., wireless sensors networks, cellular mobile networks, hot spots). See~\cite{TON14, TWC15} for a more thorough investigation of such applications and also for practical coding schemes for network packet compression.
\section{Problem Setup}
\label{sec:setup}
Let $\mathcal{X}$ be a finite alphabet. We assume that the server $S$ comprises of two parametric sources $\theta^{(1)}$ and $\theta^{(2)}$, which are defined using parameter vectors $\theta^{(1)} = (\theta^{(1)}_1,...,\theta^{(1)}_d)$ and $\theta^{(2)} = (\theta^{(2)}_1,...,\theta^{(2)}_d)$, where $\theta^{(1)}, \theta^{(2)} \in \Theta_d$ and $\Theta_d$ is a $d$-dimensional set. Denote $\mu^n_{\theta^{(1)}}$ and $\mu^n_{\theta^{(2)}}$ as the probability measures defined by the parameter vector $\theta$ on strings of length $n$.
If the information sources are memoryless, $\theta^{(1)}$ would denote the categorical distribution of the characters, and $\mu^n_{\theta^{(1)}}$ would be a product distribution.
We assume that $\theta^{(1)}$ is a priori unknown.
Unless otherwise stated, we use the notation $X^n \in \mathcal{X}^n$ and $Y^m \in \mathcal{X}^m$ to denote random string of length $n$ and $m$ drawn from $\mu^n_{\theta^{(1)}}$ and $\mu^m_{\theta^{(2)}}$, respectively.
See Assumption~\ref{assump:reg} (appendix) for a set of regularity conditions that we assume on the parametric family.
\begin{figure}
\begin{center}
\includegraphics[width = 0.35\textwidth]{figures/correlation_model}
\vspace{-.3in}
\end{center}
\caption{The correlation model between the two information sources.}
\label{fig:correlation_model}
\end{figure}
We put forth a notion of correlation between the parameter vectors $\theta^{(1)}$ and $\theta^{(2)}$, where the correlation could be tuned using a hyperparameter $t$.
We assume that the unknown (and unobserved) parameter vector $\theta^{(1)}$ follows a prior distribution $q$ supported on $\Theta_d$. Let $Z^{t}$ be a random string of length $t$ that is drawn from $\mu^t_{\theta^{(1)}}$.
We assume that given $Z^{t}$, the parameter vectors $\theta^{(1)}$ and $\theta^{(2)}$ are independent and identically distributed. This is shown in the Markov chain represented in Fig.~\ref{fig:correlation_model}. We will state several nice properties of this proposed model in Section~\ref{sec:correlation}.
Note that this framework is fundamentally different from Slepian-Wolf coding that also targets the spatial correlation between distributed information sources~\cite{slepian_wolf,Yang-SW,Mina_TCOM,PRADHAN-DSC}. In Slepian-Wolf coding, the sequences from the distributed sources are assumed to have character-by-character correlation, which is also different from our correlation model that is due to the parameter vectors being unknown in a universal compression setup.
Let $H^n(\theta)$ denote the Shannon entropy of the source given $\theta$, i.e.,
\begin{align}
H^n(\theta) &\triangleq E \left\{ \log \left(\frac{1}{\mu_\theta(X^n)} \right) \right\}\nonumber \\
&=\sum_{x^n \in \mathcal{X}^n}\mu_{\theta}(x^n) \log \left(\frac{1}{\mu_\theta(x^n)}\right).
\end{align}
Throughout this paper expectations are taken over functions of the random sequence $X^n$ with respect to the (unknown) probability measure $\mu_\theta$, and $\log(\cdot)$ denotes the logarithm in base $2$, unless otherwise stated.
We further use the notation $H(\theta)$ to denote the entropy rate, defined as $
H(\theta) \triangleq \lim_{n \to \infty }\frac{1}{n} H^n(\theta).
$
Let $\mathcal{I}(\theta)$ be the Fisher information matrix, where each element is given by
\begin{equation}
\mathcal{I}(\theta)_{ij}\triangleq \lim_{n \to \infty} \frac{1}{n \log e}E\left\{\frac{\partial^2}{\partial \theta_i \partial \theta_j} \log\left( \frac{1}{\mu^n_\theta(X^n)}\right)\right\}.
\label{eq:fisher}
\end{equation}
Fisher information matrix quantifies the amount of information, on the average, that a random string $X^n$ from the source conveys about the source parameters.
Let Jeffreys' prior on $\Theta_d$ be defined as
\begin{equation}
w_J(\theta) \triangleq \frac{|\mathcal{I}(\theta)|^{\frac{1}{2}}}{\int_{\phi \in \Theta_d} | \mathcal{I}(\phi)|^\frac{1}{2}d \phi}.
\label{eq:Jeffreys}
\end{equation}
Roughly speaking, Jeffreys' prior is optimal in the sense that the average minimax redundancy is asymptotically achieved when the parameter vector $\theta$ is assumed to follow Jeffreys' prior (see~\cite{Clarke_Barron} for a formalized statement and proof). This prior distribution is particularly interesting because it corresponds to the worst-case compression performance for the best compression scheme.
We consider the family of block codes that map any $n$-string to a variable-length binary sequence, which also satisfy Kraft's inequality~\cite{huffman_redundancy}.
Let
\begin{align}
\mathcal{C} &\triangleq \mathcal{X}^n \times \{\varepsilon\}^m,\nonumber\\
\mathcal{C}^E &\triangleq \mathcal{X}^n \times \mathcal{X}^m,\nonumber\\
\mathcal{D} & \triangleq \{0, 1\}^* \times \{\varepsilon \}^m,\nonumber\\
\mathcal{D}^D &\triangleq \{0, 1\}^* \times \mathcal{X} ^m,
\label{eq:mcDE}
\end{align}
where $\varepsilon$ denotes an erasure.
We use $c: \mathcal{C} \to \{0, 1\}^*$ and $c^E: \mathcal{C}^E \to \{0, 1\}^*$ to denote the encoder without and with side information, respectively. Similarly, we also use $d: \mathcal{D} \to \mathcal{X}^n$ and $d^D: \mathcal{D}^D \to \mathcal{X}^n$ to denote the decoder without and with side information, respectively.
We use notations
\begin{align}
C &\triangleq (\mathcal{X}^n , \varepsilon^m) \in \mathcal{C},\nonumber\\
C^E &\triangleq (\mathcal{X}^n , y^m) \in \mathcal{C}^E,\nonumber\\
D &\triangleq (c(C) , \varepsilon^m) \in \mathcal{D} ,\nonumber\\
D^E &\triangleq (c^E(C^E) , \varepsilon^m) \in \mathcal{D},\nonumber\\
D^{D} &\triangleq (c(C) , y^m) \in \mathcal{D}^D,\nonumber\\
D^{ED} &\triangleq (c^{E}(C^E) , y^m) \in \mathcal{D}^D.
\label{eq:DE}
\end{align}
Next, we present the notions of strictly lossless and almost lossless source codes, which will be needed in the sequel. While the definitions are only given for the case with no side information at the encoder and the decoder, it is straightforward to extend them using the above definitions.
Our main focus in on prefix free codes that ensure unique decodability of concatenated code blocks (see~\cite[Chapter 5.1]{cover-book}).
\begin{definition}
The code $c: \mathcal{C}\to \{0,1\}^*$ is called strictly lossless (also called zero-error) if there exists a reverse mapping $d: \mathcal{D} \to \mathcal{X}^n$ such that
$$\forall C \in\mathcal{C}:\quad d(D) = x^n.$$
\end{definition}
\begin{definition}
Let $\mu^{n,m}$ denote a joint probability distribution on $(x^n, y^m)$.
The code $c_{\epsilon}: \mathcal{C} \to \{0,1\}^*$ is called almost lossless with permissible error probability $\epsilon(n)$, if there exists a reverse mapping $d_{\epsilon}:\mathcal{D} \to \mathcal{X}^n$ such that
$$E\{ \mathbf{1}_e(X^n, Y^m) \}\leq \epsilon(n),$$
where $\mathbf{1}_e(x^n)$ denotes the error indicator function, i.e,
\begin{equation}
\mathbf{1}_e(x^n, y^m) \triangleq
\left\{
\begin{array}{ll}
1 & \quad \quad d_{\epsilon}(D) \neq x^n,\\
0 & \quad \quad \text{otherwise},
\end{array}
\right.\nonumber
\end{equation}
where $D$ and $E$ are defined in~\eqref{eq:DE}.
\end{definition}
Most of the practical data compression schemes are examples of strictly lossless codes, namely, the arithmetic code~\cite{Arithmetic_coding_introduction}, Huffman code~\cite{Huffman_coding}, Lempel-Ziv codes~\cite{LZ77,LZ78}, and CTW code~\cite{CTW95}.
In almost lossless source coding, which is a weaker notion of the lossless case, we allow a non-zero error probability $\epsilon(n)$ for any finite $n$ while if $\epsilon(n) = o_n(1)$ the code is \emph{almost surely} asymptotically error free. The proofs of Shannon~\cite{Shannon_paper} for the existence of entropy achieving source codes are based on almost lossless random codes. The proof of the Slepian-Wolf theorem~\cite{slepian_wolf} also uses almost lossless codes. Further, all of the practical implementations of SW source coding are based on almost lossless codes (see~\cite{PRADHAN-DSC,Mina_TCOM}).
We consider four coding strategies according to the orientation of the switches $s_e$ and $s_d$ in Fig.~\ref{fig:two_model}
for the compression of $x^n$ drawn from $\mu^n_{\theta^{(1)}}$ provided that the sequence $y^m$ drawn from $\mu^m_{\theta^{(2)}}$ is available to the encoder/decoder or not.\footnote{In this paper, we assume that $m$ and $n$ are a priori known to both the encoder and the decoder.}
\begin{itemize}
\item {{\text{Ucomp}}} (Universal compression without side information), where the switches $s_e$ and $s_d$ in Fig.~\ref{fig:two_model} are both {\em open}. This corresponds to $C \in \mathcal{C}$ and $D \in \mathcal{D}$.
\item {\text{UcompE}} (Universal compression with encoder side information), where the switch $s_e$ in Fig.~\ref{fig:two_model} is {\em closed} but the switch $s_d$ is {\em open}. This corresponds to $C^E \in \mathcal{C}^E$ and $D^E \in \mathcal{D}$.
\item {{\text{UcompD}}} (Universal compression with decoder side information), where the switch $s_e$ in Fig.~\ref{fig:two_model} is {\em open} but the switch $s_d$ is {\em closed}. This corresponds to $C \in \mathcal{C}$ and $D^D \in \mathcal{D}^D$.
\item { {\text{UcompED}}} (Universal compression with encoder-decoder side information), where the switches $s_e$ and $s_d$ in Fig.~\ref{fig:two_model} are both {\em closed}. This corresponds to $C^E \in \mathcal{C}^E$ and $D^{ED} \in \mathcal{D}^D$.
\end{itemize}
\begin{figure}
\begin{center}
\includegraphics[width = 0.47\textwidth]{figures/two_model}
\end{center}
\caption{The compression model for universal source coding with two correlated parameter vectors.}
\label{fig:two_model}
\end{figure}
\section{Implications of the Correlation Model}
\label{sec:correlation}
In this section, we study some implications of the proposed correlation model. This section may be skipped by the reader and only referred to when a particular lemma is needed in the subsequent proofs.
\begin{lemma}
The joint distribution of $(\theta^{(1)}, \theta^{(2)})$ for all $t \geq 0$ is given by
\begin{equation}
p^{t}(\theta^{(1)}, \theta^{(2)}) = w(\theta^{(1)}) w(\theta^{(2)}) f^t(\theta^{(1)}, \theta^{(2)}),
\end{equation}
where $f^t(\theta^{(1)}, \theta^{(2)})$ is defined as
\begin{equation}
f^t(\theta^{(1)}, \theta^{(2)}) \triangleq \sum_{z^{t} \in \mathcal{X}^{t}} \left( \frac{\mu^t_{\theta^{(1)}}(z^{t}) \mu^t_{\theta^{(2)}}(z^{t})}{ \int_{\phi \in \Theta_d} \mu^t_{\phi}(z^{t}) w(\phi) d\phi } \right).
\end{equation}
\label{lem:cond}
\end{lemma}
\begin{IEEEproof}
We have
\begin{align}
p^{t}(\theta^{(2)}|\theta^{(1)}) &= \sum_{z^{t} \in \mathcal{X}^{t}}p (\theta^{(2)},z^{t}|\theta^{(1)})\\
&= \sum_{z^{t} \in \mathcal{X}^{t}} p(\theta^{(2)}|z^{t}) \mu^t_{\theta^{(1)}}(z^{t})\label{eq:indep}\\
&= w(\theta^{(2)}) \sum_{z^{t} \in \mathcal{X}^{t}} \left( \frac{\mu^t_{\theta^{(1)}}(z^{t}) \mu^t_{\theta^{(2)}}(z^{t})}{ \int_{\phi \in {\Theta_d}} \mu^t_{\phi}(z^{t}) w(\phi) d \phi } \right),\label{eq:bayes}
\end{align}
where~\eqref{eq:indep} follows from the fact that $\theta^{(2)}$ and $\theta^{(1)}$ are independent and identically distributed given $Z^{t}$, and~\eqref{eq:bayes} follows from the Bayes rule. Hence, the result follows.
\end{IEEEproof}
Next, we find the marginal distribution of $\theta^{(2)}$, i.e., $p^{t}_{\theta^{(2)}}(\theta^{(2)})$.
\begin{lemma}
For all $t \geq 0$, we have
\begin{equation}
p^{t}(\theta^{(2)}) = w(\theta^{(2)}).
\end{equation}
\label{lem:marginal}
\end{lemma}
\begin{IEEEproof}
The proof follows from the following equations
\begin{align}
p^{t}_{\theta^{(2)}}(\theta^{(2)}) &= \int_{{\Theta_d}}p^{t}_{\theta^{(2)}|\theta^{(1)}}(\theta^{(2)}|\theta^{(1)}) w(\theta^{(1)}) d\theta^{(1)}\nonumber\\
&= w(\theta^{(2)}) \int_{\Theta_d} f^t( \theta^{(1)}, \theta^{(2)}) w(\theta^{(1)}) d\theta^{(1)}\label{eq:dd} \\
& = w(\theta^{(2)}),
\end{align}
where~\eqref{eq:dd} follows from Lemma~\ref{lem:integral} (appendix).
\end{IEEEproof}
\begin{lemma}
$\theta^{(2)}$ is independent of $\theta^{(1)}$ if and only if $t=0$, i.e.,
\begin{equation}
p^{0} (\theta^{(1)}, \theta^{(2)}) = w(\theta^{(1)}) w(\theta^{(2)}).
\end{equation}
\label{lem:independent}
\end{lemma}
\begin{IEEEproof}
By definition of $f^t(\cdot, \cdot)$, and the fact that $\mu^0_{\theta^{(1)}}(z^0) = 1$, we have
\begin{equation}
f^0( \theta^{(1)}, \theta^{(2)})= \left( \frac{1}{ \int_{\phi \in {\Theta_d}} w(\phi) d\phi} \right) = 1.
\label{eq:f-prop2}
\end{equation}
Hence, the claim follows by invoking Lemma~\ref{lem:cond}.
\end{IEEEproof}
\begin{lemma}
$\theta^{(2)}$ converges in mean square to $\theta^{(1)}$ as $t \to \infty$, that is
\begin{equation}
\lim_{t \to \infty} E \left\{ \lVert\theta^{(2)} - \theta^{(1)} \rVert^2 \right\}= 0.
\end{equation}
\label{lem:conv-mean-sq}
\end{lemma}
\begin{IEEEproof}
Let $\widehat{\theta^{(1)}}(Z^{t})$ be the maximum likelihood estimator (MLE) of $\theta^{(1)}$ from the observation $Z^{t}$. By definition, $\widehat{\theta^{(1)}}(Z^{t})$ also serves as the MLE for $\theta^{(2)}$.
Then,
\begin{align}
E \{\lVert \theta^{(2)} - \theta^{(1)} \rVert^2\} & \leq E \{\lVert\theta^{(2)} -\widehat{\theta^{(1)}}(Z^{t}) \rVert^2 \} \nonumber\\
&+ E\{ \lVert\theta^{(1)}- \widehat{\theta^{(1)}}(Z^{t}) \rVert^2 \}\\
& = 2 E\{ \lVert\theta^{(1)}- \widehat{\theta^{(1)}}(Z^{t}) \rVert^2\},
\end{align}
and the statement follows from the convergence of MLE in mean square for the parametric information source as assumed in the regularity conditions put forth in Assumption~\ref{assump:reg} (appendix).
\end{IEEEproof}
{\em Remark:} The degree of correlation between the two parameter vectors $\theta^{(1)}$ and $\theta^{(2)}$ is determined by the hyperparameter $t$.
This degree of correlation varies from independence of the two parameter vectors at $t=0$ all the way to the vectors being equal (convergence in mean square) when $t \to \infty$. Further note that the covariance matrix of the parameter vectors $\theta^{(1)}$ and $\theta^{(2)}$ asymptotically as $t$ grows large behaves like $ \frac{2}{{t}} \mathcal{I}^{-1} (\theta^{(1)})$.
\section{Average Maximin Redundancy}
\label{sec:redundancy}
In this section, we investigate the average maximin redundancy in universal compression of correlated sources for different coding strategies put forth in Section~\ref{sec:setup}.
\subsection{{\text{Ucomp}} Coding Strategy}
Let $l^n :\mathcal{X}^n \to \mathbb{R}^+ $ denote the universal (strictly lossless) length function for {\text{Ucomp}}.\footnote{We ignore the integer constraint on the length functions in this paper, which will result in a negligible redundancy smaller than $1$ bit and is exactly analyzed in~\cite{Precise_Minimax_Redundancy, huffman_redundancy}.}
This is the length associated with a strictly lossless code. A necessary and sufficient condition for existence of a code that satisfies unique decodability is given by Kraft inequality:
\begin{equation}
\sum_{x^n \in \mathcal{X}^n} 2^{-l^n(x^n)} \leq 1.
\label{eq:Kraft}
\end{equation}
Denote $L^n$ as the set of all strictly lossless universal length functions that satisfy Kraft inequality.
Denote $R^n(l^n,\theta)$ as the average redundancy of the code with length function $l^n(\cdot)$, defined as
\begin{equation}
R^n(l^n,\theta) \triangleq E_{X^n \sim \mu^{n}} \{ l^n(X^n) \}- H^n(\theta).
\label{eq:redundancy-def}
\end{equation}
Define $\underline{R}$ as the minimax redundancy of {\text{Ucomp}}, i.e.,
\begin{equation}
\underline{R}^n = \max_{w \in \Omega_d} \min_{l^n \in L^n} \int_{\theta \in \Theta_d} R^n(l^n,\theta) w(\theta)d\theta.
\label{eq:avg_min_redundancy}
\end{equation}
It is well known that the maximum above is attained by Jeffreys' prior in the asymptotic limit as $n$ grows large. Hence, in the rest of this paper we assume that $\theta^{(1)}, \theta^{(2)} \sim w_J$ follow Jeffreys' prior given in~\eqref{eq:Jeffreys}. On the other hand, the length function that achieves the inner minimization is simply the information random variable.
\begin{equation}
\imath^n(x^n) \triangleq - \log\left(\int_{\theta \in \Theta_d} \mu_\theta^n(x^n) w_J(\theta)d\theta\right).
\end{equation}
Putting it all together, we have
\begin{align}
\underline{R}^n = I(X^n; \theta),
\end{align}
where $I(\cdot; \cdot)$ denotes the mutual information. This is Gallager's redundancy-capacity theorem in~\cite{Gallager-source-coding}.
Clarke and Barron~\cite{Clarke_Barron} showed that the average maximin redundancy for strictly lossless {\text{Ucomp}} is
\begin{equation}
\underline{R}^n = \frac{d}{2} \log\left( \frac{n}{2\pi e} \right) + \log \int_{\phi \in \Theta_d}
|\mathcal{I}(\phi)|^{\frac{1}{2}}d\phi + o_n(1).\nonumber
\label{eq:maximin}
\end{equation}
This result states that the average maximin redundancy in {\text{Ucomp}} coding strategy is $O(\log n)$ and also is linearly proportional to the number of unknown source parameters, $d$.
It is straightforward to define $\underline{R}_\epsilon^n$ as the average redundancy when $\theta^{(1)}$ follows Jeffreys' prior when we are restricted to almost lossless codes with permissible error $\epsilon$. Note that it is clear that $\underline{R}_\epsilon^n \leq \underline{R}^n $. A natural question that arises is how much reduction is achievable by allowing a permissible error probability in decoding.
Our main result on {\text{Ucomp}} coding strategy with almost lossless codes is given in the following theorem.
\begin{theorem}
If $\epsilon(n) = O(\frac{1}{n})$, then
\begin{equation}
\underline{R}_\epsilon^n = \underline{R}^n - O_n(1).
\end{equation}
\label{thm:almost-lossless}
\end{theorem}
\begin{IEEEproof}
The proof is completed by invoking Lemma~\ref{thm:NM_almost} in the appendix and noting that $\underline{R}^n = O(\log n)$.
\end{IEEEproof}
The content of Theorem~\ref{thm:almost-lossless} is that if the permissible error, $\epsilon(n)$, in almost lossless compression vanishes fast enough as $n$ grows, then asymptotically the maximin risk imposed by universality of compression dominates any savings obtained by allowing an $\epsilon(n)$ average error in decoding. Hence, in the rest of this paper we only focus on the family of strictly lossless codes.
\subsection{{\text{UcompE}} Coding Strategy}
Since the side information sequence $y^m$ is not available to the decoder, then the minimum number of average bits required at the decoder to describe the random sequence $X^n$ is indeed $H(X^n)$. On the other hand, it is straightforward to see that
\begin{equation}
H(X^n) = H^n(\theta^{(1)}) + I(X^n;\theta^{(1)}),
\end{equation}
where
$
I(X^n;\theta^{(1)}) = \underline{R}^n
$
by the redundancy-capacity theorem.
Hence, in {\text{UcompE}} strategy, we establish that the side information provided by $y^m$ only at the encoder does not provide any benefit on the strictly lossless universal compression of the sequence $x^n$.
\subsection{{\text{UcompD}} Coding Strategy}
Considering the {\text{UcompD}} strategy, by Assumption~\ref{assump:reg} (appendix), the two sources $\mu_{\theta^{(1)}}$ and $\mu_{\theta^{(2)}}$ are $d$-dimensional parametric ergodic sources. In other words, any pair $(x^n, y^m) \in \mathcal{X}^n \times \mathcal{X}^m$ occurs with non-zero probability and the support set of $(x^n,y^m)$ is equal to the entire $\mathcal{X}^n \times \mathcal{X}^m$. Therefore, the knowledge of the side information sequence $y^m$ at the decoder does not rule out any possibilities for $x^n$ at the decoder. Hence, we conclude that side information provides no reduction in average codeword length (see~\cite{Alon_source_coding} and the references therein for a discussion on zero-error coding). However, this is not the case in almost lossless source coding. See~\cite{TWC15} for an almost lossless code in this case.
\subsection{{\text{UcompED}} Coding Strategy}
In the case of {\text{UcompED}}, let $l^{n,m} : \mathcal{X}^n \times \mathcal{X}^m \to \mathbb{R}^+$ denote the universal prefix-free strictly lossless length function. Denote $L^{n,m}$ as the set of all possible such length functions. Denote $R^{n,m}(l^{n,m}, \theta^{(1)}, \theta^{(2)})$ as the expected redundancy of the code with length function $l^{n,m}(\cdot, \cdot)$:
\begin{align}
&R^{n,m}(l^{n,m},\theta^{(1)}, \theta^{(2)}) \nonumber\\
& \triangleq E_{X^n, Y^m \sim \mu^{n,m}_{\theta^{(1)}, \theta^{(2)}}} \{ l^{n,m}(X^n, Y^m) \}- H^n(\theta^{(1)}),
\end{align}
where $\mu^{n,m}_{\theta^{(1)}, \theta^{(2)}}$ is the product distribution
\begin{equation}
\mu^{n,m}_{\theta^{(1)}, \theta^{(2)}} (x^n, y^m) \triangleq \mu^n_{\theta^{(1)}}(x^n) \mu^m_{\theta^{(2)}}(y^m) .
\end{equation}
Here we assume that $\theta^{(1)}, \theta^{(2)}$ follow the correlation model that we put forth in this paper with their marginals being Jeffreys' prior. Hence, we define
\begin{equation}
\underline{R}^{n,m,t} \triangleq E_{(\theta^{(1)}, \theta^{(2)}) \sim p^t } \left\{ \min_{l^{n,m} \in L^{n,m}} R^{n,m}(l^{n,m},\theta^{(1)}, \theta^{(2)}) \right\}.
\end{equation}
In this case, following the same lines of arguments in~\cite{Gallager-source-coding}, we can conclude that
\begin{equation}
\underline{R}^{n,m,t} = I(X^n; \theta^{(1)} | Y^m).
\end{equation}
The following intuitive inequality demonstrates that the redundancy decreases when side information is available.
\begin{lemma} For all $n,m, t \geq 0$, we have
\begin{equation}
\underline{R}^{n,m,t} \leq \underline{R}^n.
\end{equation}
with equality if and only if $\min\{n, m, t\} = 0.$
\label{lem:sandwich}
\end{lemma}
\begin{IEEEproof}
First notice that $\underline{R}^{n,m,t} = I(X^n; \theta^{(1)} |Y^m)$ and $ \underline{R}^n = I(X^n; \theta^{(1)})$ and hence the inequality is achieved by applying Lemma~\ref{lem:Markov-MI} (appendix) and noticing the Markov chain $X^n \to \theta^{(1)} \to Y^m$.
Equality holds if and only if $I(X^n; Y^m) = 0$.
We just need to show that $I(X^n; Y^m) = 0$ if and only if $\min\{n, m, t\} = 0.$
If $n = 0$ or $m = 0$, then $I(X^n; Y^m) = 0$.
If $t = 0$, then $\theta^{(1)}$ and $\theta^{(2)}$ are {\em independent} by Lemma~\ref{lem:independent}. Hence, $X^n$ and $Y^m$ are also independent. Conversely, assume that $n,m > 0$, then by Lemma~\ref{lem:independent}, $I(X^n; Y^m) = 0$ only if $t =0$ completing the proof.
\end{IEEEproof}
According to Lemma~\ref{lem:sandwich}, side information cannot hurt, which is intuitively expected. However, there is no benefit provided by the side information when the two parameter vectors of the sources $S_1$ and $S_2$ are independent. This is not surprising as when $\theta^{(1)}$ and $\theta^{(2)}$ are independent, then $X^n$ (produced by $S_1$) and $Y^m$ (produced by $S_2$) are also independent.
Thus, the knowledge of $y^m$ does not affect the distribution of $x^n$. Hence, $y^m$ cannot be used toward the reduction of the codeword length for $x^n$.
Next, we present our main result on the average maximin redundancy for strictly lossless {\text{UcompED}} coding.
\begin{theorem}
For strictly lossless {\text{UcompED}} coding, if $\min\{m, t\} = O_n(1)$, then
$$\underline{R}^{n,m,t} = \underline{R}^n - O_n(1),$$
and if $\min\{m, t\} = \omega_n(1)$, then\footnote{$f(n) = \omega(g(n))$ if and only if $g(n) = o(f(n))$.}
\begin{equation}
\underline{R}^{n,m,t} = \widehat{R}(n,m,t) + o_n(1),\nonumber
\end{equation}
where $\widehat{R}(n,m,t)$ is defined as
\begin{equation}
\widehat{R}(n,m,t) \triangleq \frac{d}{2} \log\left( 1+\frac{n}{m^\star(m, t)}\right),
\label{eq:Rhat}
\end{equation}
and $m^\star(\cdot, \cdot)$ is given by the following:
\begin{equation}
\frac{1}{m ^ \star (m,t)} \triangleq \frac{1}{m} + \frac{2}{t}.
\label{eq:m-star}
\end{equation}
\label{thm:LLED_strict}
\end{theorem}
\begin{IEEEproof}
Recall that
\begin{align}
\underline{R}^{n,m,t} &= I (X^n; \theta^{(1)}| Y^m).
\end{align}
Further, note the following Markov chain
\begin{equation}
\widehat{\theta^{(1)}} (X^n) \to \theta^{(1)} \to Z^t \to \theta^{(2)} \to Y^m.
\end{equation}
Assuming that $\min\{m, t\} = \omega_n(1)$, i.e., both grow unbounded with $n$. Then, we can rely on the asymptotic normality of all of the variables above and noting that $\widehat{\theta^{(1)}} (X^n)$ is a sufficient statistic for $X^n$, then $\theta^{(1)}$ is Gaussian distributed with mean $\widehat{\theta}(Y^m)$ with variance $ \frac{1}{m^\star} = \frac{2}{t} + \frac{1}{m}$ given $Y^m$. Hence, invoking Lemma~\ref{lem:Gaussian-MI} (appendix) we arrive at the desired result.
For $\min\{m, t\} = O_n(1)$, notice that from Lemma~\ref{lem:Markov-MI} we can deduce that
\begin{align}
I (X^n; \theta^{(1)}) - I (X^n; \theta^{(1)}| Y^m) & = I(X^n; Y^m) \nonumber\\
& \leq I(\theta^{(1)} ; Y^m).
\end{align}
Hence, the result is concluded by noting that $I(\theta^{(1)} ; Y^m) = O_n(1)$.
\end{IEEEproof}
Theorem~\ref{thm:LLED_strict} characterizes the average maximin redundancy in the case of {\text{UcompED}} with side information from a correlated source. If the sources are not sufficiently correlated or the side information string is not long enough, then not much performance improvement is expected and the redundancy is close to that of {\text{Ucomp}} strategy. On the other hand, for sufficiently correlated information sources with sufficiently long side information string, one expects that the redundancy would be significantly reduced. In a sense, $m^\star(m,t) $ can be thought of as the effective length of the side information string. When $t \to \infty$, we see that $m^\star(m,t) \approx m$ while for smaller $t$, we see that $m^\star(m,t) <m$.
\begin{figure}[t]
\centering
\includegraphics[width = 0.46\textwidth]{figures/fig_M1_256_n_2}
\caption{Theoretical lower bound on the side information gain~$g_\text{M}(n,m,\theta,0.05,0)$ for the first-order Markov source with alphabet size $k=256$ and entropy rate $H^n(\theta)/n = 0.5$.}
\label{fig:M1_256_gain_n}
\end{figure}
\section{Side Information Gain}
\label{sec:gain}
In this section, we define and characterize the side information gain in the different coding strategies described in Section~\ref{sec:setup}. Side information gain is defined as the ratio of the expected codeword length of the traditional universal compression (i.e., {\text{Ucomp}}) to that of the universal compression with side information from a correlated source (i.e., {\text{UcompED}}):
\begin{align}
g^{n,m,t} (\theta) &\triangleq \frac{H^n(\theta) + \underline{R}^n}{H^n(\theta) +\underline{R}^{n,m,t}},
\label{eq:def-g}
\end{align}
In other words, $g^{n,m,t}(\theta)$ is the side information gain on a string of length $n$ drawn from $\mu^n_{\theta}$ and compressed using {\text{UcompED}} coding strategy with a side information string of length $m$ drawn from a correlated source with degree of correlation $t$.
The following is a trivial lower bound on the side information gain.
\begin{lemma}
For all $n,m, t \geq 0$, and $\theta \in \Theta_d$:
\begin{equation}
g^{n,m,t}(\theta) \geq 1.
\end{equation}
\label{thm:g_1_single}
\end{lemma}
\begin{IEEEproof}
This is proved by invoking Lemma~\ref{lem:sandwich}.
\end{IEEEproof}
Next, we present our main result on the side information gain in the next theorem.
\begin{theorem}
If $\min \{ m, t\} = O_n(1)$, then $g^{n,m,t}(\theta) = 1+ O(\frac{1}{n})$.
If $\min \{m,t\} = \omega_n(1)$:
\begin{equation}
g^{n,m,t} (\theta) = 1 + \frac{\underline{R}^n - \widehat{R}(n, m, t)}{H^n(\theta) + \widehat{R}(n, m, t)} + O\left(\frac{1}{n}\right) ,
\label{eq:gain-thm}
\end{equation}
where $\widehat{R}(n, m, t)$ is defined in~\eqref{eq:Rhat}.
\label{thm:gain}
\end{theorem}
\begin{IEEEproof}
The theorem is proved by invoking Theorem~\ref{thm:LLED_strict} and light algebraic manipulations.
\end{IEEEproof}
Consider the case where the string length $n$ grows to infinity. Intuitively, we would expect the side information gain to vanish in this case.
\begin{lemma}
For any $m,t \geq 0$ and any $\theta \in \Theta_d$, we have
\begin{equation}
\lim_{n \to \infty} g^{n,m,t}(\theta) = 1.
\end{equation}
\label{thm:Gain_infinite_n}
\end{lemma}
Let us demonstrate the significance of the side information gain through an example. We let the information source be a first-order Markov source with alphabet size $k=256$. We also assume that the source is such that $H^n(\theta)/n = 0.5$ bit per source character (byte).
In Fig.~\ref{fig:M1_256_gain_n}, the lower bound on the side information gain is demonstrated as a function of the sequence length $n$ for different values of the memory size $m$.
As can be seen, significant improvement in the compression may be achieved using memorization. For example, the lower bound on $g^{32\text{kB},m, \infty}(\theta)$ is equal to $1.39$, $1.92$, $2.22$, and $2.32$, for $m$ equal to $128$kB, $512$kB, $2$MB, and $8$MB, respectively. Further, $g^{512\text{kB},\infty,\infty}(\theta) = 2.35$.
Hence, more than a factor of two improvement is expected on top of traditional universal compression when network packets of lengths up to $32$kB are compressed using side information. See~\cite[Section III]{TON14} for practical compression methods that aim at achieving these improvements.
As demonstrated in Fig.~\ref{fig:M1_256_gain_n}, the side information gain for memory of size $8$MB is very close to $g^{n,\infty, \infty}(\theta)$, and hence, increasing the memory size beyond $8$MB does not result in substantial increase of the side information gain.
On the other hand, we further observe that as $n\to\infty$, the side information gain becomes negligible regardless of the length of the side information string. For example, at $n=32$MB even when $m \to \infty$, we have $g^{32\text{MB},\infty, \infty} \approx 1.01$, which is a subtle improvement. This is not surprising as the redundancy that is removed via the side information is $O(\log n)$, and hence the gain in~\eqref{eq:gain-thm} is $O(\frac{\log n}{n})$ which vanishes as $n$ grows.
Thus far, we have shown that significant performance improvement is obtained from side information on the compression of finite-length strings from low-entropy sources. As also was evident in the previous example, as the size of the memory increases the performance of the universal compression with side information is improved. However, there is a certain memory size beyond which increasing the side information length does not provide further compression improvement. In this section, we will quantify the required size of memory such that the benefits of the memory-assisted compression apply.
Then, the following theorem determines the size of the required memory for achieving $(1-\delta)$ fraction of the gain for unlimited memory.
Let $\widehat{g}^{n, t}(\theta)$ be defined as
\begin{equation}
\widehat{g}^{n, t}(\theta)
\triangleq 1 + \frac{\underline{R}^n}{H^n(\theta)}.
\end{equation}
It is straightforward to see that $\widehat{g}^{n, t}(\theta)$ is the limit of side information gain as the effective side information string length $m^\star(m,t) \to \infty,$ where $m^\star(\cdot, \cdot)$ is defined in~\eqref{eq:m-star}.
\begin{theorem}
Let $m^n_{\delta}(\theta)$ be defined as
\begin{equation}
m_{\delta}^{n} ( \theta) \triangleq \frac{1-\delta}{\delta} \frac{n}{H^n(\theta)} \frac{d}{2} \log e .
\end{equation}
Then, for any $m,t \geq 0$ such that $m^\star (m,t) \geq m_{\delta}^{n} ( \theta)$, we have
\begin{equation}
g^{n,m, t}(\theta) \geq (1-\delta)\widehat{g}^{n, t}(\theta).\nonumber
\end{equation}
\label{thm:m_size}
\end{theorem}
\begin{IEEEproof}
By invoking Theorem~\ref{thm:gain}, we have
\begin{equation}
g^{n,m, t} (\theta) \geq \frac{H^n(\theta)}{H^n(\theta) + \widehat{R}(n,m,t )} \widehat{g}^{n, t}(\theta).
\end{equation}
Hence, we need to show that for $m^\star(m,t) > m_{\delta}^{n, t} ( \theta)$, we have
\begin{equation}
\frac{H^n(\theta)}{H^n(\theta) + \widehat{R}(n,m,t )} \geq (1-\delta).
\end{equation}
By noting the definition of $m^n_\delta(\theta)$, for any $m^\star(m,t)> m^n_\delta(\theta)$, we have
\begin{equation}
\frac{d}{2}\frac{n}{m^\star(m,t)}\log e \leq \frac{\delta}{1-\delta} H^n(\theta).
\end{equation}
By noting that $\log \left(1+ \frac{n}{m}\right) \leq \frac{n}{m}\log e$, we have
\begin{equation}
\frac{d}{2}\log \left(1+ \frac{n}{m^\star(m,t)}\right) \leq \frac{\delta}{1-\delta} H^n(\theta),
\end{equation}
and hence, the proof is completed by noting the definition of $\widehat{R}(n,m,t)$ in~\eqref{eq:Rhat} and light algebraic manipulations.
\end{IEEEproof}
Theorem~\ref{thm:m_size} determines the size of the memory that is sufficient for the gain to be at least a fraction $(1-\delta)$ of the gain obtained as $m\to \infty$.
Considering our working example of the first-order Markov source in this section with $H^n(\theta)/n = 0.5$, with $\delta = 0.01$, we have
$m_\delta(\theta) \approx 8.9$MB is sufficient for the gain to reach $99\%$ of its maximum confirming our previous observation. This also complements the practical observations reported in~\cite[Section IV.C]{TON14}.
\section{Impact of Prefix Constraint}
\label{sec:one-to-one}
Thus far, all of the results of the paper are on prefix-free codes that satisfy Kraft inequality in~\eqref{eq:Kraft}. However, we remind the reader that our main application is in network packet compression.
In this case, the code need not be uniquely decodable (satisfy Kraft inequality) as the beginning and the end of each block is already determined by the header of the packet. Thus, the unique decodability condition is too restrictive and can be relaxed. It is only necessary for the mapping (the code) to be injective so as to ensure that {\em one} block of length $n$ can be uniquely decoded. Such codes are known as one-to-one codes. These are also called nonsingular codes in~\cite[Chapter 5.1]{cover-book}.
An interesting fact about one-to-one codes is that while the average codeword length of prefix-free codes can never be smaller than the Shannon entropy, the average codeword length of one-to-one codes can go below the entropy (cf.~\cite{Alon_Orlitsky_one2one,Szpankowski_one2one,Kontoyiannis_one2one,Cover_one2one,Szpankowski2011} and the references therein).
Let $l^n_*(\cdot)$ denote a strictly lossless one-to-one length function. Further, denote $L^n_*$ as the collection of all one-to-one codes (bijective mappings to binary sequences) on sequences of length $n$.
Let $R^n_*(l^n_*, \theta) $ denote the average redundancy of the one-to-one code, which is defined in the usual way as
\begin{equation}
R^n_*(l^n_*, \theta) \triangleq E\{l^n_*(X^n)\} - H_n(\theta).
\end{equation}
Further, define
\begin{equation}
\underline{R}^n_* \triangleq \max_{w \in \Omega_d} \min_{l^n_* \in L^n_*} \int_{\theta \in \Theta_d} R^n_*(l^n_*, \theta) w(\theta) d\theta,
\end{equation}
where $\Omega_d$ denotes the set of probability measures on $\Theta_d$.
\begin{theorem}
The following bound holds:
\begin{equation}
\underline{R}^n_*\geq \frac{d-2}{2}\log \frac{n}{2\pi e} -\log 2\pi e^2 + \int_{\theta \in \Theta_d} |\mathcal{I}(\theta)|^{\frac{1}{2}}d\theta + O\left(\frac{1}{\sqrt{n}}\right).
\end{equation}
\label{thm:one2one_lower}
\end{theorem}
\begin{IEEEproof}
We have
\begin{equation}
H(X^n) = H(X^n|\theta) + I(X^n; \theta)
\end{equation}
Assuming that $\theta$ follows Jeffreys' prior, we can get
\begin{equation}
H(X^n) = \underline{H}^n + \underline{R}^n,
\end{equation}
where $\underline{R}^n$ is the average minimax redundancy for prefix-free codes given in~\eqref{eq:maximin} and $\underline{H}^n$ is given by
\begin{equation}
\underline{H}^n \triangleq \int_{\theta \in \Theta_d} H_n(\theta) w_J(\theta) d\theta.
\end{equation}
We now invoke the main theorem in \cite{Alon_Orlitsky_one2one} to obtain a lower bound on $E \{ l^n_* (X^n)\}$. The proof is completed by observing that $\log \underline{H}^n \leq \log n $ and noting that the average redundancy for the case where $\theta$ follows Jeffreys' prior provides a lower limit on the average maximin redundancy.
\end{IEEEproof}
\begin{figure}[tb]
\centering
\epsfig{width= 0.47\textwidth,file=figures/fig_ITW14_one2one}
\caption{Average maximin redundancy as a function of string length for prefix-free and one-to-one universal codes for different values of entropy rate $H_n(\theta)/n$.}
\label{fig:M1_256_one2one}
\end{figure}
Theorem~\ref{thm:one2one_lower} shows that the compression overhead as measured against entropy is $\frac{d-2}{2} \log n + O_n(1)$. However, as discussed earlier, non-universal one-to-one codes achieve an average codeword length that can go below entropy. In particular, for the family of parametric sources studied in this paper, for almost all $\theta \in \Theta_d$, it is shown that the average codeword length is given by $H^n(\theta) - \frac{1}{2} \log n + O_n(1)$~\cite{Szpankowski_one2one,Szpankowski2011,Kontoyiannis_one2one}. Hence, the cost of universality is $\frac{d-1}{2} \log n + O_n(1)$. See~\cite{ITW14, kosut-IT-one2one} for a more complete study of the one-to-one universal compression problem. Additionally, see~\cite{Beirami-IT-Guesswork} for new insights on why the cost of universality scales with one less parameter in one-to-one compression, i.e., $\frac{d-1}{2}$, as compared to $\frac{d}{2}$ for prefix-free codes.
It is desirable to see how much reduction is offered by universal one-to-one compression compared with the prefix-free universal compression.
We compare the performance of universal one-to-one codes with that of the universal prefix-free codes through the running numerical example from Section~\ref{sec:motivation}.
This example is based on a first-order Markov source with alphabet size $|\mathcal{X}|=256$, where the number of source parameters is $d = 256 \times 255 = 62580$.
Note that we have not provided an actual code for the one-to-one universal compression. We compare the converse bound of Theorem~\ref{thm:one2one_lower} with the average maximin redundancy of universal prefix-free codes.
Fig.~\ref{fig:M1_256_one2one} compares the minimum average number of bits per symbol required to compress the class of the first-order Markov sources normalized to the entropy of the sequence for different values of entropy rates in bits per source symbol (per byte).
As can be seen, relaxing the prefix constraint at its best does not offer meaningful performance improvement on the compression performance as the curves for the prefix-free codes and one-to-one codes almost coincide.
This leads to the conclusion that the universal one-to-one codes are not of much practical interest.
On the other hand, if the source entropy rate is $1$ bit per byte ($H_n(\theta)/n = 1$), the compression rate on sequences of length $32$kB (for both prefix-free and one-to-one codes) is around 2.25 times the entropy-rate, which results in more than 100\% overhead on top of the entropy-rate for both prefix-free and one-to-one universal codes. Hence, we conclude that average redundancy poses significant overhead in the universal compression of finite-length low-entropy sequences, such as the Internet traffic, which cannot be compensated by dropping the prefix constraint. Hence, the side information gain provided from a correlated information source is essential even if the prefix constraint is dropped.
\begin{figure}[t]
\centering
\includegraphics[height=2.6in, angle=-90]{figures/sample_network_2}
\vspace{-0.05in}
\caption{The sample network in case study.}
\label{fig:sample_network_2}
\end{figure}
\section{A Network Case Study}
\label{sec:network}
In this section, we demonstrate how the side information gain could be leveraged in terms of the
compression of network traffic. Assume that source $S$ is the CNN server and the packet size is $n = 1$kB.
Further, assume that the memory size is $4$MB. In Section~\ref{sec:motivation}, we demonstrated that for this source, the average compression ratio for {\text{Ucomp}} is $\frac{1}{n}E \{ l^n(X^n)\} = 4.42$ bits per byte for this packet size. We further expected that the side information gain for such packet size be at least $g = 5$. Note that the rest of this discussion is concerned as to how the side information gain impacts the overall performance in the network.
We define the network-wide gain of side information measured in
\emph{bit$\times$hop} ($\text{\text{BH}}$) for the
sample network presented in
Fig.~\ref{fig:sample_network_2}, where $M$ denotes the memory element.
Assume that the server $S$ would serve the client $C$ in the network. The intermediate nodes $R_i$ are not capable of memorization.
Recall that the side information gain $g$ is only achievavle on every link in a path where the encoder and the decoder both have access to the side information string.
Let $d(S,C)$ denote the length of the shortest path from $S$ to $C$, which is clearly $d(S,C) = 3$, e.g., using the path $e_1,e_5,e_{10}$.
Let $\text{BH}(S,C)$ denote the minimum bit-hop cost required to transmit the sequence (of length $n$) from $S$ to $C$ without any compression mechanism, which is $\text{BH}(S,C) = 24$kbits (which is $1$kB$\times8$bits/byte$\times3$). In the case of end-to-end universal compression, i.e., using {\text{Ucomp}}, on the average we need to transmit $\text{BH}_{\text{Ucomp}} = E\{l^n(X^n)\} d(S,C)$
\emph{bit$\times$hop} for the transmission of a packet of length $n$ to the client.
On the other hand, in the case of universal compression with side information, i.e., using {\text{UcompED}}, for every information bit on the path from the server to the memory element $M$, we can leverage the
side information, and hence, we only require $\frac{1}{n}E\{ l^{n,m}(X^n, Y^m)\} = \frac{1}{ng} E\{ l^n(X^n)\}$ bit transmissions per each source character that is transmitted to the memory element.
Then, the memory element $M$ will decode the received codeword using {\text{UcompED}} decoder and the side information string $y^m$. It will then re-encode the result using {\text{Ucomp}} encoder for the final destination (the client $C$).
In this example, this implies that we require to transmit $\frac{2}{n} E\{ l^{n,m}(X^n, Y^m)\}$ \emph{bit$\times$hop} on
the average from $S$ to $M$ on links $e_1$ and $e_3$ (where $d(S,M) =
2$) for each source character. Then, we transmit the message using $E \{ l^n(X^n)\}$
\emph{bit$\times$hop} per source character from $M$ to $C$ on the link $e_9$. Let
$\text{BH}_{\text{UcompED}}$ be the minimum \emph{bit$\times$hop} cost for transmitting the string (of length $n$) using network compression that leverages side information in the $S \to M$ path, i.e.,
\begin{align}
\text{BH}_{\text{UcompED}} &= d(S,M) E \{ l^{n,m}(X^n,Y^m)\} \nonumber\\
&+ d(M, C) E \{ l^n(X^n)\}\nonumber\\
& = 2E \{ l^{n,m}(X^n,Y^m)\}+ E \{ l^n(X^n)\}.
\end{align}
Further, let $\mathcal{G}_{\text{BH}}$ be the
\emph{bit$\times$hop} gain of network compression, defined as $\mathcal{G}_{\text{BH}} = \frac{\text{BH}_{\text{Ucomp}}}{
\text{BH}_{\text{UcompED}}}$. Thus, $\mathcal{G}_{\text{BH}} = 2.14$ in this example by substituting $g= 5$. In other
words, network compression (using {\text{UcompED}} in the $S \to M$ path) achieves more than a factor of $2$ saving in \emph{bit$\times$hop} over the traditional universal compression of the packet (using {\text{Ucomp}} from $S$ to $C$) in the sample network.
In~\cite{TON14}, we fully characterize the scaling of the \emph{bit$\times$hop} gain, $\mathcal{G}_\text{BH}$, for scale-free networks (random power-law graphs) as a function of side information gain, $g$. We show that $\mathcal{G}_\text{BH} \approx g$ if the fraction of nodes in the network equipped with memorization capability is larger than a phase-transition cutoff. We refer the interested reader to~\cite{TON14} for more details.
\section{Conclusion}
\label{sec:conclusion}
In this paper, we formulated and studied universal compression with side information from a correlated source.
We showed that redundancy can impose a significant overhead in universal compression of finite-length sequences, such as network packets. We put forth a notion of correlation between information sources where the degree of correlation is controlled by a single hyperparameter. We showed that side information from a correlated source can significantly suppress the redundancy in universal compression. We defined the side information gain and showed that it can be large with reasonable side information size for small strings, such as network packets.
We showed that this gain is largely preserved even if the code is allowed to be only almost lossless allowing a sufficiently small error that vanishes asymptotically. We also showed that dropping the prefix constraint would not remedy the universal compression problem either. Finally, we showed how these benefits are applicable in network compression in a case study.
| {'timestamp': '2019-01-14T02:19:41', 'yymm': '1901', 'arxiv_id': '1901.03625', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03625'} | arxiv |
\section{Introduction}
Depth first search (DFS) is a well known graph traversal technique.
Right from the seminal work of Tarjan~\cite{Tarjan72}, DFS traversal
has played an important role in the design of efficient algorithms for many
fundamental graph problems, namely, bi-connected components,
strongly connected components, topological sorting~\cite{Tarjan76},
dominators in directed graph~\cite{Tarjan74}, etc. Even in undirected graphs,
DFS traversal have various applications including computing connected components, cycle detection,
edge and vertex connectivity~\cite{EvenT75} (via articulation points and bridges),
bipartite matching~\cite{HopcroftK73}, planarity testing~\cite{HopcroftT74} etc.
In this paper, we address the problem of computing a DFS tree in the semi-streaming environment.
The streaming model~\cite{AlonMS99,FeigenbaumKSV03,GuhaKS01} is a popular model for computation
on large data sets wherein a lot of algorithms have been developed~\cite{FlajoletM85,HenzingerRR98,GuhaKS01,Indyk06} to address significant problems in this model.
The model requires the entire input data to be accessed as a stream, typically in a single pass
over the input, allowing very small amount of storage ($poly\log$ in input size).
A streaming algorithm
must judiciously choose the data to be saved in the small space,
so that the computation can be completed successfully. In the context of graph problems,
this model is adopted in the following fashion. For a given graph $G=(V,E)$ having $n$ vertices,
an input stream sends the graph edges in $E$ using an arbitrary order only once, and the
allowed size of local storage is $O(poly\log n)$. The algorithm iteratively asks for the next edge and
performs some computation. After the stream is over, the final computation is performed and the
result is reported. At no time during the entire process should the total size of stored data
exceed $O(poly\log n)$.
In general only statistical properties of the graph are computable under this
model, making it impractical for use in more complicated graph problems~\cite{FeigenbaumKMSZ05b,GuruswamiK16}.
A prominent exception for the above claim is the problem of counting triangles
($3$-cycles) in a graph~\cite{Bar-YossefKS02}.
Consequently, several relaxed models have been proposed with a goal to solve more complex
graph problems. One such model is called {\em semi-streaming model}~\cite{Muthukrishnan05,FeigenbaumKMSZ05} which
relaxes the storage size to $O(n~poly\log n)$. Several significant problems have been studied under this model (surveys in~\cite{ConnellC09,Zhang10,McGregor14}). Moreover, even though it is preferred to allow only a single pass over the input stream, several hardness results~\cite{HenzingerRR98,BuchsbaumGW03,FeigenbaumKMSZ05,BorradaileMM14,GuruswamiO16} have reported the limitations of using a single pass (or even $O(1)$ passes). This has led to the development of various multi-pass algorithms~\cite{FeigenbaumKMSZ05,FeigenbaumKMSZ05b,McGregor05,AhnG13,Kapralov13,KaleT17} in this model.
Further, several streaming algorithms maintaining approximate distances~\cite{FeigenbaumKMSZ05b,Baswana08,Elkin11} are also
known to require $O(n^{1+\epsilon})$ space (for some constant $\epsilon>0$) relaxing the requirement of $O(n~poly\log n)$ space.
Now, a DFS tree of a graph can be computed in a single pass if $O(m)$ space is allowed.
If the space is restricted to $O(n)$, it can be trivially computed using $O(n)$ passes over the input stream,
where each pass adds one vertex to the tree. This can also be easily improved to $O(h)$ passes,
where $h$ is the height of the computed DFS tree. Despite most applications of DFS trees in undirected graphs
being efficiently solved in the semi-streaming environment~\cite{WestbrookT92,FeigenbaumKMSZ05,FeigenbaumKMSZ05b,AusielloFL09,AusielloFL12,Farach-ColtonHL15,Kliemann16}, due to its fundamental nature DFS is considered a long standing open problem~\cite{Farach-ColtonHL15,ConnellC09,Ruhl03} even for undirected graphs. Moreover, computing a DFS tree in ${O}(poly\log n)$ passes is considered hard~\cite{Farach-ColtonHL15}. To the best of our knowledge, it remains an open problem to compute a DFS tree using $o(n)$ passes even in any relaxed streaming environment.
In our results, we borrow some key ideas from recent sequential algorithms~\cite{BaswanaK17,BaswanaCCK16}
for maintaining dynamic DFS of undirected graphs.
Recently, similar ideas were also used by Khan~\cite{Khan17} who presented a semi-streaming
algorithm that uses using $O(n)$ space for maintaining dynamic DFS of an undirected graph,
requiring $O(\log^2 n)$ passes per update.
\subsection{Our Results}
\label{sec:OurResults}
We present the first semi-streaming algorithms to compute a DFS tree on an undirected graph
in $o(n)$ passes. Our first result can be described using the following theorem.
\begin{theorem}
Given an undirected graph $G=(V,E)$, the DFS tree of the graph can be computed by a
semi-streaming algorithm in at most $n/k$ passes using $O(nk)$ space, requiring $O(m\alpha(m,n))$ time per pass.
\label{thm:AdvAlg}
\end{theorem}
As described earlier, a simple algorithm can compute the DFS tree in $O(h)$ passes, where $h$ is the height of the DFS tree. Thus, for the graphs having a DFS tree with height $h=o(n)$ (see Appendix~\ref{apn:advAlg1WC} for details), we improve our result for such graphs in the following theorem.
\begin{theorem}
Given an undirected graph $G$, a DFS tree of $G$ can be computed by a
semi-streaming algorithm using $\lceil h/k \rceil$ passes using $O(nk)$ space
requiring amortized $O(m+nk)$ time per pass for any integer
$k\leq h$, where $h$ is the height of the computed DFS tree.\footnote{
Note that there can be many DFS trees of a graph having varying heights, say $h_{min}$ to $h_{max}$.
Our algorithm does not guarantee the computation of DFS tree having minimum height $h_{min}$,
rather it simply computes a {\em valid} DFS tree with height $h$, where $h_{min}\leq h\leq h_{max}$.
}
\label{thm:FinalAlg}
\end{theorem}
Since typically the space allowed in the semi-streaming model is $O(n~poly\log n)$,
the improvement in upper bounds of the problem by our results is considerably small
(upto $poly\log n$ factors).
Recently, Elkin~\cite{Elkin17} presented the first $o(n)$ pass algorithm for computing
Shortest Paths Trees. Using $O(nk)$ local space, it computes the shortest path tree
from a given source in $O(n/k)$ passes for unweighted graphs, and in $O(n\log n/k)$ passes
for weighted graphs. The significance of such results, despite improving the upper bounds
by only small factors, is substantial because they address fundamental problems.
The lack of any progress for such fundamental problems despite several decades of research on streaming
algorithms further highlights the significance of such results.
Moreover, allowing $O(n^{1+\epsilon})$ space (as in \cite{FeigenbaumKMSZ05b,Baswana08,Elkin11})
such results improves the upper bound significantly by $O(n^{\epsilon})$ factors.
Furthermore, they demonstrate the existence of a trade-off between the space and number of passes
required for computing such fundamental structures.
Our final algorithm is presented in form of a {\em framework}, which can use any algorithm for
maintaining a DFS tree of a stored sparser subgraph,
provided that it satisfies the property of {\em monotonic fall}. Such a {\em framework}
allows more flexibility and is hopefully much easier to extend to better algorithms for computing
a DFS tree or other problems requiring a computation of DFS tree. Hence we believe our {\em framework}
would be of independent interest.
We also augment our theoretical analysis with the experimental evaluation of our proposed algorithms. For both random and real graphs, the algorithms require merely a {\em few} passes even when the allowed space is just $O(n)$. The exceptional performance and surprising observations of our experiments on random graphs might also be of independent interest.
\subsection{Overview}
We now briefly describe the outline of our paper. In Section~\ref{sec:prelim} we establish the
terminology and notations used in the remainder of the paper. In order to present the main ideas
behind our approach in a simple and comprehensible manner, we present the algorithm in
four stages. {\em Firstly} in Section~\ref{sec:alg1}, we describe the basic algorithm
to build a DFS tree in $n$ passes, which adds a new vertex to the DFS tree in every pass over
the input stream. {\em Secondly} in Section~\ref{sec:alg2}, we improve this algorithm to compute a DFS tree in $h$ passes, where $h$ is the height of the final DFS tree. This algorithm essentially
computes all the vertices in the next level of the currently built DFS tree simultaneously,
building the DFS tree by one level in each pass over the input stream. Thus, in the $i^{th}$
pass every vertex on the $i^{th}$ level of the DFS tree is computed.
{\em Thirdly} in Section~\ref{sec:alg3}, we describe an advanced algorithm which uses $O(nk)$
space to add a path of length at least $k$ to the DFS tree in every pass over the input stream.
Thus, the complete DFS tree can be computed in $\lceil n/k \rceil$ passes.
{\em Finally}, in Section~\ref{sec:alg4}, we improve the algorithm to simultaneously add
all the subtrees constituting the next $k$ levels of the final DFS tree starting from the leaves
of the current tree $T$. Thus, $k$ levels are added to the DFS tree in each pass over the input stream, computing the DFS tree in $\lceil h/k \rceil$ passes.
As described earlier, our final algorithm is presented in form of a {\em framework}
which uses as a black box, any algorithm to maintain a DFS tree of a stored sparser subgraph,
satisfying certain properties. In the interest of completeness, one such algorithm is described in the Appendix~\ref{sec:rebuild}. {\em Lastly} in Section~\ref{sec:exp}, we present the results of the experimental evaluation of these algorithms. The details of this evaluation are deferred to Appendix~\ref{apn:expEval}.
In our advanced algorithms, we employ two interesting properties of a DFS tree, namely,
the {\em components} property~\cite{BaswanaCCK16} and the {\em min-height} property.
These simple properties of any DFS tree prove crucial in building the DFS efficiently
in the streaming environment.
\section{Preliminaries}
\label{sec:prelim}
Let $G=(V,E)$ be an undirected connected graph having $n$ vertices and $m$ edges.
The DFS traversal of $G$ starting from any vertex $r\in V$
produces a spanning tree rooted at $r$
called a DFS tree, in $O(m+n)$ time.
For any rooted spanning tree of $G$, a non-tree edge of the graph
is called a {\it back edge} if one of its endpoints is an ancestor of the
other in the tree, else it is called a {\it cross edge}.
A necessary and sufficient condition for any rooted spanning tree to be a
DFS tree is that every non-tree edge is a back edge.
In order to handle disconnected graphs, we add a dummy vertex $r$ to the graph
and connect it to all vertices. Our algorithm computes a DFS tree rooted at
$r$ in this augmented graph, where each child subtree of $r$ is a DFS tree of a
connected component in the DFS forest of the original graph.
The following notations will be used throughout the paper.
\begin{itemize}
\itemsep0em
\item $T:$~ The DFS tree of $G$ incrementally computed by our algorithm.
\item $par(w):$~ Parent of $w$ in $T$.
\item $T(x):$ The subtree of $T$ rooted at vertex $x$.
\item $root(T'):$~ Root of a subtree $T'$ of $T$, i.e., $root\big(T(x)\big)=x$.
\item $level(v):$ Level of vertex $v$ in $T$, where $level(root(T))=0$ and
$level(v)=level(par(v))+1$.
\end{itemize}
In this paper we will discuss algorithms to compute a DFS tree $T$ for the input graph $G$
in the semi-streaming model. In all the cases $T$ will be built iteratively starting from an empty tree.
At any time during the algorithm, we shall refer to the vertices that are not a part of
the DFS tree $T$ as {\em unvisited} and denote them by $V'$, i.e., $V'=V\setminus T$.
Similarly, we refer to the subgraph induced by the {\em unvisited} vertices, $G'=G(V')$,
as the {\em unvisited graph}.
Unless stated otherwise, we shall refer to a connected component of the unvisited graph $G'$
as simply a {\em component}.
For any component $C$, the set of edges and vertices in the component will be denoted by $E_C$ and $V_C$.
Further, each component $C$ maintains a spanning tree of the component that shall be referred as $T_C$.
We refer to a path $p$ in a DFS tree $T$ as an {\em ancestor-descendant} path if one of
its endpoints is an ancestor of the other in $T$.
Since the DFS tree grows downwards from the root,
a vertex $u$ is said to be {\em higher} than vertex $v$ if $level(u)<level(v)$.
Similarly, among two edges incident on an ancestor-descendant path $p$, an edge $(x,y)$ is {\em higher}
than edge $(u,v)$ if $y,v\in p$ and $level(y)<level(v)$.
We shall now describe two invariants such that any algorithm computing DFS tree incrementally
satisfying these invariants at every stage of the algorithm,
ensures the absence of cross edges in $T$ and hence the correctness of the final DFS tree $T$. \\
{\centering
\fbox{\parbox{\linewidth}{
{\bf Invariants:}
\begin{enumerate}[leftmargin=1cm]
\item[${\cal I}_1:$] All non-tree edges among vertices in $T$ are back edges, and
\item[${\cal I}_2:$] For any component $C$ of the unvisited graph, all the edges
from $C$ to the partially built DFS tree $T$ are incident on a single
{\em ancestor-descendant} path of $T$.
\end{enumerate}
}}
}
\vspace{.25em}
We shall also use the {\em components property} by Baswana et al.~\cite{BaswanaCCK16},
described as follows.
\begin{figure}[!ht]
\centering
\setlength{\belowcaptionskip}{-10pt}
\includegraphics[width=0.3\linewidth]{components2.pdf}
\caption{Edges $e_1'$ and $e_2'$ can be ignored during the DFS traversal (reproduced from~\cite{BaswanaCCK16}).}
\label{fig:component-property}
\end{figure}
\begin{lemma}[Components Property~\cite{BaswanaCCK16}]
\label{lemma:L()}
Consider a partially completed DFS traversal where $T$ is the partially built DFS tree.
Let the connected components of $G'$ be $C_1,..,C_k$.
Consider any two edges $e_i$ and $e'_i$ from $C_i$ that
are incident respectively on a vertex $x_{i}$ and some
ancestor (not necessarily proper) $w$ of $x_{i}$ in $T$.
Then it is sufficient to consider only $e_i$ during the DFS traversal,
i.e., the edge $e'_i$ can be safely ignored.
\end{lemma}
Ignoring $e'_i$ during the DFS traversal, as stated in the components property, is justified
because $e'_i$ will appear as a back edge in the resulting DFS tree
(refer to Figure~\ref{fig:component-property}). For each component $C_i$,
the edge $e_i$ can be found using a single pass over all the graph edges.
\section{Simple Algorithms}
\label{sec:alg1}
We shall first briefly describe the trivial algorithm to compute a DFS tree of a
(directed) graph using $n$ passes. Since we are limited to have only $O(n~poly\log n)$ space,
we cannot store the adjacency list of the
vertices in the graph. Recall that in the standard DFS algorithm~\cite{Tarjan72},
after visiting a vertex $v$, we choose any unvisited neighbour of $v$ and visit it.
If no neighbour of $v$ is unvisited, the traversal retreats back to the
parent of $v$ and look for its unvisited neighbour, and so on.
In the streaming model, we can use the same algorithm.
However, we do not store the adjacency list of a vertex.
To find the unvisited neighbour of each vertex, we perform a complete pass over the edges in $E$.
The algorithm only stores the partially built DFS tree and the status of each vertex
(whether it is visited/added to $T$).
Thus, for each vertex $v$ (except $r$) one pass is performed to add $v$ to $T$ and
another is performed before retreating to the parent of $v$.
Hence, it takes $2(n-1)$ passes to complete the algorithm
since $T$ is initialized with the root $r$.
Since, this procedure essentially simulates the standard DFS algorithm~\cite{Tarjan72},
it clearly satisfies the invariants ${\cal I}_1$ and ${\cal I}_2$.
This procedure can be easily transformed to require only $n-1$ passes by
avoiding an extra pass for retreating from each vertex $v$.
In each pass we find an edge $e$ (from the stream) from the unvisited vertices, $V'$, to
the lowest vertex on the ancestor-descendant path connecting $r$ and $v$, i.e., closest to $v$.
Hence $e$ would be an edge from the lowest (maximum level) ancestor of $v$ (not necessarily proper)
having at least one unvisited neighbour.
Recall that if $v$ does not have an unvisited neighbour we move to processing its
parent, and so on until we find an ancestor having an unvisited neighbour.
We can thus directly add the edge $e$ to $T$.
Hence, retreating from a vertex would not require an additional pass and
the overall procedure can be completed in
$n-1$ passes, each pass adding a new vertex to $T$.
Moreover, this also requires $O(1)$ processing time per edge and
extra $O(n)$ time at the end of the pass, to find the relevant ancestor.
Refer to Procedure~\ref{alg:simple1} in Appendix~\ref{sec:pseudoCode} for the pseudocode of the procedure.
Thus, we get the following result.
\begin{theorem}
Given a directed/undirected graph $G$, a DFS tree of $G$ can be computed by a
semi-streaming algorithm in $n$ passes using $O(n)$ space, using $O(m)$ time per pass.
\end{theorem}
\subsection{Improved algorithm}
\label{sec:alg2}
We shall now describe how this simple algorithm can be improved to compute a DFS tree
of an undirected graph in $h$ passes, where $h$ is the height of the computed DFS tree.
The main idea behind this approach is that each component of the unvisited graph $G'$
will constitute a separate subtree of the final DFS tree.
Hence each such subtree can be computed independent of each other
in parallel (this idea was also used by \cite{Khan17}).
Using one pass over edges in $E$, the components of the unvisited graph $G'$
can be found by using Union-Find algorithm~\cite{Tarjan75,TarjanL84} on the edges $E'$ of $G'$.
Now, using the \textit{components} property we know that it is sufficient
to add the lowest edge from each component to the DFS tree $T$.
At the end of the pass, for each component $C$ we find the edge $(x_C,y_C)$ incident from
the lowest vertex $x_C\in T$ to some vertex $y_C \in V_C$ and add it to $T$.
Note that in the next pass, for each component of $C\setminus\{y_C\}$ the lowest edge
connecting it to $T$ would necessarily be incident on $y_C$ as $C$ was connected.
Hence, instead of lowest edge incident on $T$,
we store $e_y$ from $y\in V'$ only if $e_y$ is incident on some leaf of $T$.
Refer to Procedure~\ref{alg:simple} in Appendix~\ref{sec:pseudoCode} for the pseudocode of the algorithm.
To prove the correctness of the algorithm, we shall prove using induction that
the invariants ${\cal I}_1$ and ${\cal I}_2$ hold over the passes performed on $E$. Since $T$ is initialized as an
isolated vertex $r$, both invariants trivially hold.
Now, let the invariants hold at the beginning of a pass.
Using ${\cal I}_2$, each component $C$ can have edges to a single ancestor-descendant path from $r$ to $x_C$.
Thus, adding the edge $(x_C,y_C)$ for each component $C$, would not violate ${\cal I}_1$ at the
end of the pass,
given that ${\cal I}_1$ holds at the beginning of the pass.
Additionally, from each component $C$ we add a single vertex $y_C$ as a child of $x_C$ to $T$.
Hence for any component of $C\setminus\{y_C\}$, the edges to $T$ can only be to ancestors of
$y_C$ (using ${\cal I}_2$ of previous pass), and an edge necessarily to $y_C$,
satisfying ${\cal I}_2$ at the end of the pass.
Hence, using induction both ${\cal I}_1$ and ${\cal I}_2$ are satisfied
proving the correctness of our algorithm.
Further, since each component $C$ in any $i^{th}$ pass necessarily has an edge to
a leaf $x_C$ of $T$, the new vertex $y_C$ is added to the
$i^{th}$ level of $T$. This also implies that every vertex at $i^{th}$ level of the
final DFS tree is added during the $i^{th}$ pass.
Hence, after $h$ passes we get a DFS tree of the whole graph as $h$ is the height
of the computed DFS tree. Now, the total time\footnote{
The Union-Find algorithm~\cite{Tarjan75,TarjanL84} requires $O(m\alpha(m,n))$ time, where $\alpha(m,n)$
is the inverse Ackermann function}
required to compute the connected components is $O(m\alpha(m,n))$. And computing an edge from each unvisited vertex
to a leaf in $T$ requires $O(1)$ time using $O(n)$ space. Thus, we have the following theorem.
\begin{theorem}
Given an undirected graph $G$, a DFS tree of $G$ can be computed by a
semi-streaming algorithm in $h$ passes using $O(n)$ space, where $h$ is the height of the computed
DFS tree, using $O(m\alpha(m,n))$ time per pass.
\end{theorem}
\section{Computing DFS in sublinear number of passes}
\label{sec:alg3}
Since a DFS tree may have $O(n)$ height, we cannot hope to compute
a DFS tree in sublinear number of passes using the previously described simple algorithms.
The main difference between the advanced approaches and the simple algorithms
is that, in each pass instead of adding a single vertex (say $y$) to the DFS tree,
we shall be adding an entire path (starting from $y$) to the DFS tree.
The DFS traversal gives the flexibility to chose the next vertex
to be visited as long as the DFS property is satisfied, i.e., invariants ${\cal I}_1$ and ${\cal I}_2$
are maintained.
Hence in each pass we do the following for every component $C$ in $G'$.
Instead of finding a single edge $(x_C,y_C)$ (see Section~\ref{sec:alg2}),
we find a path $P$ starting from $y_C$ in $C$ and attach this entire path $P$ to $T$
(instead of only $y_C$). Suppose this splits the component $C$ into components
$C_1,C_2,\dots$ of $C\setminus P$. Now, each $C_i$ would have an edge to at least
one vertex on $P$ (instead of necessarily the leaf $x_C$ in Section~\ref{sec:alg2})
since $C$ was a connected component. Hence in this algorithm for each $C_i$,
we find the vertex $y_i$ which is the lowest vertex of $T$ (or $P$) to which an edge from $C_i$
is incident. Observe that $y_i$ is unique since all the neighbours of $C_i$ in $T$
are along one path from the root to a leaf.
Using the {\em components} property, the selection of $y_i$ as the parent of the root of the subtree to be computed for $C_i$ ensures that invariant ${\cal I}_2$ continues to hold.
Thus, in each pass from every component of the unvisited graph,
we shall extract a path and add it to the DFS tree $T$.
This approach thus allows $T$ to grow by more than one vertex in each pass which is essential
for completing the tree in $o(n)$ passes. If in each pass we add a path of length at least $k$
from each component of $G'$, then the tree will grow by at least $k$ vertices in each pass,
requiring overall $\lceil n/k \rceil$ passes to completely build the DFS tree.
We shall now present an important property of any DFS tree of an undirected graph,
which ensures that in each pass we can find a path of length at least $k\geq m/n$ (refer to Appendix~\ref{sec:proofs} for proof).
\begin{lemma}[Min-Height Property]
Given a connected undirected graph $G$ having $m$ edges, any DFS tree of $G$
from any root vertex necessarily has a height $h\geq m/n$.
\label{lem:dfsHeight}
\end{lemma}
\subsection{Algorithm}
We shall now describe our algorithm to compute a DFS tree of the input graph in $o(n)$ passes.
Let the maximum space allowed for computation in the semi-streaming model be $O(nk)$.
The algorithm is a recursive procedure that computes a DFS tree of a component $C$
from a root $r_C$. For each component $C$ we maintain a spanning tree $T_C$ of $C$.
Initially we can perform a single pass over $E$ to compute a spanning tree of the connected
graph $G$ (recall the assumption in Section~\ref{sec:prelim}) using the Union-Find algorithm.
For the remaining components, its spanning tree would already have been computed and passed
as an input to the algorithm.
We initiate a pass over the edge in $E$ and store the first $|V_C|\cdot k$ edges (if possible)
from the component $C$ in the memory as the subgraph $E'_C$.
Before proceeding with the remaining stream, we use any algorithm for computing a DFS tree
$T'_C$ rooted at $r_C$ in the subgraph containing edges from $T_C$ and $E'_C$.
Note that adding $T_C$ to $E'_C$ is important to ensure that subgraph induced by
$T_C\cup E'_C$ is connected. In case the pass was completed before $E'_C$ exceeded
storing $|V_C|\cdot k$ edges, $T'_C$ is indeed a DFS tree of $C$ and we directly add it to $T$.
Otherwise, we find the longest path $P$ from $T'_C$ starting from $r_C$, i.e., path from $r_C$
to the farthest leaf. The path $P$ is then added to $T$.
Now, we need to compute the connected components of $C\setminus P$ and the new corresponding root
for each such component. We use the Union-Find algorithm to compute these components,
say $C_1,...,C_f$, and compute the lowest edge $e_i$ from each $C_i$ on the path $P$.
Clearly, there exist such an edge as $C$ was connected. In order to find these components
and edges, we need to consider all the edges in $E_C$, which can be done by first considering
$E'_C$ and then each edge from $C$ in the remainder of input stream of the pass.
Refer to Procedure~\ref{alg:advAlg1} in Appendix~\ref{sec:pseudoCode} for the pseudocode of the algorithm.
Using the components property, choosing the new root $y_i$ corresponding to the lowest edge
$e_i$ ensures that the invariant ${\cal I}_2$ and hence ${\cal I}_1$ is satisfied.
Now, in case $|E_C|< |V_C|\cdot k$, the entire DFS tree of $C$ is constructed and added to $T$ in a single pass.
Otherwise, in each pass we add the longest path $P$ from $T'_C$ to the final DFS tree $T$.
Since $|E'_C|=|V_C|\cdot k$ and $E'_C\cup T_C$ is a single connected component,
the {\em min-height property} ensures that the height of any such $T'_C$ (and hence $P$) is at least $k$.
Since in each pass, except the last, we add at least $k$ new vertices to $T$,
this algorithm terminates in at most $\lceil n/k \rceil$ passes.
Now, the total time required to find the components of the unvisited graph is again $O(m\alpha(m,n))$.
The remaining operations clearly require $O(|E_C|)$ time for a component $C$, requiring overall $O(m)$ time.
Thus, we get the following theorem.
\newtheorem*{thmAdvAlg}{Theorem~\ref{thm:AdvAlg}}
\begin{thmAdvAlg}
Given an undirected graph $G$, a DFS tree of $G$ can be computed by a
semi-streaming algorithm in at most $\lceil n/k \rceil$ passes using $O(nk)$ space,
requiring $O(m\alpha(m,n))$ time per pass.
\end{thmAdvAlg}
\begin{remark}
Since, Procedure~\ref{alg:advAlg1} adds an ancestor-descendant path for each component of $G'$,
it might seem that the analysis of the algorithm is not tight for computing DFS trees with $o(n)$ height.
However, there exist a sequence of input edges where Procedure~\ref{alg:advAlg1} indeed takes $\Theta(n/k)$ passes
for computing a DFS tree with height $o(n)$ (see Appendix~\ref{apn:advAlg1WC}).
\end{remark}
\section{Final algorithm}
\label{sec:alg4}
We shall now further improve the algorithm so that the required number of passes reduces
to $\lceil h/k \rceil$ while it continues to use $O(nk)$ space, where $h$ is the height
of the computed DFS tree and $k$ is any positive integer. To understand the main intuition
behind our approach, let us recall the previously described algorithms.
We first described a simple algorithm (in Section~\ref{sec:alg1}) in which every pass over
the input stream adds one new vertex as the child of some leaf of $T$, which was improved
(in Section~\ref{sec:alg2}) to simultaneously adding all vertices which are children of the
leaves of $T$ in the final DFS tree.
We then presented another algorithm (in Section \ref{sec:alg3}) in which every pass over the
input stream adds one {\em ancestor-descendant} path of length $k$ or more, from each component
of $G'$ to $T$. We shall now improve it by adding all the subtrees constituting the next $k$
levels of the final DFS tree starting from the leaves of the current tree $T$
(or fewer than $k$ levels if the corresponding component of $G'$ is exhausted).
Now, consider any component $C$ of $G'$. Let $r_C\in C$ be a vertex having an edge $e$ to a
leaf of the partially built DFS tree $T$. The computation of $T$ can be completed by computing
a DFS tree of $C$ from the root $r_C$, which can be directly attached to $T$ using $e$.
However, computing the entire DFS tree of $C$ may not be possible in a single pass over the
input stream, due to the limited storage space available. Thus, using $O(n\cdot k)$ space we
compute a special spanning tree $T_C$ for each component $C$ of $G'$ in parallel,
such that the top $k$ levels of $T_C$ is same as the top $k$ levels of {\em some} DFS tree of $C$.
As a result, in the $i^{th}$ pass all vertices on the levels $(i-1)\cdot k+1$ to $i\cdot k$ of
the final DFS tree are added to $T$. This essentially adds a tree $T'_C$ representing the top $k$
levels of $T_C$ for each component $C$ of $G'$. This ensures that our algorithm will terminate
in $\lceil h/k \rceil$ passes, where $h$ is the height of the final DFS tree. Further, this special
tree $T_C$ also ensures an \textit{additional} property, i.e., there is a one to one correspondence between
the set of trees of $T_C\setminus T'_C$ and the components of $C\setminus T'_C$.
In fact, each tree of $T_C\setminus T'_C$ is a spanning tree of the corresponding component.
This property directly provides the spanning trees of the components of $G'$ in the next pass.
\subsubsection*{Special spanning tree $T_C$}
We shall now describe the properties of this special tree $T_C$ (and hence $T'_C$) which
is computed in a single pass over the input stream. For $T'_C$ to be added to the DFS tree
$T$ of the graph, a necessary and sufficient condition is that $T'_C$ satisfies the
invariants ${\cal I}_1$ and ${\cal I}_2$ at the end of the pass.
To achieve this we maintain $T_C$ to be a spanning tree of $C$, such that these invariants are
maintained by the corresponding $T'_C$ throughout the pass as the edges are processed.
Let $S_C$ be the set of edges already visited during the current pass, which have both endpoints in $C$.
In order to satisfy ${\cal I}_1$, no edge in $S_C$ should be a cross edge in $T'_C$, i.e.,
no edge having both endpoints in the top $k$ levels of $T_C$ is a cross edge.
In order to satisfy ${\cal I}_2$, no edge in $S_C$ from any component $C'\in C\setminus T'_C$
to $C\setminus C'$ should be a cross edge in $T_C$. Hence, using the {\em additional} property of $T_C$,
each edge from a tree $\tau$ in $T_C\setminus T'_C$ to $T_C\setminus \tau$ is necessarily a back edge.
This is captured by the two conditions of invariant ${\cal I}_T$ given below.
Hence ${\cal I}_T$ should hold after processing each edge in the pass.
Observe that any spanning tree, $T_C$, trivially satisfies ${\cal I}_T$ at the beginning of the pass
as $S_C=\emptyset$.\\
{\centering
\fbox{\parbox{\linewidth}{
{\bf Invariant ${\cal I}_T:$}\\
$T_C$ is a spanning tree of $C$ with the top $k$ levels being $T'_C$ such that:
\begin{enumerate}[leftmargin=1cm]
\item[${\cal I}_{T_1}:$] All non-tree edges of $S_C$ having both endpoints in $T'_C$, are back edges.
\item[${\cal I}_{T_2}:$] For each tree $\tau$ in $T_C\setminus T'_C$, all the edges of $S_C$ from
$\tau$ to $T_C\setminus \tau$ are back edges.
\end{enumerate}
}}}
\vspace{.25em}
Thus, ${\cal I}_T$ is the local invariant maintained by $T_C$ during the pass,
so that the global invariants ${\cal I}_1$ and ${\cal I}_2$ are maintained throughout the algorithm.
Now, in order to compute $T_C$ (and hence $T'_C$) satisfying the above invariant, we store
a subset of $S_C$ along with $T_C$. Let $H_C$ denote the (spanning) subgraph of $G$ formed
by $T_C$ along with these additional edges. Note that all the
edges of $S_C$ cannot be stored in $H_C$ due to space limitation of $O(nk)$.
Since each pass starts with the spanning tree $T_C$ of $C$ and $S_C=\emptyset$, initially $H_C=T_C$.
As the successive edges of the stream are processed, $H_C$ is updated if the input edge belongs
to the component $C$. We now formally describe $H_C$ and its properties.
\subsubsection*{Spanning subgraph $H_C$}
As described earlier, at the beginning of a pass for every component $C$ of $G'$,
$H_C = T_C$. Now, the role of $H_C$ is to facilitate
the maintenance of the invariant ${\cal I}_T$. In order to satisfy ${\cal I}_{T_1}$
and ${\cal I}_{T_2}$, we store in $H_C$ all the edges in $S_C$ that are incident on at least one vertex of $T'_C$.
Therefore, $H_C$ is the spanning tree $T_C$
along with every edge in $S_C$ which has at least one endpoint in $T'_C$.
Thus, $H_C$ satisfies the following invariant throughout the algorithm.\\
{\centering
\fbox{\parbox{\linewidth}{
{\bf Invariant ${\cal I}_H:$}\\
$H_C$ comprises of $T_C$
and all edges from $S_C$ that are incident on at least one vertex of $T'_C$. }}}
\vspace{.25em}
We shall now describe a few properties of $H_C$ and then in the following section
show that maintaining ${\cal I}_H$ for $H_C$ is indeed sufficient to maintain the invariant ${\cal I}_T$
as the stream is processed.
The following properties of $H_C$ are crucial to establish the correctness of our procedure to maintain
$T_C$ and $H_C$ and establish a bound on total space required by $H_C$ (see Appendix~\ref{sec:proofs} for proofs).
\begin{lemma}
$T_C$ is a valid DFS tree of $H_C$.
\label{lem:dfsProp}
\end{lemma}
\begin{lemma}
The total number of edges in $H_C$, for all the components $C$ of $G'$, is $O(nk)$.
\label{lem:HCspace}
\end{lemma}
\subsection{Processing of Edges}
We now describe how $T_C$ and $H_C$ are maintained while processing the edges of the
input stream such that ${\cal I}_T$ and ${\cal I}_H$ are satisfied.
Since our algorithm maintains the invariants
${\cal I}_1$ and ${\cal I}_2$ (because of ${\cal I}_T$), we know that any edge whose both endpoints are not in some
component $C$ of $G'$, is either a back edge or already a tree edge in $T$. Thus, we shall only discuss
the processing of an edge $(x,y)$ having both endpoints in $C$ (now added to $S_C$),
where $level(x)\leq level(y)$.
\begin{enumerate}
\item If $x\in T'_C$ then the edge is added to $H_C$ to ensure ${\cal I}_H$.
In addition, if $(x,y)$ is a cross edge in $T_C$ it violates either ${\cal I}_{T_1}$ (if $y\in T'_C$)
or ${\cal I}_{T_2}$ (if $y\notin T'_C$).
Thus, $T_C$ is required to be restructured to ensure that ${\cal I}_T$ is satisfied.
\item If $x\notin T'_C$ and if $x$ and $y$ belong to different trees in $T_C\setminus T'_C$,
then it violates ${\cal I}_{T_2}$.
Again in such a case, $T_C$ is required to be restructured to ensure that ${\cal I}_T$ is satisfied.
\end{enumerate}
Note that after restructuring $T_C$ we need to update $H_C$ such that ${\cal I}_H$ is satisfied.
Consequently any non-tree edge in $H_C$ that was incident on a vertex in original $T'_C$,
has to be removed from $H_C$ if none of its endpoints are in $T'_C$ after restructuring $T_C$,
i.e., one or both of its endpoints have moved out of $T'_C$.
But the problem arises
if a vertex moves into $T'_C$ during restructuring.
There might have been edges incident on such a vertex in $S_C$ and which were not stored in $H_C$.
In this case we need these edges in $H_C$ to satisfy ${\cal I}_H$, which is not possible
without visiting $S_C$ again.
This problem can be avoided if our restructuring procedure ensures that no new vertex enters $T'_C$.
This can be ensured if the restructuring procedure follows the property of {\em monotonic fall}, i.e.,
the level of a vertex is never decreased by the procedure.
Let $e$ be the new edge of component $C$ in the input stream.
We shall show that in order to preserve the invariants ${\cal I}_T$ and ${\cal I}_H$
it is sufficient that the restructuring procedure maintains the property of {\em monotonic fall} and
ensures that the restructured $T_C$ is a DFS tree of $H_C+e$.
\begin{lemma}
On insertion of an edge $e$, any restructuring procedure which updates $T_C$ to be a valid DFS tree
of $H_C + e$ ensuring {\em monotonic fall}, satisfies the invariants ${\cal I}_T$ and ${\cal I}_H$.
\label{lem:correctness}
\end{lemma}
\begin{proof}
The property of {\em monotonic fall} ensures that the vertex set of new $T'_C$ is a subset
of the vertex set of the previous $T'_C$. Using ${\cal I}_H$ we know that any edge of $S_C$
which is not present in $H_C$ must have both its endpoints outside $T'_C$. Hence,
{\em monotonic fall} guarantees that ${\cal I}_H$ continues to hold with respect to the new
$T'_C$ for the edges in $S_C\setminus\{e\}$. Additionally, we save $e$ in the new $H_C$
if at least one of its endpoints belong to the new $T'_C$, ensuring that ${\cal I}_H$
holds for the entire $S_C$.
Since the restructuring procedure ensures that the updated $T_C$ is a DFS tree of $H_C$,
the invariant ${\cal I}_{T_1}$ trivially holds as a result of ${\cal I}_H$. In order to prove
the invariant ${\cal I}_{T_2}$, consider any edge $e'\in S_C$ from a tree
$\tau\in T_C\setminus T'_C$ to $T_C\setminus \tau$. Clearly, it will satisfy ${\cal I}_{T_2}$ if
$e'\in H_C$, as $T_C$ is a DFS tree of $H_C+e$. In case $e' \notin H_C$, it must be internal to
some tree $\tau'$ in the original $T_C\setminus T'_C$ (using ${\cal I}_{T_2}$ in the original $T_C$).
We shall now show that such an edge will remain internal to some tree in the updated
$T_C\setminus T'_C$ as well, thereby not violating ${\cal I}_{T_2}$. Clearly the endpoints of
$e'$ cannot be in the updated $T'_C$ due to the property of {\em monotonic fall}.
Assume that the endpoints of $e'$ belong to different trees of updated $T_C \setminus T'_C$.
Now, consider the edges $e_1,...,e_t$ on the tree path in $\tau'$ connecting the endpoints of $e'$.
Since the entire tree path is in $\tau'$, the endpoints of each $e_i$ are not in original $T'_C$,
ensuring that they are also not in the updated $T'_C$ (by {\em monotonic fall}). Since the endpoints
of $e'$ (and hence the endpoints of the path $e_1,...,e_t$) are in different trees in updated
$T_C \setminus T'_C$, there must exist some $e_i$ which also has endpoints belonging to different
trees of updated $T_C\setminus T'_C$.
This makes $e_i$ a cross edge of the updated $T_C$. Since $e_i$ is a tree edge
of original $T_C$, it belongs to $H_C$ and hence $e_i$ being a cross edge implies that
the updated $T_C$ is not a DFS tree of $H_C+e$, which is a contradiction.
Hence $e'$ has both its endpoints in the same tree of the updated $T_c\setminus T'_C$,
ensuring that ${\cal I}_{T_2}$ holds after the restructuring procedure.
\end{proof}
Hence, any procedure to restructure a DFS tree $T_C$ of the subgraph $H_C$ on insertion of a
{\em cross edge} $e$, that upholds the property of {\em monotonic fall} and returns a new $T_C$
which is a DFS tree of $H_C+e$, can be used as a {\em black box} in our algorithm. One such algorithm is the incremental
DFS algorithm by Baswana and Khan~\cite{BaswanaK17}, which precisely fulfils our requirement.
They proved the total update time of the algorithm to be $O(n^2)$. They also showed that any
algorithm maintaining incremental DFS abiding {\em monotonic fall} would require $\Omega(n^2)$ time
even for sparse graphs, if it explicitly maintains the DFS tree. If the height of the DFS tree is
known to be $h$, these bounds reduces to $O(nh+n_e)$ and $\Omega(nh+n_e)$ respectively,
where $n_e$ is the number of edges processed by the algorithm. Refer to Appendix~\ref{sec:rebuild}
for a brief description of the algorithm.
\subsection{Algorithm}
We now describe the details of our final algorithm which uses Procedure~\ref{alg:rebuild}~\cite{BaswanaK17} (described in Appendix~\ref{sec:rebuild}) for restructuring
the DFS tree when a cross edge is inserted.
Similar to the algorithm in Section~\ref{sec:alg3}, for each component $C$ of $G'$, a rooted spanning tree $T_C$ of the component is required as an input to the procedure having the root $r_C$.
Initially $T=\emptyset$ and $G'=G$ has a single component $C$, as $G$ is connected
(recall the assumption in Section~\ref{sec:prelim}). Hence for the first pass,
we compute a spanning tree $T_C$ of $G$ using the Union-Find algorithm. Subsequently
in each pass we directly get a spanning tree $T_{C'}$ for each component $C'$ of the new $G'$,
which is the corresponding tree in $T_C\setminus T'_C$,
where $C$ is the component containing $C'$ in the previous pass.
Also, observe that the use of these trees as the new $T_C$ ensures that the level of no vertex ever rises
in the context of the entire tree $T$. This implies that the level of any vertex starting
with the initial spanning tree $T_G$ never rises, i.e., the entire algorithm satisfies the property
of {\em monotonic fall}. We will use this fact crucially in the analysis of the time complexity.
As described earlier, we process the edges of the stream by updating the $T_C$ and $H_C$ maintaining
${\cal I}_T$ and ${\cal I}_H$ respectively. In case the edge is internal to some tree in $T_C\setminus T'_C$
(i.e., have both endpoint in the same tree in $T_C\setminus T'_C$), we simply ignore the edge.
Otherwise, we add it to $H_C$ to satisfy ${\cal I}_H$. Further, Procedure~\ref{alg:rebuild}
maintains $T_C$ to be a DFS tree of $H_C$, which restructures $T_C$ if the processed edge is added
to $H_C$ and is a cross edge in $T_C$.
Now, in case $T_C$ is updated we also update the subgraph $H_C$, by removing the extra
non-tree edges having both endpoints in $T_C\setminus T'_C$. After the pass is completed,
we attach $T'_C$ (the top $k$ levels of $T_C$) to $T$. Now, ${\cal I}_{T_2}$ ensures that each tree
of $T_C\setminus T'_C$ forms the (rooted) spanning tree of the components of the new $G'$,
and hence can be used for the next pass. Refer to Procedure~\ref{alg:advAlg2} in Appendix~\ref{sec:pseudoCode}
for the pseudocode of the algorithm.
\subsection{Correctness and Analysis}
The correctness of our algorithm follows from Lemma~\ref{lem:correctness}, which ensures
that invariants ${\cal I}_{H}$ and ${\cal I}_{T}$ (and hence ${\cal I}_1$ and ${\cal I}_2$)
are maintained as a result of using Procedure~\ref{alg:rebuild} which ensures {\em monotonic fall} of vertices.
The total space used by our algorithm and the restructuring procedure is dominated
by the cumulative size of $H_C$ for all components $C$ of $G'$, which is $O(nk)$ using Lemma~\ref{lem:HCspace}.
Now, in every pass of the algorithm, a DFS tree for each component $C$ of height $k$ is
attached to $T$. These trees collectively constitute the next $k$ levels of the final DFS tree $T$.
Therefore, the entire tree $T$ is computed in $\lceil h/k \rceil$ passes.
Let us now analyse the time complexity of our algorithm. In the first pass $O(m\alpha(m,n))$
time is required to compute the spanning tree $T_C$ using the Union-Find algorithm.
Also, in each pass $O(m)$ time is required to process the input stream. Further,
in order to update $H_C$ we are required to delete edges
having both endpoints out of $T'_C$. Hence, whenever a vertex falls below the $k^{th}$ level, the edges
incident on it are checked for deletion from $H_C$ (if the other endpoint is also not in $T'_C$).
Total time required for this is $O(\sum_{v\in V} deg(v)) = O(m)$ per pass.
Now, Appendix~\ref{sec:rebuild} describes the details of Procedure~\ref{alg:rebuild} which
maintains the DFS tree in total $O(nh+n_e)$ time, where $n_e=O(mh/k)$, for processing the entire
input stream in each pass.
Finally, we need to efficiently answer the {\em query} whether an edge is internal to some tree in
$T_C\setminus T'_C$. For this we maintain for each vertex $x$ its ancestor at level $k$
as $rep[x]$, i.e., $rep[x]$ is the root of the tree in $T_C\setminus T'_C$
that contains $x$. If $level(x) < k$, then $rep[x] =x$. For an edge $(x,y)$ comparing the
$rep[x]$ and $rep[y]$ efficiently answers the required query in $O(1)$ time.
However, whenever $T_C$ is updated we need to update
$rep[v]$ for each vertex $v$ in the modified part of $T_C$, requiring $O(1)$ time per vertex
in the modified part of $T_C$. We shall bound the total work done to update $rep[x]$ of
such a vertex $x$ throughout the algorithm to $O(nh)$ as follows.
Consider the potential function $\Phi=\sum_{v\in V} level(v)$. Whenever some part of $T_C$ is updated,
each vertex $x$ in the modified $T_C$ necessarily incurs a fall in its level
(due to {\em monotonic fall}).
Thus, the cost of updating $rep[x]$ throughout the algorithm is proportional to the number of times
$x$ descends in the tree, hence increases the value of $\Phi$ by at least one unit.
Hence, updating $rep[x]$ for all $x$ in the modified part of $T_C$ can be accounted by the
corresponding increase in the value of $\Phi$. Clearly, the maximum value of $\Phi$ is $O(nh)$,
since the level of each vertex is always less than $h$, where $h$ is the height of the
computed DFS tree. Thus, the total work done to update $rep[x]$ for all $x\in V$ is $O(nh)$.
This proves our main theorem described in Section~\ref{sec:OurResults} which is stated as follows.
\newtheorem*{thmMain}{Theorem~\ref{thm:FinalAlg}}
\begin{thmMain}
Given an undirected graph $G$, a DFS tree of $G$ can be computed by a
semi-streaming algorithm using $\lceil h/k \rceil$ passes using $O(nk)$ space
requiring amortized $O(m+nk)$ time per pass for any integer
$k\leq h$, where $h$ is the height of the computed DFS tree.
\end{thmMain}
\noindent
\textbf{Remark: } Note that the time complexity of our algorithm is indeed tight for our framework.
Since our algorithm requires $\lceil h/k \rceil $ passes and any restructuring procedure following
{\em monotonic fall} requires $\Omega(nh+n_e)$ time, each pass would require $\Omega(m+nk)$ time.
\section{Experimental Evaluation}
\label{sec:exp}
Most streaming algorithms deal with only $O(n)$ space, for which our advanced algorithms improve over the simple algorithms theoretically by just constant factors. However, their empirical performance demonstrates their significance in the real world applications. The evaluation of our algorithms on random and real graphs shows that in practice these algorithms require merely a {\em few} passes even when allowed to store just $5n$ edges. The results of our analysis can be summarized as follows (for details refer to Appendix~\ref{apn:expEval}).
The two advanced algorithms {\em kPath} (Algorithm~\ref{alg:advAlg1} in Section~\ref{sec:alg3}) and {\em kLev} (Algorithm~\ref{alg:advAlg2} in Section~\ref{sec:alg4} with an additional heuristic) perform much better than the rest even when $O(n)$ space is allowed. For both random and real graphs, {\em kPath} performs slightly worse as the density of the graph increases. On the other hand {\em kLev} performs slightly better only in random graphs with the increasing density. The effect of the space parameter is very large on {\em kPath} from $k=1$ to small constants, requiring very {\em few} passes even for $k=5$ and $k=10$. However, {\em kLev} seems to work very well even for $k=1$ and has a negligible effect of increasing the value of $k$. Overall, the results suggest using {\em kPath} if $nk$ space is allowed for $k$ being a small constant such as $5$ or $10$. However, if the space restrictions are extremely tight it is better to use {\em kLev}.
\section{Conclusion}
We presented the first $o(n)$ pass semi-streaming algorithm for computing a DFS tree
for an undirected graph, breaking the long standing presumed barrier of $n$ passes.
In our streaming model we assume that $O(nk)$ local space is available for computation,
where $k$ is any natural number.
Our algorithm computes a DFS tree in $\lceil n/k \rceil$ passes.
We improve our algorithm to require only $\lceil h/k \rceil$ passes without any additional space
requirement, where $h$ is the height of the final tree. This improvement becomes significant
for graphs having shallow DFS trees. Moreover, our algorithm is described as a {\em framework}
using a restructuring algorithm as a black box. This allows more flexibility
to extend our algorithm for solving other problems requiring a computation of DFS tree in the streaming
environment.
Recently, in a major breakthrough Elkin~\cite{Elkin17} presented the first $o(n)$ pass algorithm
for computing Shortest Paths Tree from a single source.
Using $O(nk)$ local space, it computes the shortest path tree
from a given source in $O(n/k)$ passes for unweighted graphs and in $O(n\log n/k)$ passes
for weighted graphs.
Despite the fact that these breakthroughs provide only minor improvements
(typically $poly\log n$ factors), they are significant steps to pave a path in better
understanding of such fundamental problems in the streaming environment.
These simple improvements come after decades of the emergence of
streaming algorithms for graph problems, where such problems were considered implicitly hard in the
semi-streaming environment.
We thus believe that our result is a significant improvement over the known algorithm for
computing a DFS tree in the streaming environment, and it can be a useful step in more involved
algorithms that require the computation of a DFS tree.
Moreover, the experimental evaluation of our algorithms revealed exceptional performance of the advanced algorithms {\em kPath} and {\em kLev} (greatly affected by the {\em additional heuristic}). Thus, it would be interesting to further study these algorithms theoretically which seem to work extremely well in practice.
\bibliographystyle{plain
| {'timestamp': '2019-01-14T02:22:19', 'yymm': '1901', 'arxiv_id': '1901.03689', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03689'} | arxiv |
\section{Introduction}
Real-time 6-DoF (Degrees of Freedom) state estimation is a fundamental technology for robotics.
Accurate state estimation plays an important role in various intelligent applications, such as robot exploration, autonomous driving, VR (Virtual Reality) and AR (Augmented Reality).
The most common sensors we use in these applications are cameras.
A large number of impressive vision-based algorithms for pose estimation has been proposed over the last decades, such as \cite{klein2007parallel, ForPizSca1405, engel2014lsd, mur2015orb, engel2017direct}.
Besides cameras, the IMU is another popular option for state estimation.
The IMU can measure acceleration and angular velocity at a high frequency, which is necessary for low-latency pose feedback in real-time applications.
Hence, there are numerous research works fusing vision and IMU together, such as \cite{MouRou0704,LiMou1305,LeuFurRab1306,bloesch2015robust,mur2017visual,forster2017manifold, qin2018vins}.
Another popular sensor used in state estimation is LiDAR.
LiDAR-based approaches \cite{zhang2014loam} achieve accurate pose estimation in a confined local environment.
Although a lot of algorithms have been proposed in the past, they are usually applied to a single input sensor or a specific sensor suite.
Recently, we have seen platforms equipped with various sensor sets, such as stereo cameras on ground vehicles, a monocular camera with an IMU on mobile phones, stereo cameras with an IMU on aerial robots.
However, as most traditional algorithms were designed for a single sensor or a specific sensor set, they cannot be ported to different platforms.
Even for one platform, we need to choose different sensor combinations in different scenarios.
Therefore, a general algorithm which supports different sensor suites is required.
Another practical requirement is that in case of sensor failure, an inactive sensor should be removed and an alternative sensor should be added into the system quickly.
Hence, a general algorithm which is compatible with multiple sensors is in need.
\begin{figure}
\centering
\includegraphics[width=0.45\textwidth]{newframework}
\caption{An illustration of the proposed framework for state estimation, which supports multiple sensor choices, such as stereo cameras, a monocular camera with an IMU, and stereo cameras with an IMU. Each sensor is treated as a general factor.
Factors which share common state variables are summed together to build the optimization problem.
\label{fig:framework}}
\end{figure}
In this paper, we propose a general optimization-based framework for pose estimation, which supports multiple sensor combinations.
We further demonstrate it with visual and inertial sensors, which form three sensor suites (stereo cameras, a monocular camera with an IMU, and stereo cameras with an IMU).
We can easily switch between different sensor combinations.
We highlight the contribution of this paper as follows:
\begin{itemize}
\item a general optimization-based framework for state estimation, which supports multiple sensors.
\item a detailed demonstration of state estimation with visual and inertial sensors, which form different sensor suites (stereo cameras, a monocular camera + an IMU, and stereo cameras + an IMU).
\item an evaluation of the proposed system on both public datasets and real experiments.
\item open-source code for the community.
\end{itemize}
\section{Related Work}
\label{sec:literature}
State estimation has been a popular research topic over the last decades.
A large number of algorithms focus on accurate 6-DoF pose estimation.
We have seen many impressive approaches that work with one kind of sensor, such as visual-based methods \cite{klein2007parallel, ForPizSca1405, engel2014lsd, mur2015orb, engel2017direct}, LiDAR-based methods \cite{zhang2014loam}, RGB-D based methods \cite{kerl2013dense}. and event-based methods \cite{rebecq2017evo}.
Approaches work with a monocular camera is hard to achieve 6-DoF pose estimation, since absolute scale cannot be recovered from a single camera.
To increase the observability and robustness, multiple sensors which have complementary properties are fused together.
There are two trends of approaches for multi-sensor fusion.
One is filter-based methods, the other is optimization-based methods.
Filter-based methods are usually achieved by EKF (Extended Kalman Filter).
Visual and inertial measurements are usually filtered together for 6-DoF state estimation.
A high-rate inertial sensor is used for state propagation and visual measurements are used for the update in \cite{lynen2013robust, bloesch2015robust}.
MSCKF~\cite{MouRou0704,LiMou1305} was a popular EKF-based VIO (Visual Inertial Odometry), which maintained several camera poses and leveraged multiple camera views to form the multi-constraint update.
Filter-based methods usually linearize states earlier and suffer from error induced by inaccurate linear points.
To overcome the inconsistency caused by linearized error, observability constrained EKF \cite{huang2010observability} was proposed to improve accuracy and consistency.
An UKF (Unscented Kalman Filter) algorithm was proposed in \cite{SheMulMic1405}, where visual, LiDAR and GPS measurements were fused together.
UKF is an externsion of EKF without analytic Jacobians.
Filter-based methods are sensitive to time synchronization.
Any late-coming measurements will cause trouble since states cannot be propagated back in filter procedure.
Hence, special ordering mechanism is required to make sure that all measurements from multiple sensors are in order.
Optimization-based methods maintain a lot of measurements and optimize multiple variables at once, which is also known as Bundle Adjustment (BA).
Compared with filter-based method, optimization-based method have advantage in time synchronization.
Because the big bundle serves as a nature buffer, it can easily handle the case when measurments from multiple sensors come in disorder.
Optimization-based algorithms also outperform the filter-based algorithms in term of accuracy at the cost of computational complexity.
Early optimization solvers, such as G2O \cite{kummerle2011g}, leveraged the Gauss-Newton and Levenberg-Marquardt approaches to solve the problem.
Although the sparse structure was employed in optimization solvers, the complexity grown quadratically with the number of states and measurements.
In order to achieve real-time performance, some algorithms have explored incremental solvers, while others bounded the size of the pose graph.
iSAM2 \cite{kaess2012isam2} was an efficient incremental solver, which reused the previous optimization result to reduce computation when new measurements came.
The optimization iteration only updated a small part of states instead of the whole pose graph.
Afterward, an accelerated solver was proposed in \cite{liu2018ice}, which improved efficiency by reconstructing dense structure into sparse blocks.
Methods, that keep a fixed sized of pose graph, are called sliding-window approaches.
Impressive optimization-based VIO approaches, such as~\cite{LeuFurRab1306,mur2017visual,qin2018vins}, optimized variables over a bounded-size sliding window.
The previous states were marginalized into a prior factor without loss of information in \cite{LeuFurRab1306,qin2018vins}.
In this paper, we adopt a sliding-window optimization-based framework for state estimation.
\section{System Overview}
\label{sec:System Overview}
The structure of proposed framework is shown in Fig.~\ref{fig:framework}.
Multiple kinds of sensors can be freely combined.
The mesurement of each sensor is treated as a general factor.
Factors and their related states form the pose graph.
An illustration of pose graph is shown in Fig. \ref{fig:factor_graph2}.
Each node represents states (position, orientation, velocity and so on) at one moment.
Each edge represents a factor, which is derived by one measurement.
Factors constrain one state, two states or multiple states.
For IMU factor, it constrains two consecutive states by continuous motion restriction.
For a visual landmark, its factor constrains multiple states since it is observed on multiple frames.
Once the graph is built, optimizing it equals to finding the configuration of nodes that match all edges as much as possible.
In this paper, we specifically demonstrate the system with visual and inertial sensors.
Visual and inertial sensors can form three combinations for 6-DoF state estimation, which are stereo cameras, a monocular camera with an IMU, and stereo cameras with an IMU.
A graphic illustration of the proposed framework with visual and inertial sensors is shown in Fig. \ref{fig:a_graph}.
Several camera poses, IMU measurements and visual measurements exist in the pose graph.
The IMU and one of cameras are optional.
\begin{figure}
\centering
\includegraphics[width=0.45 \textwidth]{factor_graph2}
\caption{
A graphic illustration of the pose graph. Each node represents states (position, orientation, velocity and so on) at one moment.
Each edge represents a factor, which is derived by one measurement.
Edges constrain one state, two states or multiple states.
\label{fig:factor_graph2}}
\end{figure}
\begin{figure*}
\centering
\includegraphics[width=0.85 \textwidth]{a_graph}
\caption{
A graphic illustration of the proposed framework with visual and inertial sensors.
The IMU and one of cameras are optional.
Therefore, it forms three types (stereo cameras, a monocular camera with an IMU, and stereo cameras with an IMU).
Several camera poses, IMU measurements and visual measurements exist in the pose graph.
\label{fig:a_graph}}
\end{figure*}
\section{Methodology}
\label{sec:algorithm}
\subsection{Problem Definition}
\subsubsection{States}
Main states that we need to estimate includes 3D position and orientation of robot's center.
In addition, we have other optional states, which are related to sensors.
For cameras, depths or 3D locations of visual landmarks need to be estimated.
For IMU, it produces another motion variable, velocity,
Also, time-variant acceleration bias and gyroscope bias of the IMU are needed to be estimated.
Hence, for visual and inertial sensors, whole states we need to estimate are defined as follows:
\begin{equation}
\label{eq:variable}
\begin{split}
\mathcal{X} &=[\mathbf{p}_0, \mathbf{R}_0,\mathbf{p}_1, \mathbf{R}_1,...,\mathbf{p}_n, \mathbf{R}_n,\mathbf{x}_{cam}, \mathbf{x}_{imu}] \\
\mathbf{x}_{cam} & = [\lambda_0, \lambda_1,...,\lambda_l]\\
\mathbf{x}_{imu} & = [\mathbf{v}_0,\mathbf{b}_{a_0}, \mathbf{b}_{g_0}, \mathbf{v}_1,\mathbf{b}_{a_1}, \mathbf{b}_{g_1},... ,\mathbf{v}_n,\mathbf{b}_{a_n}, \mathbf{b}_{g_n}],
\end{split}
\end{equation}
where $\mathbf{p}$ and $\mathbf{R}$ are basic system states, which correspond to position and orientation of body expressed in world frame.
$\mathbf{x}_{cam}$ is camera-ralated state, which includes depth $\lambda$ of each feature observed in the first frame.
$\mathbf{x}_{imu}$ is IMU-ralated variable, which is composed of velocity $\mathbf{v}$, acceleration bias $\mathbf{b}_a$ and gyroscope bias $\mathbf{b}_g$.
$\mathbf{x}_{imu}$ can be omitted if we only use stereo camera without an IMU.
The translation from sensors' center to body's center are assumed to be known, which are calibrated offline.
In order to simplify the notation, we denote the IMU as body's center
(If the IMU is not used, we denote left camera as body's center).
\subsubsection{Cost Function}
The nature of state estimation is an MLE (Maximum Likelihood Estimation) problem.
The MLE consists of the joint probability distribution of robot poses over a period of time.
Under the assumption that all measurements are independent, the problem is typically derived as,
\begin{equation}
\mathcal{X}^* = \argmaxA_{\mathcal{X}} \prod^{n}_{t=0}\prod^{}_{k\in\mathbf{S}} p(\mathbf{z}^k_t|\mathcal{X}),
\end{equation}
where $\mathbf{S}$ is the set of measurements, which come from cameras, IMU and other sensors.
We assume the uncertainty of measurements is Gaussian distributed, $p(\mathbf{z}^k_t|\mathcal{X}) \sim \mathcal{N}(\bar{\mathbf{z}}^k_t, \Omega^k_t)$.
Therefore, the negative log-likelihood of above-mentioned equation is written as,
\begin{equation}
\label{eq:ba}
\begin{split}
\mathcal{X}^* &= \argmaxA_{\mathcal{X}} \prod^{n}_{t=0} \prod^{}_{k\in{\mathbf{S}}} exp(-\frac{1}{2}\left\|\mathbf{z}^k_t - h^k_t(\mathcal{X})\right\|^2_{ \mathbf{\Omega}^k_t}) \\
&= \argminA_{\mathcal{X}} \sum^n_{t=0} \sum^{}_{k\in{\mathbf{S}}}
\left\|\mathbf{z}^k_t - h^k_t(\mathcal{X})\right\|^2_{ \mathbf{\Omega}^k_t}.
\end{split}
\end{equation}
The Mahalanobis norm is defined as $\left \| \mathbf{r} \right\|_\mathbf{\Omega}^2 = \mathbf{r}^T \mathbf{\Omega}^{-1}{\mathbf{r}}$.
$h(\cdot)$ is the sensor model, which is detailed in the following section.
Then the state estimation is converted to a nonlinear least squares problem, which is also known as Bundle Adjustment (BA).
\subsection{Sensor Factors}
\subsubsection{Camera Factor}
The framework supports both monocular and stereo cameras.
The intrinsic parameters of every camera and the extrinsic transformation between cameras are supposed to be known, which can be easily calibrated offline.
For each camera frame, corner features \cite{shi1994good} are detected.
These features are tracked in previous frame by KLT tracker \cite{LucKan8108}.
For the stereo setting, the tracker also matches features between the left image and right image.
According to the feature associations, we construct the camera factor with per feature in each frame.
The camera factor is the reprojection process, which projects a feature from its first observation into following frames.
Considering the feature $l$ that is first observed in the image $i$, the residual for the observation in the following image $t$ is defined as:
\begin{equation}
\label{eq:vision model}
\begin{split}
\mathbf{z}^{l}_t - h^{l}_t(\mathcal{X}) &= \mathbf{z}^{l}_t - h^{l}_t (\mathbf{R}_i, \mathbf{p}_i,\mathbf{R}_t, \mathbf{p}_t, \lambda_l) \\
&=
\begin{bmatrix}
{u}^{l}_t \\
{v}^{l}_t
\end{bmatrix}
-\pi_c(
\inv{\mathbf{T}^b_{c}} \, \inv{ \mathbf{T}_t} \, \mathbf{T}_i \, \mathbf{T}^b_{c} \,
\inv{\pi_c} ( \lambda_l,
\begin{bmatrix}
{u}^{l}_i \\
{v}^{l}_i
\end{bmatrix}
)),
\end{split}
\end{equation}
where $[ {u}^{l}_i , {v}^{l}_i ] $ is the first observation of the $l$ feature that appears in the $i$ image.
$[{u}^{l}_t ,{v}^{l}_t ] $ is the observation of the same feature in the $t$ image.
${\pi}_c$ and ${\pi}^{-1}_c$ are the projection and back-projection functions which depend on camera model (pinhole, omnidirectional or other models).
$\mathbf{T}$ is the 4x4 homogeneous transformation, which is $\begin{bmatrix} \mathbf{R} \,\, \mathbf{p}\\\mathbf{0} \,\, 1 \end{bmatrix}$.
We omit some homogeneous terms for concise expression.
$\mathbf{T}^c_{b}$ is the extrinsic transformation from body center to camera center, which is calibrated offline.
The covariance matrix $\mathbf{\Omega}^l_t$ of reprojection error is a constant value in pixel coordinate, which comes from the camera's intrinsic calibration results.
This factor is universal for both left camera and right camera.
We can project a feature from the left image to the left image in temporal space, also we can project a feature from the left image to the right image in spatial space.
For different cameras, a different extrinsic transformation $\mathbf{T}^c_{b}$ should be used.
\subsubsection{IMU Factor}
We use the well-known IMU preintegration algorithm \cite{qin2018vins, forster2017manifold} to construct the IMU factor.
We assume that the additive noise in acceleration and gyroscope measurements are Gaussian white noise.
The time-varying acceleration and gyroscope bias are modeled as a random walk process, whose derivative is Gaussian white noise.
Since the IMU acquires data at a higher frequency than other sensors, there are usually multiple IMU measurements existing between two frames.
Therefore, we pre-integrate IMU measurements on the manifold with covariance propagation.
The detailed preintegration can be found at \cite{qin2018vins}.
Within two time instants, $t-1$ and $t$, the preintegration produces relative position $\boldsymbol{\alpha}^{{t-1}}_{{t}}$, velocity $\boldsymbol{\beta}^{{t-1}}_{{t}}$ and rotation $\boldsymbol{\gamma}^{{t-1}}_{{t}}$.
Also, the preintegration propagates the covariance of relative position, velocity, and rotation, as well as the covariance of bias.
The IMU residual can be defined as:
\begin{equation}
\begin{split}
&\mathbf{z}^{imu}_t - h^{imu}_t(\mathcal{X}) =
\\
&
\begin{bmatrix}
\boldsymbol{\alpha}^{{t-1}}_{{t}}\\
\boldsymbol{\beta}^{{t-1}}_{{t}}\\
\boldsymbol{\gamma}^{{t-1}}_{{t}}\\
{\mathbf{0}}\\
{\mathbf{0}}\\
\end{bmatrix}
\ominus
\begin{bmatrix}
\inv{\mathbf{R}_{t-1}}(\mathbf{p}_{t} - \mathbf{p}_{{t-1}} + \frac{1}{2}\mathbf{g} dt^2 - \mathbf{v}_{t-1} dt) \\
\inv{\mathbf{R}_{t-1}}(\mathbf{v}_{t} - \mathbf{v}_{{t-1}} + \mathbf{g} dt) \\
\inv{\mathbf{R}_{t-1}} \mathbf{R}_{t}\\
\mathbf{b}_{a_t} - \mathbf{b}_{a_{t-1}}\\
\mathbf{b}_{g_t} - \mathbf{b}_{g_{t-1}}
\end{bmatrix},
\end{split}
\end{equation}
where $\ominus$ is the minus operation on manifold, which is specially used for non-linear rotation.
$dt$ is the time interval between two time instants.
$\mathbf{g}$ is the known gravity vector, whose norm is around $9.81$.
Every two adjacent frames construct one IMU factor in the cost function.
\subsubsection{Other Factors}
Though we only specify camera and IMU factors, our system is not limited to these two sensors.
Other sensors, such as wheel speedometer, LiDAR and Radar, can be added into our system without much effort.
The key is to model these measurements as general residual factors and add these residual factors into cost function.
\subsection{Optimization}
In traditional, the nonlinear least square problem of eq.\ref{eq:ba} is solved by Newton-Gaussian or Levenberg-Marquardt approaches.
The cost function is linearized with respect to an initial guess of states, $\hat{\mathcal{X}}$.
Then, the cost function is equals to:
\begin{equation}
\argminA_{\delta\mathcal{X}} \sum^n_{t=0} \sum^{}_{k\in{\mathbf{S}}}
\left\|
\mathbf{e}^k_t + \mathbf{J}^k_t \delta\mathcal{X}
\right\|^2_{ \mathbf{\Omega}^k_t} ,
\end{equation}
where $\mathbf{J}$ is the Jacobian matrix of each factor with respect to current states $\hat{\mathcal{X}}$.
After linearization approximation, this cost function has closed-form solution of $\delta{\mathcal{X}}$.
We take Newton-Gaussian as example, the solution is derived as follows,
\begin{equation}
\label{eq:hb}
\underbrace{\sum\sum{\mathbf{J}^k_t}^T{\mathbf{\Omega}^k_t}^{-1}\mathbf{J}^k_t}_{\mathbf{H}}
\delta\mathcal{X} =
\underbrace{-\sum\sum{\mathbf{J}^k_t}^T{\mathbf{\Omega}^k_t}^{-1}\mathbf{e}^k_t}_{\mathbf{b}}.
\end{equation}
Finally, current state $\hat{\mathcal{X}}$ is updated with $\hat{\mathcal{X}} \oplus \delta \mathcal{X}$, where $\oplus$ is the plus operation on manifold for rotation.
This procedure iterates several times until convergence.
We adopt Ceres solver\cite{ceres-solver} to solve this problem, which utilizes advanced mathematical tools to get stable and optimal results efficiently.
\subsection{Marginalization}
Since the number of states increases along with time, the computational complexity will increase quadratically accordingly.
In order to bound the computational complexity, marginalization is incorporated without loss of useful information.
Marginalization procedure converts previous measurements into a prior term, which reserves past information.
The set of states to be marginalized out is denoted as $\mathcal{X}_m$, and the set of remaining states is denoted as $\mathcal{X}_r$.
By summing all marginalized factors (eq.\ref{eq:hb}), we get a new $\mathbf{H}$ and $\mathbf{b}$.
After rearrange states' order, we get the following relationship:
\begin{equation}
\begin{bmatrix}
\mathbf{H}_{mm} \, \, \mathbf{H}_{mr}\\
\mathbf{H}_{rm} \, \, \mathbf{H}_{rr}
\end{bmatrix}
\begin{bmatrix}
\delta\mathcal{X}_m\\
\delta\mathcal{X}_r
\end{bmatrix}
=
\begin{bmatrix}
\mathbf{b}_m\\
\mathbf{b}_r
\end{bmatrix}.
\end{equation}
The marginalization is carried out using the Schur complement \cite{SibMatSuk1009} as follows:
\begin{equation}
\underbrace{(\mathbf{H}_{rr}-\mathbf{H}_{rm}\inv{\mathbf{H}_{mm}}\mathbf{H}_{mr})}_{\mathbf{H}_p}
\delta\mathcal{X}_r
=
\underbrace{\mathbf{b}_r - \mathbf{H}_{rm}\inv{\mathbf{H}_{mm}}\mathbf{b}_m}_{\mathbf{b}_p}.
\end{equation}
We get a new prior $\mathbf{H}_p, \mathbf{b}_p$ for the remaining states.
The information about marginalized states is converted into prior term without any loss.
To be specific, we keep ten spacial camera frames in our system.
When a new keyframe comes, we marginalize out the visual and inertial factors, which are related with states of the first frame.
After we get the prior information about current states,
with Bayes' rule, we could calculate the posterior as a product of likelihood and prior: $p(\mathcal{X}|\mathbf{z}) \propto p(\mathbf{z}|\mathcal{X})p(\mathcal{X})$.
The state estimation then becomes a MAP (Maximum A Posteriori) problem.
Denote that we keep states from instant m to instant n in the sliding window.
The states before m are marginalized out and converted to a prior term.
Therefore, the MAP problem is written as:
\begin{equation}
\begin{split}
\mathcal{X}_{m:n}^* &= \argmaxA_{\mathcal{X}_{m:n}} \prod^{n}_{t=m}\prod^{}_{k\in{\mathbf{S}}} p(\mathbf{z}^k_t|\mathcal{X}_{m:n}) \, \, \,p(\mathcal{X}_{m:n}) \\
&= \argminA_{\mathcal{X}_{m:n}} \sum^n_{t=m} \sum^{}_{k\in{\mathbf{S}}}
\left\|\mathbf{z}^k_t - h^k_t(\mathcal{X}_{m:n})\right\|^2_{ \mathbf{\Omega}^k_t} \\
& \qquad \qquad \,\,+(\mathbf{H}_p \delta \mathcal{X}_{m:n} - \mathbf{b}_p).
\end{split}
\end{equation}
Compared with eq.\ref{eq:ba}, the above-mentioned equation only adds a prior term.
It is solved as same as eq.\ref{eq:ba} by Ceres solver\cite{ceres-solver}.
\subsection{Discussion}
The proposed system is a general framework.
Various sensors can be easily added into our system, as long as it can be derived as a general residual factor.
Since our system is not specially designed for a certain sensor, it is capable to handle sensor failure case.
When sensor failure occurs, we just remove factors of the inactive sensor and add new factors from other alternative sensors.
\section{Experimental Results}
\label{sec:experiments}
We evaluate the proposed system with visual and inertial sensors both on datasets and with real-world experiments.
In the first experiment, we compare the proposed algorithm with another state-of-the-art algorithm on public datasets.
We then test our system in the large-scale outdoor environment.
The numerical analysis is generated to show the accuracy of our system in detail.
\subsection{Datasets}
\begin{figure}
\centering
\includegraphics[width=0.5\textwidth]{mh05}
\caption{
Relative pose error \cite{geiger2012we} in MH\_05\_difficult.
Two plots are relative errors in translation and rotation respectively.
\label{fig:mh05}}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=0.5\textwidth]{V202}
\caption{
Relative pose error \cite{geiger2012we} in V2\_02\_medium.
Two plots are relative errors in translation and rotation respectively.
\label{fig:V202}}
\end{figure}
\begin{table}
\centering
\caption{{RMSE[m] in EuRoC dataset.} \label{tab:euroc}}
\begin{tabular}{c c c c c c}
\toprule
\multirow{2}{*}{Sequence} & \multirow{2}{*}{Length} &
\multicolumn{3}{c}{Proposed RMSE} &
{OKVIS } \\
\cline{3-5}
& & stereo & mono+imu &stereo+imu & RMSE \\
\hline
MH\_01 & 79.84 & 0.54 & 0.18 & 0.24 & \textbf{0.16} \\
MH\_02 & 72.75 & 0.46 & \textbf{0.09} & 0.18 & 0.22\\
MH\_03 & 130.58 & 0.33 & \textbf{0.17} & 0.23 & 0.24 \\
MH\_04 & 91.55 & 0.78 & \textbf{0.21} & 0.39 & 0.34\\
MH\_05 & 97.32 & 0.50 & 0.25 & \textbf{0.19} & 0.47\\
V1\_01 & 58.51 & 0.55 & \textbf{0.06} & 0.10 & 0.09\\
V1\_02 & 75.72 & 0.23 & \textbf{0.09} & 0.10 & 0.20\\
V1\_03 & 78.77 & x & 0.18 & \textbf{0.11} & 0.24\\
V2\_01 & 36.34 & 0.23 & \textbf{0.06} & 0.12 & 0.13\\
V2\_02 & 83.01 &0.20 & 0.11 & \textbf{0.10} & 0.16 \\
V2\_03 & 85.23 &x & \textbf{0.26} & 0.27 & 0.29\\
\bottomrule
\end{tabular}
\footnotesize
\end{table}
We evaluate our proposed system using the EuRoC MAV Visual-Inertial Datasets~\cite{Burri25012016}.
This datasets are collected onboard a micro aerial vehicle,
which contain stereo images (Aptina MT9V034 global shutter, 752x480 monochrome, 20 FPS),
synchronized IMU measurements (ADIS16448, 200 Hz),
Also, the ground truth states are provided by VICON and Leica MS50.
We run datasets with three different combinations of sensors, which are stereo cameras, a monocular camera with an IMU, stereo cameras with an IMU separately.
In this experiment, we compare our results with OKVIS~\cite{LeuFurRab1306}, a state-of-the-art VIO that works with stereo cameras and an IMU.
OKVIS is another optimization-based sliding-window algorithm.
OKVIS is specially designed for visual-inertial sensors, while our system is a more general framework, which supports multiple sensors combinations.
We tested the proposed framework and OKVIS with all sequences in EuRoC datasets.
We evaluated accuracy by RPE (Relative Pose Errors) and ATE (Absolute Trajectory Errors).
The RPE is calculated by tools proposed in \cite{geiger2012we}.
The RPE (Relative Pose Errors) plot of two sequences, MH\_05\_difficult and V2\_02\_medium, are shown in Fig.~\ref{fig:mh05} and Fig. \ref{fig:V202} respectively.
The RMSE (Root Mean Square Errors) of ATE for all sequences in EuRoC datasets is shown in Table.~\ref{tab:euroc}.
Estimated trajectories are aligned with the ground truth by Horn's method \cite{horn1987closed}.
The stereo-only case fails in V1\_03\_difficult and V2\_03\_difficult sequences, where the movement is too aggressive for visual tracking to survive.
Methods which involves the IMU work successfully in all sequences.
It is a good case to show that the IMU can dramatically improve motion tracking performance by bridging the gap when visual tracks fail due to illumination change, texture-less area, or motion blur.
From the relative pose error and absolute trajectory error, we can see that the stereo-only method performed worst in most sequences.
Position and rotation drift obviously grown along with distance in stereo-only case.
In other words, the IMU significantly benefited vision in states estimation.
Since the IMU measures gravity vector, it can effectively suppress drifts in roll and pitch angles.
Stereo cameras with an IMU didn't always perform best, because it requires more accurate calibration than the case of a monocular camera with an IMU.
Inaccurate intrinsic and extrinsic calibration will introduce more noise into the system.
In general, multiple sensor fusion increase the robustness of the system.
Our results outperforms OKVIS in most sequences.
\subsection{Real-world experiment}
\begin{figure}
\centering
\includegraphics[width=0.4\textwidth]{device_in_papera}
\caption{
The self-developed sensor suite used in the outdoor environment.
It contains stereo cameras (mvBlueFOX-MLC200w, 20Hz) and DJI A3 controller, which include inbuilt IMU (200Hz) and GPS receiver.
\label{fig:device}}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=0.45\textwidth]{trajectory_a}
\caption{
Estimated trajectories in outdoor experiment.
\label{fig:trajectory_a}}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=0.5\textwidth]{rpe_a}
\caption{
Relative pose error \cite{geiger2012we} in outdoor experiment.
\label{fig:rpe_a}}
\vspace{-0.3cm}
\end{figure}
\begin{table}
\centering
\caption{{RMSE[m] in outdoor experiment.} \label{tab:tab_outdoor}}
\begin{tabular}{c c c c c}
\toprule
\multirow{2}{*}{Sequence} & \multirow{2}{*}{Length} &
\multicolumn{3}{c}{Proposed RMSE} \\
\cline{3-5}
& & stereo & mono+imu &stereo+imu\\
\hline
outdoor1 & 223.70 & 1.85 & 0.71 & \textbf{0.52} \\
outdoor2 & 229.91 & 2.35 & 0.56 & \textbf{0.43} \\
outdoor3 & 232.13 & 2.59 & \textbf{0.65} & 0.75 \\
\bottomrule
\end{tabular}
\end{table}
In this experiment, we used a self-developed sensor suite to demonstrate our framework.
The sensor suite is shown in Fig.~\ref{fig:device}.
It contains stereo cameras (mvBlueFOX-MLC200w, 20Hz) and DJI A3 controller\footnote{\url{http://www.dji.com/a3}}, which inculdes inbuilt IMU (200Hz) and GPS receiver.
The GPS position is treated as ground truth.
We hold the sensor suite by hand and walk around on the outdoor ground.
We run states estimation with three different combinations, which are stereo cameras, a monocular camera with an IMU, and stereo cameras with an IMU.
For accuracy comparison, we walked two circles on the ground and compared our estimation with GPS.
The trajectory is shown in Fig.~\ref{fig:trajectory_a}, and the RPE (Relative Pose Error) is shown in Fig.~\ref{fig:rpe_a}.
As same as dataset experiment, noticeable position drifts occurred in the stereo-only scenario.
With the assistance of the IMU, the accuracy improves a lot.
The RMSE of more outdoor experiments is shown in Table.~\ref{tab:tab_outdoor}.
The method which involves the IMU always performs better than the stereo-only case.
\section{Conclusion}
\label{sec:conclusion}
In this paper we have presented a general optimization-based framework for local pose estimation.
The proposed framework can support multiple sensor combinations, which is desirable in aspect of robustness and practicability.
We further demonstrate it with visual and inertial sensors, which form three sensor suites (stereo cameras, a monocular camera with an IMU, and stereo cameras with an IMU).
Note that although we only show the factor formulations for the camera and IMU, our framework can be generalized to other sensors as well.
We validate the performance of our system with multiple sensors on both public datasets and real-world experiments.
The numerical result indicates that our framework is able to fuse sensor data with different settings.
In future work, we will extend our framework with global sensors (e.g. GPS) to achieve locally accurate and globally aware pose estimation.
\clearpage
| {'timestamp': '2019-01-14T02:20:31', 'yymm': '1901', 'arxiv_id': '1901.03638', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03638'} | arxiv |
\section{Introduction}
In the \prob{Edge Dominating Set}\xspace problem (EDS) we are given a graph $G=(V,E)$ and an integer $k$, and need to determine whether there is a set $F\subseteq E$ of at most $k$ edges that are incident with all (other) edges of $G$. It is known that this is equivalent to the existence of a maximal matching of size at most $k$. The \prob{Edge Dominating Set}\xspace problem is \ensuremath{\mathsf{NP}}\xspace-hard but admits a simple $2$-approximation by taking any maximal matching of $G$. It can be solved in time $\mathcal{O}^*(2.2351^k)$\footnote{$\mathcal{O}^*$-notation hides factors that are polynomial in the input size.}~\cite{IwaideN16}, making it fixed-parameter tractable for parameter $k$. Additionally, for EDS any given instance $(G,k)$ can be efficiently reduced to an equivalent one $(G',k')$ with only $\mathcal{O}(k^2)$ vertices and $\mathcal{O}(k^3)$ edges \cite{XiaoKP13} (this is called a \emph{kernelization}).
The drawback of choosing the solution size $k$ as the parameter is that $k$ is large on many types of easy instances.
This has been addressed for many other problems by turning to so called \emph{structural parameters} that are independent of the solution size. Two lines of research in this direction have yielded polynomial kernels for several other \ensuremath{\mathsf{NP}}\xspace-hard problems. One possibility is to choose the parameter as the size of a set $X$ such that $G-X$ belongs to some class $\ensuremath{\mathcal{C}}\xspace$ where the problem in question can be efficiently solved; such sets $X$ are called \emph{modulators}. The other possibility is to parameterize above some lower bound for the solution, i.e., the parameter is the difference between the solution size $k$ and the lower bound.
The \prob{Vertex Cover}\xspace problem, where, given a graph $G$ and an integer $k$, we are asked whether there are $k$ vertices that are incident with all edges, has been successfully studied under different structural parameters.
It had been observed that \prob{Vertex Cover}\xspace is FPT parameterized by the size of a modulator to a class $\ensuremath{\mathcal{C}}\xspace$ when one can solve vertex cover on graphs that belong to $\ensuremath{\mathcal{C}}\xspace$ in polynomial time; e.g. if $\ensuremath{\mathcal{C}}\xspace$ is the graph class of forests or, more generally, of bipartite or K\H{o}nig graphs.
Furthermore, there also exist kernelizations for \prob{Vertex Cover}\xspace parameterized by modulators to some graph classes $\ensuremath{\mathcal{C}}\xspace$. The first of a number of such results is due to Jansen and Bodlaender~\cite{JansenB13} who gave a kernelization with $\mathcal{O}(\ell^3)$ vertices where $\ell$ is the size of a (minimum) feedback vertex set of the input graph. Clearly, the solution size $k$ cannot be bounded in terms of $\ell$ alone because forests already have arbitrarily large minimum vertex covers. This result has been generalized, e.g., for parameterization by the size of an odd cycle transversal~\cite{KratschW12}.
There are also parameterized algorithms for \prob{Vertex Cover}\xspace above lower bounds that address the specific complaint about the seemingly unnecessarily large parameter value $k$ in many graph classes. It was first shown that \prob{Vertex Cover}\xspace parameterized by $\ell=k-MM$ where $MM$ stands for the size of a maximum matching is FPT~\cite{RamanRS11}. In other words, the parameter value $\ell$ is the difference between $k$ and the obvious lower bound. This has been improved to work also for parameterization by $\ell=k-LP$ where $LP$ stands for the minimum \emph{fractional vertex cover} (as determined by the LP relaxation)~\cite{CyganPPW13,LokshtanovNRRS14} and, recently, even for parameter $\ell=k-(2LP-MM)$~\cite{GargP16}. All of these above lower bound parameterizations of \prob{Vertex Cover}\xspace also have randomized polynomial kernels~\cite{KratschW12,Kratsch16}.
Motivated by the number of positive results for \prob{Vertex Cover}\xspace parameterized by structural parameters we would like to know whether some of these results carry over to the related but somewhat more involved \prob{Edge Dominating Set}\xspace problem.
\subparagraph{Our results.}
For kernelization subject to the size of a modulator to some tractable class $\ensuremath{\mathcal{C}}\xspace$ there is bad news: Even if $\ensuremath{\mathcal{C}}\xspace$ contains only the disjoint unions of paths of length two (consisting of three vertices each) we show that there is no polynomial kernelization for parameterization by $|X|$ with $G-X\in\ensuremath{\mathcal{C}}\xspace$ unless \ensuremath{\mathsf{NP\subseteq coNP/poly}}\xspace (and the polynomial hierarchy collapses). The same is true when $\ensuremath{\mathcal{C}}\xspace$ contains at least all disjoint unions of triangles. Thus, for the usual program of studying modulators to well-known \emph{hereditary} graph classes $\ensuremath{\mathcal{C}}\xspace$ there is essentially nothing left to do because the only permissible connected components would have one or two vertices.\footnote{This very modest case actually admits a polynomial kernelization.} That said, as the next result shows, this perspective would ignore an interesting landscape of positive and negative results that can be obtained by permitting certain forms of connected components in $G-X$ but not necessarily all induced subgraphs thereof, i.e., by dropping the requirement that $\ensuremath{\mathcal{C}}\xspace$ needs to be hereditary (closed under induced subgraphs).
Indeed, there is, e.g., a polynomial kernelization for parameter $|X|$ when all connected components of $G-X$ are paths of length \emph{four}. This indicates that the structure even of constant-sized components permitted in $G-X$ determines in a nontrivial way whether or not there is a polynomial kernelization. Note the contrast with \prob{Vertex Cover}\xspace where a modulator to component size $d$ admits a kernelization with $\mathcal{O}(k^d)$ vertices for each fixed $d$. Naturally, we are interested in finding out exactly which cases admit polynomial kernels.
This brings us to our main result. For $\ensuremath{\mathcal{H}}\xspace$ a set of graphs, say that $G$ is an $\ensuremath{\mathcal{H}}\xspace$-component graph if each connected component of $G$ is isomorphic to some graph in $\ensuremath{\mathcal{H}}\xspace$. We fully classify the existence of polynomial kernels for parameterization by the size of a modulator to the class of $\ensuremath{\mathcal{H}}\xspace$-component graphs for all finite sets $\ensuremath{\mathcal{H}}\xspace$. To clarify, the input consists of $(G,k,X)$ such that $G-X$ is an $\ensuremath{\mathcal{H}}\xspace$-component graph and the task is to determine whether $G$ has an edge dominating set of size at most $k$; the parameter is $|X|$.
Note that these problems are fixed-parameter tractable for all finite sets $\ensuremath{\mathcal{H}}\xspace$ because $G$ has treewidth at most $|X|+\mathcal{O}(1)$.
\begin{theorem}\label{theorem:classification}
For every finite set \ensuremath{\mathcal{H}}\xspace of graphs, the \prob{Edge Dominating Set}\xspace problem parameterized by the size of a given modulator $X$ to the class of $\ensuremath{\mathcal{H}}\xspace$-component graphs falls into one of the following two cases:
\begin{enumerate}
\item It has a kernelization with $\mathcal{O}(|X|^{d})$ vertices, $\mathcal{O}(|X|^{d+1})$ edges, and size $\mathcal{O}(|X|^{d+1}\log |X|)$. Moreover, unless \ensuremath{\mathsf{NP\subseteq coNP/poly}}\xspace, there is no kernelization to size $\mathcal{O}(|X|^{d-\varepsilon})$ for any $\varepsilon>0$. Here $d=d(\ensuremath{\mathcal{H}}\xspace)$ is a constant depending only on the set $\ensuremath{\mathcal{H}}\xspace$.
\item It has no polynomial kernelization unless \ensuremath{\mathsf{NP\subseteq coNP/poly}}\xspace.
\end{enumerate}
\end{theorem}
To obtain the classification one needs to understand how connected components of $G-X$ that are isomorphic to some graph $H\in\ensuremath{\mathcal{H}}\xspace$ can interact with a solution for $G$, and to derive properties of $H$ that can be leveraged for kernels or lower bounds for kernelization. Crucially, edge dominating sets for $G$ may contain edges between $X$ and components of $G-X$. From the perspective of such a component (isomorphic to $H$) this is equivalent to first covering edges incident with some vertex set $B \subseteq V(H)$ (the endpoints of chosen edges to $X$) and then covering the remaining edges by a minimum edge dominating set for $H-B$. Depending on the size of a minimum edge dominating set of $H-B$ and further properties of $H$, such a set $B$ may be used to rule out any polynomial kernels or to give a lower bound of $\mathcal{O}(|X|^{d-\varepsilon})$ for the kernel size, where $d=|B|$. Conversely, absence of such sets or an upper bound for their size can be leveraged for kernels. Some sets $B$ may make others redundant, complicating both upper and lower bounds.
For a given finite set $\ensuremath{\mathcal{H}}\xspace$ of graphs, the lower bound obtained from the classification is simply the strongest one over all $H\in\ensuremath{\mathcal{H}}\xspace$. If this does not already rule out a polynomial kernelization then, for each $H\in\ensuremath{\mathcal{H}}\xspace$, we can reduce the number of components isomorphic to $H$ to $\mathcal{O}(|X|^{d(H)})$ where $d(H)$ depends only on $H$. Moreover, we also have the almost matching lower bound of $\mathcal{O}(|X|^{d(H)-\varepsilon})$, assuming \ensuremath{\mathsf{NP\nsubseteq coNP/poly}}\xspace. The value $d(\ensuremath{\mathcal{H}}\xspace)$ is the maximum over all $d(H)$ for $H\in\ensuremath{\mathcal{H}}\xspace$ that yield such a polynomial lower bound; it can be computed in time depending only on $\ensuremath{\mathcal{H}}\xspace$, i.e., in constant time for each fixed $\ensuremath{\mathcal{H}}\xspace$.
Regarding parameterization above lower bounds, we prove that it is \ensuremath{\mathsf{NP}}\xspace-hard to determine whether a graph $G$ has an edge dominating set of size equal to the lower bound of half the size of a maximum matching. This rules out any positive results for parameter $\ell=k-\frac12MM$.
\subparagraph{Related work.}
The parameterized complexity of \prob{Edge Dominating Set}\xspace has been studied in a number of papers~\cite{Fernau06,FominGSS09,WangCFC09,Xiao10,XiaoKP13,XiaoN13a,EscoffierMPX15,IwaideN16}. Structural parameters were studied, e.g., by Escoffier et al.~\cite{EscoffierMPX15} who obtained an $\mathcal{O}^*(1.821^\ell)$ time algorithm where $\ell$ is the vertex cover size of the input graph, and by Kobler and Rotics~\cite{KoblerR03} who gave a polynomial-time algorithm for graphs of bounded clique-width. It is easy to see that EDS is fixed-parameter tractable with respect to the treewidth of the input graph. Prieto~\cite{Prieto05} was the first to find a kernelization to $\mathcal{O}(k^2)$ vertices for the standard parameterization by $k$; this was improved to $\mathcal{O}(k^2)$ vertices and $\mathcal{O}(k^3)$ edges by Xiao et al.~\cite{XiaoKP13} and further tweaked by Hagerup~\cite{Hagerup12}. Our work appears to be the first to study the existence of polynomial kernels for EDS subject to structural parameters, though some lower bounds, e.g., for parameter treewidth are obvious.
Classically, \prob{Edge Dominating Set}\xspace remains \ensuremath{\mathsf{NP}}\xspace-hard on planar cubic graphs, bipartite graphs with maximum degree three~\cite{YannakakisG80}. This implies \ensuremath{\mathsf{NP}}\xspace-hardness already for $|X|=0$ when considering parameterization by a modulator to any graph class containing this special case. \prob{Edge Dominating Set}\xspace has also been studied from the perspective of approximation~\cite{FujitoN02,ChlebikC06,CardinalLL09,SchmiedV12,EscoffierMPX15}, enumeration~\cite{KanteLMN12,GolovachHKV15,KanteLMNU15}, and exact exponential-time algorithms~\cite{RamanSS07,Xiao10,RooijB12,XiaoN14}.
\subparagraph{Organization.}
We begin with some preliminaries in Section~\ref{section::preliminaries}. Section~\ref{section::lowerbounds} provides some intuition for the main result by proving the lower bound for \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to a $P_3$-component graph as well as the polynomial kernelization for parameterization by the size of a modulator to a $P_5$-component graph. Section~\ref{section::classification} gives a detailed statement of the main result including the required definitions to determine which result applies for any given set $\ensuremath{\mathcal{H}}\xspace$. Section~\ref{section::aboveLB} contains the hardness proof for parameter $\ell=k-\frac12MM$. We conclude in Section~\ref{section::conclusion}.
\section{Preliminaries}\label{section::preliminaries}
We use standard graph notation as given by Diestel~\cite{Diestel12}. In particular, for a graph $G=(V,E)$ we let $N(v)=\{u\in V\mid \{u,v\}\in E\}$ and $N[v]=N(v)\cup\{v\}$; similarly, $N[X]=\bigcup_{x\in X}N[x]$ and $N(X)=N[X]\setminus X$. We let $E(X,Y)=\{\{x,y\}\mid x\in X, y\in Y\}$ and we let $\delta(v)=\{\{u,v\}\mid u\in V, \{u,v\}\in E\}$. By $G[X]$ we denote the induced subgraph of $G$ on vertex set $X$ and by $G-X$ the induced subgraph on vertex set $V\setminus X$; we let $G-v=G-\{v\}$. We denote the size of a minimum edge dominating set of a graph $G$ by $\MEDS(G)$.
Let \ensuremath{\mathcal{H}}\xspace be a set of graphs. We say that a graph $G$ is an \emph{\ensuremath{\mathcal{H}}\xspace-component graph} if each connected component of $G$ is isomorphic to some graph in $\ensuremath{\mathcal{H}}\xspace$. Clearly, disconnected graphs in $\ensuremath{\mathcal{H}}\xspace$ do not affect which graphs $G$ are $\ensuremath{\mathcal{H}}\xspace$-component graphs and, thus, our proofs need only consider the connected graphs $H\in\ensuremath{\mathcal{H}}\xspace$.
We write $H$-component graph rather than $\{H\}$-component graph for single (connected) graphs $H$.
Let $[n]$ denote the set $\{1, 2,\ldots, n\}$.
\subparagraph{Parameterized complexity.}
A \emph{parameterized problem} \ensuremath{\mathcal{Q}}\xspace is a subset of $\Sigma^*\times\ensuremath{\mathbb{N}}\xspace$ where $\Sigma$ is any finite set. The second component $k$ of instances $(x,k)$ is called the \emph{parameter}. A parameterized problem \ensuremath{\mathcal{Q}}\xspace is \emph{fixed-parameter tractable} if there is an algorithm that correctly solves all instances $(x,k)$ in time $f(k)|x|^c$ where $f$ is a computable function and $c$ is a constant independent of $k$. A \emph{kernelization} for \ensuremath{\mathcal{Q}}\xspace is an efficient algorithm that, given an instance $(x,k)$, takes time polynomial in $|x|+k$ and returns an instance $(x',k')$ of size at most $f(k)$ such that $(x,k)\in\ensuremath{\mathcal{Q}}\xspace$ if and only if $(x',k')\in\ensuremath{\mathcal{Q}}\xspace$ where $f$ is a computable function. The function $f$ is also called the \emph{size} of the kernelization and a kernelization is polynomial (resp.\ linear) if $f(k)$ is polynomially (resp.\ linearly) bounded in $k$.
We use the notion of a cross-composition~\cite{BodlaenderJK14}, which is a convenient front-end for the seminal kernel lower bound framework of Bodlaender et al.~\cite{BodlaenderDFH09} and Fortnow and Santhanam~\cite{FortnowS11}. A relation $\ensuremath{\mathcal{R}}\xspace\subseteq\Sigma^*\times\Sigma^*$ is a \emph{polynomial equivalence relation} if equivalence of two strings $x,y\in\Sigma^*$ can be tested in time polynomial in $|x|+|y|$ and if \ensuremath{\mathcal{R}}\xspace partitions any finite set $S\subseteq\Sigma^*$ into a number of classes that is polynomially bounded in the largest element of $S$.
\begin{definition}[(OR-)cross-composition \cite{BodlaenderJK14}]
Let $L\subseteq\Sigma^*$ be a language, let \ensuremath{\mathcal{R}}\xspace be a polynomial equivalence relation on $\Sigma^*$, and let $\ensuremath{\mathcal{Q}}\xspace\subseteq\Sigma^*\times\ensuremath{\mathbb{N}}\xspace$ be a parameterized problem. An \emph{\mbox{(OR-)}cross-composition of $L$ into $\ensuremath{\mathcal{Q}}\xspace$} (with respect to $\ensuremath{\mathcal{R}}\xspace$) is an algorithm that, given $t$ instances $x_1,\ldots,x_t\in\Sigma^*$ of $L$ belonging to the same equivalence class of \ensuremath{\mathcal{R}}\xspace, takes time polynomial in $\sum_{i=1}^t|x_i|$ and outputs an instance $(y,k)\in\Sigma^*\times\ensuremath{\mathbb{N}}\xspace$ such that the following hold:
\begin{itemize}
\item ``PB'': The parameter value $k$ is polynomially bounded in $\max_{i=1}^t |x_i|+\log t$.
\item ``OR'': The instance $(y,k)$ is yes for \ensuremath{\mathcal{Q}}\xspace if and only if \emph{at least one} instance $x_i$ is yes for $L$.
\end{itemize}
An \emph{(OR-)cross-composition of $L$ into $\ensuremath{\mathcal{Q}}\xspace$ of cost $f(t)$} instead satisfies ``OR'' and ``CB'':
\begin{itemize}
\item ``CB'': The parameter value $k$ is bounded by $\mathcal{O}(f(t)\cdot (\max_{i=1}^t|x_i|)^c)$, where $c$ is some constant independent of $t$.
\end{itemize}
\end{definition}
If $L$ is \ensuremath{\mathsf{NP}}\xspace-hard then both forms of cross-compositions are known to imply lower bounds for kernelizations for $\ensuremath{\mathcal{Q}}\xspace$. Theorem~\ref{theorem:polynomiallowerbound} additionally builds on Dell and van Melkebeek~\cite{DellM14}.
\begin{theorem}[{\cite[Corollary 3.6.]{BodlaenderJK14}}]\label{theorem:kernellowerbound:crosscomposition}
If an \ensuremath{\mathsf{NP}}\xspace-hard language L has a cross-composition to \ensuremath{\mathcal{Q}}\xspace then \ensuremath{\mathcal{Q}}\xspace admits no polynomial kernelization or polynomial compression unless \ensuremath{\mathsf{NP\subseteq coNP/poly}}\xspace.
\end{theorem}
\begin{theorem}[{\cite[Theorem 3.8.]{BodlaenderJK14}}]\label{theorem:polynomiallowerbound}
Let $d,\varepsilon>0$. If an \ensuremath{\mathsf{NP}}\xspace-hard language L has a cross-composition into \ensuremath{\mathcal{Q}}\xspace of cost $f(t)=t^{1/d+o(1)}$, where $t$ is the number of instances, then \ensuremath{\mathcal{Q}}\xspace has no polynomial kernelization or polynomial compression of size $\mathcal{O}(k^{d-\varepsilon})$ unless \ensuremath{\mathsf{NP\subseteq coNP/poly}}\xspace.
\end{theorem}
All our composition-based proofs use for $L$ the \ensuremath{\mathsf{NP}}\xspace-hard \prob{Multicolored Clique}\xspace problem. Therein we are given a graph $G=(V,E)$, an integer $k$, and a partition of $V$ into $k$ sets $V_1,\ldots,V_k$ of equal size; we need to determine whether there is a clique of size $k$ in $G$ that contains exactly one vertex from each set $V_i$. Such a set $X$ is called a \emph{multicolored $k$-clique}.
\section[EDS parameterized by the size of a modulator to a P3- resp. P5-component graph]{EDS parameterized by the size of a modulator to a $\boldsymbol{P_3}$- resp.\ $\boldsymbol{P_5}$-component graph}\label{section::lowerbounds}
In this section we study the difference of \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to a $P_3$-component graph and \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to a $P_5$-component graph, which are both more restrictive than parameterization by size of a feedback vertex set (modulator to a forest). Note that the latter is FPT, because the treewidth is at most the size of the feedback vertex set plus one and \prob{Edge Dominating Set}\xspace parameterized by the treewidth is FPT. Hence, \prob{Edge Dominating Set}\xspace parameterized by the above modulators is FPT too.
First, we show that \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to a $P_3$-component graph has no polynomial kernel unless $\ensuremath{\mathsf{NP\subseteq coNP/poly}}\xspace$. This rules out polynomial kernels for a large number of interesting parameters like feedback vertex set size or size of a modulator to a linear forest.
Somewhat surprisingly, we then show that when parameterized by the modulator to a $P_5$-component graph we do get a polynomial kernel.
\subsection[Lower bound for EDS parameterized by the size of a modulator to a P3-component graph]{Lower bound for EDS parameterized by the size of a modulator to a $\boldsymbol{P_3}$-component graph}
We give a kernelization lower bound for \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator $X$, such that deleting $X$ results in a disjoint union of $P_3$'s. To prove this we give a cross-composition from \prob{Multicolored Clique}\xspace.
\begin{theorem} \label{theorem::P3}
\prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to a $P_3$-component graph (and thus also parameterized by the size of a modulator to a linear forest) does not admit a polynomial kernel unless $\ensuremath{\mathsf{NP\subseteq coNP/poly}}\xspace$.
\end{theorem}
\begin{proof}
To prove the theorem we give a cross-composition from the \ensuremath{\mathsf{NP}}\xspace-hard \prob{Multicolored Clique}\xspace problem to \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to a $P_3$-component graph. Input instances are of the form $(G_i,k_i)$ where $G_i$ comes with a partition of the vertex set into $k$ color classes. (Since the color classes are of equal size it holds that $k \leq |V(G_i)|$.)
For the polynomial equivalence relation $\mathcal{R}$ we take the relation that puts two instances $(G_1,k_1)$, $(G_2,k_2)$ of \prob{Multicolored Clique}\xspace in the same equivalence class if $k_1=k_2$ and $|V(G_1)|=|V(G_2)|$. It is easy to check that $\mathcal{R}$ is a polynomial equivalence relation. (Instances with size at most $N$ have at most $N$ vertices. Thus, we get at most $N^2$ classes for instances of size at most $N$.)
Let a sequence of instances $I_i=(G_i,k)_{i=1}^{t}$ of \prob{Multicolored Clique}\xspace be given that are equivalent under $\mathcal{R}$.
We identify the color classes of the input graphs so that all graphs have the same vertex set $V$ and the same color classes $V_1, V_2, \ldots, V_k$. Let $n:=|V_i|$ be the number of vertices of each color class; thus, each instance has $|V|=n\cdot k$ vertices. We assume w.l.o.g.\ that every instance has at least one edge in $E(V_p,V_q)$ for all $1 \leq p < q \leq k$; otherwise, this instance would be a trivial no instance and we can delete it. Furthermore, we can assume w.l.o.g.\ that $t=2^s$ for an integer $s$, since we may copy some instances if needed (while at most doubling the number of instances and increasing $\log t$ by less than one).
\begin{figure}[t]
\centering
\begin{tikzpicture}[scale=1, transform shape]
\node[draw, ellipse, minimum width=3cm, minimum height=0.5cm] (Z') at (0,0)[label=right:$Z'$] {};
\node[draw, ellipse, minimum width=3cm, minimum height=0.5cm] (Z) at (0,-1) [label=right:$Z$] {};
\node[draw, rectangle, rounded corners, minimum width=6cm, minimum height=0.7cm] (W) at (0,-2) [label=right:$W$] {};
\node[draw, rectangle, minimum width=12cm, minimum height=4cm, fill, color=bgray] at (0,-4.5) [] {};
\foreach \i/\j/\place in {0/1/left,1/2/left,2/3/left,3/4/left,5/{t-1}/left,6/{t}/left}
\node[draw, rectangle, minimum width=1cm, minimum height=3cm] (I_\i) at (1.6*\i-4.8,-4.5) [label=\place:$I_{\j}$] {};
\node at (1.6*5-6.7,-4.5) {$\ldots$};
\node[draw, rectangle, rounded corners, minimum width=4cm, minimum height=1cm] (V) at (-2.5,-7.5) [label=left:$V$] {};
\node[draw, rectangle, rounded corners, minimum width=4cm, minimum height=0.55cm] (S) at (2.5,-7.12) [label=right:$S$] {};
\node[draw, rectangle, rounded corners, minimum width=4cm, minimum height=0.55cm] (S) at (2.5,-7.88) [label=right:$S'$] {};
\node[draw, ellipse, minimum width=3cm, minimum height=0.5cm] (T) at (-2.5,-9) [label=left:$T$] {};
\node[draw, ellipse, minimum width=3cm, minimum height=0.5cm] (T') at (-2.5,-10) [label=left:$T'$] {};
\foreach \i in {-2,-1,...,3}{
\node[draw, circle, inner sep=1pt, fill] (zp_\i) at (0.5*\i-0.25,0) {};
\node[draw, circle, inner sep=1pt, fill] (z_\i) at (0.5*\i-0.25,-1) {};
\draw (zp_\i) -- (z_\i);}
\foreach \i in {-2,-1,...,1}{
\node[draw, circle, inner sep=1pt, fill] (t_\i) at (0.5*\i -2.5+0.25,-9) {};
\node[draw, circle, inner sep=1pt, fill] (tp_\i) at (0.5*\i -2.5+0.25,-10) {};
\draw (t_\i) -- (tp_\i);
}
\foreach \j in {-5,-4,...,6}{
\node[draw, circle, inner sep=1pt, fill] (w_\j) at (0.5*\j -0.25,-2) {};
\foreach \i in {-2,-1,...,3}{
\draw (z_\i) -- (w_\j);}}
\foreach \j in {-5,-4,...,6}{
\node[draw, circle, inner sep=1pt, fill] (v_\j) at (0.3*\j -2.65,-7.5) {};
}
\foreach \i in {-2,-1,...,1}{
\foreach \j in {0,1,2}{
\pgfmathtruncatemacro{\number}{3 *\i +1 +\j};
\draw (t_\i) -- (v_\number);}}
\foreach \j in {1,2,...,6}{
\node[draw, circle, inner sep=1pt, fill] (s1_\j) at (0.7*\j +0.05,-7.1) {};
\node[draw, circle, inner sep=1pt, fill] (s2_\j) at (0.7*\j +0.05,-7.9) {};
\draw (s1_\j) -- (s2_\j);
}
\foreach \i in {0,1,2,3,5,6}{
\foreach \j in {1,3,7,9}{
\node[draw, circle, inner sep=1pt, fill] (x_\i_\j) at (1.6*\i +1.2-6.25,-3-0.3*\j) {};
\node[draw, circle, inner sep=1pt, fill] (e_\i_\j) at (1.6*\i +1.2-6,-0.3*\j-3) {};
\node[draw, circle, inner sep=1pt, fill] (y_\i_\j) at (1.6*\i +1.2-5.75,-3-0.3*\j) {};
\draw (x_\i_\j) -- (e_\i_\j);
\draw (y_\i_\j) -- (e_\i_\j);}
\node at (1.6*\i +1.2-6,-2.6-0.3*6) {$\vdots$};
}
\foreach \i in {-5,-4,...,0}{
\draw[color=lgray] (w_\i) -- (x_0_1);
\draw[color=lgray] (w_\i) -- (x_0_3);}
\foreach \i in {-5,-4,-3,5,6}{
\draw[color=lgray] (w_\i) -- (x_3_1);
\draw[color=lgray] (w_\i) -- (x_3_3);}
\draw[color=lgray] (x_0_9) -- (v_-1);
\draw[color=lgray] (x_0_9) -- (v_1);
\draw[color=lgray] (e_0_9) -- (s1_1);
\draw[color=lgray] (x_0_7) -- (v_-5);
\draw[color=lgray] (x_0_7) -- (v_-2);
\draw[color=lgray] (e_0_7) -- (s1_2);
\draw[color=lgray] (x_3_9) -- (v_3);
\draw[color=lgray] (x_3_9) -- (v_5);
\draw[color=lgray] (e_3_9) -- (s1_3);
\draw[color=lgray] (x_3_7) -- (v_0);
\draw[color=lgray] (x_3_7) -- (v_1);
\draw[color=lgray] (e_3_7) -- (s1_1);
\foreach \k in {40,60,...,140}{
\foreach \i in {1,2,5,6}{
\foreach \j in {1,3,7,9}{
\draw[color=lgray] (x_\i_\j) -- +(\k:0.23);}}
\foreach \i in {0,3}{
\foreach \j in {7,9}{
\draw[color=lgray] (x_\i_\j) -- +(\k:0.23);}}
}
\foreach \k in {260,290}{
\foreach \i in {1,2,5,6}{
\foreach \j in {1,3,7,9}{
\draw[color=lgray] (x_\i_\j) -- +(\k:0.23);
\draw[color=lgray] (e_\i_\j) -- +(-30-15*\i:0.23);}}
\foreach \i in {0,3}{
\foreach \j in {1,3}{
\draw[color=lgray] (x_\i_\j) -- +(\k:0.23);
\draw[color=lgray] (e_\i_\j) -- +(-30-15*\i:0.23);}}
}
\end{tikzpicture}
\caption{Construction of the graph $G'$ with $k=4$, where $X'=W \cup Z \cup Z' \cup V \cup T \cup T' \cup S\cup S'$}
\label{figure::lower_bound}
\end{figure}
Now, we construct an instance $(G',k',X')$ of \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to a $P_3$-component graph, where the size of $X'$ is polynomially bounded in $n+k+s$ (see Figure \ref{figure::lower_bound} for an illustration).
We add a set $V$ consisting of $k \cdot n$ vertices to graph $G'$ which represents the vertices of the $t$ instances. The set $V$ is partitioned into the $k$ color classes $V_1,V_2,\ldots, V_k$. To choose which vertices are contained in a clique of size $k$, we add a set $T=\{t_1,t_2,\ldots,t_k\}$ and a set $T'=\{t_1',t_2',\ldots,t_k'\}$, each of size $k$, to $G'$. We make $t_j \in T$, with $j \in [k]$, adjacent to all vertices in $V_j$ and to vertex $t_j' \in T'$.
Next, we add two sets $Z$, $Z'$, each of size $s$, and a set $W$ of size $2s$ to $G'$ and add edges to $G'$ such that each vertex in $Z$ has exactly one private neighbor in $Z'$ and is adjacent to all vertices in $W$. The set $W$ contains $\binom{2s}{s} \geq 2^s$ different subsets of size $s$. For each instance $(G_i,k)$, with $i \in [t]$, we pick a different subset of size $s$ of $W$ and denote it by $W(i)$.
For all $1\leq p<q \leq k$ we add a vertex $s_{p,q}$ and a vertex $s_{p,q}'$ to $G'$; these will correspond to edge sets $E(V_p,V_q)$. Let $S=\{s_{p,q} \mid 1\leq p < q \leq k\}$ and $S'=\{s_{p,q}' \mid 1 \leq p < q \leq k\}$. We make vertex $s_{p,q}$ adjacent to vertex $s_{p,q}'$ for all $1 \leq p < q \leq k$.
For each graph $G_i$, for $i \in [t]$, we add $|E(G_i)|$ paths of length two to the graph $G'$; every $P_3$ represents exactly one edge of the graph $G_i$. Let $P_i^e=u_{i,1}^e u_i^e u_{i,2}^e$ denote the path of instance $i \in [t]$ that represents edge $e \in E(G_i)$.
Finally, we make vertices in $P_i^e$, with $i \in [t]$ and $e \in E(G_i)$, adjacent to vertices in the sets $W$, $V$, and $S$ as follows:
We make vertex $u_{i,1}^e$ of path $P_i^e$, with $i \in [t]$, which represents edge $e=\{x,y\} \in E(G_i)$ adjacent to the vertices $x,y$ in $V$ and to all vertices in the set $W(i) \subseteq W$. Additionally, we make vertex $u_i^e$ adjacent to vertex $s_{p,q}$ where $1 \leq p < q \leq k$ such that $e \in E(V_p,V_q)$.
The set $X'$ is defined to contain all vertices that do not participate in the paths $P_i^e$, i.e., $X'=W \cup Z \cup Z' \cup V \cup T \cup T' \cup S\cup S'$. Clearly, $G-X'$ is a $P_3$-component graph and $|X'|=4s+k \cdot n+2k+2\cdot\binom{k}{2}$. Let $k'=k+s+\sum_{i=1}^t |E(G_i)|$. Note that the size of $k'$ can depend linearly on the number of instances, because our parameter is the size of $X'$, which is polynomially bounded in $n+s$, as $k\leq n$.
We return the instance $(G',k',X')$; clearly, this instance can be generated in polynomial time.
Now, we have to show that $(G',k',X')$ is a $\mathrm{YES}$-instance of \prob{Edge Dominating Set}\xspace if and only if there exists an $i^* \in [t]$ such that $(G_{i^*},k)$ is a $\mathrm{YES}$-instance of \prob{Multicolored Clique}\xspace.
$(\Rightarrow:)$ Assume first that $(G',k',X')$ is yes for EDS and that there exists an edge dominating set $F$ of size at most $k'$ in $G'$.
We can always pick $F$ such that it fulfills the following properties (most hold for all solutions of size at most $k'$):
%
\begin{enumerate}
\item The vertex sets $S$, $T$, and $Z$ must be subsets of $V(F)$: E.g., for each edge $\{z,z'\}$ with $z\in Z$ and $z'\in Z'$ the set $V(F)$ must contain $z$ or $z'$; if it contains $z'$ then $\{z,z'\}\in F$ as it is the only edge incident with $z'$; either way we get $z\in V(F)$. The same applies for $S$ and $S'$, and for $T$ and $T'$.
\item Because $S,T,Z\subseteq V(F)$ but $S\cup T\cup Z$ is an independent set, the set $F$ must contain at least $|S|$ edges incident with $S$, $|T|$ edges incident with $T$, and $|Z|$ edges incident with $Z$. By straightforward replacement arguments we may assume that $F$ contains exactly the following edges incident with $S\cup T\cup Z$: $|T|$ edges between $T$ and $V$, $|Z|$ edges between $Z$ and $W$, and $|S|$ edges between $S$ and middle vertices $u_i^e$ of $P_3$'s in $G'-X'$. Furthermore, we can assume that these edges are a matching, because no color class is empty, no edge set $E(V_p,V_q)$ is empty, and $Z$ is adjacent to all vertices in $W$.
\item For each $P_i^e=u^e_{i,1} u^e_i u^e_{i,2}$, which represents the edge $e$ of instance $(G_i,k)$, at least vertex $u^e_i$ must be an endpoint of an edge in $F$: Indeed, to cover the edge $\{u^e_i,u^e_{i,2}\}$ one of its two vertices must be in $V(F)$. Similar to Property 1 above, if $u^e_{i,2}\in V(F)$ then $F$ must contain its sole incident edge $\{u^e_i,u^e_{i,2}\}$ and, hence, $u^e_i\in V(F)$.
\item An edge in $F$ cannot have its endpoints in two different $P_3$'s of $G'-X'$ because no such edges exist.
\end{enumerate}
%
Let $F_T=F \cap E(T,V)$, let $F_Z=F \cap E(Z,W)$, let $F_S=F \cap E(S, \{u^e_i\mid i\in[t], e\in E(G_i)\})$, and let $F_R=F \setminus (F_T \cup F_Z \cup F_S)$. Hence, due to Properties 1 and 2, we have
\[
|F_R| \leq k' - |F_T| -|F_Z| - |F_S|\leq \sum_{i=1}^t |E(G_i)| - \binom{k}{2}.
\]
By Property 3, all vertices $u^e_i$ are endpoints of edges in $F$. Among $F_T\cup F_Z\cup F_S$ this can only be true for the $|S|=\binom{k}{2}$ edges in $F_S$. Since there are exactly $\sum_{i=1}^t |E(G_i)|$ vertices $u^e_i$, which is (greater or) equal to $|F_R|+|F_S|$, and there are no edges connecting different such vertices, each edge in $F_R\cup F_S$ is incident with a private vertex $u^e_i$. This also implies that all edges in $F_R$ have no endpoints in $V\cup W$ as those sets are not adjacent to any vertex $u^e_i$.
Thus, in $W$ exactly the $|Z|=s$ endpoints of $F_Z$ are endpoints of $F$. Similarly, in $V$ exactly the $|T|=k$ endpoints of $F_T$ are endpoints of $F$; let $X\subseteq V$ denote this set of $k$ vertices. Observe that by construction of $G'$ the set $X$ contains exactly one vertex from each color class, because $t_j \in T$, for $j \in [k]$, is only adjacent to vertices of $V_j$.
Now, consider any path $P_i^e=u^e_{i,1} u^e_i u^e_{i,2}$ where $u_i^e$ is an endpoint of an edge $f\in F_S$. Clearly, the other endpoint of $f$ lies in $S$, and, by the above accounting, no other edge of $F$ is incident with $u^e_{i,1}$ or $u^e_{i,2}$. In particular, this implies that all neighbors of $u^e_{i,1}$ in $W$ and $V$ must be endpoints of edges in $F$. If $e=\{x,y\}$ then these neighbors of $u^e_{i,1}$ are the set $W(i)\subseteq W$ and the vertices $x,y\in V$, and, by construction of $G'$, the edge $\{x,y\}$ must exist in $G_i$. Thus, $W(i) \cup \{x,y\} \subseteq V(F)$ which implies that $x,y \in X$.
Repeating this argument for all $|S|=\binom{k}{2}$ paths of this type, we can conclude the following: (1) All paths correspond to the same instance $i^*\in[t]$ because we require $W(i)\subseteq V(F)$, but exactly $|Z|=|W(i^*)|=s$ such vertices are in $V(F)$. (Different values of $i$ would require different sets $W(i)$, exceeding size $s$.) (2) There are $\binom{k}{2}$ edges of $G_{i^*}$ represented by the paths and all their endpoints must be in $X=V\cap V(F)$. Since $|X|=k$, the edges must form a clique of size $k$ on vertex set $X$ in $G_{i^*}$. We already observed above that $X$ contains exactly one vertex per color class, hence, instance $(G_{i^*},k)$ is yes, as claimed.
$(\Leftarrow:)$
For the other direction, assume that for some $i^* \in [t]$ the \prob{Multicolored Clique}\xspace instance $(G_{i^*},k)$ is a $\mathrm{YES}$-instance. Let $X=\{x_1,x_2,\ldots,x_k\} \subseteq V$ be a multicolored clique of size $k$ in $G_{i^*}$ with $x_j \in V_j$ for $j \in [k]$, let $E'$ be the set of edges of the clique $X$, and let $e_{p,q}=\{x_p,x_q\}$ for $1\leq p < q \leq k$. We construct an edge dominating set $F$ of $G'$ of size at most $k'$ as follows:
First we add the $k$ edges $\{t_j,x_j\}$ for $j \in [k]$ between $T$ and $X\subseteq V$; thus, $T\cup X\subseteq V(F)$. We then add a maximum matching (of size $s$) between $W(i^*) \subseteq W$ and $Z$ to the set $F$. This matching saturates $W(i^*)$ and $Z$ because $|Z|=|W(i^*)|=s$; thus, $W(i^*)\cup Z\subseteq V(F)$. Next, we add the edges $\{u^{e_{p,q}}_{i^*},s_{p,q}\}$ for all edges $e_{p,q} \in E'$, with $1\leq p < q \leq k$, to the set $F$; hence $S \subseteq V(F)$. Finally, for all other paths $P_i^e$, with $i \in [t]$, $e \in E(G_i)$, and $i \neq i^*$ or $e \notin E'$, we add the edge $\{u^e_{i,1}, u^e_i\}$ to $F$. (We have thus selected exactly one edge incident with each path of $G'-X'$.) By construction, it holds that $|F|=k+s+ \sum_{i=1}^t |E(G_i)| = k'$.
It remains to show that $F$ is indeed an edge dominating set of $G'$. To prove this, it suffices to show that $V(G')-V(F)$ is an independent set in $G'$. We already know that $S\cup T\cup W(i^*)\cup X\cup Z\subseteq V(F)$. Moreover, $V(F)$ contains the middle vertex $u^e_i$ for all $P_3$'s in $G'-X'$ and it contains $u_{i,1}^e$ for all $P_3$'s that do not correspond to an edge of the clique $X$ (i.e., with $i\neq i^*$ or with $i=i^*$ but $e\neq e_{p,q}$ for any $1\leq p<q\leq k$). The sets $S'$, $T'$, and $Z'$ are independent sets whose neighborhoods $S$, $T$, and $Z$ are subsets of $V(F)$. Similarly, all vertices $u_{i,2}^e$ have their single neighbor $u^e_i$ in $V(F)$. Thus, only vertices in $W\setminus W(i^*)$ and $V\setminus X$ could possibly be adjacent to vertices $u_{i^*,1}^{e_{p,q}}$, which correspond to the edges of $G_{i^*}[X]$, in $G'-V(F)$, but this can be easily refuted: Indeed, each $u_{i^*,1}^{e_{p,q}}$ is adjacent only to $x_p$ and $x_q$ in $V$, which are both in $X\subseteq V(F)$, and to the vertices in $W(i^*)$ in $W$, but $W(i^*)\subseteq V(F)$ as well. Thus $V(G')-V(F)$ is an independent set in $G'$ and hence $F$ is an edge dominating set for $G'$ of size at most $k'$. Thus, $(G',k',X')$ is yes, which completes the cross-composition.
By Theorem~\ref{theorem:kernellowerbound:crosscomposition} the cross-composition from \prob{Multicolored Clique}\xspace implies the claimed lower bound for kernelization.
\end{proof}
We proved that \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to a $P_3$-component graph has no polynomial kernelization unless \ensuremath{\mathsf{NP\subseteq coNP/poly}}\xspace. A similar proof establishes the same lower bound for modulators to $K_3$-component graphs. As mentioned in the introduction this rules out polynomial kernels using modulators to essentially all interesting hereditary graph classes.\footnote{It certainly does completely settle the question for modulators to $\ensuremath{\mathcal{H}}\xspace$-component graphs for all \emph{hereditary} classes $\ensuremath{\mathcal{H}}\xspace$. If $\ensuremath{\mathcal{H}}\xspace$ contains any connected graph with at least three vertices then we get a lower bound; else all connected components have one or two vertices and there is a polynomial kernel.}
\subsection[Polynomial kernel for EDS parameterized by the size of a modulator to a P5-component graph]{Polynomial kernel for EDS parameterized by the size of a modulator to a $\boldsymbol{P_5}$-component graph}
To illustrate why other, non-hereditary, sets $\ensuremath{\mathcal{H}}\xspace$ may well allow polynomial kernels for parameterization by the size of a modulator $X$ to an $\ensuremath{\mathcal{H}}\xspace$-component graph, we sketch a simple kernelization for the case of $\ensuremath{\mathcal{H}}\xspace=\{P_5\}$, i.e., when components of $G-X$ are isomorphic to the path of length four. This does not use the full generality of the kernelization obtained in Section \ref{section::classification} because $P_5$ does not have any (later called) uncovered vertices or (later called) strongly beneficial sets (which are the main source of complication).
For the kernelization we need the following theorem which is due to Hopcroft and Karp \cite{DBLP:journals/siamcomp/HopcroftK73}. The second claim of the theorem is not standard (but well known).
\begin{theorem}[\cite{DBLP:journals/siamcomp/HopcroftK73}] \label{theorem::matching}
Let $G$ be an undirected bipartite graph with partition $R$ and $S$, on $n$ vertices and $m$ edges. Then we can find a maximum matching of $G$ in time $\mathcal{O}(m \sqrt{n})$. Furthermore, in time $\mathcal{O}(m \sqrt{n})$ we can find either a maximum matching that saturates $R$ or a set $Y \subseteq R$ such that $|N_G(Y)|<|Y|$ and such that there exists a maximum matching $M$ in $G - N_G[Y]$ that saturates $R \setminus Y$.
\end{theorem}
\begin{theorem} \label{theorem::kernel_P5}
\prob{Edge Dominating Set}\xspace parameterized by the size of a given modulator $X$ to a $P_5$-component graph admits a kernel with $\mathcal{O}(|X|)$ vertices.
\end{theorem}
\begin{proof}
Let $(G,k,X)$ be an instance of \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to a $P_5$-component graph, and let $\ensuremath{\mathcal{C}}\xspace$ be the set of connected components of $G-X$.
We construct a bipartite graph $G_B$ where one part is the set $X$, the other part consists of one vertex $s_P$ for every connected component $P$ in $\ensuremath{\mathcal{C}}\xspace$, and where there is an edge between $x \in X$ and $s_P$ with $P=w_1w_2w_3w_4w_5 \in \ensuremath{\mathcal{C}}\xspace$ if and only if $x$ is adjacent to a vertex of $P$ that is not the middle vertex $w_3$. Now, we apply Theorem~\ref{theorem::matching} to obtain either a maximum matching in $G_B$ that saturates $X$ or a set $Y \subseteq X$ such that $|N_{G_B}(Y)| < |Y|$ and such that there exists a maximum matching in $G_B - N_{G_B}[Y]$ that saturates $X \setminus Y$. If there exists a maximum matching in $G_B$ that saturates $X$ then let $X_1=X$ and $X_2 = \emptyset$. Otherwise, if there exists a set $Y$ with the above properties then let $X_1=X \setminus Y$ and $X_2 = Y$. Observe that $X_2$ also contains the vertices in $X$ that are only adjacent to middle vertices of components in $\ensuremath{\mathcal{C}}\xspace$, and the vertices in $X$ that are not adjacent to any component in $\ensuremath{\mathcal{C}}\xspace$. Let $M$ be a maximum matching in $G_B-N_{G_B}[X_2]$ that saturates $X_1$. The partition $X_1 \dot\cup X_2$ of $X$ fulfills the following properties:
\begin{itemize}
\item Let $\ensuremath{\mathcal{C}}\xspace_2$ be the set of connected components $P$ in $\ensuremath{\mathcal{C}}\xspace$ where $s_P$ is a vertex in $N_{G_B}(X_2)$, i.e., $\ensuremath{\mathcal{C}}\xspace_2=\{P=w_1w_2w_3w_4w_5 \in~\ensuremath{\mathcal{C}}\xspace \mid N_G(\{w_1,w_2,w_4,w_5\}) \cap X_2 \neq \emptyset\}$.
It holds either that $\ensuremath{\mathcal{C}}\xspace_2$ is the empty set (when $X_2 = \emptyset$) or that it contains less than $|X_2|$ connected components of $\ensuremath{\mathcal{C}}\xspace$, i.e., $|\ensuremath{\mathcal{C}}\xspace_2|< |X_2|$ (when $Y=X_2 \neq \emptyset$).
\item For every vertex $x \in X_1$, let $P_x=w_1^xw_2^xw_3^xw_4^xw_5^x$ be the connected component in $\ensuremath{\mathcal{C}}\xspace_1:=\ensuremath{\mathcal{C}}\xspace \setminus \ensuremath{\mathcal{C}}\xspace_2$ that is paired to $x$ by $M$, i.e., $\{x,s_{P_x}\} \in M$. It holds that there exists a vertex $w^x \in \{w_1^x,w_2^x,w_4^x,w_5^x\}$ such that $\{w^x,x\} \in E(G)$ (definition of $G_B$). Note that $\ensuremath{\mathcal{C}}\xspace_1$ also contains all connected components that are not adjacent to any vertex in $X$ or where only the middle vertex of a path in $\ensuremath{\mathcal{C}}\xspace$ is adjacent to a vertex in $X$.
\end{itemize}
Using the above partition, one can show that there exists an optimum solution $S$ that contains for each path $P_x$ with $x \in X_1$ the locally optimal solution $\{\{x,w^x\},\{w_3^x,w_2^x\}\}$ resp.\ $\{\{x,w^x\},\{w_3^x,w_4^x\}\}$ depending on whether $w^x \in \{w_4^x,w_5^x\}$ or $w^x \in \{w_1^x,w_2^x\}$. More generally, for every vertex $w$ of a path $P \in \ensuremath{\mathcal{C}}\xspace$, except the middle vertex, and every vertex $x \in X$ that is adjacent to $w$ there exists a local optimum solution to $P$ that uses edge $\{w,x\}$ and has the middle vertex of $P$ as an endpoint of the second solution edge.
This is the crucial difference to a path $P'=v_1v_2v_3$ of length two. Here, the only locally optimal solution that dominates $P'$ and contains an edge between $P'$ and $X$ is $\{\{v_2,x\}\}$ with $x \in X$, but this local solution does not contain the vertices $v_1$ and $v_3$. We used this in our lower bound construction to control which $P_3$'s may be used to ``buy'' vertices in $X$.
\begin{redrule} \label{rule::P5_X}
Delete $X_1$ from $G$, i.e., let $G'=G-X_1$, $X'=X \setminus X_1=X_2$, and $k'=k$.
\end{redrule}
\begin{claim}
Reduction Rule~\ref{rule::P5_X} is safe.
\end{claim}
\begin{claimproof}
Let $F$ be an edge dominating set of size at most $k$ in $G$. We construct an edge dominating set $F'$ of size at most $k'=k$ in $G'$ by deleting every edge $e=\{x,y\} \in F$ if both endpoints of $e$ are contained in $X_1$, or if exactly one endpoint is contained in $X_1$ and the other endpoint is isolated in $G'$; and by replacing every edge $e=\{x,y\} \in F$ with $x \in X_1$ and $y \notin X_1$ by exactly one edge in $\delta_{G'}(y)$ if $\delta_{G'}(y) \neq \emptyset$.
It holds that $F'$ has size at most $k=k'$ because we either delete edges in $F$ or replace them one for one by a new edge. Since every vertex in $V(G') \cap V(F)$ is either contained in $V(F')$ or isolated in $G'$ it holds that $F'$ is an edge dominating set in $G'$.
For the other direction, let $F'$ be an edge dominating set of size at most $k'$ in $G'$.
Consider the path $P_x=w_1^xw_2^xw_3^xw_4^xw_5^x$ for some vertex $x \in X_1$. It holds that the only vertex in $P_x$ that can be adjacent to a vertex in $X'=X\setminus X_1 = X_2$ is vertex $w_3^x$; otherwise $P_x$ would be a component in $\ensuremath{\mathcal{C}}\xspace_2$ and not in $\ensuremath{\mathcal{C}}\xspace_1$ (by definition of $\ensuremath{\mathcal{C}}\xspace_1$ and $\ensuremath{\mathcal{C}}\xspace_2$).
Furthermore, the edge dominating set $F'$ must dominate the two non-adjacent edges $\{w_1^x,w_2^x\}$ and $\{w_4^x,w_5^x\}$. Since $w_1^x$, $w_2^x$, $w_4^x$, and $w_5^x$ are only adjacent to vertices in $P_x$ the set $F'$ must contain one of the two edges $e^x_{1,2}=\{w_1^x,w_2^x\}$, $e^x_{2,3}=\{w_2^x,w_3^x\}$ and one of the two edges $e^x_{3,4}=\{w_3^x,w_4^x\}$, $e^x_{4,5}=\{w_4^x,w_5^x\}$. To obtain an edge dominating set of size at most $k$ in $G$ we replace for each vertex $x \in X_1$ these edges with the local optimum solution $\{\{x,w^x\},\{w_3^x,w_2^x\}\}$ resp.\ $\{\{x,w^x\},\{w_3^x,w_4^x\}\}$ depending whether $w^x \in \{w_4^x,w_5^x\}$ or $w^x \in \{w_1^x,w_2^x\}$.
It holds that $|F| \leq |F'|$ because for every vertex $x \in X_1$ we replace the at least two edges in $F' \cap \{e^x_{1,2}, e^x_{2,3}, e^x_{3,4}, e^x_{4,5}\}$ by the two edges of the locally optimal solution $\{\{x,w^x\},\{w_3^x,w_2^x\}\}$ resp.\ $\{\{x,w^x\},\{w_3^x,w_4^x\}\}$.
It remains to show that $F$ is indeed an edge dominating set in $G$. The set $V(F)$ contains all vertices in $V(F')$, except some vertices in the connected components $P_x$ with $x \in X_1$ where we change the edge dominating set $F'$. Furthermore, $V(F)$ contains all vertices in $X_1$ because for every vertex $x \in X_1$ the edge $\{w^x,x\}$ is contained in $F$.
Thus, the only edges that are possibly not dominated by $F$ have one endpoint in a path $P_x$ with $x \in X_1$. Since $w_3^x$ is contained in $V(F)$ (by construction), since every edge in $P_x$ is dominated by $F$ (by construction), and since the vertices in $\{w^x_1,w^x_2,w^x_4,w^x_5\}$ are only adjacent to vertices in $P_x \cup X_1$, it follows that $F$ is an edge dominating set in $G$.
\end{claimproof}
After applying Reduction Rule~\ref{rule::P5_X} it holds that for each path $P=w_1w_2w_3w_4w_5 \in \ensuremath{\mathcal{C}}\xspace_1$ only the vertex $w_3$ can be adjacent to a vertex in $X$, and we can assume that every (optimum) solution contains the edges $\{w_2,w_3\}$ and $\{w_3,w_4\}$.
Additionally, one can show that there exists an optimum solution that does not contain any edge between $\ensuremath{\mathcal{C}}\xspace_1$ and $X$ because we can replace any such edge $e=\{x,v\}$ with $v \in V(\ensuremath{\mathcal{C}}\xspace_1)$ by the edge $\{x,u\}$ with $u \in N_G(x) \setminus V(\ensuremath{\mathcal{C}}\xspace_1)$ (or delete this edge when $N_G(x) \setminus V(\ensuremath{\mathcal{C}}\xspace_1)=\emptyset$).
This allows us to delete $\ensuremath{\mathcal{C}}\xspace_1$ from $G$.
\begin{redrule} \label{rule::P5_cc}
Delete all connected components in $\ensuremath{\mathcal{C}}\xspace_1$ and decrease $k$ by the size of a minimum edge dominating set in $\ensuremath{\mathcal{C}}\xspace_1$, i.e., let $G'=G-\ensuremath{\mathcal{C}}\xspace_1$, $X'=X$, and $k'=k-\MEDS(\ensuremath{\mathcal{C}}\xspace_1)$.
\end{redrule}
\begin{claim}
Reduction Rule~\ref{rule::P5_cc} is safe.
\end{claim}
\begin{claimproof}
First, we will show that there exists an edge dominating set $F$ of size at most $k$ in $G$ such that no edge in $F$ has one endpoint in a connected component of $\ensuremath{\mathcal{C}}\xspace_1$ and the other endpoint in $X$.
Let $F$ be an edge dominating set of size at most $k$ in $G$ with $F \cap E(\ensuremath{\mathcal{C}}\xspace_1,X)$ minimal, and let $P=w_1w_2w_3w_4w_5$ be a path in $\ensuremath{\mathcal{C}}\xspace_1$.
We can assume, w.l.o.g., that $F$ contains the edges $\{w_2,w_3\}$ and $\{w_3,w_4\}$ because $F$ must dominate the non-adjacent edges $\{w_1,w_2\}$, $\{w_4,w_5\}$, and the vertices $w_1$, $w_2$, $w_4$, $w_5$ are only adjacent to vertices in $P$; otherwise, $P$ is contained in $\ensuremath{\mathcal{C}}\xspace_2$ and not $\ensuremath{\mathcal{C}}\xspace_1$.
%
Now, assume for contradiction that there exists an edge $e=\{x,y\} \in F \cap E(\ensuremath{\mathcal{C}}\xspace_1,C)$ with $x \in X$ and $y \in P$ where $P=w_1w_2w_3w_4w_5$ is a path in $\ensuremath{\mathcal{C}}\xspace_1$. It holds that $y=w_3$ because $w_3$ is the only vertex in $P$ that is adjacent to a vertex in $X$.
If every vertex $u \in N_G(x)$ is contained in $V(F)$ then let $\widetilde{F}=F \setminus \{e\}$. Otherwise, let $\widetilde{F}=F \setminus \{e\} \cup \{\{x,u\}\}$, where $u \in N_G(x) \setminus V(F)$. It holds that $\widetilde{F}$ is an edge dominating set in $G$ because $y=w_3$ is still a vertex in $V(\widetilde{F})$ which implies $V(F) \subseteq V(\widetilde{F})$. Furthermore, $u$ is not contained in a connected component of $\ensuremath{\mathcal{C}}\xspace_1$ because for every path $P=w_1w_2w_3w_4w_5$ in $\ensuremath{\mathcal{C}}\xspace_1$ the vertex $w_3$ is contained in $V(F)$ and no other vertex is adjacent to a vertex in $X$.
Now, the set $\widetilde{F}$ is an edge dominating set of size at most $k$ in $G$ with $\widetilde{F} \cap E(\ensuremath{\mathcal{C}}\xspace_1,X) \subsetneq F \cap E(\ensuremath{\mathcal{C}}\xspace_1,X)$ which contradicts the minimality of $F \cap E(\ensuremath{\mathcal{C}}\xspace_1,X)$ and proves that there exists an edge dominating set $F$ of size at most $k$ in $G$ with $F \cap E(\ensuremath{\mathcal{C}}\xspace_1,X) = \emptyset$.
This implies that $F'=F \setminus E(\ensuremath{\mathcal{C}}\xspace_1)$ is an edge dominating set of size at most $k'$ in $G'$ when $F$ is a solution to $(G,k,X)$ with $F \cap E(\ensuremath{\mathcal{C}}\xspace_1,X) = \emptyset$.
For the other direction, let $F'$ be an edge dominating set of size at most $k'$ in $G'$. To obtain an edge dominating set $F$ of size at most $k$ in $G$ we add for every path $P=w_1w_2w_3w_4w_5$ in $\ensuremath{\mathcal{C}}\xspace_1$ the two edges $\{w_2,w_3\}$ and $\{w_3,w_4\}$, which are a minimum edge dominating set of $P$, to $F'$. It follows that $F$ has size $|F'|+\MEDS(\ensuremath{\mathcal{C}}\xspace_1) \leq k$.
The set $F$ dominates all edges in $G-X$ as well as all edges between $\ensuremath{\mathcal{C}}\xspace_2$ and $X$ because $F' \subseteq F$, and because $F$ contains an edge dominating set of $\ensuremath{\mathcal{C}}\xspace_1$. Additionally, $F$ dominates all edges between $\ensuremath{\mathcal{C}}\xspace_1$ and $X$ because $F$ dominates all middle vertices of the paths in $\ensuremath{\mathcal{C}}\xspace_1$ which are the only vertices in $\ensuremath{\mathcal{C}}\xspace_1$ that are adjacent to $X$. Hence, $F$ is an edge dominating set of size at most $k$ in $G$.
\end{claimproof}
Let $(G',k',X')$ be the reduced instance. It holds that the set of connected components in $G'-X'$ is $\ensuremath{\mathcal{C}}\xspace_2$ because we delete all other connected components during Reduction Rule~\ref{rule::P5_cc}. Since $|\ensuremath{\mathcal{C}}\xspace_2| \leq |X_2|=|X'|$ it follows that $G'$ has at most $5 \cdot |\ensuremath{\mathcal{C}}\xspace_2|+|X'| \leq 6|X'|$ vertices.
It remains to show that we can perform the reduction in polynomial time. We apply each Reduction Rule at most once. Furthermore, we can apply the Reduction Rules in polynomial time because we can compute the partition of $X$ as well as the sets $\ensuremath{\mathcal{C}}\xspace_1$ and $\ensuremath{\mathcal{C}}\xspace_2$ in polynomial time, and because we can delete sets of vertices from $G$ and $X$ in polynomial time.
\end{proof}
While this is not the full story about the classification in the following section, it hopefully shows the spirit of how upper and lower bounds for kernelization can arise. Solution edges between components of $G-X$ and $X$ play a crucial role and they affect the solutions for components in nontrivial ways, e.g., apart from control opportunities, it depends on how much budget is needed for $H-B$ when edges between $B$ and $X$ are in the solution.
\section[EDS parameterized by the size of a modulator to an H-component graph]{EDS parameterized by the size of a modulator to an $\boldsymbol{\ensuremath{\mathcal{H}}\xspace}$-component graph} \label{section::classification}
In this section, we develop a complete classification of \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to an $\ensuremath{\mathcal{H}}\xspace$-component graph regarding existence of polynomial kernels for all finite sets $\ensuremath{\mathcal{H}}\xspace$. This is motivated by the observed difference between modulating to $P_3$-component graphs (no polynomial kernel unless \ensuremath{\mathsf{NP\subseteq coNP/poly}}\xspace) vs.\ modulating to $P_5$-component graphs (polynomial kernelization).
To this end, we will study which properties graphs $H\in\ensuremath{\mathcal{H}}\xspace$ must have, such that \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to an $\ensuremath{\mathcal{H}}\xspace$-component graph has resp.\ does not have a polynomial kernel. To recall, the input of our problem is a tuple $(G,k,X)$ where $G-X$ is an $\ensuremath{\mathcal{H}}\xspace$-component graph and we ask whether $G$ has an edge dominating set of size at most $k$; the parameter is $|X|$.
In contrast to \prob{Vertex Cover}\xspace, where we can delete a vertex in the modulator if we know that this vertex must be in a solution of certain size, this is not the case for \prob{Edge Dominating Set}\xspace because we do not necessarily know which incident edge should be chosen. Of course, we can check for a vertex $x$ in the modulator $X$ how not having this vertex as an endpoint of a solution edge influences the size of a minimum edge dominating set of $G-X$. But, even if we find out that a vertex $x$ in the modulator $X$ must be an endpoint of a solution edge, we do not know if the other endpoint of the solution edge incident with $x$ is in $X$ or in a connected component of $G-X$. If there would be a connected component $C$ in $G-X$ with the property that there exists a vertex $v \in N(x) \cap V(C)$ with $\MEDS(C)=\MEDS(C-v) +1$, then it could be possible to have $x$ as an endpoint of a solution edge without paying more than the cost of a minimum edge dominating set in $C$.
Thus, instead of finding vertices in the modulator that must be endpoint of a solution edge, we want to find vertices in the modulator that can be endpoints of a solution edge without spending more budget than the size of a minimum edge dominating set in $G-X$. Similarly, getting edges to $r$ vertices in $X$ while increasing the cost in $C$ by less than $r$ is of interest (cost equal to $r$ can always be had). The following definition classifies relevant vertices and vertex sets in a graph $H$, which may occur as a component of $G-X$.
\newcommand{\helpfulcomment}[1]{\emph{(#1)}}
\begin{definition}\label{definition:basicterms}
Let $H=(V,E)$ be a connected graph.
\begin{itemize}
\item We call a vertex $v \in V$ \emph{extendable} if $\MEDS(H-v)+1=\MEDS(H)$. We denote the set of extendable vertices of $H$ by $Q(H)$.
\helpfulcomment{Intuitively, these vertices allow a local solution for an $H$-component in $G-X$ that includes an edge $\{v,x\}$ with $x\in X$ and $v \in V(H)$.}
\item We call a set $Y \subseteq Q(H)$ \emph{free} if for all vertices $v \in Y$ and for all minimum edge dominating sets $F$ in $H$ there exists a minimum edge dominating set $F'$ in $H-v$ of size $|F|-1$ and with $V(F) \setminus Y \subseteq V(F')$. By $W(H)$ we denote the unique maximum free set of $H$. We call a vertex $w \in W(H)$ \emph{free}. \footnote{We show in Proposition~\ref{proposition::properties}~(\ref{proposition::free}) that $W(H)$ is unique.}
\helpfulcomment{Intuitively, vertices in $Y$ can be used for solution edges between components and $X$, while covering the same vertices of $H-Y$ as any local optimum solution; thus, they cannot be used for lower bounds like for $P_3$-components.}
\item We call a vertex $v \in V$ \emph{uncovered} if no minimum edge dominating set $F$ of $H$ contains an edge incident with $v$, i.e.\ $v \notin V(F)$. We denote the set of uncovered vertices by $U(H)$.
\helpfulcomment{Intuitively, $H$-components with any $v\in U(H)$ adjacent to $x\in X$ are easy to handle because $x\notin V(F)$ would imply that the local cost for $H$ increases above $\MEDS(H)$.}
\item For any $Y\subseteq V$ define $\mathrm{cost}(Y):=|Y|+\MEDS(H-Y)-\MEDS(H)$.
\helpfulcomment{Intuitively, $\mathrm{cost}(Y)$ is equal to the additional budget that is needed for an $H$-component of $G-X$ when exactly the vertices in $Y$ have solution edges to $X$. Note that $\mathrm{cost}(\{v\})=0$ for all extendable vertices $v$.}
\item We call a set $B\subseteq V\setminus W(H)$ \emph{beneficial} if for all $\widetilde{B}\subsetneq B$ we have $|B|-\mathrm{cost}(B)>|\widetilde{B}|-\mathrm{cost}(\widetilde{B})$ or, equivalently, $\MEDS(H-B)<\MEDS(H-\widetilde{B})$. Note that this must also hold for $\widetilde{B}=\emptyset$ which implies that for all beneficial sets we have $|B|-\mathrm{cost}(B) >0$ or, equivalently, $\MEDS(H-B)<\MEDS(H)$.
\helpfulcomment{Intuitively, the solution may include $|B|$ edges between $B$ and some $X'\subseteq X$ while increasing the cost for the $H$-component by exactly $\mathrm{cost}(B)$; this saves $|B|-\mathrm{cost}(B)>0$ over taking any $|B|$ edges incident with $X'$. The condition for all $\widetilde{B}\subsetneq B$ ensures that the savings of getting $|B|$ edges at cost $\mathrm{cost}(B)$ is greater than for any proper subset.}
\item We call a beneficial set $B$ \emph{strongly beneficial} if $\mathrm{cost}(B) < \sum_{i=1}^h \mathrm{cost}(B_i)$ holds for all covers $B_1, B_2,\ldots,B_h \subsetneq B$ of $B$.
\helpfulcomment{Intuitively, for a strongly beneficial set $B$ we cannot get the same number of edges to $X$ by using sets $B_i$ in several different $H$-components.}
\end{itemize}
\end{definition}
\begin{figure}
\centering
\begin{tikzpicture}[scale=1, transform shape]
\node[circle, inner sep=1.5pt, fill] (v1) at (1,1) [label=above:$b$] {};
\node[circle, inner sep=1.5pt, fill] (v2) at (0,1) [label=above:$a$] {};
\node[circle, inner sep=1.5pt, fill] (v3) at (0,0) [label=120:$f$] {};
\node[circle, inner sep=1.5pt, fill] (v4) at (0,-1) [label=below:$k$] {};
\node[circle, inner sep=1.5pt, fill] (v5) at (1,-1) [label=below:$l$] {};
\node[circle, inner sep=1.5pt, fill] (w1) at (2.5,1) [label=above:$c$] {};
\node[circle, inner sep=1.5pt, fill] (w2) at (3.5,1) [label=above:$d$] {};
\foreach \i/\j/\k in {1/-1,2/0,3/1,4/2,5/3,6/4}
\node[circle, inner sep=1.5pt, fill] (u1) at (-1,0) [label=below:$e$] {};
\node[circle, inner sep=1.5pt, fill] (u2) at (0,0) {};
\node[circle, inner sep=1.5pt, fill] (u3) at (1,0) [label=below:$g$] {};
\node[circle, inner sep=1.5pt, fill] (u4) at (2,0) [label=below:$h$] {};
\node[circle, inner sep=1.5pt, fill] (u5) at (3,0) [label=below:$i$] {};
\node[circle, inner sep=1.5pt, fill] (u6) at (4,0) [label=below:$j$] {};
\foreach \i/\j in {1/2,2/3,3/4,4/5}
\draw (v\i) -- (v\j);
\foreach \i/\j in {1/2,2/3,3/4,4/5,5/6}
\draw (u\i) -- (u\j);
\draw (w1) -- (u4);
\draw (w1) -- (u5);
\draw (w2) -- (u5);
\draw (w2) -- (u6);
\foreach \i in {1,2,4,5}
\node[draw=Green, thick, circle, inner sep=3pt] at (v\i) {};
\foreach \x/\i in {u/4,u/6,w/2}
\node[draw=orange, thick, rectangle, inner sep=4pt] at (\x\i) {};
\node[draw=Blue, thick, regular polygon, regular polygon sides=3, inner sep=2.5pt] at (u1) {};
\draw[decorate,decoration={snake,amplitude=.4mm,segment length=1mm}] (v1) -- (v2);
\draw[decorate,decoration={snake,amplitude=.4mm,segment length=1mm}] (v3) -- (v4);
\draw[decorate,decoration={snake,amplitude=.4mm,segment length=1mm}] (w1) -- (u4);
\draw[decorate,decoration={snake,amplitude=.4mm,segment length=1mm}] (u5) -- (u6);
\end{tikzpicture}
\caption{Example of an $H$-component with $\MEDS(H)=4$. The wavy edges are a possible minimum edge dominating set of $H$.}
\label{figure::example_def}
\end{figure}
\begin{example}[Illustration of Definition \ref{definition:basicterms}]
Figure~\ref{figure::example_def} shows a connected graph $H$. The size of an edge dominating set in $H$ is at least four because a solution has to dominate the four pairwise non-adjacent edges $\{a,b\}, \{k,l\}, \{j,d\}$ and $\{g,h\}$. Thus, $\MEDS(H)=4$ because the wavy edges are an edge dominating set of $H$.
The vertices $\{a,b,k,l\}$, marked with a green cycle, as well as the vertices $\{d,h,j\}$, marked with an orange rectangle, are extendable. But only the green marked vertices $\{a,b,k,l\}$ are free: Let $F$ be any minimum edge dominating set in $H$. The set $F$ must contain exactly one of the two edges $e_1=\{a,b\}$ and $e_2=\{a,f\}$, and exactly one of the two edges $e_3=\{k,l\}$ and $e_4=\{k,f\}$. Now, $F' = F \setminus \{e_1,e_2,e_3,e_4\} \cup \{f,k\}$ is an edge dominating set in $H-a$ and $H-b$ of size $|F|-1$, and $F' = F \setminus \{e_1,e_2,e_3,e_4\} \cup \{a,f\}$ is an edge dominating set in $H-k$ and $H-l$ of size $|F|-1$ which implies that the vertices $\{a,b,k,l\}$ are free. The vertices $\{d,h,j\}$ are not free because no minimum edge dominating set $F'$ in $H-d$, resp.\ $H-h$, resp.\ $H-j$ has vertex $c$, which is not extendable, as an endpoint of a solution edge, but the graph $H$ has a minimum edge dominating set that has $c$ as an endpoint, namely the one containing the wavy edge $\{a,b\},\{h,c\},\{d,j\}$.
The vertex $e$, marked with a blue triangle, is uncovered.
The set $\{c,g\}$ is strongly beneficial, whereas the set $\{c,g,i,j\}$ is only beneficial, but not strongly beneficial: The set $\{c,g\}$ is beneficial because $\MEDS(H-\{c,g\})=3$ and $\MEDS(H-c)=\MEDS(H-g)=\MEDS(H) = 4$, and strongly beneficial because the only possible non-trivial cover of $\{c,g\}$ is $\{c\},\{g\}$ and $\mathrm{cost}(\{c,g\}) = 1 < 2 = \mathrm{cost}(\{c\}) + \mathrm{cost}(\{g\})$. The set $\{c,g,i,j\}$ is beneficial because $\MEDS(H-\{c,g,i,j\}) = 2$ and $\MEDS(H-B) \geq 3$ for all $B \subsetneq \{c,g,i,j\}$. But $\{c,g,i,j\}$ is not strongly beneficial because $\mathrm{cost}(\{c,g,i,j\}) = 2 = 1 + 1 + 0 = \mathrm{cost}(\{c,g\}) + \mathrm{cost}(\{i\}) + \mathrm{cost}(\{j\})$.
Observe that the set $\{c,g,i\}$ is not beneficial even though $\MEDS(H-\{c,g,i\})=3 < 4=\MEDS(H)$, because $\{c,g\} \subsetneq \{c,g,i\}$ and $\MEDS(H-\{c,g,i\}) = 3 = \MEDS(H-\{c,g\})$.
\end{example}
We are now able to give a more detailed version of Theorem~\ref{theorem:classification}, which specifies for each finite set $\ensuremath{\mathcal{H}}\xspace$ of connected graphs the kernelization complexity of \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to $\ensuremath{\mathcal{H}}\xspace$-component graphs.
\begin{theorem}\label{theorem:detailedclassification}
Let $\ensuremath{\mathcal{H}}\xspace$ be any finite set of connected graphs. The \prob{Edge Dominating Set}\xspace problem parameterized by the size of a modulator to $\ensuremath{\mathcal{H}}\xspace$-component graphs behaves as follows:
\begin{enumerate}
\item If $\ensuremath{\mathcal{H}}\xspace$ contains any graph $H$ fulfilling one of the following items then there is no polynomial kernelization unless \ensuremath{\mathsf{NP\subseteq coNP/poly}}\xspace:\label{item:lowerbound}
\begin{enumerate}
\item There is an extendable vertex in $H$ that is not free, i.e., $Q(H)\setminus W(H)\neq\emptyset$.\label{item:lowerbound:CP_Q}
\item There is a strongly beneficial set $B$ in $H$ that contains an uncovered vertex, i.e., $B\cap U(H)\neq\emptyset$.\label{item:lowerbound:CP_U}
\item There is a vertex in $H$ that is neither uncovered, free, nor neighbor of a free vertex, i.e., $V(H)\setminus (N[W(H)]\cup U(H))\neq\emptyset$.\label{item:lowerbound:CP_R}
\item There is a strongly beneficial set $B\subseteq N(W(H))$ in $H$ such that no minimum edge dominating set $F_B$ of $H-B$ covers all vertices of $N(W(H))\setminus B$.\label{item:lowerbound:CP_other}
\end{enumerate}
\item Else, if $\ensuremath{\mathcal{H}}\xspace$ contains at least one graph that has a strongly beneficial set, then there is a kernelization to $\mathcal{O}(|X|^d)$ vertices, $\mathcal{O}(|X|^{d+1})$ edges, and size $\mathcal{O}(|X|^{d+1}\log|X|)$, and there is no kernelization to size $\mathcal{O}(|X|^{d-\varepsilon})$, for any $\varepsilon>0$, unless \ensuremath{\mathsf{NP\subseteq coNP/poly}}\xspace where $d$ is the size of the largest strongly beneficial set in any $H\in\ensuremath{\mathcal{H}}\xspace$.\label{item:polynomialkernel}
\item Else, there is a kernelization to $\mathcal{O}(|X|^2)$ vertices, $\mathcal{O}(|X|^3)$ edges, and size $\mathcal{O}(|X|^3\log|X|)$, and there is no kernelization to size $\mathcal{O}(|X|^{2-\varepsilon})$, for any $\varepsilon>0$, unless \ensuremath{\mathsf{NP\subseteq coNP/poly}}\xspace.\label{item:smallkernel}
\end{enumerate}
\end{theorem}
The rest of this section is devoted to proving Theorem~\ref{theorem:detailedclassification}, following the proof outline below. From this, Theorem~\ref{theorem:classification} directly follows because disconnected graphs in $\ensuremath{\mathcal{H}}\xspace$ do not affect the resulting class of $\ensuremath{\mathcal{H}}\xspace$-component graphs, i.e., given \emph{any} finite set $\ensuremath{\mathcal{H}}\xspace$ of graphs we can take the subset $\ensuremath{\mathcal{H}}\xspace'$ of connected graphs in \ensuremath{\mathcal{H}}\xspace and apply Theorem~\ref{theorem:detailedclassification} to $\ensuremath{\mathcal{H}}\xspace'$. As an example for applying the theorem, for $\ensuremath{\mathcal{H}}\xspace=\{P_3\}$ we get Item~\ref{item:lowerbound:CP_Q}, for $\ensuremath{\mathcal{H}}\xspace=\{P_4\}$ we get Item~\ref{item:lowerbound:CP_U}, for $\ensuremath{\mathcal{H}}\xspace=\{K_3\}$ and $\ensuremath{\mathcal{H}}\xspace=\{K_5\}$ we get Item~\ref{item:lowerbound:CP_R}, and for $\ensuremath{\mathcal{H}}\xspace=\{P_2\}=\{K_2\}$, $\ensuremath{\mathcal{H}}\xspace=\{K_4\}$, $\ensuremath{\mathcal{H}}\xspace=\{P_5\}$, as well as $\ensuremath{\mathcal{H}}\xspace = \{E = \begin{tikzpicture}[scale=0.11, transform shape]
\node[draw, circle, inner sep=3.5pt, fill] (v1) at (1,1) {};
\node[draw, circle, inner sep=3.5pt, fill] (v2) at (0,1) {};
\node[draw, circle, inner sep=3.5pt, fill] (v3) at (0,0) {};
\node[draw, circle, inner sep=3.5pt, fill] (v4) at (0,-1) {};
\node[draw, circle, inner sep=3.5pt, fill] (v5) at (1,-1) {};
\node[draw, circle, inner sep=3.5pt, fill] (u) at (1,0) {};
\foreach \i/\j in {1/2,2/3,3/4,4/5}{
\draw[line width=0.3] (v\i) -- (v\j);}
\draw[line width=0.3] (v3) -- (u);
\end{tikzpicture}\}$ we get Item~\ref{item:smallkernel}.
\begin{remark*}
We showed that \prob{Edge Dominating Set}\xspace parameterized by the size of a given modulator $X$ to a $P_5$-component graph admits a kernel with $\mathcal{O}(|X|)$ vertices (see Theorem~\ref{theorem::kernel_P5}). The reason why we the kernelization procedure of Item~\ref{item:smallkernel} only reduces to $\mathcal{O}(|X|^2)$ vertices instead of $\mathcal{O}(|X|)$ vertices is that $H$-components can have uncovered vertices. This leads to a different marking argument similar to the case for \prob{Edge Dominating Set}\xspace parameterized by solution size. Note that EDS parameterized by solution size is covered by Item~\ref{item:smallkernel}.
\end{remark*}
\begin{proof}[Proof outline for Theorem~\ref{theorem:detailedclassification}.]
We begin by establishing a number of useful properties of the terms introduced in Definition~\ref{definition:basicterms}, e.g., that each graph $H$ containing a beneficial set $B$ also contains a strongly beneficial set $B'\subseteq B$ (Proposition~\ref{proposition::properties} (\ref{proposition::strongly})).
The kernelization lower bound of Item~\ref{item:lowerbound} is proved by generalizing the lower bound obtained for $P_3$-component graphs in Theorem~\ref{theorem::P3}. We define so-called \emph{control pairs} by abstracting properties of $P_3$-components used in the proof (Definition~\ref{definition:controlpair}) and show that there is no polynomial kernelization when any graph $H\in\ensuremath{\mathcal{H}}\xspace$ has a control pair (Theorem~\ref{theorem::LB}). We then show that graphs $H$ fulfilling Items \ref{item:lowerbound:CP_Q}, \ref{item:lowerbound:CP_U}, \ref{item:lowerbound:CP_R}, or \ref{item:lowerbound:CP_other} have control pairs (Lemmas \ref{lemma::CP_Q}, \ref{lemma::CP_U}, \ref{lemma::CP_R}, and \ref{lemma::CP_other}).
In Item \ref{item:lowerbound:CP_other}, and in the items below, we (may) use that no graph in $\ensuremath{\mathcal{H}}\xspace$ fulfills Items \ref{item:lowerbound:CP_Q}, \ref{item:lowerbound:CP_U}, or \ref{item:lowerbound:CP_R}. Accordingly, each graph $H\in\ensuremath{\mathcal{H}}\xspace$ has $V(H)=N[W(H)]\cup U(H)$, i.e., each vertex of $H$ is uncovered, free, or neighbor of a free vertex. Moreover, every extendable vertex is also free, i.e., $Q(H)=W(H)$, and strongly beneficial sets contain no (uncovered) vertices of $U(H)$. This implies that all strongly beneficial sets are subsets of $N(W(H))$, the neighborhood of the free vertices, as neither uncovered nor free vertices can be contained and no further vertices except those in $N(W(H))$ exist in $H$ (in this case).
For Item~\ref{item:polynomialkernel} we have that no graph in \ensuremath{\mathcal{H}}\xspace fulfills any of the Items \ref{item:lowerbound:CP_Q} through \ref{item:lowerbound:CP_other} and that at least one graph in $\ensuremath{\mathcal{H}}\xspace$ has a strongly beneficial set. Thus, in addition to the above restrictions on $H\in\ensuremath{\mathcal{H}}\xspace$, we know that for each strongly beneficial set $B$, which here must be a subset of $N(W(H))$, there is a minimum edge dominating set $F_B$ of $H-B$ that covers all vertices in $N(W(H))\setminus B$. We give a general kernelization procedure that reduces the number of components in $G-X$ to $\mathcal{O}(|X|^d)$ where $d$ is the size of the largest strongly beneficial set among graphs $H\in\ensuremath{\mathcal{H}}\xspace$ (Lemma \ref{lemma::kernel2}). We then rule out kernels of size $\mathcal{O}(|X|^{d-\varepsilon})$ using only $H$-components, where $H$ is any graph in $\ensuremath{\mathcal{H}}\xspace$ that exhibits the largest size $d$ of strongly beneficial sets (Lemma \ref{theorem::polynomiallowerbound}). Note that in the present item $d$ is always at least two because having a strongly beneficial set $B$ of size one would mean that $v\in B$ is an extendable vertex that is not free (because beneficial sets are disjoint from the set $W(H)$ of free vertices), which is handled by Item~\ref{item:lowerbound:CP_Q}.
Finally, for Item~\ref{item:smallkernel}, it remains to consider the case that no graph $H\in\ensuremath{\mathcal{H}}\xspace$ fulfills any of the Items \ref{item:lowerbound:CP_Q} through \ref{item:lowerbound:CP_other} and that no graph in $H$ has a strongly beneficial set. It follows that no graph in $H$ has any beneficial sets (Proposition~\ref{proposition::properties} (\ref{proposition::strongly})) and, as before, we have $V(H)=N[W(H)]\cup U(H)$. We obtain a kernelization to $\mathcal{O}(|X|^2)$ vertices, $\mathcal{O}(|X|^3)$ edges, and size $\mathcal{O}(|X|^3\log|X|)$ (Lemma \ref{lemma::kernel1}). The lower bound ruling out kernels of size $\mathcal{O}(|X|^{2-\varepsilon})$ for any $\varepsilon>0$, and in fact for any set $\ensuremath{\mathcal{H}}\xspace$, follows easily by a simple reduction from \prob{Vertex Cover}\xspace for which a lower bound ruling out size $\mathcal{O}(n^{2-\varepsilon})$ is known \cite{DellM14} (Lemma \ref{lemma::quadraticlowerbound}).
Since the arguments required for the kernelization in Item~\ref{item:smallkernel} are simpler than for that of Item~\ref{item:polynomialkernel} and can serve as an introduction to it, the proofs are given in the order of Item~\ref{item:lowerbound}, Item~\ref{item:smallkernel}, followed by Item~\ref{item:polynomialkernel}.
\end{proof}
Before starting on the lower bound part of Theorem~\ref{theorem:detailedclassification}, we establish a few basic properties of the terms defined in Definition~\ref{definition:basicterms}; these mostly follow readily from their definition. We also justify the definition of $W(H)$ as the unique maximum cardinality free set in $H$.
\begin{proposition}[\footnote{The proof of Proposition~\ref{proposition::properties} is deferred to Section \ref{section::proposition}.}] \label{proposition::properties}
Let $H=(V,E)$ be a connected graph, let $W=W(H)$ be the set of free vertices, let $Q=Q(H)$ be the set of extendable vertices, and let $U=U(H)$ be the set of uncovered vertices.
\begin{enumerate}
\item The set $W$ is well defined. \label{proposition::free}
\item The set $U$ is an independent set and no vertex in $Q$ is adjacent to a vertex in $U$; hence $N_H(U) \cap (Q \cup U ) = \emptyset$. \label{proposition::neighborhood}
\item If $v \in N_H(U)$ is a vertex that is adjacent to a vertex in $U$, then $v$ is an endpoint of an edge in every minimum edge dominating set of $H$. \label{proposition::N(U)}
\item It holds for all vertices $v \in V$ that $\MEDS(H)-1 \leq \MEDS(H-v) \leq \MEDS(H)$. \label{proposition::vertex}
\item Let $Y \subseteq V$. It holds for all subsets $X \subseteq Y$ that $\MEDS(H-X) - |Y \setminus X| \leq \MEDS(H-Y) \leq \MEDS(H-X)$, and that $\mathrm{cost}(X) \leq \mathrm{cost}(Y)$. \label{proposition::monoton}
\item Let $F$ be a minimum edge dominating set in $H$. There exists a minimum edge dominating set $F'$ in $H$ with $(V(F) \cup N_H(W) ) \setminus W \subseteq V(F')$. \label{proposition::N(W)IN}
\item Every set that consists of one vertex $v \in Q \setminus W$ is strongly beneficial. Furthermore, these are the only beneficial sets of size one. \label{proposition::Q-W}
\item If $B$ is a beneficial set of size at least two then $B$ contains no extendable vertex; hence $B \cap Q=\emptyset$. \label{proposition::disjointQ}
\item If there exists a set $Y \subseteq V \setminus W$ with $\MEDS(H-Y) < \MEDS(H)$, then there exists a beneficial set $B \subseteq Y$ with $\MEDS(H-B) = \MEDS(H-Y)$. \label{proposition::BFS}
\item If there exists a set $Y \subseteq V \setminus W$ with $\MEDS(H-Y) < \MEDS(H)$, then there exists a beneficial set $B \subseteq Y$ with $\MEDS(H-B) +1 = \MEDS(H)$. Furthermore, $B$ is strongly beneficial. \label{proposition::BFScost1}
\item If $H$ has a beneficial set $B$, then $H$ has also a strongly beneficial set $B' \subseteq B$. \label{proposition::strongly}
\item Let $F$ be a minimum edge dominating set in $H$. If $e=\{x,y\}$ is an edge in $F$ with $x, y \notin Q$, then $\{x,y\}$ is a strongly beneficial set. \label{proposition::BFSedge}
\item Let $B$ be a beneficial set. $B$ is strongly beneficial if and only if for every non-trivial partition $B_1,B_2,\ldots,B_h$ of $B$ it holds that $\mathrm{cost}(B) < \sum_{i=1}^h \mathrm{cost}(B_i)$. \label{proposition::definition}
\item Let $Y \subseteq V \setminus W$. There exists a partition $B_1,B_2,\ldots,B_h$ of $Y$ where $B_i$ is either strongly beneficial or where $B_i$ has $\mathrm{cost}(B_i)=|B_i|$, for all $i \in [h]$, such that $\mathrm{cost}(Y) \geq \sum_{i=1}^h \mathrm{cost}(B_i)$. (Note that we also allow trivial partitions.) \label{proposition::decomposeB}
\end{enumerate}
\end{proposition}
\subsection[Generalizing the lower bound obtained for P3-component graphs]{Generalizing the lower bound obtained for $\boldsymbol{P_3}$-component graphs}
We want to generalize Theorem \ref{theorem::P3} to get a lower bound that covers a variety of different $H$-components. In the proof of Theorem \ref{theorem::P3}, we used one endpoint of each $P_3$ to control that we choose the edges only from one instance and to make sure that the $\binom{k}{2}$ edges have their endpoints in a set of size $k$. The middle vertex of each $P_3$ is extendable (but not free, so $P_3$ fits Item~\ref{item:lowerbound:CP_Q} of Theorem~\ref{theorem:detailedclassification}) and the set consisting of this single vertex is beneficial. Hence, we were able to add edges between the middle vertices of the $P_3$'s and the set $S$ without spending more budget. Accordingly, to generalize Theorem~\ref{theorem::P3}, we define what we call control pairs consisting of a set of control vertices and a beneficial set.
\begin{definition}\label{definition:controlpair}
Let $H=(V,E)$ be a connected graph and let $B \subseteq V$, $C \subseteq V \setminus (Q(H) \cup B)$. We call the pair $(C,B)$ \emph{control pair}, if
\begin{itemize}
\item $B$ is strongly beneficial,
\item no vertex $c \in C$ is extendable in $H-B$, i.e., $C \cap Q(H-B) = \emptyset$,
\item there exists a minimum edge dominating set $F$ in $H$ such that $C \subseteq V(F)$, and
\item for all minimum edge dominating sets $F_B$ in $H-B$ it holds that $C \nsubseteq V(F_B)$.
\end{itemize}
\end{definition}
Let $H$ be a connected graph that contains a control pair. We show that \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to an $\ensuremath{\mathcal{H}}\xspace$-component graph has no polynomial kernel unless \ensuremath{\mathsf{NP\subseteq coNP/poly}}\xspace for all $\ensuremath{\mathcal{H}}\xspace\ni H$. The lower bound construction generalizes the construction used for Theorem \ref{theorem::P3}, making the proof more complicated. Observe that for $H=P_3=v_1v_2v_3$ the set $B$ is the vertex $v_2$ and the set $C$ is the vertex $v_1$ (or $v_2$).
\begin{theorem} \label{theorem::LB}
Let $H$ be a connected graph and let $B \subseteq V$, $C \subseteq V \setminus (Q(H) \cup B)$ such that $(C,B)$ is a control pair. For all sets $\ensuremath{\mathcal{H}}\xspace\ni H$ of graphs, the \prob{Edge Dominating Set}\xspace problem parameterized by a modulator to an $\ensuremath{\mathcal{H}}\xspace$-component graph admits no polynomial kernelization unless \ensuremath{\mathsf{NP\subseteq coNP/poly}}\xspace.
\end{theorem}
\begin{proof}
We give a cross-composition from \prob{Multicolored-Clique}; the theorem then follows directly from Theorem~\ref{theorem:kernellowerbound:crosscomposition}. In $G-X$ we use only components isomorphic to $H$, so $X$ is a modulator to $\ensuremath{\mathcal{H}}\xspace$-component graphs for all $\ensuremath{\mathcal{H}}\xspace$ with $H\in\ensuremath{\mathcal{H}}\xspace$.
We choose the same polynomial equivalence relation $\mathcal{R}$ as in the proof of Theorem \ref{theorem::P3}. Assume that we are given a sequence $I_i=(G_i,k)_{i=1}^t$ of \prob{Multicolored Clique}\xspace instance that are in the same equivalence class of $\mathcal{R}$. Since all color classes have the same size we identify the vertex sets of each color class. Let $V$ be the vertex set (of size $k \cdot n$) of the $t$ instances and let $V_1,V_2,\ldots, V_k$ be the different color classes (each of size $n$). We assume w.l.o.g.\ that every instance has at least one edge in $E(V_p,V_q)$ for all $1 \leq p < q \leq k$; otherwise, this instance would be a trivial no instance and we can delete it. Furthermore, we can assume w.l.o.g.\ that $t=2^s$.
We construct an instance $(G',k',X')$ of \prob{Edge Dominating Set}\xspace parameterized by a modulator to an $H$-component graph; thus $X'$ is a modulator to $\ensuremath{\mathcal{H}}\xspace$-component graphs for all \ensuremath{\mathcal{H}}\xspace with $H\in\ensuremath{\mathcal{H}}\xspace$. As in the proof of Theorem \ref{theorem::P3} we add sets $V$, $T=\{t_1,t_2,\ldots,t_k\}$, $T'=\{t_1',t_2',\ldots,t_k'\}$, $W$, $Z$, and $Z'$ to $G'$ and connect them in the same way. Again, for each instance $G_i$, with $i \in [t]$, we pick a different subset of size $s$ of $W$ and denote it by $W(i)$.
Instead of adding one vertex corresponding to each edge set $E(V_p,V_q)$ with $1\leq p < q \leq k$, we add a set $S_{p,q}$ of size $d:=|B|$ to $G'$ as well as a copy $S_{p,q}'$. Let $S_{p,q}=\{s_{p,q}^1,s_{p,q}^2,\ldots,s_{p,q}^{d}\}$, let $S_{p,q}'=\{s'^1_{p,q},s'^2_{p,q},\ldots,s'^d_{p,q}\}$, let $S=\bigcup_{1\leq p < q \leq k} S_{p,q}$, and let $S'=\bigcup_{1\leq p < q \leq k} S_{p,q}'$. We make every vertex $s_{p,q}^j$ with $1 \leq p < q \leq k$ and $j \in [d]$ adjacent to vertex $s'^j_{p,q}$.
For each graph $G_i$, with $i \in [t]$, we add $|E(G_i)|$ copies of graph $H$ to $G'$. We denote by $H_i^e$ the copy of $H$ that represents edge $e=\{x,y\} \in E(G_i)$ of instance $i \in [t]$ and by $(C_i^e,B_i^e)$ the control pair of $H_i^e$. For $e=\{x,y\}$ in instance $i$, we make every vertex in $C_i^e$ adjacent to all vertices in $W(i)$ and to the vertices $x,y \in V$.
To be able to refer to single vertices of $B$ in copies $H_i^e$ of $H$, let $B=\{b_1,\ldots,b_d\}$ and let $B_i^e=\{b_{i,1}^e,b_{i,2}^e,\ldots,b_{i,d}^e\}$ where $b_{i,j}^e$ corresponds to $b_j$ in $B$ (i.e., this correspondence constitutes an isomorphism between $H$ and $H_i^e$).
For all $i \in [t]$, $e \in E(G_i)$, and $j \in [d]$ we make vertex $b_{i,j}^e \in B_i^e$ adjacent to vertex $s_{p,q}^j \in S_{p,q}$ if $e \in E(V_p,V_q)$ for $1\leq p < q \leq k$. Note that every vertex $b_{i,j}^e$ is adjacent to exactly one vertex in $S$.
The modulator $X'$ contains all vertices that are not contained in a copy of $H$; thus $X'=V(G') \setminus \bigcup_{i=1}^t \bigcup_{e \in E(G_i)} V(H_i^e) = V \cup T \cup T' \cup W \cup Z \cup Z' \cup S \cup S'$ and $X'$ has size $|X'|=k \cdot n+2k+4s+2 \cdot \binom{k}{2} |B|$. Let $k'=s+k+\sum_{i=1}^t |E(G_i)| \cdot \MEDS(H) + \binom{k}{2} \cdot \mathrm{cost}(B)$. Note that $0 \leq \mathrm{cost}(B) < |B|$.
We will show that $(G',k',X')$ is a $\mathrm{YES}$-instance of \prob{Edge Dominating Set}\xspace if and only if there exists an $i^* \in [t]$ such that $(G_{i^*},k)$ is a $\mathrm{YES}$-instance of \prob{Multicolored Clique}\xspace.
$(\Rightarrow:)$ Let $F$ be an edge dominating set of size at most $k'$ in $G'$.
Analogously to the proof of Theorem \ref{theorem::P3} we can observe, that $Z \cup T \cup S \subseteq V(F)$ and that we can choose the $|T|$ resp.\ $|Z|$ resp.\ $|S|$ edges that have one endpoint in $T$ resp.\ $Z$ resp.\ $S$ always from the edge set $E(T,V)$ resp.\ $E(Z,W)$ resp.\ $E(S, \bigcup_{i=1}^t \bigcup_{e \in E(G_i)} H_i^e)$. Additionally, we can assume w.l.o.g.\ that the edges in $F \cap E(T,V)$ resp.\ $F \cap E(Z,W)$ resp.\ $F \cap E(S, \bigcup_{i=1}^t \bigcup_{e \in E(G_i)} H_i^e)$ are a matching (simple replacement argument). Furthermore, an edge in $F$ cannot have its endpoints in different copies of $H$.
Let $F_T=F \cap E(T,V)$, let $F_Z=F \cap E(Z,W)$, let $F_S=F \cap E(S, \bigcup_{i=1}^t \bigcup_{e \in E(G_i)} H_i^e)$, and let $F_R=F \setminus (F_T \cup F_Z \cup F_S)$. Recall, the edge sets $F_T$, $F_Z$ and $F_S$ are matchings in $G'$.
We can assume that every edge in $F_R$ has at least one endpoint in $V(G') \setminus X' = \bigcup_{i=1}^t \bigcup_{e \in E(G_i)} V(H_i^e)$, because every edge in $E(G'[X'])$ is dominated by an edge in $F_T \cup F_Z \cup F_S$. This follows from the fact that $Z \cup T \cup S$ are covered by the edge dominating set $F$ and that $X' \setminus (Z \cup T \cup S)$ is an independent set.
Let $B_i^e(F) = \{v \in B_i^e \mid \exists s \in S \colon \{v,s\} \in F_S\}$ be the set of vertices in $B_i^e$ that are incident with an edge in $F_S$, where $i \in [t]$ and $e \in E(G_i)$.
Since $F_S$ is a matching between $S$ and $\bigcup_{i=1}^t \bigcup_{e \in E(G_i)} H_i^e$ which covers $S$ and contains all edges of $F$ that are incident with $S$, and since $|F_S|=|S|$ it holds that no edge in $F \setminus F_S$ has an endpoint in $S$ and that $\sum_{i=1}^t \sum_{e \in E(G_i)} |B_i^e(F)| = |S| = \binom{k}{2} \cdot |B|$.
For $i \in [t]$ and $e \in E(G_i)$, let $F_i^e = \{ f \in F_R \mid f \cap V(H_i^e) \neq \emptyset\}$ be the set of edges in $F_R$ that have at least one endpoint in $H_i^e$. It holds that $\bigcup_{i=1}^t \dot{\bigcup}_{e \in E(G_i)} F_i^e =F_R$, because every edge in $F_R$ is incident with a vertex in $\bigcup_{i=1}^t \bigcup_{e \in E(G_i)} V(H_i^e)$. Moreover, the sets $F_i^e$ are a partition of $F_R$ because no edge is incident with vertices of different graphs $H_i^e$.
Every edge in the graph $H_i^e$, with $i \in [t]$ and $e \in E(G_i)$, must be dominated by edges in $F_R$ and $F_S$, because they cannot be dominated by edges in $F_T \cup F_Z\subseteq E(T,V)\cup E(Z,W)$. Thus, $F_i^e$ must dominate all edges in $H_i^e - B_i^e(F)$, because the set $B_i^e(F)$ contains all vertices in $H_i^e$ that are incident with edges in $F_S$. This implies that for all $i \in [t]$ and $e \in E(G_i)$, the set $F_i^e$ has at least the size of a minimum edge dominating set in $H_i^e - B_i^e(F)$; hence $\MEDS(H_i^e - B_i^e(F) ) \leq |F_i^e|$ .
Combining all this, we get
\begin{align*}
|F| &= |F_T| + |F_Z| + |F_S| + |F_R| \\
&= k + s + \binom{k}{2} |B| + \sum_{i=1}^t \sum_{e \in E(G_i)} |F_i^e| \quad\quad\quad\quad\quad\quad \text{// because the sets $F_i^e$ partition $F_R$}\\
&\geq k + s + \binom{k}{2} |B| + \sum_{i=1}^t \sum_{e \in E(G_i)} \MEDS(H_i^e - B_i^e(F) ) \quad\quad \text{// bc.\ } \MEDS(H_i^e - B_i^e(F) ) \leq |F_i^e| \\
&= k + s + \binom{k}{2} |B| + \sum_{i=1}^t \sum_{e \in E(G_i)} \left(\MEDS(H_i^e) - |B_i^e(F)| + \mathrm{cost}(B_i^e(F))\right) \quad \text{// def.\ } \mathrm{cost}(B_i^e(F)) \\
&=k + s + \binom{k}{2} |B| + \sum_{i=1}^t |E(G_i)| \MEDS(H) - \binom{k}{2} |B| + \sum_{i=1}^t \sum_{e \in E(G_i)} \mathrm{cost}(B_i^e(F)) \\
&= k + s + \sum_{i=1}^t |E(G_i)| \MEDS(H) + \sum_{i=1}^t \sum_{e \in E(G_i)} \mathrm{cost}(B_i^e(F)) \\
&= k + s + \sum_{i=1}^t |E(G_i)| \MEDS(H) + \sum_{1 \leq p < q \leq k} \sum_{\substack{x \in V_p\\ y \in V_q}} \sum_{\substack{i\in[t]\\ \{x,y\} \in E(G_i)}} \mathrm{cost}(B^{\{x,y\}}_i(F))\\
\intertext{Because we also have that}
|F| &\leq k'=k+s+ \sum_{i=1}^t |E(G_i)| \MEDS(H)+ \binom{k}{2} \mathrm{cost}(B), \\
\end{align*}
it follows directly that
\begin{align}
\sum_{1 \leq p < q \leq k} \sum_{\substack{x \in V_p\\ y \in V_q}} \sum_{\substack{i\in[t]\\ \{x,y\} \in E(G_i)}} \mathrm{cost}(B^{\{x,y\}}_i(F))
\leq \binom{k}{2} \cdot \mathrm{cost}(B) \text{.} \label{align::minimal_beneficial}
\end{align}
Therefore, there exist $1 \leq \bar{p} < \bar{q} \leq k$ such that
\begin{align*}
\sum_{\substack{x \in V_{\bar{p}}\\ y \in V_{\bar{q}}}} \sum_{\substack{i\in[t]\\ \{x,y\} \in E(G_i)}} \mathrm{cost}(B^{\{x,y\}}_i(F)) \leq \mathrm{cost}(B) \text{.}
\end{align*}
\begin{claim} \label{claim::cover}
The set $B_C:=\bigcup_{\substack{x \in V_{\bar{p}}\\ y \in V_{\bar{q}}}} \dot\bigcup_{\substack{i \in [t]\\ \{x,y\} \in E(G_i)}} B_i^{\{x,y\}}(F)$ contains exactly one copy of every vertex in $B$.
\end{claim}
\begin{claimproof}
Let $j \in [|B|]$. The vertex $s_{\bar{p},\bar{q}}^j \in S_{\bar{p},\bar{q}}$ is endpoint of an edge $f$ in $F_S$. Let $v$ be the other endpoint of this edge; hence $f=\{s_{\bar{p},\bar{q}}^j,v\}$. Since $F_S \subseteq E(S,\bigcup_{i=1}^t \bigcup_{e \in E(G_i)} B_i^e)$ and $s^j_{\bar{p},\bar{q}}$ is only adjacent to vertices in $\bigcup_{i=1}^t \bigcup_{e \in E(G_i)} B_i^e$ that correspond to vertex $b_j$ in $B$, it holds that $v=b^{\{x,y\}}_{i^*,j}$ for some $i^* \in [t]$, $x \in V_{\bar{p}}$, $y \in V_{\bar{q}}$ with $\{x,y\} \in E(G_{i^*})$. Thus, $B_C$ contains at least one copy of $b_j$ for all $j \in [|B|]$.
Assume, $B_C$ contains at least two copies of a vertex $b_j$ in $B$, with $j \in [|B|]$. Let $i_1,i_2 \in [t]$, let $e_1 \in E(V_{\bar{p}},V_{\bar{q}}) \cap E(G_{i_1})$, and let $e_2 \in E(V_{\bar{p}},V_{\bar{q}}) \cap E(G_{i_2})$ such that $b^{e_1}_{i_1,j}$, $b^{e_2}_{i_2,j}$ are contained in $B_C$ and either $i_1 \neq i_2$ or $e_1 \neq e_2$. Since both vertices $b^{e_1}_{i_1,j}$ and $b^{e_2}_{i_2,j}$ are only adjacent to vertex $s_{\bar{p},\bar{q}}^j \in S_{\bar{p},\bar{q}}$, the set $F_S$ is not a matching, which is a contradiction and proves the claim.
\end{claimproof}
Let $B_1, B_2,\ldots, B_h \subseteq B$ be the sets in $B$ that correspond to the nonempty sets in $\{ B_i^{\{x,y\}}(F) \mid x \in V_{\bar{p}}, y \in V_{\bar{q}}, i \in [t] \colon \{x,y\} \in E(G_i) \}$. That is, for each nonempty set $B_i^{\{x,y\}}(F)$, with $i\in[t]$, there is a set $B_r=\{b_j \mid b_{i,j}^{\{x,y\}}\in B_i^{\{x,y\}}(F)\}$.
It holds that the sets $B_1,B_2,\ldots, B_h$ are a partition of $B$ (Claim \ref{claim::cover}) and that $\sum_{r=1}^h \mathrm{cost}(B_r) \leq \mathrm{cost}(B)$ (inequality (\ref{align::minimal_beneficial})). This implies that $h=1$: Otherwise $B_1,B_2, \ldots, B_h$ would be a non-trivial partition of $B$ with $\mathrm{cost}(B) \geq \sum_{r=1}^h \mathrm{cost}(B_i)$ which implies that $B$ is not strongly beneficial (Proposition~\ref{proposition::properties}~(\ref{proposition::definition})).
Thus, there exists exactly one vertex $x \in V_{\bar{p}}$, exactly one vertex $y \in V_{\bar{q}}$, and exactly one $i^* \in [t]$ with the property that $\{x,y\} \in E(G_{i^*})$ and that $B_{i^*}^{\{x,y\}}(F)$ is not the empty set. Furthermore, it holds that $B_{i^*}^{\{x,y\}}(F) = B_{i^*}^{\{x,y\}}$ (Claim \ref{claim::cover}).
It follows that for each graph $H_i^e$ with $i \in [t]$ and $e \in E(G_i)$ either $B_i^e(F) = B_i^e$ or $B_i^e(F) = \emptyset$.
Therefore, for all $1 \leq p < q \leq k$ there exists exactly one edge $e \in E(V_p,V_q)$ and exactly one $i \in [t]$ such that $e \in E(G_i)$ and $B_i^e(F) = B_i^e$: Either all $1 \leq p < q \leq k$ fulfill inequation \ref{align::minimal_beneficial} with equality or there exist $1 \leq p'<q' \leq k$ such that inequation \ref{align::minimal_beneficial} holds with "$<$". This would imply that $B$ is not beneficial (see proof of Claim \ref{claim::cover} and definition of strongly beneficial).
Consequently, the edges in $F_S$ are incident with $\binom{k}{2}$ different copies of $H$ and cover the copy of $B$ in these $\binom{k}{2}$ copies.
Now, we consider which vertices are contained or not contained in $V(F_R)$.
It holds that $|F_R| \leq \sum_{i=1}^t |E(G_i)| \cdot \MEDS(H) - \binom{k}{2} (\mathrm{cost}(B)-|B|)$; to see this consider $k'\geq |F|=|F_S|+|F_T|+|F_Z|+|F_R|$.
For each graph $H_i^e$, with $i \in [t]$ and $e\in E(G_i)$, with $B_i^e(F) = \emptyset$ we need at least $\MEDS(H)$ edges to dominate all edges in $E(H_i^e)$ and for each graph $H_i^e$, here $i \in [t]$ and $e\in E(G_i)$, with $B_i^e(F) = B_i^e$ we need at least $\MEDS(H-B)$ edges to dominate all edges in $E(H_i^e-B_i^e)$. Since no two different copies of $H$ are adjacent, since $\MEDS(H-B)=\MEDS(H)-|B|+\mathrm{cost}(B)$, and since there are exactly $\binom{k}{2}$ copies of $H$ where the vertices that correspond to vertices in $B$ are covered by edges in $F_S$, it holds that we have exactly $\MEDS(H)$ resp.\ $\MEDS(H-B)$ edges of $F_R$ to dominate all edges in $H_i^e$ resp.\ $H_i^e - B_i^e$.
It follows, that $F_R$ contains no edge that has one endpoint in $W$ or $V$, because the vertex sets $V$ and $W$ are only adjacent to copies of vertices in $C$ in $G-X$ and a vertex $c \in C$ is neither extendable in $H$ nor in $H-B$. Hence, without using more than $\MEDS(H)$ resp.\ $\MEDS(H-B)$ edges to dominate all edges in $H$ resp.\ $H-B$ we cannot have an edge in $F_R$ that has one endpoint in $V \cup W$.
Let $i \in [t]$ and $e=\{x,y\} \in E(G_i)$ such that $B_i^e(F)=B_i^e$. It holds that $|F_i^e| = \MEDS(H-B)$, and therefore $C_i^e \nsubseteq V(F_i^e)$ (by definition of a control pair). Furthermore, $C_i^e \cap B_i^e$ is empty by the choice of $C$ and $B$. This implies that $N(C_i^e) = \{x,y\} \cup W(i) \subseteq V(F)$, i.e., that all neighbors of $C_i^e$ in $V$ and $W$ must be endpoints of $F$. It holds that $\{x,y\} \subseteq V(F_T)$ and $W(i) \subseteq V(F_Z)$ because neither edges in $F_S$ nor in $F_R$ have endpoints in $V\cup W$. Since, $|F_Z|=|W(i)|$ and $F_Z \subseteq E(Z,W)$ it follows that $V(F_Z) \cap W = W(i)$. Thus, all graphs $H_i^e$, here $i \in [t]$ and $e \in E(G_i)$, with $B_i^e(F)=B_i^e$ must belong to the same instance (because only edges in $F_Z$ contain edges that have endpoints in $W$ and because $F_Z$ has size $s=|W(i)|$).
Let $i^* \in [t]$ be the number of this instance and let $e=\{x,y \} \in E(G_{i^*})$ such that $B_{i^*}^e(F)=B_{i^*}^e$. It must hold that $x,y \in V(F_T)$ (because no other edges in $F$ have an endpoint in $V$). Since $|F_T|=k$ and $F_T \subseteq E(T,V)$ it follows that the $\binom{k}{2}$ graphs $H^e_{i^*}$, for $e \in E(G_{i^*})$, with $B_{i^*}^e(F)=B_{i^*}^e$ must correspond to a set of edges in $E(G_{i^*})$ that have their endpoints in the set $X=V(F_T) \cap V$ of size $k$.
Consequently, the set $X$ is a clique in $G_{i^*}$ and $(G_{i^*},k)$ is a $\mathrm{YES}$-instance of \prob{Multicolored-Clique}.
$(\Leftarrow:)$ This direction of the correctness proof is similar to the corresponding one in the proof of Theorem \ref{theorem::P3} and follows easily from the construction; we sketch this only briefly. If $(G_{i^*},k)$ is yes and $X=\{x_1,\ldots,x_k\}\subseteq V$ is a multicolored $k$-clique in $G_{i^*}$ with $x_j\in V_j$, for all $j \in [k]$, then select $k+s$ solution edges for $F$ in $E(T,V)$ and $E(Z,W)$ as for Theorem~\ref{theorem::P3}. In particular, this ensures that $W(i^*)\cup X\subseteq V(F)$. For each set $S_{p,q}$ with $1\leq p<q\leq k$ add the edges between the $d=|B|$ vertices between $S_{p,q}$ and the copy $B_{i^*}^{\{x_p,x_q\}}$ of $B$ in $H_{i^*}^{\{x_p,x_q\}}$. At this point, we have used up the budget (intuitively) intended for edges incident with $S$, $T$, and $Z$. All edges in $E(G[X'])$ are already dominated by $F$ as well as all edges incident with $S$; all edges in graphs $H_i^e$ and some edges between those graphs and $V\cup W$ remain.
In each graph $H_{i^*}^{\{x_p,x_q\}}$ for $1\leq p<q\leq k$ select an edge dominating set for $H_{i^*}^{\{x_p,x_q\}}-B_{i^*}^{\{x_p,x_q\}}$ of cost $\MEDS(H-B)$. Together with previously added edges incident with $B_{i^*}^{\{x_p,x_q\}}$, this dominates all edges in this copy of $H$. Furthermore, edges between $H_{i^*}^{\{x_p,x_q\}}$ and $V\cup W$ are already dominated because their other endpoints are in $X\cup W(i^*)\subseteq V(F)$. For all other graphs $H_i^e$, i.e. with $i\neq i^*$ or with $i=i^*$ but $e\notin E(G[X])$ we can select an edge dominating set of size $\MEDS(H)$ that is incident with $C_i^e$. This dominates all edges in this $H$-graph and, crucially, dominates all edges between $H_i^e$ and $V\cup W$ because their endpoints in $H_i^e$ are all in $C_i^e$. (This is the only place where we need the third property of control pairs.) Thus we have selected an edge dominating set and it can be readily checked that we have picked exactly $k'=s+k+\sum_{i=1}^t |E(G_i)| \cdot \MEDS(H) + \binom{k}{2} \cdot \mathrm{cost}(B)$. Note that $\binom{k}{2} \cdot \mathrm{cost}(B)$ is exactly the additional cost of selecting $\binom{k}{2}$ times an edge dominating set for $H_{i^*}^{\{x_p,x_q\}}-B_{i^*}^{\{x_p,x_q\}}$ and $|B|$ edges between $B_{i^*}^{\{x_p,x_q\}}$ and $S_{p,q}$ rather than the optimum solution for $H_{i^*}^e$.
\end{proof}
Theorem \ref{theorem::LB} implies that whenever we have a family of connected graphs $\mathcal{H}$ which contains at least one graph $H \in \mathcal{H}$ that has a control pair, then \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to an $\mathcal{H}$-component graph does not have a polynomial kernel unless \ensuremath{\mathsf{NP\subseteq coNP/poly}}\xspace.
Now, one can ask which connected graphs have a control pair and whether \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to an $\mathcal{H}$-component graph has a polynomial kernel when no graph in \ensuremath{\mathcal{H}}\xspace has a control pair.
First, we show which connected graphs have a control-pair. In a second step, we give a polynomial kernel for all remaining connected graphs of constant size.
\begin{lemma} \label{lemma::CP_Q}
Every connected graph $H$ that has at least one extendable vertex that is not free contains a control pair.
\end{lemma}
\begin{proof}
Since $H$ has an extendable vertex that is not free, there exists a vertex $v \in Q(H) \setminus W(H)$ and a minimum edge dominating set $F$ in $H$ such that for every minimum edge dominating set $F'$ in $H-v$, which has size $|F|-1$, it holds that $V(F) \setminus Q(H) \nsubseteq V(F')$: If there would be no such vertex $v \in Q(H) \setminus W(H)$, then it would hold that for all $v \in Q(H) \setminus W(H)$ and for all minimum edge dominating sets $F$ in $H$ there exists a minimum edge dominating set $F'$ in $H-v$ of size $|F|-1$ and with $V(F) \setminus Q(H) \subseteq V(F')$. This holds also for all vertices in $W(H)$ and would imply that $Q(H)$ is free. Now, let $v \in Q(H) \setminus W(H)$ be a vertex that is extendable but not free, and let $F$ be a minimum edge dominating set in $H$ such that there exists no minimum edge dominating set $F'$ (of size $|F|-1$) in $H-v$ with $V(F) \setminus Q(H) \subseteq V(F')$.
Let $C=V(F) \setminus Q(H)$ and $B=\{v\}$. Since $B=\{v\} \subseteq Q(H)$ it holds that $C \subseteq V \setminus (Q(H) \cup B)$. We will show that $(C,B)$ is a control pair. The set $B$ is strongly beneficial, because $v$ is extendable and not free (Proposition~\ref{proposition::properties}~(\ref{proposition::Q-W})). Furthermore, by construction, it holds that $F$ is a minimum edge dominating set with $C \subseteq V(F)$ and that for all minimum edge dominating set $F'$ in $H-B=H-v$ it holds that $C \nsubseteq V(F')$ (choice of $v$ and $C$).
It remains to show that no vertex in $C$ is extendable in $H-v$. Assume for contradiction that there exists a vertex $c \in C \cap Q(H-v)$. We will show that this implies that $c$ is also extendable in $H$, i.e., $c\in Q(H)$, which is a contradiction to the choice of $C$. Let $F_c$ be a minimum edge dominating set in $H-v-c$. Since $c$ is extendable in $H-v$, it holds that $|F_c|=\MEDS(H-v-c) = \MEDS(H-v)-1$. If $N_H(v) \setminus \{c\} = \emptyset$, then $F_c$ is also a minimum edge dominating set in $H-c$ and it would follow that $\MEDS(H-c)\leq |F_c|=\MEDS(H-v)-1 = \MEDS(H)-2$; but $\MEDS(H-c) \geq \MEDS(H)-1$ (Proposition~\ref{proposition::properties}~(\ref{proposition::vertex})), a contradiction. Thus, $N_H(v) \setminus \{c\} \neq \emptyset$ and we pick an arbitrary vertex $w\in N_H(v) \setminus \{c\}$. Now, $F_c \cup \{ \{v,w\} \}$ would be an edge dominating set in $H-c$ of size $\MEDS(H)-1$, hence $c$ would be extendable in $H$, which is a contradiction to the choice of $C$.
\end{proof}
\begin{lemma} \label{lemma::CP_U}
Every connected graph $H$ that has a strongly beneficial set that contains at least one uncovered vertex contains a control pair.
\end{lemma}
\begin{proof}
Let $B$ be a strongly beneficial set in $H$ that contains at least one uncovered vertex and let $C=N_H(B \cap U(H)) \setminus B$ be the neighborhood of all uncovered vertices in $B$ without the vertices in $B$. Since $H$ is connected and every vertex in $U(H)$ has no neighbor in $U(H)$ or $Q(H)$ (Proposition~\ref{proposition::properties}~(\ref{proposition::neighborhood})), it holds that $C \subseteq V(H) \setminus Q(H)$. Furthermore, $C$ is not the empty set. Otherwise, if all neighbours of $B \cap U(H)$ are also contained in $B$ then $\MEDS(H-B)=\MEDS(H-(B \setminus U(H)))$. This implies that $B$ is not beneficial which is a contradiction. We will show that $(C,B)$ is a control pair. The set $B$ is strongly beneficial and the set $C$ is a subset of $V(H) \setminus (Q(H) \cup B)$ (by choice). It holds that every minimum edge dominating set in $H$ contains $C$, because $C \subseteq N(U(H))$ (Proposition~\ref{proposition::properties}~(\ref{proposition::N(U)})). Moreover, there exists no minimum edge dominating set $F'$ in $H-B$ such that $C \subseteq V(F')$: If not then such a set $F'$ would also be a minimum edge dominating set in $H - (B \setminus U(H))$ because $U(H) \cap B\subseteq U(H)$ is an independent set (Proposition~\ref{proposition::properties}~(\ref{proposition::neighborhood})) and all neighbors of $U(H) \cap B$ are contained in $C$. But, this implies that $B$ is not beneficial because $\MEDS(H - \widetilde{B}) \leq \MEDS(H-B)$ where $\widetilde{B}=B \setminus U(H)\subsetneq B$.
Next, we show that no vertex in $C$ is extendable in $H-B$. Assume that there exists a vertex $c \in Q(H-B) \cap C$ that is extendable in $H-B$. Let $F'$ be a minimum edge dominating set in $H-B-c$; hence $|F'|=\MEDS(H-B)-1$. Since $c \in C = N_H(B \cap U(H))$, there exists a vertex $b \in B \cap U(H)$ with $\{c,b\} \in E(H)$. Now, $F' \cup \{\{c,b\}\}$ is an edge dominating set in $H-(B \setminus \{b\})$ of size $|F'|+1 = \MEDS(H-B)$. Thus, $\MEDS(H-(B \setminus \{b\})) \leq \MEDS(H-B)$, which implies that $B$ is not beneficial, which is a contradiction.
\end{proof}
\begin{lemma} \label{lemma::CP_R}
Every connected graph $H$ that contains at least one vertex that is not in $N[W(H)] \cup U(H)$ contains a control pair.
\end{lemma}
\begin{proof}
We can assume that the graph $H$ neither contains an extendable vertex that is not free nor a strongly beneficial set which contains at least one uncovered vertex; otherwise we can apply Lemma \ref{lemma::CP_Q} resp.\ Lemma \ref{lemma::CP_U} to find a control pair.
First, we prove that there exists a vertex $v \notin N[W(H)] \cup U(H)$ that is not contained in every minimum edge dominating set of $H$.
Assume for contradiction that every vertex in $R:= V(H) \setminus (N[W(H)] \cup U(H) )$ is contained in every minimum edge dominating set of $H$. Let $v \in R$ and let $F$ be a minimum edge dominating set in $H$ with $|N_H(v) \cap V(F)|$ maximal. Let $x \in V(H)$ such that $\{v,x\} \in F$; note that $x \notin W(H)$, because $v \notin N[W(H)]$. Consider the vertex set $X:=N_H(v) \setminus V(F)$. It holds that $X$ neither contains a vertex of $R$ (because every vertex in $R$ is contained in every minimum edge dominating set) nor a vertex of $W(H)$ (because $v \notin N[W(H)]$). In addition, $X$ contains no vertex of $N(W(H))$: If $X$ would contain a vertex in $N(W(H))$ then we know that there exists an edge dominating set $F'$ in $H$ such that $(V(F) \cup N(W(H)) \setminus W(H) \subseteq V(F')$ (Proposition~\ref{proposition::properties}~(\ref{proposition::N(W)IN})). This implies that $|N_H(v) \cap V(F)| < |N_H(v) \cap V(F')|$ because $N_H(v) \cap V(F')$ contains all vertices that are contained in $N_H(v) \cap V(F)$ and the vertex in $N(W(H))$ that is contained in $X$; note that $W(H) \cap N_H(v) = \emptyset$. Furthermore, $X$ is not the empty set because this would imply that $x$ is extendable but not free: The set $F - \{\{x,v\}\}$ would be a minimum edge dominating set of $H-x$, because $N_H(v) \subseteq V(F)$. Thus, the set $X$ is contained in $U(H)$ and not empty. Let $Y = X \cup \{x\}$.
The set $F - \{\{v,x\}\}$ is an edge dominating set in $H-Y$ because $F- \{v,x\}$ dominates all edges in $H-Y$ that are not adjacent to $v$ (the vertex $x$ is contained in $Y$), and vertex $v$ is only adjacent to the vertices in $Y$ and vertices that are contained in $V(F)$. Thus, it holds that $\MEDS(H-Y) < \MEDS(H)$.
This implies that there exists a strongly beneficial set $B \subseteq Y$ (Proposition~\ref{proposition::properties}~(\ref{proposition::strongly})). Since $x \notin W(H)$ and every extendable vertex is also free, no vertex in $Y$ is extendable and, therefore, $|B| \geq 2$ (Proposition~\ref{proposition::properties}~(\ref{proposition::Q-W}) and (\ref{proposition::disjointQ})). This directly implies that $B \cap U(H) \neq\emptyset$ because $Y$ contains only one element, namely $x$, that is not in $U(H)$. This, however, is a contradiction since we assumed that $H$ contains no strongly beneficial set that contains at least one uncovered vertex. Thus, there exists a vertex in the set $R$ that is not contained in every minimum edge dominating set.
Let $v \in R$ be such a vertex that is not contained in every minimum edge dominating set and let $F$ be a minimum edge dominating set in $H$ that contains $v$ (such a minimum edge dominating set exists; otherwise $v$ would be uncovered). Let $x \in V(H)$ such that $\{v,x\} \in F$. The vertex $x$ is not contained in $W(H)$ because vertex $x$ is adjacent to vertex $v$, and because vertex $v$ is in $R$. Hence, neither vertex $v$ nor vertex $x$ are extendable because every extendable vertex is also free.
The fact that $v,x \notin Q(H)$ together with Proposition~\ref{proposition::properties}~(\ref{proposition::BFSedge}) implies that the set $B=\{v,x\}$ is strongly beneficial.
Let $C:=N_H(v) - x$. It holds that $C \cap Q(H)$ is empty because $W(H)=Q(H)$ and $v \notin N[W(H)]$. Furthermore, $C \cap B$ is empty (by choice of $C$).
Next, we will show that $(C, B)$ is a control pair. We already showed that $B$ is strongly beneficial. Recall that we chose a vertex $v \in R$ that is not contained in every minimum edge dominating set of $H$. Thus, there exists a minimum edge dominating set $F_v$ in $H$ that does not contain $v$. This edge dominating must contain all vertices in $N_H(v)$. Since $C$ is a subset of $N_H(v)$, there exists a minimum edge dominating $\hat{F}$ in $H$ with $C \subseteq V(\hat{F})$. Furthermore, there exists no minimum edge dominating set $F_B$ in $H-B$ with $C \subseteq V(F_B)$: Otherwise, $x$ would be extendable (and not free) because $F_B$ would also be an edge dominating set in $H-x$. To prove that no vertex in $C$ is extendable in $H-B$ assume for contradiction that there exists a vertex $c \in C$ that is extendable in $H-B$. Thus, there exists a minimum edge dominating set $F_c$ in $H-B-c$ of size $\MEDS(H-B)-1$. We can extend $F_c$ to an edge dominating set in $H-c$ of size $\MEDS(H-B)=\MEDS(H)-1$ by adding the edge $\{v,x\}$ to $F_c$. But now, $c$ would also be extendable in $H$, which contradicts the assumption.
\end{proof}
So far, we showed that every connected graph $H$ that contains an extendable vertex that is not free, a vertex in $V(H) \setminus (N[W(H)] \cup U(H) )$, or a strongly beneficial set that contains at least one vertex of $U(H)$ has a control pair. Thus, for all remaining connected graphs $H$ it holds that every extendable vertex is also free ($Q(H)=W(H)$) and that $V(H) \setminus (N[W(H)] \cup U(H) )$ is empty; hence $V(H) = N[W(H)] \cup U(H)$. Moreover, no strongly beneficial set contains any vertex of $U(H)$ and, hence, strongly beneficial sets must be subsets of $N(W(H))$; recall that (strongly) beneficial sets are subsets of $V(H)\setminus W(H)$.
\begin{lemma}\label{lemma::CP_other}
Every connected graph $H$ that has a strongly beneficial set $B\subseteq N(W(H))$ such that no minimum edge dominating set $F_B$ of $H-B$ covers all vertices of $N(W(H))\setminus B$ contains a control pair.
\end{lemma}
\begin{proof}
We can assume that graph $H$ neither contains an extendable vertex that is not free, a strongly beneficial set which contains at least one uncovered vertex, nor a vertex that is not in $N[W(H)] \cup U(H)$; otherwise we can apply Lemma \ref{lemma::CP_Q} resp.\ Lemma \ref{lemma::CP_U} resp.\ Lemma \ref{lemma::CP_R}. Thus $H=N[W(H)] \cup U(H)$ and every strongly beneficial set is contained in $N(W(H))$.
Note that every strongly beneficial set $B \subseteq N(W(H))$ with the property that there exists no minimum edge dominating set in $H-B$ that contains all vertices of $N(W(H)) \setminus B$ together with the set $C=N(W(H)) \setminus B$ fulfills all except one property of a control pair: The set $B$ is strongly beneficial, $C \subseteq V(H) \setminus (Q(H) \cup B)$, and for every minimum edge dominating set $F_B$ in $H-B$ is holds that $C \nsubseteq V(F_B)$ (choice of $B$). Furthermore, there exists a minimum edge dominating set $F$ in $H$ such that $C \subseteq V(F)$, because $C \subseteq N(W(H))$ (Proposition~\ref{proposition::properties}~(\ref{proposition::N(W)IN})). But, we do not know whether $C \cap Q(H-B) = \emptyset$. We will show that if there exists a strongly beneficial set $B$ in $H$ such that no minimum edge dominating set in $H-B$ contains $N(W(H)) \setminus B$, then there exists also a strongly beneficial set $B'$ in $H$ such that no minimum edge dominating set in $H-B'$ contains $C'=N(W(H)) \setminus B'$, and such that $Q(H-B') \cap C' = \emptyset$.
Let $B \subseteq N(W(H))$ be a strongly beneficial set in $H$ such that no minimum edge dominating set of $H-B$ contains all vertices in $C:=N(W(H)) \setminus B$, and with $|Q(H-B) \cap C|$ minimal under these strongly beneficial sets. (Such a set $B$ exists by assumption.) If $Q(H-B) \cap C = \emptyset$, then $B$ fulfills the desired property and $(B,C)$ is a control pair. Thus, assume that $|Q(H-B) \cap C|>0$ and let $c \in Q(H-B) \cap C$.
We show that $B'=B \cup \{c\}$ is a strongly beneficial set in $H$ that fulfills the same properties as $B$, and with $|Q(H-B) \cap C| > |Q(H-B') \cap C'|$, where $C'=N(W(H)) \setminus B'$, which is a contradiction to the choice of $B$.
\begin{claim}
The set $B'=B \cup \{c\}$ is a strongly beneficial set in $H$.
\end{claim}
\begin{claimproof}
It holds that $\MEDS(H-B')+1 = \MEDS(H-B)$, because $c$ is extendable in $H-B$ (and $H-B'=(H-B)-c$). This implies that $\mathrm{cost}(B')=\mathrm{cost}(B)$, because $\mathrm{cost}(B')=\MEDS(H-B') + |B'|-\MEDS(H) = \MEDS(H-B) - 1 + |B|+1 - \MEDS(H) = \mathrm{cost}(B)$.
First, assume for contradiction that $B'$ is not beneficial. Hence, there exists a proper subset $\widetilde{B} \subsetneq B'$ of $B'$ such that $\MEDS(H-B') \geq \MEDS(H-\widetilde{B})$ (definition of beneficial). Note that $B \setminus \widetilde{B} \neq \emptyset$ is not the empty set, otherwise $\widetilde{B}=B$ and $\MEDS(H-\widetilde{B})=\MEDS(H-B) > \MEDS(H-B')$. Since $\widetilde{B} \setminus \{c\} \subseteq \widetilde{B}$ (they can be equal if $c \notin \widetilde{B}$) and $|\widetilde{B} \setminus (\widetilde{B} \setminus \{c\})|\leq 1$ it follows from Proposition~\ref{proposition::properties}~(\ref{proposition::monoton}) that $\MEDS(H - \widetilde{B}) \geq \MEDS(H- (\widetilde{B} \setminus \{c\})) - 1$. Combining the above inequations we obtain:
\[
\MEDS(H-B) = \MEDS(H-B')+1 \geq \MEDS(H-\widetilde{B}) +1 \geq \MEDS(H-(\widetilde{B} \setminus \{c\}))
\]
But, this implies that $B$ is not beneficial because $\widetilde{B} \setminus \{c\} \subsetneq B$ (we showed that $B \setminus \widetilde{B} \neq \emptyset$), and $\MEDS(H-B) \geq \MEDS(H-(\widetilde{B} \setminus \{c\}))$. This contradicts the choice of $B$, hence $B'$ is beneficial.
Next, we show that $B'$ is strongly beneficial. Again, assume for contradiction that $B'$ is not strongly beneficial (but beneficial). Thus, there exists a non-trivial partition $B_1,B_2,\ldots, B_h$ of $B'$ such that $\mathrm{cost}(B') \geq \sum_{i=1}^h \mathrm{cost}(B_i)$ (Proposition~\ref{proposition::properties}~(\ref{proposition::definition})). We assume w.l.o.g.\ that $c \in B_1$ and it follows from Proposition~\ref{proposition::properties}~(\ref{proposition::monoton}) that $\mathrm{cost}(B_1 \setminus \{c\}) \leq \mathrm{cost}(B_1)$. It holds that $B_1 \setminus \{c\}, B_2, \ldots, B_h$ is a partition of $B$. Additionally, $B_1 \setminus \{c\}, B_2, \ldots, B_h$ is a non-trivial partition of $B$ if $B_1 \setminus \{c\} \neq \emptyset$, because $h \geq 2$ and no set is the empty set. Furthermore, $B_2,B_3, \ldots, B_h$ is a non-trivial partition of $B$ if $B_1 \setminus \{c\} = \emptyset$: Otherwise it holds that $B_1=\{c\}$ and $B_2=B$ which implies that $\mathrm{cost}(B_1)+\mathrm{cost}(B_2)=1+\mathrm{cost}(B) = 1+ \mathrm{cost}(B') > \mathrm{cost}(B')$ which is a contradiction. (Note that the first equality holds because $c \in N(W(H))$ is not extendable in $H$). Now, it holds that
\[
\mathrm{cost}(B_1 \setminus \{c\}) + \sum_{i=2}^h \mathrm{cost}(B_i) \leq \sum_{i=1}^h \mathrm{cost}(B_i) \leq \mathrm{cost}(B') = \mathrm{cost}(B).
\]
But this implies that $B$ is not strongly beneficial, because we showed that there exists a non-trivial partition $(B_1 \setminus \{c\},) B_2, \ldots B_h$ of $B$ with $\sum_{i=1}^h \mathrm{cost}(B_i) \leq \mathrm{cost}(B)$. This is a contradiction, thus $B'$ is strongly beneficial.
\end{claimproof}
Now, we will show (by contradiction) that there exists no minimum edge dominating set $F_{B'}$ in $H-B'$ such that $C':=N(W(H)) \setminus B' \subseteq V(F_{B'})$. Assume that there exists a minimum edge dominating set $F_{B'}$ in $H-B'$ such that $C' \subseteq V(F_{B'})$. The set $F_B=F_{B'} \cup \{\{c,v\}\}$ with $v \in N_{H-B}(c)$ is a minimum edge dominating set of size $|F|+1=\MEDS(H-B')+1=\MEDS(H-B)$ in $H-B$ because $F_B$ dominates all edges in $H-B'$ and all edges that are incident with $c$ (since $c \in V(F_B)$). (Note that $N_{H-B}(c)$ is not empty, because $c \in N(W(H))$ and $W(H) \cap B = \emptyset$ (definition of beneficial sets).) But, the minimum edge dominating set $F_B$ in $H-B$ contains all vertices in $C:=N(W(H)) \setminus B$ as an endpoint: it holds $C = C' \cup \{c\}$ and $C' \subseteq V(F_{B'}) \subseteq V(F_B)$ as well as $c \in V(F_B)$.
This contradicts the choice of $B$, hence there exists no minimum edge dominating set $F_{B'}$ in $H-B'$ such that $C' \subseteq V(F_{B'})$.
Finally, we show that $|Q(H-B) \cap C| > |Q(H-B') \cap C'|$ which contradicts the choice of $B$.
\begin{claim}
It holds that $Q(H-B') \cap C' \subsetneq Q(H-B) \cap C$
\end{claim}
\begin{claimproof}
$(\subseteq :)$ Let $v \in Q(H-B') \cap C')$ be a vertex that is extendable in $H-B'$. (If $Q(H-B')$ is empty then $Q(H-B') \cap C' \subseteq Q(H-B) \cap C$.) Thus, there exists a minimum edge dominating set $F'_v$ in $H-B'-v$ of size $\MEDS(H-B')-1$. Consider $F_v:=F'_v \cup \{\{c,u\}\}$ with $u \in N_{H-B-v}(c)$. (Again, $N_{H-B-v}(c) \neq \emptyset$ because $c$ is adjacent to a vertex in $W(H)$ and $W(H) \cap (B' \cup \{v\}) = \emptyset$.)
The set $F_v$ is an edge dominating set (of size $\MEDS(H-B')=\MEDS(H-B)-1$) in $H-B-v$ because $F_v$ dominates all edges in $H-B'-v$ and all edges that are incident with $c$. Furthermore, $F_v$ is a minimum edge dominating set in $H-B-v$ because $|F_v| \geq \MEDS(H-B-v) \geq \MEDS(H-B) -1=|F_v|$ (Proposition~\ref{proposition::properties}~(\ref{proposition::vertex})). It follows that $\MEDS(H-B-v)=\MEDS(H-B)-1$; thus $v \in Q(H-B)$ (definition of extendable vertices). Hence, $Q(H-B') \cap C' \subseteq Q(H-B) \cap C$.
$(\neq:)$ The vertex $c$ is extendable in $H-B$ (choice of $c$); hence $c \in Q(H-B) \cap C$. But $c$ is not extendable in $H-B'$, because $c \in B'$ and thus not contained in $H-B'$. This implies $Q(H-B) \cap C \neq Q(H-B') \cap C'$ and concludes the proof.
\end{claimproof}
Now, $B'$ is a strongly beneficial set in $H$ such that no minimum edge dominating set $F_{B'}$ in $H-B'$ contains all vertices in $C'$. Furthermore, $Q(H-B') \cap C' \subsetneq Q(H-B) \cap C$ which contradicts the choice of $B$ because $|Q(H-B') \cap C'| < |Q(H-B) \cap C|$.
Overall, we showed that there exists a strongly beneficial set $B \subseteq N(W(H))$ such that there exists no minimum edge dominating set in $H-B$ that covers all vertices of $C:=N(W(H)) \setminus B \subseteq V \setminus (Q(H) \cup B)$ and such that $Q(H-B) \cap C = \emptyset$. It holds that $(B,C)$ is a control pair (see argumentation above).
\end{proof}
\subsection[Generalizing the upper bound obtained for P5-component graphs]{Generalizing the upper bound obtained for $\boldsymbol{P_5}$-component graphs}
We showed for many finite sets \ensuremath{\mathcal{H}}\xspace that \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to an $\mathcal{H}$-component graph has a no polynomial kernel, unless \ensuremath{\mathsf{NP\subseteq coNP/poly}}\xspace.
Now, we will show that \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to \ensuremath{\mathcal{H}}\xspace-component graphs admits a polynomial kernel for all remaining choice of finite sets $\ensuremath{\mathcal{H}}\xspace$. Recall that all remaining sets \ensuremath{\mathcal{H}}\xspace only contain graphs $H$ with $V(H)=N[W(H)] \cup U(H)$. Furthermore, it holds for every strongly beneficial set $B$ in $H$ that there exists a minimum edge dominating set $F_B$ in $H-B$ with $N(W(H)) \setminus B \subseteq V(F_B)$.
We first show that if no graph in \ensuremath{\mathcal{H}}\xspace has any beneficial set then there is a kernel with $\mathcal{O}(|X|^2)$ vertices and $\mathcal{O}(|X|^3)$ edges. (Recall, for every kernel lower bound we showed that there exists a strongly beneficial set, thus all graphs that have no beneficial set can only have vertices that are uncovered, free, or neighbours of free vertices.) This will later be extended to a more involved kernelization that also handles $H$-components where $H$ does have beneficial sets but they always have a minimum edge dominating set $F_B$ in $H-B$ as above.
\begin{lemma} \label{lemma::kernel1}
Let $\ensuremath{\mathcal{H}}\xspace$ be a finite set of connected graphs that contain no beneficial sets and such that each graph $H\in\ensuremath{\mathcal{H}}\xspace$ has $V(H)=N[W(H)]\cup U(H)$, i.e., each graph $H$ only has vertices that are uncovered, free, or neighbors of a free vertex. Then \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator $X$ to an $\mathcal{H}$-component graph admits a kernel with $\mathcal{O}(|X|^2)$ vertices, $\mathcal{O}(|X|^3)$ edges, and size $\mathcal{O}(|X|^3\log|X|)$.
\end{lemma}
\begin{proof}
Let $(G,k,X)$ be an instance of \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to an $\mathcal{H}$-component graph.
We can assume that $k - \MEDS(G-X) < |X|$. Otherwise, we can return a trivial solution consisting of a minimum edge dominating set in $G-X$ and one edge in $\delta_G(x)$ for each $x \in X$. Let $\mathcal{C}$ be the set of connected components in $G-X$, let $W$ be the set of all free vertices in $G-X$, and let $U$ be the set of all uncovered vertices in $G-X$, hence $W = \bigcup_{C \in \mathcal{C}} W(C)$ and $U = \bigcup_{C \in \mathcal{C}} U(C)$.
%
Let $X_W \subseteq X$ be the set of vertices in $X$ that are adjacent to a vertex in $W$, hence $X_W= \{ x \in X \mid \exists w \in W \colon \{x,w\} \in E(G) \}$, and let $\mathcal{C}_W$ be the set of connected components $C$ in $\mathcal{C}$ where $W(C)$ is adjacent to a vertex in $X_W$, hence with $E(W(C),X_W) \neq \emptyset$.
To find vertices in $X$ that can be covered by every edge dominating set of size at most $k$ without spending extra budged we construct a bipartite graph $G_W$. One part of $G_W$ is the set $X_W$ and the other part consists of one vertex $s_C$ for each connected component $C$ in $\mathcal{C}_W$. We add an edge between a vertex $x \in X_W$ and a vertex $s_C$ with $C \in \mathcal{C}_W$ if and only if vertex $x$ is adjacent to a vertex in $W(C)$ in $G$. Now, we apply Theorem \ref{theorem::matching} to obtain either a maximum matching in $G_W$ that saturates $X_W$, or to find a set $Y \subseteq X_W$ such that $|N_{G_W}(Y)|<|Y|$ and such that there exists a maximum matching in $G_W - N_{G_W}[Y]$ that saturates $X_W \setminus Y$.
If there exists a maximum matching in $G_W$ that saturates $X_W$ then let $X_W^h=X_W$, let $X_W^l=\emptyset$, and let $\mathcal{C}_W^l=\emptyset$. Otherwise, if there exists a set $Y$ with the above properties then let $X_W^l=Y$, let $X_W^h=X_W \setminus Y$, and let $\mathcal{C}_W^l$ be the connected components $C$ in $\mathcal{C}_W$ where $W(C)$ is adjacent to a vertex in $X_W^l$. It holds that $|\mathcal{C}_W^l|=|N_{G_W}(Y)|<|Y|=|X_W^l|$ because every connected component in $\mathcal{C}_W^l$ corresponds to a vertex in $N_{G_W}(Y)$; hence $|\mathcal{C}_W^l| \leq |X_W^l|$.
\begin{redrule} \label{rule::W}
Delete the set $X_W^h$ from $G$, i.e., let $G'=G-X_W^h$, $X'=X \setminus X_W^h$ and $k'=k$.
\end{redrule}
\begin{claim} \label{claim::X_W}
Reduction Rule \ref{rule::W} is safe.
\end{claim}
\begin{claimproof}
Let $F$ be an edge dominating set of size at most $k$ in $G$. We construct an edge dominating set $F'$ of size at most $k'=k$ in $G'$ as follows: First, we delete every edge $e \in F$, if both endpoints of $e$ are contained in $X_W^h$. Next, for every edge $e=\{x,y\} \in F$ that has exactly one endpoint in $X_W^h$ (w.l.o.g.\ $x \in X_W^h$) we either replace $e$ by one edge in $\delta_{G'}(y)$, if $\delta_{G'}(y) \neq \emptyset$ or delete $e$, if $\delta_{G'}(y) = \emptyset$. It holds that $F'$ has size at most $k=k'$ because we only delete edges or replace edges. Furthermore, $V(G') \setminus V(F')$ is an independent set because $V(F')$ contains every vertex in $V(F) \setminus X_W^h$ that is not isolated in $G'$, because $V(G) \setminus V(F)$ is an independent set, and because $V(G')=V(G) \setminus X_W^h$. Thus, $F'$ is an edge dominating set of size at most $k'$ in $G'$.
For the other direction, let $F'$ be an edge dominating set of size at most $k'$ in $G'$ that is also a matching.
Let $M$ be a maximum matching in $G_W - N_{G_W}[X_W^l]$ that saturates $X_W^h$, and for each $x \in X_W^h$ let $C_x$ be the connected component in $\mathcal{C}_W$ with $\{s_C,x\} \in M$. Consider the connected component $C_x$ for a vertex $x \in X_W^h$.
Since $M$ is a maximum matching in $G_W - N_{G_W}[X_W^l]$ it holds that the connected component $C_x$ does not correspond to a vertex in $N_{G_W}(X_W^l)$. This implies that no free vertex in $C_x$ is adjacent to a vertex in $X_W^l$ (construction of $G_W$).
Let $F'_x$ be the set of edges in $F'$ that have at least one endpoint in $C_x$; hence $F'_x=\{f \in F' \mid f \cap C_x \neq \emptyset\}$. We partition $F'_x$ in three sets: Let $F'_{x,1}$ be the set of edges in $F'_x$ that have one endpoint in $X$ and the other endpoint in $C_x$, let $F'_{x,2}$ be the set of edges in $F'_x$ that have one endpoint in $U(C_x)$ and the other endpoint in $N(W(C_x))$, and let $F'_{x,3}$ be the set of remaining edges in $F'_x$. Recall that uncovered vertices are only adjacent to vertices in $N(W(C_x)) \cup X$ (Proposition~\ref{proposition::properties}~(\ref{proposition::neighborhood})). Thus, all edges in $F'_x$ that have one endpoint in $U(C_x)$ (the set of uncovered vertices in $C_x$) are contained in $F'_{x,1} \cup F'_{x,2}$. Let $B_x$ be the set of vertices in $C_x$ that are incident with an edge in $F'_{x,1} \cup F'_{x,2}$, hence $B_x=V(C_x) \cap V(F'_{x,1} \cup F'_{x,2})$.
Recall that every vertex in $W(C_x)$ is only adjacent to vertices in $N(W(C_x))$ because no free vertex of $C_x$ is adjacent to a vertex in $X_W^l$ (and we delete set $X_W^h$ to obtain $G'$). Thus, $V(F'_{x,1} \cup F'_{x,2})$ contains no free vertex of $C_x$ because no free vertex in of $C_x$ is adjacent to a vertex in $X$ or an uncovered vertex of $C_x$; thus $B_x \subseteq N(W(C_x)) \cup U(C_x)$.
Since $C_x$ has no beneficial set, it holds that $\MEDS(C_x-B_x) = \MEDS(C_x)$ (Proposition~\ref{proposition::properties}~(\ref{proposition::BFS})); thus, $F'_x$ has size at least $\MEDS(C_x)$ plus the size of $|F'_{x,1} \cup F'_{x,2}|$. Furthermore, $F'_{x,3}$ is an edge dominating set in $C_x - B_x$ (by choice of $B_x$); thus $|F'_{x,3}| \geq \MEDS(C_x-B_x) = \MEDS(C_x)$. It follows that $|F'_x|=|F'_{x,1} \cup F'_{x,2}|+|F'_{x,3}| \geq |F'_{x,1} \cup F'_{x,2}| + \MEDS(C_x)$.
Let $w_x \in N_G(x) \cap W(C_x)$ be a free vertex in $C_x$ that is adjacent to $x \in X_W^h$. We replace $F'_{x,3}$ by the set $F_{x,3}$ that consists of a minimum edge dominating set in $C_x - w_x$ that covers all vertices in $N(W(C_x))$ (which exists by Proposition~\ref{proposition::properties}~(\ref{proposition::N(W)IN})) and the edge $\{w_x,x\}$. The edge set $F_{x,3}$ has size $\MEDS(C_x)$ because $w_x \in W(C_x)$ (definition of free); hence $|F_{x,3}| \leq |F'_{x,3}|$. We do this for all $x \in X_W^h$ to obtain $F$.
It holds that $F$ has the same size as $F'$ because we only replace $F'_{x,3}$ by $F_{x,3}$ for each $x \in X_W^h$, and because $|F_{x,3}| \leq |F'_{x,3}|$.
It remains to prove that $F$ is indeed an edge dominating set in $G$. The set $V(F)$ contains all vertices in $V(F')$, except some free vertices in the connected components where we change the edge dominating set. But, all neighbours of these free vertices are contained in $V(F)$, because these free vertices are only adjacent to vertices in $X_W^h$, which are contained in $V(F)$, and to vertices in the connected component of $G-X$ they belong to. Thus, $F$ is an edge dominating set in $G$.
\end{claimproof}
Now, let $X_U \subseteq X$ be the set of vertices in $X$ that are adjacent to a vertex in $U$, hence $X_U= \{ x \in X \mid \exists u \in U \colon \{x,u\} \in E(G) \}$. We partition $X_U$ in two sets as follows: let $X_U^h \subseteq X_U$ be the set of vertices in $X_U$ that are adjacent to the set of uncovered vertices in at least $|X|+1$ connected components (hence $X_U^h = \{ x \in X_U \mid \exists C_1,C_2,\ldots,C_{|X|+1} \in \mathcal{C} \forall j \in [|X|+1] \colon x \in N_G(U(C_j)) \}$) and let $X_U^l = X_U \setminus X_U^h$ be the set of vertices in $X_U$ that are adjacent to the set of uncovered vertices in less than $|X|$ connected components in $\mathcal{C}$. By $\mathcal{C}_U^l$ we denote the connected components $C$ in $\mathcal{C}$ with $E(U(C),X_U^l) \neq \emptyset$. It holds that $|\mathcal{C}_U^l| \leq |X_U^l| \cdot |X|$.
\begin{redrule} \label{rule::U}
For all $x \in X_U^h$ add a vertex $x'$ and the edge $\{x,x'\}$ to $G$.
\end{redrule}
Let $\mathcal{C}_S$ be the set of new connected components in $G'$; these are the connected components consisting of a single vertex $x'$ that we add during Reduction Rule \ref{rule::U}.
It is easy to verify that Reduction Rule \ref{rule::U} is safe, i.e.\ that there exists a solution for $(G,k,X)$ if and only if there exists a solution for $(G',k',X')$. This follows from the fact that every edge dominating set $F$ in $G$ of size at most $k$ must contain the vertices in $X_U^h$ as endpoints: If there would be a vertex $x \in X_U^h$ that is not contained in $V(F)$, then there exist at least $|X|+1$ connected components that contain a vertex in $U$ that is adjacent to $x$. Now, these at least $|X|+1$ vertices must be contained in $V(F)$. But, every connected component $C$ with this property is adjacent to $\MEDS(C) +1$ edges in $F$ because no minimum edge dominating set in $C$ covers an uncovered vertex. Thus, $|F| \geq \MEDS(G-X) + |X|+1 > k$ because two connected components in $G-X$ are not adjacent. This is a contradiction and shows that every vertex in $X_U^h$ must be contained in an edge dominating set of size at most $k$ in $G$. By adding the vertex $x'$ and the edge $\{x,x'\}$, with $x \in X_U^h$, to $G$, we encode that vertex $x$ must be in every solution.
Let $\mathcal{C}_D \subseteq \mathcal{C}$ be the set of connected components in $G-X$ that are not contained in $\mathcal{C}_U^l \cup \mathcal{C}_W^l \cup \mathcal{C}_S$. Note, $\mathcal{C}_D$ contains all connected components where neither a free nor an uncovered vertex is adjacent to a vertex in $X$.
\begin{redrule} \label{rule::delete}
Delete all connected components in $\mathcal{C}_D$ and decrease $k$ by the size of a minimum edge dominating set in $\mathcal{C}_D$.
\end{redrule}
\begin{claim}
Reduction Rule \ref{rule::delete} is safe.
\end{claim}
\begin{claimproof}
Let $F$ be an edge dominating set of size at most $k$ in $G$. If no edge in $F$ has one endpoint in a connected component of $\mathcal{C}_D$ and the other endpoint in $X$, then $F' = F \setminus E(\mathcal{C}_D)$ is an edge dominating set of size at most $|F| - \MEDS(\mathcal{C}_D) \leq k'$ in $G'$ and we are done. Thus, assume that there exists at least one edge that has one endpoint in $X$ and one endpoint in a connected component of $\mathcal{C}_D$; hence $F \cap E(V(\mathcal{C}_D),X) \neq \emptyset$. We denote the set of edges in $F$ that are incident with a connected component in $\mathcal{C}_D$ by $F_D$, and let $F_{D,X} = F \cap E(V(\mathcal{C}_D),X)$.
It holds that every vertex $v$ in $V(F_{D,X})$ is not a free vertex: Otherwise, there exists a vertex $x \in X_W$ such that $\{x,v\} \in F_{D,X}$. But, we delete every vertex in $X_W^h$ during Reduction Rule \ref{rule::W} and every connected component that contains a free vertex that is adjacent to a vertex in $X_W^l$ is a connected component in $\mathcal{C}_W^l$ and therefore not in $\mathcal{C}_D$.
Let $\widetilde{X} \subseteq X$ be the set of vertices in $X$ that are contained in $V(F_D)$, hence $\widetilde{X}=X \cap V(F_D)$. Since no vertex in $\widetilde{X}$ is adjacent to a free vertex in $\mathcal{C}_D$, and since the connected components do not have beneficial sets it holds that the size of a minimum edge dominating set in $\mathcal{C}_D$ plus the size of the set $\widetilde{X}$ is smaller or equal to the number of edges in $F_D$.
Now, to obtain an edge dominating set $F'$ of size at most $k'$ in $G'$, we delete the edge set $F_D$ from $F$ and we add for all vertices $x \in \widetilde{X}$ exactly one edge of the set $\delta_{G'}(x)$ to the edge dominating set (or none if the edge set $\delta_{G'}(x)$ is empty). By construction it follows that $F'$ has size at most $k'$ because we delete $|F_D| \geq \MEDS(\mathcal{C}_D) + |\widetilde{X}|$ edges from $F$ and add at most $|\widetilde{X}|$ edges to $F$. Furthermore, $F'$ is an edge dominating set in $G'$, because $V(F')$ contains all vertices of $V(F)$ that are contained in $V(G')$ and not isolated in $G'$.
For the other direction, let $F'$ be an edge dominating set of size at most $k'$ in $G'$. To obtain an edge dominating set $F$ of size at most $k$ in $G$ we add for every connected component $C \in \mathcal{C}_D$ a minimum edge dominating set $F_C$ in $C$ with $N(W(C)) \subseteq V(F_C)$ to $F'$ (the existence of such a minimum edge dominating set follows from Proposition~\ref{proposition::properties}~(\ref{proposition::N(W)IN})). To show that $F$ is indeed an edge dominating set in $G$ we only have to show that every edge $e \in E(\mathcal{C}_D,X)$ is dominated by $F$. All other edges are dominated by $F$, because they are already dominated by $F' \subseteq F$ or by $F_C$ with $C \in \mathcal{C}_D$.
Assume for contradiction that there exists a connected component $C \in \mathcal{C}_D$ and an edge $e=\{v,x\}$ in $G$ with $v \in V(C)$ and $x \in X$ such that neither vertex $v$ nor vertex $x$ is an endpoint of an edge in $F$. Since all vertices in $N(W(C))$ are endpoints of an edge in $F$ (choice of $F_C$), and since $C$ contains only free vertices, neighbours of free vertices and uncovered vertices, it holds that $v$ is either a free or uncovered vertex in $C$; hence $x$ is contained in $X_W \cup X_U$. It holds that all vertices in $X_U^h$ are contained in $V(F') \subseteq V(F)$ because every vertex $x$ in $X_U^h$ is adjacent to a connected component in $\mathcal{C}_S$ that consists of a single vertex $x'$ which is only adjacent to vertex $x$ in $X_U^h$. Furthermore, during Reduction Rule \ref{rule::W} we delete the vertex set $X_W^h$. Thus, $x$ is contained in $X_U^l \cup X_W^l$. Now, if $v$ is a free vertex in $C$, then $x$ must be a vertex in $X_W^l$ which implies that $C$ is a connected component in $\mathcal{C}_W^l$ and not in $\mathcal{C}_D$, which is a contradiction. Similar, if $v$ is an uncovered vertex in $C$, then $x$ must be a vertex in $X_U^l$ which implies that $C$ is a connected component in $\mathcal{C}_U^l$ and not in $\mathcal{C}_D$, which is a contradiction. Hence, $F$ is an edge dominating set in $G$.
\end{claimproof}
We already showed that the reduction is safe. Next, we show that the reduced instance $(G',k',X')$ has at most $\mathcal{O}(|X|^2)$ vertices. The set of connected components in $G'-X'$ is $\mathcal{C}':=\mathcal{C}_U^l \cup \mathcal{C}_W^l \cup \mathcal{C}_S$, because we only add connected components to $G$ during Reduction Rule \ref{rule::U} (namely the components in $\mathcal{C}_S$) and we only delete connected components during Reduction Rule \ref{rule::delete}. We delete all connected components that are not contained in $\mathcal{C}_U^l \cup \mathcal{C}_W^l \cup \mathcal{C}_S$.
It follows that $G'-X'$ has at most $2|X|^2$ connected components, because $|\mathcal{C}'| \leq |\mathcal{C}_U^l| + |\mathcal{C}_W^l| + |\mathcal{C}_S| \leq |X_U^l| \cdot |X| + |X_W^l|+ |X_U^h| \leq 2 |X|^2$. Since every connected component has constant size, and since $V(G')=V(\mathcal{C}') \cup X$ it holds that $G'$ has at most $\mathcal{O}(|X|^2)$ vertices. Next, we have to bound the number of edges. Every connected component has only constant size, thus it has only a constant number of edges (because our graph is simple); hence $|E[\mathcal{C}']| \in \mathcal{O}(|X|^2)$. The number of edges between vertices in $X$ is at most $|X|^2$. All remaining edges are between $X$ and $\mathcal{C}'$ and there are at most $|X| \cdot |V(\mathcal{C}')| \in \mathcal{O}(|X|^3)$ edges between $X$ and $\mathcal{C}'$. This sums up to at most $\mathcal{O}(|X|^3)$ edges.
It is easy to see that we can perform the reduction in polynomial time: We apply every Reduction Rule exactly once and we also compute every set exactly once. Furthermore, we can compute the sets $W$ and $U$ in polynomial time because we can compute a minimum edge dominating set in a connected component of constant size in constant time. Moreover, we can compute all remaining sets in polynomial time (by applying Theorem \ref{theorem::matching} or by simple counting). We can also apply each Reduction Rule in polynomial time because we only delete resp.\ add vertex or edge sets of size polynomial in $|G|$ which we can compute in polynomial time.
\end{proof}
\begin{remark}
If $\ensuremath{\mathcal{H}}\xspace$ is a finite set of connected graphs that contain neither beneficial sets nor uncovered vertices (and such that each graph $H \in \ensuremath{\mathcal{H}}\xspace$ has $V(H)=N[W(H)]$ then \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator $X$ to an \ensuremath{\mathcal{H}}\xspace-component graph admits a kernel with $\mathcal{O}(|X|)$ vertices, $\mathcal{O}(|X|^2)$ edges, and size $\mathcal{O}(|X|^2 \log|X|)$.
This holds because the only set that has size $\mathcal{O}(|X|^2)$ is the set of connected components in $\mathcal{C}_U^l$. But, if we have no uncovered vertex then $\mathcal{C}_U^l = \emptyset$. Hence, the reduced instance has only $\mathcal{O}(|X|)$ many connected components, and therefore, only $\mathcal{O}(|X|)$ many vertices.
\end{remark}
\begin{lemma}\label{lemma::kernel2}
Let $d\in \ensuremath{\mathbb{N}}\xspace$ and let $\ensuremath{\mathcal{H}}\xspace$ be a finite set of connected graphs such that no graph $H\in\ensuremath{\mathcal{H}}\xspace$ has a strongly beneficial set of size exceeding $d$, such that $V(H)=N[W(H)]\cup U(H)$ for all $H\in\ensuremath{\mathcal{H}}\xspace$, and such that each strongly beneficial set $B$ of any graph $H\in\ensuremath{\mathcal{H}}\xspace$ is contained in $N(W(H))$. Moreover, assume that for each strongly beneficial set $B$ of a graph $H\in\ensuremath{\mathcal{H}}\xspace$ there exists a minimum edge dominating set in $H-B$ that covers all vertices in $N(W(H))\setminus B$.
Then \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator $X$ to the class \ensuremath{\mathcal{H}}\xspace-component graphs admits a kernel with $\mathcal{O}(|X|^d)$ vertices, $\mathcal{O}(|X|^{d+1})$ edges, and size $\mathcal{O}(|X|^{d+1} \log|X|)$.
\end{lemma}
\begin{proof}
Let $(G,k,X)$ be an instance of \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to an \ensuremath{\mathcal{H}}\xspace-component graph. Again, we can assume that $k-\MEDS(G-X) < |X|$ (see proof of Lemma \ref{lemma::kernel1}). The kernelization is similar to the previous kernelization. We construct a different graph $G_W$ to compute $X_W^h$ because we have to be a little bit more careful with connected components in $\mathcal{C}_U^l$ and because we have beneficial sets. Furthermore, we define the set $\mathcal{C}_D$ differently (for this purpose we compute another auxiliary graph).
In the previous kernelization (Lemma \ref{lemma::kernel1}) the connected components in $G-X$ have no beneficial set. Thus, for every connected component $C$ that has at least one free vertex and whose set of free vertices is adjacent to at least one vertex in $X$, we could assume that an edge dominating set contains at least one of these edges between the free vertices and $X$. We can not assume this anymore because a connected component can also contain a beneficial set $B$. Now, it could be necessary that an edge dominating set of size at most $k$ contains a matching between $B$ and $X$. For example, assume that there exists a connected component $C$ that contains a free vertex that is adjacent to vertex $x_1$ in $X$, and that $C$ has also a beneficial set $B=\{b_1,b_2,b_3\}$ of size three with $\mathrm{cost}(B)=1$ such that $b_i$ is adjacent to a vertex $x_i$ in $X$ (where all $x_i$ are pairwise different). Now, we can either increase the $\mathrm{cost}$ locally by one to cover three vertices in $X$ or use the same local $\mathrm{cost}$ to cover one vertex, namely $x_1$, in $X$. Further, assume that $x_1,x_2,x_3$ are endpoints of edges in every edge dominating set of size at most $k$ and that there exist no way to cover $x_2$ and $x_3$ with an extra budget of one. Hence, the edge dominating set will probably contain the edges between $B$ and $\{x_1,x_2,x_3\}$ as well as a minimum edge dominating set in $C-B$, and no edge between a free vertex of $C$ and $X$.
Besides this, in the previous kernelization we could assume that every edge that is incident with an uncovered vertex increases the cost locally by one. We cannot assume this anymore because a connected component $C$ with a beneficial set $B$ can cover $|B|$ vertices in $N(B) \cap U(C)$ while increasing the cost locally by $\mathrm{cost}(B) < |B|$. Thus, a beneficial set $B$ could be useful to cover some vertices in $U(C)$ and to cover vertices in $X$. But, if all vertices in $U(C)$ are only adjacent to vertices in $X$ that must be in every edge dominating set of size at most $k$ then we will never cover the vertices in $U(C)$ by edges inside a connected component.
For these reasons, we compute the set $X_W^h$ using a different auxiliary graph which leads to $\mathcal{O}(|X|^2)$ connected components in $\mathcal{C}_W^l$ (in the worst case). Note that it would be possible to bound the number of connected components in $\mathcal{C}_W^l$ by $\mathcal{O}(|X|)$ by defining an auxiliary graph that handles the connected components that have free vertices or beneficial sets at the same time. This would make the analysis more complicated. But, we are only able to bound the number of connected components that contain a beneficial set by $\mathcal{O}(|X|^d)$, with $d \geq 2$. Thus, even if no graph has uncovered vertices we will not be able to reduce to less than $\mathcal{O}(|X|^2)$ vertices because we have connected components that contain beneficial sets (of size $d \geq 2$). Recall, in the previous kernelization we can reduce to $\mathcal{O}(|X|)$ vertices if we have no uncovered vertices.
As before, let $\mathcal{C}$ be the set of connected components in $G-X$, let $W$ be the set of all free vertices in $G-X$, and let $U$ be the set of all uncovered vertices in $G-X$.
Let $X_W \subseteq X$ be the set of vertices in $X$ that are adjacent to a vertex in $W$, hence $X_W= \{ x \in X \mid \exists w \in W \colon \{x,w\} \in E(G) \}$, and let $\mathcal{C}_W$ be the set of connected components $C$ in $\mathcal{C}$ where $W(C)$ is adjacent to a vertex in $X_W$, hence with $E(W(C),X_W) \neq \emptyset$.
Again, we compute a bipartite graph $G_W$: One part consists of $|X|$ vertices $x^1,x^2,\ldots,x^{|X|}$ for every vertex $x$ in $X_W$. We denote this set by $R$. The other part consists of one vertex $s_C$ for every connected component $C$ in $\mathcal{C}_W$. We add an edge between a copy $x^i$ of vertex in $x \in X_W$, with $i \in [|X|]$, and a vertex $s_C$ with $C \in \mathcal{C}_W$ if and only if $x$ is adjacent to a vertex in $W(C)$. Now, we apply Theorem \ref{theorem::matching} to obtain either a maximum matching in $G_W$ that saturates $R$, or to find a set $Y \subseteq R$ such that $|N_{G_W}(Y)|<|Y|$ and such that there exists a maximum matching in $G_W - N_{G_W}[Y]$ that saturates $R \setminus Y$. Observe, since every copy of a vertex $x \in X_W$ has the same neighborhood it holds that either all copies of $x$ are contained in $Y$ or none.
If there exists a maximum matching in $G_W$ that saturates $R$ then let $X_W^h=X_W$, let $X_W^l=\emptyset$, and let $\mathcal{C}_W^l=\emptyset$. Otherwise, if there exists a set $Y$ with the above properties then let $X_W^l = \{ x \in X_W \mid x^1 \in Y\}$ be the vertices in $X$ whose copies are contained in $Y$, let $X_W^h = X_W \setminus X_W^l$, and let $\mathcal{C}_W^l$ be the set of connected components $C$ in $\mathcal{C}_W$ where $W(C)$ is adjacent to a vertex in $X_W^l$. Note that every connected component $C$ in $\mathcal{C}_W^l$ corresponds to a vertex in $N_{G_W}(Y)$. Thus, the set $\mathcal{C}_W^l$ contains at most $|N_{G_W}(Y)| < |Y|=|X| \cdot |X_W^l|$ connected components.
Now, we apply Reduction Rule \ref{rule::W}.
\begin{claim}
Reduction Rule \ref{rule::W} is safe.
\end{claim}
\begin{claimproof}
Let $F$ be an edge dominating set of size at most $k$ in $G$. We can construct an edge dominating set of size at most $k'=k$ in $G'$ as in the proof of Claim \ref{claim::X_W}. We delete every edge $e=\{x,y\} \in F$ if $x,y \in X_W^h$ or if $x \in X_W^h$ and $y$ is isolated in $G'$. Furthermore, we replace each edge $e=\{x,v\} \in F$ with $x \in X_W^h$ and $v \notin X_W^h$ (not isolated in $G'$) by an edge in $\delta_{G'}(v)$. By construction, the resulting set $F'$ is an edge dominating set of size at most $k=k'$ in $G'$.
For the other direction, let $F'$ be an edge dominating set of size at most $k'$ in $G'$. Recall that $k-\MEDS(G-X) < |X|$, which implies that $k'-\MEDS(G'-X') < |X|$ because $\MEDS(G'-X')=\MEDS(G-X)$ and $k=k'$. Thus, there are at most $|X|-1$ connected components $C$ of $G'-X'$ that are incident with more than $\MEDS(C)$ edges of $F'$. Recall, the graph $G_W - N_{G_W}[Y]$ (resp.\ the graph $G_W$ if $X_W^l = \emptyset$) contains a matching $M$ that saturates $R \setminus Y = \{x^i \mid x \in X_W^h \wedge i \in [|X|]\}$. For every vertex $x \in X_W^h$ let $C_x^1, C_x^2, \ldots, C_x^{|X|}$ be the connected components in $\mathcal{C}_W \setminus \mathcal{C}_W^l$ with $\{x^i,s_{C_x^i}\} \in M$. Note that the set of free vertices in these connected components is not adjacent to a vertex in $X_W^l$ because all connected components whose set of free vertices is adjacent to a vertex in $X_W^l$ correspond to a vertex in $N_{G_W}(Y)$.
Since at most $|X|-1$ connected components $C$ of $G'-X'$ are incident with more that $\MEDS(C)$ edges of $F'$ at least one of the connected components $C_x^1, C_x^2, \ldots, C_x^{|X|}$ is only incident with $\MEDS(C_x^i)$ edges of $F'$. Say, w.l.o.g., that for all $x \in X_W^h$ the connected component $C_x^1$ is only incident with $\MEDS(C_x^1)$ edges of $F'$. (Note that for two different vertices $x,y \in X_W^h$ the connected components $C_x^1$ and $C_y^1$ are different.) Furthermore, the set of free vertices in $C_x^1$ is only adjacent to vertices in $C_x^1$ because we delete $X_W^h$ to obtain $G'$ and every connected component whose set of free vertices is adjacent to a vertex in $X_W^l$ is contained in $\mathcal{C}_W^l$. Since we have only $\MEDS(C_x^1)$ edges to dominate all edges in $C_x^1$ it holds that no edge has an endpoint in $U(C_x^1)$ or one endpoint in $C_x^1$ and the other endpoint in $X$. Let $w_x \in W(C_x^1)$ be a free vertex in $C_x^1$ that is adjacent to vertex $x$ in $G$; hence $\{w_x,x\} \in E(G)$.
Now, for every $x \in X_W^h$ we delete all edges that are incident with $C_x^1$ from $F'$ and add a minimum edge dominating set in $C_x^1 - w_x$ that covers $N(W(C_x^1))$ (Proposition \ref{proposition::properties} (\ref{proposition::N(W)IN})) as well as the edge $\{w_x,x\}$ to obtain $F$. It holds that $F$ has size $k$ because $\MEDS(C_x^1)=\MEDS(C_x^1 - w_x) +1$.
It remains to prove that $F$ is an edge dominating set in $G$. The set $V(F)$ contains all vertices in $V(F')$ except some free vertices in the connected components where we change the edge dominating set. But, all neighbors of these vertices are contained in $V(F)$ because these free vertices are only adjacent to vertices in $X_W^h$ (which are contained in $V(F)$) and to vertices in the connected component of $G-X$ they belong to. Thus, $F$ is an edge dominating set of size at most $k$ in $G$.
\end{claimproof}
Let $X_U \subseteq U$ be the set of vertices in $X$ that are adjacent to a vertex in $U$, let $X_U^h \subseteq X_U$ be the set of vertices in $X_U$ that are adjacent to the set of uncovered vertices in at least $|X|+1$ connected components, and let $X_U^l = X_U \setminus X_U^h$. Again, by $\mathcal{C}_U^l$ we denote the connected components $C$ in $\mathcal{C}$ with $E(U(C),X_U^l) \neq \emptyset$, and it holds that $|\mathcal{C}_U^l| \leq |X| \cdot |X_U^l|$.
Next, we apply Reduction Rule \ref{rule::U}. Let $\mathcal{C}_S$ be the set of new connected components in $G-X$ that we add during Reduction Rule \ref{rule::U}.
To prove that Reduction Rule \ref{rule::U} is safe in the previous kernelization (Lemma \ref{lemma::kernel1}), we only showed that every vertex in $X_U^h$ must be covered by every solution of size at most $k$. The same argumentation holds here; thus, Reduction Rule \ref{rule::U} is safe.
Let $\mathcal{C}_B$ be the set of connected components $C$ in $\mathcal{C} \setminus (\mathcal{C}_W^l \cup \mathcal{C}_U^l \cup \mathcal{C}_S)$ that contain a strongly beneficial set.
To find connected components in $\mathcal{C}_B$ that can be safely removed from $G$ we construct an auxiliary graph $G_A$ as follows:
\begin{itemize}
\item Add for each set $Y \subseteq X$ with $2 \leq |Y| \leq d$ and for each $\beta \in [|Y|-1]$ a vertex $r_{Y,\beta}$ to $G_A$; denote the union of these vertices by $R$.
\item Add for each connected component $C$ in $\mathcal{C}_B$ a vertex $s_{C}$ to $G_A$; denote the union of these vertices by $S$.
\item For each connected component $C \in \mathcal{C}_B$ we add the edge $\{r_{Y,\beta},s_C\}$ to $G_A$ if and only if there exists a strongly beneficial set $B$ of size $|Y|$ in $C$ with $\mathrm{cost}(B)=\beta$ such that there exists a perfect matching $M$ in $(Y \cup B, E(G) \cap E(Y,B))$. Hence, we add an edge between a vertex $s_C$ that represents connected component $C$ and a vertex $r_{Y, \beta}$ if and only if a local solution for $C$ that contains a maximum matching between $Y$ and $B$ (that covers $Y$) increases the cost of a local solution for $C$ only by $\beta$.
\end{itemize}
Thus, the auxiliary graphs tells us which connected components $C \in \mathcal{C}_B$ can help us to cover a set $Y \subseteq X$ (of size at most $d$) without using $|Y|$ additional edges (or more precisely by using $\beta$ ``additional'' edges).
\begin{claim}
We can construct graph $G_A$ in polynomial time
\end{claim}
\begin{claimproof}
The set $R$ has $\sum_{i=2}^d \binom{|X|}{i} \cdot i \in \mathcal{O}(|X|^d)$ many vertices, one for each pair $(Y,\beta)$ where $Y \subseteq X$ with $2 \leq |Y| \leq d$ and $\beta \in [|Y|]$. Hence we can construct $R$ in polynomial time. Since the set $S$ contains one vertex for each connected component in $\mathcal{C}_B$ we can construct $S$ in polynomial time.
For every connected component $C \in \mathcal{C}_B$ we can compute a minimum edge dominating set in $C$ as well as in $C-B$, for every $B \subseteq V(C)$, in polynomial time because $C$ is of constant size. Thus, we can compute all strongly beneficial sets $B$ in $C$ as well as the value $\mathrm{cost}(B)$ in polynomial time: There are only a constant number of possible sets and we can compute $\MEDS(C)$ and $\MEDS(H-B)$ in polynomial time. This is only possible, because $C$ is of constant size. Let $C$ be a connected component in $\mathcal{C}_B$, let $B$ be a strongly beneficial set in $C$, and let $Z=N(B) \cap X$ be the set of vertices in $X$ that are adjacent to a vertex in $B$. For each set $Y \subseteq Z$ of size $|B|$ we add the edge $\{r_{Y,\mathrm{cost}(B)},s_C\}$ to $G_A$, if there exists a perfect matching in $(B \cup Y, E(B,Y))$. We can do this in polynomial time, because we only have to compute $\binom{|Z|}{|B|} \leq |X|^d$ many maximum matchings. We can do this for every connected component and every beneficial set in a component because there are only a polynomial number of connected components and because every connected component has only a constant number of strongly beneficial sets.
\end{claimproof}
Now, we apply Theorem \ref{theorem::matching} to obtain either a maximum matching in $G_A$ that saturates $R$, or to find a set $Z \subseteq R$ such that $|N_{G_A}(Z)| < |Z|$ and such that there exists a maximum matching in $G_A - N_{G_A}[Z]$ that saturates $R \setminus Z$. Note that if there exists a matching in $G_A$ that saturates $R$ we can set $Z= \emptyset$. Thus, we can assume that we always find a set $Z$ that fulfills the above properties.
Let $M$ be a maximum matching in $G_A - N_{G_A}[Z]$. By choice of $Z$, it holds that the matching $M$ saturates $R \setminus Z$.
Now, let $\mathcal{C}_{B}^l$ be the set of connected components $C$ in $\mathcal{C}_B$ that correspond to a vertex $s_C$ in $N_{G_A}(Z)$, and let $\mathcal{C}_B^h=\{ C \in \mathcal{C}_B \mid \exists Y \subseteq X, \beta \in [|Y|-1] \colon \{r_{Y,\beta},s_C\} \in M\}$ be the set of connected components $C$ in $\mathcal{C}_B$ that correspond to a vertex $s_C$ in $S$ with the property that $\{r_{Y,\beta},s_C\}$ is an edge in $M$ for a set $Y \subseteq X$ and an integer $\beta \in [|Y|-1]$. Note that $r_{Y,\beta} \in R \setminus Z$. Now, we can bound the number of connected components in $\mathcal{C}_B^l$ and $\mathcal{C}_B^h$: It holds that $|\mathcal{C}_B^l| = |N_{G_A}(Z)| < |Z|$ (property of $Z$) and that $|\mathcal{C}_B^h| = |R \setminus Z|$ (because we add one vertex for every vertex in $R \setminus Z$ to $\mathcal{C}_B^h$); thus $|\mathcal{C}_B^l \cup \mathcal{C}_B^h| \leq |R| \in \mathcal{O}(|X|^d)$.
So far, we know that $|\mathcal{C}_W^l| \leq |X| \cdot |X_W^l|$, that $|\mathcal{C}_U^l| \leq |X| \cdot |X_U^l|$, that $|\mathcal{C}_S| \leq |X_U^h|$, and that $|\mathcal{C}_B^l \cup \mathcal{C}_B^h| \in \mathcal{O}(|X|^d)$. We will show that the remaining connected components of $G-X$ can be safely removed by reducing the value $k$ accordingly.
Let $\mathcal{C}_D$ be the set of connected components in $G-X$ that are not contained in $\mathcal{C}_U^l \cup \mathcal{C}_S \cup \mathcal{C}_W^l \cup \mathcal{C}_B^l \cup \mathcal{C}_B^h$.
We apply Reduction Rule \ref{rule::delete} to delete all connected components in $\mathcal{C}_D$ and to obtain our reduced instance.
\begin{claim}
Reduction Rule \ref{rule::delete} is safe.
\end{claim}
\begin{claimproof}
Let $(G,k,X)$ be the instance before applying Reduction Rule \ref{rule::delete}, and let $(G',k',X')$ be the instance after applying Reduction Rule \ref{rule::delete}. Note that $X=X'$, because we only delete connected components of $G-X$ and decrease $k$.
Let $F'$ be an edge dominating set of size at most $k'$ in $G'$. To obtain an edge dominating set of size at most $k$ in $G$, we add for each connected component $C$ in $\mathcal{C}_D$ a minimum edge dominating set $F_C$ with $N(W(C)) \subseteq V(F_C)$ to $F'$. The existence of such a minimum edge dominating set follow from Proposition~\ref{proposition::properties}~(\ref{proposition::N(W)IN}). We denote the resulting set by $F$. By construction, the set $F$ has size at most $k$ because $k'=k-\MEDS(\mathcal{C}_D)$ and we add exactly a minimum edge dominating set of $\mathcal{C}_D$ to $F'$ to obtain $F$.
To show that $F$ is an edge dominating set of $G$, we have to show that $F$ dominates every edge between $X$ and a connected component $C$ in $\mathcal{C}_D$: All other edges are either dominated by $F'$ or by the added minimum edge dominating set $F_C$ with $C \in \mathcal{C}_D$.
Assume for contradiction that there exists a connected component $C \in \mathcal{C}_D$, a vertex $v \in V(C)$, and a vertex $x \in X$ such that $\{v,x\} \in E(G)$ is not dominated by $F$.
All vertices in $N(W(C))$ are incident with an edge in $F_C$ (choice of $F_C$) and therefore incident with an edge in $F$. Thus, $v$ must be a free or uncovered vertex because $V(C)=N[W(C)] \cup U(C)$. If $v$ is a free vertex, then $x$ must be contained in $X_W$. Since we delete $X_W^h$ during Reduction Rule \ref{rule::W}, it holds that $x \in X_W^l$. But this implies that $C$ is a connected component in $\mathcal{C}_W^l$ because $\mathcal{C}_W^l$ contains all connected components whose set of free vertices is adjacent to a vertex in $X_W^l$. Thus, $C$ is contained in $\mathcal{C}_W^l$ and not in $\mathcal{C}_D$ which is a contradiction. If $v$ is an uncovered vertex then $x$ must be a vertex in $X_U$. All vertices in $X_U^h$ must be incident with an edge in $F'$ because every vertex $x$ in $X_U^h$ is adjacent to a connected component in $\mathcal{C}_S$ that consists of a single vertex $x'$ which is only adjacent to this vertex $x$ in $X$; hence $x \in X_U^l$. But, this implies that $C$ is contained in $\mathcal{C}_U^l$, and not in $\mathcal{C}_D$, because every connected component whose set of uncovered vertices is adjacent to a vertex in $X_U^l$ is contained in $\mathcal{C}_W^l$. This is a contradiction. Thus, $F$ is an edge dominating set of size at most $k$ in $G$.
For the other direction, let $F$ be an edge dominating set of size at most $k$ in $G$ that is also a matching. Recall, every vertex $v \in W(C)$ that is adjacent to a vertex $x \in X$ is contained $x \in X_W^l$ because we delete $X_W^h$ during Reduction Rule \ref{rule::W}; hence $C \in \mathcal{C}_W^l$. Thus, every connected component $C$ with $E(W(C),X)) \neq \emptyset$ is contained in $\mathcal{C}_W^l$, and therefore, not contained in $\mathcal{C}_D \cup \mathcal{C}_B$.
Let $C_1,C_2,\ldots, C_p$ be all connected components in $\mathcal{C}_D \cup \mathcal{C}_B^h$ that are incident with an edge in $F$ that has its other endpoint in $X$; thus for all $i \in [p]$ it holds $E(C_i,X) \cap F \neq \emptyset$. For each connected component $C_i$, with $i \in [p]$, let $B_i=\{ c \in V(C_i) \mid \exists x \in X \colon \{x,c\} \in F\}$ be the set of vertices in $V(C_i)$ that are incident with an edge in $F$ that has its other endpoint in $X$. Note that $B_i \subseteq V(C_i) \setminus W(C_i)$ because $E(W(C_i),X) = \emptyset$ for all connected components in $\mathcal{C}_D \cup \mathcal{C}_B$.
Since $B_i \subseteq V(C) \setminus W(C)$ we can apply Proposition \ref{proposition::properties} (\ref{proposition::decomposeB}): For all $i \in [p]$ let $B_i^1, B_i^2,\ldots, B_i^{q_i} \subseteq B_i$ be a partition of $B_i$ where $B_i^j$ is either strongly beneficial or has $\mathrm{cost}(B_i^j)=|B_i^j|$, for all $j \in [q_i]$, such that $\mathrm{cost}(B_i) \geq \sum_{j=1}^{q_i} \mathrm{cost}(B_i^j)$.
Let $Y_i^j = \{x \in X \mid \exists v \in V(B_i^j) \colon \{x,v\} \in F \}$, with $i \in [p]$ and $j \in [q_i]$, be the set of vertices in $X$ that are incident with an edge in $F$ whose other endpoint is contained in $B_i^j$, and let $\beta_i^j=\mathrm{cost}(B_i^j)$. Note that the sets $B_i^j$ and $Y_i^j$ have the same size because $F$ is a matching in $G$. Therefore, if $B_i^j$ is a strongly beneficial set then the size of $Y_i^j$ is at most $d$ because every strongly beneficial set has size at most $d$.
Now, if $B_i^j$, with $i \in [p]$ and $j \in [q_i]$, is a strongly beneficial set in $C_i$ then it holds that $2 \leq |B_i^j| = |Y_i^j| \leq d$ and that $\beta_i^j=\mathrm{cost}(B_i^j)<|B_i^j|=|Y_i^j|$.
Thus, the vertex $r_{Y_i^j,\beta_i^j}$ is contained in $R$. Note that $C_i$ is a connected component in $\mathcal{C}_B^h$ if $B_i^j$ is strongly beneficial for an index $j \in [q_i]$ because every connected component in $\mathcal{C} \setminus (\mathcal{C}_W^l \cup \mathcal{C}_U^l \cup \mathcal{C}_S)$ that contains a strongly beneficial set is contained in $\mathcal{C}_B$, and because $C_i \in \mathcal{C}_D \cup \mathcal{C}_B^h$. Recall that $\mathcal{C}_D$ contains all connected components that are not contained in $\mathcal{C}_W^l \cup \mathcal{C}_U^l \cup \mathcal{C}_S \cup \mathcal{C}_B^l \cup \mathcal{C}_B^h$.
Furthermore, the vertex $r_{Y_i^j,\beta_i^j}$ must be contained in $R \setminus Z$: If $r_{Y_i^j,\beta_i^j}$ is a vertex in $Z$ then $N_{G_A}(r_{Y_i^j,\beta_i^j}) \subseteq N_{G_A}(Z)$. But, every vertex in $N_{G_A}(Z)$ corresponds to a connected component in $\mathcal{C}_B^l$ which would imply that $C_i$ is contained in $\mathcal{C}_B^l$ because $r_{C_i} \in N_{G_A}(r_{Y_i^j,\beta_i^j})$ which is a contradiction; thus, $r_{Y_i^j,\beta_i^j} \in R \setminus Z$.
Let $C_i^j$ be the connected component in $\mathcal{C}_B^h$ whose corresponding vertex in $S$ is matched to $r_{Y_i^j,\beta_i^j}$; hence with $\{ r_{Y_i^j,\beta_i^j}, s_{C_i^j}\} \in M$. Since $\{ r_{Y_i^j,\beta_i^j}, s_{C_i^j}\} \in E(G_A)$ there exists a strongly beneficial set $\bar{B}_i^j$ of size $|Y_i^j|$ in $C_i^j$ with $\mathrm{cost}(\bar{B}_i^j)=\beta_i^j(=\mathrm{cost}(B_i^j))$ such that there exists a perfect matching between $Y_i^j$ and $\bar{B}_i^j$ in $(Y_i^j \cup \bar{B}_i^j, E(G) \cap E(Y_i^j, \bar{B}_i^j))$.
Hence, for every strongly beneficial set $B_i^j$, with $i \in [p]$ and $j \in [q_i]$, the set $Y_i^j$ is associated with a different connected component $C_i^j$ in $\mathcal{C}_B^h$ and a beneficial set $\bar{B}_i^j$ that has the same advantage as $B_i^j$.
In the case that the size of $B_i^j$, with $i \in [p]$ and $j \in [q_i]$, is equal to $\mathrm{cost}(B_i^j)$ it holds that $Y_i^j$ is equal to $\beta_i^j$. Thus, every edge that is incident with a vertex in $Y_i^j$ increases the cost locally by one.
To construct an edge dominating set of size at most $k'$ in $G'$ we delete all edges in $F$ that are incident with a vertex in a connected component of $\mathcal{C}_D \cup \mathcal{C}_B^h$; denote the resulting set by $\widetilde{F}$. Recall that $C_1,C_2,\ldots, C_p$ are the connected components in $\mathcal{C}_D \cup \mathcal{C}_W^h$ that are incident with an edge in $F$ whose other endpoint is contained in $X$.
Next, for each $i \in [p]$ and $j \in [q_i]$ with $B_i^j \subseteq B_i$ strongly beneficial we add a minimum edge dominating set in $C_i^j - \bar{B}_i^j$ with $N(W(C_i^j)) \setminus \bar{B}_i^j \subseteq V(F_C)$ to $\widetilde{F}$ as well as a maximum matching between $\bar{B}_i^j$ and $Y_i^j$ that saturates both sets: Such a minimum edge dominating set exists by assumption and such a matching exists because $\{ r_{Y_i^j,\beta_i^j}, s_{C_i^j}\}$ is an edge in $G_A$. Recall that every connected component $C_i^j$ is contained in $\mathcal{C}_B^h$. Thus, all added edges are contained in $G'$. For all remaining connected components $C$ in $\mathcal{C}_B^h$ we add a minimum edge dominating set in $C$ to $\widetilde{F}$. Finally, we add for each vertex $y$ that is contained in a set $Y_i^j$ with $|Y_i^j|=|B_i^j|=\mathrm{cost}(B_i^j)=\beta_i^j$, where $i \in [p]$ and $j \in [q_i]$, an arbitrary edge in $\delta_{G'}(y)$ to $\widetilde{F}$ if $\delta_{G'}(y)$ is not the empty set. Otherwise, if $v$ is isolated in $G'$ we add no edge to $\widetilde{F}$.
We denote the resulting set by $F'$.
First, we show that $F'$ is indeed an edge dominating set of $G'$. Every vertex in $X$ that is incident with an edge in $F$ that has its other endpoint in a connected component of $\mathcal{C}_D \cup \mathcal{C}_B^h$ is contained in a set $Y_i^j$, with $i \in [p]$ and $j \in [q_i]$. During the reduction we delete only edges that are incident with a connected component in $\mathcal{C}_D \cup \mathcal{C}_B^h$, but we also add for each vertex $v$ in $Y_i^j$ that is not isolated in $G'$ an edge in $\delta_{G'}(y)$ to $F'$. Thus, every vertex in $X$ that is covered by $V(F)$ and not isolated in $G'$ is also covered by $V(F')$.
Furthermore, every edge in a connected component is dominated: We delete only edges that are incident with connected components in $\mathcal{C}_D \cup \mathcal{C}_B^h$ and we add for all connected components in $\mathcal{C}_B^h$ an edge dominating set to $F'$. Since the connected components in $\mathcal{C}_D$ are not contained in $G'$ it holds that $F'$ dominates all edges in $G'-X'$. Thus, the only edges that are possibly not dominated by $F'$ have one endpoint in $X$ and the other endpoint in a connected component of $\mathcal{C}_B^h$ because these are the only connected components where we change the edge dominating set (and because $V(F')$ covers all vertices in $X \cap V(F)$ that are not isolated in $G'$). Assume that there exists a connected component $C \in \mathcal{C}_B^h$, a vertex $v \in V(C)$, and a vertex $x \in X$ such that edge $\{v,x\} \in E(G')$ is not dominated by $F'$; hence $v,x \notin V(F')$. No vertex in $W(C)$ is adjacent to a vertex in $X$ (otherwise $C \in \mathcal{C}_W^l$ and not in $\mathcal{C}_B^h$). Furthermore, every vertex in $N(W(C))$ is incident with an edge in $F'$ (by construction). Thus, $v$ must be a vertex in $U(C)$, and $x$ must be a vertex in $X_U$. Every vertex in $X_U^h$ must be incident with an edge in $F'$ because $X_U^h \subseteq V(F)$, and because every vertex in $X$ that is covered by the edge dominating set $F$ and is not isolated in $G'$ is contained in $V(F')$; hence $x \in X_U^l$. But, if $x \in X_U^l$ then it follows that $C$ is a connected component in $\mathcal{C}_U^l$ and not in $\mathcal{C}_B^h$, which is a contradiction; thus $F'$ is an edge dominating set in $G'$.
It remains to show that $F'$ contains at most $k'$ edges.
The connected component $C_i$, with $i \in [p]$, is incident with at least $\MEDS(C_i) + \mathrm{cost}(B_i)$ many edges (definition of $\mathrm{cost}$). For all remaining connected components $C \in \mathcal{C}_D \cup \mathcal{C}_B^h$ we need at least $\MEDS(C)$ many edges. Thus, it holds that $\widetilde{F} \leq |F|-\MEDS(\mathcal{C}_D \cup \mathcal{C}_B^h) - \sum_{i=1}^p \sum_{j=1}^{q_i} \beta_i^j$ because
\begin{align*}
\widetilde{F} &\leq |F|-\left(\MEDS(\mathcal{C}_D \cup \mathcal{C}_B^h) + \sum_{i=1}^p \mathrm{cost}(B_i) \right)
\leq |F|-\MEDS(\mathcal{C}_D \cup \mathcal{C}_B^h) - \sum_{i=1}^p \sum_{j=1}^{q_i} \mathrm{cost}(B_i^j)
\\&\leq |F|-\MEDS(\mathcal{C}_D \cup \mathcal{C}_B^h) - \sum_{i=1}^p \sum_{j=1}^{q_i} \beta_i^j
\end{align*}
To obtain $F'$ we add $\MEDS(C_i^j) + \mathrm{cost}(\bar{B}_i^j)=\MEDS(C_i^j) + \beta_i^j$ edges to $\widetilde{F}$, with $i \in [p]$, and $j \in [q_i]$, if $B_i^j \subseteq B_i$ is a strongly beneficial set in $C_i$: We add a minimum edge dominating set in $C_i^j-\bar{B}_i^j$ as well as a matching between $Y_i^j$ and $\bar{B}_i^j$ that saturates both sets to $\widetilde{F}$, and $\mathrm{cost}(\bar{B}_i^j)=\beta_i^j$. All these connected components $C_i^j$ are contained in $\mathcal{C}_B^h$.
For all remaining connected components $C$ in $\mathcal{C}_B^h$ we add a minimum edge dominating set of $C$ to $\widetilde{F}$.
Furthermore, for all vertices $y$ that are not isolated in $G'$ and that are contained in a set $Y_i^j$, with $i \in [p]$, and $j \in [q_i]$, where $|Y_i^j|=\beta_i^j=\mathrm{cost}(B_i^j)$, we add an arbitrary edge in $\delta_{G'}(y)$ to $\widetilde{F}$. Thus,
\[
|F'|\leq|\widetilde{F}| + \MEDS(\mathcal{C}_B^h) + \sum_{i=1}^p \sum_{j=1}^{q_i} \beta_i^j \leq |F| - \MEDS(\mathcal{C}_D) = k'
\]
This completes the proof.
\end{claimproof}
We showed that all reduction rules are safe.
To show that the reduced $(G',k',X')$ instance has only $\mathcal{O}(|X|^d)$ vertices, we only have to bound the number of connected components in $G'-X'$ because every connected component has constant size. During the reduction rules we delete all connected components that are not contained in $\mathcal{C}':=\mathcal{C}_W^l \cup \mathcal{C}_U^l \cup \mathcal{C}_S \cup \mathcal{C}_B^h \cup \mathcal{C}_B^l$. We already showed that $|\mathcal{C}_W^l \cup \mathcal{C}_U^l \cup \mathcal{C}_S| \leq 2 \cdot |X|^2$ (see above). Furthermore, we showed that $|\mathcal{C}_B^l \cup \mathcal{C}_B^h| \in \mathcal{O}(|X|^d)$. This implies that $G'$ has at most $\mathcal{O}(|X|^d)$ connected components, and thus, at most $\mathcal{O}(|X|^d)$ vertices. (We assumed that there exists at least one graph $H$ in \ensuremath{\mathcal{H}}\xspace that has a beneficial set and these beneficial set has at least size two; thus $d \geq 2$.)
Next, we have to bound the number of edges. Every connected component has only constant size, thus it has only a constant number of edges; hence $|E[\mathcal{C}']| \in \mathcal{O}(|X|^d)$. The number of edges between vertices in $X$ is at most $|X|^2$. All remaining edges are between $X$ and $\mathcal{C}'$. This are at most $|X| \cdot |V(\mathcal{C}')| \in \mathcal{O}(|X|^{d+1})$ many edges. This sums up to at most $\mathcal{O}(|X|^{d+1})$ edges.
It remains to show that we can perform the reduction in polynomial time. We can compute the sets $W$ and $U$ in polynomial time because every connected component is of constant size, and therefore, we can compute minimum edge dominating sets in every connected component as well as in every subgraph of a connected component in polynomial time. Furthermore, we can construct the auxiliary graphs $G_W$ and $G_A$ in polynomial time. Hence, by applying Theorem \ref{theorem::matching} we can compute the set $X_W^h$, the set $X_W^l$, the set $\mathcal{C}_W^l$, the set $\mathcal{C}_B^l$, and the set $\mathcal{C}_B^h$ in polynomial time. The set $X_U^l$, the set $X_U^h$, as well as the set $\mathcal{C}_U^l$ can be computed in polynomial time by simple counting. Since we can compute all sets in polynomial time, we can apply the reduction rules in polynomial time because we only delete the set $X_W^h$ (Reduction Rule \ref{rule::W}) as well as all connected components that are not contained in $\mathcal{C}_U^l \cup \mathcal{C}_S \cup \mathcal{C}_W^l \cup \mathcal{C}_B^l \cup \mathcal{C}_B^h$ (Reduction Rule \ref{rule::delete}), and we only add one vertex for every vertex in $X_U^h$ (Reduction Rule \ref{rule::U}).
\end{proof}
\begin{theorem}\label{theorem::polynomiallowerbound}
Let $d\in\ensuremath{\mathbb{N}}\xspace$ and let $\ensuremath{\mathcal{H}}\xspace$ be a finite set of connected graphs such that some $H\in\ensuremath{\mathcal{H}}\xspace$ has a strongly beneficial set of size $d$. Then \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to $\mathcal{H}$-component graphs does not have a kernelization of size $\mathcal{O}(|X|^{d-\varepsilon})$, for any $\varepsilon>0$, unless \ensuremath{\mathsf{NP\subseteq coNP/poly}}\xspace.
\end{theorem}
At a first glance, $d$-dimension $d$-\prob{Set Cover} seems to be a suitable problem to prove Theorem \ref{theorem::polynomiallowerbound} by giving a polynomial parameter transformation from $d$-dimension $d$-\prob{Set Cover} parameterized by the size of the universe to \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to $\mathcal{H}$-component graphs, where $\ensuremath{\mathcal{H}}\xspace$ contains a graph $H$ that has a strongly beneficial set $B$ of size $d$. Indeed, if the beneficial set $B=\{b_1,b_2,\ldots,b_d\}$ has for example $\mathrm{cost}(B)= 1$ then there exists an easy polynomial parameter transformation from $d$-dimension $d$-\prob{Set Cover} parameterized by the size of the universe to \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to $\mathcal{H}$-component graphs, where $\ensuremath{\mathcal{H}}\xspace$ contains a graph $H$ that has a strongly beneficial $B$ set of size $d$: For an instance $((U:=U_1 \dot\cup U_2 \dot\cup \ldots \dot\cup U_d,\mathcal{F}),k)$ of $d$-dimension $d$-\prob{Set Cover} we construct an instance $(G,k',X)$ of \prob{Edge Dominating Set}\xspace by adding for each set $F=\{u_1,u_2,\ldots,u_d\} \in \mathcal{F}$, where $u_i \in U_i$ for all $i \in [d]$, a copy $H_F$ of $H$ to $G$ as well as two vertices $u$, $u'$ for each element $u \in U$. We add an edge between $u$ and $u'$ for each $u \in U$ as well as an edge between $u$ and the copy of $b_i$ in $H_F$ if $u \in U_i \cap F$. Let $k'=\MEDS(G-X)+k$ and $X$ be the set of all vertices that are not contained in a copy of $H$. In general, if $\mathrm{cost}(B) > 1$ then one would set $k'=\MEDS(G-X)+k \cdot \mathrm{cost}(B)$.
But, there could be cases where it seems unlikely that such a polynomial parameter transformation exists, and where the above construction is not correct. For example, assume that there exists a graph $H$ that has a strongly beneficial set $B=\{b_1,b_2,\ldots,b_{15}\}$ of size 15 with $\mathrm{cost}(B)=5$. It could be possible that also the sets $B_1=\{b_1,b_2,\ldots,b_{10}\}$, $B_2=\{b_5,b_6,\ldots,b_{15}\}$, and $B_3=\{b_1,b_2,\ldots,b_5,b_{10},b_{11},\ldots,b_{15}\}$ are strongly beneficial and that $\mathrm{cost}(B_i)=3$ for all $i \in [3]$. Note that this does not violate the definition of strongly beneficial sets. Now, instead of covering 30 vertices in the modulator by using only edges between the modulator of $X$ and two different copies of $H$ and using 10 edges more than one need to cover these two copies, one can cover 30 vertices in the modulator by using edges between copies of $B_1$, $B_2$ and $B_3$ in different copies of $H$ and using only 9 edges more than one need to cover these three copies. Hence, an edge dominating set in $G$ of size at most $k'$ would not lead to a set cover in $(U,\mathcal{F})$ of size at most $k$, because an edge dominating set in $G$ could contain edges between $X$ and more than $k$ connected components of $G-X$. Thus, this would lead to a set cover with more that $k$ sets, where some sets are only subsets of sets in $\mathcal{F}$.
We can handle this problem by giving a cross-composition of cost $t^{1/d}$ from the \ensuremath{\mathsf{NP}}\xspace-hard \prob{Multicolored Clique}\xspace problem.
\begin{proof}
Fix a graph $H\in\ensuremath{\mathcal{H}}\xspace$ that contains a strongly beneficial set of size $d$, and fix a strongly beneficial set $B=\{b_1,\ldots,b_d\}$ of size $d$ in $H$. If any of the Items \ref{item:lowerbound:CP_Q} through \ref{item:lowerbound:CP_other} of Theorem~\ref{theorem:detailedclassification} applies to $H$ then we already ruled out \emph{any} polynomial kernelization (unless \ensuremath{\mathsf{NP\subseteq coNP/poly}}\xspace). Thus, it suffices to prove the theorem in the remaining case where we know that $V(H)=N[W(H)]\cup U(W)$, that $B\subseteq N(W(H))$, and that there is a minimum edge dominating set $F_B$ of $H-B$ that covers $N(W(H))\setminus B$.
To prove the theorem, we give a cross-composition of cost $f(t)=t^{1/d}$ from the \ensuremath{\mathsf{NP}}\xspace-hard \prob{Multicolored Clique}\xspace problem to \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to an \ensuremath{\mathcal{H}}\xspace-component graph, where $t$ is the number of \prob{Multicolored Clique}\xspace instances. We will construct an instance $(G',k',X')$ where all components of $G'-X'$ are isomorphic to $H$, implying that the result holds for all sets $\ensuremath{\mathcal{H}}\xspace$ containing $H$ (though a stronger lower bound may follow using another $H'\in\ensuremath{\mathcal{H}}\xspace$).
We choose the same equivalence relation $\mathcal{R}$ as in the proof of Theorem \ref{theorem::P3}. Let a sequence of instances $I_i=(G_i,k)_{i=1}^t$ of \prob{Multicolored Clique}\xspace be given that are in the same equivalence class of $\mathcal{R}$. As before, since all color classes have the same size we can identify for each color class the vertex sets. Let $V$ be the vertex set (of size $k \cdot n$) of the $t$ instances and let $V_1,V_2,\ldots, V_k$ be the different color classes (of size $n$).
We assume, w.l.o.g.\ that every instance has at least one edge in $E(V_p,V_q)$ for all $1 \leq p < q \leq k$; otherwise, this instance would be a trivial no instance and we can delete it.
We copy some instance until we have $\widetilde{t}=s^d$ instances, where $s$ is the least odd integer with $t\leq s^d$. It holds that $s=\lceil t^{1/d} \rceil$ or $s=\lceil t^{1/d} \rceil + 1$; hence $s \leq t^{1/d}+2$. Clearly, this does not affect whether at least one instance is yes for MCC.
In the proof of Theorem \ref{theorem::P3} resp.\ Theorem \ref{theorem::LB} we add a set $W$ of size $2 \cdot \log(t)$ to the modulator to encode for each path $P_3$ resp.\ graph $H$ which instance it corresponds to. We cannot apply this construction here because we do not have the ``control set'' $C$ of a control pair; we only have a (large) strongly beneficial set $B$. Therefore, we have to find a different approach to encode to which instance a copy of the graph $H$ corresponds. Like Dell and Marx \cite{DBLP:conf/soda/DellM12} we add $d \cdot s$ vertex sets to the graph $G'$ (more precisely the modulator $X'$), which form $d$ groups of size $s$ each. The goal is to associate each instance with a different choice of $d$ out of the $d\cdot s$ vertex sets, picking one from each group; there are $\widetilde{t}=s^d$ choices.
\begin{figure}
\centering
\begin{tikzpicture}[scale=0.6]
\foreach \s/\ls in {1,2,3,5/s}{
\node at (2*\s -2, -4) {$\vdots$};
\foreach \t/\lt in {1,2,4/d-1}{
\node[draw, rectangle, minimum width=0.5cm, minimum height=0.5cm] (X_\t_\s) at (2*\s - 2, -2 *\t +2) [label=below:$X_{\lt,\ls}$] {};
}
\node[draw, rectangle, minimum width=0.7cm, minimum height=0.7cm] (Y_\s) at (2*\s -2, -8) [label=below:$Y_\ls$] {};
}
\node at (6, -8) {$\ldots$};
\foreach \t in {1,2,4}{
\node at (6,-2*\t +2) {$\ldots$};}
\end{tikzpicture}
\caption{The $d \cdot s$ sets that encode the $\widetilde{t}=s^d$ instances in the construction of $G'$.}
\label{figure::instance}
\end{figure}
We construct an instance $(G',k',X')$ of \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to an $H$-component graph; of course, this is also an instance of \prob{Edge Dominating Set}\xspace parameterized by the size of modulator to an \ensuremath{\mathcal{H}}\xspace-component graph. (See Figures \ref{figure::instance} and \ref{figure::LBgadgets} for an illustration.)
We add $(d-1) \cdot s$ vertex sets, each of size $\binom{k}{2}$, to $G'$; we denote these sets by $X_{i,j}$ where $i \in [d-1]$ and $j \in [s]$. Every vertex in $X_{i,j}$, with $i \in [d-1]$ and $j \in [s]$, represents a different edge set $E(V_p,V_q)$ for $1\leq p<q \leq k$. By $x_{i,j}^{p,q}$ we denote the vertex in $X_{i,j}$ that represents the edge set $E(V_p,V_q)$.
Next, we add $s$ sets, each of size $\binom{k}{2} \cdot n^2$, to $G'$. We denote these sets by $Y_j$ with $j \in [s]$. Every vertex in $Y_j$, with $j \in [s]$, represents a possible edge (of a \prob{Multicolored Clique}\xspace instance) between two vertices in different color classes $V_p$ and $V_q$, with $1\leq p<q\leq k$. By $y_j^{\{u,v\}}$ we denote the vertex in $Y_j$ that represents the possible edge $\{u,v\}$ with $u \in V_p$, $v \in V_q$.
We modify the indexing of the input instances from using $i$ with $ i \in [\widetilde{t}]$ to using index vectors $h=(h_1,h_2,\ldots, h_d) \in [s]^d$; there are $s^d=\widetilde{t}$ different index vectors. Henceforth, we refer to instances and their graphs through their index $h$. In the rest of the construction, every instance $(G_h,k)$ of \prob{Multicolored Clique}\xspace with $h=(h_1,h_2,\ldots, h_d) \in [s]^d$ only interacts with the vertex sets $X_{i,h_i}$ for $i \in [d-1]$ and the vertex set $Y_{h_d}$.
For every instance $G_h$, with $h \in [s]^d$, we add $|E(G_h)|$ copies of the graph $H$ to $G'$ and denote the copy of $H$ that represents edge $e \in E(G_h)$ by $H_h^e$. Let $B_h^e=\{b_{h,1}^e,b_{h,2}^e,\ldots, b_{h,d}^e\}$ be the copy of the beneficial set $B$ in $H_h^e$, i.e. vertex $b_{h,i}^e$ corresponds to vertex $b_i$ in $B$, for all $i \in [d]$.
We add all edges $\{b_{h,i}^e,x_{i,h_i}^{p,q} \}$, with $i \in [d-1]$, as well as the edge $\{b_{h,d}^e,y_{h_d}^e\}$ to $G'$, with $h=(h_1,h_2,\ldots,h_d) \in [s]^d$, $e \in E(G_h) \cap E(V_p,V_q)$ and $1 \leq p < q \leq k$. That is, an edge $e$ between color classes $V_p$ and $V_q$ in $G_h$ is (in part) represented by connecting its corresponding graph $H^e_h$ to the sets $X_{i,h_i}$ corresponding to $h$: The $i$th vertex $b^e_{h,i}$ of the beneficial set $B_h^e$ in $H^e_h$ is made adjacent to $x^{p,q}_{i,h_i}\in X_{i,h_i}$, for $i \in [d-1]$.
These edges between $H_h^e$ and $X_{i,h_i}$ represent only the colors of the endpoints of $e$. Whereas, the edges between $H_h^e$ and $Y_{h_d}$ represent the endpoints of $e$: The vertex $b_{h,d}^e$ of the beneficial set $B_h^e$ in $H_h^e$ is made adjacent to $y_{h_d}^e$.
Thus, every vertex $b^e_{h,i}$, with $i \in [d]$, is adjacent to exactly one vertex that is not contained in $V(H_h^e)$.
We need the sets $X_{i,j}$ with $i \in [d-1]$, and $j \in [s]$ only to encode the $\widetilde{t}$ instances; to make sure that there exists a clique in at least one instance we primarily use the sets $Y_j$ with $j \in [s]$.
Our goal is that for every $i \in [d-1]$ exactly one of the sets $X_{i,1}, X_{i,2}, \ldots X_{i,s}$ is contained in the set of endpoints of an edge dominating set of size at most $k'$ in $G'$. We obtain this by means of the following gadget:
\begin{figure}
\centering
\begin{minipage}[t]{0.35\textwidth}
\centering
\begin{tikzpicture}[scale=1]
\foreach \s in {1,2,...,5}{
\node[draw, rectangle, inner sep=0.35cm, rotate=360/5 * (\s) + 18] (c_\s) at ({360/5 * (\s) + 18}:1cm) {};
\node at ({360/5 * (\s) + 18}:1cm) {{\scriptsize{$X'_\s$}}};
}
%
\foreach \s in {1,2,...,5}{
\node[draw, rectangle, inner sep=0.25cm, rotate=360/5 * (\s) + 18] (v_\s) at ({360/5 * (\s) + 18}:2.1cm) {};
\node at ({360/5 * (\s) + 18}:2.1cm) {{\scriptsize{$X_\s$}}};
}
%
\foreach \s in {1,2,...,5}{
\draw[line width=3] (c_\s) -- (v_\s);
\foreach \t in {1,...,5}{
\draw[line width=3] (c_\s) -- (c_\t);
}}
\end{tikzpicture}
\subcaption{selection gadget with $s=5$}
\label{figure::selection_gadget}
\end{minipage}
\hspace{3em}
\begin{minipage}[t]{0.45\textwidth}
\centering
\begin{tikzpicture}[scale=0.75]
\foreach \s in {1,2,...,9}{
\node[draw, rectangle, minimum width=0.25cm, minimum height=0.25cm] (zp_\s) at (\s-5,1) {};
\node[draw, rectangle, minimum width=0.25cm, minimum height=0.25cm] (z_\s) at (\s-5,2) {};
\draw[line width=3] (z_\s) -- (zp_\s);
}
\foreach \s in {1,2,3}{
\node[draw, rectangle, minimum width=0.25cm, minimum height=0.25cm] (t_\s) at (3*\s-6,0) [label=below:$\widetilde{T}_\s$] {};
}
\foreach \s in {1,2,3}{
\draw[line width=3] (t_1) -- (zp_\s);
}
\foreach \s in {4,5,6}{
\draw[line width=3] (t_2) -- (zp_\s);
}
\foreach \s in {7,8,9}{
\draw[line width=3] (t_3) -- (zp_\s);
}
\foreach \s in {1,2,...,27}{
\node[draw, circle, inner sep=1pt, fill] (y_\s) at (0.33*\s-4.62,3) {};}
\node at (5,1) {$Z'$};
\node at (5,2) {$Z$};
\node at (5,3) {$Y$};
\foreach \i/\s in {1/4,2/5,3/6}{
\draw[fill] ($(z_1.north) + (-0.6mm,0)$) -- ($(z_1.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_1.north) + (-0.5mm,0)$) -- cycle ;
\draw[fill] ($(z_\s.north) + (-0.6mm,0)$) -- ($(z_\s.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_\s.north) + (-0.5mm,0)$) -- cycle ;
}
\foreach \i/\s in {4,5,6}{
\draw[fill] ($(z_2.north) + (-0.6mm,0)$) -- ($(z_2.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_2.north) + (-0.5mm,0)$) -- cycle ;
\draw[fill] ($(z_\s.north) + (-0.6mm,0)$) -- ($(z_\s.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_\s.north) + (-0.5mm,0)$) -- cycle ;
}
\foreach \i/\s in {7/4,8/5,9/6}{
\draw[fill] ($(z_3.north) + (-0.6mm,0)$) -- ($(z_3.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_3.north) + (-0.5mm,0)$) -- cycle ;
\draw[fill] ($(z_\s.north) + (-0.6mm,0)$) -- ($(z_\s.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_\s.north) + (-0.5mm,0)$) -- cycle ;
}
%
\foreach \i/\s in {10/7,13/8,16/9}{
\draw[fill] ($(z_1.north) + (-0.6mm,0)$) -- ($(z_1.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_1.north) + (-0.5mm,0)$) -- cycle ;
\draw[fill] ($(z_\s.north) + (-0.6mm,0)$) -- ($(z_\s.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_\s.north) + (-0.5mm,0)$) -- cycle ;
}
\foreach \i/\s in {11/7,14/8,17/9}{
\draw[fill] ($(z_2.north) + (-0.6mm,0)$) -- ($(z_2.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_2.north) + (-0.5mm,0)$) -- cycle ;
\draw[fill] ($(z_\s.north) + (-0.6mm,0)$) -- ($(z_\s.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_\s.north) + (-0.5mm,0)$) -- cycle ;
}
\foreach \i/\s in {12/7,15/8,18/9}{
\draw[fill] ($(z_3.north) + (-0.6mm,0)$) -- ($(z_3.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_3.north) + (-0.5mm,0)$) -- cycle ;
\draw[fill] ($(z_\s.north) + (-0.6mm,0)$) -- ($(z_\s.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_\s.north) + (-0.5mm,0)$) -- cycle ;
}
%
\foreach \i/\s in {19/4,20/5,21/6}{
\draw[fill] ($(z_7.north) + (-0.6mm,0)$) -- ($(z_7.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_7.north) + (-0.5mm,0)$) -- cycle ;
\draw[fill] ($(z_\s.north) + (-0.6mm,0)$) -- ($(z_\s.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_\s.north) + (-0.5mm,0)$) -- cycle ;
}
\foreach \i/\s in {22/4,23/5,24/6}{
\draw[fill] ($(z_8.north) + (-0.6mm,0)$) -- ($(z_8.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_8.north) + (-0.5mm,0)$) -- cycle ;
\draw[fill] ($(z_\s.north) + (-0.6mm,0)$) -- ($(z_\s.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_\s.north) + (-0.5mm,0)$) -- cycle ;
}
\foreach \i/\s in {25/4,26/5,27/6}{
\draw[fill] ($(z_9.north) + (-0.6mm,0)$) -- ($(z_9.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_9.north) + (-0.5mm,0)$) -- cycle ;
\draw[fill] ($(z_\s.north) + (-0.6mm,0)$) -- ($(z_\s.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_\s.north) + (-0.5mm,0)$) -- cycle ;
}
\end{tikzpicture}
\subcaption{clique gadget with $k=3$ and $|V_i|=3$}
\label{figure::clique_gadget}
\end{minipage}
\caption{Gadgets with notation as in the definition}
\label{figure::LBgadgets}
\end{figure}
A \emph{selection gadget} of size $\alpha$ consists of $s$ sets, say $X'_1,X'_2,\ldots,X'_s$, each of size $2 \cdot \binom{k}{2} \cdot d$ and $s$ sets, say $X_1,X_2,\ldots, X_s$, each of size $\alpha$. Each vertex in $X'_j$, with $j \in [s]$, is connected to all vertices in $X_j$ and to all vertices in $X'_{\bar{j}}$ with $\bar{j} \in [s]$ and $\bar{j} \neq j$ (see Figure \ref{figure::selection_gadget} for an illustration).
Intuitively, with a local budget of $(s-1)/2\cdot 2 \cdot \binom{k}{2} \cdot d$ edges, one could cover exactly all $(s-1)\cdot 2\cdot\binom{k}{2}$ vertices of all but one set $X'_j$ by picking appropriate edges with endpoints in the other sets; here we use that $s$ is odd. This would force us to cover edges between $X'_j$ and $X_j$ by making all vertices in $X_j$ endpoints of solution edges with other endpoint outside of th selection gadget.
We add $d-1$ selection gadgets of size $\binom{k}{2}$ to the modulator $X'$ and identify for each $j \in [s]$ the set $X_{i,j}$ with the set $X_j$ of one selection gadget. The $i$th selection gadget has the vertex sets $X_{i,1}, X_{i,2},\ldots, X_{i,s}$ and $X'_{i,1}, X'_{i,2},\ldots, X'_{i,s}$ where $i \in [d-1]$.
We still have to make sure that we pick $\binom{k}{2}$ edges that have their endpoints in a vertex set of size $k$, so that they must form a $k$-clique. To guarantee this, we add for each set $Y_j$, with $j \in [s]$, a gadget that we call clique gadget (see Figure \ref{figure::clique_gadget}) to the graph $G'$:
A \emph{clique gadget} consists of $k$ sets $\widetilde{T}_1,\widetilde{T}_2,\ldots,\widetilde{T}_k$ each of size $k-1$; every set represents one color class. Additionally, we add for every vertex $v \in V$ a set $Z_v$ of size $k-1$ as well as a copy of $Z_v$, named $Z'_v$, to the gadget. The final set $Y$ of the gadget contains $\binom{k}{2} \cdot n^2$ vertices, one for each possible edge in an instance. (Each edge has its endpoints in different color classes and we have $k$ color classes of size $n$.) We denote the vertex in $Y$ that represents the edge between vertex $v$ and $u$ in different color classes by $y^{\{v,u\}}$. (Later we will identify $Y$ with one set $Y_j$ for $j \in [s]$.)
We connect every vertex in $Z_v$ for a vertex $v \in V_i$, with $i \in [k]$, to all vertices in $Z'_v$, and to every vertex $y^{\{v,u\}}$ with $u \in V \setminus V_i$. Furthermore, we connect every vertex in $\widetilde{T}_i$, for $i \in [k]$, to all vertices in $Z'_v$, if $v \in V_i$, i.e., if $v$ has color $i$.
This gadget is perhaps the most vital part of our construction (apart from understanding strongly beneficial sets in $H$-components). There are two different cases for its behavior, which we will trigger by another selection gadget.
If there are no other constraints then it can be covered entirely by picking edges connecting sets $Z_v$ to sets $Z'_v$ (using $(k-1) \cdot k \cdot n$ edges). Else, as we will ensure for exactly one of these gadgets, the vertices in all sets $\widetilde{T}_i$ must be endpoints of solution edges because they have neighbors outside the gadget that are not contained in the solution. Nevertheless, we only want (have) $(k-1) \cdot k \cdot n$ solution edges that can be inside a clique gadget and we have to cover the vertices in all sets $\widetilde{T}_i$ only with this budget. To cover the vertices in $\widetilde{T}_i$ we add a matching between $\widetilde{T}_i$ and the vertices in one set $Z'_v$ for a single $v\in V_i$ to the solution. These $k$ vertices will be the vertices of a clique in one instance. Since, all sets $\widetilde{T}_i$, with $i \in [k]$, are covered, we can select $k-1$ edges each between the vertices of a set $Z_v$ (where $Z'_v$ is not covered by solution edges to $\widetilde{T}_1, \cup \ldots \cup \widetilde{T}_k$). We can pick these edges such that all, except the edges between $Z_v$ (where $v$ is a vertex in the ``clique'') and vertices in $y$ that represent an edge between $v$ and another vertex in the ``clique'', are dominated. We will dominate these $\binom{k}{2}$ edges in $Y$ that are incident with a non dominated edge via edges that have one endpoint in a copy of $H$, more precisely the vertex $b_d$ in a copy of $H$. This will guarantee that the edge between two clique vertices is an edge in the instance.
As mentioned above, we add $s$ clique gadgets to the modulator $X'$ and identify each $Y_j$, here $j \in [s]$, with a different set $Y$ of a clique gadget. To distinguish between sets in the different clique gadgets, we denote the other sets for the clique gadget containing set $Y_j$, with $j \in [s]$, by $T_{j,i}$, with $i \in [k]$, and by $Z_{j,v}$ and $Z'_{j,v}$, with $v \in V$; let $Z_j=\bigcup_{v \in V} Z_{j,v}$, let $Z'_j=\bigcup_{v \in V} Z'_{j,v}$ and let $T_j:=\bigcup_{i=1}^k T_{j,i}$.
Now, we have $s$ different clique gadgets and want to choose exactly one clique gadget where the set $T_j$ must be covered by the solution $F$. To this end, we add one last selection gadget of size $k \cdot (k-1)$ to $X'$ and identify the set $T_j$ with the set $X_j$ of the selection gadget, with $j \in [s]$. We denote the sets $X_j'$ of the selection gadget, with $j \in [s]$, by $T'_j$.
\begin{figure}
\centering
\begin{minipage}[t]{0.35\textwidth}
\centering
\begin{tikzpicture}[scale=1]
\foreach \s in {1,2,...,5}{
\node[draw, rectangle, inner sep=0.37cm, rotate=360/5 * (\s) + 18] (c_\s) at ({360/5 * (\s) + 18}:1cm) {};
\node at ({360/5 * (\s) + 18}:1cm) {{\scriptsize{$X'_{i,\s}$}}};
}
%
\foreach \s in {1,2,...,5}{
\node[draw, rectangle, inner sep=0.27cm, rotate=360/5 * (\s) + 18] (v_\s) at ({360/5 * (\s) + 18}:2.1cm) {};
\node at ({360/5 * (\s) + 18}:2.1cm) {{\scriptsize{$X_{i,\s}$}}};
}
%
\foreach \s in {1,2,...,5}{
\draw[line width=3] (c_\s) -- (v_\s);
\foreach \t in {1,...,5}{
\draw[line width=3] (c_\s) -- (c_\t);
}}
\end{tikzpicture}
\subcaption{the $i$th selection gadget with $s=5$}
\end{minipage}
\hspace{3em}
\begin{minipage}[t]{0.45\textwidth}
\centering
\begin{tikzpicture}[scale=0.8]
\foreach \s in {1,2,...,9}{
\node[draw, rectangle, minimum width=0.25cm, minimum height=0.25cm] (zp_\s) at (\s-5,1) {};
\node[draw, rectangle, minimum width=0.25cm, minimum height=0.25cm] (z_\s) at (\s-5,2) {};
\draw[line width=3] (z_\s) -- (zp_\s);
}
\foreach \s in {1,2,3}{
\node[draw, rectangle, minimum width=0.25cm, minimum height=0.25cm] (t_\s) at (3*\s-6,0) [label=below:$T_{j,\s}$] {};
}
\foreach \s in {1,2,3}{
\draw[line width=3] (t_1) -- (zp_\s);
}
\foreach \s in {4,5,6}{
\draw[line width=3] (t_2) -- (zp_\s);
}
\foreach \s in {7,8,9}{
\draw[line width=3] (t_3) -- (zp_\s);
}
\foreach \s in {1,2,...,27}{
\node[draw, circle, inner sep=1pt, fill] (y_\s) at (0.33*\s-4.62,3) {};}
\node at (5,1) {$Z_j'$};
\node at (5,2) {$Z_j$};
\node at (5,3) {$Y_j$};
\node at (5,0) {$T_j$};
\node at (-0.5,1.9) {{\scriptsize$Z_{j,v}$}};
\node at (-0.5,0.9) {{\scriptsize$Z'_{j,v}$}};
\foreach \i/\s in {1/4,2/5,3/6}{
\draw[fill] ($(z_1.north) + (-0.6mm,0)$) -- ($(z_1.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_1.north) + (-0.5mm,0)$) -- cycle ;
\draw[fill] ($(z_\s.north) + (-0.6mm,0)$) -- ($(z_\s.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_\s.north) + (-0.5mm,0)$) -- cycle ;
}
\foreach \i/\s in {4,5,6}{
\draw[fill] ($(z_2.north) + (-0.6mm,0)$) -- ($(z_2.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_2.north) + (-0.5mm,0)$) -- cycle ;
\draw[fill] ($(z_\s.north) + (-0.6mm,0)$) -- ($(z_\s.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_\s.north) + (-0.5mm,0)$) -- cycle ;
}
\foreach \i/\s in {7/4,8/5,9/6}{
\draw[fill] ($(z_3.north) + (-0.6mm,0)$) -- ($(z_3.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_3.north) + (-0.5mm,0)$) -- cycle ;
\draw[fill] ($(z_\s.north) + (-0.6mm,0)$) -- ($(z_\s.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_\s.north) + (-0.5mm,0)$) -- cycle ;
}
%
\foreach \i/\s in {10/7,13/8,16/9}{
\draw[fill] ($(z_1.north) + (-0.6mm,0)$) -- ($(z_1.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_1.north) + (-0.5mm,0)$) -- cycle ;
\draw[fill] ($(z_\s.north) + (-0.6mm,0)$) -- ($(z_\s.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_\s.north) + (-0.5mm,0)$) -- cycle ;
}
\foreach \i/\s in {11/7,14/8,17/9}{
\draw[fill] ($(z_2.north) + (-0.6mm,0)$) -- ($(z_2.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_2.north) + (-0.5mm,0)$) -- cycle ;
\draw[fill] ($(z_\s.north) + (-0.6mm,0)$) -- ($(z_\s.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_\s.north) + (-0.5mm,0)$) -- cycle ;
}
\foreach \i/\s in {12/7,15/8,18/9}{
\draw[fill] ($(z_3.north) + (-0.6mm,0)$) -- ($(z_3.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_3.north) + (-0.5mm,0)$) -- cycle ;
\draw[fill] ($(z_\s.north) + (-0.6mm,0)$) -- ($(z_\s.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_\s.north) + (-0.5mm,0)$) -- cycle ;
}
%
\foreach \i/\s in {19/4,20/5,21/6}{
\draw[fill] ($(z_7.north) + (-0.6mm,0)$) -- ($(z_7.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_7.north) + (-0.5mm,0)$) -- cycle ;
\draw[fill] ($(z_\s.north) + (-0.6mm,0)$) -- ($(z_\s.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_\s.north) + (-0.5mm,0)$) -- cycle ;
}
\foreach \i/\s in {22/4,23/5,24/6}{
\draw[fill] ($(z_8.north) + (-0.6mm,0)$) -- ($(z_8.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_8.north) + (-0.5mm,0)$) -- cycle ;
\draw[fill] ($(z_\s.north) + (-0.6mm,0)$) -- ($(z_\s.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_\s.north) + (-0.5mm,0)$) -- cycle ;
}
\foreach \i/\s in {25/4,26/5,27/6}{
\draw[fill] ($(z_9.north) + (-0.6mm,0)$) -- ($(z_9.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_9.north) + (-0.5mm,0)$) -- cycle ;
\draw[fill] ($(z_\s.north) + (-0.6mm,0)$) -- ($(z_\s.north) + (0.6mm,0)$) -- (y_\i.south) -- ($(z_\s.north) + (-0.5mm,0)$) -- cycle ;
}
\end{tikzpicture}
\subcaption{$j$th clique gadget with $k=3$ and $|V_i|=3$.}
\end{minipage}
\caption{Gadgets with notation as in the construction of $G'$}
\label{figure::LBgadgets_new}
\end{figure}
The set $X'$ contains all vertices that are not contained in a copy of graph $H$; in total these are $(d-1) \cdot s \cdot \binom{k}{2} \cdot (1 + 2 \cdot d)$ vertices for the $d-1$ selection gadgets of size $\binom{k}{2}$, $s \cdot ( (k + 2 \cdot k \cdot n) \cdot (k-1) + \binom{k}{2} \cdot n^2)$ vertices for the $s$ clique gadgets and $s \cdot 2 \cdot \binom{k}{2} \cdot d$ vertices for the last selection gadget (only those that we did not already count, because they are also contained in a clique gadget); hence $|X'| \in \mathcal{O}(s \cdot n^2 \cdot k^2 \cdot d^2)= \mathcal{O}(t^{1/d} \cdot poly(n))$, because $t^{1/d} \geq s-2$ and $d,k \leq n$.
Let
\[
k'= d \cdot 2 \cdot \binom{k}{2} \cdot d \cdot \frac{s-1}{2} + s \cdot k \cdot n \cdot (k-1) + \sum_{h \in [s]^d} |E(G_h)| \cdot \MEDS(H) + \binom{k}{2} \mathrm{cost}(B):
\]
Intuitively, we have a local budget of $2 \cdot \binom{k}{2} \cdot d \cdot \frac{s-1}{2}$ to dominate all edges of the complete $s$-partite graph that is contained in each of the $d$ selection gadgets, a local budget of $k \cdot n \cdot (k-1)$ to dominate all edges between $Z_j$ and $Z'_j$ in each of the $s$ clique gadgets, a local budget of $\sum_{h \in [s]^d} |E(G_h)| \cdot \MEDS(H)$ to dominate all edges of $G-X$, and an extra budget of $\binom{k}{2} \mathrm{cost}(B)$ edges to dominate all remaining edges.
We have to show that there exists an index vector $h^* \in [s]^d$ such that $(G_{h^*},k)$ is a $\mathrm{YES}$-instance if and only if $(G',k',X')$ is a $\mathrm{YES}$-instance.
$(\Rightarrow:)$ Assume that for some index vector $h^* \in [s]^d$ the \prob{Multicolored Clique}\xspace instance $(G_{h^*}, k)$ is a $\mathrm{YES}$-instance. Let $X=\{x_1,x_2,\ldots,x_k\} \subseteq V$ be a multicolored clique of size $k$ in $G_{h^*}$ with $x_i \in V_i$ for $i \in [k]$ and let $E'$ be the set of edges of the clique $X$. Let $h^*=(h^*_1,h^*_2,\ldots,h^*_d) \in [s]^d$. We construct an edge dominating set $F$ of $G'$ as follows:
For each $i \in [d-1]$ we add a minimum edge dominating set in $G'[X'_{i,1} \cup X'_{i,2} \cup \ldots \cup X'_{i,s}]$ of size $2 \cdot \binom{k}{2} \cdot d \cdot \frac{s-1}{2}$ to $F$ such that each set, except the set $X'_{i,h^*_i}$, is covered by $F$. Such a minimum edge dominating set exists, because $G'[X'_{i,1} \cup X'_{i,2} \cup \ldots \cup X'_{i,s}]$ is a complete $s$-partite graph and $s$ is odd.
Thus, we dominate all edges, except the edges between the vertex sets $X'_{i,h^*_i}$ and $X_{i,h^*_i}$ in these $d-1$ selection gadgets.
Next, we add a minimum edge dominating set in $G'[T'_1 \cup T'_2 \cup \ldots \cup T'_s]$ of size $2 \cdot \binom{k}{2} \cdot d \cdot \frac{s-1}{2}$ to $F$ such that each vertex set, except the set $T'_{h^*_d}$, is covered by $F$. (Such a minimum edge dominating set exists for the same reasons as above.)
Consider the $s$ clique gadgets: For each $j \in \{1,2,\ldots,s\} \setminus \{h^*_d\}$ we add a perfect matching between the vertex sets $Z_j$ and $Z'_j$ to $F$; such a matching of size $|V| \cdot (k-1) = n \cdot k \cdot (k-1)$ exists by construction (for each $v \in V$ it holds that every vertex in $Z_{j,v} \subseteq Z_j$ is connected to every vertex in $Z'_{j,v} \subseteq Z'_j$ and both sets have the same size). Thus, all edges in these clique gadgets and between these clique gadgets and the selection gadget are dominated: The only uncovered vertices in a clique gadget are the vertices $Y_j$ and $T_j$, with $j \in [s]$ and $j \neq h^*_d$. These sets are independent sets and only the set $T_j$ is adjacent to a selection gadget, more precisely, to the vertex set $T'_j$ which is covered by $F$.
Since the edges between the vertex sets $T'_{h^*_d}$ and $T_{h^*_d}$ are not dominated so far, we add a perfect matching between the vertex sets $T_{h^*_d}$ and $\{Z'_{h^*_d,x} \mid x \in X\}$ to $F$; such a matching of size $|X| \cdot (k-1) = k \cdot (k-1)$ exists by construction: the set $T_{h^*_d,i}$, with $i \in [k]$, has size $k-1$ and every vertex in $T_{h^*_d,i}$ is connected to all $k-1$ vertices in $Z'_{h^*_d,x_i}$ with $x_i \in X \cap V_i$. Thus, we covered all edges inside the selection gadget of size $k \cdot (k-1)$ and between this selection gadget and the clique gadgets.
Next, we add for all $v \in V_i \setminus X$, with $i \in [k]$, a perfect matching between $Z_{h^*_d,v}$ and $\{y_{h^*_d}^{\{v,x\}} \mid x \in X - x_i\}$: Both sets have size $k-1$ and every vertex in $Z_{h^*_d,v}$ is adjacent to all vertices in $\{y_{h^*_d}^{\{v,x\}} \mid x \in X - x_i\}$. In total, these are $|V \setminus X| \cdot (k-1) = (n-1) \cdot k \cdot (k-1)$ edges.
So far, we dominate all edges, except the edges between vertices in $Z_{h^*_d,x}$, with $x \in X$, and the vertices in $\{y_{h^*_d}^{\{x,y\}} \mid x,y \in X, x \neq y\}$: The sets $T_{h^*_d}$, $Z'_{h^*_d,x}$, with $x \in X$, and $Z_{h^*_d,v}$, with $v \in V \setminus X$, are covered by $F$. Thus, the only edges that are not dominated in this clique gadget are those between the vertex sets $Z_{h^*_d,x}$ with $x \in X$ and $Y_{h^*_d}$. A vertex in $Z_{h^*_d,x_i}$, with $i \in [k]$, is adjacent to a vertex $y_{h^*_d}^{\{u,v\}}$ if $u=x_i$ and $v \in V \setminus V_i$. But, for all $v \in V \setminus (V_i \cup X)$, the vertex $y_{h^*_d}^{\{x_i,v\}}$ is already covered by $F$ (see above).
Finally, we add an edge dominating set for the copies of $H$ to $F$. For all graphs $H_h^e$ with $h \in [s]^d$, and $e \in E(G_h)$, and either $h \neq h^*$ or $e \notin E'$ we add a minimum edge dominating set in $H_h^e$ that covers all vertices in $B_h^e$ to $F$; such a minimum edge dominating set exists by assumption. (Recall, $E'$ is the set of edges between vertices in $X$.)
For all graphs $H_{h^*}^e$ with $e=\{x_p,x_q\} \in E'$, with $1 \leq p < q \leq k$, we add a minimum edge dominating set in $H_{h^*}^e -B_{h^*}^e$ to $F$ as well as the edges $\{b_{h^*,i}^e, x_{i,h^*_i}^{p,q}\}$, with $i \in [d-1]$, and the edge $\{b_{h^*,d}^e, y_{h^*_d}^e\}$. These edges exist by construction, because $E' \subseteq E(G_{h^*})$. Thus, the set $V(F)$ contains the vertex set $X_{i,h^*_i}$, with $i \in [d-1]$, and the vertex set $\{y_{h^*_d}^{\{x,y\}} \mid x,y \in X, x \neq y\}$, which implies that $F$ dominates all edges that are contained in a clique gadget and in a selection gadget.
Since all vertices in $B_h^i$, with $h \in [s]^d$ and $i \in [k]$, are dominated by $F$ and these are the only vertices in the connected component of $H_h^e$ that are adjacent to a vertex in $X'$, and $F$ dominates all clique gadgets, selection gadgets, and connected components of $G'-X'$, the set $F$ is an edge dominating set of $G'$.
The set $F$ contains $d \cdot 2 \cdot \binom{k}{2} \cdot d \cdot \frac{s-1}{2}$ edges inside the selection gadgets, $(s-1) \cdot n \cdot k \cdot (k-1)$ edges inside the clique gadgets that do not contain $Y_{h^*_d}$, $k \cdot (k-1) + (n-1) \cdot k \cdot (k-1)$ edges inside the clique gadget that contains $Y_{h^*_d}$, $\MEDS(H)$ edges for all graphs $H_h^e$ with $h \in [s]^d$, $e \in E(G_h)$ and either $h \neq h^*$ or $e \notin E'$, and $\MEDS(H-B)+|B|=\MEDS(H)+\mathrm{cost}(B)$ edges for all graphs $H_{h^*}^e$ with $e \in E'$. This sums up to $k'$, implying that $(G',k',X')$ is a $\mathrm{YES}$-instance.
$(\Leftarrow:)$ Assume that $(G',k',X')$ is a $\mathrm{YES}$-instance of $\prob{Edge Dominating Set}\xspace$ and let $F$ be an edge dominating set of size at most $k'$ in $G'$.
First, we consider how the edge dominating set $F$ interacts with the graph $G'$:
\begin{itemize}
\item We need at least $k \cdot n \cdot (k-1)$ edges to dominate all edges between $Z_j=\bigcup_{v \in V} Z_{j,v}$, and $Z'_j=\bigcup_{v \in V} Z'_{j,v}$ in one clique gadget, because $G'[Z_{j,v} \cup Z'_{j,v}]$ is a complete bipartite graph whose bipartition has the parts $Z_{j,v}$ and $Z'_{j,v}$ for all $v \in V$ and $|Z_{j,v}|=|Z'_{j,v}|=k-1$. Thus, at least $k \cdot n \cdot (k-1)$ edges of $F$ must be contained inside a clique gadget because we need at least $k \cdot n \cdot (k-1)$ edges to dominate all edges between $Z_j$ and $Z'_j$, with $j \in [s]$, and because these sets are only adjacent to vertices inside the clique gadget they belong to.
\item Furthermore, $F$ contains at least $2 \cdot \binom{k}{2} \cdot d \cdot \frac{s-1}{2}$ edges inside each selection gadget, because the $s$ sets $X'_{i,1}, X'_{i,2}, \ldots, X'_{i,s}$, with $i \in [d-1]$, resp.\ the $s$ sets $T'_1, T'_2, \ldots, T'_s$ of each selection gadget form a complete $s$-partite graph where each partition has size $2 \cdot \binom{k}{2} \cdot d$ and these sets are only adjacent to vertices in their selection gadget. Note that, the sets $T_1, T_2,\ldots, T_s$ are contained in one selection gadget and in the clique gadgets; but our counting is still correct, because each of the $k \cdot n \cdot (k-1)$ edges that are contained in the clique gadgets must have at least one endpoint in the vertex set $Z_j \cup Z'_j$, with $j \in [s]$, and each of the $2 \cdot \binom{k}{2} \cdot d \cdot \frac{s-1}{2}$ edges in the selection gadgets must have at least one endpoint in the vertex set $T'_1 \cup T'_2 \cup \ldots \cup T'_s$, and because the sets $Z_j \cup Z'_j$ and $T'_1 \cup T'_2 \cup \ldots \cup T'_s$ are not adjacent.
\item To dominate all edges in $H_h^e$, with $h \in [s]^d$ and $e \in E(G_h)$, we need at least $\MEDS(H)$ edges that are adjacent to $V(H_h^e)$. Thus, we need at least $\sum_{h \in [s]^d} |E(G_h)| \cdot \MEDS(H)$ edges to dominate all edges of $G'-X'$.
\end{itemize}
Summarizing, for all, except $\binom{k}{2} \cdot \mathrm{cost}(B)$ edges of $F$ we know at least one endpoint and that these edges are either contained in a selection gadget, a clique gadget, or adjacent to a copy of $H$.
During the proof, we will show that we can make some assumptions about the edge dominating set $F$. To achieve these assumptions, we replace some edges in $F$ such that the resulting graph is still an edge dominating set of size $|F|$ in $G'$. But, a replacement of an edge will always preserve the previous assumptions.
\begin{claim} \label{claim::selection_gadget}
There exists an edge dominating set $F'$ of size $k'$ in $G'$ such that for each $i \in [d-1]$ there exists exactly one $j \in [s]$ such that no vertex in $X'_{i,j}$ is covered by $F'$ (hence $X'_{i,j} \cap V(F')=\emptyset$), and there exists exactly one $j \in [s]$ such that no vertex in $T'_{j}$ is covered by $F'$ (hence $T'_j \cap V(F') = \emptyset$).
\end{claim}
%
\begin{claimproof}
Since the $s$ sets $X'_{i,1}, X'_{i,2}, \ldots, X'_{i,s}$, with $i \in [d-1]$, resp.\ the $s$ sets $T'_1, T'_2, \ldots, T'_s$ of each selection gadget form a complete $s$-partite graph, it holds that $V(F)$ contains at least $s-1$ sets of the $s$ sets $X'_{i,1}, X'_{i,2}, \ldots, X'_{i,s}$, with $i \in [d-1]$, resp.\ at least $s-1$ of the $s$ sets $T'_1, T'_2, \ldots, T'_s$.
First, we show that not all sets $X'_{i,1}, X'_{i,2}, \ldots, X'_{i,s}$, with $i \in [d-1]$, resp.\ not all sets $T'_1, T'_2, \ldots, T'_s$ can be covered by $F$:
Assume that all vertices in $X'_{i,1}\cup X'_{i,2}\cup \ldots \cup X'_{i,s}$, for some $i \in [d-1]$, resp.\ all vertices in $T'_1 \cup T'_2 \cup \ldots \cup T'_s$ are contained in $V(F)$. This would imply that at least
\[
\frac{1}{2} \cdot \left|\bigcup_{j=1}^s X'_{i,j}\right| = \frac{1}{2} \cdot \left|\bigcup_{j=1}^s T'_{j}\right| =\frac{1}{2} \cdot s \cdot 2 \cdot \binom{k}{2} \cdot d = 2 \cdot \binom{k}{2} \cdot d \cdot \frac{s-1}{2} + \binom{k}{2} \cdot d
\]
edges of $F$ must be contained in this selection gadget. These are at least $\binom{k}{2} \cdot d$ edges more than the minimum number of edges in $F$ that must be contained in a selection gadget. But, we showed above that $F$ has at most $\binom{k}{2} \cdot \mathrm{cost}(B) < \binom{k}{2} \cdot |B| = \binom{k}{2} \cdot d$ additional edges. Thus, if $V(F)$ contains the entire set $X'_{i,1}\cup X'_{i,2}\cup \ldots \cup X'_{i,s}$, for some $i \in [d-1]$, resp.\ the entire set $T'_1 \cup T'_2 \cup \ldots \cup T'_s$, then $F$ contains more than $k'$ edges which is a contradiction.
Thus, for each $i \in [d-1]$ there exists an $h_i \in [s]$ such that not all vertices in $X'_{i,h_i}$ are covered by $F$ and there exists an $h_d \in [s]$ such that not all vertices in $T'_{h_d}$ are covered by $F$. Let $h=(h_1,h_2,\ldots,h_d)$.
Since all vertices in $X'_{i,h_i}$, with $i \in [d-1]$, resp.\ all vertices in $T'_{h_d}$ have the same neighborhood and at least one vertex in these sets in not contained in $V(F)$, it holds that all vertices in the neighborhood of $X'_{i,h_i}$, with $i \in [d-1]$, resp.\ in the neighborhood of $T'_{h_d}$ must be contained in $V(F)$; otherwise $F$ would not be an edge dominating set in $G'$.
We replace every edge in $F$ that is incident with a vertex in $X'_{i,h_i}$, with $i \in [d-1]$, resp.\ to a vertex in $T'_{h_d}$. (Note, that the set $\bigcup_{i=1}^{d-1} X'_{i,h_i} \cup T'_{h_d}$ is an independent set, thus every edge in $F$ that is incident with this set must have its other endpoint outside this set.) Let $f=\{u,v\} \in F$ be an edge in $F$ with $u \in \bigcup_{i=1}^{d-1} X'_{i,h_i} \cup T'_{h_d}$. By construction, the vertex $v$ is a vertex in $X'_{i,j}$, with $i \in [d-1]$, $j \in [s]$ and $j \neq h_i$, or $T_j'$, with $j \in [s]$ and $j \neq h_d$, or $X_{i,h_i}$, with $i \in [d-1]$, or $T_{h_d}$. Hence, $v$ has a neighbor $v'$ that is not contained in $\bigcup_{i=1}^{d-1} X'_{i,h_i} \cup T'_{h_d}$.
Thus, we can replace edge $f$ in $F$ with edge $f'=\{v,v'\}$ to obtain $F'$. The set $F'$ is still an edge dominating set: the only vertices that are not covered by the set $F'$ any more are contained in $\bigcup_{i=1}^{d-1} X'_{i,h_i} \cup T'_{h_d}$, but this set is an independent set and the neighborhood of this set is still covered by $F'$. This proves the claim.
\end{claimproof}
%
Assume that the edge dominating set $F$ fulfills the properties of Claim \ref{claim::selection_gadget} (if this is not the case we can replace $F$ by $F'$). Let $h^*=(h^*_1,h^*_2,\ldots, h^*_d) \in [s]^d$ such that no vertex in $X'_{i,h^*_i}$, for $i \in [d-1]$, is covered by $F$ and no vertex in $T'_{h^*_d}$ is covered by $F$. It follows, that the sets $X_{i,h^*_i}$, for $i \in [d-1]$, must be covered by $F$ because all vertices in $X'_{i,h^*_i}$ are adjacent to all vertices in $X_{i,h^*_i}$.
The vertex sets $X_{i,h^*_i}$, with $i \in [d-1]$, are only adjacent to the sets $X'_{i,h^*_i}$ and copies of $H$; hence the edges of $F$ that cover $X_{i,h^*_i}$ have their other endpoint in a copy of $H$.
Let $F_{h^*} = \{ f \in F \mid \exists i \in [d-1] \colon f \cap X_{i,h^*_i} \neq \emptyset \}$ be the set of edges in $F$ that are incident with a vertex in $X_{i,h^*_i}$, with $i \in [d-1]$, and let $F_h^e = \{ f \in F \mid f \cap V(H_h^e) \neq \emptyset \}$ be the set of edges in $F$ that are incident with a vertex in $H_h^e$ with $h \in [s]^d$.
Let $B_h^e(F_{h^*}) = \{ b \in B_h^e \mid \exists f \in F_{h^*} \colon b \in f \}$ be the set of vertices in $B_h^e$ that are incident with an edge in $F_{h^*}$.
It holds that $F_h^e$, with $h \in [s]^d$ and $e \in E(G_h)$, has at least the size of a minimum edge dominating set in $H_h^e - B_h^e(F_{h^*})$ plus the size of $B_h^e(F_{h^*})$, because the edges in $F_h^e$ that have one endpoint in $B_h^e(F_{h^*})$ have their other endpoint not in $H_h^e$ and to dominate all remaining edges in $H_h^e$ we need at least $\MEDS(H_h^e - B_h^e(F_{h^*}))$ many edges. Since no two copies of $H$ are adjacent, this implies that at least
\[
\sum_{h \in [s]^d} |E(G_h)| \cdot \MEDS(H) + \sum_{h \in [s]^d} \sum_{ e \in E(G_h)} \mathrm{cost}(B_h^e(F_{h^*}))
\]
edges of $F$ are incident with a copy of $H$ because
\begin{align}
\sum_{h \in [s]^d} \sum_{ e \in E(G_h)} |F_h^e|
&\geq \sum_{h \in [s]^d} \sum_{ e \in E(G_h)} \left( \MEDS(H-B_h^e(F_{h^*})) + |B_h^e(F_{h^*})| \right) \nonumber \\
&= \sum_{h \in [s]^d} \sum_{ e \in E(G_h)} \left( \MEDS(H) + \mathrm{cost}(B_h^e(F_{h^*})) \right) \nonumber \\
&=\sum_{h \in [s]^d} |E(G_h)| \cdot \MEDS(H) + \sum_{h \in [s]^d} \sum_{ e \in E(G_h)} \mathrm{cost}(B_h^e(F_{h^*}))\text{.} \label{align::bound_F_h^e}
\end{align}
Now, we have $\sum_{h \in [s]^d} \sum_{ e \in E(G_h)} \mathrm{cost}(B_h^e(F_{h^*}))$ edges more in $F$ that are incident with a copy of $H$ than the lower bound of $\sum_{h \in [s]^d} |E(G_h)| \cdot \MEDS(H)$ edges. These edges belong neither to the $2 \cdot \binom{k}{2} \cdot d \cdot \frac{s-1}{2}$ edges that we need to dominate all edges in the complete $s$-partite graph that is a subgraph of every selection gadget nor to the $k \cdot n \cdot (k-1)$ edges that we need to dominate one clique gadget. Thus,
\[
\sum_{h \in [s]^d} \sum_{ e \in E(G_h)} \mathrm{cost}(B_h^e(F_{h^*})) \leq \binom{k}{2} \cdot \mathrm{cost}(B).
\]
\begin{claim} \label{claim::extra_budget}
\[
\sum_{h \in [s]^d} \sum_{ e \in E(G_h)} \mathrm{cost}(B_h^e(F_{h^*})) = \binom{k}{2} \cdot \mathrm{cost}(B).
\]
\end{claim}
\begin{claimproof}
First, we rewrite the left-hand side as follows:
\[
\sum_{h \in [s]^d} \sum_{ e \in E(G_h)} \mathrm{cost}(B_h^e(F_{h^*})) = \sum_{1 \leq p<q \leq k} \sum_{h \in [s]^d} \sum_{e \in E(G_h) \cap E(V_p,V_q)} \mathrm{cost}(B_h^e(F_{h^*})).
\]
We assume for contradiction that
\[
\sum_{1 \leq p<q \leq k} \sum_{h \in [s]^d} \sum_{e \in E(G_h) \cap E(V_p,V_q)} \mathrm{cost}(B_h^e(F_{h^*})) < \binom{k}{2} \cdot \mathrm{cost}(B).
\]
This implies that there exist $1 \leq \bar{p} < \bar{q} \leq k$ such that
\[
\sum_{h \in [s]^d} \sum_{e \in E(G_h) \cap E(V_{\bar{p}},V_{\bar{q}})} \mathrm{cost}(B_h^e(F_{h^*})) < \mathrm{cost}(B).
\]
We will show that $B':=\bigcup_{h \in [s]^d} \bigcup_{e \in E(G_h) \cap E(V_{\bar{p}},V_{\bar{q}})} B_h^e(F_{h^*})$ contains at least one copy of every vertex in $B \setminus \{b_d\}$. Let $i \in [d-1]$. Consider vertex $x_{i,h^*_i}^{\bar{p},\bar{q}}$ in $X_{i,h^*_i}$, which is covered by an edge in $F_{h^*}$ (by definition of $F_{h^*}$) and let $f=\{x_{i,h^*_i}^{\bar{p},\bar{q}}, v\}$ be an edge in $F_{h^*}$ that has $x_{i,h^*_i}^{\bar{p},\bar{q}}$ as one endpoint. The vertex $v$ must be a vertex in a copy of $H$ because $X_{i,h^*_i}$ is only adjacent to vertices in $X'_{i,h^*_i}$ (which are not covered by $F$), and adjacent to copies of $H$. More precisely, since $f$ is an edge in $E(G')$, the vertex $v$ must be contained in $\{b_{h,i}^e \mid h \in [s]^d, h_i=h^*_i, e \in E(G_h) \cap E(V_{\bar{p}},V_{\bar{q}}) \}$ (construction of $G'$: we add edges $\{x_{i,h_i}^e,b_{h,i}^e\}$ to $G'$ with $h=(h_1,h_2,\ldots,h_d) \in [s]^d$ and $e \in E(G_h)$). But, every vertex in this set is a copy of $b_i$ and it follows that $B'$ contains at least one copy of $b_i$. Since, this holds for all $i \in [d-1]$ it follows that $B'$ contains at least one copy of each vertex in $B \setminus \{b_d\}$.
Let $B_1,B_2,\ldots,B_l$ be the subsets of $B$ that correspond to the nonempty sets in $\{ B_h^e(F_{h^*}) \mid h \in [s]^d, e \in E(G_h) \cap E(V_{\bar{p}},V_{\bar{q}})\}$. Now, the sets $B_1,B_2,\ldots,B_l$ together with the set $\{b_d\}$ cover the set $B$. Since the vertex $b_d$ is not extendable in $H$ (Proposition \ref{proposition::properties} (\ref{proposition::disjointQ})) it holds that $\mathrm{cost}(\{b_d\})=1$. Thus, it holds that $\sum_{i=1}^l \mathrm{cost}(B_i) + \mathrm{cost}(\{b_d\}) < \mathrm{cost}(B) + 1$, because we assumed that $\sum_{i=1}^l \mathrm{cost}(B_i) < \mathrm{cost}(B)$ and $\mathrm{cost}(\{b_d\})=1$; hence $\sum_{i=1}^l \mathrm{cost}(B_i) + \mathrm{cost}(\{b_d\}) \leq \mathrm{cost}(B)$. Note that every set $B_i$, with $i \in [l]$, must be a proper subset of $B$; otherwise $\mathrm{cost}(B)=\mathrm{cost}(B_i)$ which contradicts the assumption that $\sum_{i=1}^l \mathrm{cost}(B_i) < \mathrm{cost}(B)$.
Summarized, the sets $B_1,B_2,\ldots, B_l, \{b_d\} \subsetneq B$ cover $B$ and it holds that $\sum_{i=1}^l \mathrm{cost}(B_i) + \mathrm{cost}(\{b_d\}) \leq \mathrm{cost}(B)$. This implies that $B$ is not strongly beneficial (see definition), which is a contradiction and proves the claim.
\end{claimproof}
%
So far, we know that $F$ contains $d \cdot 2 \cdot \binom{k}{2} \cdot d \cdot \frac{s-1}{2}$ edges that cover the $d$ different complete $s$-partite graphs that are subgraphs of the $d$ selection gadgets, and that (at least) $\sum_{h \in [s]^d} |E(G_h)| \cdot \MEDS(H) + \binom{k}{2} \mathrm{cost}(B)$ edges are incident with copies of $H$ (Claim \ref{claim::extra_budget}).
Thus, the remaining $s \cdot k \cdot n \cdot (k-1)$ edges must cover the $s$ clique gadgets. Since this is the number of edges we need (at least) to dominate the edges between the vertex sets $Z_j$ and $Z'_j$, with $j \in [s]$, in a clique gadget, every remaining edge must either be incident with a vertex of $Z_j$ or with a vertex of $Z'_j$.
Consider the clique gadget that contains the vertex set $Y_{h^*_d}$. Since no vertex in $T'_{h^*_d}$ is covered by $F$, it holds that every vertex in $T_{h^*_d}$ must be covered by $F$ (because every vertex in $T'_{h^*_d}$ is adjacent to every vertex in $T_{h^*_d}$). Each vertex in $T_{h^*_d}$ is only adjacent to vertices in $T'_{h^*_d}$ and $Z'_{h^*_d}$; thus, every edge in $F$ that is incident with a vertex in $T_{h^*_d}$ has its other endpoint in $Z'_{h^*_d}$.
Furthermore, for each vertex $v \in V$ the entire set $Z_{h^*_d,v}$ or the entire set $Z'_{h^*_d,v}$ is contained in $V(F)$ (both is also okay) because $G'[Z_{h^*_d,v} \cup Z'_{h^*_d,v}]$ is a complete bipartite graph whose partition has the parts $Z_{h^*_d,v}$ and $Z'_{h^*_d,v}$. Additionally, this implies that the vertex set $Z_{h^*_d,v} \cup Z'_{h^*_d,v}$ is incident with exactly $|Z_{h^*_d,v}| = |Z'_{h^*_d,v}|=k-1$ edges of $F$ because $|V|=k \cdot n$, and there are $k \cdot n \cdot (k-1)$ edges in $F$ that dominate all edges between $Z_{h^*_d}$ and $Z'_{h^*_d}$.
\begin{claim}\label{claim::clique_gadget}
There exists an edge dominating set $F'$ of size $k'$ in $G'$ such that for all vertices $v \in V$ either no vertex in $Z'_{h^*_d,v}$ or no vertex in $Z_{h^*_d,v}$ is covered by $F'$. Furthermore, for each color class $V_i$, with $i \in [k]$, there exists exactly one vertex $v_i \in V_i$ such that $F'$ covers no vertex in $Z_{h^*_d,v}$.
\end{claim}
\begin{claimproof}
Let $i \in [k]$ and let $v_i$ be a vertex in $V_i$ such that $F$ contains an edge that has one endpoint in $T_{h^*_d,i}$ and the other endpoint in $Z'_{h^*_d,v_i}$.
Since the set $Z'_{h^*_d,v_i} \cup Z_{h^*_d,v_i}$ is only incident with $k-1$ edges of $F$, and since either $Z'_{h^*_d,v_i}$ or $Z_{h^*_d,v_i}$ must be entirely contained in $V(F)$ it holds that $Z'_{h^*_d,v_i}$ is entirely covered by $F$, and that every edge of $F$ that is incident with a vertex in $Z_{h^*_d,v_i}$ has its other endpoint in $Z'_{h^*_d,v_i}$. Furthermore, there exists a vertex in $Z_{h^*_d,v_i}$ that is not covered by $F$ because the set $Z'_{h^*_d,v_i} \cup Z_{h^*_d,v_i}$ is only incident with $k-1$ edges of $F$ and at least one of these $k-1$ edge has no endpoint in $Z_{h^*_d,v_i}$.
Thus, the entire neighborhood of $Z_{h^*_d,v_i}$ must be covered by $F$ because all vertices in $Z_{h^*_d,v_i}$ have the same neighborhood.
Hence, we can delete every edge in $F$ that has one endpoint in $Z'_{h^*_d,v_i}$ and add a maximum matching of the complete bipartite graph $G'[Z'_{h^*_d,v_i} \cup T_{h^*_d,i}]$ to $F$. This maximum matching has size $|Z'_{h^*_d,v_i}|=|T_{h^*_d,i}|$ and covers all vertices in $Z'_{h^*_d,v_i} \cup T_{h^*_d,i}$. The resulting edge set, which we denote by $\widetilde{F}$ is still an edge dominating set of size $|F|$ in $G'$ because the only vertices that are not covered anymore are contained in $Z_{h^*_d,v_i}$, but all neighbors are still covered: The vertices in $Z'_{h^*_d,v_i}$ are only adjacent to the vertices in $Z_{h^*_d,v_i}$ and $T_{h^*_d,i}$, and the vertices in $Z_{h^*_d,v_i}$ are adjacent to vertices in $Z'_{h^*_d,v_i}$ and $Y_{h^*_d}$. Thus, the only edges that we replace and that are incident with $Z_{h^*_d,v_i}$ or a neighbor of $Z_{h^*_d,v_i}$ are incident with $Z'_{h^*_d,v_i}$ and these vertices are still covered by $\widetilde{F}$. It holds that the edge dominating set $\widetilde{F}$ covers all vertices in $Z'_{h^*_d,v_i}$ and no vertex in $Z_{h^*_d,v_i}$.
Now, consider a vertex $v \in V_i \setminus \{v_i\}$. Every vertex in $Z'_{h^*_d,v}$ is only adjacent to the vertices in $T_{h^*_d,i} \cup Z_{h^*_d,v}$. Since every vertex in $T_{h^*_d,i}$ is covered by $\widetilde{F}$, we can replace the edges in $\widetilde{F}$ that are incident with a vertex in $Z_{h^*_d,v}$.
Recall that that either the set vertex $Z'_{h^*_d,v}$ or the vertex set $Z_{h^*_d,v}$ is entirely covered by $\widetilde{F}$, and that $Z'_{h^*_d,v} \cup Z_{h^*_d,v}$ is only incident with $|Z'_{h^*_d,v}|=|Z_{h^*_d,v}|=k-1$ edges of $\widetilde{F}$.
If $\widetilde{F}$ covers all vertices in $Z'_{h^*_d,v}$ then we replace every edge $e=\{z,z'\} \in F$ with $z' \in Z'_{h^*_d,v}$ and $z \in Z_{h^*_d,v}$ by an edge in $E(z,Y_{h^*_d})$.
Otherwise, if $\widetilde{F}$ covers all vertices in $Z_{h^*_d,v}$ then we delete the $|Z'_{h^*_d,v}|=|Z_{h^*_d,v}|=k-1$ edges in $F$ that are incident with a vertex in $Z'_{h^*_d,v} \cup Z_{h^*_d,v}$ and add for each vertex $z$ in $Z_{h^*_d,v}$ exactly one edge in $E(z,Y_{h^*_d})$ to $\widetilde{F}$. We denote the resulting set by $F'$.
Note that in both cases the set $Z_{h^*_d,v}$ is not covered by $F'$ and the set $Z'_{h^*_d,v}$ is covered by $F'$.
Clearly, $F'$ has the same size as $\widetilde{F}$ (by construction) and hence as $F$. The fact that $F'$ is still an edge dominating set holds because the only vertices that are possibly covered by $\widetilde{F}$ and not by $F'$ are contained in $Z'_{h^*_d,v}$, but all neighbors of $Z'_{h^*_d,v}$ are still contained in $V(F')$.
We can do this for all $i \in [k]$ and all $v \in V_i \setminus \{v_i\}$ independently; this proves the claim.
\end{claimproof}
Let $F$ be the edge dominating set that we construct during the proof of Claim \ref{claim::clique_gadget}.
Now, for each $i \in [k]$ there exists exactly one vertex $v$ in $V_i$ such that no vertex in $Z_{h^*_d,v}$ is incident with an edge in $F$; denote this vertex by $x_i$.
Let $X=\{x_1,x_2,\ldots,x_k\}$. We will show that $X$ is a clique in $G_{h^*}$.
Every vertex in the set $Z_{h^*_d,x_i}$, with $i \in [k]$, is adjacent to all vertices in $Z'_{h^*_d,x_i}$ and to all vertices in $\{ y_{h^*_d}^{\{x_i,v\}} \in Y_{h^*_d} \mid v \in V \setminus V_i \}$; thus both sets must be covered by $F$. The second set contains $(k-1) \cdot n$ vertices, one vertex for every vertex in $V \setminus V_i$. All vertices $y_{h_d}^{\{x_i,x_j\}}$, with $ j \in [k]$ and $j \neq i$, can only be covered by edges in $F$ that have one endpoint in a copy of $H$ because these vertices are only adjacent to copies of $H$, and adjacent to the set $Z_{h^*_d,x_i} \cup Z_{h^*_d,x_j}$, which is not incident with an edge in $F$.
Let $Y=\{y_{h^*_d}^{\{x_i,x_j\}} \in Y_{h^*_d} \mid 1\leq i < j\leq k\}$ be the set of vertices in $Y_{h^*_d}$ that must be covered by $F$ via edges that have one endpoint in a copy of $H$. This set has size $\binom{k}{2}$.
Recall that $F_h^e$ is the set of edges in $F$ that are incident with a vertex in $H_h^e$. The sets $F_h^e$ are pairwise disjoint because no two copies of $H$ are adjacent. Let $B_h^e(F) = \{ b \in B_h^e \mid \exists f \in F \colon b \in f \text{ and } f \nsubseteq V(H_h^e)\}$ be the set of vertices in $B_h^e$ that are an endpoint of an edge $f$ in $F$ whose other endpoint is not a vertex in a copy of $H$; thus, by construction, this other endpoint is contained in a set $X_{i,j}$ or a set $Y_j$, with $i \in [d-1]$ and $j \in [s]$. Note that $B_h^e(F_{h^*}) \subseteq B_h^e(F)$ because $B_h^e(F_{h^*})$ contains all edges that have one endpoint in $H_h^e$ (or more precisely $B_h^e$) and the other endpoint in a set $X_{i,h^*_i}$ ,with $i \in [d-1]$, whereas, $B_h^e(F_h)$ contains all edges that have one endpoint in $H_h^e$ (or more precisely $B_h^e$) and the other endpoint in $X'$.
As before, the edge set $F_h^e$, with $h \in [s]^d$ and $e \in E(G_h)$, has at least the size of a minimum edge dominating set in $H_h^e - B_h^e(F)$ plus the size of $B_h^e(F)$ because $F_h^e$ contains the $|B_h^e(F)|$ edges between the vertices in $B_h^e(F)$ and a vertex that is not in $V(H_h^e)$, and because $F_h^e$ must also dominate all remaining edges in $H_h^e - B_h^e(F)$; thus,
\begin{align}
\sum_{h \in [s]^d} \sum_{ e \in E(G_h)} |F_h^e| &\geq \sum_{h \in [s]^d} \sum_{ e \in E(G_h)} \left( \MEDS(H_h^e-B_h^e(F)) + |B_h^e(F)| \right) \nonumber \\
&= \sum_{h \in [s]^d} \sum_{ e \in E(G_h)} \left( \MEDS(H) + \mathrm{cost}(B_h^e(F)) \right). \label{align::F_h^e}
\end{align}
Since every edge in a set $F_h^e$, for $h \in [s]^d$ and $e \in E(G_h)$, is incident with a vertex in $H_h^e$ (and therefore neither incident with a vertex in $Z_j \cup Z_j'$, for $j \in [s]$, nor incident with a vertex in a selection gadget) we know that
\[
\sum_{h \in [s]^d} \sum_{ e \in E(G_h)} |F_h^e| \leq \sum_{h \in [s]^d} |E(G_h)| \cdot \MEDS(H) + \binom{k}{2} \cdot \mathrm{cost}(B).
\]
It follows from Claim \ref{claim::extra_budget} together with inequality (\ref{align::bound_F_h^e}) that
\[
\sum_{h \in [s]^d} \sum_{ e \in E(G_h)} |F_h^e| \geq \sum_{h \in [s]^d} |E(G_h)| \cdot \MEDS(H) + \binom{k}{2} \cdot \mathrm{cost}(B).
\]
Combining the two last inequalities we obtain that
\begin{align*}
\sum_{h \in [s]^d} \sum_{ e \in E(G_h)} |F_h^e| = \sum_{h \in [s]^d} |E(G_h)| \cdot \MEDS(H) + \binom{k}{2} \cdot \mathrm{cost}(B). \label{align::equality}
\end{align*}
Summarized, this implies:
\begin{align*}
&\sum_{h \in [s]^d} |E(G_h)| \cdot \MEDS(H) + \binom{k}{2} \cdot \mathrm{cost}(B) \\
&\qquad\overset{(\ref{align::equality})}{=}\sum_{h \in [s]^d} \sum_{ e \in E(G_h)} |F_h^e| \\
&\qquad \overset{(\ref{align::F_h^e})}{\geq} \sum_{h \in [s]^d} \sum_{ e \in E(G_h)} \left( \MEDS(H) + \mathrm{cost}(B_h^e(F)) \right) \\
&\qquad=\sum_{h \in [s]^d} |E(G_h)| \cdot \MEDS(H) + \sum_{h \in [s]^d} \sum_{ e \in E(G_h)} \mathrm{cost}(B_h^e(F)) \\
&\qquad \geq \sum_{h \in [s]^d} |E(G_h)| \cdot \MEDS(H) + \sum_{h \in [s]^d} \sum_{ e \in E(G_h)} \mathrm{cost}(B_h^e(F_{h^*})) \\
&\quad \overset{Claim \ref{claim::extra_budget}}{=}\sum_{h \in [s]^d} |E(G_h)| \cdot \MEDS(H) + \binom{k}{2} \cdot \mathrm{cost}(B)
\end{align*}
The last inequality holds because $B_h^e(F_{h^*}) \subseteq B_h^e(F)$, which implies that $\mathrm{cost}(B_h^e(F_{h^*})) \leq \mathrm{cost}(B_h^e(F))$ (Proposition \ref{proposition::properties} (\ref{proposition::monoton})). It follows that all terms are equal and, hence,
\[
\sum_{1 \leq p<q \leq k} \sum_{h \in [s]^d} \sum_{e \in E(G_h) \cap E(V_p,V_q)} \mathrm{cost}(B_h^e(F)) = \sum_{h \in [s]^d} \sum_{ e \in E(G_h)} \mathrm{cost}(B_h^e(F_{h^*})) = \binom{k}{2} \cdot \mathrm{cost}(B).
\]
This implies that either for all $1 \leq p < q \leq k$ it holds that
\[
\sum_{h \in [s]^d} \sum_{e \in E(G_h) \cap E(V_p,V_q)} \mathrm{cost}(B_h^e(F)) = \mathrm{cost}(B),
\]
or that there exist $1 \leq \bar{p} < \bar{q} \leq k$ such that
\[
\sum_{h \in [s]^d} \sum_{e \in E(G_h) \cap E(V_{\bar{p}},V_{\bar{q}})} \mathrm{cost}(B_h^e(F)) < \mathrm{cost}(B).
\]
We will show that for all $1 \leq p < q \leq k$ it holds that
\begin{align}\label{align::equality}
\sum_{h \in [s]^d} \sum_{e \in E(G_h) \cap E(V_p,V_q)} \mathrm{cost}(B_h^e(F)) = \mathrm{cost}(B),
\end{align}
and that $B_h^e(F)=B_h^e$ if and only if $h = h^*$ and $e$ has both endpoints in $X=\{x_1,x_2,\ldots,x_k\}$.
First, as in the proof of Theorem \ref{theorem::LB} we will show that we always have equality, hence that (\ref{align::equality}) holds.
Let $1 \leq \bar{p} < \bar{q} \leq k$.
We showed in the proof of Claim \ref{claim::extra_budget} that
$B':=\bigcup_{h \in [s]^d} \bigcup_{e \in E(G_h) \cap E(V_{\bar{p}},V_{\bar{q}})} B_h^e(F_{h^*})$ contains at least one copy of every vertex in $B \setminus\{b_d\}$.
Thus, $B'':=\bigcup_{h \in [s]^d} \bigcup_{e \in E(G_h) \cap E(V_{\bar{p}},V_{\bar{q}})} B_h^e(F)$ contains at least one copy of every vertex in $B \setminus\{b_d\}$, because $B_h^e(F_{h^*}) \subseteq B_h^e(F)$.
Furthermore, $B''$ also contains a copy of $b_d$, because vertex $y_{h^*_d}^{\{x_{\bar{p}},x_{\bar{q}}\}}$ must be covered by an edge $f$ in $F$ that has its other endpoint in a copy of $H$. By construction, the vertices in a copy of $H$ that are adjacent to vertex $y_{h^*_d}^{\{x_{\bar{p}},x_{\bar{q}}\}}$ are the vertices $b_{h,d}^{\{x_{\bar{p}},x_{\bar{q}}\}}$ with $h\in [s]^d$ s.t.\ $h_d=h^*_d$, and $\{x_{\bar{p}},x_{\bar{q}}\} \in E(G_{h}) \cap E(V_{\bar{p}},V_{\bar{q}})$; this implies that $B''$ contains a copy of $b_d$.
Now, let $B_1,B_2,\ldots, B_l$ be the subsets of $B$ that correspond to nonempty sets in $\{B_h^e(F) \mid h \in [s]^d, e \in E(G_h) \cap E(V_{\bar{p}},V_{\bar{q}})\}$. Note that every set $B_i$ is either a proper subset of $B$ or $l=1$: If there exists a set, say w.l.o.g. $B_1$, such that $B_1=B$ then $\mathrm{cost}(B_1)=\mathrm{cost}(B)$. Since no vertex in $B$ is extendable (Proposition \ref{proposition::properties} (\ref{proposition::disjointQ})) it holds that $\mathrm{cost}(B_i) \geq 1$ for all $i \in [l]$. Now, if $l > 1$ and $B_1=B$ then $\sum_{i=1}^l \mathrm{cost}(B_i) \geq \mathrm{cost}(B) + (l-1) > \mathrm{cost}(B)$, which contradicts the assumption. Thus, we have either $l=1$ and $B_1=B$ (since $B_1$ covers $B$) or that the sets $B_1,B_2,\ldots,B_l \subsetneq B$ cover $B$. Since $B$ is strongly beneficial, and the sets $B_1,B_2,\ldots,B_l$ cover $B$, it must hold that $\sum_{i=1}^l \mathrm{cost}(B_i) > \mathrm{cost}(B)$ or that $l=1$. Therefore, $\sum_{i=1}^l \mathrm{cost}(B_i) > \mathrm{cost}(B)$ if $l > 1$ and $\sum_{i=1}^l \mathrm{cost}(B_i) = \mathrm{cost}(B)$ if $l=1$, but, this must hold for all $1 \leq p < p \leq k$. Hence, we must always have the latter case where $l=1$, and there exist no $1 \leq \bar{p} < \bar{q} \leq k$ such that $\sum_{h \in [s]^d} \sum_{e \in E(G_h) \cap E(V_{\bar{p}},V_{\bar{q}})} \mathrm{cost}(B_h^e(F)) < \mathrm{cost}(B)$.
Thus, it holds for all $1 \leq p < q \leq k$ that there exists an index $\hat{h} \in [s]^d$ and an edge $\hat{e} \in E(G_{\hat{h}}) \cap E(V_p,V_q)$ such that $B_{\hat{h}}^{\hat{e}}(F)=B_{\hat{h}}^{\hat{e}}$; such a set exists, because $B''$ contains at least one copy of each vertex in $B$ and $l=1$. Furthermore, all other sets $B_h^e(F)$, with $h \in [s]^d$, $e \in E(G_h) \cap E(V_p,V_q)$, and $h \neq \hat{h}$ or $e \neq \hat{e}$, are empty since $l=1$.
We will show that $\hat{h}=h^*$ and that $\hat{e} = \{x_p,x_q\}$:
Consider vertex $x_{i,h^*_i}^{p,q}$, with $i \in [d-1]$, which is contained in $X_{i,h^*_i}$. This vertex must be covered by an edge $f$ in $F$ and the other endpoint of this edge $f$ must be contained in $\{b_{h,i}^e \mid h \in [s]^d, h_i=h^*_i, e \in E(G_h) \cap E(V_{p},V_{q})\}$ (see proof of Claim \ref{claim::extra_budget}).
This vertex must also be contained in $B_{\hat{h}}^{\hat{e}}$ because all other sets $B_h^e(F)$ with $e \in E(V_p,V_q)$ are empty; thus $\hat{h}_i = h^*_i$. This holds for all $i \in [d-1]$ which implies that $(\hat{h}_1,\hat{h}_2,\ldots,\hat{h}_{d-1}) = (h_1,h_2,\ldots,h_{d-1})$.
Furthermore, vertex $y_{h^*_d}^{\{x_{p},x_{q}\}}$ must be covered by an edge $f$ in $F$ whose other endpoint is contained in $\{b_{h,d}^{\{x_{p},x_{q}\}} \mid h \in [s]^d, h_d=h^*_d, \{x_{p},x_{q}\} \in E(G_h) \cap E(V_{p},V_{q})\}$. For the same reasons, this vertex must be contained in $B_{\hat{h}}^{\hat{e}}$. The only vertex in $\{b_{h,d}^{\{x_{p},x_{q}\}} \mid h \in [s]^d, h_d=h^*_d, \{x_{p},x_{q}\} \in E(G_h) \cap E(V_{p},V_{q})\}$ that is also contained in $B_{\hat{h}}^{\hat{e}}$ is vertex $b_{h^*,d}^{\{x_{p},x_{q}\}}$. Thus, $\hat{h}_d=h^*_d$, $\hat{e}=\{x_{p},x_{q}\}$, and $\{y_{h^*_d}^{\{x_{p},x_{q}\}}, b_{h^*,d}^{\{x_{p},x_{q}\}}\}$ is an edge in $G'$. Summarized, we showed that $B_h^e(F)=B_h^e$ if and only if $h=h^*$ and $e \in E(X,X)$, and that all other sets $B_h^e(F)$ are empty.
We will show that the vertex set $X=\{x_1,x_2,\ldots,x_k\}$ is a clique in $G_{h^*}$. Recall that the vertex $x_i$ is contained in $V_i$, thus every vertex of $X$ is contained in a different color class. Consider two vertices $x_p$, $x_q$ with $1 \leq p < q \leq k$. We have to show that $\{x_p,x_q\}$ is an edge in $E(G_{h^*})$. Since vertex $y_{h^*_d}^{\{x_p,x_q\}}$ is adjacent to vertex $b_{h^*,d}^{\{x_p,x_q\}}$ it holds that $\{x_p,x_q\}$ is an edge in $G_{h^*}$, which proves that $X$ is a clique in $G_{h^*}$.
\end{proof}
Concluding the section, we observe a simple quadratic lower bound for the size of kernels for \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to \ensuremath{\mathcal{H}}\xspace-component graphs that holds for all sets $\ensuremath{\mathcal{H}}\xspace$.
\begin{lemma}\label{lemma::quadraticlowerbound}
The \prob{Edge Dominating Set}\xspace problem has no kernelization to size $\mathcal{O}(n^{2-\varepsilon})$ where $n$ is the number of vertices, for any $\varepsilon>0$, unless \ensuremath{\mathsf{NP\subseteq coNP/poly}}\xspace. Therefore, for any set $\ensuremath{\mathcal{H}}\xspace$ of (connected) graphs, the \prob{Edge Dominating Set}\xspace problem parameterized by the size of a modulator to $\ensuremath{\mathcal{H}}\xspace$-component graphs admits no kernelization to size $\mathcal{O}(|X|^{2-\varepsilon})$, for any $\varepsilon>0$, unless \ensuremath{\mathsf{NP\subseteq coNP/poly}}\xspace.
\end{lemma}
\begin{proof}
It is known that \prob{Vertex Cover}\xspace admits no kernelization to size $\mathcal{O}(n^{2-\varepsilon})$, for any $\varepsilon>0$, unless \ensuremath{\mathsf{NP\subseteq coNP/poly}}\xspace~\cite{DellM14}. By a straightforward reduction to an EDS instance $(G',k)$ with $n'=\mathcal{O}(n)$ vertices the same is true for EDS. This in turn yields an equivalent instance $(G',k,X')$ with a trivial modulator $X'=V(G')$ such that $G'-X'$ is the empty graph; since this is a feasible instance for the \prob{Edge Dominating Set}\xspace problem parameterized by the size of a modulator to $\ensuremath{\mathcal{H}}\xspace$-component graphs for all sets $\ensuremath{\mathcal{H}}\xspace$ and since $|X'|=n'=\mathcal{O}(n)$, the lemma follows.
The lower bound of $\mathcal{O}(n^{2-\varepsilon})$ for EDS is not surprising (and may well be known), as the same is known for a number of similar graph problems (like \prob{Vertex Cover}\xspace). Thus, we only sketch a simple reduction (which surely has been rediscovered several times already).
Let $(G,k)$ be an instance of \prob{Vertex Cover}\xspace with $G=(V,E)$ and, w.l.o.g., $k\leq |V|$. Construct a graph $G'$, starting from a copy of $G$ by adding $2k$ vertices $u_1,\ldots,u_k,u'_1,\ldots,u'_k$ and adding the edges $\{u_1,u'_1\},\ldots,\{u_k,u'_k\}$. Finally, make each vertex $u_i$ adjacent to all vertices in the copy of $V$ in $G'$. Return the instance $(G',k)$. Clearly, $G'$ has $n+2k=\mathcal{O}(n)$ vertices and the construction can be done in polynomial time.
It is easy to see that $(G,k)$ is yes for \prob{Vertex Cover}\xspace if and only if $(G',k)$ is yes for \prob{Edge Dominating Set}\xspace: If $(G,k)$ is yes for VC then we can pick a vertex cover $S=\{v_1,\ldots,v_k\}$ of size exactly $k$. Clearly, $F=\{\{v_1,u_1\},\ldots,\{v_k,u_k\}\}$ is an edge dominating set of size $k$ for $G'$; all additional edges in comparison to $G$ have an endpoint in $\{u_1,\ldots,u_k\}$. For the converse, assume that $(G',k)$ is yes and let $F$ be an edge dominating set of size $k$. Let $S$ contain all vertices of $V$ in $G'$ that are endpoints of $F$. Observe that, because $F$ needs to contain at least one vertex per edge $\{u_1,u'_1\},\ldots,\{u_k,u'_k\}$, which are disjoint from $V$, and because it has at most $2k$ endpoints, the set $S$ has size at most $k$. Clearly, the set $S$ alone covers all edges of $G'[V]\cong G$, so $(G,k)$ is yes for \prob{Vertex Cover}\xspace. This completes the proof.
\end{proof}
\section{EDS parameterized above half a maximum matching} \label{section::aboveLB}
A natural lower bound for the size of a minimum edge dominating set is $\frac{1}{2} MM$, where $MM$ denotes the size of a maximum matching.
We show that \prob{Edge Dominating Set}\xspace is \ensuremath{\mathsf{NP}}\xspace-hard even for the special case where the input graph has a perfect matching and we need to determine whether there is an edge dominating set of at most half the size of that matching.
This implies that \prob{Edge Dominating Set}\xspace parameterized by $l=k-\frac{1}{2} MM$, where $k$ is the solution size, is para-\ensuremath{\mathsf{NP}}\xspace-hard.
\begin{theorem} \label{theorem::MM}
\prob{Edge Dominating Set}\xspace parameterized by $k-\frac{1}{2} MM$ is para-\ensuremath{\mathsf{NP}}\xspace-hard.
\end{theorem}
\begin{proof}
To prove the theorem we show that it is \ensuremath{\mathsf{NP}}\xspace-hard to decide whether a given graph that has a perfect matching has an edge dominating set of size equal to half the size of this matching.
We will show that this problem is \ensuremath{\mathsf{NP}}\xspace-hard by giving a reduction from 3-$\mathrm{SAT}$\xspace (which is known to be \ensuremath{\mathsf{NP}}\xspace-complete \cite{Cook71}). Let $(X,\mathcal{C})$ be an instance of 3-$\mathrm{SAT}$\xspace with $n$ variables and $m$ clauses. We construct a graph $G$ as follows:
\begin{figure}[t]
\centering
\begin{minipage}[t]{0.35\textwidth}
\centering
\begin{tikzpicture}[scale=0.75]
\node[fill, circle, inner sep = 2pt] (x) at (0cm, 0cm) [label=left:$x$] {};
\node[fill, circle, inner sep = 2pt] (nx) at (1cm,0cm) [label=right:$\bar{x}$] {};
\node[fill, circle, inner sep = 2pt] (c) at (0.5cm,1cm) [label=above:$c$] {};
\node[fill, circle, inner sep = 2pt] (d) at (1.5cm,1cm) [label=right:$d$] {};
%
\draw[decorate,decoration={snake,amplitude=.4mm,segment length=1mm}] (x) -- (nx);
\draw (x) -- (c);
\draw (c) -- (nx);
\draw[decorate,decoration={snake,amplitude=.4mm,segment length=1mm}] (c) -- (d);
\end{tikzpicture}
\subcaption{Gadget for a variable $x \in X$}
\label{figure::variable_gadget}
\end{minipage}
\hspace{3em}
\begin{minipage}[t]{0.45\textwidth}
\centering
\begin{tikzpicture}[scale=0.75]
\node[fill, circle, inner sep = 2pt] (a1) at (0cm, 0cm) [label=below:$a_1$] {};
\node[fill, circle, inner sep = 2pt] (a2) at (1cm,0cm) [label=below:$a_2$] {};
\node[fill, circle, inner sep = 2pt] (a3) at (0.5cm,1cm) [label=right:$a_3$] {};
\node[fill, circle, inner sep = 2pt] (b1) at (-1cm,0cm) [label=left:$b_1$] {};
\node[fill, circle, inner sep = 2pt] (b2) at (2cm,0cm) [label=right:$b_2$] {};
\node[fill, circle, inner sep = 2pt] (b3) at (0.5cm,2cm) [label=right:$b_3$] {};
\node[fill, circle, inner sep = 2pt] (t) at (0.5cm,3cm) [label=above:$t$] {};
\node[fill, circle, inner sep = 2pt] (s) at (1.5cm,3cm) [label=right:$s$] {};
%
\draw (a1) -- (a2);
\draw (a1) -- (a3);
\draw (a2) -- (a3);
\draw[decorate,decoration={snake,amplitude=.4mm,segment length=1mm}] (a1) -- (b1);
\draw[decorate,decoration={snake,amplitude=.4mm,segment length=1mm}] (a2) -- (b2);
\draw[decorate,decoration={snake,amplitude=.4mm,segment length=1mm}] (a3) -- (b3);
\draw (b1) to [bend left] (t);
\draw (b2) to [bend right] (t);
\draw (b3) -- (t);
\draw[decorate,decoration={snake,amplitude=.4mm,segment length=1mm}] (s) -- (t);
\end{tikzpicture}
\subcaption{Gadget for a clause $C=\{ \lambda_1,\lambda_2,\lambda_3\} \in \mathcal{C}$}
\label{figure::clause_gadget}
\end{minipage}
\caption{The wavy edges are the edges that are contained in the perfect matching $M$.}
\label{figure::gadgets}
\end{figure}
For each variable $x \in X$ we construct a variable gadget (see Figure \ref{figure::variable_gadget}) consisting of four vertices $x$, $\bar{x}$, $c$, $d$, where the vertices $x$, $\bar{x}$, $c$ form a clique and the vertex $d$ is only adjacent to vertex $c$. (Here $x$ and $\bar{x}$ are the literals of variable $x$.) For every clause $C=\{ \lambda_1,\lambda_2,\lambda_3\} \in \mathcal{C}$ we construct a clause gadget (see Figure \ref{figure::clause_gadget}) consisting of eight vertices $a_1$, $a_2$, $a_3$, $b_1$, $b_2$, $b_3$, $s$, and $t$. The vertices $a_1$, $a_2$, and $a_3$ form a clique, each vertex $a_i$, with $i=1,2,3$, is also adjacent to $b_i$, and vertex $t$ is adjacent to $b_1$, $b_2$, $b_3$, and $s$. For every clause $C=\{ \lambda_1,\lambda_2,\lambda_3\} \in \mathcal{C}$ we make vertex $\lambda_i$ (which is contained in a variable gadget) for $i \in \{1,2,3\}$ adjacent to vertex $a_i$ in the clause gadget $C$.
It is easy to verify that $G$ has a perfect matching, e.g. the edges $\{x, \bar{x}\}$, $\{c,d\}$ in every variable gadget together with the edges $\{a_i, b_i\}$ for $i=1,2,3$, and the edge $\{s,t\}$ in every clause gadget are a perfect matching in $G$. (In Figure \ref{figure::gadgets} the matching edges are the wavy edges.) We denote this maximum matching by $M$. Note that the matching $M$ has size $2n+4m$; two edges in every variable gadget and four edges in every clause gadget.
We will show that $G$ has an edge dominating set of size $n+2m$ if and only if the 3-$\mathrm{SAT}$\xspace instance has a satisfying assignment. There cannot be an edge dominating set of smaller size, because every edge dominating set has at least half the size of any (maximum) matching.
Suppose first that the 3-$\mathrm{SAT}$\xspace instance $(X,\mathcal{C})$ has a satisfying assignment $s \colon X \rightarrow \{\mathrm{true}, \mathrm{false}\}$. We construct an edge dominating set $F$ of $G$ by selecting edge $\{x,c\}$ in the variable gadget for $x \in X$ to $F$ if $x$ is set to true and by selecting edge $\{\bar{x},c\}$ in the variable gadget $x \in X$ to $F$ if $x$ is set to false. For every clause $C=\{\lambda_1, \lambda_2, \lambda_3\}$ we choose one true literal, w.l.o.g.\ say $\lambda_1$ is true and we add the edges $\{t,b_1\}$ and $\{a_2,a_3\}$ to $F$. The set $F$ has exactly $n+2m$. We have to show that $F$ is an edge dominating set.
Assume for contradiction that there exists an edge $e$ in $G$ that is not dominated by $F$. By construction of $F$, this edge cannot be in a clause or a variable gadget. Hence, this edge must have one endpoint in a clause gadget and one endpoint in a variable gadget. Let $C=\{\lambda_1, \lambda_2,\lambda_2\}$ be the clause that corresponds to the clause gadget that contains one endpoint of $e$. By construction of $G$ and $F$, the endpoint of $e$ is exactly the vertex $a_i$ that is not contained in $V(F)$. This implies that literal $\lambda_i$ is true. Since $\lambda_i$ is the only neighbor of $a_i$ outside the clause gadget, $\lambda_i$ is the other endpoint of $e$. But $\lambda_i$ is contained in $V(F)$ (by construction), hence $e$ is dominated.
Now, suppose $G$ has an edge dominating set $F$ of size $n+2m$. Since the matching $M$ has twice the size of the edge dominating set $F$, it must hold that every edge in $F$ dominates two matching edges and different edges in $F$ dominate different matching edges; otherwise there would be an edge that is not dominated by $F$. The matching edge $\{c,d\}$ in a variable gadget for variable $x \in X$ has as neighbors only the vertices $x$ and $\bar{x}$, therefore either edge $\{c,x\}$ or edge $\{c,\bar{x}\}$ is contained in the edge dominating set $F$.
To satisfy the instance $(X,\mathcal{C})$ of 3-$\mathrm{SAT}$\xspace let $x$ be set to $\mathrm{true}$ if $\{x,c\} \in F$ and $x$ be set to $\mathrm{false}$ if $\{\bar{x},c\} \in F$. Exactly one of these edges is contained in $F$ (see above). To show that this is a satisfying assignment consider an arbitrary clause $C=\{\lambda_1, \lambda_2, \lambda_3\} \in \mathcal{C}$ and the clause gadget for clause $C$.
The matching edge $\{s,t\}$ in the clause gadget for clause $C$ has as neighbors only the vertices $b_1$, $b_2$, and $b_3$, hence exactly one of the edges $\{t,b_1\}$, $\{t,b_2\}$, $\{t,b_3\}$ is contained in $F$. Assume w.l.o.g.\ that $\{t,b_1\} \in F$, which dominates the matching edge $\{a_1,b_1\}$. Thus, no other edge of $F$ can also dominate this edge $\{a_1,b_1\}$ and, hence, $a_1\notin V(F)$. Now, however, the edge $\{a_1,\lambda_1\}$ is only dominated by $F$ if $\lambda_1\in V(F)$, which holds only if $\{c,\lambda_1\}$ is contained in $F$. By construction of our assignment in the previous paragraph, this implies that $\lambda_1$ is $\mathrm{true}$ and that clause $C$ is satisfied.
This completes the proof.
\end{proof}
The graph we construct in the proof of Theorem \ref{theorem::MM} is also a K\H{o}nig graph, i.e., it has minimum vertex cover size equal to maximum matching size. This implies that \prob{Edge Dominating Set}\xspace for K\H{o}nig graphs is also \ensuremath{\mathsf{NP}}\xspace-hard (even if $k=\frac12MM$).
\section{Proof of Proposition~\ref{proposition::properties}} \label{section::proposition}
Let $H=(V,E)$ be a connected graph, let $W=W(H)$ be the set of free vertices, let $Q=Q(H)$ be the set of extendable vertices, and let $U=U(H)$ be the set of uncovered vertices.
\begin{lemma}[Proposition \ref{proposition::properties} (\ref{proposition::free})]
The set $W$ is well defined
\end{lemma}
\begin{proof}
To show that the maximum free set is unique, we show that the union of two free sets is free. This implies that $W$ is the union of all free sets in $H$. Let $Y_1, Y_2 \subseteq Q$ be free sets in $H$, and let $Y= Y_1 \cup Y_2$. Since $Y_1$ and $Y_2$ are free, it hold that for all $y \in Y$ and for all minimum edge dominating set $F$ in $H$ there exists a minimum edge dominating set $F'$ in $H-y$ (of size $|F|-1$) with either $V(F) \subseteq V(F') \setminus Y_1 \subseteq V(F') \setminus Y$ (if $y \in Y_1$) or $V(F) \subseteq V(F') \setminus Y_2 \subseteq V(F') \setminus Y$ (if $y \in Y_2$); thus $Y$ is free.
\end{proof}
\begin{lemma}[Proposition \ref{proposition::properties} (\ref{proposition::neighborhood})]
The set $U$ is an independent set and no vertex in $Q$ is adjacent to a vertex in $U$; hence $N_H(U) \cap (Q \cap U) = \emptyset$.
\end{lemma}
\begin{proof}
If there was an edge $\{u,u'\}$ with $u,u'\in U$ then no feasible edge dominating set could avoid being incident with either vertex. If $u\in U$ had a neighbor $q\in Q$ then $\MEDS(H-q)+1=\MEDS(H)$ but then combining a minimum solution for $H-q$ and adding edge $\{u,q\}$ would be a minimum solution for $H$ and be incident with $u$; a contradiction.
\end{proof}
\begin{lemma}[Proposition \ref{proposition::properties} (\ref{proposition::N(U)})]
If $v \in N_H(U)$ is a vertex that is adjacent to a vertex in $U$, then $v$ is contained in every minimum edge dominating set of $H$
\end{lemma}
\begin{proof}
Vertices in $U$ are never endpoints of edges in minimum solutions. Thus, to dominate the incident edges all their neighbors must be endpoints of solution edges.
\end{proof}
\begin{lemma}[Proposition \ref{proposition::properties} (\ref{proposition::vertex})]
It holds for all vertices $v \in V$ that $\MEDS(H)-1 \leq \MEDS(H-v) \leq \MEDS(H)$.
\end{lemma}
\begin{proof}
Let $F_v$ be an edge dominating set of $H-v$ and let $u \in V$ such that $\{u,v\} \in E$. Clearly, $F_v \cup \{\{u,v\}\}$ is an edge dominating set of $H$; hence $\MEDS(H) - 1 \leq |F_v| = \MEDS(H-v)$. Now, let $F$ be a minimum edge dominating set of $H$. If $v$ is not incident with an edge in $F$ then $F$ is also an edge dominating set in $H$; hence $\MEDS(H-v) \leq |F| = \MEDS(H)$. If $v$ is incident with an edge $f=\{v,u\}$ in $F$ then replace $f$ either by an edge in $\delta_H(v) \setminus \{f\}$ or delete $f$ when $\delta_H(v) \setminus \{f\}$ is empty; hence $\MEDS(H-v) \leq |F| = \MEDS(H)$.
\end{proof}
\begin{lemma}[Proposition \ref{proposition::properties} (\ref{proposition::monoton})]
Let $Y \subseteq V$. It holds for all subsets $X \subseteq Y$ that $\MEDS(H-X) - |Y \setminus X| \leq\MEDS(H-Y) \leq \MEDS(H-X)$, and that $\mathrm{cost}(X) \leq \mathrm{cost}(Y)$.
\end{lemma}
\begin{proof}
It follows from (\ref{proposition::vertex}) that $\MEDS(H-X) -|Y \setminus X| \leq \MEDS(H-Y) \leq \MEDS(H-X)$: Let $Y=\{y_1,y_2,\ldots, y_p\}$ and let $X=\{y_1,y_2,\ldots,y_q\}$ with $q \leq p$. It holds that $\MEDS(H-Y) \leq \MEDS(H-(Y \setminus \{y_p\})) \leq \MEDS(H-(Y \setminus \{y_{p-1},y_p\})) \leq \ldots \leq \MEDS(H-X)$. Furthermore, $\MEDS(H-Y) \geq \MEDS(H-(Y \setminus \{y_p\})) - 1 \geq \MEDS(H-(Y \setminus \{y_{p-1},y_p\})) - 2 \geq \ldots \geq \MEDS(H-X) - |Y \setminus X|$. Now, $\mathrm{cost}(Y) = \MEDS(H-Y) + |Y| - \MEDS(H) \geq \MEDS(H-X) - |Y \setminus X| + |Y| - \MEDS(H) = \MEDS(H-X) + |X| - \MEDS(H)= \mathrm{cost}(X)$.
\end{proof}
\begin{lemma}[Proposition \ref{proposition::properties} (\ref{proposition::N(W)IN})]
Let $F$ be a minimum edge dominating set in $H$. There exists a minimum edge dominating set $F'$ in $H$ with $(V(F) \cup N_H(W) ) \setminus W \subseteq V(F')$.
\end{lemma}
\begin{proof}
Let $F$ be an arbitrary minimum edge dominating set in $H$, and let $F'$ be a minimum edge dominating set in $H$ with $V(F) \setminus W \subseteq V(F')$ and $|V(F') \cap N_H(W)|$ maximal (under the minimum edge dominating sets that fulfill $V(F) \setminus W \subseteq V(F')$). Assume for contradiction that $V(F') \cap N_H(W) \neq N_H(W)$. Let $v \in N_H(W) \setminus V(F')$ be a vertex in the neighborhood of $W$ that is not incident with an edge in $F'$, and let $w \in N_H(v) \cap W$ be a free vertex that is adjacent to $v$. Since vertex $w$ is free, there exists a minimum edge dominating set $\widetilde{F}$ in $H-w$ (of size $|F'|-1$) with $V(F') \setminus W \subseteq V(\widetilde{F})$. Now, we can add the edge $\{v,w\}$ to the minimum edge dominating set $\widetilde{F}$ to obtain a minimum edge dominating set $\hat{F} = \widetilde{F} \cup \{\{v,w\}\}$ of $H$. It holds that $V(F) \setminus W \subseteq V(F') \setminus W \subseteq V(\widetilde{F}) \setminus W \subseteq V(\hat{F}) \setminus W$. Furthermore, the set $V(F') \cap N_H(W)$ is a proper subset of $V(\hat{F}) \cap N_H(W)$, because $V(\hat{F})$ contains all vertices in $V(F') \setminus W$ and the vertex $v \notin W$ that is not contained in $V(F')$. This contradicts the choice of $F'$ and proves the statement.
\end{proof}
\begin{lemma}[Proposition \ref{proposition::properties} (\ref{proposition::Q-W})]
Every set that consists of one vertex $v \in Q \setminus W$ is strongly beneficial. Furthermore, these are the only beneficial sets of size one.
\end{lemma}
\begin{proof}
Let $v \in Q \setminus W$ be a vertex that is extendable and not free, and let $B=\{v\}$. We show that $B$ is strongly beneficial. Since $\MEDS(H-v)+1 = \MEDS(H)$, and since for every set $\widetilde{B} \subsetneq B$ it holds that $\MEDS(H-\widetilde{B})=\MEDS(H)$ it holds that $B$ is beneficial. ($\widetilde{B}=\emptyset$ is the only proper subset of $B$.) Assume for contradiction that $B$ is not strongly beneficial. This would imply that there exists a cover $B_1, B_2, \ldots, B_h \subsetneq B$, but the only proper subset of $B=\{v\}$ is the empty set. Thus, $B$ is strongly beneficial.
Assume there exists a beneficial set $B=\{v\}$ with $v \notin Q \setminus W$. Note that beneficial sets are disjoint from $W$ (definition), thus $v \in V \setminus Q$. Since $B$ is beneficial it holds that $\MEDS(H-B) < \MEDS(H)$. Together with Proposition~\ref{proposition::properties}~(\ref{proposition::vertex}) it follows that $\MEDS(H-B)=\MEDS(H)-1$; thus $v \in Q$ which is a contradiction.
\end{proof}
\begin{lemma}[Proposition \ref{proposition::properties} (\ref{proposition::disjointQ})]
If $B$ is a strongly beneficial set of size at least two then $B$ contains no extendable vertex; hence $B \cap Q=\emptyset$.
\end{lemma}
\begin{proof}
If there would exists a vertex $v \in B$ that is extendable, but not free, then $\mathrm{cost}(\{v\})=\MEDS(H-v) + |\{v\}| - \MEDS(H)=0$. Furthermore, it follows from Proposition~\ref{proposition::properties}~(\ref{proposition::monoton}) that $\mathrm{cost}(B\setminus \{v\}) \leq \mathrm{cost}(B)$. Now, $\{v\}, B \setminus \{v\} \subsetneq B$ is a cover of $B$ and it holds that $\mathrm{cost}(\{v\}) + \mathrm{cost}(B \setminus \{v\}) \leq 0 + \mathrm{cost}(B) = \mathrm{cost}(B)$. This implies that $B$ is not strongly beneficial which is a contradiction.
\end{proof}
\begin{lemma}[Proposition \ref{proposition::properties} (\ref{proposition::BFS})]
If there exists a set $Y \subseteq V \setminus W$ with $\MEDS(H-Y) < \MEDS(H)$, then there exists a beneficial set $B \subseteq Y$ with $\MEDS(H-B) = \MEDS(H-Y)$.
\end{lemma}
\begin{proof}
If $Y$ is beneficial then $B=Y$ is a beneficial set with $\MEDS(H-Y)=\MEDS(H-B)$. Thus, assume that $Y$ is not beneficial. Hence, there exists a set $Y' \subsetneq Y$ with $\MEDS(H-Y)\geq \MEDS(H-Y')$ (definition of beneficial). Pick $B \subsetneq Y$ minimal with $\MEDS(H-B)\leq \MEDS(H-Y)$. This implies that $B$ is beneficial: Otherwise there would exists a set $Y' \subsetneq B$ with $\MEDS(H-Y')\leq\MEDS(H-B)$ which contradicts the choice of $B$.
\end{proof}
\begin{lemma}[Proposition \ref{proposition::properties} (\ref{proposition::BFScost1})]
If there exists a set $Y \subseteq V \setminus W$ with $\MEDS(H-Y) < \MEDS(H)$, then there exists a beneficial set $B \subseteq Y$ with $\MEDS(H-B) +1 = \MEDS(H)$. Furthermore, $B$ is strongly beneficial.
\end{lemma}
\begin{proof}
Let $B \subseteq Y$ be minimal such that $\MEDS(H- B) < \MEDS(H)$. Thus, for every $Z \subsetneq B$ it holds $\MEDS(H-Z)=\MEDS(H)$. First, we proof that $B$ is beneficial. If $B$ is not beneficial, then there exists a set $\widetilde{B} \subsetneq B$ such that $\MEDS(H-B) \geq \MEDS(H-\widetilde{B})$. This contradicts the choice of $B$, because $\widetilde{B} \subsetneq B$ and $\MEDS(H-\widetilde{B}) < \MEDS(H)$; hence $B$ is beneficial.
Next, we show that $\MEDS(H-B)+1=\MEDS(H)$. Let $b \in B$ and $B'=B \setminus \{b\}$. It holds that $\MEDS(H-B')=\MEDS(H)$ (choice of $B$). It follows from Proposition~\ref{proposition::properties}~(\ref{proposition::vertex}) that $\MEDS(H) -1 = \MEDS(H-B') -1 \leq \MEDS(H-B' -b) = \MEDS(H-B) \leq \MEDS(H-B') = \MEDS(H)$. Since $\MEDS(H-B) < \MEDS(H)$ it follows that $\MEDS(H-B)+1 = \MEDS(H)$.
Finally, we show that $B$ is strongly beneficial. If $B$ has size one, then $B=\{v\}$ with $v \in Q \setminus W$, and it follows that $B$ is strongly beneficial Proposition~\ref{proposition::properties}~(\ref{proposition::Q-W}).
Now, assume for contradiction that $B$ is not strongly beneficial. Hence, there exists a cover $B_1,B_2,\ldots,B_h \subsetneq B$ of $B$ with $\mathrm{cost}(B) \geq \sum_{i=1}^h \mathrm{cost}(B_i)$.
It holds that $\mathrm{cost}(B)=\MEDS(H-B)+|B|-\MEDS(H)=|B|-1$ (because $\MEDS(H-B)+1=\MEDS(H)$), and it always holds that $\mathrm{cost}(B_i) \leq |B_i|$ (definition of $\mathrm{cost}$). This implies that there exists at least one $i^* \in [h]$ with $\mathrm{cost}(B_{i^*})<|B_{i^*}|$: otherwise
\[
|B|-1 = \mathrm{cost}(B) \geq \sum_{i=1}^h \mathrm{cost}(B_i) = \sum_{i=1}^h |B_i| \geq |B|.
\]
Now, $|B|-\mathrm{cost}(B) = 1 \leq |B_{i^*}| - \mathrm{cost}(B_{i^*})$. This is a contradiction to $B$ beneficial, because $B_{i^*} \subsetneq B$ is a proper subset of $B$ and it holds that $|B|-\mathrm{cost}(B) \leq |B_{i^*}| - \mathrm{cost}(B_{i^*})$. Thus, $B$ is strongly beneficial.
\end{proof}
\begin{lemma}[Proposition \ref{proposition::properties} (\ref{proposition::strongly})]
If $H$ has a beneficial set $B$, then $H$ has also a strongly beneficial set $B' \subseteq B$.
\end{lemma}
\begin{proof}
This follows from Proposition~\ref{proposition::properties}~(\ref{proposition::BFScost1}).
\end{proof}
\begin{lemma}[Proposition \ref{proposition::properties} (\ref{proposition::BFSedge})]
Let $F$ be a minimum edge dominating set in $H$. If $e=\{x,y\}$ is an edge in $F$ with $x, y \notin Q$, then $\{x,y\}$ is a strongly beneficial set.
\end{lemma}
\begin{proof}
Let $F$ be a minimum edge dominating set in $H$ and let $\{x,y\}$ be an edge in $F$ with $x,y \notin Q$. First, we show that $B=\{x,y\}$ is beneficial.
It holds that $\MEDS(H-B) < \MEDS(H)$, because $F'=F \setminus \{\{x,y\}\}$ is an edge dominating set in $H-B$: $F'$ covers all edges that are not incident with $x$ and $y$, and these vertices are not contained in $H-B$.
It follows from Proposition~\ref{proposition::properties}~(\ref{proposition::BFScost1}) that there exists a strongly beneficial set $B' \subseteq B$ with $\MEDS(H-B')+1=\MEDS(H)$. The sets $\emptyset$, $\{x\}$ and $\{y\}$ are not beneficial, because the empty set is not beneficial, and neither $x$ nor $y$ is extendable; hence $\MEDS(H-x)=\MEDS(H-y)=\MEDS(H)$. Note that the only beneficial sets of size consists of one vertex in $Q \setminus W$ (Proposition~\ref{proposition::properties}~(\ref{proposition::Q-W})). Thus, $B$ must be strongly beneficial.
\end{proof}
\begin{lemma}[Proposition \ref{proposition::properties} (\ref{proposition::definition})]
Let $B$ be a beneficial set. $B$ is strongly beneficial if and only if for every non-trivial partition $B_1,B_2,\ldots,B_h$ of $B$ it holds that $\mathrm{cost}(B) < \sum_{i=1}^h \mathrm{cost}(B_i)$.
\end{lemma}
\begin{proof}
$(\Rightarrow:)$ This follows directly from the definition of strongly beneficial set, because every non-trivial partition $B_1,B_2, \ldots, B_h$ of $B$ is also a cover of $B$ with $B_1,B_2,\ldots, B_h \subsetneq B$.
$(\Leftarrow:)$ Assume that $B$ is not strongly beneficial. Thus, there exists a cover $B_1, B_2, \ldots, B_h \subsetneq B$ of $B$ with $\mathrm{cost}(B) \geq \sum_{i=1}^h \mathrm{cost}(B_i)$. We construct a non-trivial partition of $B$ as follows: Let $B_1'=B_1$ and let $B_i' = B_i \setminus \left(\bigcup_{j=1}^{i-1} B_j \right)$ for all $2 \leq i \leq h$. It holds that no set $B_i'$ is the set $B$ because $B_i' \subseteq B_i \subsetneq B$. Furthermore, the union of all sets $B_i'$, with $i \in [h]$, is still $B$, and the intersection of two sets $B_i$ and $B_j$ with $i \neq j$ is empty (by construction). Thus, all nonempty set $B_i'$ are a non-trivial partition of $B$. Additionally, it follows from Proposition~\ref{proposition::properties}~(\ref{proposition::monoton}) that $\mathrm{cost}(B_i') \leq \mathrm{cost}(B_i)$ which implies that $\mathrm{cost}(B) \geq \sum_{i=1}^h \mathrm{cost}(B_i) \geq \sum_{i=1}^h \mathrm{cost}(B_i')$. Hence, there exists a non-trivial partition $B_1'', B_2'', \ldots, B_q''$ of $B$ with $\mathrm{cost}(B) \geq \sum_{i=1}^q \mathrm{cost}(B_i'')$. This concludes the proof.
\end{proof}
\begin{lemma}[Proposition \ref{proposition::properties} (\ref{proposition::decomposeB})]
Let $Y \subseteq V \setminus W$. There exists a partition $B_1,B_2,\ldots,B_h$ of $Y$ where $B_i$ is either strongly beneficial or where $B_i$ has $\mathrm{cost}(B_i)=|B_i|$, for all $i \in [h]$, such that $\mathrm{cost}(Y) \geq \sum_{i=1}^h \mathrm{cost}(B_i)$. (Note that we also allow trivial partitions.)
\end{lemma}
\begin{proof}
Assume that the statement does not hold and let $Y \subseteq V \setminus W$ be a minimal set that does not fulfill the properties of the lemma. Hence, $Y$ is neither strongly beneficial nor has $\mathrm{cost}(Y)=|Y|$, because in both cases the trivial partition $Y$ would fulfill the properties of the lemma.
First, assume that $Y$ is not beneficial. Thus, there exists a set $Y' \subsetneq Y$ beneficial with $\MEDS(H-Y)= \MEDS(H-Y')$ Proposition~\ref{proposition::properties}~(\ref{proposition::BFS}).
Since $Y' \subsetneq Y$ is a proper subset of $Y$ and $Y$ is a minimal set that does not fulfill the properties of the lemma, there exists a partition $B_1', B_2'\ldots, B_p'$ of $Y'$ where $B_i'$ is either strongly beneficial or has $\mathrm{cost}(B_i')=|B_i|$ for all $i \in [p]$ such that $\mathrm{cost}(Y') \geq \sum_{i=1}^p \mathrm{cost}(B_i')$. Furthermore, the set $Y'' = Y \setminus Y'$ is a proper subset of $Y$, because $Y'$ is not the empty set (if $Y'$ is the empty set then $Y'$ is not beneficial). Thus, there exists a partition $B_1'', B_2'', \ldots, B_q''$ of $Y''$ where $B_i''$ is either strongly beneficial or has $\mathrm{cost}(B_i'')=|B_i''|$ for all $i \in [q]$ such that $\mathrm{cost}(Y'') \geq \sum_{i=1}^q \mathrm{cost}(B_i'')$.
Now, $B_1=B_1',B_2=B_2',\ldots, B_p=B_p', B_{p+1}=B_1'',B_{p+2}=B_2'',\ldots,B_{p+q}=B_q''$ is a partition of $Y$, because $B_1', B_2'\ldots, B_p'$ is a partition of $Y'$, $B_1'', B_2'', \ldots, B_q''$ is a partition of $Y''$, and $Y', Y''$ is a partition of $Y$. Additionally, every set $B_i$, with $i \in [p+q]$, is either strongly beneficial or has $\mathrm{cost}(B_i)=|B_i|$ (by choice of $B_i$). To show that $Y$ also fulfills the properties of the lemma it remains to show that $\mathrm{cost}(Y) \geq \sum_{i=1}^{p+q} \mathrm{cost}(B_i)$. It holds that
\begin{align*}
\mathrm{cost}(Y) &=\MEDS(H-Y) +|Y|-\MEDS(H) \\
&= \MEDS(H-Y') + |Y'| + |Y''| - \MEDS(H) &\text{// bc. choice of } Y' \text{ and } Y=Y' \dot\cup Y''\\
&\geq \mathrm{cost}(Y') + \mathrm{cost}(Y'') &\text{// bc. definition of cost} \\
&\geq \sum_{i=1}^p \mathrm{cost}(B_i') + \sum_{i=1}^q \mathrm{cost}(B_i'') = \sum_{i=1}^{p+q} \mathrm{cost}(B_i)
\end{align*}
This implies that $Y$ fulfills the properties of the lemma, which is a contradiction.
Thus, assume that $Y$ is beneficial (but not strongly beneficial). Hence, there exists a non-trivial partition $B_1, B_2,\ldots, B_h$ of $Y$ with $\mathrm{cost}(Y) \geq \sum_{i=1}^h \mathrm{cost}(B_i)$ Proposition~\ref{proposition::properties}~(\ref{proposition::definition}). Every $B_i$, with $i \in [h]$, is a proper subset of $Y$, because $B_1, B_2, \ldots, B_h$ is a non-trivial partition of $Y$. Since $Y$ is a minimal set that does not fulfill the properties of the lemma, there exists, for all $i \in [h]$, a partition $B_{i,1}, B_{i,2},\ldots, B_{i,p_i}$ of $B_i$ where $B_{i,j}$ is either strongly beneficial or has $\mathrm{cost}(B_{i,j})=|B_{i,j}|$, for all $j \in [p_i]$, such that $\mathrm{cost}(B_i) \geq \sum_{j=1}^{p_i} \mathrm{cost}(B_{i,j})$. By construction, the sets $B_{1,1}, B_{1,2},\ldots, B_{1,p_1}, B_{2,1},\ldots, B_{h,p_h}$ are a partition of $Y$ where every $B_{i,j}$ is either strongly beneficial or has $\mathrm{cost}(B_{i,j})=|B_{i,j}|$, for all $i \in [h]$ and all $j \in [p_i]$. Furthermore, $\mathrm{cost}(Y) \geq \sum_{i=1}^h \mathrm{cost}(B_i) \geq \sum_{i=1}^h \sum_{j=1}^{p_i} \mathrm{cost}(B_{i,j})$. Thus, the set $Y$ fulfills the properties of the lemma, which is a contradiction and concludes the proof.
\end{proof}
\section{Conclusion}\label{section::conclusion}
As our main result, we have given a complete classification for \prob{Edge Dominating Set}\xspace parameterized by the size of a modulator to \ensuremath{\mathcal{H}}\xspace-component graphs for all finite sets \ensuremath{\mathcal{H}}\xspace. An obvious follow-up question is to extend this result to infinite sets \ensuremath{\mathcal{H}}\xspace. Our lower bounds of course continue to work in this setting, and the upper bounds still permit us to reduce the number of connected components (under the same conditions as before, e.g., that relevant beneficial sets have bounded size). However, for infinite \ensuremath{\mathcal{H}}\xspace, polynomial kernels also require us to shrink connected components of $G-X$, and to derive general rules for this. Moreover, even determining beneficial sets etc.\ for graphs $H\in\ensuremath{\mathcal{H}}\xspace$ could no longer be dismissed as being constant time. It is conceivable that such a classification is doable whenever graphs in $\ensuremath{\mathcal{H}}\xspace$ have bounded treewidth, as this simplifies the required additional steps. Since most known tractable graph classes for \prob{Edge Dominating Set}\xspace have bounded treewidth (and tractability for $G-X$ is required, or else \ensuremath{\mathsf{NP}}\xspace-hardness for $|X|=0$ rules out kernels and fixed-parameter tractability), this seems like a reasonable goal.
Apart from this, it would be nice to close the gap between size $\mathcal{O}(|X|^{d+1}\log |X|)$ and the lower bound of $\mathcal{O}(|X|^{d-\varepsilon})$, where improvements to the upper bound seem more likely.
| {'timestamp': '2019-01-14T02:16:14', 'yymm': '1901', 'arxiv_id': '1901.03582', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03582'} | arxiv |
\section{Introduction}
The estimation of accurate biomarker signatures in Alzheimer's disease (AD) and related neurodegenerative diseases is crucial for understanding underlying disease mechanisms, predicting subjects' progressions, and enrichment in clinical trials. Recently, data-driven disease progression models were proposed to reconstruct long term biomarker signatures from collections of short term individual measurements \cite{oxtoby2018,jedynak2012computational}. When applied to large datasets of typical AD, disease progression models have shown important benefits in understanding the earliest events in the AD cascade \cite{oxtoby2018}, quantifying biomarkers' heterogeneity \cite{young2018uncovering} and they showed improved predictions over standard approaches \cite{oxtoby2018}. However, by necessity these models require large datasets -- in addition they should be both multimodal and longitudinal. Such data is not always available in rare neurodegenerative diseases. In particular, most datasets for rare neurodegenerative diseases come from local clinical centres, are unimodal (e.g. MRI only) and limited both cross-sectionally and longitudinally -- this makes the application of disease progression models extremely difficult. Moreover, such a model estimated from common diseases such as typical AD may not generalise to specific variants. For example, in Posterior Cortical Atrophy (PCA) -- a neurodegenerative syndrome causing visual disruption -- posterior regions such as the occipital lobe are affected early, instead of the hippocampus and temporal regions in typical AD.
The problem of limited data in medical imaging has so far been addressed through transfer learning methods. These were successfully used to improve the accuracy of AD diagnosis \cite{hon2017towards} or prediction of MCI conversion \cite{cheng2015domain}, but have two key limitations. First, they use deep learning or other machine learning methods, which are not easily interpretable and don't allow us to understand underlying disease mechanisms that are either specific to rare diseases, or shared across related diseases. Secondly, these models cannot be used to forecast the future evolution of subjects at risk of disease, which is important for selecting the right subjects in clinical trials.
We propose Disease Knowledge Transfer (DKT), a generative model that estimates continuous multimodal biomarker progressions for multiple diseases simultaneously -- including rare neurodegenerative diseases -- and which inherently performs transfer learning between the modelled phenotypes. This is achieved by exploiting biomarker relationships that are shared across diseases, whilst accounting for differences in the spatial distribution of brain pathology. DKT is interpretable, which allows us to understand underlying disease mechanisms, and can also predict the future evolution of subjects at risk of diseases. We apply DKT on Alzheimer's variants and demonstrate its ability to predict non-MRI trajectories for patients with Posterior Cortical Atrophy, in lack of such data. This is done by fitting DKT to two datasets simultaneously: (1) the TADPOLE Challenge \cite{marinescu2018tadpole} dataset containing subjects from the Alzheimer's Disease Neuroimaging Initiative (ADNI) with MRI, FDG-PET, DTI, AV45 and AV1451 scans and (2) MRI scans from patients with Posterior Cortical Atrophy from the Dementia Research Centre (DRC), UK. We finally validate DKT on three datasets: 1) simulated data with known ground truth, 2) TADPOLE sub-populations with different progressions and 3) 20 DTI scans from controls and PCA patients from our clinical center.
\begin{figure}[h]
\centering
\includegraphics[width=0.9\textwidth,trim=0 0 0 0,clip]{figures/disease_knowledge_transfer_symbols.pdf}
\caption{Diagram of the proposed DKT framework. We assume that each disease can be modelled as the evolution of abstract dysfunction scores (Y-axis, top row), each one related to different brain regions. Each region-specific dysfunction score then further models (X-axis, bottom row) the progression of several multimodal biomarkers within that same region. For instance, the temporal dysfunction, modelled as a biomarker in the disease specific model (top row), is the X-axis in the disease agnostic model (temporal unit, bottom row), which aggregates together abnormality from amyloid, tau and MR imaging within the temporal lobe. The biomarker relationships within the bottom units are assumed to be disease agnostic and shared across all diseases modelled. Knowledge transfer between the two diseases can then be achieved via the disease-agnostic units. Mathematical notation from section \ref{sec:method} is shown in red to ease understanding.}
\label{fig:diagram}
\end{figure}
\section{Method}
\label{sec:method}
\newcommand{\lambda_{d_i}^{\psi(k)}}{\lambda_{d_i}^{\psi(k)}}
\newcommand{\lambda_{d_i}^{\psi(k),(u)}}{\lambda_{d_i}^{\psi(k),(u)}}
\newcommand{\lambda_{d_i}^{\psi(k),(u-1)}}{\lambda_{d_i}^{\psi(k),(u-1)}}
Fig. \ref{fig:diagram} shows the diagram of the DKT framework. We assume that the progression of each disease can be modelled as a unique evolution of dysfunction trajectories representing region-specific multimodal pathology, further modelled as the progression of several biomarkers within that same region, but acquired using different modalities (Fig. \ref{fig:diagram} bottom). Each group of biomarkers in the bottom row will be called a \emph{disease-agnostic unit} or simply \emph{agnostic unit}, because biomarker dynamics here are assumed to be shared across all diseases modelled.
The assumption that the dynamics of some biomarkers are disease-agnostic (i.e. shared across diseases), is key to DKT. We can make this assumption for two reasons. First, pathology in many related neurodegenerative diseases (e.g. Alzheimer's variants) is hypothesised to share the same underlying mechanisms (e.g. amyloid and tau accumulation), and within one region, such mechanisms lead to similar pathology dynamics across all the disease variants modelled \cite{jack2010hypothetical}, with the key difference that distinct brain regions are affected at different times and with different pathology rates and extent, likely caused by selective vulnerability of networks within these regions \cite{seeley2009neurodegenerative}. Secondly, even if the diseases share different upstream mechanisms (e.g. amyloid vs tau accumulation), downstream biomarkers measuring hypometabolism, white matter degradation and atrophy are likely to follow the same pathological cascade and will have similar dynamics.
We now model the biomarker dynamics that are specific to each disease, by mapping the subjects' disease stages to dysfunction scores. We assume that each subject $i$ at each visit $j$ has an underlying disease stage $s_{ij} = \beta_{i} + m_{ij}$, where $m_{ij}$ represents the months since baseline visit for subject $i$ at visit $j$ and $\beta_{i}$ represents the time shift of subject $i$. We then assume that each subject $i$ at visit $j$ has a dysfunction score $\gamma_{ij}^l$ corresponding to multimodal pathology in brain region $l$, which is a function of its disease stage:
\begin{equation}
\label{eqDysfunctionScoreDef}
\gamma_{ij}^l = f(\beta_{i} + m_{ij}; \lambda_{d_i}^l)
\end{equation}
where $f$ is a smooth monotonic function mapping each disease stage to a dysfunction score, having parameters $\lambda_{d_i}^l$ corresponding to agnostic unit $l \in \Lambda$, where $\Lambda$ is the set of all agnostic units. Moreover, $d_i \in \mathbb{D}$ represents the index of the disease corresponding to subject $i$, where $\mathbb{D}$ is the set of all diseases modelled. For example, MCI and tAD subjects from ADNI as well as tAD subjects from the DRC cohort can all be assigned $d_i=1$, while PCA subjects can be assigned $d_i=2$. We implement $f$ as a parametric sigmoidal curve similar to \cite{jedynak2012computational}, to enable a robust optimisation and because this accounts for floor and ceiling effects present in AD biomarkers -- the monotonicity of this sigmoidal family is also very appropriate for many neurodegenerative diseases due to irreversability.
We further model the biomarker dynamics that are disease-agnostic, by constructing the mapping from the dysfunction scores $\gamma_{ij}^l$ to the biomarker measurements. We assume a set of given biomarker measurements $Y = [y_{ijk} | (i,j,k) \in \Omega]$ for subject $i$ at visit $j$ in biomarker $k$, where $\Omega$ is the set of available biomarker measurements. We further denote by $\theta_k$ the trajectory parameters for biomarker $k \in K$ within its agnostic unit $\psi(k)$, where $\psi$: \{1, ..., K\} $ \rightarrow \Lambda$ maps each biomarker $k$ to a unique agnostic unit $l \in \Lambda$. These definitions allow us to formulate the likelihood for a single measurement $y_{ijk}$ as follows:
\begin{equation}
p(y_{ijk}|\theta_k, \lambda_{d_i}^{\psi(k)}, \beta_{i}, \epsilon_k) = N(y_{ijk}| g( \gamma_{ij}^{\psi(k)} ; \theta_k), \epsilon_k)
\end{equation}
where $g(\ .\ ; \theta_k)$ represents the trajectory of biomarker $k$ within agnostic unit $\psi(k)$, with parameters $\theta_k$, and is again implemented using a sigmoidal function for reasons outlined above. Parameters $\lambda_{d_i}^{\psi(k)}$ are used to define $\gamma_{ij}^{\psi(k)}$ based on Eq. \ref{eqDysfunctionScoreDef}, where agnostic unit $l$ is now referred to as $\psi(k)$, to clarify this is the unit where biomarker $k$ has been allocated. Variable $\epsilon_k$ denotes the variance of measurements for biomarker $k$.
We extend the above model to multiple subjects, visits and biomarkers to get the full model likelihood:
\begin{equation}
\label{eq:dktFinal}
p(\boldsymbol{y}|\theta, \lambda, \beta , \epsilon) = \\ \prod_{(i,j,k) \in \Omega} p(y_{ijk}|\theta_k, \lambda_{d_i}^{\psi(k)}, \beta_{i})
\end{equation}
where $\boldsymbol{y} = [y_{ijk} | \forall (i,j,k) \in \Omega ]$ is the vector of all biomarker measurements, while $\boldsymbol{\theta} = [\theta_1, ..., \theta_K]$ represents the stacked parameters for the trajectories of biomarkers in agnostic units, $\boldsymbol{\lambda} = [\lambda_d^{l}|l \in \Lambda, d \in \mathbb{D}]$ are the parameters of the dysfunction trajectories within the disease models, $\boldsymbol{\beta} =[\beta_1, ..., \beta_N]$ are the subject-specific time shifts and $\boldsymbol{\epsilon} = [\epsilon_k | k \in K]$ estimates measurement noise.
We estimate the model parameters $[\boldsymbol{\theta}, \boldsymbol{\lambda}, \boldsymbol{\beta}, \boldsymbol{\epsilon}]$ using loopy belief propagation -- see algorithm in supplementary material. One key advantage of DKT is that the subject's time shift $\beta_{i}$ can be estimated using only a subset (e.g. MRI) of the subject's data -- the model can then infer the missing modalities (e.g. non-MRI) using Eq. \ref{eq:dktFinal}.
\subsection{Generating Synthetic Data}
\label{sec:dktMetSyn}
We first test DKT on synthetic data, to assess its performance against known ground truth. More precisely, we generate data that follows the DKT model exactly, and test DKT's ability to recover biomarker trajectories and subject time-shifts. We generate synthetic data from two diseases (50 subjects with "\emph{synthetic PCA}" and 100 subjects with "\emph{synthetic AD}") using the parameters from the bottom-left table in Fig. \ref{fig:dktSynthTrajCompTrue}, emulating the TADPOLE and DRC cohorts -- see supplementary material for full details. The six biomarkers ($k_1$-$k_6$) have been \emph{a-priori} allocated to two agnostic units $l_0$ and $l_1$. To simulate the lack of multimodal data in the synthetic PCA subjects, we discarded the data from biomarkers $k_0$, $k_1$, $k_4$ and $k_5$ for all these subjects.
\subsection{Data Acquisition and Preprocessing}
We trained DKT on ADNI data from the TADPOLE challenge \cite{marinescu2018tadpole}, since it contained a large number of multimodal biomarkers already pre-processed and aggregated into one table. From the TADPOLE dataset we selected a subset of 230 subjects which had an MRI scan and at least one FDG PET, AV45, AV1451 or DTI scan. In order to model another disease, we further included MRI scans from 76 PCA subjects from the DRC cohort, along with scans from 67 tAD and 87 age-matched controls.
For both datasets, we computed multimodal biomarker measurements corresponding to each brain lobe: MRI volumes using the Freesurfer software, FDG-, AV45- and AV1451-PET standardised uptake value ratios (SUVR) extracted with the standard ADNI pipeline, and DTI fractional anisotropy (FA) measures from adjacent white-matter regions. For every lobe, we regressed out the following covariates: age, gender, total intracranial volume (TIV) and dataset (ADNI vs DRC). Finally, biomarkers were normalized to the [0,1] range.
\section{Results on Synthetic and Patient Datasets}
\label{sec:dktRes}
Results on synthetic data in the presence of ground truth (Fig. \ref{fig:dktSynthTrajCompTrue}) suggest that DKT can robustly estimate the trajectory parameters (MAE $<$ 0.058) as well as the subject-specific time-shifts ($R^2$ $>$ 0.98). While some errors in trajectory estimation can be noticed, these are due to the informed priors on the model parameters in order to ensure identifiability and convergence of parameters.
\begin{figure}[htp]
\includegraphics[width=0.8\textwidth]{figures/compTrueParams105_synth1_JMD.pdf}
\begin{flushright}
\vspace{-16.0em}
\fontsize{5}{8.0}\selectfont
\begin{tabular}{c}
Biomarker allocation:\\
$l_0:\{k_0, k_2, k_4\}$ \\
$l_1: \{k_1, k_3, k_5\}$ \\
\hline
Agnostic unit $l_0$:\\
$\theta_0 = (1,5,0.20,0)$\\
$\theta_2 = (1,5,0.55,0)$\\
$\theta_4 = (1,5,0.90,0)$ \\
\hline
Agnostic unit $l_1$:\\
$\theta_1 = (1,10,0.20,0)$\\
$\theta_3 = (1,10,0.55,0)$\\
$\theta_5 = (1,10,0.90,0)$ \\
\hline
Synthetic AD:\\
$\lambda_0^0 = (1, 0.3, -4, 0)$\\
$\lambda_0^1 = (1, 0.2,\ \ 6, 0)$ \\
\hline
Synthetic PCA:\\
$\lambda_1^0 = (1, 0.3,\ \ 6, 0)$\\
$\lambda_1^1 = (1, 0.2, -4, 0)$\\
\end{tabular}
\end{flushright}
\vspace{-1em}
\caption[DKT Simulation Results - Comparison between true and DKT-estimated biomarker trajectories and subject time-shifts.]{Comparison between true and DKT-estimated subject time-shifts and biomarker trajectories. (top-left/top-middle) Scatter plots of the true shifts (y-axis) against estimated shifts (x-axis), for the 'synthetic AD' and 'synthetic PCA' diseases. We then show the DKT-estimated and true trajectories of the agnostic units within the 'synthetic AD' disease (top-right, "Dis0") and the 'synthetic PCA' disease (bottom-left, "Dis1"). Finally, we also show the biomarker trajectories within unit 0 (bottom-center) and unit 1 (bottom-right). Parameters used for generating the trajectory shapes are shown in the table on the right.}
\label{fig:dktSynthTrajCompTrue}
\end{figure}
We then apply DKT to real patient data, with the aim of transferring multimodal biomarker trajectories from tAD to PCA. The inferred PCA trajectories, shown in Fig. \ref{fig:PCAtrajByModality}, recapitulate known patterns in PCA \cite{crutch2012posterior}, where posterior regions such as occipital and parietal lobes are predominantly affected in later stages. As opposed to typical AD, we find that the hippocampus is affected later on, further suggesting the model did not transfer too much tAD specific information. Here, we demonstrate the possibility of inferring plausible non-MRI biomarkers in a rare neurodegenerative disease, in lack of such data for these subjects. As far as we are aware, this is the first time a continuous signature of non-MRI biomarkers is estimated for PCA, due to its rarity and lack of data.
\begin{figure}[htp]
\centering
\includegraphics[width=0.8\textwidth, trim=0 20 0 0, clip]{figures/trajDisSpaceOverlap_PCA_tad-drcTinyPen5_JMD.png}
\caption{Estimated trajectories for the PCA cohort. The only data that were available were the MRI volumetric data. The dynamics of the other biomarkers has been inferred by the model using data from typical AD, and taking into account the different spatial distribution of pathology in PCA vs tAD. }
\label{fig:PCAtrajByModality}
\end{figure}
\subsection{Validation on DTI Data in tAD and PCA}
\label{sec:dktResVal}
We further validated DKT by predicting unseen DTI data from two patient datasets: 1) TADPOLE subjects with a different progression from the training subjects, and 2) a separate test set of 20 DTI scans from controls and PCA patients from the DRC -- full demographics are given in the supplementary material. To split TADPOLE into subgroups with different progression, we used the SuStaIn model by \cite{young2018uncovering}, which resulted into three subgroups: hippocampal, cortical and subcortical, with prominent early atrophy in the hippocampus, cortical and subcortical regions respectively. To evaluate prediction accuracy, we computed the rank correlation between the DKT-predicted biomarker values and the measured values in the test data. We compute the rank correlation instead of mean squared error as it is not susceptible to systemic biases of the models when predicting "unseen data" in a certain disease.
Validation results are shown in Table \ref{sec:dktPerfMetrics}, for hippocampal to cortical TADPOLE subgroups (other pairs of subgroups not shown due to lack of space) as well as PCA subjects. When predicting missing DTI markers of the TADPOLE cortical subgroup as well as PCA subjects from the DRC cohort (Table \ref{sec:dktPerfMetrics}), the DKT correlations are generally high for the cingulate, hippocampus and parietal, and lower for the frontal lobe. DKT also shows favourable performance compared to four other models: the latent-stage model from \cite{jedynak2012computational}, a multivariate Gaussian Process model with RBF kernel that predicts a DTI ROI marker from multiple MRI markers, as well as cubic spline and linear models that predict a regional DTI biomarker directly from its corresponding MRI marker. In particular for predicting DTI FA in the parietal and temporal lobes, DKT has significantly better predictions that almost all methods tested.
\newcommand{c}{c}
\begin{table}
\centering
\fontsize{7}{10}\selectfont
\begin{tabular}{c | c c c c c c}
\textbf{Model} & \textbf{Cingulate} & \textbf{Frontal} & \textbf{Hippocam.} & \textbf{Occipital} & \textbf{Parietal} & \textbf{Temporal}\\
& \multicolumn{6}{c}{\textbf{TADPOLE: Hippocampal subgroup to Cortical subgroup}}\\
DKT (ours) & 0.56 $\pm$ 0.23 & \textbf{0.35 $\pm$ 0.17} & \textbf{0.58 $\pm$ 0.14} & -0.10 $\pm$ 0.29 & \textbf{0.71 $\pm$ 0.11} & \textbf{0.34 $\pm$ 0.26} \\
Latent stage & 0.44 $\pm$ 0.25 & 0.34 $\pm$ 0.21 & 0.34 $\pm$ 0.24* & \textbf{-0.07 $\pm$ 0.22} & 0.64 $\pm$ 0.16 & 0.08 $\pm$ 0.24* \\
Multivariate & \textbf{0.60 $\pm$ 0.18} & 0.11 $\pm$ 0.22* & 0.12 $\pm$ 0.29* & -0.22 $\pm$ 0.22 & -0.44 $\pm$ 0.14* & -0.32 $\pm$ 0.29* \\
Spline & -0.24 $\pm$ 0.25* & -0.06 $\pm$ 0.27* & 0.58 $\pm$ 0.17 & -0.16 $\pm$ 0.27 & 0.23 $\pm$ 0.25* & 0.10 $\pm$ 0.25* \\
Linear & -0.24 $\pm$ 0.25* & 0.20 $\pm$ 0.25* & 0.58 $\pm$ 0.17 & -0.16 $\pm$ 0.27 & 0.23 $\pm$ 0.25* & 0.13 $\pm$ 0.23* \\
& \multicolumn{6}{c}{\textbf{typical Alzheimer's to Posterior Cortical Atrophy}}\\
DKT (ours) & 0.77 $\pm$ 0.11 & 0.39 $\pm$ 0.26 & 0.75 $\pm$ 0.09 & 0.60 $\pm$ 0.14 & \textbf{0.55 $\pm$ 0.24} & \textbf{0.35 $\pm$ 0.22} \\
Latent stage & \textbf{0.80 $\pm$ 0.09} & \textbf{0.53 $\pm$ 0.17} & \textbf{0.80 $\pm$ 0.12} & 0.56 $\pm$ 0.18 & 0.50 $\pm$ 0.21 & 0.32 $\pm$ 0.24 \\
Multivariate & 0.73 $\pm$ 0.09 & 0.45 $\pm$ 0.22 & 0.71 $\pm$ 0.08 & -0.28 $\pm$ 0.21* & 0.53 $\pm$ 0.22 & 0.25 $\pm$ 0.23* \\
Spline & 0.52 $\pm$ 0.20* & -0.03 $\pm$ 0.35* & 0.66 $\pm$ 0.11* & 0.09 $\pm$ 0.25* & 0.53 $\pm$ 0.20 & 0.30 $\pm$ 0.21* \\
Linear & 0.52 $\pm$ 0.20* & 0.34 $\pm$ 0.27 & 0.66 $\pm$ 0.11* & \textbf{0.64 $\pm$ 0.17} & 0.54 $\pm$ 0.22 & 0.30 $\pm$ 0.21* \\
\end{tabular}
\vspace{0.5em}
\caption[Performance evaluation of DKT and other models]{Performance evaluation of DKT and four other statistical models of decreasing complexity. We show the rank correlation between predicted biomarkers and measured biomarkers in (top) TADPOLE subgroups and (bottom) PCA. (*) Statistically significant difference in the performance of DKT vs the other models, based on a two-tailed t-test, Bonferroni corrected.}
\label{sec:dktPerfMetrics}
\end{table}
\section{Discussion}
\label{sec:dktDis}
In this work we made initial steps at the challenging problem of transfer learning between different neurodegenerative diseases. Our proposed DKT method enabled the estimation of quantitative non-MRI trajectories in a rare disease (PCA) where very limited data was available. To our knowledge, this is the first time a multimodal continuous signature is derived for PCA, as the only other longitudinal study of PCA only computed atrophy measures from MRI scans \cite{lehmann2011cortical}. Our work has however several limitations, which can be addressed in future research: 1) to account for population heterogeneity, DKT can be easily extended to include subject-specific effects; 2) improved schemes for biomarker allocation to agnostic units can take connectivity into account, or derive it from the data automatically; 3) DKT can be further validated on more complex synthetic experiments with a range of datasets generated with different parameters.
\section{Acknowledgements}
This work was supported by the EPSRC Centre For Doctoral Training in Medical Imaging with grant EP/L016478/1 and in part by the Neuroimaging Analysis Center through NIH grant NIH NIBIB NAC P41EB015902. Data collection and sharing for this project was funded by the Alzheimer’s Disease Neuroimaging Initiative (ADNI) (National Institutes of Health Grant U01 AG024904) and DOD ADNI (Department of Defense award number W81XWH-12-2-0012). The Dementia Research Centre is an ARUK coordination center.
\bibliographystyle{unsrtnat}
| {'timestamp': '2019-07-30T02:28:57', 'yymm': '1901', 'arxiv_id': '1901.03517', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03517'} | arxiv |
\section{Introduction}
Numbers play a vital role in our lives. We reason with numbers in day-to-day tasks ranging from handling currency to reading news articles to understanding sports results, elections and stock markets. As numbers are used to communicate information accurately, reasoning with them is an essential core competence in understanding natural language \cite{levinson2001pragmatics, frank2008number, dehaene2011number}. A benchmark task in natural language understanding is natural language inference (NLI)(or recognizing textual entailment (RTE)) \cite{cooper1996using, condoravdi2003entailment, bos2005recognising, dagan2006pascal}, wherein a model determines if a natural language hypothesis can be justifiably inferred from a given premise\footnote{Often, this is posed as a three-way decision where the hypothesis can be inferred to be true (entailment), false (contradiction) or cannot be determined (neutral).}. Making such inferences often necessitates reasoning about quantities.
\begin{table}[tb]
\small
\setlength\tabcolsep{2pt}
\begin{tabular}{p{0.3 cm} p{6.9cm}}
\hline \\[-1.75ex] \multicolumn{2}{l}{\textsc{\textbf{RTE-Quant}} }\\ \hline \\[-1.75ex]
\textbf{P}: & After the deal closes, Teva will generate \textcolor{red}{sales of} about \textcolor{red}{\$ 7 billion} a year, the company said. \\
\textbf{H}: & Teva \textcolor{red}{earns \$ 7 billion} a year.\\
\hline \\[-1.75ex] \multicolumn{2}{l}{\textsc{\textbf{AWP-NLI}}} \\ \hline \\[-1.75ex]
\textbf{P}: & Each of farmer Cunningham's \textcolor{red}{6048 lambs} is either black or white and there are \textcolor{red}{193 white ones.} \\
\textbf{H}: & \textcolor{red}{5855} of Farmer Cunningham's \textcolor{red}{lambs are black.}\\
\hline \\[-1.75ex] \multicolumn{2}{l}{\textsc{\textbf{NewsNLI}}} \\ \hline \\[-1.75ex]
\textbf{P}: & \textcolor{red}{Emmanuel Miller, 16}, and \textcolor{red}{Zachary Watson, 17}, are charged as adults, police said. \\
\textbf{H}: & \textcolor{red}{Two teen suspects} charged as adults.\\
\hline \\[-1.75ex] \multicolumn{2}{l}{\textsc{\textbf{RedditNLI}}} \\ \hline \\[-1.75ex]
\textbf{P}: & Oxfam says richest \textcolor{red}{one percent} to own \textcolor{red}{more than rest} by 2016. \\
\textbf{H}: & Richest \textcolor{red}{1\%} To Own \textcolor{red}{More Than Half} Worlds Wealth By 2016 Oxfam.\\
\hline
\end{tabular}
\caption{Examples from evaluation sets in EQUATE}
\label{tab:dataex}
\end{table}
Consider the following example from Table \ref{tab:dataex},\\
\noindent
P: With 99.6\% of precincts counted , Dewhurst held 48\% of the vote to 30\% for Cruz . \\
H: Lt. Gov. David Dewhurst fails to get 50\% of primary vote.\\
To conclude the hypothesis is inferable, a model must reason that since 99.6\% precincts are counted, even if all remaining precincts vote for Dewhurst, he would fail to get 50\% of the primary vote. Scant attention has been paid to building datasets to evaluate this reasoning ability. To address this gap, we present EQUATE (Evaluating Quantity Understanding Aptitude in Textual Entailment) (\S \ref{data:equate}), which consists of five evaluation sets, each featuring different facets of quantitative reasoning in textual entailment (Table \ref{tab:dataex}) (including verbal reasoning with quantities, basic arithmetic computation, dealing with approximations and range comparisons.).
We evaluate the ability of existing state-of-the-art NLI models to perform quantitative reasoning (\S \ref{models:existing}), by benchmarking 9 published models on EQUATE. Our results show that most models are incapable of quantitative reasoning, instead relying on lexical cues for prediction. Additionally, we build \textsc{Q-REAS} , a shallow semantic reasoning baseline for quantitative reasoning in NLI (\S \ref{models:ours}). \textsc{Q-REAS} is effective on synthetic test sets which contain more quantity-based inference, but shows limited success on natural test sets which require deeper linguistic reasoning. However, the hardest cases require a complex interplay between linguistic and numerical reasoning. The EQUATE evaluation framework makes it clear where this new challenge area for textual entailment stands.
\section{Related Work}
NLI has attracted community-wide interest as a stringent test for natural language understanding \cite{cooper1996using, fyodorov2000natural, glickman2005web, haghighi2005robust, harabagiu2006methods,romanoinvestigating,dagan2006pascal,giampiccolo2007third, zanzotto2006learning,malakasiotis2007learning, maccartney2009natural, de2009multi, dagan2010fourth, angeli2014naturalli, marelli2014sick}. Recently, the creation of large-scale datasets \cite{snli,williams2017broad,khot2018scitail} spurred the development of many neural models \cite{ parikh2016decomposable, nie-bansal:2017:RepEval, conneau-EtAl:2017:EMNLP2017,balazs-EtAl:2017:RepEval,chen-EtAl:2017:Long3, radford2018improving, devlin2018bert}.
However, state-of-the-art models for NLI treat the task like a matching problem, which appears to work in many cases, but breaks down in others. As the field moves past current models of the matching variety to ones that embody more of the reasoning we know is part of the task, we need benchmarks that will enable us to mark progress in the field. Prior work on challenge tasks has already made headway in defining tasks for subproblems such as lexical inference with hypernymy, co-hyponymy, antonymy \cite{glockner-shwartz-goldberg:2018:Short, naik-EtAl:2018:C18-1}. In this work, we specifically probe into quantitative reasoning.
\newcite{de-marneffe-etal-2008-finding} find that in a corpus of real-life contradiction pairs collected from Wikipedia and Google News, \emph{29\%} contradictions arise from numeric discrepancies, and in the RTE-3 (Recognizing Textual Entailment) development set, numeric contradictions make up 8.8\% of contradictory pairs. \newcite{naik-EtAl:2018:C18-1} find that model inability to do numerical reasoning causes 4\% of errors made by state-of-the-art models. \newcite{sammons2010ask, clark2018knowledge} argue for a systematic knowledge-oriented approach in NLI by evaluating specific semantic analysis tasks, identifying quantitative reasoning in particular as a focus area. \newcite{bentivogli-etal-2010-building} propose creating specialized datasets, but feature only 6 examples with quantitative reasoning. Our work bridges this gap by providing a more comprehensive examination of quantitative reasoning in NLI.
While to the best of our knowledge, prior work has not studied quantitative reasoning in NLI, \newcite{roy2017reasoning} propose a model for a related subtask called \emph{quantity entailment}, which aims to determine if a given quantity can be inferred from a sentence. In contrast, our work is concerned with general-purpose textual entailment which considers if a given \emph{sentence} can be inferred from another. Our work also relates to solving arithmetic word problems \cite{hosseini2014learning, mitra2016learning, zhou2015learn, upadhyay2016learning, huang2017learning, kushman2014learning, koncel2015parsing, roy2016solving, roy2017reasoning, ling2017program}. A key difference is that word problems focus on arithmetic reasoning, while the requirement for linguistic reasoning and world knowledge is limited as the text is concise, straightforward, and self-contained \cite{hosseini2014learning,Kushman2014LearningTA}. Our work provides a testbed that evaluates basic arithmetic reasoning while incorporating the complexity of natural language.
Recently, \newcite{Dua2019DROPAR} also recognize the importance of quantitative reasoning for text understanding. They propose DROP, a reading comprehension dataset focused on a limited set of discrete operations such as counting, comparison, sorting and arithmetic. In contrast, \textsc{EQUATE} features diverse phenomena that occur naturally in text, including reasoning with approximation, ordinals, implicit quantities and quantifiers, requiring NLI models to reason comprehensively about the interplay between quantities and language. Additionally, through EQUATE we suggest the inclusion of controlled synthetic tests in evaluation benchmarks. Controlled tests act as basic validation of model behaviour, isolating model ability to reason about a property of interest.
\begin{table*}[tb]
\small
\resizebox{\textwidth}{!}{
\begin{tabular}{|p{1.08cm}|p{1.9cm}|p{0.9cm}|p{1cm}|p{2.5cm}|p{2cm}|p{3.5cm}|}
\hline
\textbf{Source} & \textbf{Test Set} & \textbf{Size} & \textbf{Classes} & \textbf{Data Source} & \textbf{Annotation Source} & \textbf{Quantitative Phenomena }\\ \hline
& RTE-Quant & 166 & 2 & RTE2-RTE4 & Experts & Arithmetic, Ranges, Quantifiers\\ \cline{2-7}
Natural & NewsNLI & 968 & 2 & CNN & Crowdworkers & Ordinals, Quantifiers, Arithmetic, Approximation, Magnitude, Ratios\\ \cline{2-7}
& RedditNLI & 250& 3 & Reddit & Experts & Range, Arithmetic, Approximation, Verbal\\ \hline
& Stress Test & 7500 & 3 & AQuA-RAT & Automatic& Quantifiers \\ \cline{2-7}
Synthetic & AwpNLI & 722 & 2 & Arithmetic Word Problems & Automatic & Arithmetic\\
\hline
\end{tabular}
}
\caption{An overview of test sets included in EQUATE. RedditNLI{} and Stress Test{} are framed as 3-class (entailment, neutral, contradiction) while RTE-Quant{}, NewsNLI{} and AwpNLI{} are 2-class (entails=yes/no). RTE 2-4 formulate entailment as a 2-way decision. We find that few news article headlines are contradictory, thus NewsNLI{} is similarly framed as a 2-way decision. For algebra word problems, substituting the wrong answer in the hypothesis necessarily creates a contradiction under the event coreference assumption \cite{de-marneffe-etal-2008-finding}, thus it is framed as a 2-way decision as well.}
\label{tab:equate}
\end{table*}
\section{Quantitative Reasoning in NLI}
\label{data:equate}
Our interpretation of ``quantitative reasoning'' draws from cognitive testing and education \cite{stafford1972hereditary,ekstrom1976manual}, which considers it ``verbal problem-solving ability''. While inextricably linked to mathematics, it is an inclusive skill involving everyday language rather than a specialized lexicon. To excel at quantitative reasoning, one must interpret quantities expressed in language, perform basic calculations, judge their accuracy, and justify quantitative claims using verbal and numeric reasoning. These requirements show a reciprocity: NLI lends itself as a test bed for quantitative reasoning, which conversely, is important for NLI \cite{sammons2010ask, clark2018knowledge}. Motivated by this, we present the EQUATE (Evaluating Quantity Understanding Aptitude in Textual Entailment) framework.
\subsection{The EQUATE Dataset}
\textsc{EQUATE} consists of five NLI test sets featuring quantities. Three of these tests for quantitative reasoning feature language from real-world sources such as news articles and social media (\S \ref{data:rte}; \S \ref{data:qnli}; \S \ref{data:reddit}). We focus on sentences containing quantities with numerical values, and consider an entailment pair to feature quantitative reasoning if it is at least one component of the reasoning required to determine the entailment label (but not necessarily the only reasoning component). Quantitative reasoning features quantity matching, quantity comparison, quantity conversion, arithmetic, qualitative processes, ordinality and quantifiers, quantity noun and adverb resolution\footnote{Such as the quantities represented in \emph{dozen}, \emph{twice}, \emph{teenagers}.} as well as verbal reasoning with the quantity's textual context\footnote{For example, $\langle$Obama cuts tax rate to 28\%, Obama wants to cut tax rate to 28\% as part of overhaul$\rangle$.}. Appendix \ref{sec:phenom} gives some examples for these quantitative phenomena. We further filter sentence pairs which require only temporal reasoning, since specialized knowledge is needed to reason about time. These three test sets contain pairs which conflate multiple lexical and quantitative reasoning phenomena. In order to study aspects of quantitative reasoning in isolation, \textsc{EQUATE} further features two controlled synthetic tests (\S \ref{data:st}; \S \ref{data:awp}), evaluating model ability to reason with quantifiers and perform simple arithmetic. We intend that models reporting performance on any NLI dataset additionally evaluate on the EQUATE benchmark, to demonstrate competence at quantitative reasoning.
\subsection{RTE-Quant}
\label{data:rte}
This test set is constructed from the RTE sub-corpus for quantity entailment \cite{roy2017reasoning}, originally drawn from the RTE2-RTE4 datasets \cite{dagan2006pascal}. The original sub-corpus conflates temporal and quantitative reasoning. We discarded pairs requiring temporal reasoning, obtaining a set of 166 entailment pairs.
\subsection{NewsNLI}
\label{data:qnli}
This test set is created from the CNN corpus \cite{hermann2015teaching} of news articles with abstractive summaries. We identify summary points with quantities, filtering out temporal expressions. For a summary point, the two most similar sentences\footnote{According to Jaccard similarity.} from the article are chosen, flipping pairs where the premise begins with a first-person pronoun (eg:$\langle$``He had nine pears'', ``Bob had nine pears''$\rangle$ becomes $\langle$``Bob had nine pears'', ``He had nine pears''$\rangle$). The top 50\% of similar pairs are retained to avoid lexical overlap bias. We crowdsource annotations for a subset of this data from Amazon Mechanical Turk. Crowdworkers\footnote{We require crowdworkers to have an approval rate of 95\% on at least 100 tasks and pass a qualification test.} are shown two sentences and asked to determine whether the second sentence is definitely true, definitely false, or not inferable given the first. We collect 5 annotations per pair, and consider pairs with lowest token overlap between premise and hypothesis and least difference in premise-hypothesis lengths when stratified by entailment label. Top 1000 samples meeting these criteria form our final set. To validate crowdsourced labels, experts are asked to annotate 100 pairs. Crowdsourced gold labels match expert gold labels in 85\% cases, while individual crowdworker labels match expert gold labels in 75.8\%. Disagreements are manually resolved by experts and examples not featuring quantitiative reasoning are filtered, leaving a set of 968 samples.
\subsection{RedditNLI}
\label{data:reddit}
This test set is sourced from the popular social forum \textbackslash reddit\footnote{According to the Reddit User Agreement, users grant Reddit the right to make their content available to other organizations or individuals.}. Since reasoning about quantities is important in domains like finance or economics, we scrape all headlines from the posts on \textbackslash r\textbackslash economics, considering titles that contain quantities and do not have meta-forum information. Titles appearing within three days of each other are clustered by Jaccard similarity, and the top 300 pairs are extracted. After filtering out nonsensical titles, such as concatenated stock prices, we are left with 250 sentence pairs. Similar to RTE, two expert annotators label these pairs, achieving a Cohen's kappa of 0.82. Disagreements are discussed to resolve final labels.
\subsection{Stress Test}
\label{data:st}
We include the numerical reasoning stress test from \cite{naik-EtAl:2018:C18-1} as a synthetic sanity check. The stress test consists of 7500 entailment pairs constructed from sentences in algebra word problems \cite{P17-1015}. Focusing on quantifiers, it requires models to compare entities from hypothesis to the premise while incorporating quantifiers, but does not require them to perform the computation from the original algebra word problem (eg: $\langle$``NHAI employs 100 men to build a highway of 2 km in 50 days working 8 hours a day'',``NHAI employs less than 700 men to build a highway of 2 km in 50 days working 8 hours a day''$\rangle$).
\subsection{AwpNLI}
\label{data:awp}
To evaluate arithmetic ability of NLI models, we repurpose data from arithmetic word problems \cite{roy2016solving}. They have the following characteristic structure. First, they establish a world and optionally update its state. Then, a question is posed about the world. This structure forms the basis of our pair creation procedure. World building and update statements form the premise. A hypothesis template is generated by identifying modal/auxiliary verbs in the question, and subsequent verbs, which we call secondary verbs. We identify the agent and conjugate the secondary verb in present tense followed by the identified unit to form the final template (for example, the algebra word problem `Gary had 73.0 dollars. He spent 55.0 dollars on a pet snake. How many dollars did Gary have left?' would generate the hypothesis template `Agent(Gary) Verb(Has) Answer(18.0) Unit(dollars) left'). For every template, the correct guess is used to create an entailed hypothesis. Contradictory hypotheses are created by randomly sampling a wrong guess
($x \in \mathbb{Z}^{+}$ if correct guess is an integer, and $x \in \mathbb{R}^{+}$ if it is a real number) \footnote{From a uniform distribution over an interval of 10 around the correct guess (or 5 for numbers less than 5), to identify plausible wrong guesses.}. We check for grammaticality, finding only 2\% ungrammatical hypotheses, which are manually corrected leaving a set of 722 pairs.
\section{Models}
We describe the 9 NLI models\footnote{Accuracy of all models on MultiNLI closely matches original publications (numbers in appendix \ref{sec:dev}).} used in this study, as well as our new baseline. The interested reader is invited to refer to the corresponding publications for further details.
\begin{figure}[tb]
\centering
\includegraphics[scale=0.26]{models_final.pdf}
\caption{Overview of \textsc{Q-REAS} baseline.}
\label{fig:results_policy}
\end{figure}
\subsection{NLI Models}
\label{models:existing}
\noindent
1) \textbf{Majority Class (MAJ): } Simple baseline that always predicts the majority class in test set.\\
\noindent
2) \textbf{Hypothesis-Only (HYP): } FastText classifier \cite{mikolov2018advances} trained on only hypotheses \cite{gururangan2018annotation}. \\
\noindent
3) \textbf{ALIGN: } A bag-of-words alignment model inspired by \newcite{maccartney2009natural}.\footnote{Model accuracy on RTE-3 test is 61.12\%, comparable to the reported average model performance in the RTE competition of 62.4\% .}\\
\noindent
4) \textbf{CBOW: } A simple bag-of-embeddings sentence representation model \cite{williams2017broad}. \\
\noindent
5) \textbf{BiLSTM: }The simple BiLSTM model described by \newcite{williams2017broad}. \\
\noindent
6) \textbf{Chen (CH): }Stacked BiLSTM-RNNs with shortcut connections and character word embeddings \cite{chen-EtAl:2017:RepEval}. \\
\noindent
7) \textbf{InferSent: } A single-layer BiLSTM-RNN model with max-pooling \cite{conneau-EtAl:2017:EMNLP2017}. \\
\noindent
8) \textbf{SSEN: } Stacked BiLSTM-RNNs with shortcut connections \cite{nie-bansal:2017:RepEval}.\\
\noindent
9) \textbf{ESIM: } Sequential inference model proposed by \newcite{chen-EtAl:2017:Long3} which uses BiLSTMs with an attention mechanism. \\
\noindent
10) \textbf{OpenAI GPT:} Transformer-based language model \cite{vaswani2017attention}, with finetuning on NLI \cite{radford2018improving}.\\
\noindent
11) \textbf{BERT:} Transformer-based language model \cite{vaswani2017attention}, with a cloze-style and next-sentence prediction objective, and finetuning on NLI \cite{devlin2018bert}.
\begin{table}[]
\small
\setlength\tabcolsep{2pt}
\resizebox{\columnwidth}{!}{
\begin{tabular}{|p{1 cm} p{6.5cm}|}
\hline \multicolumn{2}{|l|}{INPUT} \\
$P_c$ & Set of ``compatible'' single-valued premise quantities \\
$P_r$ & Set of ``compatible'' range-valued premise quantities\\
$H$ & Hypothesis quantity\\
$O$ & Operator set $\{+, -, *, /, =, \cap, \cup, \setminus, \subseteq \}$\\
$L$ & Length of equation to be generated\\
$SL$ & Symbol list ($P_c \cup P_r \cup H \cup O$)\\
$TL$ & Type list (set of types from $P_c, P_r, H$)\\
$N$ & Length of symbol list\\
$K$ & Index of first range quantity in symbol list\\
$M$ & Index of first operator in symbol list\\
\hline \multicolumn{2}{|l|}{OUTPUT} \\
$e_i$ & Index of symbol assigned to $i^{th}$ position in postfix equation\\
\hline \multicolumn{2}{|l|}{VARIABLES} \\
$x_i$ & Main ILP variable for position $i$\\
$c_i$ & Indicator variable: is $e_i$ a single value?\\
$r_i$ & Indicator variable: is $e_i$ a range?\\
$o_i$ & Indicator variable: is $e_i$ an operator?\\
$d_i$ & Stack depth of $e_i$\\
$t_i$ & Type index for $e_i$\\
\hline
\end{tabular}
}
\caption{Input, output and variable definitions for the Integer Linear Programming (ILP) framework used for quantity composition}
\label{tab:ilpvar}
\end{table}
\begin{table*}[tb]
\small
\centering
\begin{tabular}{|p{3cm}|p{11.5cm}|}
\hline \multicolumn{2}{|c|}{\textbf{Definitional Constraints}} \\ \hline
Range restriction & $x_i < K$ or $x_i = M-1$ for $i \in [0,L-1]$ if $c_i = 1$\\
& $x_i \geq K$ and $x_i < M$ for $i \in [0,L-1]$ if $r_i = 1$\\
& $x_i \geq M$ for $i \in [0,L-1]$ if $o_i = 1$\\
Uniqueness & $c_i + r_i + o_i = 1$ for $i \in [0,L-1]$ \\
Stack definition & $d_0 = 0$ (Stack depth initialization)\\
& $d_i = d_{i-1} - 2o_i + 1$ for $i \in [0,L-1]$ (Stack depth update)\\
\hline \multicolumn{2}{|c|}{\textbf{Syntactic Constraints}} \\ \hline
First two operands & $c_0 + r_0 = 1$ and $c_1 + r_1 = 1$\\
Last operator & $x_{L-1} \geq N-1$ (Last operator should be one of $\{ =, \subseteq \}$)\\
Last operand & $x_{L-2} = M-1$ (Last operand should be hypothesis quantity)\\
Other operators & $x_i \leq N-2$ for $i \in [0,L-3]$ if $o_i = 1$\\
Other operands & $x_i < K$ for $i \in [0,L-3]$ if $c_i = 1$\\
& $x_i < M$ for $i \in [0,L-3]$ if $r_i = 1$\\
Empty stack & $d_{L-1} = 0$ (Non-empty stack indicates invalid postfix expression) \\
Premise usage & $x_i \neq x_j$ for $i,j \in [0,L-1]$ if $o_i \neq 1, o_j \neq 1$ \\
\hline \multicolumn{2}{|c|}{\textbf{Operand Access}} \\ \hline
Right operand & $op2(x_i) = x_{i-1}$ for $i \in [0,L-1]$ such that $o_i = 1$\\
Left operand & $op1(x_i) = x_{l}$ for $i,l \in [0,L-1]$ where $o_i = 1$ and $l$ is the largest index such that $l \leq (i-2)$ and $d_l = d_i$\\ \hline
\end{tabular}
\caption{Mathematical validity constraint definitions for the ILP framework. Functions $op1()$ and $op2()$ return the left and right operands for an operator respectively. Variables defined in table \ref{tab:ilpvar}.}
\label{tab:ilpmath}
\end{table*}
\begin{table*}[tb]
\centering
\small
\begin{tabular}{|p{3cm}|p{11.5cm}|}
\hline \multicolumn{2}{|c|}{\textbf{Type Consistency Constraints}} \\ \hline
Type assignment & $t_i = TL[k]$ for $i \in [0,L-1]$ if $c_i + r_i = 1$ and $type(SL_i) = k$\\
Two type match & $t_i = t_a = t_b$ for $i \in [0,L-1]$ such that $o_i = 1, x_i \in \{+, -, *, /, =, \cap, \cup, \setminus, \subseteq \}, a=op1(x_i), b=op2(x_i)$ \\
One type match & $t_i \in \{ t_a, t_b\}, t_a \neq t_b$ for $i \in [0,L-1]$ such that $o_i = 1, x_i = *, a=op1(x_i), b=op2(x_i)$ \\
& $t_i = t_a \neq t_b$ for $i \in [0,L-1]$ such that $o_i = 1, x_i = /, a=op1(x_i), b=op2(x_i)$ \\
\hline \multicolumn{2}{|c|}{\textbf{Operator Consistency Constraints}} \\ \hline
Arithmetic operators & $c_a = c_b = 1$ for $i \in [0,L-1]$ such that $o_i = 1, x_i \in \{+, -, *, /, =\}, a=op1(x_i), b=op2(x_i)$ \\
Range operators & $r_a = r_b = 1$ for $i \in [0,L-1]$ such that $o_i = 1, x_i \in \{ \cap, \cup, \setminus \}, a=op1(x_i), b=op2(x_i)$\\
& $r_b = 1$ for $i \in [0,L-1]$ such that $o_i = 1, x_i = \subseteq, b=op2(x_i)$\\
\hline
\end{tabular}
\caption{Linguistic consistency constraint definitions for the ILP framework. Functions $op1()$ and $op2()$ return the left and right operands for an operator respectively. Variables defined in table \ref{tab:ilpvar}.}
\label{tab:ilpling}
\end{table*}
\subsection{\textsc{Q-REAS} Baseline System}
\label{models:ours}
\begin{table*}[t]
\small
\centering
\resizebox{\textwidth}{!}{
\begin{tabular}{l l r l r l r l r l r |l l l }
\toprule
\diagbox{M}{D} & \multicolumn{2}{l}{RTE-Q \hfill \raggedright{$\Delta$}} & \multicolumn{2}{l}{NewsNLI \hfill $\Delta$} & \multicolumn{2}{l}{RedditNLI \hfill $\Delta$} & \multicolumn{2}{l}{NR ST \hfill \raggedright{$\Delta$}} & \multicolumn{2}{l}{AWPNLI \hfill $\Delta$} & \makecell{Nat. \\Avg. $\Delta$} & \makecell{Synth. \\Avg. $\Delta$} & \makecell{All \\ Avg. $\Delta$} \\ \midrule
MAJ & 57.8 & \textcolor{blue}{0.0} & 50.7 & \textcolor{blue}{0.0} & \textbf{58.4} & \textbf{\textcolor{blue}{0.0}} & 33.3 & \textcolor{blue}{0.0} & 50.0 & \textcolor{blue}{0.0} & \textcolor{blue}{+0.0} & \textcolor{blue}{+0.0} & \textcolor{blue}{+0.0}\\
HYP & 49.4 & \textcolor{blue}{-8.4} & 52.5 & \textcolor{blue}{+1.8} & 40.8 & \textcolor{blue}{-17.6} & 31.2 & \textcolor{blue}{-2.1} & 50.1 & \textcolor{blue}{+0.1} & \textcolor{blue}{-8.1} & \textcolor{blue}{-1.0} & \textcolor{blue}{-5.2}\\
ALIGN & 62.1 & \textcolor{blue}{+4.3} & 56.0 & \textcolor{blue}{+5.3} & 34.8 & \textcolor{blue}{-23.6} & 22.6 & \textcolor{blue}{-10.7} & 47.2 & \textcolor{blue}{-2.8} & \textcolor{blue}{-4.7} & \textcolor{blue}{-6.8} & \textcolor{blue}{-5.5} \\ \hline
CBOW &47.0 & \textcolor{blue}{-10.8} & 61.8 & \textcolor{blue}{+11.1} & 42.4 & \textcolor{blue}{-16.0} & 30.2 & \textcolor{blue}{-3.1} & 50.7 & \textcolor{blue}{+0.7} & \textcolor{blue}{-5.2} & \textcolor{blue}{-1.2} & \textcolor{blue}{-3.6} \\
BiLSTM &51.2 & \textcolor{blue}{-6.6} & 63.3 & \textcolor{blue}{+12.6} & 50.8 & \textcolor{blue}{-7.6} & 31.2 & \textcolor{blue}{-2.1} & 50.7 & \textcolor{blue}{+0.7} & \textcolor{blue}{-0.5} & \textcolor{blue}{-0.7} & \textcolor{blue}{-0.6} \\
CH &54.2 & \textcolor{blue}{-3.6} & 64.0 & \textcolor{blue}{+13.3} & 55.2 & \textcolor{blue}{-3.2} & 30.3 & \textcolor{blue}{-3.0} & 50.7 & \textcolor{blue}{+0.7} & \textcolor{blue}{+2.2} & \textcolor{blue}{-1.2} & \textcolor{blue}{+0.9} \\
InferSent & 66.3 & \textcolor{blue}{+8.5} & 65.3 & \textcolor{blue}{+14.6} & 29.6 & \textcolor{blue}{-28.8} & 28.8 & \textcolor{blue}{-4.5} & 50.7 & \textcolor{blue}{+0.7} & \textcolor{blue}{-1.9} & \textcolor{blue}{-1.9} & \textcolor{blue}{-1.9} \\
SSEN &58.4 & \textcolor{blue}{+0.6} & 65.1 & \textcolor{blue}{+14.4} & 49.2 & \textcolor{blue}{-9.2} & 28.4 & \textcolor{blue}{-4.9} &50.7 & \textcolor{blue}{+0.7} & \textcolor{blue}{+1.9} & \textcolor{blue}{-2.1} & \textcolor{blue}{+0.3} \\
ESIM &54.8 & \textcolor{blue}{-3.0} & 62.0 & \textcolor{blue}{+11.3} & 45.6 & \textcolor{blue}{-12.8} & 21.8 & \textcolor{blue}{-11.5} &50.1 & \textcolor{blue}{+0.1} & \textcolor{blue}{-1.5} & \textcolor{blue}{-5.7} & \textcolor{blue}{-3.2} \\
GPT & \textbf{68.1} & \textbf{\textcolor{blue}{+10.3}} & 72.2 & \textcolor{blue}{+21.5} & 52.4 & \textcolor{blue}{-6.0} & 36.4 & \textcolor{blue}{+3.1} & 50.0 & \textcolor{blue}{+0.0} & \textcolor{blue}{+8.6} & \textcolor{blue}{+1.6} & \textcolor{blue}{+5.8} \\
BERT & 57.2 & \textcolor{blue}{-0.6} & \textbf{72.8} & \textbf{\textcolor{blue}{+22.1}} & 49.6 & \textcolor{blue}{-8.8} & 36.9 & \textcolor{blue}{+3.6} & 42.2 & \textcolor{blue}{-7.8} & \textcolor{blue}{+4.2} & \textcolor{blue}{-2.1} & \textcolor{blue}{+1.7} \\
\midrule
\textsc{Q-REAS} & 56.6 & \textcolor{blue}{-1.2} & 61.1 & \textcolor{blue}{+10.4} & 50.8 & \textcolor{blue}{-7.6} & \textbf{63.3} & \textbf{\textcolor{blue}{+30}} & \textbf{71.5} & \textbf{\textcolor{blue}{+21.5}} & \textcolor{blue}{+0.5} & \textcolor{blue}{+25.8} & \textbf{\textcolor{blue}{+10.6}} \\\bottomrule
\end{tabular}
}
\caption{Accuracies(\%) of 9 NLI Models on five tests for quantitiative reasoning in entailment. M and D represent \emph{models} and \emph{datasets} respectively. $\Delta$ captures improvement over majority-class baseline for a dataset. Column Nat.Avg. reports the average accuracy(\%) of each model across 3 evaluation sets constructed from natural sources (RTE-Quant, NewsNLI, RedditNLI), whereas Synth.Avg. reports the average accuracy(\%) on 2 synthetic evaluation sets (Stress Test, AwpNLI). Column Avg. represents the average accuracy(\%) of each model across all 5 evaluation sets in \textsc{equate}. }
\label{ref:bigtable}
\end{table*}
Figure \ref{fig:results_policy} describes the \textsc{Q-REAS} baseline for quantitative reasoning in NLI. The model manipulates quantity representations symbolically to make entailment decisions, and is intended to serve as a strong heuristic baseline for numerical reasoning on the \textsc{equate} benchmark. This model has four stages: Quantity mentions are extracted and parsed into semantic representations called \textsc{Numsets} (\S\ref{ref:Qsegment}, \S\ref{ref:Qparse}); compatible \textsc{Numsets} are extracted (\S\ref{ref:Qprune}) and composed (\S\ref{ref:Qcompose}) to form \emph{justifications}; Justifications are analyzed to determine entailment labels (\S\ref{ref:Qjustify}).
\subsubsection{Quantity Segmenter}
\label{ref:Qsegment}
We follow \newcite{barwise1981generalized} in defining quantities as having a number, unit, and an optional approximator. Quantity mentions are identified as least ancestor noun phrases from the constituency parse of the sentence containing cardinal numbers.
\subsubsection{Quantity Parser}
\label{ref:Qparse}
The quantity parser constructs a grounded representation for each quantity mention in the premise or hypothesis, henceforth known as a \textsc{Numset} \footnote{A \textsc{Numset} may be a composition of other \textsc{Numsets} .}. A \textsc{Numset} is a tuple (val, unit, ent, adj, loc, verb, freq, flux)\footnote{As in \cite{koncel2015parsing} S denotes all possible spans in the sentence, ${\phi}$ represents the empty span, and $S^{\phi}$=$S \cup \phi$} with:\\
\noindent
1. val $\in$ [$\mathbb{R} , \mathbb{R}$]: quantity value represented as a range\\
2. unit $\in S$: unit noun associated with quantity \\
3. ent $\in S^{\phi}$: entity noun associated with unit (e.g., ‘\emph{donations} worth 100\$’)\\
4. adj $\in S^{\phi}$: adjective associated with unit if any\footnote{Extracted as governing verb linked to entity by an \emph{amod} relation.}, \\
5. loc $\subseteq S^{\phi}$: location of unit (e.g.,'in the bag')\footnote{Extracted as prepositional phrase attached to the quantity and containing noun phrase.}\\
6. verb $\in S^{\phi}$: action verb associated with quantity\footnote{Extracted as governing verb linked to entity by \emph{dobj} or \emph{nsubj} relation.}. \\
7. freq $\subseteq S^{\phi}$: if quantity recurs\footnote{extracted using keywords \emph{per} and \emph{every}} (e.g, 'per hour'),\\
8. flux $\in$ \{increase to, increase from, decrease to, decrease from$\}^{\phi}$: if quantity is in a state of flux\footnote{using gazetteer: \emph{increasing}, \emph{rising}, \emph{rose}, \emph{decreasing}, \emph{falling}, \emph{fell}, \emph{drop}}.\\
To extract \textbf{values} for a quantity, we extract cardinal numbers, recording contiguity. We normalize the number\footnote{(remove ``,''s, convert written numbers to float, decide the numerical value, for example hundred fifty eight thousand is 158000, two fifty eight is 258, 374m is 3740000 etc.). If cardinal numbers are non-adjacent, we look for an explicitly mentioned range such as `to' and `between'.}. We also handle simple ratios such as quarter, half etc, and extract bounds (eg: \emph{fewer than 10 apples} is parsed to $[-\infty, 10]$ apples.)
To extract \textbf{units}, we examine tokens adjacent to cardinal numbers in the quantity mention and identify known units. If no known units are found, we assign the token in a \emph{numerical modifier} relationship with the cardinal number, else we assign the nearest noun to the cardinal number as the unit. A quantity is determined to be \textbf{approximate} if the word in an \emph{adverbial modifier} relation with the cardinal number appears in a gazetteer\footnote{roughly, approximately, about, nearly, roundabout, around, circa, almost, approaching, pushing, more or less, in the neighborhood of, in the region of, on the order of,something like, give or take (a few), near to, close to, in the ballpark of}. If approximate, range is extended to (+/-)2\% of the current value.
\subsubsection{Quantity Pruner}
The pruner constructs ``compatible'' premise-hypothesis \textsc{Numset} pairs. Consider the pair ``Insurgents killed \emph{7 U.S. soldiers}, set off a car bomb that killed \emph{four Iraqi policemen}'' and ``\emph{7 US soldiers} were killed, and \emph{at least 10 Iraqis} died''. Our parser extracts \textsc{Numsets} corresponding to \emph{``four Iraqi policemen''} and \emph{``7 US soldiers''} from premise and hypothesis respectively. But these \textsc{Numsets} should not be compared as they involve different units. The pruner discards such incompatible pairs. Heuristics to identify unit-compatible \textsc{Numset} pairs include three cases- 1) direct string match, 2) synonymy/hypernymy relations from WordNet, 3) one unit is a nationality/ job\footnote{Lists of jobs, nationalities scraped from Wikipedia.} and the other unit is synonymous with person \cite{roy2017reasoning}.
\label{ref:Qprune}
\subsubsection{Quantity Composition}
\label{ref:Qcompose}
The composition module detects whether a hypothesis \textsc{Numset} is justified by composing ``compatible'' premise \textsc{Numsets} . For example, consider the pair ``I had \textit{3 apples} but gave \textit{one} to my brother'' and ``I have \textit{two apples}''. Here, the premise \textsc{Numsets} {} $P_1$ (``\textit{3 apples}'') and $P_2$ (``\textit{one apple}'') must be composed to deduce that the hypothesis \textsc{Numset} {} $H_1$ (``\textit{2 apples}'') is justified. Our framework accomplishes this by generating postfix arithmetic equations\footnote{Note that arithmetic equations differ from algebraic equations in that they do \textit{not} contain unknown variables} from premise \textsc{Numsets} , that justify the hypothesis \textsc{Numset} \footnote{Direct comparisons are incorporated by adding ``='' as an operator.}. In this example, the expression $<P_1,P_2,-,H_1,=>$ will be generated.
The set of possible equations is exponential in number of \textsc{Numsets} , making exhaustive generation intractable. But a large number of equations are invalid as they violate constraints such as unit consistency. Thus, our framework uses integer linear programming (ILP) to constrain the equation space. It is inspired by prior work on algebra word problems \cite{koncel2015parsing}, with some key differences:\\
\noindent
1. \textbf{ Arithmetic equations:} We focus on arithmetic equations instead of algebraic ones.\\
2. \textbf{Range arithmetic:} Quantitative reasoning involves ranges, which are handled by representing then as endpoint-inclusive intervals and adding the four operators ($\cup, \cap, \setminus, \subseteq$)\\
3. \textbf{Hypothesis quantity-driven:} We optimize an ILP model for each hypothesis \textsc{Numset} because a sentence pair is marked ``entailment'' iff every hypothesis quantity is justified.\\
Table \ref{tab:ilpvar} describes ILP variables. We impose the following types of constraints:\\
\textbf{1. Definitional Constraints: }Ensure that ILP variables take on valid values by constraining initialization, range, and update.\\
\textbf{2. Syntactic Constraints: }Assure syntactic validity of generated postfix expressions by limiting operator-operand ordering.\\
\textbf{3. Operand Access: }Simulate stack-based evaluation correctly by choosing correct operator-operand assignments.\\
\textbf{4. Type Consistency:} Ensure that all operations are type-compatible.\\
\textbf{5. Operator Consistency: }Force range operators to have range operands and mathematical operators to have single-valued operands.\\
Definitional, syntactic, and operand access constraints ensure mathematical validity while type and operator consistency constraints add linguistic consistency. Constraint formulations are provided in Tables \ref{tab:ilpmath} and \ref{tab:ilpling}. We limit tree depth to 3 and retrieve a maximum of 50 solutions per hypothesis \textsc{Numset} , then solve to determine whether the equation is mathematically correct. We discard equations that use invalid operations (division by 0) or add unnecessary complexity (multiplication/ division by 1). The remaining equations are considered plausible justifications .
\subsubsection{Global Reasoner}
\label{ref:Qjustify}
The global reasoner predicts the final entailment label as shown in Algorithm 1\footnote{MaxSimilarityClass() takes two quantities and returns a probability distribution over entailment labels based on unit match. Similarly, ValueMatch() detects whether two quantities match in value (this function can also handle ranges).}, on the assumption that every \textsc{Numset} in the hypothesis \emph{has} to be justified \footnote{This is a necessary but not sufficient condition for entailment. Consider the example, $\langle$`Sam believed Joan had 5 apples', `Joan had 5 apples'$\rangle$. The hypothesis quantities of 5 apples is justified but is not a sufficient condition for entailment.} for entailment.
\begin{algorithm}[h]
\caption{PredictEntailmentLabel($P,H,C,E$)}
\label{alg:global}
\begin{algorithmic}[1]
\Input Premise quantities $P$, Hypothesis quantities $H$, Compatible pairs $C$, Equations $E$
\Output Entailment label $l \in $ \{ e, c, n \}
\If{$C$ = $\emptyset$}
\Return{$n$}
\EndIf
\State $J \leftarrow \emptyset$
\State $L \leftarrow [ ]$
\For{$q_h \in H$}
\State $J_h \leftarrow \{ q_p \mid q_p \in P, (q_p, q_h) \in C \}$
\State $J \leftarrow J \cup \{(q_h, J_h)\}$
\State $L \leftarrow L + [false]$
\EndFor
\For{$(q_h, J_h) \in J$}
\If{$J_h = \emptyset$}
\Return{$n$}
\EndIf
\For{$q_p \in J_h$}
\State $s \leftarrow$ MaxSimilarityClass($q_p, q_h$)
\If{$s = e$}
\If{ValueMatch($q_p, q_h$)}
\State $L$[$q_h$] = $true$
\EndIf
\If{!ValueMatch($q_p, q_h$)}
\State $L$[$q_h$] = $false$
\EndIf
\EndIf
\If{$s = c$}
\If{ValueMatch($q_p, q_h$)}
\State $L$[$q_h$] = $c$
\EndIf
\EndIf
\EndFor
\EndFor
\For{$q_h \in H$}
\State $E_q \leftarrow \{ e_i \in E \mid hyp(e_i) = q_h \}$
\If{$E_q \neq \emptyset$}
\State $L$[$q_h$] = $true$
\EndIf
\EndFor
\If{$c \in L$}
\Return{$c$}
\EndIf
\If{count($L, true$) = len($L$)}
\Return{$e$} \\
\Return{$n$}
\EndIf
\end{algorithmic}
\end{algorithm}
\section{Results and Discussion}
Table \ref{ref:bigtable} presents results on EQUATE. All models, except \textsc{Q-REAS} are trained on MultiNLI. \textsc{Q-REAS} utilizes WordNet and lists from Wikipedia. We observe that neural models, particularly OpenAI GPT excel at verbal aspects of quantitative reasoning (RTE-Quant, NewsNLI), whereas \textsc{Q-REAS} excels at numerical aspects (Stress Test, AwpNLI).\\
\subsection{Neural Models on NewsNLI{}:}
To tease apart contributory effects of numerical and verbal reasoning in natural data, we experiment with NewsNLI. We extract all entailed pairs where a quantity appears in both premise and hypothesis, and perturb the quantity in the hypothesis generating contradictory pairs. For example, the pair $\langle$`In addition to 79 fatalities , some 170 passengers were injured.'$\rangle$ `The crash took the lives of 79 people and injured some 170', `entailment' is changed to $\langle$`In addition to 79 fatalities , some 170 passengers were injured.', `The crash took the lives of 80 people and injured some 170', `contradiction'$\rangle$, assuming scalar implicature and event coreference. Our perturbed test set contains 218 pairs. On this set, GPT\footnote{the best-performing neural model on \textsc{EQUATE}.} achieves an accuracy of 51.18\%, as compared to 72.04\% on the unperturbed set, suggesting the model relies on verbal cues rather than numerical reasoning. In comparison, \textsc{Q-REAS} achieves an accuracy of 98.1\% on the perturbed set, compared to 75.36\% on the unperturbed set, highlighting reliance on quantities rather than verbal information. Closer examination reveals that OpenAI switches to predicting the `neutral' category for perturbed samples instead of entailment, accounting for 42.7\% of its errors, possibly symptomatic of lexical bias issues \cite{naik-EtAl:2018:C18-1}. \\
\subsection{What Quantitative Phenomena Are Hard?}
We sample 100 errors made by \textsc{Q-REAS} on each test in EQUATE, to identify phenomena not addressed by simple quantity comparison. Our analysis of causes for error suggest avenues for future research:\\
\noindent
1. \textbf{Multi-step numerical-verbal reasoning:} Models do not perform well on examples requiring interleaved verbal and quantitative reasoning, especially multi-step deduction. Consider the pair $\langle$``Two people were injured in the attack'', ``Two people perpetrated the attack''$\rangle$. Quantities ``two people'' and ``two people'' are unit-compatible, but must not be compared. Another example is the NewsNLI{} entailment pair in Table \ref{tab:dataex}. This pair requires us to identify that 16 and 17 refer to Emmanuel and Zachary's ages (quantitative), deduce that this implies they are teenagers (verbal) and finally count them (quantitative) to get the hypothesis quantity ``two teens''. Numbers and language are intricately interleaved and developing a reasoner capable of handling such complex interplay is challenging.\\
\noindent
2. \textbf{Lexical inference:} Lack of real world knowledge causes errors in identifying quantities and valid comparisons. Errors include mapping abbreviations to correct units (``m'' to ``meters''), detecting part-whole coreference (``seats'' can be used to refer to ``buses''), and resolving hypernymy/hyponymy (``young men'' to ``boys''). \\
\noindent
3. \textbf{Inferring underspecified quantities:} Quantity attributes can be implicitly specified, requiring inference to generate a complete representation. Consider ``A mortar attack killed four people and injured 80''. A system must infer that the quantity ``80'' refers to people. On RTE-Quant, 20\% of such cases stem from zero anaphora, a hard problem in coreference resolution. \\
\noindent
4. \textbf{Arithmetic comparison limitations:} These examples require composition between incompatible quantities. For example, consider $\langle$``There were 3 birds and 6 nests'', ``There were 3 more nests than birds''$\rangle$. To correctly label this pair ``3 birds'' and ``6 nests'' must be composed.
\section{Conclusion}
In this work, we present EQUATE, an evaluation framework to estimate the ability of models to reason quantitatively in textual entailment. We observe that existing neural approaches rely heavily on the lexical matching aspect of the task to succeed rather than reasoning about quantities. We implement a strong symbolic baseline \textsc{Q-REAS} {} that achieves success at numerical reasoning, but lacks sophisticated verbal reasoning capabilities. The \textsc{EQUATE} resource presents an opportunity for the community to develop powerful hybrid neuro-symbolic architectures, combining the strengths of neural models with specialized reasoners such as \textsc{Q-REAS} {}. We hope our insights lead to the development of models that can more precisely reason about the important, frequent, but understudied, phenomena of quantities in natural language.
\section*{Acknowledgments}
This research was supported in part by grants from the National Science Foundation Secure and Trustworthy Computing program (CNS-1330596, CNS-15-13957, CNS-1801316, CNS-1914486) and a DARPA Brandeis grant (FA8750-15-2-0277). The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of the NSF, DARPA, or the US Government. The author Naik was supported by a fellowship from the Center of Machine Learning and Health at Carnegie Mellon University. The authors would like to thank Graham Neubig, Mohit Bansal and Dongyeop Kang for helpful discussion regarding this work, and Shruti Rijhwani and Siddharth Dalmia for reviews while drafting this paper. The authors are also grateful to Lisa Carey Lohmueller and Xinru Yan for volunteering their time for pilot studies.
| {'timestamp': '2019-10-29T01:14:00', 'yymm': '1901', 'arxiv_id': '1901.03735', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03735'} | arxiv |
\section{Introduction}
Group-Based Policy (GBP), or policy-based networking \cite{Verma2002} is a declarative approach to defining network behaviour. Network administrators specify network endpoints, groups of endpoints and their policies using a high level language, which is later translated to network configurations. One of these languages, GBP is widely employed in the industry, for example in OpenStack's Neutron network API \cite{openstack18}. It can define rules between servers and clients, service chains, etc.
Until now, GBP has been conceived as a language for a single administrative domain. In this paper, we analyze if we can extend it to several administrative domains, preserving at the same time their independence. For example, we want to make it possible for an administrator in company B to allow a VPN connection from a user in company A by simply typing:
\texttt{\footnotesize{createPolicy from=userA to=VPNserverB action=allow}}
Typically, there are two solutions for this scenario: (i) manual, by means of issuing a digital certificate and giving it to the users (so they use it later to authenticate the connection), or (ii) leveraging structures based on PKI systems, namely cross-domain certification or bridge CA certificates \cite{josang2013pki}. These structures allow the co-existence of several CAs and ensure mutual trust.
However, these approaches present some limitations that have hindered their deployment. First of all, scalability: in scenarios with thousands or tens of thousands of users, the manual approach is unfeasible, and cross-certificating $N$ domains means -in the worst case- issuing $\sim$ $N^{2}/2$ certificates \cite{josang2013pki,slagell06}. Second, granularity: it is not possible to define different policies for different users without issuing more certificates, further affecting scalability. Finally, management: PKIs are cumbersome to manage, especially day-to-day operations like adding and removing users, revocation (requires a CRL subsystem) or key rollover.
With these limitations in mind, in this paper we propose using a blockchain to overcome them. In such blockchain, each organization defines its users and resources, and specifies which users -from other organizations- can access its resources. Upon an access request, routers query the blockchain to verify authorization (fig. \ref{fig:global}).
\begin{figure}[tbp]
\begin{displaymath}
\xymatrix{ & *++[F]{Blockchain} & \\
*++[F-:<3pt>]{Org A} \ar[ur]^{\txt<8pc>{(1) write \\users}} \ar[rr]_{\txt<8pc>{(2) connection request}} & & *++[F-:<3pt>]{Org B} *\ar[ul]_{\txt<8pc>{(3) query \\ authorization}}
}
\end{displaymath}
\caption{Global architecture.}
\label{fig:global}
\end{figure}
Thanks to blockchain's particular properties, we can design an access control system that improves on several of PKI's limitations: (i) \emph{increased scalability: }when we establish a new relationship in a PKI, we have to cross-certificate the new entity with the rest. In a blockchain, however, we can directly reference previous transactions/users. This reduces the number of required certificates (transactions in this case). (ii) \emph{improved granularity and flexibility}: since we can associate each resource or user with a private key, we can alter its state without affecting the rest. This includes both its validity and other data, for example, we can assign different policies to different users.
(iii) \emph{simpler management:} the transactional nature of blockchain makes management simpler: the aforementioned common operations (key rollover, revocation) can be encoded as new transactions, instead of requiring a dedicated subsystem, like CRLs and manifests.
In this paper we present an architecture to support this use-case, we describe a practical end-to-end implementation and evaluate its performance to demonstrate its feasibility. Our results show that we can store thousands of access polices with modest storage, and achieve linear update times on a permissioned blockchain.
\section{Why Blockchain?}
Our use-case presents two particular characteristics: (i) its participants have limited trust in each other, and (ii) they want to retain full control over the access policies. This is because in a multi-enterprise scenario: (i) companies are not willing to leave access control to a third party, and (ii) each company must be able to revoke any access policy at any moment in time, respectively.
These requirements match the characteristics of any blockchain. Regarding the first demand, its consensus algorithm ensures that no single entity controls the blockchain and avoids having to fully trust its participants. The second requirement is covered by the fact that blockchain assets are controlled by their associated private key owner, not by a centralized entity.
On the other hand, an approach like this is much more complex in a classical PKI because it cannot fulfill the previous two requirements. The first one because the CA is the single point of trust in the system, which forces all participants to trust it. Furthermore, it cannot meet the second as a consequence of the centralized trust: the CA can unilaterally alter state by means of certificate revocation.
As mentioned before, other PKI schemes could provide equivalent functionality, such as bridge CA certificates, but in this case the bridge CA certificate is still a single point of trust, thus it is not significantly different from a conventional CA. Cross-domain certification may prove useful, however, it presents scalability limitations because each new CA has to cross-certify with all the existing ones.
In addition, a blockchain can alleviate this scalability concerns: we can reduce the number of required certificates (transactions in this case), since a blockchain allows directly referencing existing transactions, instead of re-certifying with the PKI CA. In turn, this simplifies the verification of the chain of authorizations, i.e. it is not necessary to go up the CA, then down to the cross-certificated one. Authorization emerges directly from the originating organization.
Finally, thanks to emerging private blockchain platforms we can provide a certain degree of privacy for their users (as opposed to public blockchains like Ethereum) and improve some of their performance metrics (sec. \ref{sec:arch:bc}).
\section{Architecture}
We can describe our architecture as a three-layer system (fig. \ref{fig:layer}):
\begin{figure}[!tbp]
\begin{displaymath}
\xymatrix{ Administrator \ar[d]^{access\:policies} \\
*++[F]{Policy} \ar[d]^{transactions} \\
*++[F]{Blockchain} \ar[d]^{authentication}\\
*++[F]{Network}
}
\end{displaymath}
\caption{Layered architecture.}
\label{fig:layer}
\end{figure}
\emph{\textbf{Policy: }}an intent-driven interface allows administrators to specify users, resources and access policies. These polices are rendered into blockchain transactions.
\emph{\textbf{Blockchain: }}a blockchain stores all the information and ensures its integrity and accuracy.
\emph{\textbf{Network: }}routers access the blockchain via an API to determine if a particular user can access a specific resource. If the user is authorized, they retrieve authentication information to establish a security association and allow the connection.
The following sections provide details on each element.
\subsection{Policy interface}\label{sec:interface}
Administrators use a simple CLI, based on GBP, to perform management operations, such as creating/deleting users, groups of users, policies and resources, as well as querying the blockchain for specific policies, users, etc. We have chosen GBP because it is widely adopted in the industry \cite{openstack18} and its semantics align pretty well with our use-case.
Specifically, we can accommodate our use case to the OpenStack syntax simply re-using some of its commands. For example, consider that organization B wants to grant access to its internal database to Alice from the Human Resources department of an external organization A (figure \ref{fig:example}). First, company A creates a member for Alice:
\begin{figure}[!tbp]
\centerline{\includegraphics[width=\columnwidth, trim={1cm, 7cm, 0.5cm, 2.5cm}, clip]{example.pdf}}
\caption{Example scenario}
\label{fig:example}
\end{figure}
\texttt{\footnotesize{gbp member-create alice}}
Then, company B creates a group for company A's user and adds Alice into it:
\texttt{\footnotesize{gbp group-create dbaccess --add:orga.alice}}
It also creates the internal database as a member:
\texttt{\footnotesize{gbp member-create internalDB}}
Finally, organization B creates the policy associated to its database and company A's user, allowing access from the group \emph{dbaccess} to its member \emph{internalDB}:
\texttt{\footnotesize{gbp policy-rule-create external-human-res --src:dbaccess --dst:internalDB --actions allow}}
The GBP syntax can be extended with more options, for example, adding a one week timeout to Alice's membership in the \emph{internalDB} group:
\texttt{\footnotesize{gbp group-create dbaccess --add:orga.alice --timeout 1w}}
This custom logic can be easily implemented thanks to the ability of some blockchains to run smart contracts.
\subsection{Blockchain}\label{sec:arch:bc}
In this section we discuss two major design decisions we took for our blockchain.
\emph{\textbf{Participants:}}
We believe that a private blockchain (only authorized members can access it) fits better in this scenario than a public, mainly because its participants are not willing to make their access policies public. Communicating access policies only to a group of companies is sufficient for correct operation.
\emph{\textbf{Consensus algorithm:}}
We argue that a BFT protocol suits our use case, due to the following reasons: (i) Security: classical BFT protocols such as XFT \cite{liu2016xft} or BFT-SMART \cite{Bessani14} offer proven security guarantees, as opposed to PoW or PoS algorithms, some of which lack a formal security analysis or a mature implementation. (ii) the access-control PKI of the private chain can be re-used in the BFT protocol, since they require some kind of node authentication. (iii) Higher throughput: BFT algorithms typically reach consensus faster than PoW or PoS, thus increasing the amount of transactions per second. (iv) Immediate finality: in a BFT protocol, when a transaction has been added in the chain, it will never be removed. On the contrary, a Bitcoin fork prevents immediate finality, and (v) We can avoid well-known PoW/PoS drawbacks, e.g. high energy consumption or limited throughput.
Finally, it should be noted that BFT-based chains suffer from scalability concerns, i.e., they cannot scale to as many users as well-know PoW or PoS chains like Bitcoin (in the order of millions). However, this is not our case: a chain with hundreds or even tenths of companies would be perfectly functional.
\subsection{Network}\label{sec:network}
In order to perform the access control, we have chosen the Locator/ID Separation Protocol (LISP, RFC 6830). LISP is a request-response protocol that allows the communication of control and data planes. In our scenario, routers can easily retrieve the blockchain access control policies from the control plane with minimal modification of the base protocol. For this particular use-case, LISP is conceptually equivalent to OpenFlow \cite{McKeown2008}. Hence, we can use other protocols for this task, such as the aforementioned OpenFlow or P4 Runtime \cite{p4r18}.
In a nutshell, we store the access policies in the LISP control plane and update them through the blockchain. LISP-enabled routers query the control plane to determine if a particular user can access the requested resource. Users authenticate to the router by means of including their signature in the LISP control plane messages (Map Request and Map Reply).
\subsection{Typical Workflow}\label{sec:wf}
Fig. \ref{fig:workflow} presents an example of the typical workflow in this architecture, in which two companies set up a secure connection from User A of company A to Resource B located in company B.
\begin{figure}[tbp]
\centerline{\includegraphics[width=\columnwidth, trim={0, 1.5cm, 0, 1cm}, clip]{gbp-workflowv2.pdf}}
\caption{Typical architecture workflow.}
\label{fig:workflow}
\end{figure}
\begin{enumerate}
\item At setup time, administrators from both companies store the required information in the chain. Company A adds User A and its public key. Company B details its resource (Resource B) and grants access to company A's user (A $>$ B). They use a CLI similar to the example in sec. \ref{sec:interface}.
\item Company A assigns User A its credentials (public-private keypair), with the public key being the one in the blockchain.
\item When User A wants to connect to Resource B, it sends a LISP control message to the LISP Control Plane. The message is signed by User A.
\item The LISP Control Plane verifies the signature and checks the access policy against the blockchain.
\item If they are correct, it sends a reply message to Company B's LISP Router.
\item The LISP router sends a reply message with the cryptorgraphic material for data plane encryption, in order to establish a security association with User A. This message is encrypted with User A's public key.
\item The LISP router and User A start a secure connection, e.g. with LISP-CRYPTO (RFC 8061) or other VPN protocols (L3VPN or equivalent).
\end{enumerate}
\section{Implementation}
We have built an end-to-end prototype encompassing the three components of the aforementioned architecture: GBP interface, Blockchain, and Network. It is available as open-source code\footnote{https://github.com/JordiSubira/DGBP}.
\subsection{GBP Command Line}
We designed a CLI inspired on GBP commands that allows the creation/deletion/retrieval of users, groups of users, resources and access policies, highly similar to the examples in sec. \ref{sec:interface}. For example \texttt{create resource} creates a new resource for the organization. Additional options in the commands specify the IP address of the resource, the public key of a user, etc.
\subsection{Blockchain}
Our prototype is based on the Hyperledger project (HL), an open-source permissioned blockchain implementation. Specifically, we have chosen its Fabric \cite{fabric18} framework because of its maturity, flexibility and business-orientation. Moreover, thanks to Fabrics's channels, we can establish private communications among sub-sets of companies if privacy is a strong concern. In this section we summarize the different configuration parameters and implementation details of our prototype in the HL Fabric framework.
\subsubsection{Assets}We defined the following elements in the chain:
\emph{\textbf{Users:}} Source endpoints, identified by a public key and including other information: originating organization, IP address, name and department.
\emph{\textbf{Departments:}} A group of users within an organization, identified by department name and their belonging organization\footnote{They identify groups of users in order to simultaneously create policies for several users.}.
\emph{\textbf{Resources:}} Destination endpoints, identified by an IP address and the associated organization.
\emph{\textbf{Policies:}} Access control lists that grant access either from a source endpoint (user) or from a group of users (department) to a destination endpoint (resource). They are identified by a composite key (source-destination). Typically, the source endpoint is a user or department of another organization and the destination is a resource of the issuing organization. Policies can contain other information, such as the time frame in which the connection is allowed or an expiry time.
\subsubsection{Membership Service Provider}Each organization is identified by a MSP (Fabric's PKI for blockchain nodes).
\subsubsection{Chaincode}We imposed as a global constraint that only the organization that creates an asset can alter its state (e.g. delete, associate with another asset, etc). We enforce this by binding all assets to their respective MSP, and rejecting any modification from a non-owner MSP.
In addition, any organization within the same HL channel can query information about any asset of any organization in the chain.
\subsubsection{Endorsement policy}In our implementation, all members have to endorse any transaction. However, other schemes are possible thanks to Fabric's flexibility. Depending on the level of trust among the participating organizations and the particular use-case, we can adjust the minimum number of endorsements. Some examples are: half + 1 of the members, $2f + 1$ valid signatures out of $n$ endorsers (assuming $f$ faulty endorsers and $n>3f$), or AND/OR syntax (\texttt{member A OR members (B,C,D)}), etc.
\subsubsection{Ordering Service}We leveraged the SOLO ordering service (i.e. a centralized orderer), so we could ease development. However, in a production setup Apache Kafka could be a good fit, because it can tolerate several faulty or disconnected nodes.
In scenarios with low trust among participants, BFT ordering services can be easily plugged thanks to Fabric's modular design. However, we believe that a CFT algorithm is enough for this use-case since a double-spend does not make sense here\footnote{n.b. in a CFT environment some attacks, such as censoring a transaction, may become feasible}. In addition, HL's endorse-order-validate transaction lifecycle offers a variety of mechanisms to prevent or detect misbehavior.
\subsection{OpenOverlayRouter Software Router}
In order to effectively perform access control, we took advantage of an open-source LISP implementation, Open Overlay Router (OOR \cite{rodriguez2017programmable}). We made a slight modification to its Tunnel Router mode: when it receives a Map Request packet, it queries Hyperledger with the source and destination endpoints, via an ad-hoc API. Hyperledger checks if the pair of (source, destination) is allowed to establish a connection and notifies OOR. If they can connect, OOR then responds to the source with a Map Reply message, otherwise takes no action. This way, unauthorized users do not receive a response in the form of a Map Reply and do not know where to connect. Of course, a production setup requires additional security mechanisms, as outlined in section \ref{sec:network}.
\section{Experimental Evaluation}
\subsection{Scenario}
We set up an experimental scenario on a PC running Ubuntu 16.06 and a quad-core Intel i5 CPU 650 @ 3.20GHz. Table \ref{tab:setup} summarizes HL parameters during the experiment. Thanks to the Docker containerization of HL, we could emulate 4 organizations, each with 2 peers, all in the same PC. We artificially generated around 1 million policies and users to evaluate the read latency, and added at most 15 endorsers to estimate the write latency.
\begin{table}[tbp]
\caption{Experimental Setup}
\begin{center}
\begin{tabular}{|c|c|}
\hline
Number of organizations& 4\\
\hline
Typical key + value size & 32 bytes\\
\hline
Number of channels& 1\\
\hline
State database & LevelDB key-value store\\
\hline
\multirow{2}{*}{Endorsement Policy} & AND (Org1,Org2,\\
& Org3,Org4)\\
\hline
Ordering Service &SOLO \\
\hline
Block timeout & 100 ms\\
\hline
\end{tabular}
\label{tab:setup}
\end{center}
\end{table}
\subsection{Results}
We carried out several experiments on our implementation to characterize its performance and have an understanding of its scalability.
\textbf{\emph{Read latency: }}Fig. \ref{fig:query} presents the average query time for different number of elements in the chain. In this case the state DB was CouchDB\footnote{HL allows using both LevelDB and Couch DB as state DB, with similar performance.}. We can see that it revolves around 40 ms regardless of the number of elements, because Couch DB is a key-value store (these type of databases present constant query latency). It should be noted that the query performs exact matches of pairs of source and destination IP addresses, and that future work should also support longest-prefix matching.
\begin{figure}[tbp]
\centerline{\includegraphics[width=\columnwidth]{query_latency_bar}}
\caption{Hyperledger CouchDB query latency.}
\label{fig:query}
\end{figure}
\textbf{\emph{Write latency: }}Fig. \ref{fig:adduser} plots the time required to add a new user depending on the number of endorsers in the network. As we can see, the latency grows linearly with the number of endorsers, because each new endorser is an additional signature that the issuer has to verify (the current HL implementation makes this verification sequentially). This result is in line with in a recent benchmark of the HL platform \cite{thakkar2018performance}.
\begin{figure}[tbp]
\centerline{\includegraphics[width=\columnwidth]{delay-add-user-sec}}
\caption{Latency to add a new user for different number of endorsers.}
\label{fig:adduser}
\end{figure}
\textbf{\emph{Chain size: }}We were also interested in the chain size, i.e. required storage. Figs. \ref{fig:sizetx} and \ref{fig:sizeendorsers} show the total chain size depending on the number of transactions and endorsers, respectively. As expected, in both cases the size grows linearly with the number of transactions or endorsers (in the latter case because more endorsers mean more signatures per transaction). We can see that these situations require very modest storage. Thus, we can safely assume that scenarios with a considerable amount of participants (e.g. 1k endorsers would demand $\sim$25 GB) or a long transaction history (1M transactions take up $\sim$10 GB) can be easily supported.
\begin{figure}[tbp]
\centerline{\includegraphics[width=\columnwidth]{size_transactions}}
\caption{Chain size vs. number of transactions, in a setup with four endorsers. }
\label{fig:sizetx}
\end{figure}
\begin{figure}[tbp]
\centerline{\includegraphics[width=\columnwidth]{size_endorsers}}
\caption{Chain size depending on the number of required endorsers (5k transactions in the chain).}
\label{fig:sizeendorsers}
\end{figure}
\textbf{\emph{Network latency: }}Fig. \ref{fig:lisprtt} presents the query time CDF of a LISP control plane node (Map Server) storing 1k, 10k or 100k pairs of source, destination pairs. In other words, given a source node, how long does it take to find the authorized destination node(s). Since this test was performed in a local network, we consider the communication delay negligible.
We can see that the majority of the queries are completed in less than 0.35 ms, roughly two orders of magnitude below the HL database delay. This is mainly due to two reasons: (i) the Map Server is implemented in C (whereas the queries in fig. \ref{fig:query} go through HL's Node.js API, CouchDB and back) and (ii) data is stored in a Patricia Trie, a tree optimized for prefix queries. In addition, the delay is independent of the number of elements thanks again to the Patricia Trie: the delay depends on the length of the elements (source endpoints, IP addresses in our implementation), not the number.
\begin{figure}[tbp]
\centerline{\includegraphics[width=\columnwidth,trim={1.5cm, 0, 2.5cm, 1.5cm}, clip]{RTT_MS_paper_linear.eps}}
\caption{CDF for LISP Map Server query delay for 1k, 10k or 100k pairs of source, destination nodes.}
\label{fig:lisprtt}
\end{figure}
\subsection{Discussion}
The previous results demonstrate that the proposed system can easily scale to meet the demands of a federation of several organizations. Table \ref{tab:summary} outlines several metrics and their requirements in terms of scalability.
On one hand, both the read and network latencies can support high query rates. The read latency presents a constant response time regardless of the number of elements in the chain (in case of exact matches), and the network server storing the access policies, linear with the length of identifiers.
On the other hand, the write latency can suffer if we have a large amount organizations in the same blockchain. However, it is not as critical as the read latency because we can tolerate a delay up to several of seconds when adding a new user.
Finally, the chain size obviously depends linearly on the number of transactions, but also on the number of endorsers. This last relationship puts an additional strain on scalability, because it affects both chain size and write latency. There is a tradeoff here between a small number of endorsers (small write latency and chain size, but more centralized trust in a narrow set of participants), and a large number of them (higher write latency and size but more distributed trust). Thus, special consideration should be put in the number of endorsers and the endorsement policy to achieve an equilibrium between a tolerable write latency and the expected number of endorsements.
\begin{table}[tbp]
\caption{Scalability Analysis}
\begin{center}
\begin{tabular}{|c|c|}
\hline
Read latency & \multirow{2}{*}{constant} \\
(exact match) & \\
\hline
Write latency & linear w.r.t. number of org.\\
\hline
\multirow{2}{*}{Chain size} & linear w.r.t. number of\\
& transactions and endorsers\\
\hline
\multirow{2}{*}{Network latency} & linear w.r.t. identifier size\\
&+ propagation delay \\
\hline
\end{tabular}
\label{tab:summary}
\end{center}
\vspace{-0.75cm}
\end{table}
\section{Related Work}
There are already several proposals in the literature \cite{Bozic2016} that leverage blockchains for a wide range of network applications, such as mesh networks \cite{selimi2018towards}, IP addresses \cite{paillisse18}, etc.
The most closely related work to ours is \cite{francesco17}, which implements Attribute-Based Access Control (ABAC) policies over the Bitcoin blockchain. It presents three main differences with respect to our work: (i) it focuses on access control for individual users, unlike our organization-based approach, (ii) it allows transferring access control rights between users, and (iii) does not consider using a private chain or a different consensus algorithm. Hadi \cite{hashemi2017decentralized} proposes a data distribution system in which the blockchain is the data persistence layer, but is also user-centric and more oriented towards data storage and messaging services rather than networking.
Finally, there is also a growing body of work on blockchain-based access control for IoT: \cite{iotchain18} leverages a blockchain to store access permissions for IoT devices with a strong emphasis on key management and distribution. \cite{pinno18controlchain} also provides authentication, authorization and auditing for IoT but separates them in four independent blockchains, and is generic enough to support a wide range of access control models typical of IoT, while in this paper we concentrate on a specific language, GBP.
\section{Conclusion}
In this paper we have presented, implemented and evaluated an architecture to support access control in cross-domain communications. In order to reduce the burden on network administrators, the front-end builds on GBP, a well-known intent-driven language. A permissioned blockchain distributes network polices, and helps overcome drawbacks of conventional solutions while at the same time maintains the independence of each organization. Our experimental evaluation shows that this design can easily scale to -at least- tenths of organizations with modest storage requirements.
\section*{Acknowledgment}
This work has been supported by the Spanish MINECO under contract TEC2017-90034-C2-1-R (ALLIANCE) and the Catalan Institution for Research and Advanced Studies (ICREA).
\bibliographystyle{unsrtnat}
| {'timestamp': '2019-01-14T02:15:26', 'yymm': '1901', 'arxiv_id': '1901.03568', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03568'} | arxiv |
\section{Introduction}
In common clinical practice, the ECG is an important tool to diagnose a wide spectrum of cardiac disorders,
which are the leading health problem and cause of death worldwide by statistics~\cite{CVD}.
There are recent high-profile examples of Deep Neural Networks (DNNs)-powered approaches achieving parity with human cardiologists on ECG classification and diagnosis~\cite{Hannun2019Cardiologist,aivsdoctor,kiranyaz2016real,al2016deep}, which are superior to traditional classification methods.
Given enormous costs of healthcare, it is tempting to replace expensive manual ECG examining of cardiologists with a cheap and highly accurate deep learning system. In recent, the U.S. Food and Drug Administration has granted clearance to several deep learning-based ECG diagnostic systems such as AliveCor\footnote{\url{https://www.prnewswire.com/news-releases/fda-grants-first-ever-clearances-to-detect-bradycardia-and-tachycardia-on-a-personal-ecg-device-300835949.html}} and Biofourmis\footnote{\url{https://www.mobihealthnews.com/content/fda-clears-biofourmis-software-ecg-based-arrhythmia-detection}}.
With DNN's increasing adoption in ECG diagnosis, its potential vulnerability to `adversarial examples' also arouses great public concern.
The state-of-the-art literature has shown that to attack a DNN-based image classifier, an adversary can construct adversarial images by adding almost imperceptible perturbations to the input image. This misleads DNNs to misclassify them into an incorrect class~\cite{szegedy2013intriguing,goodfellow6572explaining,carlini2017towards}.
Such adversarial attacks would pose devastating threats to the DNN-powered ECG diagnosis system. On one hand, adversarial examples fool the system to give incorrect results so that the system fails to serve the purpose of diagnosis assistance. On the other hand, adversarial examples would breed medical frauds. The DNNs' outputs are expected to be utilized in other decision-making in medical system~\cite{finlayson2018adversarial}, including billing and reimbursement between hospitals/physicians and insurance companies. Large institutions or individual actors may exploit the system's blind spots on adversarial examples to inflate medical costs (e.g., exaggerate symptoms) for profit\footnote{\url{https://www.beckershospitalreview.com/legal-regulatory-issues/cardiologist-convicted-in-fountain-of-youth-billing-fraud-scam.html}}.
To our knowledge, previous literature on DNN model attacks mainly focus on the image domain, and has yet to thoroughly discuss the adversarial attacks on ECG recordings.
In this paper, we identify the distinct properties of ECGs, and investigate two types of adversarial attacks for DNN-based ECG classification system.
In Type I Attack, the adversary can access the ECG recordings and corrupt them by adding perturbations.
One possible case is a cardiologist who can access patients' ECGs and have monetary incentive to manipulate them to fool the checking system of insurance companies.
Another possible case is a hacker who intercept and corrupt data to attack a cloud-deployed ECG diagnosis system for fun or profit. That data may be uploaded from portable patches like Life Signal LP1100 or household medical instruments like Heal Force ECG monitor
to the cloud-deployed algorithms for analysis.
For both cases, the adversary aims to engineer ECGs so that the ECG classification system is mislead to give the diagnosis that he/she desires, and in the meanwhile, the data perturbations should be sufficiently subtle that they are either imperceptible to humans, or if perceptible, seems natural and not representative of an attack.
We found that simply applying existing image-targeted attacks on ECG recordings generates suspicious adversarial instances, because commonly-used $L_p$ norm in image domain to encourage visual imperceptibility is unsuitable for ECGs (see Figure~\ref{fig:sample}).
In visualization, each value in an ECG represents the voltage of a sampling point which is visualized as a line curve. Meanwhile, each value in a image represents the grayscale or RGB value of a pixel which is visualized as the corresponding color. Humans have different perceptual sensitivities to colors and line curves. As shown in Fig.~\ref{fig:grayscale}, when two data arrays are visualized as line curves, their differences are more prominent rather than those visualized as gray-scale images. In this paper, we propose smoothness metrics to quantify perceptual similarities of line curves, and leverages them to generate unsuspicious adversarial ECG instances.
\begin{figure}[h]
\centering
\includegraphics[width=0.32\textwidth]{grayscale1.png}
\caption{Perception test. There are two data arrays in the range of $[-1, 1]$, and the second one is obtained by adding a few perturbations with $0.1$ amplitude to the first one. Both of them are visualized as line curves and gray-scale images.}
\label{fig:grayscale}
\end{figure}
It is worth mentioning the difference between adversarial attacks and simple substitution attacks. In substitution attack, the adversary replaces the victim ECG with ECG of another subject with the target class. However, the ECGs, as a kind of biomedical signs, are often unique to their owners as fingerprint~\cite{odinaka2012ecg}. Thus, the simple substitution attacks can be effectively defended if the system checks input ECGs against prior recordings from the same patient. However, the adversarial attacks only add subtle perturbations without substantially altering the personal identifier (Figure~\ref{fig:sub}).
\begin{figure}[h]
\centering
\includegraphics[width=0.46\textwidth]{comparesubattack.png}
\caption{Adversarial Attack v.s. Substitution attack}
\label{fig:sub}
\end{figure}
In Type II Attack, the adversary may not be able to access the ECGs directly or they want to fool the system without leaving digital tampering footage. Thus, the attackers inject perturbation to on-the-fly ECGs by physical process. The feasibility of such attacks can be achieved by EMI signal injection as in~\cite{kune2013ghost}, which meant to pollute ECGs but did not consider crafting injected signals for adversarial attacks. Due to lack of equipment like patient simulator, we could not implement their prototype to conduct physical attacks. However, we identify four major properties of such attack that different from Type I, explicitly consider them in attacking strategy and mimic them in evaluation.
\begin{enumerate}[topsep=0pt]
\item There is skewing in time domain between perturbation and ECG, since the attacker hardly knows ECG’s exact start time. We mimic it by shifting perturbation with various amount before adding to victim ECGs.
\item Filtering of ECG devices, as a standard process to combat noise, will be applied on injected perturbation and may impair its attack effect. In evaluation, two widely-adopted filters are applied to adversarial examples. The rectangular filter is used in generation process, since it strictly removes all power within selected frequency range.
\item Type I accesses digital ECGs without showing up on the scene, but physical injection should be conducted closer to victim. The smaller attack duration(the part of an ECG affected by perturbation), the lower exposure risk. Thus we generate perturbation with different attack duration for evaluation.
\item Physical attacks inject perturbation generated from known ECGs to on-the-fly ECGs. The variance between them may affect attack effect. In evaluation, perturbation generated with random selected ECGs are tested on others.
\end{enumerate}
In summary, the contributions of this paper are as follows:
\begin{itemize}
\item This paper thoroughly investigate adversarial attacks for DNN-based ECG classification systems. We identify the distinct properties of ECGs to facilitate designing effective attack schemes under two attack models respectively.
\item We propose a smoothness metric to effectively quantify human perceptual distance on line cures, which quantifies the pattern similarity in a computationally-efficient way. Adversarial attacks using the smoothness metric achieve a 99.9\% success attack rate. In addition, we conduct an extensive human perceptual study on both ordinary people and cardiologists to evaluate the imperceptibility of adversarial ECG instances.
\item We model the sampling point uncertainty of the on-the-fly ECGs and the filtering effect within the adversarial generation scheme. The generated perturbations are skewing-resistant and filtering-resistant to tamper with on-the-fly signals (99.64\% success rate), and generalize well in unseen examples.
\end{itemize}
\section{Related Works}
Here we review recent works on adversarial examples, and the existing arrhythmia classification systems.
\subsection{Adversarial Examples}
Recently, considerable attack strategies have been proposed to generate adversarial examples.
Attacks can be classified into targeted and untargeted ones based on the adversarial goal. The adversary of the former modifies an input to mislead the targeted model to classify the perturbed input into a chosen class, while the adversary of the latter make the perturbed input misclassified to any class other than the ground truth. In this paper, we only focus on the more powerful targeted attacks.
Based on the accessibility to the target model, the existing attacks fall into white-box and black-box attacks categories. In former manner, an adversary has complete access to a classifier~\cite{szegedy2013intriguing,goodfellow6572explaining,moosavi2016deepfool,carlini2017towards,kurakin2018adversarial}, while in latter manner, an adversary has zero knowledge about them~\cite{papernot2016transferability,moosavi2017universal,liu2016delving}. This paper studies the white-box adversarial attacks to explore the upper bound of an adversary to better motivate defense methods. Besides, prior works~\cite{papernot2016transferability,liu2016delving} have shown the transferability of adversarial attacks, i.e, train a substitute model given black-box access to a target model, and transfer the attacks to it by attacking the substitute one.
Adversarial attacks have been studied most in image domain. However, in other domains, these attack schemes may lose effect, e.g., \cite{qin2019imperceptible} identifies unique problems on speech recognition and leverages properties of human auditory system to generate audio adversarial examples. This paper, however, focuses on adversarial attacks on ECG diagnosis, another important application domain of DNN.
In the image domain, most works adopted $L_p$ norm as approximations of human perceptual distance to constrain the distortion. However, for ECGs in time-series format, people focus more on the overall pattern/shape, which can not be fully described by $L_p$ norm~\cite{eichmann2015evaluating,gogolou2018comparing} (see Section `Similarity Metrics' for details).
Recent works~\cite{kurakin2018adversarial,athalye2018synthesizing,chen2018robust} have explored the robustness of the adversarial examples in the physical world, where the input images could not be precisely controlled, and may change under different viewpoints, lighting and camera noise.
Our strategy on Type II attack is inspired by~\cite{athalye2018synthesizing,brown2017adversarial}. Different from images, we deal with sampling point uncertainty of the periodic ECGs and the filtering function of ECG devices.
Recent works on GAN-based attacks~\cite{xiao2018generating,song2018constructing} focus on improve attacking efficiency to image classification system, which can be combined with metric computation efficiency of ECGadv in future work.
A workshop paper~\cite{hanadversarial} convolves perturbation with Gaussian kernels for ECG adversarial attacks. Our proposed smoothness metric and Gaussian kernels method can be integrated to improve the system. Besides, our paper further addresses the issues in physical ECG attacks.
For the emerging defense methods, ~\cite{athalye2018obfuscated} proposed a general framework to circumvent several published defenses based on randomly transforming the input. Thus, we do not discuss defense breaking in this paper.
\subsection{Arrhythmia Classification System}
Considerable efforts have been made on automated arrhythmia classification systems to take over tedious manual examinations.
Deep learning methods show great potential
due to their ability to automatically learn features through multiple levels of abstraction, which frees the system from the dependence on hand-engineered features.
Recent works~\cite{kiranyaz2016real,al2016deep,Hannun2019Cardiologist} started applying DNN models on ECG signals for arrhythmia classification and achieved good performance.
For any system in the health-care field, it is crucial to defend against any possible attacks since people's lives rely heavily on the system's reliability. Prior work~\cite{kune2013ghost} has launched attacks to pollute the measurement of cardiac devices by a low-power emission of chosen electromagnetic waveforms.
The adversarial attacks and the injection attacks in~\cite{kune2013ghost} complement each other. The injection attack can inject the carefully-crafted perturbation generated by adversarial attacks to perform targeted attacks to mislead the arrhythmia classification system.
\section{Technical Approach}
In this section, we illustrate our attack strategies for two threat models respectively.
\subsection{Type I Attack Strategy}
\label{sec:metric}
\subsubsection{Problem Formulation}
Given an m-class classifier, $g : \mathcal{X} \to \mathcal{Y}$ that accepts an input $x \in \mathcal{X}$ and produces an output $y \in \mathcal{Y}$. The output vector $y$, treated as the probability distribution, satisfies $0 \leq y_i \leq 1$ and $\sum_{i=1}^{m} y_i = 1$. The classifier assigns the label $\mathit{C}(x) = \mathrm{argmax}_i g(x)_i$ to the input $x$.
Let $\mathit{C}^*(x)$ be the correct label of $x$.
Given a valid input $x$ and a target class $t \ne \mathit{C}^*(x)$, an adversary aims to generate adversarial examples $x_{adv}$ so that the classifier predicts $g(x_{adv}) = t$ (\textit{i.e.} successful attack), and $x_{adv}$ and $x$ are close based on the similarity metric (\textit{i.e.} visual imperceptibility).
It can be modeled as a constrained minimization problem as seen in prior works~\cite{szegedy2013intriguing}:
\begin{equation}
\begin{split}
& \mathrm{minimize} \text{ } \mathcal{D}(x, x_{adv}) \\
& \mathrm{such} \text{ } \mathrm{that} \text{ } \mathit{C}(x_{adv}) = t
\end{split}
\end{equation}
where $\mathcal{D}$ is some similarity metric. It is worth mentioning that there is no box constraints for time-series measurement.
It is equivalent to solve~\cite{carlini2017towards}:
\begin{equation}
\begin{split}
& \mathrm{minimize} \text{ } \mathcal{D}(x, x_{adv}) + c \cdot \mathit{f}_{g}(x_{adv}) \\
\end{split}
\end{equation}
where $ \mathit{f}_{g}$ is an objective function mapping the input to a positive number, which satisfies $\mathit{f}_{g}(x_{adv}) \leq 0$ if and only if $ \mathit{C}(x_{adv}) = t$.
One common objective function is cross-entropy. We adopt the one in~\cite{carlini2017towards}.
\begin{equation}
\mathit{f}_{g}(x_{adv}) = (\mathrm{max}_{i \ne t}(Z(x_{adv})_i) - Z(x_{adv})_t)^+
\end{equation}
where $Z(x) = z$ is logits, \textit{i.e.}, the output of all layers except the softmax. $(e)^+$ is short-hand for $\mathrm{max}(e, 0)$.
\subsubsection{Similarity Metrics}
\label{sec:metric}
To generate adversarial examples, we require a distance metric to quantify perceptual similarity to encourage visual imperceptibility. The widely-adopted distance metrics in the literature are $L_p$ norms $\Vert x_{adv}-x \Vert _p$, where the p-norm $\Vert \cdot \Vert_p$ is defined as
$\Vert v \Vert _p = (\sum^n_{i=1} \vert v_i \vert ^p) ^{\frac{1}{p}}$.
$L_p$ norms focus on the change in each pixel value. However, human perception on line curves focuses more on the overall pattern/shape. Studies in ~\cite{eichmann2015evaluating,gogolou2018comparing} show that given a group of line curves for similarity assessment, pattern-focused distance metrics like the Dynamic time warping (DTW)-based ones produce rankings that are closer to the human-annotated rankings than value-focused metrics like Euclidean distances.
Thus, we consider using DTW to quantify the similarity of ECGs at first. However, the non-differentiability and non-parallelism of DTW make it ill-suited for adversarial attacks.
Recent work~\cite{cuturi2017soft} proposes a differentiable DTW variant, Soft-DTW. However, Soft-DTW does not change the essence of DTW -- a standard dynamic programming problem. The value and gradient of Soft-DTW would be computed in quadratic time, and it is hard to leverage the parallel computing of the GPU to speed it up.
To capture the pattern similarity in a computation-efficient way, we adopt the following metric, denoted as \textit{smoothness} as our similarity metric. Given $\delta = x_{adv} - x $ and $var(\cdot)$ refers to variance calculation:
\begin{equation}
\label{eq:smooth}
\begin{split}
& \mathit{diff}(\delta) = {\delta_i - \delta_{i-1}}, i=2, \dots ,n \\
& d_{\mathrm{smooth}}(\delta) = \mathrm{var}(\mathit{diff}(\delta)) \\
\end{split}
\end{equation}
Smoothness metric $d_\mathrm{smooth}$ quantifies the smoothness of perturbation($\delta$) by measuring the variation of the difference between neighbouring points of perturbation.
The smaller the variation, the smoother the perturbation. A smoother perturbation $\delta$ means that the adversarial instances $x'$ are more likely to preserve a similar pattern to the original instance $x$. In the extreme case where $d_\mathrm{smooth} = 0$, $\delta$ should be a constant and $x_{adv} = x + \mathrm{constant}$, \textit{i.e.}, the adversarial instances $x_{adv}$ have the same shape as the original instance $x$.
It is worth mentioning that in our attack scheme, we intentionally preserve the zero-mean and one-variance property of the generated $x_{adv}$, therefore the perturbation can not be easily filtered by the normalization layer of the system.
Besides, compared with the quadratic time complexity of Soft-DTW, the smoothness metric can be computed in linear time, which is efficient in principle. To further quantify the efficiency, we run the adversarial attacks with different metrics: Soft-DTW, smoothness metric and $L_2$ norm. Both the computing resources (AWS c5.2xlarge instances) and the victim ECGs are the same. The average CPU time per iteration of different metrics are shown in Table~\ref{tab:metriccomp}. The smoothness metric can be further accelerated by GPU.
\renewcommand{\arraystretch}{1.1}
\begin{table}[h]
\begin{center}
\begin{tabular}{ |c|c|c|c|}
\hline
Metric & $d_{\mathrm{softdtw}}$ & $d_{\mathrm{smooth}}$& $d_{\mathrm{l2}}$ \\
\hline
CPU time/iteration & 12.28s & 0.05s & 0.05s \\
\hline
\end{tabular}
\end{center}
\caption{Computation Efficiency across Different Metrics}
\label{tab:metriccomp}
\end{table}
\subsection{Type II Attack Strategy}
\label{sec:local}
\subsubsection{Problem Formulation}
Given the same m-class classifier, $g : \mathcal{X} \to \mathcal{Y}$ as above, in Type II attack,
we explicitly consider the filtering process in attack scheme. Filtering is a standard process in ECG devices to combat noises before the data analysis, including baseline wandering noises ($<$0.05Hz) and the power-line noises (50 or 60 Hz)~\cite{luo2010review}. To generate filtering-resistant perturbations, we constrain the power of the perturbation within those filtered frequency bands during the optimization procedure.
We also consider the possible skewing to generate perturbations that are effective for the on-the-fly ECGs, since it is hard for the attacker to obtain the exact time that the device begins measuring ECGs.
Inspired by \textit{Expectation Over Transformation(EOT)}~\cite{athalye2018synthesizing}, we regard such uncertainty as a shifting transformation of the original measurement and explicitly consider such a transformation within the optimization procedure.
Formally, given a distance function $\mathcal{D(\cdot, \cdot)}$ and a chosen distribution $\mathit{T}$ of transformation function $t$, we have the following optimization problem:
\begin{equation}
\begin{split}
\mathrm{minimize} \text{ } &\mathbb{E}_{t \sim T}[\mathcal{D}(t(x_{adv}), t(x))] + \\
& c \cdot \mathbb{E}_{t \sim T}[-\log P(y_t|t(x_{adv}))]\\
\end{split}
\end{equation}
where $x_{adv} = x + h(x_{perturb})$. $x_{perturb}$ is the added perturbation and $h(\cdot)$ is a rectangular filter. Specifically, we transform the $x_{perturb}$ from time domain to frequency domain via Fast Fourier transform. We utilize a mask to zero the power of frequency bins for less than 0.05Hz and 50/60Hz. Finally, inverse Fast Fourier transform will transform it back to the time domain.
Besides, we add a constraint $ \epsilon_1 < \mathbb{E}_{t \sim T}[\mathcal{D}(t(x_{adv}), t(x))] < \epsilon_2$. $\epsilon_1$ is large enough that $x_{adv}$ can have a large probability of successful attacks under most shifting transformations. Since the ECG signals of the same class share common pattern, a sufficiently large $\epsilon_1$ can implicitly enable the universality of an adversarial sample, \textit{i.e.}, a perturbation is effective on other unseen samples of the same class. $\epsilon_2$ forces the adversarial examples to be within a certain distance constraint of the original.
\subsubsection{Perturbation Window Size}
For adversarial attacks, it is better that the perturbation attracts minimal attention of the victim. Thus, we introduce the length of the perturbation $w_d$ as a parameter, which could be set by the adversary and fixed during the perturbation generation.
$w_d$ gives the system flexibility to control the added perturbation. The intuition behind is that the smaller $w_d$ is, the smaller the attack duration. Attack duration denotes the time when the attacker try to inject the signal. It is obviously that the less time the attacker stays active in the crime scene, the less chance it will be perceived by the victim.
Moreover, the larger $w_d$ is, the generated perturbation has higher probability of having an effect on other unseen samples of the same class(\textit{i.e.}, universality).
\section{Experimental Results}
In this section, we first introduce the victim DNN-based ECG classification system for attack scheme evaluation, then evaluate our attacks in two threat models respectively\footnote{\url{https://github.com/codespace123/ECGadv}}.
\subsection{Victim DNN-powered ECG Diagnosis Model}
\label{sec:targetmodel}
We apply our attack strategies to the DNN-based arrhythmia classification system~\cite{rajpurkar2017cardiologist,andreotti2017comparing,Hannun2019Cardiologist}.
An arrhythmia is defined as any rhythm other than a normal rhythm.
If the detection algorithm is mislead to classify an arrhythmia as a normal one, the patient may miss the optimal treatment period. Conversely if a normal rhythm is misclassified as an arrhythmia, the patient may accept unnecessary consultation and treatment, which results in medical resources waste or frauds.
The original model~\cite{rajpurkar2017cardiologist} adopts 34-layer Residual Networks (ResNet)~\cite{he2016deep} to classify a 30s single-lead ECG segment into 14 different classes. However, their dataset and trained model are not public. In the Physionet/Computing in the Cardiology Challenge 2017~\cite{clifford2017af}, \cite{andreotti2017comparing} reproduced the approach by ~\cite{rajpurkar2017cardiologist} on the PhyDB dataset and achieved a good performance. The model is the representative of the current state-of-the-art in arrhythmia classification. Both their algorithm and model are available in open-source\footnote{\url{https://github.com/fernandoandreotti/cinc-challenge2017}}.
PhyDB dataset consists of 8,528 short single-lead ECG segments labeled as 4 classes: normal rhythm(N), atrial fibrillation(A), other rhythm(O) and noise($\backsim$). Both atrial fibrillation and other rhythm indicates arrhythmia. Atrial fibrillation is the most prevalent cardiac arrhythmia. ``Other rhythm'' in the dataset refers to other abnormal arrhythmia except atrial fibrillation.
For note, the accuracy of this model is not 100\% on the PhyDB dataset. Thus, to prove the effectiveness of the proposed attacks, we only generate adversarial examples for those ECGs originally correctly classified by the model without attacks. The profile of the attack dataset is shown in Table~\ref{tab:profile} (6081 ECGs in total). The sampling rate of the ECGs is 300Hz, \textit{i.e.}, the length of a 30s ECG is 9000.
\subsection{Evaluation for Type I Attack}
\label{sec:cloud_eval}
\subsubsection{Experiment Setup}
We implement our attack strategy for Type I Attack under the framework of CleverHans~\cite{papernot2018cleverhans}. We adopt the Adam optimizer~\cite{kingma2014adam} with $0.005$ learning rate to search for adversarial examples.
We compare the performance of three similarity metrics on adversarial examples generation, given $\delta = x_{adv} - x$: (i) $d_\mathrm{l2}(\delta) = \Vert \delta \Vert_2^2$, (ii)$d_{\mathrm{smooth}}(\delta)$ (Equation~\ref{eq:smooth}), (iii) $d_\mathrm{smooth, l2}(\delta)$ = $d_\mathrm{smooth}(\delta) + k \cdot d_\mathrm{l2}(\delta)$, $k=0.01$.
All metrics are evaluated under the same optimization scheme with the same hyper-parameters.
\begin{table}[h]
\begin{center}
\begin{tabular}{ |c|c|c|c|}
\hline
\multirow{2}{*}{Type} & \multirow{2}{*}{Number} & \multicolumn{2}{|c|}{Time length (s)} \\
\cline{3-4}
& & mean & std \\
\hline
Normal rhythm(N)& 3886 & 32.85 & 9.70 \\
Atrial Fibrillation(A) & 447 & 32.25 & 11.98\\
Other rhythm(O) & 1488 & 35.46 & 11.56\\
Noisy signal($\backsim$) & 260 & 24.02 & 10.42 \\
\hline
\end{tabular}
\end{center}
\caption{Data profile for the attack dataset}
\label{tab:profile}
\end{table}
\renewcommand{\arraystretch}{1.2}
\begin{table*}[h]
\begin{center}
\begin{tabular}{ |c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
\hline
\multirow{2}{*}{} & \multicolumn{4}{|c|}{$d_\mathrm{l2}$} & \multicolumn{4}{|c|}{$d_\mathrm{smooth}$} & \multicolumn{4}{|c|}{$d_\mathrm{smooth, l2}$} \\
\cline{2-13}
& A & N & O & $\backsim$ & A & N & O & $\backsim$ & A & N & O & $\backsim$ \\
\hline
A & / & 97.22\% & 100\% & 100\% & / & 100\% & 100\% & 100\% & / & 100.0\% & 100.0\% & 100.0\% \\
\hline
N & 100\% & / & 100\% & 100\% & 100\% & /& 100\% & 100\% & 100\% & / & 100\% & 100\% \\
\hline
O & 99.44\% & 95.0\% & / & 100\% & 99.72\% & 100\% & / & 100\% & 100\% & 100\% & / & 100\% \\
\hline
$\backsim$ & 100\% & 99.55\% & 100\% & / & 100\% & 100\% & 100\% & / & 100\% & 100\% & 100\% & / \\
\hline
\end{tabular}
\end{center}
\caption{Success rates of targeted attacks (Type I Attack)}
\label{tab:success}
\end{table*}
\subsubsection{Success Rate of Targeted Attacks}
We select the first 360 segments of class N, class A and class O respectively, and the first 220 segments of class $\backsim$ in attack dataset to evaluate the success rate of the targeted attacks. For each ECG segment, we conduct three targeted attacks to other classes one by one. Thus, we have 12 source-target pairs given 4 classes. The attack results are shown in Table~\ref{tab:success}.
With all three similarity metrics, the generated adversarial instances achieve high attack success rates. $d_\mathrm{l2}$ fails in a few instances of some source-target pairs, such as ``O $\rightarrow$ A'', ``A $\rightarrow$ N'', ``O $\rightarrow$ N'' and ``$\backsim$ $\rightarrow$ N''. $d_{\mathrm{smooth}}$ case achieves almost a 100\% success rate and $d_\mathrm{smooth, l2}$ achieves a 100\% success rate.
A sample of generated adversarial ECG signals are shown in Fig.~\ref{fig:sample}. Due to the limited space, we only show a case where an original atrial fibrillation ECG(A) is misclassified to a normal rhythm(N). Compared with original ECG, $d_\mathrm{l2}$ one presents small but consecutive peaks at multiple locations, which are almost impossible in cardiac rhythms. While the $d_\mathrm{smooth}$ one presents smooth signal transition and preserves more similar pattern to the original.
It is also noticed that the Soft-DTW one present suspicious spikes, the extent of which falls in between L2-norm and `smoothness+L2' cases.
Table~\ref{tab:metriccomp} shows CPU time per iteration of softDTW is about 12 seconds, and it takes hundreds of iterations to generate one example. It is time-consuming to generate large number of them (600 in our perceptual study) using softDTW. Since the proposed attacks as shown in Table~\ref{tab:success} almost achieve 100\% success rate, without affecting major conclusions, we exclude softDTW in evaluation.
\subsubsection{Human Perceptual Study}
\label{sec:amt}
We conduct an extensive human perceptual study on both ordinary people and cardiologists to evaluate the imperceptibility of adversarial ECGs.
Ordinary human participants without medical expertise are recruited from Amazon Mechanical Turk(AMT). Thus, they are only required to compare the adversarial examples generated using different similarity metrics and choose the one closer to the original ECG.
For each similarity metric, we generate 600 adversarial examples (each source-target pair accounts for 50 examples). In the study, the participants are asked to observe an original example and its two adversarial ones generated using two different similarity metrics. Then they need to choose one of the two adversarial examples that is closer to the original.
The perceptual study comprises three parts, (\romannumeral 1) $d_\mathrm{smooth}$ versus $d_\mathrm{l2}$, (\romannumeral 2) $d_\mathrm{smooth, l2} $ versus $d_\mathrm{l2}$, and (\romannumeral 3) $d_\mathrm{smooth}$ versus $d_\mathrm{smooth, l2}$.
To avoid labeling bias, we allow each user to conduct at most 60 trials for each part. For each tuple of an original example and its two adversarial examples, we collect 5 annotations from different participants.
In total, we collected 9000 annotations from 57 AMT users. The study results are shown in Table \ref{tab:subjective}, where ``triumphs" denotes the metric got 4 or 5 votes for all 5 annotations, and ``wins'' denotes that the metric got 3 votes for 5, \textit{i.e.}, a narrow victory.
\renewcommand{\arraystretch}{1.2}
\begin{table}[h]
\begin{center}
\resizebox{\linewidth}{!}{%
\begin{tabular}{ |c|c|c|c|c|c|c|}
\hline
\multirow{3}{*}{\romannumeral 1} & \multicolumn{3}{|c|}{$d_\mathrm{smooth}$ wins(\%)} & \multicolumn{3}{|c|}{ $d_\mathrm{l2}$ wins(\%)} \\
\cline{2-7}
& triumphs & wins & total & triumphs & wins & total \\
\cline{2-7}
& 58.67 & 22.67 & 81.34 & 10 & 8.66 & 18.66 \\
\hline
\hline
\multirow{3}{*}{\romannumeral 2} & \multicolumn{3}{|c|}{$d_\mathrm{smooth, l2}$ wins(\%)} & \multicolumn{3}{|c|}{ $d_\mathrm{l2}$ wins(\%)} \\
\cline{2-7}
& triumphs & wins & total & triumphs & wins & total \\
\cline{2-7}
& 65.5 & 18.5 & 84 & 7.83 & 8.17 & 16 \\
\hline
\hline
\multirow{3}{*}{\romannumeral 3} & \multicolumn{3}{|c|}{$d_\mathrm{smooth}$ wins(\%)} & \multicolumn{3}{|c|}{ $d_\mathrm{smooth, l2}$ wins(\%)} \\
\cline{2-7}
& triumphs & wins & total & triumphs & wins & total \\
\cline{2-7}
& 31.83 & 27.83 & 59.67 & 15.83 & 24.5 & 40.33\\
\hline
\end{tabular}}
\end{center}
\caption{Human perceptual study (AMT participants)}
\label{tab:subjective}
\end{table}
Compared with the $d_\mathrm{l2}$-generated examples, the $d_\mathrm{smooth}$-generated ones are voted closer to the original in 81.34\% of the trials.
This indicates that the smoothness metric encourages generated adversarial examples preserve similar patterns to original ones, so they are more likely to be imperceptible.
When comparing $d_\mathrm{smooth}$ and $d_\mathrm{smooth, l2}$, $d_\mathrm{smooth}$ get a few more votes (59.67\%) than $d_\mathrm{smooth, l2}$, which further validates that the smoothness metric better qualifies human similarity perception on line curves than $L_2$ norm.
The data provide sufficient evidence (p values $<$ 0.0001 using z-test) at the 5\% level of significance to conclude that most people think $d_\mathrm{smooth}$ is more imperceptible than $d_\mathrm{l2}$ and $d_\mathrm{smooth, l2}$.
Besides participants on AMT, we also invite three cardiologists to evaluate whether added perturbations arouse their suspicion.
The cardiologists are asked to classify the given ECG and its adversarial counterparts into 4 classes(A, N, O, $\backsim$) based on their medical expertise.
We focus on the cases of ``N $\rightarrow$ A'', ``N $\rightarrow$ O'', ``A $\rightarrow$ N'', ``O $\rightarrow$ N'', which misclassify a normal rhythm to an arrhythmia or vise versa. For the above 4 source-target pairs, we randomly select 6 type N, 3 type A and 3 type O, then we generate adversarial examples with different similarity metrics. Thus, we have 48 samples (original and adversarial ones) and shuffle them randomly. For every sample, we collect annotations from all three cardiologists. The results are shown in Table~\ref{tab:subjective_2}.
\begin{table}[h]
\begin{center}
\begin{tabular}{|c|c|c|c|c|}
\hline
Idx & Original & $d_\mathrm{l2}$ & $d_\mathrm{smooth}$ & $d_\mathrm{smooth, l2}$ \\
\hline
1 & 100\% & 100\% & 100\% & 100\% \\
\hline
2 & 91.7\% & 100\% & 100\% & 100\% \\
\hline
3 & 100\% & 100\% & 100\% & 100\% \\
\hline
\end{tabular}
\end{center}
\caption{Human Perceptual Study (Cardiologists)}
\label{tab:subjective_2}
\end{table}
Each row refers to one cardiologist. The first column denotes the percentage of the cardiologist's annotations the same as the labels in PhyDB dataset. Only one cardiologist annotates a type A instance as type O. The last three columns show the percentage of adversarial examples which are annotated the same type as their original counterparts.
The results show that in all cases, cardiologists give the same annotations to adversarial examples as their original counterparts. The possible reason is that most perturbations generally occur on the wave valley, but the cardiologists give annotations based on the peak-to-peak intervals. They think the subtle perturbations possibly caused by instrument noise. The results that adversarial signals can be correctly classified by cardiologists but wrongly classified by the classifier prove that our attacks successfully fool the classifier to disable its function of diagnosis assistance without arousing suspicion.
\begin{figure*}[h]
\begin{minipage}{0.61\textwidth}
\centering
\includegraphics[width=0.98\textwidth]{R3863-1.png}
\caption{A sample of generated adversarial ECG signal.}
\label{fig:sample}
\end{minipage}
\begin{minipage}{0.39\textwidth}
\centering
\includegraphics[width=\textwidth]{window_size.png}
\caption{Success attack rates with different sized windows.}
\label{fig:wd}
\end{minipage}
\end{figure*}
\subsection{Evaluation for Type II Attack}
\label{sec:local_eval}
\subsubsection{Success Rate of Targeted Attacks}
We implement our attack strategy for Type II attack under the framework of CleverHans~\cite{papernot2018cleverhans}.
During training, we maximize the objective function using the Adam~\cite{kingma2014adam} optimizer, and approximate the gradient of the expected value through independently sampling transformations at each gradient decent step.
Among 12 source-target pairs, we randomly choose 10 samples of each pair to generate adversarial
perturbations by applying the attack strategy in Section~\ref{sec:local}. We generate one perturbation from one sample. To generate filtering-resistant perturbation, we use rectangular filter that removes the signal with frequency of lower than 0.05Hz and 50/60Hz. Because the rectangular filter can remove all the energy within the chosen frequency band which is stricter than other filters. In this evaluation, we generate the perturbation at full length, \textit{i.e.}, $w_d$ is equal to 9000.
During testing, we apply the generated perturbations to 100 randomly-chosen samples from every source class to see whether the adversarial examples could mislead the classifier universally. By source class, we mean the chosen testing sample has the same class with training sample generating perturbation.
Before adding perturbations to the target sample, we apply a filter on the perturbations to test the filtering-resistance. The filter has two choices: Filter 1 is the rectangular filter which is the same as the training procedure. Filter 2 is the combination of two common filters used in ECG signal processing, a high-pass butterworth filter with 0.05Hz cutting frequency and notch filters for 50/60Hz power line noises.
To mimic the sampling point uncertainty of the on-the-fly signals, we randomly shift perturbations and add them to the original signals for 200 times.The average success rates are shown in Table~\ref{tab:success_local}. The row refers to origin class and the column refers to target class. In one cell, the top success attack rate is for filter 1 and the bottom is for filter 2.
Our attack strategy achieves pretty high success rates, which indicates that the generated perturbation is filtering-resistant, skewing-resistant and universal.
\begin{table}[h]
\begin{center}
\begin{tabular}{|c|c|c|c|c|}
\hline
& A & N & O & $\backsim$ \\
\hline
A & / & \makecell{99.97\%/\\99.96\%} & \makecell{99.82\%/\\99.86\%} & \makecell{100\%/\\100\%} \\
\hline
N & \makecell{100\%/\\100\%} & / & \makecell{100\%/\\100\%} & \makecell{99.83\%/\\99.75\%} \\
\hline
O & \makecell{100\%/\\100\%} & \makecell{99.76\%/\\99.73\%} & / & \makecell{100\%/\\100\%} \\
\hline
$\backsim$ & \makecell{100\%/\\100\%} & \makecell{97.63\%/\\97.45\%} & \makecell{98.70\%/\\98.76\%} & / \\
\hline
\end{tabular}
\end{center}
\caption{Success rates of targeted attacks (Type II Attack)}
\label{tab:success_local}
\end{table}
\subsubsection{Impact of Window Size}
\label{sec:local_factor}
In this section, we evaluate the success attack rates with different sized windows $w_d$.
As mentioned before, the smaller the window size, the lower the chance that the attacker can be perceived. In this evaluation, we generate perturbations on different sized windows 9000,7500,6000,4500,3000 and 1500. For each window size, we generate adversarial examples under the same conditions as the previous section – randomly 10 samples for each source-target pairs. Then we apply filters, shift the perturbation randomly and add it to other samples from the original source class. The results are shown in Figure~\ref{fig:wd}. The legend refers to target class under different filters. In most cases, the success rate decreases a lot when the window size decreases. However, they slowly decrease and even remain almost unchanged under the cases of ``A $\rightarrow$ O'', ``N $\rightarrow$ O''
and ``$\backsim$ $\rightarrow$ O''. All these cases are from a certain class to class O. This is mainly because class O (refers to other abnormal arrhythmia except atrial fibrillation) may cover an expansive input space so that it is easier to misclassify an other class to class O.
Besides, we find that except for class O, the success rate decrease more slowly when the target class is A.
The possible reason is the inherent property of class A, \textit{i.e.}, if a certain part of the ECG signal is regraded as atrial fibrillation, then the whole ECG segment will be classified as class A. The success attack rates under different filters are quite similar, which shows the filtering-resistance of our generated perturbations.
\section{Conclusion}
This paper proposes ECGadv to generate adversarial ECG examples to misguide arrhythmia classification systems.
The existing attacks in image domain could not be directly applicable due to the distinct properties of ECGs in visualization and dynamic properties.
We analyze the properties of ECGs to design effective attacks schemes under two attacks models respectively.
Our results demonstrate the blind spots of DNN-powered diagnosis systems under adversarial attacks to call attention to adequate countermeasures.
\subsubsection{Acknowledgment}
This work was supported in part by the RGC under Contract CERG 16203719, 16204418 and in part by the Guangdong Natural Science Foundation No. 2017A030312008.
\bibliographystyle{aaai}
| {'timestamp': '2020-01-15T02:10:40', 'yymm': '1901', 'arxiv_id': '1901.03808', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03808'} | arxiv |
\section{Einleitung}
\section{Introduction}
The ambition for making excellent wines has a very long
history \cite{pellechia2006wine} and focuses on the crucial step of a `perfect' alcoholic fermentation.
For this quest, also mathematics is contributing by
investigating models consisting of systems of ordinary differential equations (ODEs) that describe the kinetics of the bio-chemical reactions occurring in the fermentation process
and provide the starting point for an emerging control technology that aims at improving the quality of
the wine by steering a well-behaved fermentation process that is also energetically more efficient.
Among some of the most representative and recent models of wine fermentation, we refer to \cite{david2010dynamical} and \cite{David}, where the evolution of the yeast biomass together with the concentrations of assimilable nitrogen, sugar, and ethanol are modeled.
In this model, the growth of the yeast population that consumes nitrogen is governed by a Michaelis-Menten term, which is often used for the description of enzymatic biological reactions \cite{michaelis1913kinetik}.
Another kinetic component of this model governs the conversion of sugar into ethanol. This component takes into account the fact that high concentration of ethanol decelerates the fermentation of sugar, which
corresponds to an inhibition term.
A similar model is also presented in \cite[Chapter~3.10.2]{Velten2009}, whereas an advanced model is proposed in \cite{malherbe2004modeling} that emphasizes the effect of nitrogen and takes into account the fact that this
substance is also needed for the sugar transport in the yeast cells.
Further, in \cite{colombie2007modeling,Zenteno2010} thermal phenomena in the fermentation process, as the production of heat by the yeast and the heat loss to the environment, are considered.
In application, a first attempt to formulate wine fermentation control problems can be found in \cite{sablayrolles2009control} with the aim to improve energy consumption and the aromatic profile. Further efforts to develop simulation and optimization schemes for wine fermentation can be found in \cite{CharnomordicDavidDochainHilgertMouretSablayrollesVandeWouwer2010,Goelzer2009}.
Our contribution to this research effort is manifold, i.e. reflecting the multiple objectives of the project
ROENOBIO that focused on the modelling and optimization of the
wine fermentation process \cite{BorziMerger2014,BorziMerger,MergerRD2017,mueller2015application,EnergOpt15,Schenk,schmidt2016numerical}. In
this work and any other improvement in simulation and
optimization of wine fermentation, a differential model of fermentation of increasing sophistication seems
indispensable.That is why in this paper we aim at
developing a new model that improves upon existing ones by including and merging together different components
like the yeast dying behavior, glucose transporters, and the presence of aromas and acids.
Wine fermentation is a very complex bio-chemical process
where each bio-chemical component plays an important
role. In particular, oxygen plays a crucial role for yeast activity, helping this to cope with the initial high concentrations of sugar and nutrients. However,
oxygen which is not consumed by the yeast leads to oxidation of the wine; see e.g. \cite{oxygenarticle}. During fermentation yeast grows by metabolizing sugar in the presence of nutrients such as nitrogen. The consumed sugar is converted into ethanol. On the other hand, alcohol inhibits yeast growth because it is toxic
for the yeast, see \cite{JarzebskiMalinowski89,LeaoUden82,SainzPizarro03} for further references and attempts to model the influence of ethanol on the fermentation rate. In fact, the alcohol which is produced
consists of many components of which ethanol is the most relevant one. Further, as discussed in \cite{David}, the yeast needs certain proteins, called \emph{transporters}, for the assimilation of sugar and nitrogen.
Our work starts with the basic model proposed in \cite{David}, which governs the time evolution of the yeast $X$, assimilable nitrogen $N$, ethanol $E$ and sugar $S$. In \cite{BorziMerger2014}, this model is extended by
including: 1) a term that describes the yeast dying phase with respect to the toxic influence of alcohols (see below);
2) an ODE for the time evolution of oxygen $O_2$; 3) the impact of oxygen and sugar on the yeast production.
For clarity of illustration see the terms in \textbf{bold} in (\ref{align:arXiv}) and compare with \cite{David}:
\begin{equation}
\begin{cases}
\begin{aligned}
\dfrac{\textup{d} X}{\textup{d} t}=&\mu_{max}(T) \dfrac{{N}}{K_N+N}\bf\dfrac{S}{K_{S_1}+S}\\&\bf\dfrac{O_2}{K_{O}+O_2}{X}-\boldsymbol\varphi({E}){X}\\
\dfrac{\textup{d} {N}}{\textup{d} t}=&-k_1\mu_{max}(T) \dfrac{{N}}{K_N+{N}}\bf\dfrac{{S}}{K_{S_1}+{S}}\\&\bf\dfrac{{O_2}}{K_{O}+{O_2}}{X}\\
\dfrac{\textup{d} {E}}{\textup{d} t}=&\beta_{max}(T) \dfrac{{S}}{K_{S_2}+{S}}\dfrac{K_E(T)}{K_E(T)+{E}}{X}\\
\dfrac{\textup{d}{S}}{\textup{d} t}=&-k_2\dfrac{\textup{d} {E}}{\textup{d} t}-\\& \bf k_3 \mu_{max}(T) \dfrac{{N}}{K_N+N}\dfrac{S}{K_{S_1}+S}\\&\bf\dfrac{O_2}{K_{O}+O_2}{X}\\
\bf\dfrac{\textup{d} {O_2}}{\textup{d} t}=&\bf-k_3\mu_{max}(T) \dfrac{{N}}{K_N+{N}}\dfrac{{S}}{K_{S_1}+{S}}\\&\bf\dfrac{{O_2}}{K_{O}+{O_2}}{X}\\
\end{aligned}
\end{cases}.
\label{align:arXiv}
\end{equation}
Since the yeast is also active even if no oxygen is left, we introduce a parameter $\varepsilon > 0$, to model this
fact. However, in order to ensure that the yeast reaches a stationary state, we add an additional dying term in the equation for the yeast given
by $-k_d\, X$; see \cite{Schenk}. These additions result in the model \textbf{(A)}.
In the following, the parameters $k_i$ represent the \textit{stoichiometric coefficients}, which describe the substances amount ration in a chemical reaction, e.g. $k_1$ describes, in which ratio nitrogen ($N$) is used in the conversion to yeast ($X$). To have mathematically more compact equations, we often combine several stoichiometric coefficients in to one. \\
In every equation, the \emph{Michaelis-Menten-kinetics} with Michaelis-Menten constants are used to model the conversion of the substances into each other, a well known model for enzyme kinetics. The Michaelis-Menten constants are given by the substrate concentration for which the reaction rate is the half of the maximal reaction rate. Their values are presented in Table \ref{tab:Michaelis-Menten}. \\
The time dependent functions $\mu_{max}(\cdot),~\beta_{max}(\cdot)$ describe the specific maximal reaction rate for the given substrate, depending on the temperature.
$\varphi(\cdot):\mathbb{R}^+_0 \rightarrow \mathbb{R}^+$ is the function, which is used to model the toxic influence of alcohol on yeast.
We define $\Sigma(t)$ as the sum of all different alcohols contained in wine; in our model $\Sigma(t):= E(t)+A(t)+B(t)+P(t)$. Where $A$ (isoamyl alcohol), $B$ (isobutanol), $P$ (propanol) are additional alcohols which are described in detail in Section \ref{ModelWithAromas}. \\
The toxicity function $\varphi(\Sigma)$ was proposed in
\cite{BorziMerger2014}, based on heuristic consideration and results of measurement of wine fermentation. The
same data was used in \cite{BorziMerger} with a new
function identification scheme confirming
that the following functional structure of $\varphi$
appropriately describes the effect of alcohol toxicity in the
evolution of the yeast. We have
\begin{small}
\begin{align}
\label{phifunction}
\varphi(\Sigma) = \left( 0.5 + \frac{1}{\pi}\arctan(k_{d1}(\Sigma-tol)) \right)k_{d2}(\Sigma-tol)^2 ,
\end{align}
\end{small}
where $tol$ describes the tolerance bound of the alcohol concentration and $k_{d1},k_{d2}$ are parameters, which correlate with the dying of the yeast cells related to the exceeding of the $tol$ threshold.
\subsection{Glucose transporters}
We follow the work in \cite{David} and consider the
presence of glucose transporters that are essential
for the assimilation of sugar (here glucose) and nitrogen.
In fact, these transporters are responsible for the glucose passing the yeast cell membrane. Therefore
we distinguish two nitrogen components: there exists a part of nitrogen $N_x$, which is converted into yeast $X$, and one part $N_{Tr}$, which is responsible for the synthesis of the transporters $Tr$. These components
are included in our model in the way proposed by \cite{David} and as illustrated in the system \textbf{(B)}
as follows
$$
\textbf{(B)}
\begin{cases}
\frac{\textup{d} Tr}{\textup{d} t} = \eta_{max}(T)\frac{N_{tr}}{N_{tr} + N_{tr}}\frac{S}{K_{S_1}+S}\frac{O_2}{K_O+O_2}X \\
\frac{\textup{d} N_{tr}}{\textup{d} t} = -k_1^{'} \eta_{max}(T)\frac{N_{tr}}{K_{tr} + N_{tr}}\frac{S}{K_{S_1}+S}\frac{O_2}{K_O+O_2}X
\end{cases},
$$
where $\eta_{max}$ is given in \eqref{align:temperaturfunktionen}.
Hence, we arrive at the combined system \textbf{(A)}-\textbf{(B)}, where \textbf{(A)} also contains the glucose transporters that influence the ethanol production through the conversion of sugar. Specifically, this influence is implemented by the additional factor $(1+\Phi(T)Tr)$, where $\Phi(T)$ is a function of temperature $T$ and is given in (\ref{align:temperaturfunktionen}).
$$
\textbf{(A)}
\begin{cases}
\frac{\textup{d} X}{\textup{d} t} = \mu_{max}(T)\frac{N_x}{K_x + N_x}\frac{S}{K_{S_1}+S}\left(\frac{O_2}{K_O+O_2}+\varepsilon\right)X
\\~~~~~~~ - k_d X -\varphi(\Sigma)X \\
\frac{\textup{d} N_x}{\textup{d} t} = -k_1 \mu_{max}(T)\frac{N_x}{K_x + N_x}\frac{S}{K_{S_1}+S}\left(\frac{O_2}{K_O+O_2}+\varepsilon\right)X \\
\frac{\textup{d} S}{\textup{d} t} = -k_2\frac{\textup{d} E}{\textup{d} t}
\\~~~~~~~ - k_3\mu_{max}(T)\frac{N_x}{K_x X + N_x}\frac{S}{K_{S_1}+S}\left(\frac{O_2}{K_O+O_2}+\varepsilon\right)X \\
\frac{\textup{d} O_2}{\textup{d} t} -k_4 \mu_{max}(T)\frac{N_x}{K_x X + N_x}\frac{S}{K_{S_1}+S}\frac{O_2}{K_O+O_2}X \\
\frac{\textup{d} E}{\textup{d} t} = \beta_{max}(T)\frac{S}{K_{S_2} + S}\frac{K_E(T)}{K_E(T) + E}X(1+\Phi(T)Tr) \\
\end{cases}
$$
Where the sugar-related Michaelis-Menten constant $K_1$, $K_2$ are associated to part of sugar utilized for nutrition of yeast, respectively to part required for the metabolization into alcohol.
\section{Model including aromas}
\label{ModelWithAromas}
The next important step in the development of our
model is to take into account the presence of aroma
compounds, which are responsible for the taste of wine; see e.g. \cite{TonesImperfections}. We consider three secondary aromas as in \cite{Rankine67,GeisenheimMaster}: propanol $(P)$, isoamyl alcohol ($A$) and isobutanol $(B)$. The ODE equations that describe the dynamics of these substances are given in \textbf{(C)} as follows
$$
\textbf{(C)}
\begin{cases}
\frac{\textup{d} P}{\textup{d} t} = k_5\mu_{max}(T)\frac{N_x}{K_x X + N_x}\frac{S}{K_{S_1}+S}\left(\frac{O_2}{K_O+O_2}+\varepsilon\right)X \\
\frac{\textup{d} A}{\textup{d} t} = k_6\beta_{max}(T)\frac{S}{K_{S_3} + S}\frac{K_E(T)}{K_E(T) + E}X(1+\Phi(T)Tr) \\ ~~~~~~+k_7\mu_{max}(T)\frac{N_x}{K_x X + N_x}\frac{S}{K_{S_1}+S}\left(\frac{O_2}{K_O+O_2}+\varepsilon\right)X \\
\frac{\textup{d} B}{\textup{d} t} = k_8\beta_{max}(T)\frac{S}{K_{S_4} + S}\frac{K_E(T)}{K_E(T) + E}X(1+\Phi(T)Tr) \\ ~~~~+ k_9\mu_{max}(T)\frac{N_x}{K_x X + N_x}\frac{S}{K_{S_1}+S}\left(\frac{O_2}{K_O+O_2}+\varepsilon\right)X \\
\end{cases}.
$$
These equations represent an extension of the
model discussed in \cite{GeisenheimMaster} to take
into account the coupling with the other components
of our model. Since the propanol production stops if the assimilable nitrogen part is depleted, in the related equation only the nitrogen part $N_x$ appears; see \cite{MouretHigherAlcohols} for a related discussion. In contrast to that, there is an additional influence of sugar to isoamyl alcohol and isobutanol. Therefore, a supplementary summand has to be taken into account.
The additional Michaelis-Menten constants related to sugar $K_{S_3}$, $K_{S_4}$ describe the saturation constants associated to the corresponding alcohols. \\
Now, to conclude the discussion on our new model
and before we address the presence of acids, we
give in Table \ref{tab:Parametervalues} and
Table \ref{tab:Michaelis-Menten} the values of the parameters appearing in our \textbf{(A)}-\textbf{(B)}-\textbf{(C)} model. In Table \ref{tab:Parametervalues}, the stoichiometric coefficients are given in terms of relative ratios; in Table \ref{tab:temperaturDependence}, parameters for the functions that represent the time dependence of the reaction time are presented; in Table \ref{tab:Michaelis-Menten}, we give the Michaelis-Menten constants in $g/l$. We take the parameter values as they are given in \cite{BorziMerger2014,GeisenheimMaster,David}.
\begin{table}[H]
\centering
\begin{tabular}{|l|l| l |l|l|} \hline
\textbf{symbol} & \textbf{value} & & \textbf{symbol} & \textbf{value} \\ \hline
$k_1$ & 0.0115 & & $k_1'$ & 0.160 \\ \hline
$k_2$ & 1.9569 & & $k_3$ & 2.8424\\ \hline
$k_4$ & 0.0004 & & $k_5$& 0.025\\ \hline
$k_6$ & 0.0023 & & $k_7$& 0.0005\\ \hline
$k_8$ & 0.009 & & $k_9$& 0.0005\\ \hline
$k_{d1}$ & 9.9676 & & $k_{d2}$& 0.0004\\ \hline
\end{tabular}
\caption{\textbf{(A)}-\textbf{(B)}-\textbf{(C)} Stoichiometric coefficients}
\label{tab:Parametervalues}
\end{table}
\begin{table}
\centering
\begin{tabular}{|l|l| l |l|l|} \hline
\textbf{symbol} & \textbf{value} & & \textbf{symbol} & \textbf{value} \\ \hline
$tol~~~(g/l)$ & 70 & & $\beta_1~~~((d^\circ\text{C})^{-1})$ & 0.1\\ \hline
$\beta_2~~~(d^{-1})$ & 0.0728 & & $\mu_11~~~((d^\circ\text{C})^{-1})$ & 0.02 \\ \hline
$\mu_2~~~(d^{-1})$ & 0 & & $\Phi_1~~~(l/(g^\circ\text{C}))$ & 0.0364 \\ \hline
$\Phi_2~~~(l/g)$ & 0.3945 & & $\eta_1~~~((d^\circ\text{C})^{-1})$ & 0.0125833 \\ \hline
$\eta_2~~~(d^{-1})$ & 0.1655 & & & \\ \hline
\end{tabular}
\caption{\textbf{(A)}-\textbf{(B)}-\textbf{(C)} Values for temperature dependence; units are specified in brackets}
\label{tab:temperaturDependence}
\end{table}
\begin{table}
\centering
\begin{tabular}{|l|l| l |l|l|} \hline
\textbf{symbol} & \textbf{values} & & \textbf{symbol} & \textbf{values} \\ \hline
$K_X$ & 0.0007 & & $K_{S_1}$ & 53.2669 \\ \hline
$K_{S_2}$ & 0.1599 & & $K_{E_1}~~~(g/(l\cdot min))$ & 1.5693\\ \hline
$K_{E_2}$ & 45.1692 & & $K_O$& 0.0002\\ \hline
$K_{S_3}$ & 32 & & $K_{S_4}$& 220\\ \hline
$K_{Tr}$ & 0.174 & &$K_{AA}$ &6 \\ \hline
$K_{MA}$ & 1.5 & &$K_{TA}$ &6 \\ \hline
$K_{S_5}$ & 53.2669 & & & \\ \hline
\end{tabular}
\caption{Michaelis-Menten constants; the unit is $g/l$ unless noted otherwise }
\label{tab:Michaelis-Menten}
\end{table}
These values also enter in the functional dependence
on the temperature of some constants appearing in our model. This functional dependence is given in
\eqref{align:temperaturfunktionen}.
\begin{align}
\label{align:temperaturfunktionen}
\beta_{max}(T) = \beta_1 T - \beta_2 \notag \\
\mu_{max}(T) = \mu_1 T - \mu_2 \notag \\
\Phi(T) = \Phi_1 T - \Phi_2 \\
\eta_{max}(T) = \eta_1 T - \eta_2 \notag \\
K_E(T) = -K_{E1}T+K_{E2} \notag
\end{align}
Notice that in \eqref{align:temperaturfunktionen}, the relation between temperature and maximum rate of conversion of the substances is approximated by linear functions.
We ensure that all these functions are non-negative by projection on $\mathbb{R}^+$.
We consider linear dependence in order to be consistent with the references, and mention that it is also common to model the temperature dependence in chemical reactions with the so called \emph{Arrhenius} equation, see \cite{Laidler84}. Note that all kinetic constants depend on temperature, but we focused on the for our study most important ones. \\
In the simulation results presented in the following Section \ref{subsec:Simulations}, we consider that the working temperature is 18\textcelsius~in the first half of the simulation and 30\textcelsius~in the second one; see \cite{David}.
\subsection{Simulations}
\label{subsec:Simulations}
In this section, we present results of simulation
with our \textbf{(A)}-\textbf{(B)}-\textbf{(C)} model.
For this purpose, we use the initial values
given in Table \ref{tab:Startvalues}.
\begin{table}
\centering
\begin{tabular}{|l|l| l |l|l|} \hline
\textbf{substance} & \textbf{values (g/l)} & & \textbf{substance} & \textbf{values (g/l)} \\ \hline
$X$ & 0.2 & & $N_x$ & 0.24\\ \hline
$S$ & 213.4 & & $O_2$ & 0.005\\ \hline
$E$ & 0 & & $P$ & 0\\ \hline
$A$ & 0 & & $B$& 0\\ \hline
$Tr$ & 0 & & $N_{Tr}$& 0.22\\ \hline
$AA$ & 0.2 & & $MA$& 5.9\\ \hline
$TA$ & 7.3 & & &\\ \hline
\end{tabular}
\caption{Initial values}
\label{tab:Startvalues}
\end{table}
For the numerical solution of our non-linear ODE
system we use the Runge-Kutta method (as
implemented by the MATLAB function \texttt{ode45}).
We chose a time interval of 40 days, which is
typical for a complete fermentation process \cite{David}. In Figure \ref{fig:Aroma}-\ref{fig:Tr}, the development of the concentration of mentioned substances is given. The $y$-axis always represents this concentration in $g/l$, while on the $x$-axis the time evolution in days is given. \\
In Figure \ref{fig:Aroma}, we show the time behaviour of propanol (\dashed), isoamyl alcohol (\dotted) and isobutanol (\full). Propanol reaches the highest and isobutanol the lowest concentration at the final time. We also remark that the propanol production reaches the static stage earlier than the production of isoamyl alcohol and isobutanol due to a different dependence of propanol to sugar and nitrogen.
\begin{figure}
\includegraphics[width=0.5\textwidth]{Aroma}
\caption{Time evolution of aromas}
\label{fig:Aroma}
\end{figure}
In
Figure \ref{fig:NandO2}, we depict the evolution of nitrogen $N_X$ (solid-dotted) and $N_{Tr}$ (\dotted) and oxygen. In this case the solid thick line (\full) represents the oxygen concentration, and the right $y$-axis gives the concentration amount of it. We see that the depletion of oxygen is very much related to the consumption of nitrogen.
\begin{figure}[H]
\includegraphics[width=0.5\textwidth]{NitrogenAndOxygen2}
\caption{Time evolution of nitrogen and oxygen}
\label{fig:NandO2}
\end{figure}
In Figure \ref{fig:Yeast}, we plot the concentration of the yeast cells, showing the toxic influence of ethanol and of the other alcohols contributing to the dying phase of yeast. In Figure \ref{fig:SandE}, we show the relation between ethanol (\dashed) and sugar (\full). One can see how ethanol is produced (by yeast) as far as sugar is available; the production of ethanol stops at the time when the sugar is depleted. In Figure \ref{fig:Tr}, we present the time evolution of the concentration of the glucose transporters in the wine.
\begin{figure}
\includegraphics[width=0.5\textwidth]{Yeast}
\caption{Time evolution of yeast}
\label{fig:Yeast}
\end{figure}
\begin{figure}
\includegraphics[width=0.5\textwidth]{SugarAndEthanol}
\caption{Time evolution of sugar and ethanol}
\label{fig:SandE}
\end{figure}
\begin{figure}
\includegraphics[width=0.5\textwidth]{Transporters}
\caption{Time evolution of glucose transporters}
\label{fig:Tr}
\end{figure}
\section{A model including acids}
The results presented in the previous section meet
the expectation and experience of practitioners and
encourage us to make a further step of sophistication
of our wine fermentation model considering the
production of acids. This addition is also useful for
validating our model with results of measurements
focusing on the particular acid content of the wine.
Now, we discuss the functional dependence of
the most relevant acids on the remaining components
participating the wine fermentation process.
We start discussing the \emph{acetic acid (AA)}. This
is a by-product of alcoholic fermentation, which
is produced by the yeast in the order of several hundreds of milligrams per liter; see \cite{C}, \cite{D}. Higher concentrations (e.g. $>1g/l$) in the final product might indicate bacterial activity during or after fermentation.
This acid belongs to the family of \emph{volatile acids} and is responsible for acescence if its concentration reaches more than 1 g/l. Furthermore, for a good wine it must not exceed a certain concentration due to an EU Regulation, which differs depending on the particular wine produced (see Appendix I C in \cite{EUVerordnung}). Another two important acids contained in wine are \emph{malic acid (MA)} and \emph{tartaric acid (TA)}, which we also discuss below. For detailed information concerning these acids see \cite{OxfordWeinlexikon}.
\subsection{Acetic acid}
During fermentation, sugar conversion by lactic acid bacteria \cite{Laimburg} (otherwise called wild yeast) can lead to an increase of acetic acid concentration,
while post-fermentation spoilage can be caused by the presence of acetic acid bacteria that form
acetic acid by oxidation of ethanol (\cite{A},\cite{B},\cite{C},\cite{D}). Moreover, it is
reasonable to assume a linear precipitation rate of the acetic acid. Further, we have an additional Michaelis-Menten constant $K_{S_5}$ describing the saturating sugar concentration for this acid. These considerations are modelled in the following equation \eqref{align:AAODE}. We have
\begin{small}
\begin{align}
\label{align:AAODE}
\frac{\textup{d} AA}{\textup{d} t} = k_{10}\theta_{max}(T)\mu_{max}(T)\frac{N_x}{K_x+ N_x}\frac{S}{K_{S_5}+S}\frac{O_2}{K_O+O_2}X \notag
\\ +k_{11}\zeta_{max}(T)\frac{\textup{d} E}{\textup{d} t}- k_a AA.<wh
\end{align}
\end{small}
\subsection{Malic acid}
Notice that malic and tartaric acids are present in the grape. The more matured the grape is, the less is the concentration of malic acid, which is responsible for the sour taste of fruits. During the fermentation process, the concentrations of these acids decreases. In the case of malic acid, this happens through \emph{malolactic fermentation}, that is, the conversion of malic acid into the softer lactic acid and $CO_2$; see \cite{OxfordWeinlexikon}. We remark that the bacteria
that are responsible for this process need a low concentration of oxygen to act optimally. Furthermore we consider a linear precipitation rate $k_m$ of the acid. Hence,
we arrive at the following equation \eqref{align:MAODE} describing the dynamics of malic acid:
\begin{small}
\begin{align}
\frac{\textup{d} MA}{\textup{d} t} = - k_{12} \gamma_{max}(T) \frac{MA}{K_{MA}+MA}\left(
\frac{O_2}{K_O+O_2}+k_{m}\right)
\label{align:MAODE}
\end{align}
\end{small}
\subsubsection{Tartaric acid}
The concentration of tartaric acid is reduced through \emph{precipitation} of wine scale. This happens if the acid is no more resolvable in the developing wine; \cite{OxfordWeinlexikon}. Factors
that contribute to the reduction of tartaric acid are low temperature and rising alcohol concentration. Therefore we model the tartaric acid dynamics by the following equation, where $k_t$ is the rate of precipitation:
\begin{small}
\begin{align}
\frac{\textup{d} TA}{\textup{d} t} = - k_{13} \gamma_{max}(T) \frac{TA}{K_{TA}+TA}\left(
\frac{K_E(T)}{K_E(T)+E}+k_{t}\right) ,
\label{align:TAODE}
\end{align}
\end{small}
where the temperature dependent factors are again approximated by linear functions as follows
\begin{align*}
\gamma_{max}(T) = \gamma_1 T - \gamma_2,~\tilde{\gamma}_{max}(T) = \tilde{\gamma}_1 T - \tilde{\gamma}_2 \\
\theta_{max}(T) = \theta_1 T + \theta_2,~\zeta_{max}(T) = \zeta_1 T + \zeta_2 .
\end{align*}
Summarizing, we can augment our model with the
following equations
$$
\textbf{(D)}
\begin{cases}
\frac{\textup{d} AA}{\textup{d} t} = k_{10}\theta_{max}(T) \mu_{max}(T)\frac{N_x}{K_x + N_x}\frac{S}{K_{S_1}+S}\frac{O_2}{K_O+O_2}X
\\~~~~~~~+ k_{11}\zeta_{max}(T) \frac{\textup{d} E}{\textup{d} t} - k_a AA \\
\frac{\textup{d} MA}{\textup{d} t} = -k_{12} \gamma_{max}(T) \frac{MA}{K_{MA}+MA}\left(\frac{O_2}{K_O+O_2}+k_m \right) \\
\frac{\textup{d} TA}{\textup{d} t} = -k_{13} \tilde{\gamma}_{max}(T) \frac{TA}{K_{TA}+TA}\left(\frac{O_2}{K_O+O_2}+k_t \right) .
\end{cases}
$$
\section{Simulation and comparison with measurements}
In this section, we present results of simulation and
comparison to real data to validate our
new model \textbf{(A)}-\textbf{(B)}-\textbf{(C)}-\textbf{(D)}. We refer to measurements performed
in an experiment as part of the ROENOBIO project
in collaboration with the Dienstleistungszentrum L\"andlicher Raum (DLR) Mosel (Germany). In a time interval of almost 30 days, periodic measurements of concentrations of various important substances were taken (for more information see \cite{Schenk}). Notice that in this
experiment, the temperature was controlled in a way
suggested by an independent control strategy \cite{Schenk}. This temperature profile is
depicted in Figure \ref{fig:temperature}.
\begin{figure}
\includegraphics[width=0.5\textwidth]{temperaturFunction}
\caption{Temperature profile in the experiment. }
\label{fig:temperature}
\end{figure}
In the following plots, we compare the results of
simulation with our model with the measured data.
The initial values for the simulation are
given in Table \ref{tab:Startvalues} and the
values of the parameters for the acetic model are given in Table \ref{tab:AcidParameters} and Table \ref{tab:AcidParameters2}.
\begin{table}
\centering
\begin{tabular}{|l|l| l |l|l|}
\hline
\textbf{symbol} & \textbf{values} & & \textbf{symbol} & \textbf{values} \\
\hline
$k_{10}$ & 0.26432 & &$k_{11}$ & 0.0015 \\
\hline
$k_a$ & 0.0232 & & $k_{12}$ & 0.2994 \\
\hline
$k_m$ & 0.151 & & $k_{13}$ & 0.745 \\
\hline
$k_t$ & 0.17 & & & \\
\hline
\end{tabular}
\caption{Stoichiometric coefficients for the acid model \textbf{(D)}.}
\label{tab:AcidParameters}
\end{table}
\begin{table}
\centering
\begin{tabular}{|l|l| l |l|l|}
\hline
\textbf{symbol} & \textbf{values} & & \textbf{symbol} & \textbf{values} \\
\hline
$\gamma_2$ & 1 & & $\gamma_1$ & 0.125 \\
\hline
$\tilde{\gamma}_2$ & 1 & & $\tilde{\gamma}_1$& 0.125 \\
\hline
$\zeta_2$ & 1 & & $\zeta_1$&0 \\
\hline
$\theta_1$ & 0.1 & &$\theta_2$ & 0.03 \\
\hline
\end{tabular}
\caption{Parameters' values for the acid model \textbf{(D)} in $g/l$.}
\label{tab:AcidParameters2}
\end{table}
We choose the parameters of Table \ref{tab:AcidParameters} and Table \ref{tab:AcidParameters2} based on experience. Another possibility would be to solve a parameter fitting problem using for example \texttt{MATLAB} built-in functions as \texttt{fminsearch} in combination with an ODE solver.
In Figure \ref{fig:AA}, we see measured concentration of acetic acid in $g/l$ over a time period of about 30 days. The solid line shows the result of our simulation with our extended model. In Figure \ref{fig:MAnTA}, one can see the results of the measurements of the other two chosen acids collected in the same experiment. One can see that the time evolution of all three acids is reproduced in our simulation with a striking accuracy. The acetic acid concentration raises in both experiment and simulation until a specific time and then diminishes with the same rate. In the evolution of malic (\dotted) and tartaric (\full) acid, we see different stages of decrease in the measured data, as well as in our model.
\begin{figure}[H]
\includegraphics[width=0.5\textwidth]{AceticAcid}
\caption{Time development of acetic acid.}
\label{fig:AA}
\end{figure}
\begin{figure}[H]
\includegraphics[width=0.5\textwidth]{VariousAcids}
\caption{Time development of malic and tartaric acid.}
\label{fig:MAnTA}
\end{figure}
\section{Conclusion}
In this paper, a new extended model of wine fermentation has been presented. It extends previous models by including the time development of aromas and acids and is augmented by the presence of glucose transporters. Results of numerical experiments and comparison to real data have been illustrated that successfully validate the proposed model.\\
This work was done in the context of the project ROENOBIO aiming at the development of multi-dimensional simulation and control tools for an improved production and quality of white wines. The proposed model represents the core component (kinetics) of bio-chemical reaction fluid models for simulation of wine fermentation in tanks and in related control problems where an optimal fermentation pattern is driven by temperature regulation.
\section{Acknowledgements}
This work was supported by the BMBF (German Federal Ministry of Education and Research) project ROENOBIO (Robust energy optimization of fermentation processes for the production of biogas and wine) with contract number \texttt{05M2013UTA}. We would like to thank Achim Rosch and Christian von Walbrunn for providing the measurements by which we validated our results and Peter Fürst and Peter Petter (fp-sensor systems) for equipping those experiments
with their technology.
\bibliographystyle{alpha}
\newcommand{\etalchar}[1]{$^{#1}$}
| {'timestamp': '2019-01-14T02:21:31', 'yymm': '1901', 'arxiv_id': '1901.03659', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03659'} | arxiv |
\section{Introduction}
Three-dimensional data, that is useful for everyday geometric representation and design, is essential in modern industry and research.
Generating, approximating, processing and storing such data succinctly, and yet faithfully, are vital research problems with a long history of study.
While it would be ideal to use three-dimensional data in its most lossless form, the theoretical limit on representability as well as the source of data collection make the mode of representation crucial.
For different applications, varied modes of 3D data representations are used, such as grids, points clouds, meshes and splines.
In the broad spectrum of 3D data representations, the most abstract forms are those based on splines and parametric primitives.
Their natural representability for arbitrarily smooth surfaces makes them the industry standard for computer-aided design.
Therefore, while representations such as point clouds are more accessible, conversion to parametric representations is often necessary.
Generating clean geometric data with parametric surfaces based on observations often requires approximation and fitting based on a distance measure.
However, the requirement for a measurable distance between target and output and an initialization are common limitations for such a family of fitting algorithms.
On another front, creating geometry that could be induced and inferred from single images has historically been a very attractive research problem.
A strikingly exciting direction is geometric inference from indirect inputs, especially single images.
While such tasks, commonly known as Shape from X, have been studied for over four decades, the recent advances in deep learning have shed a new light on recovering these geometries.
By synthetically generating observations based on ground-truth geometry, recovering geometry based on single images has been illustrated with the representation of voxel grids or point clouds over a wide variety of different shapes.
A natural question that then arises is if there is a way to infer the parametrizable surfaces, directly based on the input information.
A deep learning framework is best suited to perform such inference for multiple reasons.
Fundamentally, deep learning-based frameworks are adaptable to varied input formats, especially when the relationship between the data and geometry is highly nonlinear and non-convex, e.g., images.
Besides, by learning over a myriad of examples, deep networks also do away with the need for manual initialization of the control points, thereby making the inference process less laborious.
Finally, the deep learning frameworks also aid in performing inference when the number of control points and curves are variable in number, which often needs to be determined heuristically in the traditional setting.
In this paper, we attempt to reconstruct spline curves and surfaces using data-driven approaches.
To tackle challenges with the 2D cases such as multiple splines with intersections, we use a hierarchical Recurrent Neural Network (RNN) trained with ground truth labels, to predict a variable number of spline curves, each with an undetermined number of control points.
In the 3D case, we reconstruct surfaces of revolution and extrusion without self-intersection through an unsupervised learning approach, that circumvents the requirement for ground truth labels.
To summarize, our contributions are as follows:
\begin{itemize}
\item We define two single-layer RNNs, Curve RNN and Point RNN that can be used to perform curve predictions and control point predictions respectively.
\item We provide a Hierarchical RNN architecture model that performs reconstruction of 2D spline curves of variable number, each of which contains a variable number of control points using nested Curve RNN and Point RNN units, and an algorithm to train it effectively.
\item We provide an unsupervised parametric reconstruction model that performs reconstruction of 3D surfaces of extrusion or revolution.
\end{itemize}
\section{Differentiable Modeler}
\paragraph{Primitives and Splines}
As vital representations of geometric designs, primitives of curves, surfaces, and volumes are the most elementary building blocks of modern design systems.
In industrial designs, most of the representations are splines, due to their simplicity for manipulation, local support, sparse representation, and flexibility regarding smoothness and sharpness.
Many classic works in the traditional Computer Aided Geometric Design community strived to improve such representations from different aspects in the past decades.
Recently, there is a family of work in inverse modeling that targets to create spline curves or spline patches with given data, including my work~\cite{dev16}, where one of the problems solved is to approximate point clouds by developable surfaces.
\paragraph{Expressiveness and Differentiability}
With the advancement of reinforcement learning and deep learning, the intriguing question is that how can we leverage both the geometric modeling capability of the standard geometric algorithm and the powerfulness of machine learning algorithms.
To achieve both, it is important that the core building blocks could be sufficient to convey the design ideas of individual designers and utilized by machine learning algorithms at the same time.
The first aspect requires sufficient expressiveness of the modeler.
The second perspective demands that the modeler should be differentiable to provide adequate feedback for a learning algorithm.
There are two ways to achieve such a balance between expressiveness and differentiability.
One straightforward way is to wrap the optimization based tools to have an interface to provide gradient to be used by machine learning approaches.
However, a more appealing alternative is to completely replace inverse modeling procedure by learning based approaches, in a way similar to the PointNet~\cite{qi2016pointnet}.
In other words, can we devise a modeler that could generate spline- or subdivision-based curves and surface conditioned on given data of varied forms, e.g., point clouds, signed distance fields, or semantic information?
This problem could be studied individually in 2D and 3D, with an exploratory study carried on 2D first before delving into 3D.
\begin{figure}[b]
\includegraphics[width=0.4\columnwidth]{images/spline_fitting}
\hfill
\begin{minipage}[b]{.58\columnwidth}
\caption{
\label{fig:spline_fitting}
Fitting a point cloud by a spline curve by minimizing a distance measure between the spline curve and the point cloud works well locally with a given good initialization~\protect\cite{wang2006fitting}.
However, a major challenge is to find the initialization of the control points, especially if the curve has self-intersections.
}
\end{minipage}
\end{figure}
\subsection{2D}
\paragraph{Reconstructing Lines and Curves on Plane}
As a small example to have some concrete and actionable items, we plan to start with the simplest 2D geometric elements and curves tentatively together with Lin Shao, Jiahui Huang, and Olga Diamanti.
The forms of the input include both point clouds and pixelized or voxelized data.
All the problems would be trained on synthetic data, either a set of points on a plane or raster images generated based on vector graphics.
The following lists a set of geometric primitive in 2D and the parameters we would like to recover:
\begin{itemize}
\item Straight line segments: two ends of a line segment.
\item Arcs: the circle center and the arc parameter range.
\item Polyline: the sequence of vertices.
\item Spline curves: the sequence of control points.
\end{itemize}
Most of the problems have the implication that the neural network should learn how to solve a least-squares fitting problem with given data provided as images.
Two fundamental questions arise naturally: 1) how to devise a learning architecture to recover the 2D primitives, and 2) how to design the loss function of the predicted fitting.
The second one is particularly interesting to me as there are multiple alternatives of different geometric nature connected to traditional CAGD problems.
In general, the loss function measures the difference between a ground truth curve and a predicted curve.
Here, the differences between two curves could be measured in different ways, such as point to point distances, differences between the normal vectors.
In optimization based approaches such as~\cite{wang2006fitting}, it is discovered that the normal information leads to much faster convergence.
Therefore, a particular idea we would like to try is how the information of normal vectors and fields could help the convergence of approximation and learning.
\subsection{3D}
\paragraph{Reconstructing Surfaces and Volumes}
Similar to the case in 2D, the 3D surfaces can also be represented by different primitives.
The following are some of the basic primitives and their corresponding parameters that we are interested:
\begin{itemize}
\item Ellipsoid: the scaling factors and orientation.
\item Cuboids: the center, size, and orientation.
\item Spline or subdivision surfaces: control points.
\end{itemize}
Similar to the case in 2D, a particular question I aim to answer is if and how the proximity of normals, or a Sobolev metric, could help the convergence of the learning process.
Another challenge which is shared by spline curves and spline surfaces is how many control points and which degree shall we choose.
For this problem, a possible way is to start from a large number of initial control points and give a parsimonious reward to the agent when a control point is removed.
A common misconception about splines and spline surfaces is that they are more suitable to represent curves and surfaces that are smooth than those with sharp corners or boundaries.
In fact, by coinciding control points a smooth intersect can degenerate to a sharp corner naturally.
However, how splines could handle both sharp and smooth corners and borders in the context of learning environment is a question by itself that needs be studied.
\begin{figure}[tb]
\includegraphics[width=\columnwidth]{images/approx}
\caption{
Approximating point clouds by developable patches through optimization.
It has a similar challenge as in the 2D case.
}
\label{fig:approx}
\end{figure}
\paragraph{Possible Advantages of Learning}
As a major difficulty for optimization based methods is how to find the proper initialization of the control points.
However, overviewing the global energy landscape is a possible advantage of learning based approaches.
Compared with a method purely based on optimization, it is speculated that an approach based on machine learning may not need initialization.
Moreover, it is hoped that it will be more robust with respect to self-intersections, for both curves and surfaces, due to the nonlinear nature of hidden layers.
\section{Experiments}
Training deep neural networks usually requires a copius amount of data. However, since there isn't enough real data with ground truth spline curve labeling, we use randomly synthesised data to perform our training and testing experiments. We synthesize a dataset of size 500,000, with a 70-30 train-to-test split. For each instance of the dataset, multiple spline curves and control points for each of the spline curves are generated. The training dataset consists of self-intersecting or looping spline curves, but do not contain any closed spline curves. This could be done by adding a circular loss term to the loss function in Equation \ref{loss_variable}. But for the purpose of this paper, we shall not venture into closed curves. According to the problem we attempt to solve, we generate the dataset and perform the training. We also run the trained model on real images to check the generalizability of our model.
For 2D reconstruction, we set the image size to 128$\times$128 and randomly generate the number of spline curves and the number and the position of control points for each spline curve in 2D image plane. The number of control points are varied between 4 to 6 for the problem with spline curve reconstruction with variable control points. The number of spline curve are varied between 1 to 3 for the problem of reconstructing multiple spline curve with the number of control points fixed at 5. These two variations are combined to train and test for multiple spline curve reconstruction with variable number of control points. For 3D reconstrunction, the number of control points are fixed to 5, and then the spline curve is revolved or extruded to gain a 3D surfaces. If the input is an image, we render the 3D surface with fixed camera angle and lighting condition. If the input is point cloud, we randomly sample from the 3D surface.
We use the VGGNet as image feature extractor for all the three models in Sec. \ref{model}. We initialize our network using pretrained weights from ImageNet \cite{deng2009imagenet}. We then train the network with Adam optimizer through back-propagation. We set both the learning rate and weight decay to $10^{-4}$. Determining the number of points (or curves) is easier than predicting the position of the control points. Therefore, the hyperparameter $\lambda$ is set to 0.1 to lay more emphasis on position regression. Our models are implemented in PyTorch and trained for 100$\times$10000 iterations with batch size set to 32. It took approximately one to two days on GeForce GTX 1080 GPU to converge. Testing on one image needs only 12ms.
Measuring the performance of our model is not a straightforward task. Due the ambiguity that could potentially be caused by two shape-similar curves having totally different control point sequences, or even different number of control points, one single measurement would not be able to cover all the characteristics of spline curves. We use three measurements here that complement each other: Mean-Squared Error between the position of predicted control points and target control points, Classification accuracy of the number of control points and the number of spline curves and Chamfer distance between point clouds of the predicted spline curves and the target curves.
\subsection{Baseline Method}
Traditional methods minimize a distance metric measured directly between a pair of geometric entities: the reconstructed surface and a target often provided as a point cloud. In each iteration, the target points are projected onto the predicted surface (and vice versa) to obtain point-to-foot-point matches. As this distance can be expressed through the parameters of the prediction, minimizing the distance updates the parameters. Throughout the optimization, at each iteration, the distance and the foot-points are reevaluated. Faster algorithms based on normal-to-normal distances and point-to-tangent-plane distances have been used to accelerated the process, with an essentially similar idea of minimizing a local distance metric~\cite{besl1992method,chen1991object,wang2006fitting,tang2016dev}. For all our experiments, we minimize the point-to-point distance as the traditional method to compare against.
\subsection{Results}
\label{results_sec}
We present results pertaining to both 2D spline curve reconstruction and 3D surface of extrusion or revolution reconstruction. As mentioned in Section~\ref{model} and~\ref{unsupervised_sec}, the method that is employed to perform the 2D spline reconstruction is supervised, while the one used to reconstruct the surface of extrusions or revolutions is unsupervised.
\subsubsection{Supervised 2D Reconstruction}
We have proposed three supervised models in Sections~\ref{basic_network_sec},~\ref{multiple_curves_sec} and ~\ref{hierarchical_rnn_sec} aiming to reconstruct single spline curve with variable control points, variable number of spline curves with a fixed number of control points and variable number of spline curves with variable control points respectively. In this section, we showcase the reconstruction performance of these individual models, as well as in comparison to traditional energy-based models.
\textbf{Single Spline Curve, Variable Number of Control Points.} \\
We attempt to show that traditional energy-based models that optimize to reconstruct a spline curve with fixed number of control points as input, show significantly improved performance when initialized with control points that are more systematically learned by our method, as opposed to a random initialization that is classically performed. To this effect, we randomly initialize the position of control points and use energy-based methods to perform the optimization. Since the traditional method uses a fixed number of input control points, we perform this optimization for three different cases of initial control points ($4,5,6$) and select the best optimized case as the final result. We observe that the performance of the learned initialization easily outperforms the random initialization. This is expected, since the systematic learning of the control points leverages the information contained in the training datasets about the relative position of the control points to the curves, and this can provide us with a very good starting point to perform the optimization from, This is observed in Figure~\ref{results_variable}. It is observed that the prediction by our RNN is close enough to the original curve, and therefore serves as an excellent initialization for control point optimization. After optimization based on this initialization, the obtained reconstruction almost exactly mirrors the input curves.
\textbf{Variable Spline Curves, Fixed Number of Control Points.} \\
The method discussed in Section~\ref{multiple_curves_sec} is used to perform predictions of number of spline curves and the control points for each of the spline curves. In Figure~\ref{results_multiple}, we again perform the comparisons between the target and the predictions of the RNN, the optimization-based reconstruction dependent on initializations, both random and based on RNN output. We again observe that the prediction of the RNN, when used as an initialization, comfortably outperforms the random initialization.
\textbf{Variable Spline Curves, Variable Number of Control Points}\\
The method discussed in Section~\ref{hierarchical_rnn_sec} is used to perform predictions of a variable number of spline curves, each containing a variable number of control points. We perform the comparisons between the target and the random and RNN-based initialization and reconstruction schemes again in Figure~\ref{results_multiple_variable}. It is also to be noted that in Figure~\ref{results_multiple_variable}, as in the case of the orange curve in the second row, in spite of prediction of number of control points being wrong and predicted positions also being wrong, the predicted and target curves look similiar, which provide us with the intuition that the RNN architecture learns the curves though it does not necessarily learn it in the specific manner we intend it to.
\begin{figure}[!htb]
\centering
\mbox{} \hfill
\begin{minipage}{\linewidth}
\includegraphics[width=0.32\linewidth]{./3dsurface_data/rendered/rev_pc_r3.jpg}
\includegraphics[width=0.32\linewidth]{./3dsurface_data/rendered/rev_pred_r15.jpg}
\includegraphics[width=0.32\linewidth]{./3dsurface_data/rendered/rev_both_r15.jpg}
\end{minipage}
\begin{minipage}{\linewidth}
\includegraphics[width=0.32\linewidth]{./3dsurface_data/rendered/ex_pc_r2.jpg}
\includegraphics[width=0.32\linewidth]{./3dsurface_data/rendered/ex_pred_r1.jpg}
\includegraphics[width=0.32\linewidth]{./3dsurface_data/rendered/ex_both_r1.jpg}
\end{minipage}
\hfill \mbox{}
\caption{Randomly picked results of point cloud reconstruction. The left column consists of input point clouds, the middle column consists of generator splines revolved (top) or extruded along a path (bottom) to generate surface reconstructions. We plot the input point clouds and predicted surfaces in the right column.}
\label{results_point_cloud}
\end{figure}
\begin{figure*}[tbp]
\includegraphics[width=\textwidth]{./images/test_mnist_gray.pdf}
\hfill \mbox{}
\caption{MNIST reconstruction. Reconstruction of MNIST numerals $0$-$9$ is shown. The left sub-image of each of the images is the original MNIST numeral, and the right sub-image is the reconstructed image from our method. The mode that is used is the one with variable number of curves and fixed number of control points for each curve.}
\label{results_mnist}
\end{figure*}
The optimization results after the RNN-based initialization are an order of magnitude better than the optimization results after a random initialization. This can be quantitatively validated over the entire test set, that has been synthetically generated with random positions of control points and variability in the number of spline curves and control points. This evaluation is indicated in Table~\ref{quant_results_chamfer} as well, where V refers to the case of using variable number of control points on single spline curve, M refers to the case of using multiple spline curves with fixed number of control points and MV refers to the case of using multiple spline curves each containing a variable number of control points.
We also show other quantitative measures in Table ~\ref{quant_results}. Here, we compute the Mean-Squared Error in curve prediction and accuracy in computing number of points and number of curves, as well as the Chamfer distance between the reconstructed prediction and the target curves. It is to be noted that in the case of variable curves with fixed control points, the point accuracy is not an applicable measure since it is known beforehand, and the same holds for curve accuracy in the case of variable control points for single curve. It is observed that in spite of the fact that the performance of curve accuracy and point accuracy both drop in the case of multiple spline curves with variable control points, the drop is very minor and the performance is still excellent by all comparable measures as shown in Table~\ref{quant_results_chamfer}.
\begin{table}[!hbp]
\centering
\begin{tabular}{c|ccc}
\hline
\hline
& NN & NN Init & Random Init \\
\hline
V & $1.38 \times 10^{-3}$ & $2.30 \times 10^{-5}$ & $3.33 \times 10^{-4}$\\
M & $1.93 \times 10^{-3}$ & $7.74 \times 10^{-5}$ & $8.25 \times 10^{-4}$\\
MV & $2.22 \times 10^{-3}$ & $9.53 \times 10^{-5}$ & $7.39 \times 10^{-4}$\\
\hline
\end{tabular}
\caption{Chamfer distance between the predicted curve and target curve. ``NN'' denotes the average distance of target from Neural Network prediction, ``NN Init'' denotes the average distance of target from the optimization performed with the Neural Network prediction as initialization, and ``Random Init'' denotes the same distance with optimization performed with random initialization. The optimization here is performed using traditional methods as discussed in Section~\ref{results_sec}. The distances are all normalized to lie in the unit interval. The rows refer to the three modes of variability on which we operate our networks as described in Section~\ref{results_sec}.}
\label{quant_results_chamfer}
\end{table}
\begin{figure}[!htb]
\centering
\mbox{} \hfill
\begin{minipage}{\linewidth}
\includegraphics[width=0.23\linewidth]{./images/Revolve_Img/input_img_20.jpg}
\includegraphics[width=0.23\linewidth]{./3dsurface_data/rendered/syn_ground_truth_1_resized.jpg}
\includegraphics[width=0.23\linewidth]{./3dsurface_data/rendered/syn_prediction_1_resized.jpg}
\includegraphics[width=0.23\linewidth]{./3dsurface_data/rendered/syn_overlay_1_resized.jpg}
\end{minipage}
\hfill \mbox{}
\caption{Results of surfaces of revolution on images. Left to Right: Input synthetic image, ground truth surface, predicted surface, ground truth and predicted surface plotted together.}
\label{results_revolve_surface_img_real}
\end{figure}
\begin{figure}[!htb]
\centering
\mbox{} \hfill
\begin{minipage}{\linewidth}
\includegraphics[width=0.5\linewidth]{./images/real_image_2.jpg}
\includegraphics[width=0.5\linewidth]{./3dsurface_data/rendered/round_pot.jpg}
\end{minipage}
\hfill \mbox{}
\caption{Results of surfaces of revolution on real image. The image on the left is the real image, and one on the right is the reconstructed surface..}
\label{results_revolve_surface_img_real_2}
\end{figure}
\begin{table}[!hbp]
\begin{tabular}{c|cccc}
\hline
\hline
& MSE & Point Acc & Curve Acc & Chamfer Distance \\
\hline
V & 0.01302 & 94.58 &N/A & $1.38 \times 10^{-3}$\\
M & 0.02699 & N/A & 99.85 & $1.93 \times 10^{-3}$\\
MV & 0.03738 & 82.75 & 99.49 & $2.22 \times 10^{-3}$\\
\hline
\end{tabular}
\caption{Error and Accuracy measures. Quantitative evaluation of Mean Squared Error, point prediction accuracy, curve prediction accuracy and the Chamfer distance between the predicted and target curves are provided. The accuracy terms are provided in percentages. The distances are all normalized to lie in the unit interval. The rows refer to the three modes of variability on which we operate our networks as described in Section~\ref{results_sec}.}
\label{quant_results}
\end{table}
\subsubsection{Point Cloud Reconstruction}
The reconstruction of surfaces of extrusion or revolution from inputs in the form of point clouds is performed as described in Section~\ref{real_recons_sec}. A sampling of these reconstructions is shown in Figure~\ref{results_point_cloud}, where spline curve prediction to resemble the point cloud when revolved or extruded is performed in an unsupervised manner.
\begin{figure}[tbp]
\centering
\mbox{} \hfill
\includegraphics[width=\linewidth]{./images/new_attention_map_gray.pdf}
\vspace{-15pt}
\hfill \mbox{}
\caption{Attention results for Hierarchical RNN. The first row shows the input image, and the maps provided by the attention networks for the prediction of each of the individual spline curves. The second row shows the target curves and the predictions of spline curves one at a time, corresponding to the attention map provided in the first row.}
\label{attention_results}
\end{figure}
\subsubsection{Real/Synthetic Image Reconstruction}
\textbf{MNIST Spline Reconstruction.}
We use the trained networks to reconstruct images in the MNIST dataset \cite{lecun1998gradient}. The networks have been trained on synthetically generated data, and testing it to perform real data reconstruction, as is the case of the MNIST dataset, is overreaching of the capabilities of the network. Nevertheless, it is to be noted that we perform significantly well on this dataset, especially when the input images are more curved in nature, with less sharp edges. A sample of these reconstructed results are shown in Figure~\ref{results_mnist}.
We first enlarge the MNIST image to size $128 \times 128$, and then thin the digits to lines, which are the input to our network. It is observed that the mode of multiple spline curves with fixed number of control points performs best for this task. It is also to be noted that no post-processing is performed on the result.
\begin{figure}[!htb]
\centering
\mbox{} \hfill
\includegraphics[width=0.95\linewidth]{./images/Multiple_Variable_Failure/test_multiple_variable_failure.pdf}
\hfill \mbox{}
\caption{Reconstruction failure. Failure cases of multiple spline curves with variable number of control points}
\label{results_multiple_variable_failure}
\end{figure}
\textbf{Surface Reconstruction.}
We perform testing on real images to generate surfaces of revolution. As a preprocessing step, we convert the photo to a gray-scale image, crop and pad it properly to fit the input size of the neural network. An instance of this reconstruction, performed as described in Section~\ref{real_recons_sec} on a synthetic input image, is shown in Figure~\ref{results_revolve_surface_img_real}. This can also be performed on real images as illustrated in Figure~\ref{results_revolve_surface_img_real_2}.
\subsubsection{Visualization and Analysis}
The attention map in the Hierarchical RNN is plotted at different curve-prediction iterations in Figure~\ref{attention_results}. This gives us a method to visualize how the networks learns to pick the next curve to predict. In each iteration, the network tends to focus on the regions of the image that correspond to the curve that is being predicted currently. The attention region in these maps is usually close to the center of the curve. Since the operation of convolution is repeated applied, as the network gets deeper, the center part of an object or curve tends to contain more information than the marginal parts, and thus this part deserves more attention.
\subsubsection{Failure Cases}
We showcase a number of failure cases for our method in Figure~\ref{results_multiple_variable_failure}. It is observed that when multiple spline curves are heavily entangled, the model seems to fail. These entanglements are difficult to separate through manual human supervision, and so it can be expected with fairly high chance that this would fail, and this is what is observed in the figure.
We also showcase some failure cases in the reconstruction of MNIST numerals in Figure~\ref{results_mnist_failure}. This can be attributed to the lack of training on real images. There are multiple issues with using the MNIST images as test images. One issue that we run into often is that of closed curves. The training data does not contain closed spline curves, but in MNIST closed curves are ubiquitous, such as numerals 0,6,8,9 in the Figure~\ref{results_mnist_failure}. This tends to be alien to the network when it is seen in the MNIST images. Another issue is that images such as numerals, which are sharper in nature, than plain spline curves, and thus the curves that are predicted, while they attempt to approximate the input image, they are not expressive enough to be able to make a close enough approximation. Real images also contain some noise, such as unnecessary pixels, which might lead the network to predict complicated curves to account for the noise (numerals 1, 2, 5, 7 in the Figure~\ref{results_mnist_failure}). But we believe these issues could be mitigated with some domain adaptation techniques.
\begin{figure}[tbp]
\includegraphics[width=\linewidth]{./images/test_mnist_failure_gray.pdf}
\vspace{-15pt}
\hfill \mbox{}
\caption{Failure cases at MNIST reconstruction. Reconstruction of MNIST numerals $0$-$9$ is shown. The left sub-image of each of the images is the original MNIST numeral, and the right sub-image is the reconstructed image from our method. The mode that is used is the one with multilple number of curves and variable number of control points for each curve.}
\label{results_mnist_failure}
\end{figure}
There are a few limitations to our methods. For 2D reconstruction, our methods only consider the family of spline curves where the knot position in the splines is fixed. If both the control points and the knots need to vary, our methods need modifications. For 3D reconstruction, our methods only consider surfaces with no self-intersections and decreasing y-coordinates to avoid the local minima problem. Finally, due to lack of training data, we train our model on synthetic data and test it on real data. While we do this, we do not apply domain adaptation techniques to help the network generalize well to real data, but this is a problem which could be attempted as a future work.
\section{Supervised 2D Reconstruction}
\label{model}
Reconstructing spline curves in images consists of two modes of variability: the number of spline curves and the number of control points. While solving for both these factors of variability can prove challenging, solving the sub-problems where one of these modes is fixed can provide ample intuition towards solving the harder problems with more variables. In this section, we provide basic models of spline curve fitting solving both these variability issues. First, we propose a model that infers a variable number of control points to fit a single spline curve. Then, we extend this to fitting multiple spline curves with a fixed number of control points. Finally, we propose the Hierarchical RNN to solve for multiple spline curves with a variable number of control points.
\subsection{Single Spline Curve, Variable Number of Control Points}
\label{basic_network_sec}
A vanilla model is used to tackle the problem of fitting a variable number of control points to a single spline curve. For the spline curve in consideration, the corresponding control points form an ordered sequence, with each element of the sequence being the position of one control point. The prediction of these variable number of control points could, therefore, be viewed as inferring a variable length sequence. A very similar learning technique has previously been used in Machine Translation and Image Captioning. \cite{sutskever2014sequence, bahdanau2014neural, cho2014learning, vinyals2015show}. The use of RNNs for this generative process is a natural choice.
The input to the pipeline is an image that contains the spline curve. A deep convolutional network is used to extract a feature vector from this image. This feature vector is then forwarded to an RNN module, which predicts the control point sequence. The RNN module performs a dual prediction task. At each iteration, the RNN predicts the position of a new control point and the probability with which this control point is the endpoint. The probability is predicted as a distribution over two states \{CONTINUE = 0, STOP = 1\}. Specifically, at time step $t$, the model predicts the $t^{\text th}$ control point $C_t$ and the probability $p_t$ for the prediction to stop at this time step. In the ideal scenario, the value of $p_t$ would be binary, with value $0$ for all time steps, and $1$ for the final time step, forcing the prediction to end.
The network architecture is shown in Figure~\ref{RNNSpline}. Here, we use the VGGNet, described in \cite{simonyan2014very},to extract image features, and then perform mean pooling to obtain a vector representation of the whole image. This feature vector is fed into a linear layer to get a more abstract feature vector with 512 dimensions and then supplied into the RNN. We use a one-layer Gated Recurrent Unit (GRU) \cite{cho2014properties} as the basic block of the RNN, with the dimension of input and hidden layers set to 512. At each time step, the hidden vector $h_t$ of RNN is fed forward into a two-layer fully-connected network to produce the control point's position $C_t$ and the stop probability $p_t$. Specifically, the output of this two-layer fully-connected network has four units, the first two represent $C_t$ and we append a softmax layer into the last two units, which provide a probability distribution over \{CONTINUE = 0, STOP = 1\}.
We use a Mean-Squared Error (MSE) term to optimize on the position of the control points, and a Cross-Entropy term to optimize for the predicted stop probability. The loss function used to train the RNN is
\begin{align}
\label{loss_variable}
L_1 &= \sum_{i=1}^{N} \Big(\sum_{k=1}^{n_i}(C^i_k - \hat{C}^i_k)^2 \\
&+ \lambda \big(p^i_k\log(\hat{p}^i_k) + (1-p^i_k)\log(1-\hat{p}^i_k)\big) \Big)
\end{align}
where $N$ is the size of the training dataset, $n_i$ is the number of control points of $i^{\text{th}}$ spline curve in the training dataset, $\hat{C}$ is the predicted position of a control point, while $C$ is the corresponding ground truth, $\hat{p}$ is the predicted stop probability, $p$ is the ground truth stop probability ($1$ when $k = n_i$, $0$ otherwise) and $\lambda$ is the optimization hyperparameter.
\begin{figure}[htb]
\centering
\includegraphics[width=.95\linewidth]{images/schematic2.jpg}
%
%
\caption{\label{hierarchical_rnn_model}
Hierarchical RNN architecture. The Curve RNN acts as an outer loop to determine when all curves in the image have been generated. For each iteration of the Curve RNN, the Point RNN runs the prediction based on the Single Curve, Variable Control Points process as described in Section \ref{basic_network_sec} with input obtained from the Curve RNN to perform reconstruction of this curve. The Curve RNN predicts the stop probability to signal end of all curves, $p_{\text{curve}}$ and the predicted curve $v$, while the Point RNN predicts the stop probability to signal end of predicted points, $p_{\text{point}}$ and the predicted point at that particular iteration $C_{\text{point}}$.}
\end{figure}
\begin{figure*}[tbp]
\centering
\vspace{-20pt}
\mbox{} \hfill
\includegraphics[width=\textwidth]{./images/new_images_data/test_variable_compress.pdf}
\hfill \mbox{}
\caption{Randomly picked results of variable number of control points. The first column shows the target curve, the second column shows the prediction from the RNN, the third column shows the reconstruction obtained by using the RNN prediction as initialization for traditional methods, and the last column shows the reconstruction obtained by using a random initialization.}
\label{results_variable}
\end{figure*}
\begin{figure*}[tbp]
\centering
\vspace{-20pt}
\mbox{} \hfill
\includegraphics[width=\textwidth]{./images/new_images_data/test_multiple_compress.pdf}
\hfill \mbox{}
\caption{Randomly picked results of multiple number of spline curves with fixed number of control points. The first column shows the target curves, the second column shows the prediction from the RNN, the third column shows the reconstruction obtained by using the RNN prediction as initialization for traditional methods, and the last column shows the reconstruction obtained by using a random initialization.}
\label{results_multiple}
\end{figure*}
\subsection{Multiple Spline Curves, Fixed Number of Control Points}
\label{multiple_curves_sec}
Fitting multiple spline curves with a fixed number of control points is solved with a minor modification to the model in Sec.\ref{basic_network_sec}. Here, instead of predicting if a certain point is the final control point, the entire spline curve along with all control points are computed at each iteration of the RNN. The RNN also predicts the probability to determine if the most recent curve is the final curve.
However, there are two new challenges that arise in this solution. The RNN predicts an ordered sequence of curves, while the target of multiple spline curves is an unordered bag of spline curves. Therefore, a correspondence needs to be established between the target curves and the curves that are predicted by the network. This is achieved by modeling this problem as a matching problem in a bipartite graph, with the two sets being the set of target curves and the set of predicted curves. The weight of each edge between the curves in the two sets would be the distance between the two curves. The Hungarian Algorithm is implemented to obtain a matching of minimal cost. This is similar in spirit to the matching problem solved in \cite{eccv_15_ris}.
The second challenge is to ensure that when a certain spline curve is being processed, influences from regions of other spline curves are minimized. Since there are multiple curves, occupying different regions of the image, it becomes necessary to nullify these influences. This is handled by adapting the attention mechanism \cite{sukhbaatar2015end-to-end, kumar2016ask} of the network. At each time step $t$, the image features are scaled by an attention map showing weights of different regions in the image before passing into the RNN. This ensures that the attention of the network is localized to the region in which the current spline dominates. The idea of using a localization network to perform this task of drawing attention to certain regions over others is used with considerable success in\cite{icml2015_xuc15}. Our methods are demonstrated in more detail in Sections \ref{hungarian_algo} and \ref{attention_module}.
\subsubsection{Loss Function}
\label{hungarian_algo}
The training dataset is composed of labeled images. Image $i$ as $\textbf{I}^i\in \mathcal{R}^{128x128x3}$, its annotation $S^i = \{S_1^i, S_2^i, ... , S_{n_i}^i\}$ is a set of spline curves, $n_i$ is the number of spline curves in this image, $S_j^i$ is a sequence of control point positions that construct spline curve $j$ inside the image $\textbf{I}^i$. In all our experiments, we use $n_i \in \{1, 2, 3\}$.
The network predicts both a sequence of spline curves $\hat{S}^i = \{\hat{S}_1^i,\hat{S}_2^i, ... ,\hat{S}_{\hat{n}_i}^i\}$, and stop probabilities $\hat{P}^i = \{\hat{p}_1^i, \hat{p}_2^i, ... , \hat{p}_{\hat{n}_i}^i\}$. We train the RNN by running $n_i$ iterations for each training instance $S^i$. On inference, the number of iterations is determined by the predicted stop probability $\hat{p}_j^i$. The recurrence stops when $\hat{p}_j^i > 0.5$.
The loss on the probability sequence is defined as earlier.
\begin{equation}
L_p^i = \sum_{j = 1}^{n_i} p_j^i \log \hat{p}_j^i + (1-p_j^i)\log(1-\hat{p}_j^i)
\end{equation}
\begin{equation}
p_j^i =
\begin{cases}
0& j<n_i\\
1& j=n_i
\end{cases}
\end{equation}
As described earlier, the loss term that measures the distance between the target and predicted spline curves also needs alignment. Since $\hat{S}^i$ is an ordered sequence and the ground truth $S^i$ is an unordered set, the order of processing the spline curves in an image is not easily determinable. Random allocation of processing rank to $S^i$ will result in a problem of ambiguity and the network convergence is not guaranteed. The bipartite graph model is used here, as described earlier, to model the correspondence, while computing the reconstruction loss. This reconstruction loss is computed as follows:
\begin{equation}
\label{loss_min_hungarian}
L_c^i = \min_{\delta \in \mathbf{K}^i} f_{Match}(S^i, \hat{S}^i, \delta)
\end{equation}
where
\begin{equation}
f_{Match}(S^i, \hat{S}^i, \delta) = \sum_{j = 1}^{n_i}\big(\sum_{\hat{j} = 1}^{n_i} f_{ED}(S_j^i, \hat{S}_{\hat{j}}^i)\delta_{j,\hat{j}}\big),
\end{equation}
\begin{align}
\label{matching}
\mathbf{K}^i = \Big\{\delta \in \{0,1\}^{n_i, n_i}: &\sum_{j=1}^{n_i}\delta_{j,\hat{j}} = 1, \forall \hat{j} \in \{1,...,n_i\}, \\
&\sum_{\hat{j}=1}^{n_i}\delta_{j,\hat{j}} = 1, \forall j \in \{1,...,n_i\}\Big\}.
\end{align}
$f_{ED}(S_j^i, \hat{S}_{\hat{j}}^i) = \sum_{k=1}^m (C_{S_j}^k - C_{\hat{S}_{\hat{j}}}^k)^2$ is the Euclidean distance between the position of control points at $S_j^i$ and $\hat{S}_{\hat{j}}^i$, and $m$ is the number of control points. we use $m = 5$ in our experiments.
$\delta$ defines a matching between ground truth $S^i$ and prediction result $\hat{S}^i$, Equation \ref{matching} guarantees a bijection between the ground truth and prediction results. The optimal matching $\delta$ in Equation \ref{loss_min_hungarian} is efficiently computed by the Hungarian algorithm. Therefore, the overall loss function is defined as:
\begin{align}
L_2 &= \sum_{i=1}^{N}\Big( \min_{\delta \in \mathbf{K}^i} f_{Match}(S^i, \hat{S}^i, \delta)\\
&+ \lambda\sum_{j = 1}^{n_i} \big(p_j^i \log \hat{p}_j^i + (1-p_j^i)\log(1-\hat{p}_j^i)\big)\Big)
\end{align}
\begin{figure*}[tbp]
\centering
\vspace{-20pt}
\mbox{} \hfill
\includegraphics[width=\textwidth]{./images/new_images_data/test_multiple_variable_compress.pdf}
\hfill \mbox{}
\caption{Randomly picked results of multiple spline curves with variable number of control points. The first column shows the target curves, the second column shows the prediction from the Hierarchical RNN, the third column shows the reconstruction obtained by using the Hierarchical RNN prediction as initialization for traditional methods, and the last column shows the reconstruction obtained by using a random initialization.}
\label{results_multiple_variable}
\end{figure*}
\subsubsection{Attention Network}
\label{attention_module}
At each iteration of the RNN, a smaller network $f_{\textbf{att}}$ is used to predict a soft attention mask. This mask provides localized weights to different regions of the image features.
The output of the feature extractor is a 3D tensor $\mathcal{M}$, of size $(l,x,y)$, where $l$ is the number of channels in the last layer of the network and $(x,y)$ is the downsampled size of input image. Each column, a vector that has $l$ elements, relates to a certain region in the input image. Let $d = xy$ and the image feature be $\alpha$.
\begin{equation}
\label{img_feature}
\alpha = \{ \textbf{a}_1, \textbf{a}_2, ... , \textbf{a}_d\}, \textbf{a}_i \in \mathbb{R}^l
\end{equation}
At each time step $t$ of the RNN, we denote the input vector as $\textbf{z}_t$ and hidden vector as $\textbf{h}_t$
\begin{equation}
\textbf{h}_t = RNN(\textbf{z}_t, \textbf{h}_{t-1})
\end{equation}
The attention network $f_{\textbf{att}}$ is used to get the vector $\textbf{z}_t$, the hidden vector $\textbf{h}_t$ is used to predict the control points and stop probability.
\begin{align}
\label{attention_function}
e_{ti} &= f_{\textbf{att}}(\textbf{a}_i, \textbf{h}_{t-1}) \\
\textbf{z}_t &= \sum_{i=1}^d e_{ti} \textbf{a}_i
\end{align}
$f_{\textbf{att}}$ is a two-layer fully-connected network with ReLU activation. The inputs are $\textbf{a}_i$, which corresponds to a certain part of the image, and $\textbf{h}_{t-1}$, which contains the information of the curve that needs to be predicted at current step. The output is only a scalar $e_{ti}$ which corresponds to the information about how important region $i$ is.
\subsection{Multiple Spline Curves, Variable Number of Control Point}
\label{hierarchical_rnn_sec}
Extending the previous model to the generation process of multiple spline curves with variable numbers of control points would consist of two nested loops. First, we loop over the curves and determine the number of curves, thereby generating one curve at each iteration of the generative process. The inner loop uses the information from the first loop that is needed to generate one curve, looping over the control points and determine the number of control points to generate the curve. This is implemented through a hierarchical RNN structure that is explained below.
\subsubsection{Hierarchical RNN}
\label{hierarchical_rnn}
We propose a Hierarchical RNN structure to model this generation procedure. This architecture has been previously used to describe visual content by attempting to understand and caption details in local regions of an image \cite{krause2016paragraphs}. We leverage the multiple recurrent units of a network to repeatedly extract local regions of an image containing information, and then to process this information. As before, an image feature extractor and an attention subnetwork are used to process the input image before feeding it to the RNN. This model constitutes two RNNs combined hierarchically, one for looping over the curves (Curve RNN) and the other for looping over the control points (Point RNN). At each time step of the Curve RNN, it predicts the stop probability of the curve generation and also generates a vector representation of the current spline curve and forward it into the Point RNN. The Point RNN uses this vector representation of a spline curve and then decodes it into the position of control points. Our model is shown in Figure~\ref{hierarchical_rnn_model}.
\subsubsection{Curve RNN}
The Curve RNN is a single-layer GRU with hidden size $H = 512$, the initial hidden vector $\textbf{h}_0$ is predicted by a two-layer fully-connected network with the average image feature as input. At each time step, the Curve RNN receives the image feature vector $\textbf{z}_t$, after passing through the attention subnetwork, as input. The hidden vector $\textbf{h}_t$ is then fed into a two-layer fully-connected network to obtain curve stop probability $p_t$ and a vector representation $\textbf{v}_t$ using which the model predicts the curve at the current step, which is also the input to the Point RNN. This is different from what is done in Sections \ref{basic_network_sec} and \ref{multiple_curves_sec}, where the hidden vector is directly fed into the two-layer fully-connected network to get positions of control points (or control point sequence).
\subsubsection{Point RNN}
The Point RNN is also a single-layer GRU with hidden size $H = 512$, which, given a vector representation $\textbf{v}_t$ from Curve RNN, is used to generate the sequence of positions of control points. We follow the network configuration in Section \ref{basic_network_sec}. At each time step, the Point RNN predicts one control point combined with a stop probability that represents whether this control point is the end point.
\subsubsection{Training and Inference}
The two RNNs are trained accordingly to predict the spline curves, and their stop probabilities as suggested in previous sections. The pseudocode to train this Hierarchical RNN model is provided below in Algorithm \ref{algo_hierarchical_rnn}.
\begin{algorithm}
\caption{Pseudocode for Training Hierarchical RNN}
\begin{algorithmic}[1]
\For{$\text{epoch} = 0 \to T$} \Comment{Loop over epoch}
\For{$i = 0 \to N$} \Comment{Loop over all training data}
\State $\alpha = CNN(\textbf{I}^i)$ \Comment{Get the image feature}
\State $\textbf{h}_{curve} = Hidden\_pred_{curve}(\alpha)$ \Comment{Initial hidden vector}
\For{$j = 0 \to L$}\Comment{Predict the attention mask}
\State $e_{j} = f_{\textbf{att}}(\textbf{a}_j, \textbf{h}_{curve})$
\EndFor
\State $\textbf{z} = \sum_{j=1}^D e_{j} * \textbf{a}_j$ \Comment{Get the input vector for RNN}
\For{$curve = 0 \to n_i$} \Comment{Loop over spline curves}
\State $\textbf{h}_{curve} = Curve\_RNN(\textbf{z}, \textbf{h}_{curve})$
\State $\textbf{v} = Curve\_to\_Point(\textbf{h}_{curve})$
\State $p\_curve= Stop\_Prob(\textbf{h}_{curve})$ \Comment{stop probability}
\For{$j = 0 \to D$} \Comment{Predict the attention mask}
\State $e_{j} = f_{\textbf{att}}(\textbf{a}_j, \textbf{h}_{curve})$
\EndFor
\State $\textbf{z} = \sum_{j=1}^D e_{j} * \textbf{a}_j$
\State $\textbf{h}_{point} = Hidden\_pred_{point}(\textbf{v})$ \Comment{Initial hidden}
\For{$point = 0 \to n\_point$} \Comment{Loop over Point}
\State $\textbf{h}_{point} = Point\_RNN(\textbf{v}, \textbf{h}_{point})$
\State $C_{point}, p_{point} = Point\_Pred(\textbf{h}_{point})$
\EndFor
\EndFor
\EndFor
\EndFor
\end{algorithmic}
\label{algo_hierarchical_rnn}
\end{algorithm}
The loss function has three terms: the mean-squared error of predicted positions, the cross entropy loss of curve stop probabilities and of point stop probabilities:
\begin{align}
L_3 &= \sum_{i=1}^{N}\Big( \min_{\delta \in \mathbf{K}^i} f_{Match}(S^i, \hat{S}^i, \delta)\\
&+ \lambda_1\sum_{j = 1}^{n_i} \big(p_j^i \log \hat{p}_j^i + (1-p_j^i)\log(1-\hat{p}_j^i)\big) \\
&+ \lambda_2\sum_{j = 1}^{n_i}\sum_{k=1}^{n_{i,j}} \big( p_{j,k}^i \log \hat{p}_{j,k}^i + (1-p_{j,k}^i)\log(1-\hat{p}_{j,k}^i)\big)\Big)
\end{align}
$\lambda_1$ and $\lambda_2$ are optimization hyperparameters. $n_i$ is the number of spline curves in the $i^{\text{th}}$ image, $n_{i,j}$ is the number of control points in the $j^{\text{th}}$ spline curve of image $i$. $p$ is the target probability and $\hat{p}$ is the predicted probability.
\section{Unsupervised Parametric 3D Reconstruction}
\label{unsupervised_sec}
While the methods discussed in Section \ref{model} could be employed to perform control point prediction when corresponding ground truth exists, solving for the parameters in the absence of ground truth is significantly harder.
Two natural obstacles are to be overcome in this setting. The first is to devise a loss function different from Mean-Squared Error that can be used to optimize the neural network. This is because one needs a ground truth to make a point-wise comparison and compute the error. This ground truth is missing in this case, and a technique to compare against a target point cloud, must be devised. We assume we have the target point cloud, which is natural and necessary in traditional methods. The second obstacle is to make the network aware of its purpose, that is to predict spline curves (or surfaces), as opposed to some other arbitrary primitives. These obstacles are entangled two-way, with the loss function design needing to take into consideration properties of spline curves (or surfaces), which might provide feedback to the neural network to determine the parameters.
Both traditional optimization methods (ICP ~\cite{besl1992method,chen1991object}) and ideas in \cite{pmlr-v70-tompson17a}, which utilizes neural network for fluid simulation, provide as inspirations to solving this problem. Suppose we are provided an oracle which could predict the parameters perfectly, then the point cloud representation of the predicted curves (or surfaces) could be generated. The Chamfer distance measurement between the point clouds of predicted curves (or surfaces) and the target point clouds could be used as the loss function to train the network.
Though we use the same loss function as in the case of traditional methods, we use a learning technique to predict the control points, as opposed to optimizing them directly, since this helps us leverage the entire dataset, as opposed to considering just one sample while optimizing. The prediction learned by the network could also used as the initialization to the traditional optimization methods, circumventing the manual initialization while reducing the number optimization iterations. A learning based approach also equips us to deal with multiple input formats, while traditional methods only use point cloud input.
\subsection{Reconstruction of Images or Point Clouds}
\label{real_recons_sec}
In this section, we provide a technique to reconstruct surfaces of extrusion or revolution from images or point clouds. For generating a surface of extrusion, we extrude a spline curve at a random height. As for a surface of revolution, this is generated by revolving the spline curve around the axis by 360 degrees. We only consider spline curves without self-intersections and with monotonically decreasing $y-$coordinate in the control point sequence. This assumption is made since generally self-intersected surfaces are not ubiquitous. Given the input data, features are extracted from it. If this is a 2D image, the VGG network \cite{simonyan2014very} is used to extract the image features as in Section~\ref{basic_network_sec}. If the input is a point cloud, the PointNet \cite{qi2016pointnet} is used to extract features. The extracted features $\textbf{v}$ are forwarded into a two-layer fully-connected network, which predicts the position of control points $\textbf{C}$ (if surfaces of extrusion are considered, $\textbf{C}$ also contains the extruded height). Since $\textbf{C}$ contains the control points, the predicted curve can be reconstructed from a linear combination of $\textbf{C}$, which is dependent on the parameterization of the spline curve $\textbf{t}$. This is represented as follows.
\begin{equation}
\textbf{C} = NN(v)
\end{equation}
\begin{equation}
P_{pred} = \textbf{f}(\textbf{t})(\textbf{C})
\end{equation}
where $NN$ denotes the two-layer fully-connected network, and $\textbf{f}$ is the basis function dependent on the spline generator $\textbf{t}$.
We use the Chamfer distance to measure the distance between the predicted point cloud and target point cloud.
\begin{equation}
d_{CD}(P_1, P_2) = \sum_{x\in P_1}\min_{y\in P_2} \|x-y\|_2^2 + \sum_{y\in P_2}\min_{x\in P_1} \|x-y\|_2^2
\end{equation}
Since $d_{CD}$, is differentiable, it is possible to train the network end-to-end. The function $\textbf{f}(\textbf{t})(.)$ represents control point weights to generate the surface. This is implemented as a linear layer with fixed weights in the network. This architecture is generalizable, since predicting other kinds of surfaces (like surfaces of sweeping or NURBS), would require only a change of this individual layer, with the rest of the model remaining the same.
\section{Related Work}
\label{related_work}
The problem of recovering faithful yet succinct representations of geometry, has been studied extensively over the past decades with varied forms of outputs and inputs. There are three categories of works that have been relevant to this study and fundamental to multiple applications. We first discuss previous work on spline fitting, in which a direct minimization of a distance between the target and the result is performed. Next, we discuss the creation of shapes from indirect information, i.e., Shape from X, with current advances in deep learning. Finally, we also review the work done in vectorization of rasterized images and discuss the main differences.
\textbf{Spline Fitting} In computer-aided design and computer graphics, registering or fitting curves or surfaces to targets, e.g., point clouds, are essential for a wide range of tasks such as industrial design following a physical sculpture. One of the most widely used method is the Iterative Closest Point (ICP)~\cite{besl1992method,chen1991object}, which minimizes the distances between two clouds of points based on an initial configuration, iteratively evaluated. Following a similar goal of minimizing a directly measurable and differentiable distance, multiple variants of registration and fitting algorithms are proposed. By devising a metric that is adaptive to curvature, Wang et al proposed a faster and more robust algorithm~\cite{wang2006fitting}, which was further accelerated with quasi-Newton methods~\cite{zheng2012fast}This has further been extended to spline surfaces with constraints such as developability~\cite{tang2016dev}. Despite being able to successfully and efficiently minimize the energies encoding distances, a proper initialization -- a given number of points at selected positions -- is always necessary for such approaches. In contrast, our method does not require such an initialization and could even be used to complement those previous approaches to improve their fits.
\textbf{Shape from X} There has been a long history of interest in discovering shapes from indirect inputs on images, e.g., from shading~\cite{horn1970shape,horn1989shape} or texture~\cite{kender1979shape}.
Most traditional methods follow a sequential procedure including, e.g., light source estimation, normal estimation, and depth estimation.
More recently, multiple works generate shapes based on images in an end-to-end manner with the help of deep neural networks and synthetically generated data, for shapes represented as volumetric grid~\cite{choy20163d} or point clouds~\cite{fan2016point}.
Despite the variety and complexity of recoverable shapes from single images, a large gap remains between the reconstruction and a clean geometry.
While multi-scale approaches, e.g., based on octree~\cite{ogn2017}, attempt to enhance geometric details with higher resolution, we attempt to directly recover the parameters of geometric primitives, especially spline curves or surfaces directly, which provide a higher level geometric abstraction with an arbitrarily high resolution.
\textbf{Image Tracing} Another field of related work is image tracing or vectorization, in which a rasterized image is converted to a vectorized one.
Commercially available tools, e.g., Illustrator, often provide a fine tessellation with an excessive amount of control points to ensure fidelity.
While most vectorization techniques work on the boundaries of the shapes, recent works such as~\cite{favreau2016fidelity} and~\cite{simo2016learning} strive for a simplification of the output on curves in a globally consistent manner.
Besides tracing based on direct differences of colors, Polygon-RNN~\cite{PolyRNN} used an RNN to predict the polygon contour of an object on a semantic level, which could be used for instance segmentation or reducing labelling labor.
In contrast to these methods that perform vectorization, we aim to abstract the simplest types of representation, based on general splines instead of polylines or interpolating cubic Bezier curves, and to create 3D surfaces based on images.
\section{Conclusion and Future Work}
In this paper, we have illustrated approaches to reconstruct spline curves and surfaces using data driven approaches.
Being both different and complementary to the traditional methods of spline fitting, our methods, adaptive to different forms of inputs, do not need initialization and can handle variable number of control points.
There are many exciting directions that remain to be explored.
A viable future direction would be to investigate methods to detect, decompose, and recover mutiple parametric surfaces from single images and consistently assemble them across multiple images.
Another area of interest would be to study how other types of information, such as semantics and physics, can be utilized to design and reconstruct clean, complex, and functional geometry and structures.
\section{Overview}
\label{overview_sec}
\begin{figure}[t]
\centering
\includegraphics[width=1.0\linewidth]{images/two_reals.jpg}
\hfill \mbox{}
\caption{Canny Edge Detector on real image. The image on the left shows a real image with a dish, and the image on the right is the output of the Canny Edge Detector of the image on the former.}
\label{two_reals}
\end{figure}
\begin{figure}[t]
\centering
\includegraphics[width=1.0\linewidth]{images/pipeline.jpg}
\hfill \mbox{}
\caption{Overview. The image and point cloud representations of curves or 3D shapes are used to generate control points and splines, which can be used for 2D and 3D reconstruction.}
\label{overview_img}
\end{figure}
\subsection{Motivation}
Traditional methods attempt to extract curved lines or surfaces from images leveraging low-level local image features such as gradients. For example, Canny Edge Detector \cite{Canny:1986:CAE:11274.11275} has been a popular edge detector in computer vision research for decades. Although low-level image features can work well for simple cases when the background is simple and clean, like handwriting on white clean papers, in images with clutter as in Figure~\ref{two_reals}, it is much more challenging to extract the profile of objects. It becomes vital then to develop a more robust method that can better exploit image content. As shown in recent computer vision papers for object recognition ~\cite{NIPS2012_4824}, deep learning methods seem to be able to learn object categories agnostic to the nuisance factors such as lighting, background clutter, pose variation etc. We, therefore, resort to deep learning methods to detect and generate parametric curves for 2D/3D reconstruction. This serves as crucial motivation to solve this problem using learning based techniques.
\subsection{Method}
The spline-based reconstruction techniques presented in this paper are performed on multiple input modalities, specifically images and point clouds, and both 2D and 3D reconstruction are discussed in this paper (Figure~\ref{overview_img}). For 2D reconstruction from images, there are two stages, prediction of spline curves in the image to reconstruct, and prediction of the actual control points that reconstruct the afore-mentioned spline curve. In the paper, we address both these reconstructions as individual problems. We solve the prediction of identifying the spline curves, knowing each of the curves have a fixed number of control points, and the prediction of identifying the control points, given a single spline curve, but not knowing the number of control points that are used to generate this curve. The reconstruction techniques used for these individual problems are then utilized along with a hierarchical deep learning module called the Hierarchical RNN, to solve the more general problem of predicting both the unknown quantities.
For 3D reconstruction, we perform surface reconstruction in the case of an extruded cross-section or rotational symmetry with two input modes, images or point clouds. These image or point cloud data are processed to learn features, from which spline curves that generate the shape are learned. From the spline curve that is learned, a surface of extrusion or revolution is generated by extruding the curve along the path of extrusion or revolving the curve about the axis of symmetry. | {'timestamp': '2019-01-15T02:04:09', 'yymm': '1901', 'arxiv_id': '1901.03781', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03781'} | arxiv |
\section{Introduction}%
\label{sec: introduction}\label{sec: intro}
\input{1_introduction}
\section{Huang and Wong's \myproblem{gbsplit} algorithm is incorrect}%
\label{sec: huang flaw}
\input{2_errors_huang_wong}
\section{A \myproblem{2wcst} algorithm by Spuler fails on some subproblems}%
\label{sec: spuler flaw}
\input{3_errors_spuler}
\bigskip
\paragraph{Note:}
We would like to use this opportunity to acknowledge yet another
error in the literature on binary split trees, this one in our
own paper~\cite{chrobak_etal_isaac_2015}. In that paper we introduced
a perturbation method that can be used to extend algorithms for
binary search trees with keys of distinct weights to instances where
key-weights need not be distinct, and we claimed that this method can
be used to speed up the computation of optimal binary split trees
to achieve running time $O(n^4)$.
(Recall that in binary split trees from~\cite{Huang1984,Perl1984,Hester1986},
the equality-test key in each node must be a most likely key among keys reaching the node.)
As it turns out, this claim is not valid. In essence, the perturbation
approach from~\cite{chrobak_etal_isaac_2015} does not apply to binary
split trees because such perturbations affect the choice of the equality-test key
and thus also the validity of some trees.
\bibliographystyle{abbrv}
\section{Errors in Huang and Wong's algorithm for \myproblem{gbsplit}}
\newcommand{\hfigtree}[2]{\ensuremath{T_{\ref{fig: #1}#2}}}
This section gives our first main result:
a proof that Huang and Wong's proposed \myproblem{gbsplit} algorithm~\cite{StephenHuang1984}
has a fundamental flaw.
\begin{theorem}\label{thm: huang flaw}%
Huang and Wong's \myproblem{gbsplit} algorithm~\cite{StephenHuang1984} is incorrect.
There is a \myproblem{gbsplit} instance $({\sf K}, p)$ for which it returns a non-optimal tree.
\end{theorem}
\renewcommand{\int}[2]{[#1,#2]}
We summarize their algorithm and analysis, give the intuition behind the failure, then prove the theorem.
The basic intuition is that, for the dynamic program that Huang and Wong define,
the optimal-substructure property fails.
{The proof gives a specific counter-example and verifies it.
The counter-example can also be verified computationally
by running the Python code for Huang and Wong's algorithm in Appendix~\ref{sec: code huang}.
}
Fix any \myproblem{gbsplit} instance $({\sf K}, p)$.
Assume without loss of generality that the keys are ${\sf K}=\{1,2,\ldots,n\}$.
Regarding the probability vector $p$, for convenience, throughout the paper we
drop the constraint that the probabilities must sum to 1, and we use
``probabilities'' and ``weights'' synonymously,
allowing their values to be arbitrary non-negative reals.
(To represent probabilities, these values can be appropriately normalized.)
Abusing notation, a \emph{query interval} $I=\int i j$ is the set of contiguous keys $\{i,i+1,\ldots,j\}$.
Given any query interval $I$ and any subset $H\subseteq I$ of ``hole'' keys,
consider the subproblem $(I,H)$ formed by the subset of keys $I\setminus H$,
with the probability distribution obtained from $p$ by restricting to $I\setminus H$.
Let $p(I\setminus H) = \sum_{k\in I\setminus H} p_k$ denote the total probability of these keys.
Let $\opt {I,H}$ denote the minimum cost of any generalized binary split tree for this subproblem.
If $H = I$ then the subproblem can be handled by an ``empty'' tree, so $\opt {I,H} = 0$.
Otherwise, letting $I=\int i j$, the definition of generalized binary split trees gives the recurrence
\[
\opt {I , H} ~=~
\weight{I\setminus H}+
\displaystyle\min_{s\in{\sf K};\, e\in I \setminus H}
~\big(~\opt {\int i {s-1}, \,H_{e} \cap \int i {s-1} }
\,+\, \opt {\int s j,\, H_{e} \cap \int s j}~\big)
\]
where $H_{e} = H \cup \{e\}$.
(Here $s\in {\sf K}$ ranges over the possible split keys,
$e\in I \setminus H$ ranges over the possible equality keys.)
\smallskip
The goal is to compute $\opt {{\sf K},\emptyset}$.
The recurrence above allows arbitrary equality keys $e$,
so it gives rise to exponentially many hole sets $H$,
resulting in a dynamic program with exponentially many subproblems.
Huang and Wong propose a dynamic program with $O(n^3)$ subproblems $(I,h)$,
one for each interval $I$ and integer $h\le |I|$. Specifically, they define
\[
\ensuremath{\operatorname{\sf opt}^*} {I, h} ~=~ \min\{\, \opt {I, H} : H\subseteq I,\, |H|=h\,\},
\]
which is the minimum cost of any tree for interval $I$ minus \emph{any} hole set of size $h$.
(Each such tree will have $|I|-h$ nodes.
Their paper uses ``$p[i-1,j,h]$'' to denote $\ensuremath{\operatorname{\sf opt}^*} {\int i j,h}$.)
They develop a recurrence for $\ensuremath{\operatorname{\sf opt}^*}{I, h}$ as follows.
For any node $N$ in an optimal tree,
define $N$'s \emph{interval} $I_N$ and \emph{hole set} $H_N$ in the natural way
so that interval $I_N$ contains those key values that,
if searched for in $T$ with the equality tests
ignored, would reach $N$,
and $H_N\subseteq I_N$ contains those keys \emph{in interval $I_N$} that are equality keys at ancestors of $N$.
Hence, the set of keys reaching $N$ is $I_N\setminus H_N$,
instance $(I_N, H_N)$.
Huang and Wong's Lemma 1 states:
\HuangLemma{1}{ambiguous}
{``Subtrees of an optimal generalized binary search tree
are optimal generalized binary search trees.''}
This statement is ambiguous in that
it doesn't specify \emph{for what subproblem} the subtree is optimal.
Consider any subtree $T'$ of an optimal tree $T^*$.
Let $T'$ have root $N$, interval $I_N$ and hole set $H_N$.
There are two natural subproblems that $T'$ might be a solution for:
$\opt{I_N, H_N}$, or $\ensuremath{\operatorname{\sf opt}^*}{I_N, |H_n|}$.
The first interpretation of their Lemma~1
is that ``optimal'' is with respect to $\opt{I_N, H_N}$.
With this interpretation (following the first recurrence above), the lemma is indeed true.
But another interpretation
is that ``optimal'' is with respect to $\ensuremath{\operatorname{\sf opt}^*}{I_N, |H_N|}$.
This interpretation is not the same ---
as this subproblem specifies only the \emph{number} of holes,
and choosing different holes can give a cheaper tree,
it can happen that $\ensuremath{\operatorname{\sf opt}^*}{I_N, |H_N|} < \opt{I_N, H_N}$.
As we shall see below,
it is the second interpretation that apparently underlies the recurrence relation that Huang and Wong propose,
but, with that interpretation, the above lemma is false.
The ambiguity in Lemma 1 appears to be their first misstep.
They follow it with the following (correct) observation:
\HuangLemma{2}{correct}{
Let $N$ be the root of a subtree $T'$ with interval $I$ in an optimal generalized binary split tree $T^*$.
The equality-test key $e_N$ of $N$ must be the least frequent key
among those in $N$'s interval $I_N$ that do not occur (as an equality-test key) in
the left and right subtrees of $N$.\footnote
{To avoid confusion, note that the lemma does not preclude
a descendant $D$ of $N$ from having an equality-test key $e_{D}$
that is more likely than $e_{N}$, because $e_{N}$ might not be in $D$'s interval.
So it does not imply that the equality-test key $e_{N}$ at $N$
is as likely as all equality-test keys in the subtree rooted at $N$.
For example, see keys ${\key{A2}}$ and ${\key{D1}}$ in Fig.~\ref{fig: huang small}\,(a).}
}
\begin{proof}
The proof is a simple exchange argument.
Suppose for contradiction that $e_N$ is more likely than some key $k$ in $I_N$
and $k$ does not occur as an equality-test key in the left and right subtrees of $N$.
Then $k$ is a hole at $N$, so it must be the equality-test key $k=e_{N'}$ of some ancestor $N'$ of $N$.
A contradiction is obtained by
observing that exchanging $e_N$ and $e_{N'}$ gives a correct tree cheaper than $T^*$.
\end{proof}
Huang and Wong's Lemma~2 above
(with the second, incorrect interpretation of their Lemma 1) suggests
the following idea.
To find an optimal tree $t^*(I,h)$ for $(I, h)$, first find the optimal
left and right subtrees,
and then take the equality-key at the root of $t^*(I, h)$ to be the least-likely key in $I$
that is not an equality-test in either subtree.
Following this idea, letting $I=\int i j$, their algorithm solves a given $(I,h)$ as follows:
\begin{center}
\begin{minipage}{6.5in}
\hrule
\medskip
\renewcommand{\labelenumii}{\theenumii}
\renewcommand{\theenumii}{\theenumi.\arabic{enumii}.}
\begin{enumerate}
\item For each triple $(s, h_{\mathsmaller 1}, h_{\mathsmaller 2})$ where $s\in I$ is a valid split key,
and $h_{\mathsmaller 1}$ and $h_{\mathsmaller 2}$ are non-negative integers such that $h_{\mathsmaller 1} + h_{\mathsmaller 2} +1 = h$,
$h_{\mathsmaller 1} \le s-i$, and $h_{\mathsmaller 2} \le j-s+1$,
construct one possible \emph{candidate tree} $T(s, h_{\mathsmaller 1}, h_{\mathsmaller 2})$ for $\ensuremath{\operatorname{\sf opt}^*}{I, h}$, as follows:
\begin{enumerate}[label*=\arabic*.]
\item Give $T(s, h_{\mathsmaller 1}, h_{\mathsmaller 2})$ left and right subtrees $t^*([i, s-1], h_{\mathsmaller 1})$ and $t^*([s, j], h_{\mathsmaller 2})$.
\smallskip
\item\label{step: e}
Give the root of $T(s, h_{\mathsmaller 1}, h_{\mathsmaller 2})$ split key $s$ and equality-test key $e$,
\emph{where $e$ is a least-likely key in $I$
that is not an equality-test key in either subtree.
}
\end{enumerate}
\item Take $t^*(I,h)$ to be the cheapest of all candidate subtrees $T(s, h_{\mathsmaller 1}, h_{\mathsmaller 2})$ constructed above.
\end{enumerate}
\hrule
\end{minipage}
\end{center}
The algorithm is not hard to implement.
Appendix~\ref{sec: code huang} gives Python code for it (40 lines).
Note that, by their Lemma~2, the choice for $e$ in Line~\ref{step: e} would be
{correct}
\emph{if} the second interpretation of their Lemma~1 were correct in a strong sense.\footnote
{Strictly speaking, the lemma asserts that within an optimal generalized binary search tree,
each subtree must be optimal for its subproblem. For their algorithm to be correct,
formally, the converse would be required:
using any optimal subtree for each subproblem
must yield an optimal overall tree.}
We surmise that this line of thinking
led Huang and Wong to the following recurrence relation for $\ensuremath{\operatorname{\sf opt}^*}{I, h}$.
Recall that $t^*(I, h)$ denotes an optimal solution (subtree) for $(I,h)$,
with cost $\ensuremath{\operatorname{\sf opt}^*}{I, h}$.
Let $w(I, h)$ denote the total weight of the equality keys in $t^*(I,h)$.
Their Lemma~3 (in our notation) gives a correct base case:
\HuangLemma{3}{correct}{
$\ensuremath{\operatorname{\sf opt}^*}{\emptyset, 0} = w(\emptyset, 0) = 0$.
}
\noindent
But their Lemma~4 then claims that,
for any interval $I=\int i j$ and any number of holes $h$,
the following recurrence relations hold for $\ensuremath{\operatorname{\sf opt}^*}{I,h}$ and $w(I,h)$:
\HuangLemma{4}{incorrect}
{Assume that $h \le |I|$ (otherwise let $\ensuremath{\operatorname{\sf opt}^*}{I, h} = \infty$). Then
\[\displaystyle\ensuremath{\operatorname{\sf opt}^*}{I, h}
\,=\, \min_{s,h_{\mathsmaller 1},h_{\mathsmaller 2}}~\big(~ w(I,h)
\,+\, \ensuremath{\operatorname{\sf opt}^*}{ \int i {s-1}, h_{\mathsmaller 1} } \,+\, \ensuremath{\operatorname{\sf opt}^*}{ \int s j, h_{\mathsmaller 2}} ~\big) \]
where the minimum is over all $s\in K$, and $h_{\mathsmaller 1}$ and $h_{\mathsmaller 2}$ such that $h_{\mathsmaller 1} + h_{\mathsmaller 2} + 1 =h$, and
\[w(I,h) \,=\, w([i, s-1],h_{\mathsmaller 1})+w([s, j],h_{\mathsmaller 2}) + p_{e}\]
where $e$ is the least-likely key among those in $I$
but not in $t^*([i,s-1],h_{\mathsmaller 1})$ or $t^*([s,j], h_{\mathsmaller 2})$ (as an equality-test key).
}
\smallskip
\begin{Observation}\label{obs: substructure}
If Lemma 4 holds for $(I,h)$ and all its smaller subproblems, then $(I,h)$ has optimal substructure.
\end{Observation}
\noindent
Let us be precise. By ``optimal substructure'', we mean the following:
\begin{definition}\label{def: substructure}
A tree $T^*$ has \emph{optimal substructure}
if every subtree $T'$ of $T^*$ is optimal (has minimum cost) for its own subproblem $(I',h')$.
A subproblem $(I,h)$ (or \myproblem{gbsplit} instance $({\sf K},p)$) has optimal substructure
if it has an optimal subtree $T^*$ with optimal substructure.
\end{definition}
Observation~\ref{obs: substructure}
holds because, \emph{if} the recurrence holds for $(I,h)$ and all smaller subproblems,
then (inductively) Huang and Wong's algorithm constructs an optimal tree $T^*$ for $(I,h)$
in which each subtree $T'$ is an optimal subtree $t^*(I', h')$ for its subproblem $(I', h')$.
To show that Lemma 4 is in fact wrong, we describe an instance $({\sf K},p)$
that does not have optimal substructure ---
every optimal tree $T^*$ for $({\sf K},p)$ contains a \emph{non-optimal} subtree $T'$,
one that does not have minimum cost for its subproblem $(I',h')$.
Before we describe $({\sf K},p)$, for intuition,
we first describe a subproblem $(I',h')$ for which using a minimum-cost tree $T'$ is
globally a bad choice.
The subproblem is $(I_9, 2)$, with $h=2$ holes
and interval $I_9$ consisting of nine keys named (in order)
$\{{\key{A1}}$, ${\key{A2}}$, ${\key{A3}}$, $ \allowbreak{\key{B0}}$, ${\key{B4}}$,
${\key{C0}}$, ${\key{D0}}$, ${\key{D1}}$, ${\key{E0}}\}$,
with weights as follows:
\begin{quote}\centering\small
\begin{tabular}{|r||c|c|c|c|c|c|c|c|c|}\hline
key & ${\key{A1}}$ &${\key{A2}}$ & ${\key{A3}}$ & ${\key{B0}}$
& ${\key{B4}}$ & ${\key{C0}}$ & ${\key{D0}}$ & ${\key{D1}}$ & ${\key{E0}}$ \\ \hline
weight & 20 & 20 & 20 & 10 & 20 & 5 & 10 & 22 & 10 \\ \hline
\end{tabular}
\end{quote}
Fig.~\ref{fig: huang small} shows two possible subtrees $\hfigtree{huang small}{a}$ and $\hfigtree{huang small}{b}$ for $(I_9, 2)$,
each with seven nodes.
\begin{figure}\centerin
\noindent\inputTree{error_d=1}
\caption{Subtrees $\hfigtree{huang small}{a}$ and $\hfigtree{huang small}{b}$ for 9-key interval $I_9$ with $h=2$.
{ $\hfigtree{huang small}{a}$ is missing the two keys ${\key{A3}}, {\key{B4}}$;
$\hfigtree{huang small}{b}$ is missing ${\key{A3}}, {\key{D1}}$.}
Each node shows its equality key and the frequency of that key;
split keys are not shown. (For each node, take the split key to be any key that separates
the keys in the left and right subtrees.)
The costs of $\hfigtree{huang small}{a}$ and $\hfigtree{huang small}{b}$ are $209$ and $210$, respectively,
but in $\hfigtree{huang small}{a}$, the total weight of the keys is larger by 2.
}\label{fig: huang small
\end{figure}
By calculation, subtree $\hfigtree{huang small}{b}$ costs 1 more than subtree $\hfigtree{huang small}{a}$.
(Indeed, key ${\key{C0}}$ contributes $5$ units more to $\hfigtree{huang small}{b}$ than to $\hfigtree{huang small}{a}$,
while key ${\key{B4}}$ contributes $4$ units less to $\hfigtree{huang small}{b}$
than key ${\key{D1}}$ contributes to $\hfigtree{huang small}{a}$.)
Although $\hfigtree{huang small}{b}$ costs 1 more than $\hfigtree{huang small}{a}$,
choosing subtree $\hfigtree{huang small}{b}$ instead of $\hfigtree{huang small}{a}$ can decrease the cost of the overall tree!
To see why, suppose that $\hfigtree{huang small}{a}$ occurs as a subtree of some tree $T^*$,
in which $\hfigtree{huang small}{a}$ has parent ${\key{A3}}$ and grandparent ${\key{B4}}$ as shown in the figure.
(See also Fig.~\ref{fig: huang flaw}.)
Consider replacing $\hfigtree{huang small}{a}$ and its two hole keys ${\key{A3}}$ and ${\key{B4}}$
by $\hfigtree{huang small}{b}$ and its two hole keys ${\key{A3}}$ and ${\key{D1}}$.
By calculation, this replacement decreases the cost of $T^*$ by 1 unit.
(Indeed, the cost of $\hfigtree{huang small}{b}$ is 1 larger,
but the total weight of keys in $\hfigtree{huang small}{b}$ is 2 units less,
so the replacement decreases the cost of ${\key{A3}}$'s subtree by 1 unit.)
\begin{figure}\centerin
\noindent\inputTree{error_bad}
\caption{Trees $\hfigtree{huang flaw}{a}$ and $\hfigtree{huang flaw}{b}$ for an instance of \myproblem{gbsplit} with 31-key interval $I_{31}$.
Key order is alphabetic: ${\key{A0}} < {\key{A1}} < {\key{A2}} < {\key{A3}} < {\key{B0}} < \cdots$.
As in Fig.~\ref{fig: huang small}, split keys are not shown.
Huang and Wong's algorithm gives tree $\hfigtree{huang flaw}{a}$, of cost $1763$,
but tree $\hfigtree{huang flaw}{b}$ costs $1762$.
}\label{fig: huang flaw
\end{figure}
Next we use this subproblem to obtain the complete instance $({\sf K},p)$ that does not have optimal substructure.
{The instance has a 31-key interval $I_{31}$},
which extends the previously considered interval $I_9$
by appending two ``neutral'' subintervals, with 7 and 15 keys.
The instance $({\sf K},p)$ is equivalent to its subproblem $(I_{31},0)$.
Fig.~\ref{fig: huang flaw} shows two trees $\hfigtree{huang flaw}{a}$ and $\hfigtree{huang flaw}{b}$ for $({\sf K},p)$.
As shown there, the new keys are given weights
so that each of the two added subintervals (without any holes) has a self-contained, optimal balanced subtree.
\begin{lemma}\label{lemma: K p}
Let $T^*$ be any optimal tree for this \myproblem{gbsplit} instance $({\sf K},p)$. Then
\emph{(a)} $T^*$ contains a subtree $T'$ that solves subproblem $(I_9, 2)$,
and
\emph{(b)} subtree $T'$ is not an optimal solution of subproblem $(I_9, 2)$.
Hence, $({\sf K}, p)$ does not have optimal substructure.
\end{lemma}
\begin{proof}
To bound tree costs,
define a \emph{key placement} (for a tree $T$) to be an assignment
of the equality-test keys in $T$ to distinct nodes in the infinite rooted binary tree $T_\infty$.
Define the \emph{cost} of the placement to be the average weighted depth of the placed keys,
weighted according to the key weight-vector $p$.
Each correct \myproblem{gbsplit} tree $T$ yields a placement of equal cost
by placing each equality-test key in the same place in $T_\infty$ that it occupies in $T$.
The converse does not hold, partly because placements can ignore the ordering of keys.
By an exchange argument, a placement has minimum cost if and only if it puts
the weight-22 key ${\key{D1}}$ at depth 0,
the fourteen weight-20 keys at depths 1--3,
and the sixteen remaining (weight-10 and weight-5) keys at depth 4.
By calculation, such a placement costs 1757.
No placement costs less, so no tree costs less.
Tree $\hfigtree{huang flaw}{b}$ almost achieves a minimum-cost placement ---
it fails only in that it places the weight-5 key at depth 5,
so costs 1762, just 5 units more than the minimum placement cost.
\begin{Claim}\label{claim: placement}
$T^*$ has the following structure:
\begin{itemize}
\item[(i)] It places the fifteen keys of weight 20 or more at depths 0--3.
\item[(ii)] It places the fifteen weight-10 keys at depth 4.
\end{itemize}
\end{Claim}
Next we prove the claim.
Since $T^*$ is optimal it costs at most 1762 (the cost of $\hfigtree{huang flaw}{b}$),
so its placement also costs at most 1762.
Suppose for contradiction that (i) doesn't hold.
Then $T^*$ places a key $k$ of weight 20 or more at depth at least 4.
Also, in depths 1--3, it either places at least one key $k'$ of weight 10,
or places fewer than fifteen keys.
In either case, by exchanging $k$ and $k'$, or just re-placing $k$ in depth 1--3,
we can obtain a key placement that costs at least 10 units less than 1762.
But this is impossible, as the minimum placement cost is 1757.
So (i) holds.
Now suppose for contradiction that (ii) doesn't hold.
Then there is a weight-10 key $k'$ at depth 5 or more,
and at most fifteen keys at depth 4, so $k'$ can be re-placed in depth 4,
yielding a key placement that costs 10 less, which is impossible.
This proves the claim.
Key placements ignore the ordering of keys.
The following \emph{order property} captures the restrictions on key placements due to the ordering.
\begin{quote}
\emph{
Let $T$ be any correct \myproblem{gbsplit} tree.
Let $N$ and $N'$ be nodes in $T$ with equality-test keys $k$ and $k'$.
Let $M$ be the least-common ancestor of $N$ and $N'$.
If $N$ is in $M$'s left subtree, and $N'$ is in $M$'s right subtree, then $k<k'$.}
\end{quote}
The property holds simply because $k$ and $k'$ are separated by $M$'s split key.
\smallskip
Fix any optimal tree $T^*$ for $({\sf K},p)$.
Claim~\ref{claim: placement} determines the depth of all keys in $T^*$
except for the weight-5 key ${\key{C0}}$. There are two cases:
\begin{outercases}
\item[1]\emph{$T^*$ places ${\key{C0}}$ at depth 4.}
With Claim~\ref{claim: placement}, this implies that
$T^*$ is a complete balanced binary tree of depth 4 (like $\hfigtree{huang flaw}{a}$),
whose sixteen depth-4 nodes hold the fifteen weight-10 keys and ${\key{C0}}$.
By the order property, these depth-4 keys are ordered left to right,
just as they are in $\hfigtree{huang flaw}{a}$,
with the left-most four nodes at depth 4 having keys
${\key{B0}}$, ${\key{C0}}$, ${\key{D0}}$, and ${\key{E0}}$.
The left spine has only five nodes.
By the order property, all five keys less than ${\key{C0}}$ have to be on the spine.
So \emph{${\key{D1}}$ is not on the left spine.}
Let $N$ be the parent of sibling leaves ${\key{D0}}$ and ${\key{E0}}$.
Since ${\key{D0}} < {\key{D1}} < {\key{E0}}$,
by the order property, ${\key{D1}}$ must lie on the path from $N$ to the root.
Since ${\key{D1}}$ is not on the left spine,
and $N$ is the only node on this path that is not on the left spine,
${\key{D1}}$ must be $N$.
So ${\key{D1}}$ has depth 3 in $T^*$.
Now exchanging ${\key{D1}}$ with the root key gives a placement
that costs at least 6 less, that is, at most $1762-6 < 1757$,
which is impossible as the minimum placement cost is 1757.
So Case 1 cannot happen.
\item[2]\emph{$T^*$ places ${\key{C0}}$ at depth 5.}
Let $L_0, L_1, \ldots, L_\ell$ be the left spine of $T^*$, starting at the root.
Take $T'$ to be the subtree of $T^*$ rooted at $L_2$.
By Claim~\ref{claim: placement},
$T^*$ has fifteen depth-4 nodes, holding the fifteen weight-10 keys.
By the order property, these depth-4 keys are ordered left to right within their level.
This implies that the weight-10 key ${\key{E0}}$ must be
the third or fourth depth-4 key from the left in $T^*$.
So ${\key{E0}}$ is in $T'$.
The next larger weight-10 key, ${\key{N0}}$, cannot be in $T'$.
(If it were, then by the order property, all keys less than or equal to ${\key{N0}}$
would be in $T'\cup \{L_1, L_0\}$.
But there are twelve keys less than or equal to ${\key{N0}}$
and at most eight keys in $T'$.)
So, \emph{the keys at depth 2 in $T'$
are ${\key{B0}}$, ${\key{D0}}$, and ${\key{E0}}$.}
By the order property and the assumption for Case 2,
${\key{C0}}$ must be (the only key) at depth 3 in $T'$
(as the child of either ${\key{B0}}$ or ${\key{D0}}$).
By Lemma~\ref{lemma: depth},
the three keys at depths 0 and 1 in $T'$ have weight 20 or 22.
By calculation, \emph{the cost of $T'$ is therefore at least 210 (see Fig.~\ref{fig: huang small}).}
Since ${\key{E0}}$ is in $T'$, by the order property,
all eight keys less than ${\key{E0}}$ are in $T' \cup\{L_0, L_1\}$.
That is, $T'\cup\{L_0, L_1\}$ contains at least the 9 keys in $I_{9}$.
But (as observed above) $T'$ has seven nodes.
So $T'\cup\{L_0, L_1\}$ contains exactly the 9 keys in $I_{9}$,
and (since $I_9$'s maximum and minimum keys ${\key{B0}}$ and ${\key{E0}}$ are in $T'$),
the subproblem solved by $T'$ must be $(I_9, 2)$.
As observed above, $T'$ costs at least 210.
But tree $\hfigtree{huang small}{a}$ (Fig.~\ref{fig: huang small}) of cost 209 also solves $(I_9, 2)$.
So $T'$ is not an optimal solution to its subproblem.
This proves Lemma~\ref{lemma: K p}.
\end{outercases}
\end{proof}
We now prove Theorem~\ref{thm: huang flaw}.
\begin{proof}[Proof of Theorem~\ref{thm: huang flaw}.]
Recall tree $\hfigtree{huang small}{a}$ for $(I_9, 2)$ in Fig.~\ref{fig: huang small}.
By inspection of $\hfigtree{huang small}{a}$, it has optimal substructure.
That is, each subtree $T'$ of $\hfigtree{huang small}{a}$ solves its subproblem $(I', h')$ optimally.
Hence, the recurrence in Huang and Wong's Lemma 4 holds for every such subproblem $(I', h')$ of $(I_9, 2)$.
It follows that \emph{their algorithm computes an optimal tree $t^*(I_9, 2)$ for $(I_9, 2)$}.
(One can also verify this by executing the Python code in Appendix~\ref{sec: code huang}.)
Now consider the execution of the algorithm on input $({\sf K},p)$.
Rather than showing directly that the algorithm of Huang and Wong fails to compute an optimal tree for
this instance, we argue as follows.
Let $T$ be the tree output by the algorithm.
If $T$ does not contain a subtree whose subproblem is $(I_9,2)$
then, by Lemma~\ref{lemma: K p}(a), $T$ cannot be optimal for $({\sf K},p)$.
On the other hand, if $T$ does contain a subtree $T'$ whose subproblem is $(I_9, 2)$, then
the algorithm solves it optimally (as observed above), in which case
Lemma~\ref{lemma: K p}(b) implies that $T$ is not optimal for $({\sf K},p)$.
This proves the theorem.
\end{proof}
In fact, the tree $T$ computed by their algorithm for $({\sf K},p)$ has cost 1763 (like $\hfigtree{huang flaw}{a}$).
(This can be verified by executing the Python code in the appendix.)
But $\hfigtree{huang flaw}{b}$ costs 1762.
\paragraph{Remark on Chen and Liu's algorithm for \myproblem{multiway} \myproblem{gbsplit}~\cite{chen_optimal_1991}.}
Chen and Liu's algorithm~\cite{chen_optimal_1991} and analysis
are patterned directly on Huang and Wong's,
and the proofs they present also conflate (their equivalents of) $\ensuremath{\operatorname{\sf opt}^*}{I,h}$ and $\opt{I,H}$,
leading to the same problems with optimal substructure.
For example, Property 1 of~\cite{chen_optimal_1991} states
\emph{``Any subtree of an optimal $(m+1)$-way generalized split tree is optimal.''}
They do not define ``optimal'',
so their Property 1 has the same problem as Huang and Wong's Lemma 1:
it is true if ``optimal'' means ``with respect to their equivalent of $\opt{I,H}$'',
but does not necessarily hold if ``optimal'' means ``with respect to their equivalent of $\ensuremath{\operatorname{\sf opt}^*}{I,h}$''.
Lemmas 2, 3 and 4 of~\cite{chen_optimal_1991},
which state the recurrence relations for their dynamic program,
are direct generalizations of Huang and Wong's Lemma 4.
Their recurrence chooses equality keys by first finding optimal subtrees for the children,
then taking the equality keys to be the least-likely keys that are not equality keys in the children's subtrees.
As pointed out in the proof of Theorem~\ref{thm: huang flaw},
correctness of this approach requires the optimal-substructure property
to hold with respect to $\ensuremath{\operatorname{\sf opt}^*}{I,h}$. But it does not.
For these reasons, their proof of correctness is not valid.
We believe that their algorithm for \myproblem{multiway} \myproblem{gbsplit} is also incorrect,
but describing their algorithm and analysis in detail,
and giving a complete counter-example, are out of the scope of this paper.
\section{\myproblem{2wcst} algorithms based on Huang and Wong's \myproblem{bsplit} algorithm}
This section concerns \myproblem{2wcst},
the problem of computing an optimal \emph{two-way comparison} search tree,
given a probability distribution $p$ and a set ${\sf K}$ of $n$ keys.
Such a tree $T$ is a rooted binary tree, where each non-leaf node $N$ has two children,
as well as a key $k_N\in{\sf K}$ and a binary comparison operator (equality or less-than).
Denote such a node by
$\compnode{=}{k_N}$ or $\compnode{<}{k_N}$, depending on which
comparison operator is used.
The tree $T$ has $n$ leaves, each labeled with a unique key in ${\sf K}$.
The search for a query $v$ in $T$ starts at the root.
If the root is a leaf, the search halts.
Otherwise, it compares $v$ to the root's key using the root's comparison operator,
then recurses either left or right,
depending on the outcome of the comparison.
For the tree to be correct, the search for any query $v\in{\sf K}$
must end at the leaf that is labeled with $v$.
(For simplicity, we discuss here only the \emph{successful-queries} variant,
in which only queries in ${\sf K}$ are allowed.)
Spuler's thesis proposed various algorithms for \myproblem{2wcst} and for \myproblem{gbsplit},
for both the successful-queries variants and more general
variants~\cite{Spuler1994Thesis}.\footnote{We remark
that Spuler~\cite[Section 4.8]{Spuler1994Thesis}
pointed out, and claimed to fix, several flaws in the \emph{pseudo-code}
that Huang and Wong gave for their \myproblem{gbsplit} algorithm.
Those flaws are relatively minor
and do not include the deeper errors discussed in Section~\ref{sec: huang flaw}.}
Here we discuss the (successful-queries) \myproblem{2wcst} algorithm that Spuler presented
as a modification of Huang and Wong's \myproblem{gbsplit} algorithm~\cite[Section 6.4.1]{Spuler1994Thesis}.
Spuler's thesis gave no proof of correctness, remarking only that
\begin{quote}\em
``The changes to the optimal generalized binary split tree algorithm of Huang
and Wong~\cite{StephenHuang1984} to produce optimal generalized two-way comparison trees are quite straight forward.''
\end{quote}
(Note that ``generalized two-way comparison trees'' in the thesis
refers to two-way comparison search trees as defined in this paper.)
In addition to lacking proofs of correctness,
these algorithms have not appeared in any peer-reviewed publication,
although Spuler did refer to them in his journal paper~\cite{Spuler1994Paper}.
Similarly to~\cite{StephenHuang1984}, Spuler's algorithms use
dynamic programming, with subproblems specified by an interval
of keys and a number of holes, and their costs determined by an appropriate
recurrence relation. We show that:
\begin{theorem}\label{thm: spuler flaw}
There is an instance $({\sf K}, p)$ of \myproblem{2wcst} such that, given that instance,
Spuler's \myproblem{2wcst} algorithm~\cite[Section 6.4.1]{Spuler1994Thesis}
computes non-optimal solutions to some of the subproblems in its dynamic program.
Hence, Spuler's proposed recurrence relation is incorrect for some subproblems.
\end{theorem}
Note that Theorem~\ref{thm: spuler flaw}
does not imply that the algorithm is incorrect,
in the sense that it gives an incorrect solution to some full instance
(where the number $h$ of holes is $0$).
{
Next we summarize Spuler's recurrence and algorithm, then prove the theorem.
The proof describes a specific counter-example.
It can also be verified computationally
by running the Python code for Spuler's algorithm in Appendix~\ref{sec: code spuler}.}
Following Huang and Wong,
Spuler's dynamic program has a subproblem $(I, h)$
for each query interval $I$ and number of holes $h$,
and defines $\ensuremath{\operatorname{\sf opt}^*}{I,h} = \min \{\opt{I, H} : H\subseteq I, |H|=h\}$
to be the minimum cost
of any tree for any query set $I\setminus H$ with a hole set $H$ of size $h$.
The underlying flaw is the same as in Huang and Wong's dynamic program ---
the recurrence for $\ensuremath{\operatorname{\sf opt}^*}{I, h}$ assumes an optimal-substructure property that does not hold.
Given subproblem $(I, h)$, where $I=[i,j]$ and the subproblem size $|I|-h$ is more than one,
Spuler's recurrence for $\ensuremath{\operatorname{\sf opt}^*}{I,h}$ and the associated optimal tree $t^*(I, h)$ is defined as follows:
\begin{center}
\begin{minipage}{6in}
\hrule
\medskip
\renewcommand{\labelenumii}{\theenumii}
\renewcommand{\theenumii}{\theenumi.\arabic{enumii}.}
\begin{enumerate}
\item Construct one \emph{candidate tree} $T_=$ with an equality test at the root, as follows:
\begin{enumerate}[label*=\arabic*.]
\item Let $e$ be the least-likely key in $I$
that is not an equality-test key in $t^*(I, h+1)$.
\item Make candidate tree $T_=$ the tree with root $\compnode = e$ and no-subtree is $t^*(I, h+1)$.
\end{enumerate}
\item
For all $s\in I$ and $(h_{\mathsmaller 1}, h_{\mathsmaller 2})$
s.t.~$h_{\mathsmaller 1} + h_{\mathsmaller 2} = h$, $s-i - h_{\mathsmaller 1} \ge 1$ and $j-s+1-h_{\mathsmaller 2} \ge 1$, do:
\begin{enumerate}[label*=\arabic*.]
\item Give candidate tree $T_{<s}$ root $\compnode < s$
and subtrees $t^*([i, s-1], h_{\mathsmaller 1})$, $t^*([s, j], h_{\mathsmaller 2})$.
\end{enumerate}
\item Among the candidate trees so constructed,
let $t^*(I,h)$ be one of minimum cost,
and let $\ensuremath{\operatorname{\sf opt}^*}{I,h}$ be its cost.
\end{enumerate}
\hrule
\end{minipage}
\end{center}
Spuler's algorithm is not hard to implement. Appendix~\ref{sec: code spuler} gives Python code (42 lines).
To distinguish the overall algorithm
from the subroutine above that computes $\ensuremath{\operatorname{\sf opt}^*}{I,h}$ and $t^*(I, h)$ for a given $(I, h)$,
we refer to the latter as \emph{Spuler's recurrence}.
In constructing candidate trees,
the recurrence only considers subtrees $t^*(I', h')$
that are optimal for their subproblem $(I', h')$.
Hence, the following observation holds:
\begin{Observation}\label{obs: substructure 2}
If Spuler's algorithm solves a given subproblem $(I,h)$ correctly,
then $(I,h)$ has \emph{optimal substructure},
defined as follows (same as~Definition~\ref{def: substructure}):
\end{Observation}
\begin{definition}\label{def: substructure 2}
A tree $T^*$ has \emph{optimal substructure}
if every subtree $T'$ of $T^*$ is optimal (has minimum cost) for its own subproblem $(I',h')$.
A subproblem $(I,h)$ (or \myproblem{2wcst} instance $({\sf K},p)$) has optimal substructure
if it has an optimal subtree $T^*$ with optimal substructure.
\end{definition}
Next we construct a subproblem $(I,h)$ that does not have optimal substructure.
That is, every optimal tree $T^*$ for subproblem $(I,h)$
has a subtree $T'$ that is non-optimal for its own subproblem $(I',h')$.
Before we describe the full subproblem $(I,h)$,
for intuition, we first describe one smaller subproblem $(I',h')$
for which using a minimum-cost tree $T'$ is globally a bad choice.
It is $(I_{8}, 1)$, with one hole, and interval $I_8$ having keys $\{1,2,\ldots,8\}$ whose weights are as follows:
\begin{quote}\centering
\begin{tabular}{|r||c|c|c|c|c|c|c|c|c||c|}\hline
\text{key} & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 \\ \hline
\text{weight} & 7 & 5 & 0 & 5 & 0 & 5 & 0 & 5 \\ \hline
\end{tabular}
\end{quote}
\smallskip
Fig.~\ref{fig: spuler counter 4} shows three possible subtrees \sfigtree 4 a, \sfigtree 4 b, and \sfigtree 4 c
for $(I_8, 1)$.
\begin{figure}[t]\centerin
\noindent\inputTree{Spuler_counter_example_4}
\caption{
Three trees (circled and shaded) for subproblem $(I_8, 1)$.
\sfigtree 4 a has cost 49 and weight 22.
\sfigtree 4 b and \sfigtree 4 c have cost 50 but weight 20.
\sfigtree 4 a is optimal for $(I_8, 1)$.
Among trees that don't contain the weight-7 key 1,
trees \sfigtree 4 b and \sfigtree 4 c have minimum cost.
Subtrees marked with $0$ contain keys of weight $0$.
}\label{fig: spuler counter 4
\end{figure}
By inspection, \sfigtree 4 a has cost 49 for subproblem $(I_{8}, 1)$,
while \sfigtree 4 b and \sfigtree 4 c cost 50 but weigh 2 units less.
Suppose, in a larger tree, that \sfigtree 4 a occurs as the left child of a node $N$,
as shown in Fig.~\ref{fig: spuler counter 4}.
(For example, $N$ might be $\compnode < {9}$.)
Let $T_N$ be the subtree rooted at $N$.
Suppose that each hole of \sfigtree 4 a is also a hole at $N$.
Then replacing \sfigtree 4 a by \sfigtree 4 b would reduce the overall cost by at least 1 unit.
This is because the contribution of \sfigtree 4 a to the cost of $T_N$
is not the cost of $\sfigtree 4 a$; rather, it is its cost \emph{plus its weight},
and the cost plus weight of \sfigtree 4 b is 1 unit less.
Next we construct the full subproblem $(I, h)=(I_{15},2)$ that does not have optimal substructure.
It has two holes, and extends the above subproblem $(I_{8}, 1)$
to a larger interval $I_{15} = \{1,2,\ldots,15\}$ with the following symmetric weights:
\[\setlength\arraycolsep{4.5pt}
\begin{array}{|r||c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}\hline
\text{key} & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15
\\ \hline
\text{weight} & 7 & 5 & 0 & 5 & 0 & 5 & 0 & 5 & 0 & 5 & 0 & 5 & 0 & 5 & 7
\\ \hline
\end{array}
\]
\smallskip
We use the following terminology to distinguish the different types of keys in a subtree.
Suppose $T'$ is a tree for some subproblem $(I',h')$ of $(I,h)$.
The keys of $I'$ that appear in the leaves of $T'$ are \emph{$T'$-queries}.
The other keys in interval $I'$, which are holes in $T'$, are \emph{$T'$-holes}.
(We don't introduce new terminology for the comparison keys in $T'$.)
We drop the prefix $T'$ from these terms when it is understood from context.
\smallskip
To analyze $(I_{15},2)$ we need some utility lemmas. We start with
one that will help us characterize how weight-0 queries increase costs.
This lemma (Lemma~\ref{lemma: depth} below) is in fact general and it
holds for subproblems of an arbitrary instance of \myproblem{2wcst}.
Define two integer sequences $\braced{d_m}$ and $\braced{e_m}$,
as follows:
$d_1 = 0$, $d_2 = 3$,
$e_1 = 0$, $e_2 = 2$, $e_3 = 6$, and
\begin{align*}
d_m &~=~ m\, + \,\min\,\{d_i + d_{m-i} : 1\le i < m \}\,\quad\text{for $m\ge 3$,}
\\
e_m &~=~ m\, + \,\min\,\{d_i + e_{m-i} : 1\le i < m \}\,\quad\text{for $m\ge 4$.}
\end{align*}
By calculation,
$d_3 = 6$, $d_4 = 10$, $d_5 = 14$,
$e_4 = 9$, $e_5 = 13$, and $e_6 = 18$.
Consider a tree $T'$ for a subproblem $({\tilde{I}},{\tilde{h}})$ of some
arbitrary instance of \myproblem{2wcst} (not necessarily our specific instance $({\sf K},p)$).
A subset $Q$ of $T'$-queries will be
called \emph{$T'$-separated} (or simply \emph{separated}, if $T'$ is
understood from context) if for any two $k,k'\in Q$, with $k < k'$,
there is a $T'$-query $k''$ that separates them, that is
$k < k'' < k'$. Also, if $Q\setminus\braced{f}$ is $T'$-separated for some $f\in Q$,
then we say that $Q$ is \emph{nearly $T'$-separated}.
\begin{lemma}\label{lemma: depth}
Let $T$ be a tree for a subproblem $({\tilde{I}}, {\tilde{h}})$ of some
arbitrary instance of \myproblem{2wcst}.
Let $Q$ be a set of $T$-queries and $m=|Q|$.
\emph{(i)}
If $Q$ is $T$-separated then
the total depth in $T$ of the keys in $Q$ is at least $d_m$.
\emph{(ii)}
If $Q$ is nearly $T$-separated then
the total depth in $T$ of the keys in $Q$ is at least $e_m$.
\end{lemma}
The proof of Lemma~\ref{lemma: depth} is a straightforward induction --- we
postpone it to the end of this section, and proceed with our analysis.
Now we focus our attention on our instance $({\sf K},p)$, and
we characterize the weights and costs of optimal subtrees for certain subproblems.
For $1\le \ell\le 14$,
let $I_\ell=\{1,2,\ldots,\ell\}$ denote the subinterval of $I_{15}$ containing its first $\ell$ keys.
These keys have $\ell$ weights (in order) $\{7, 5, 0, 5, \ldots\}$:
one key of weight 7, then $\lfloor \ell/2\rfloor$ even keys of weight 5,
separated by odd keys of weight 0.
Let $\nofposvalues{\ell} = 1+\lfloor \ell/2\rfloor$ be the number of positive-weight keys in $I_\ell$.
Note that each subproblem $(I_\ell, h')$
can be solved by a tree with $\nofposvalues{\ell}-h'$ positive-weight queries,
having $h'$ (positive-weight) hole keys.
\begin{lemma}\label{lemma: T 4}
Consider any subproblem $(I_\ell, h')$ with $\ell \le 14$ and $\nofposvalues{\ell}-h' = 4$.
Let $T'$ be an optimal tree for $(I', h')$.
Then $T'$ has weight 22 and cost 49 (like \sfigtree 4 a).
\end{lemma}
\begin{proof}
As $T'$ is fixed throughout the proof, the terms \emph{holes}, \emph{queries}, and \emph{separated},
mean \emph{$T'$-holes}, \emph{$T'$-queries}, and \emph{$T'$-separated}
as defined earlier, unless otherwise specified.
Let $h_0$ be the number of weight-0 holes and
$\nofposvalues{q}$ the number of queries with positive weight.
We use the following facts about $T'$.
\begin{description}
\item[(F1)] \emph{$T'$ costs at most 49.}
Indeed, one way to solve $(I_\ell,h')$ is as follows:
take the $h'$ rightmost weight-5 keys in $I_\ell$ to be the holes,
then handle the remaining $\nofposvalues{\ell}-h'=4$ queries with positive weight
(queries $1,2,4,6$), along with any weight-0 queries $3,5,7,\ldots$,
using tree \sfigtree 4 a, at cost 49. \smallskip
\item[(F2)] \emph{$\nofposvalues{q} = 4+h_0$}.
This follows by simple calculation:
$\nofposvalues{q} = \nofposvalues{\ell}-(h'-h_0) = 4+h_0$. \smallskip
\item[(F3)]
\emph{$T'$ does not contain four separated weight-5 queries.}
Indeed, otherwise, by Lemma~\ref{lemma: depth},
$T'$ would cost at least $5\cdot d^0_4 = 50 > 49$, contradicting (F1).
\end{description}
To finish we show that $T'$ costs at least 49.
Along the way we show it has weight 22.
\begin{outercases}
\item[1] First consider the case that $h_0 = 0$.
By (F2), \emph{there are $4$ positive-weight queries in $T'$.}
Since $h_0=0$, all weight-0 keys are queries in $T'$,
so the set of all weight-5 queries in $T'$ is separated,
and by (F3), \emph{there are at most three such queries}.
The fourth positive-weight query must be the weight-7 query, query 1.
So
\emph{the positive-weight queries in $T'$ are the weight-7 query and three separated weight-5 queries.}
So $T'$ has total weight 22, as desired.
Further, by Lemma~\ref{lemma: depth}, the four positive-weight queries in $T'$
have total depth at least $e_4$ in $T'$.
So $T'$ costs at least $5\cdot e_4 + (7-5)\cdot j = 45+2j$,
where $j$ is the depth of the weight-7 query.
If $j\ge 2$, by the previous bound, $T'$ costs at least 49,
and we are done.
%
In the remaining case we have $j = 1$ (as $j=0$ is impossible),
so the weight-7 query is a child of the root.
The three weight-5 queries are in the other child's subtree
(and are a separated subset there),
so by Lemma~\ref{lemma: depth} have total depth at least $d_3=6$
in that subtree, and therefore total depth at least 9 in $T'$.
So the total cost of $T'$ is at least $7 + 5\cdot 9 > 49$,
contradicting (F1).
\item[2] In the remaining case $h_0 \ge 1$.
By (F2), there are $\nofposvalues{q} = 4+ h_0$ positive-weight queries in $T'$.
Let $q_5 \ge \nofposvalues{q}-1$ be the number of weight-5 queries in $T'$.
Since all but $h_0$ of the weight-0 queries are in $T'$,
there is a separated set of $q_5-h_0$ weight-5 queries in $T'$.
By (F3), $q_5 - h_0 \le 3$.
This (with $\nofposvalues{q} = 4+h_0$ and $q_5\ge \nofposvalues{q}-1$) implies
$q_5 = h_0 + 3 = \nofposvalues{q} - 1$.
This implies that the weight-7 query is in $T'$,
along with some $q_5-h_0 = 3$ separated weight-5 queries.
Reasoning as in Case~1, the cost of these four queries alone is at least 49.
But $T'$ contains at least one additional weight-5 query
(as $q_5 = 3+h_0 > 3$), so $T'$ costs strictly more than 49,
contradicting (F1). Thus Case~2 cannot actually occur.
\end{outercases}
\end{proof}
\begin{figure}[t]\centerin
\noindent\inputTree{Spuler_counter_example_5}
\caption{
Trees $\sfigtree 5 a$ and $\sfigtree 5 b$, with five positive weight queries.
Tree $\sfigtree 5 a$ has cost 69 and weight 27.
Tree $\sfigtree 5 b$ has cost 70 and weight 25.
}\label{fig: spuler counter 5
\end{figure}
\begin{lemma}\label{lemma: T 5}
Consider any subproblem $(I_\ell, h')$ with $\ell \le 14$ and $\nofposvalues{\ell}-h' = 5$.
Let $T'$ be an optimal tree for $(I_\ell, h')$.
Then $T'$ has weight 27 and cost 69 (like \sfigtree 5 a in Fig.~\ref{fig: spuler counter 5}).
\end{lemma}
\begin{proof}
Again, throughout the proof, unless otherwise specified,
the terms \emph{holes}, \emph{queries}, and \emph{separated},
are all with respect to $T'$. Let $h_0$ be the number of weight-0 holes and
$\nofposvalues{q}$ the number of queries with positive weight.
We use the following facts about $T'$.
\begin{description}
\item[(F4)] \emph{$T'$ costs at most 69.}
Indeed, one can solve $(I_\ell,h')$ is as follows:
take the $h'$ rightmost weight-5 keys in $I_\ell$ to be the holes,
then handle the remaining $\nofposvalues{\ell}-h'=5$ queries with positive weight
(queries $1,2,4,6,8$), along with any weight-0 queries $3,5,7,\ldots$,
using tree \sfigtree 5 a at cost 69. \smallskip
\item[(F5)] \emph{$\nofposvalues{q} = 5+h_0$}.
This follows by straightforward calculation:
$\nofposvalues{q} = \nofposvalues{\ell}-(h'-h_0) = 5+h_0$.\smallskip
\item[(F6)]
\emph{$T'$ does not contain five separated weight-5 queries.}
Indeed, otherwise, by Lemma~\ref{lemma: depth},
$T'$ would cost at least $5\cdot d_5 = 70 > 69$, a contradiction.
\end{description}
To finish, we show that $T'$ has cost at least 69.
Along the way we show it has weight 27.
\begin{outercases}
\item[1] First consider the case that $h_0 = 0$.
By (F5), \emph{there are $5$ positive-weight queries in $T'$.}
Also, since $h_0=0$, all weight-0 keys are queries in $T'$,
so the set of all weight-5 queries in $T'$ is separated,
and by (F6), \emph{there are at most four of them}.
The fifth positive-weight query must be the weight-7 query, query 1.
So
\emph{the positive-weight queries in $T'$ are the weight-7 query and four separated weight-5 queries.}
So $T'$ has total weight 27.
Further, by Lemma~\ref{lemma: depth}, the five positive-weight queries in $T'$
have total depth at least $e_5$ in $T'$.
So $T'$ costs at least $5\cdot e_5 + (7-5)\cdot j = 65+2j$,
where $j$ is the depth of the weight-7 query.
If $j\ge 2$ then, by the previous bound, $T'$ costs at least 69,
and we are done.
In the remaining case we have $j = 1$ (as $j=0$ is impossible),
so the weight-7 query is a child of the root.
The four weight-5 queries are in the other child's subtree
(and form a separated set there),
so by Lemma~\ref{lemma: depth} have total depth at least $d_4=10$
in that subtree, and therefore total depth at least 14 in $T'$.
So the total cost of $T'$ is at least $7 + 5\cdot 14 > 69$,
contradicting (F4).
\item[2] In the remaining case, $h_0 \ge 1$.
By (F5), there are $\nofposvalues{q} = 5+ h_0$ positive-weight queries in $T'$.
Let $q_5 \ge \nofposvalues{q}-1$ be the number of weight-5 queries in $T'$.
Since all but $h_0$ of the weight-0 queries are in $T'$,
there is a separated set of $q_5-h_0$ weight-5 queries in $T'$.
By (F6), $q_5 - h_0 \le 4$.
This (with $\nofposvalues{q} = 5+h_0$ and $q_5\ge \nofposvalues{q}-1$)
implies $q_5 = h_0 + 4 = \nofposvalues{q} - 1$.
This implies that the weight-7 query is in $T'$,
along with some separated set of $q_5-h_0 = 4$ weight-5 queries.
Reasoning as in Case~1, the cost of these five queries alone is at least 69.
But $T'$ contains at least one additional weight-5 query
(as $q_5 = 4+h_0 > 4$), so $T'$ costs strictly more than 69,
contradicting (F4). Thus Case~2 cannot actually occur.
\end{outercases}
\end{proof}
We now prove that $(I_{15}, 2)$ does not have optimal substructure.
\begin{lemma}\label{lemma: obstacle}
Let $T^*$ be an optimal subtree $T^*$ for subproblem $(I_{15}, 2)$.
Then $T^*$ contains a subtree $T'$ that solves its subproblem $(I',h')$ non-optimally.
\end{lemma}
\begin{proof}
\begin{figure}[t]\centerin
\noindent\inputTree{Spuler_counter_example_full}
\caption{
Spuler's algorithm fails on the subproblem $(I_{15}, 2)$.
The algorithm computes a tree of cost 116, such as \sfigtree F a above,
but there are trees, such as \sfigtree F b, of cost 115.
The two trees' left subtrees are \sfigtree 4 a and \sfigtree 4 c.
}\label{fig: spuler counter F
\end{figure}
Throughout the proof, unless otherwise specified,
the terms \emph{holes}, \emph{queries}, and \emph{separated},
are all with respect to $T^*$.
We use the following properties of $T^*$:
\begin{description}
\item[(P1)] \emph{$T^*$ costs at most 115.}
Indeed, one way to solve $(I_{15}, 2)$ is to take the two weight-7 keys as holes,
then use tree $\sfigtree F b$ in Fig.~\ref{fig: spuler counter F}, of cost 115.
As $T^*$ is optimal, it costs at most 115. \smallskip
\item[(P2)] \emph{The root of $T^*$ does a less-than comparison.}
Indeed, by~\cite[Theorem~5]{Anderson2002}, since $T^*$ is optimal for its queries,
if $T^*$ does an equality-test at the root, then the total query weight in $T^*$
is at most four times the maximum query weight.
But the total query weight in $T^*$ is at least $7\cdot 5 = 35$,
while the maximum query weight is at most 7. \smallskip
\item[(P3)] \emph{In $T^*$ there are seven positive-weight queries,
and the set of weight-5 queries is separated (by weight-0 queries).}
To show this, we show that no weight-0 key is a hole.
Suppose otherwise for contradiction. Let $k'$ be a weight-0 hole.
Assume without loss of generality that
$k'$ is not used in any node of $T^*$ as an equality key, for otherwise this node can be
removed (spliced-out), without increasing the cost of $T^*$.
If it is used as an inequality key, we can
modify $T^*$ to not use it, without changing its cost, by replacing it with the
weight-5 key $k'' = k'+1$ (which could be a hole or a query).
So we can assume that $k'$ does not appear as a comparison key in $T^*$.
Let $k\in\{k'\pm 1\}$ be a weight-5 query in $T^*$.
(Query $k$ exists in $T^*$ --- otherwise $\{k'-1, k', k'+1\}$ would all be holes.)
Replace $k$ throughout $T^*$ by $k'$.
As $k'$ and $k$ are adjacent keys and $k'$ does not occur in $T^*$,
the resulting tree ${\bar{T}}$ still solves $(I_{15}, 2)$,
and ${\bar{T}}$ costs less than $T^*$ (as ${\bar{T}}$ uses the weight-0 key $k'$ instead of the weight-5 key $k$).
This contradicts the optimality of $T^*$.
\end{description}
%
By (P3), $T^*$ has seven positive-weight queries.
Assume without loss of generality (by (P2) and symmetry) that the left subtree of $T^*$
has at least four of the seven.
Let $T'$ be the left subtree.
Denote the subproblem that $T'$ solves by $(I_\ell, h')$.
To prove the lemma, assume for contradiction that $T'$ is optimal for its subproblem,
and proceed by cases:
\begin{outercases}
\item[1]\emph{$T'$ has four positive-weight queries.}
That is, $T'$ solves a subproblem $(I_\ell, h')$ where $\nofposvalues{\ell}-h' = 4$.
By Lemma~\ref{lemma: T 4}, $T'$ has cost 49 and weight 22.
The right subtree $T''$ of $T^*$ has the three remaining positive-weight queries,
the leftmost two of which are separated in $T''$ by a zero-weight query.
By Lemma~\ref{lemma: depth}\,(ii), $T''$ has cost at least $5\cdot e_3 = 30$ and weight at least 15.
The cost of $T^*$ is its weight plus the costs of $T'$ and $T''$.
By the above observations, this is at least $(22+15)+49+30 = 116$,
contradicting (P1).
\item[2]\emph{$T'$ has five positive-weight queries.}
That is, $T'$ solves a subproblem $(I_\ell, h')$ where $\nofposvalues{\ell}-h' = 5$.
By Lemma~\ref{lemma: T 5}, $T'$ has cost 69 and weight 27.
The right subtree $T''$ of $T^*$ has the two other positive-weight queries,
which have total depth at least $1+1=2$ in $T''$,
and each has weight at least 5.
So $T''$ has cost, and weight, at least $5\cdot 2 = 10$.
The cost of $T^*$ is its weight plus the costs of $T'$ and $T''$.
By the above observations, this is at least $(27+10) + 69 + 10 = 116$,
contradicting (P1).
\item[3]\emph{$T'$ has six or seven positive-weight queries.}
Let set $S$ consist of just the first six of these queries.
Since $T'$ is the left subtree of $T^*$ (which has seven positive-weight queries)
$S$ does not contain the last key, 15.
So (using (P3)) all queries in $S$, except possibly $\{1, 2\}$, are separated by weight-zero queries in $T'$.
By Lemma~\ref{lemma: depth}\,(ii), $T'$ has cost at least $5\cdot e_6 = 90$.
The cost of $T^*$ is its weight (at least $7\cdot 5 = 35$),
plus the cost of its left and right subtrees (at least 90, counting $T'$ alone).
So $T^*$ costs at least $35+90=125$, contradicting (P1).
\end{outercases}
\end{proof}
Finally we prove Theorem~\ref{thm: spuler flaw}.
\begin{proof}[Proof of Theorem~\ref{thm: spuler flaw}]
Let $({\sf K}, p)$ be the instance with interval $I_{15}$ and weights as specified before Lemma~\ref{lemma: obstacle}.
Let $T$ be the tree computed by Spuler's algorithm for $(I_{15}, 2)$.
If $T$ is not optimal for $(I_{15},2)$, then the theorem holds.
So assume $T$ is optimal for $(I_{15},2)$.
By Lemma~\ref{lemma: obstacle},
the subproblem $(I_{15}, 2)$ does not have optimal substructure
--- some subtree $T'$ of $T$ is not optimal for its subproblem $(I', h')$.
But Spuler's algorithm returns $T'$ for $(I', h')$.
So Spuler's algorithm computes a non-optimal solution to subproblem $(I', h')$.
\end{proof}
In fact, for $(I_{15}, 2)$, Spuler's algorithm computes a non-optimal tree of cost 116,
such as \sfigtree F a in Fig.~\ref{fig: spuler counter F}.
This can be verified by executing the Python code for the algorithm in Appendix~\ref{sec: code spuler}.
(By inspection, tree \sfigtree F b in that figure costs 115, so \sfigtree F a is not optimal.)
\paragraph{Discussion.}
As mentioned earlier, this counterexample is just for a subproblem.
This subproblem has $h=2$ holes, so it does not
represent a complete instance of \myproblem{2wcst}
for which Spuler's algorithm would give an incorrect \emph{final} result.
However, this counterexample does demonstrate that Spuler's algorithm
solves some \emph{subproblems} incorrectly,
so that the recurrence relation underlying its dynamic program is incorrect.
At a minimum, this suggests that any proof of correctness for Spuler's algorithm
would require a more delicate approach. Anderson~{et al.\xspace}~\cite{Anderson2002}
establish some conditions on the weights of equality-test keys in optimal trees.
It may be possible to leverage the bounds from~\cite{Anderson2002} to show that
bad subproblems --- those that are not solved correctly by the algorithm ---
never appear as subproblems of an optimal complete tree.
For example, per Anderson et al.\xspace,
for any equality-test node in any optimal tree, the weight of the node's key
must be at least one quarter of the total weight of the keys that reach the node.
Hence, if a subproblem $(I', h')$ is solved by some subtree $T'$
of an optimal tree $T^*$, then each hole key in $T'$
must have weight at least one third of the total weight of the queries in $T'$.
This implies that the subproblem $(I_{15}, 2)$ in the proof of Theorem~\ref{thm: spuler flaw}
cannot actually occur in any optimal tree for $(I_{15}, 0)$.
While the question of correctness of Spuler's algorithm is somewhat
intriguing, it should be noted that showing its correctness will
not improve known complexity bounds for \myproblem{2wcst}, as
there are faster \myproblem{2wcst} algorithms that are known to be
correct~\cite{Anderson2002,chrobak_etal_isaac_2015}.
\subsection{Proof of Lemma~\ref{lemma: depth}.}
Here is the promised proof of Lemma~\ref{lemma: depth}.
\begin{proof}[Proof of Lemma~\ref{lemma: depth}]
Recall that $T$ is a tree for some subproblem of $({\tilde{I}}, {\tilde{h}})$
and $Q$ is a subset of the queries in $T$, with $m = |Q|$.
\smallskip
\noindent\emph{Part (i).} Assume that $Q$ is separated.
Our goal is to show that the total depth in $T$ of queries in $Q$ is at least $d_m$,
as defined before Lemma~\ref{lemma: depth}.
It is convenient to recast the problem as follows.
Change the weight of each query in $Q$ to 1.
Change the weight of each query not in $Q$ to 0.
We will refer to the resulting cost of a tree as
\emph{modified cost}.
Now we need to show that the modified cost of $T$ is at least $d_m$.
The proof is by induction on $m$.
The base cases (when $m = 1,2$) are easily verified, so consider the inductive step,
for some given $m \ge 3$. We assume that $T$ and $Q$ are chosen to
minimize the modified cost of $T$, subject to $|Q|=m$.
Call this the \emph{minimality assumption}.
Suppose $T$ does an inequality test at the root.
Let $T_1$ and $T_2$ be the left and right subtrees of $T$,
and for $a\in\braced{1,2}$ let $Q_a\subseteq Q$ contain the queries in $Q$ that fall in $T_a$.
Let $i = |Q_1|$, so that $|Q_2| = m-i$.
For $a\in\braced{1,2}$, query set $Q_a$ is $T_a$-separated.
By the minimality assumption, $0\not\in\{i, m-i\}$.
The modified cost of $T$ is its weight ($m$),
plus the modified costs of $T_1$ and $T_2$.
By the inductive assumption,
this is at least $m+d_{i} + d_{m-i} \ge d_m$, as desired.
Suppose $T$ does an equality test at the root. The minimality assumption implies that
the equality-test key has non-zero (modified) weight. (This follows via
the argument given for Property (P2) in the proof of Lemma~\ref{lemma: obstacle}.)
So the equality-test key is in $Q$.
Let $T_1$ be the no-subtree of $T$ and
let $Q_1\subseteq Q$ contain the queries in $Q$ that fall in $T_1$;
so we have $|Q_1|=m-1$.
Set $Q_1$ is $T_1$-separated, so by the inductive assumption,
$T_1$ has modified cost at least $d_{m-1}$.
So the modified cost of $T$ is at least $m+ d_{m-1} = m + d_1 + d_{m-1} \ge d_m$, as desired.
\smallskip
\noindent\emph{Part (ii).} The proof of Part (ii) follows the same inductive argument as above.
The base cases for $m=1,2$ are trivial. The verification of the base case
for $m=3$ is by straightforward case analysis.
In the inductive step, the only significant difference is in the case
when $T$ does an inequality test at the root. Since $Q$ is now only nearly separated,
$Q_1$ will be $T_1$-separated while $Q_2$ will be nearly $T_2$-separated
(or vice versa), giving us that the modified cost of
$T$ is at least $m+d_{m_1} + e_{m_2} \ge d_m$.
\end{proof}
\section{Python code for Huang and Wong's \myproblem{gbsplit} algorithm}\label{sec: code huang}
See Figure~\ref{fig: code huang}.
\begin{figure}
{
\vspace*{-0.5in}
\small
\lstinputlisting{CODE_huang1984.tex}
}
\caption{Python code for Huang and Wong's \myproblem{gbsplit} algorithm}\label{fig: code huang}
\end{figure}
\section{Python code for Spuler's \myproblem{2wcst} algorithm}\label{sec: code spuler}
See Figure~\ref{fig: code spuler}.
\begin{figure}
{
\vspace*{-0.5in}
\small
\lstinputlisting{CODE_spuler1994.tex}
}
\caption{Python code for Spuler's \myproblem{2wcst} algorithm}\label{fig: code spuler}
\end{figure}
| {'timestamp': '2019-01-15T02:04:11', 'yymm': '1901', 'arxiv_id': '1901.03783', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03783'} | arxiv |
\section{Introduction}
\label{intro}
Pedestrian attributes recognition involves describing the appearance of a person observed in surveillance or similar scenarios. This description includes inherent traits such as age and gender as well as less permanent traits such as clothing, accessories and footwear. Although it could be used in a wide range of scenarios, typically person attributes are used in person re-identification. Re-identification can proceed in several directions. One way is to combine many attributes together to re-identify a person \cite{martinho2018super} or by combining attributes with an another classifier \cite{schumann2017person}.
Early work on pedestrian attribute recognition proposed recognizing a small number of attributes (e.g., gender) using hand crafted features. Unfortunately, it is difficult to hand-craft a feature that is effective for a diverse set of attributes. For example, features that are effective for recognizing gender may not work as well for recognizing footwear. This is the primary reason why end-to-end deep learning has become increasingly popular for attribute recognition and person re-identification. However, most deep learning approaches for person attribute recognition use shallow CNNs (i.e., 8-layer AlexNet architecture pre-trained with ImageNet) \cite{krizhevsky2012imagenet,sudowe2015person,li2015multi,zhu2015multi}). Later approaches moved towards deeper ResNet architectures both with\cite{yu2016weakly,sarfraz2017deep} and without pre-training \cite{bekele2017multi}, but even these are comparably shallow.
Shallow networks are not ideal for this problem because they have a limited ability to utilize the rich amount of information present in these images. In this paper, we demonstrate this through experimental validation on popular attributes datasets including Celeb-A, PETA, and PA-100K. We discuss the challenges of training such deeper networks on a limited amount of training data. Using the proposed techniques, we achieve state-of-the-art results on these datasets. We also present an interpretation with GradCAM that suggests that shallower networks typically consider less contextual information when making a classification decision.
\section{Related Work}
Early approaches to person attribute recognition involved heavy use of hand-crafted features. Features included color histograms \cite{layne2012person, martinson2013identifying}, HOG, textures and ensemble of localized features (ELF) \cite{layne2014attributes}. A common formula was to use a linear support vector machine (SVM) combined with hand-crafted features to recognize attributes \cite{layne2014attributes}.
This suffers from several problems. First, the SVM optimizes each attribute independently and lacks a way to learn relationship among attributes. For example, attributes such as 'casual lower body' are closely related to other attributes such as 'wearing jeans', yet the SVM has no method of learning this relationship. We can improve the performance of both by leveraging a classifier that can learn both of these attributes simultaneously. Second, a large class imbalance can make this an extremely difficult problem as the hyperplanes are overwhelmed by a large number of negative examples compared to the rare positive examples. Finally, it it is difficult to craft a set of features that perform well on such a wide variety of attributes in a wide variety of situations.
Later work \cite{zhang2014panda,zhu2015multi} proposed using CNNs which showed that end-to-end learning (i.e., learning both feature and classification using stochastic gradient descent) could mitigate some of the limitations associated with support vector machines and hand-crafted features. This has three primary benefits. First, features are extracted using convolutional filters learned directly from the training data. This eliminates the need to hand-craft features for each dataset and attribute. Second, the feature extractors and the classifier parameters are optimized together in an end-to-end fashion. The extracted features are optimized for the particular attribute automatically. Finally, multi-label CNNs \cite{zhu2015multi} can significantly outperform SVMs because of their capacity to learn relationships among attributes.
Stacked conventional CNNs have limitations in their generalization ability when trained with smaller datasets. Because of this, pedestrian attribute recognition datasets are harder for CNNs to learn due to their limited size. The multi-label CNN (ML-CNN) in \cite{zhu2015multi}, for instance, had to be shallow with only 3 convolutional layers to cope with the smaller sample size in the datasets. Existing CNN-based approaches are either shallow networks, limiting the learning of complex features, or they are deeper networks pre-trained on larger datasets such as ImageNet \cite{li2015multi}. In this case, representative features are not learned from training data, as is the goal of this work. Examples of pre-training a deeper networks includes \cite{antipov2015learned,sudowe2015person,deng2015learning,zhang2014panda}.
CNNs with branched connections in GoogLeNet \cite{szegedy2015going} and residual mapping using "shortcut" connections were proposed to tackle the accuracy degradation problem with deep CNNs\cite{he2015deep,he2016identity}. Residual networks are composed of residual units (or blocks) that have a double convolution residual leg and a direct input-to-output identity mapping or "shortcut" connection \cite{bekele2017multi}. Stacking residual blocks of up to 1000 layers, residual networks were shown to achieve state-of-the-art results on ImageNet large scale visual recognition challenge in 2015 \cite{he2015deep}. They are also shown to accelerate the learning process and converge quicker than their ``plain'' stacked CNN counterparts \cite{szegedy2016inception}. Recent work exploited joint prediction of weakly-supervised attribute locations \cite{yu2016weakly} and view \cite{sarfraz2017deep} together with attribute recognition using a pre-trained GoogLeNet and showed state-of-the-art performance on PETA. The increased performances in these methods were attributed to the joint attribute location and view prediction as well as a complicated branching schemes. Contrast that approach with this approach, where we outperform these approaches using only deeper residual networks trained with attribute recognition.
\section{Methodology}
\label{sec:methods}
In this section, we describe our network architecture and training
methodology. We go further than previous work \cite{yu2016weakly,sarfraz2017deep} by using deeper residual networks (ResNet) \cite{he2016identity} for creating a richer feature sets that could achieve the state-of-the-art performance on
attribute recognition datasets.
\subsection{Residual Networks (ResNet)}
The basic unit of a residual network is the residual block. This is composed of a regular feed-forward path of stacked convolutional layers combined with a side ``short-cut'' connection. The features from both branches are merged at the end of the block. Joint attribute learning uses stacked residual blocks as to learn relevant features. Once an image has been processed by a number of residual blocks, the features are pooled and passed through a joint multi-label classifier (see Fig. \ref{fig:arch} right). Hence, the learned embedding at the last layer of the the feature extractor ResNet is a joint representation for all the attributes. We apply a sigmoid for the final classifier layer for jointly learning the attributes.
Previous work on person attributes recognition with relatively deeper architectures include \cite{yu2016weakly} and \cite{sarfraz2017deep} for joint person attribute learning. Both implemented variants of the GoogLeNet architecture \cite{szegedy2015going}. We explored variations of GoogLeNet, DenseNet and ResNet and found variants of ResNet performed better on joint person attributes learning (see ablation studies in the Experimental Results). We have selected ResNet as the best architecture for this problem, and use this for the remainder of the analysis.
\begin{figure*}
\centering
\includegraphics[width=90mm]{fig/arch}
\includegraphics[width=60mm]{fig/resnet}
\caption{ResNet-based joint multi-attribute recognition model (left) and a
simplified residual unit (right).}
\label{fig:arch}
\end{figure*}
\subsection{Feature Pooling}
After all of the residual blocks, the features are pooled to reduce dimensionality before classification. Several methods of pooling at the feature stage have been proposed for joint multi-attribute recognition. They range from the simple global pooling at the last stage of the feature extraction pipeline to more complex pyramidal pooling schemes \cite{yu2016weakly}.
Deeper networks such as ResNet \cite{he2016identity}, GoogLeNet \cite{szegedy2015going} and DenseNet \cite{huang2016densely} pool features globally. Global pooling reduces the dimensionality of an $h \times w \times d$ network to $1 \times 1 \times d$. The depth of these networks gives rich features that are sufficient to be representative. Further, they avoid the computational burden required to recognize attributes, and also avoids avoids dense fully connected classifier layer. Unless otherwise specified, our network structure employs a global average pooling (GAP), which takes the average of each of the $d$ feature maps before performing attribute classification.
\subsection{Classifier Types}
The most common classifier (i.e., output) layers used in attribute recognition are the dense and simple logistic single output layers. Their application also depends on the depth of the network and the feature pooling method used in conjunction. In our approach, we use a simple logistic single layer classifier. This is preferred for deeper networks in conjunction with the global feature pooling methods. The dense classifier is typically used for shallower networks such as DeepMAR and ACN together with local max-pooling. It is usually two fully connected layers with dropouts in between them. Because fully connected layers have exponential computational requirements with the number of neurons, they are not feasible for the rich set of features produced by deeper networks.
\subsection{Training and Optimization Objective}
We train our residual network using stochastic gradient descent with a learning rate of $0.1$. For our loss function we use binary cross-entropy (BCE) loss\cite{zhu2015multi}. This loss is widely used and is generally appropriate due the inherent presence of multiple attributes. By using a multi-label BCE loss, we can not only learn about individual attributes, we can also learn about their joint interrelationship. Equation \ref{eq:total_loss} shows BCE loss.
\begin{equation}
\label{eq:total_loss}
Total Loss = \sum_{m=1}^{M}{\gamma_{m} loss_{m}}
\end{equation}
where $loss_{m}$ is the BCE contribution of $m^{th}$ attribute to the total loss. The $\lambda$ parameter could be used to control the learning to be focused towards a particular attribute. This could be useful if a particular attribute is especially important for a particular recognition scenario. For instance, intrinsic attributes such as age and gender may be more important than clothing attributes for security applications. For our experiment we treated the contribution of each attribute equally by setting $\lambda$ to $\dfrac{1}{M}$.
The individual attribute losses, $loss_{m}$, are computed using the sigmoid binary cross-entropy loss for binary classification of each attribute as shown in
Equation \ref{eqn:loss_m}.
\begin{equation}
\begin{split}
\label{eqn:loss_m}
loss = -\dfrac{1}{N}\sum_{i=1}^{N} {\omega_{m}^{i}(y_{m}^{i}log(p(x_{m}^{i}))} \\ + {(1-y_{m}^{i})log(1-p(x_{m}^{i})))}
\end{split}
\end{equation}
where $y^{i}$ is the true attribute label for $m^{th}$ attribute and $i^{th}$ example. The predicted probabilities are computed via the sigmoid function and is given by Equation \ref{eqn:p_x}.
\begin{equation}
\label{eqn:p_x}
p(x_{m}^{i}) = \dfrac{1}{1 + exp(-x_{m}^{i})}
\end{equation}
and $w_{m}$ is a sample weighting factor introduced to account for the bias that could occur due to inherent class imbalance within an attribute. The form of the sample weighting schemes is discussed in the next section.
This weighted multi-label optimization objective was minimized using stochastic gradient decent (SGD) with Nestrov momentum.
\subsection{Sample Weighting}
Sample weighting controls the bias given to each attribute. In attribute recognition, there is typically a limited amount of highly skewed intra-class distribution. For this reason, most attribute recognition methods employ sample-based weighting \cite{li2015multi,zhu2015multi,yu2016weakly,sarfraz2017deep}. Unless otherwise specified, we use a the sample weighting scheme initially proposed by Li et al.\cite{li2015multi}, see Equation \ref{eqn:DeepMAR}.
\begin{equation}
\label{eqn:DeepMAR}
\omega _{m}^{i} = \left\{\begin{matrix}
exp((1-p_{m})/\sigma^{2})\ \ if\ y_{m}^{i}=1 \\ exp(p_{m}/\sigma^{2})\ \ else
\end{matrix}\right.
\end{equation}
where $p_{m}$ is the number of positive examples in the $m^{th}$ attribute. $\sigma$ is a control parameter. This parameter can be used to control the number of true positives and hence control the recall in effect. Our goal is to maximize recognition among all attributes, and for datasets such as PETA the 35 commonly used attributes all represent a certain threshold of positive examples\cite{deng2014pedestrian}. For that reason, unless otherwise noted, we set $\sigma=1$ for all our experiments. A lower value would improve recall at the expense of mean accuracy.
%
\subsection{Probability Calibration}
The output of our residual network architecture is one output neuron per attribute. This output represents a probability that the attribute is present. The primary challenge is developing ways to interpret this probability. In person attribute recognition literature \cite{yu2016weakly}\cite{sarfraz2017deep}, a naive probability thresholding is commonly employed. That is, thresholding the output of the network at 0.5. This naive approach does not work as well as it does in large scale image recognition such as ImageNet. We have found that a biased dataset skews the probabilities of each attribute. An attribute that appears rarely will be skewed towards lower values than an attribute that appears more commonly. This is an issue that is not typically found in popular datasets such as ImageNet, as these are all well balanced.
In this work, we propose a novel way of determining the threshold for each attribute neuron (i.e., probability calibration). For this, we compute the ROC curve for the training dataset over each attribute and computing backwards the optimal probability threshold at the curve where precision and recall are equivalent (i.e., equal error rate). Note that these calibration parameters are computed only using the training set during training time during validation and testing stages, we used the same set of probability thresholds from the training set. While we provide a full ablation study in the experimental results, we have found this strategy to strike a good balance between precision and recall, as it favors a strong example-based accuracy and F1 score. For this reason, we called it {\em F1 calibration}.
Probability calibration is in a sense similar in goals to sample weighting. Sample weighting attempts to balance the weighting of the samples that are being learned by the network. With sample weighting, naive thresholding is sensible, since the weights were balanced during training. We can accomplish a similar result without sample weight. In this case, we use the standard weighting of $\sigma=1$, then using probability calibration to modify the thresholds. We further discuss this in the experimental results section. Experimentally, we have found that probability calibration is a more flexible approach and that it typically outperforms sample weighting.
\subsection{Data Augmentation}
In this paper we apply the most commonly used data augmentation techniques in the person attribute recognition literature. These include random flip and crop, random image resizing with and without keeping the aspect ratio, mean subtraction, random RGB color jitter and random rotation. All the data augmentation in this paper was performed on-line, i.e. each image was randomly augmented by the one or combination of the listed methods in each iteration separately.
\subsection{Interpretability}
Interpretability provides important insights into the different ways that deep convolutional networks classify attributes. For this, we use the recently proposed GradCAM approach \cite{selvaraju2017grad}. GradCAM creates visual interpretations using the error gradients resulting from predicting each attribute. This provides stronger responses in regions that had a greater impact in predicting a particular attribute. This evaluation of GradCAM to the joint attribute recognition residual network is quite different from other networks that use this to evaluate softmax classifiers. Each attribute is strongly related to other attributes, i.e. the learned embedding space is a joint space for the attributes and hence is not easier to disentangle for a single attribute. For this reason, we expect to see this interrelationship or correlation between some attributes to manifest in the attribute predictions. For example, a casual lower body likely will commonly appear with a casual upper body. Therefore, the interpretation of 'casual lower body' should also highlight the relevant regions of the upper body. On the other hand, an attribute like `wearing jeans' only impacts the lower body, so the interpretation should respond highly only in this region.
\section{Experimental Setup}
\label{sec:experiments}
\subsection{Datasets}
Attribute recognition is greatly impacted by the distance from the camera, variable lighting (e.g., soft shadow, hard shadows), pose, and severe occlusions due to other objects such as shrubs or benches\cite{shi2015transferring}. It also must classify attributes using a very small number of training examples. Unlike ImageNet (common dataset with typical size to train deeper models), which has 1.2 million training images, the training set for PETA has only 9,500 images. Moreover, again unlike ImageNet, which has more or less
equally sized images with aspect ratios close to 1, images in PETA came from a wide variety of sources with wildly different image sizes and their aspect ratio is far from 1 as the person length is mostly far larger than the width.
Furthermore, attributes datasets such as PETA \cite{deng2014pedestrian} are challenging because of their intra-class variations and their skewed class distributions. In some attributes, the number of positive examples is smaller than 1\% of the training set. Moreover, some attributes occupy a very small area compared to the whole image. For instance, logos and special marks on t-shirts and v-neck shirts could occupy only a few pixels in area. Finally, attribute recognition is inherently a multi-label learning problem. Multiple person attributes may be present in an example image and there is inherent relationships among attributes \cite{zhu2015multi,bekele2017multi}.
Three datasets were employed to demonstrate the effectiveness of deeper feature extraction pipeline compared to complicated branching and computationally expensive series of dense layers. We demonstrate state-of-the-art performance on two person datasets: the PEdesTrian Attribute (PETA) recognition dataset \cite{deng2014pedestrian} and PA-100K dataset \cite{liu2017hydraplus}. We also show recognition of attributes from the face using the celebrity faces attributes dataset (CelebA) \cite{liu2015deep}. PETA contains 19,000 images captured by surveillance cameras in indoor and outdoor scenarios. Originally the images were labeled with 61 binary attributes, which are related to age, clothing, carrying items, wearing accessories etc. There are also 4 multi-class attributes related to color. Deng et al. \cite{deng2014pedestrian} suggested to use 35 attributes due to severe class imbalance issues in the remaining. Therefore, we adopted these 35 attributes PETA images exhibit wide range of variations in illumination, pose, blurriness, resolution, background and occlusion. We evaluate with the suggested \cite{deng2014pedestrian} random train/validation/test split of 9500/1900/7600 images for equivalent comparison. The PA-100K contains 100,000 images captured from 598 scenes. This is by far the largest full body person attributes recognition dataset. Each image is labeled using 26 binary full body attributes. It also features a wide range of image resolutions than other datasets. CelebA contains 202,600 images labeled with 40 face-based attributes. We used the provided splits for both PA-100K and CelebA datasets. For the ablation analysis part, we consistently used PETA for uniform comparisons across all techniques.
\subsection{Evaluation Metrics}
Following the evaluation metrics of \cite{bekele2017multi}, the performance metrics we employed are: mean average accuracy (mA), area under the curve (computed as averaged over all samples and attributes) (AUC), example based metrics of accuracy (Acc) (i.e., percentage where all attributes were correctly classified), precision (Prec), recall (Rec), and F1 score. These metrics display a balanced performance across the attributes.
\subsection{Implementation Details}
The networks were trained with similar parameters for fair comparison. The input batch size were 16 for all the experiments. The images were mean subtracted with PETA mean pixel values. The cost function defined in Equation ~\ref{eq:total_loss} was optimized jointly for all the 35 attributes using SGD optimization with learning rate schedule that starts out at 0.1 and dropped by a factor of 10 at epochs 180 and 300. The layers were highly regularized with an $l_{2}$ regularizers of value 0.0001 to prevent over-fitting.
\section{Results and Discussion}
\label{sec:results}
In this section, we, first, present state-of-the-art results on the three person attributes datasets. We then go deeper into analysis of the several factors that made it possible to train such deeper models with very limited and large multi-label space with a series of ablation experiments using the PETA dataset.
\subsection{Attribute Recognition Performance on PETA}
\begin{table}
\caption{Comparison of multi-attribute recognition performance of proposed
model and the state-of-the-art on PETA. The data augmentation employed
are
mean subtraction, random color jitter, and random flip.}
\label{tbl:sota}
\centering
\resizebox{\columnwidth}{!}{
\begin{tabular}{@{}lcccccc@{}}
\toprule
\multicolumn{1}{c}{Networks/Method} & mA & Acc & Prec & Rec & F1 &
\multicolumn{1}{l}{\begin{tabular}[c]{@{}l@{}}AUC \\ (micro)\end{tabular}}
\\ \midrule
MAResNet \cite{bekele2017multi} & 75.43 & - & - & 70.83 & - & -
\\
ResNet-152 \cite{martinho2018super} & 81.65 & - & - & - & - & - \\
ACN\cite{sudowe2015person} & 81.15 & 73.66 & 84.06 & 81.26 & 82.64 & - \\
DeepMAR \cite{li2015multi} & 82.89 & 75.07 & 83.68 & 83.14 & 83.41 & - \\
WPAL-GMP \cite{yu2016weakly} & \textbf{85.50} & 76.98 & 84.07 & 85.78 & 84.90 & - \\
VeSPA \cite{sarfraz2017deep} & 83.45 & 77.73 & 86.18 & 84.81 & 85.49 & - \\
\midrule
\begin{tabular}[c]{@{}l@{}}Proposed ResNet18\\ F1 calib + data
aug\end{tabular}
& 74.09 & 67.45 & 75.40 & 81.01 & 78.10 & 84.92 \\
\begin{tabular}[c]{@{}l@{}}Proposed ResNet34\\ F1 calib + data
aug\end{tabular}
& 75.75 & 69.40 & 77.03 & 82.24 & 79.55 & 85.90 \\
\begin{tabular}[c]{@{}l@{}}Proposed ResNet50\\ F1 calib/no data
aug\end{tabular}
& 84.18 & 78.03 & 85.78 & 85.69 & 85.73 & 90.55 \\
\begin{tabular}[c]{@{}l@{}}Proposed ResNet50\\ F1 calib + data
aug\end{tabular} & 84.68 & \textbf{78.89} & \textbf{86.38} & \textbf{86.41}
& \textbf{86.39} & \textbf{90.96} \\ \bottomrule
\end{tabular}
}
\end{table}
Table \ref{tbl:sota} compares the performance of our proposed approach against
other state-of-the-art attribute recognition approaches on the PETA dataset.
ResNet50 with data augmentation techniques such as random flip and RGB color
jitter outperforms the state-of-the-art in all the metrics presented with the
exception of mean accuracy. However, it is clear from other metrics such as
precision, recall and F1 score that ResNet50 is a well balanced recognition
approach performing well across a larger number of attributes. Without any
data augmentation, ResNet50 still has a performance that is comparable to or better
than other approaches.
\subsection{Attribute Recognition Performance on PA-100K}
\begin{table}[b]
\caption{Comparison of multi-attribute recognition performance of the
proposed model
and the state-of-the-art on PA-100K. The data augmentation employed are
mean subtraction, random color jitter, and random flip.}
\label{tbl:sota_pa100}
\centering
\resizebox{\columnwidth}{!}{
\begin{tabular}{@{}lllllll@{}}
\toprule
Networks/Method & mA & Acc & Prec & Rec & F1 & AUC \\ \midrule
HydraPlusNet \cite{liu2017hydraplus} & 72.70 & 70.39 & 82.24 & 80.42 &
81.32 & \multicolumn{1}{c}{-} \\
DeepMAR \cite{liu2017hydraplus} & 74.21 & 72.19 & 82.97 & 82.09 & 82.53 &
\multicolumn{1}{c}{-} \\ \midrule
\begin{tabular}[c]{@{}l@{}}Proposed ResNet18\\ F1 calibration\end{tabular}
& 74.45 & 72.42 & 83.90 & 82.03 & 82.95 & 88.97 \\
\begin{tabular}[c]{@{}l@{}}Proposed ResNet34\\ F1 calibration\end{tabular}
& \textbf{78.77} & \textbf{75.05} & \textbf{85.01} & \textbf{84.56} &
\textbf{84.78} & \textbf{89.95} \\
\begin{tabular}[c]{@{}l@{}}Proposed ResNet50\\ deepmar\end{tabular} & 78.07
& 73.51 & 83.74 & 83.45 & 83.59 & 89.19 \\
\begin{tabular}[c]{@{}l@{}}Proposed ResNet50\\ F1 calibration\end{tabular} & 78.12 & 74.11 & 84.42 & 84.09 & 84.25 & 89.54 \\ \bottomrule
\end{tabular}
}
\end{table}
Table \ref{tbl:sota_pa100} compares the performance of our proposed approach
against
other state-of-the-art attribute recognition approaches on the PA-100K
dataset.
Our proposed model outperforms the state-of-the-art in this dataset by about
3\% on each metric. From the metrics such as precision, recall and F1 score we
can see that our model is a well balanced recognition approach performing well
across a larger number of attributes. In this case, we can also see that F1 calibration and
sample weighting both outperform the state-of-the-art results on this dataset. It is also
noteworthy that on this dataset probability calibration using F1 calibration outperforms naive
thresholding with sample weighting.
\subsection{Attribute Recognition Performance on CelebA}
\begin{table}
\caption{Comparison of multi-attribute recognition performance of the
proposed model and the state-of-the-art on CelebA. The data
augmentation
employed are mean subtraction, random color jitter, and random flip.}
\label{tbl:sota_celeba}
\centering
\resizebox{\columnwidth}{!}{
\begin{tabular}{@{}lllllll@{}}
\toprule
Networks/Method & mA & Acc & Prec & Rec & F1 & AUC \\ \midrule
LNets+ANet \cite{liu2015deep} & \textbf{87} & \multicolumn{1}{c}{-} &
\multicolumn{1}{c}{-} & \multicolumn{1}{c}{-} & \multicolumn{1}{c}{-} &
\multicolumn{1}{c}{-} \\
FaceTracker \cite{liu2015deep} & 81 & \multicolumn{1}{c}{-} &
\multicolumn{1}{c}{-} & \multicolumn{1}{c}{-} & \multicolumn{1}{c}{-} &
\multicolumn{1}{c}{-} \\
PANDA-l \cite{liu2015deep} & 85 & \multicolumn{1}{c}{-} & \multicolumn{1}{c}{-}
& \multicolumn{1}{c}{-} & \multicolumn{1}{c}{-} & \multicolumn{1}{c}{-} \\
\midrule
\begin{tabular}[c]{@{}l@{}}Proposed ResNet18\\ FPR@10\%
calibration\end{tabular}
& 85.75 & 63.47 & 86.43 & 70.32 & 77.55 & 88.15 \\
\begin{tabular}[c]{@{}l@{}}Proposed ResNet34\\ FPR@10\%
calibration\end{tabular} & 86.55 & 65.18 & \textbf{86.55} & 72.34 & 78.81 &
\textbf{88.79} \\
\begin{tabular}[c]{@{}l@{}}Proposed ResNet34\\ F1 calibration\end{tabular} &
83.16 & 65.20 & 77.80 & \textbf{80.19} & 78.98 & 86.42 \\
\begin{tabular}[c]{@{}l@{}}Proposed ResNet34\\ FPR@8\% calibration\end{tabular}
& 85.72 & \textbf{66.67} & 82.25 & 77.79 & \textbf{79.96} & 87.98 \\
\bottomrule
\end{tabular}
}
\end{table}
Table \ref{tbl:sota_celeba} compares the performance of our proposed model to
that of the state-of-the-art attribute recognition approaches on the CelebA face attributes
dataset. Our approach performed competitively to the state-of-the-art
approaches on the mean accuracy metric. The other approaches only reported the
mean accuracy. Hence, it is not clear how balanced their recognition on the
other metrics were. To illustrate this point, we run the same network with
different probability calibration techniques discussed in the methods section
and showed that it is possible to get a mean accuracy competitive to the
state-of-the-art at the expense of precision (i.e. proposed system with
FPR@10\% calibration). However, we would like to point out that the more
balanced recognition performance is achieved with the F1 score calibration although the mean
accuracy is relatively lower.
\subsection{Ablation on Effects of Training Strategies}
Here, we explore the benefit of the strategies outlined above. We show comparisons of different strategies based on ResNet34 as that allows fair comparisons with other types of networks such as inception (GoogLeNet with 22 layers) and AlexNet-based DeepMAR (typically 8 - 12 layers) that are
used in \cite{yu2016weakly} and \cite{sarfraz2017deep}.
\subsubsection{Architectural Comparisons}
\begin{table}[b]
\caption{Architectural comparisons of multi-label attribute recognition on
PETA.}
\label{tbl:arch}
\centering
\resizebox{\columnwidth}{!}{
\begin{tabular}{@{}lcccccc@{}}
\toprule
\multicolumn{1}{c}{Networks/Method} & mA & Acc & Rec & Prec & F1 & \multicolumn{1}{l}{\begin{tabular}[c]{@{}l@{}}AUC \\ (micro)\end{tabular}} \\ \midrule
Inception v3 & \textbf{84.77} & 72.69 & 81.36 & 81.43 & 81.39 & 87.69 \\
DenseNet34 & 81.91 & 67.76 & 78.17 & 78.18 & 78.17 & 85.56 \\
DesneNet121 & 83.19 & 69.57 & 79.35 & 79.40 & 79.38 & 86.35 \\ \midrule
ResNet34 & 84.54 & \textbf{72.94} & \textbf{81.57} & \textbf{81.73} & \textbf{81.65} & \textbf{87.81} \\ \bottomrule
\end{tabular}
}
\end{table}
We compare three deeper architectures: Inception version 3 (a variant
of the 22-layer GoogLeNet-based architecture), DenseNet34 (with 34 layers),
DenseNet121 (121 layers), and ResNet34. Table \ref{tbl:arch} shows the benefits
of residual blocks. ResNet34 is comparable to, but slightly outperforms, GoogLeNet
(Inception v3). ResNet34 also outperforms both variants of DenseNet (34 and 121 layers).
It is important to note here that Inception will quickly overfit with deeper architectures, and with increased
data augmentation it trains at least twice slower than ResNet34. As we go
deeper in these networks without additional strategies, the networks
overfit too quickly as shown on the performance of DenseNet34 vs. DenseNet121. The slightly higher mean average accuracy of GoogLeNet when compared to ResNet34 is due to the fact that ResNet34 is trained using F1-calibration for balanced performance on the other metrics (specifically F1 metric).
\subsubsection{Effects of Pooling and Classifiers Types}
\begin{table}
\caption{Effect of classifier type on ResNet34 recognition performance on
PETA.}
\label{tbl:clf}
\centering
\resizebox{\columnwidth}{!}{
\begin{tabular}{@{}lcccccc@{}}
\toprule
\multicolumn{1}{c}{Networks/Method} & mA & Acc & Rec & Prec & F1 & \multicolumn{1}{l}{\begin{tabular}[c]{@{}l@{}}AUC \\ (micro)\end{tabular}} \\ \midrule
\begin{tabular}[c]{@{}l@{}}GAP + Logistic \\ classifier\end{tabular} & \textbf{84.59} & \textbf{72.87} & \textbf{81.39} & \textbf{81.54} & \textbf{81.46} & \textbf{87.77} \\
\begin{tabular}[c]{@{}l@{}}GAP + Dense \\ classifier\end{tabular} & 84.35 & 71.83 & 80.71 & 80.79 & 80.78 & 87.29 \\ \bottomrule
\end{tabular}
}
\end{table}
In practice, global average pooling (GAP) works as well as or better than complicated
pooling strategies. As shown on Table \ref{tbl:clf}, the simple logistic
classifier outperforms the dense classifier for ResNet34. Generally, for
shallower networks (ResNet34 and
below), logistic classifier performs better than dense classifiers as the
number of features pooled globally is limited (512 in the case of ResNet34).
However, for deeper networks such as ResNet50 and above, the dense classifier
works well as the number of globally pooled features is larger (2048 in the
case of ResNet50).
\subsubsection{Sample Weights vs. Probability Calibration}
\begin{table}[b]
\caption{Effects of sample weighting and probability calibration strategies
on ResNet34 performance on PETA}.
\label{tbl:f1}
\centering
\resizebox{\columnwidth}{!}{
\begin{tabular}{@{}lcccccl@{}}
\toprule
\multicolumn{1}{c}{Networks/Method} & mA & Acc & Rec & Prec & F1 & \begin{tabular}[c]{@{}l@{}}AUC \\ (micro)\end{tabular} \\ \midrule
\begin{tabular}[c]{@{}l@{}}DeepMar weights +\\ F1 calibration\end{tabular} & 84.59 & 72.87 & 81.39 & 81.54 & 81.46 & \multicolumn{1}{c}{87.77} \\
\begin{tabular}[c]{@{}l@{}}DeepMar weights + \\ recall @20\% FPR\end{tabular} & \multicolumn{1}{l}{\textbf{92.24}} & \multicolumn{1}{l}{65.73} & \multicolumn{1}{l}{\textbf{93.19}} & \multicolumn{1}{l}{67.59} & \multicolumn{1}{l}{78.35} & 86.60 \\
\begin{tabular}[c]{@{}l@{}}No weighting/\\ naive proba thresh\end{tabular} & \multicolumn{1}{l}{83.07} & \multicolumn{1}{l}{72.25} & \multicolumn{1}{l}{79.47} & \multicolumn{1}{l}{82.95} & \multicolumn{1}{l}{81.17} & 87.19 \\
\begin{tabular}[c]{@{}l@{}}No weighting/\\ F1 calibration\end{tabular} & 85.33 & \textbf{73.54} & 82.09 & \textbf{82.22} & \textbf{82.16} & \multicolumn{1}{c}{\textbf{88.23}} \\ \bottomrule
\end{tabular}
}
\end{table}
From Table \ref{tbl:f1}, it is clear that the naive probability threshold (thresholding at 0.5) with
no sample weighting performed the worst. Next, the sample weighting (DeepMAR weights)
together with F1 probability calibration performs better. The F1 probability
calibration with no sample weighting achieved the best and well balanced performance among
these comparisons. DeepMAR weights with a 20\% false positive rates gives a higher mean accuracy,
but this is at the expensive of more false positives, which is measured in the other metrics.
\subsubsection{Effects of Image Resizing and Data Augmentation}
Other factors such as the way images are resized before being fed to the network can have a big impact. Strategies such as data augmentation and depth of the networks could affect
performance. It is a combination of these factors together with the strategies
discussed above that resulted in the state-of-the-art performance on PETA as
shown in Table \ref{tbl:da} and Table \ref{tbl:sota}.
For augmentation, we experiment with applying a random flip and RGB color jitter while preserving the aspect ratio of the original image.
Some network inputs are rigid and do not keep the aspect ratio of the input
\cite{li2015multi} and \cite{sarfraz2017deep}, requiring an image with an input
size of 256x256 with crop size of 224x224. But, a dramatic performance increase
was observed by preserving the aspect ratios of input images with random
sampling of the largest dimension from a set. This results in an increase in
example-based accuracy (almost 6\%) and in F1 score (about 4\%). Intuitively, this makes sense if we think about an attribute such as a ``wearing a v-neck shirt''. Stretching out the image can make it difficult to see this attribute, which clearly impacts performance.
\begin{table}
\caption{Effects of image resizing (Size and Crop) and data augmentation
(DA) on performance.}
\label{tbl:da}
\centering
\resizebox{\columnwidth}{!}{
\begin{tabular}{@{}lllllll@{}}
\toprule
\multicolumn{1}{c}{Networks/Method} & \multicolumn{1}{c}{mA} & \multicolumn{1}{c}{Acc} & \multicolumn{1}{c}{Rec} & \multicolumn{1}{c}{Prec} & \multicolumn{1}{c}{F1} & \begin{tabular}[c]{@{}l@{}}AUC \\ (micro)\end{tabular} \\ \midrule
\begin{tabular}[c]{@{}l@{}}Size: 256x256\\ Crop: 224x224\\ DA: flip, crop\end{tabular} & \multicolumn{1}{c}{84.59} & \multicolumn{1}{c}{72.87} & \multicolumn{1}{c}{81.39} & \multicolumn{1}{c}{81.54} & \multicolumn{1}{c}{81.46} & \multicolumn{1}{c}{87.77} \\
\begin{tabular}[c]{@{}l@{}}Size: 300x300\\ Crop: 299x299\\ DA: flip, crop\end{tabular} & 84.54 & 72.94 & 81.57 & 81.73 & 81.65 & 87.81 \\
\begin{tabular}[c]{@{}l@{}}Size: random\\ AR: preserved\\ DA: None\end{tabular} & 84.18 & 78.03 & 85.69 & 85.78 & 85.73 & 90.55 \\
\begin{tabular}[c]{@{}l@{}}Size: random\\ AR: preserved\\ DA: flip, jitter, rot\end{tabular} & \multicolumn{1}{c}{83.19} & \multicolumn{1}{c}{77.16} & \multicolumn{1}{c}{84.96} & \multicolumn{1}{c}{85.12} & \multicolumn{1}{c}{85.04} & \multicolumn{1}{c}{90.03} \\ \midrule
\begin{tabular}[c]{@{}l@{}}Size: random\\ AR: preserved\\ DA: flip, jitter\end{tabular} & \textbf{84.68} & \textbf{78.89} & \textbf{86.41} & \textbf{86.38} & \textbf{86.39} & \textbf{90.96} \\ \bottomrule
\end{tabular}
}
\end{table}
\subsection{Interpretability}
Recent work by \cite{selvaraju2017grad} demonstrated a method of interpreting classification results without the need to re-train networks. This approach, known as Grad-CAM, operates by performing a backward pass through the network and pooling in order to show the regions that are responsible for classification of a particular attribute. We use Grad-CAM to provide an insight into deeper person attribute recognition.
\begin{figure*}
\centering
\begin{tabular}{lllllcccrrrr}
\small{Original Image} & & & & & & \small{ResNet with 18 layers} & & & & & \small{ResNet with 34 layers} \\
\end{tabular}
\begin{subfigure}[b]{0.85\linewidth}
\includegraphics[width=15mm]{fig/VIPeR/cam_a/000_45.png}
\includegraphics[width=15mm]{fig/VIPeR/cam_a/002_45.png}
\includegraphics[width=15mm]{fig/VIPeR/cam_a/017_45.png}
\hspace{1mm}
\includegraphics[width=15mm]{fig/resnet18/000_45JeansTrue.png}
\includegraphics[width=15mm]{fig/resnet18/002_45JeansTrue.png}
\includegraphics[width=15mm]{fig/resnet18/017_45JeansTrue.png}
\hspace{1mm}
\includegraphics[width=15mm]{fig/resnet34/000_45JeansTrue.png}
\includegraphics[width=15mm]{fig/resnet34/002_45JeansTrue.png}
\includegraphics[width=15mm]{fig/resnet34/017_45JeansTrue.png}
\caption{Interpretation of the attribute ``Wearing Jeans''}
\end{subfigure}
\begin{subfigure}[b]{0.85\linewidth}
\includegraphics[width=15mm]{fig/VIPeR/cam_a/006_0.png}
\includegraphics[width=15mm]{fig/VIPeR/cam_a/009_45.png}
\includegraphics[width=15mm]{fig/VIPeR/cam_a/011_0.png}
\hspace{1mm}
\includegraphics[width=15mm]{fig/resnet18/006_0Long_hairTrue.png}
\includegraphics[width=15mm]{fig/resnet18/009_45Long_hairTrue.png}
\includegraphics[width=15mm]{fig/resnet18/011_0Long_hairTrue.png}
\hspace{1mm}
\includegraphics[width=15mm]{fig/resnet34/006_0Long_hairTrue.png}
\includegraphics[width=15mm]{fig/resnet34/009_45Long_hairTrue.png}
\includegraphics[width=15mm]{fig/resnet34/011_0Long_hairTrue.png}
\caption{Interpretation of the attribute ``Long Hair''}
\end{subfigure}
\begin{subfigure}[b]{0.85\linewidth}
\includegraphics[width=15mm]{fig/VIPeR/cam_a/014_0.png}
\includegraphics[width=15mm]{fig/VIPeR/cam_a/023_0.png}
\includegraphics[width=15mm]{fig/VIPeR/cam_a/031_45.png}
\hspace{1mm}
\includegraphics[width=15mm]{fig/resnet18/014_0MessengerBagTrue.png}
\includegraphics[width=15mm]{fig/resnet18/023_0MessengerBagTrue.png}
\includegraphics[width=15mm]{fig/resnet18/031_45MessengerBagTrue.png}
\hspace{1mm}
\includegraphics[width=15mm]{fig/resnet34/014_0MessengerBagTrue.png}
\includegraphics[width=15mm]{fig/resnet34/023_0MessengerBagTrue.png}
\includegraphics[width=15mm]{fig/resnet34/031_45MessengerBagTrue.png}
\caption{Interpretation of the attribute ``Carrying Messenger Bag''}
\end{subfigure}
\caption{An interpretation of why a ResNet18 (middle) and ResNet34 (right) classifies various attributes. }
\label{Interpret1}
\end{figure*}
Figure \ref{Interpret1} shows the GradCAM interpretation of why attributes were correctly recognized. The figure shows a residual network with 18 layers (ResNet18) and a residual network with 34 layers (ResNet34). Each row shows a different attribute. The top row shows the interpretation of recognizing jeans (top row), long hair (middle row) and having a messenger bag (bottom row). These are all true positives. Experimentally, we already have shown that ResNet34 outperforms ResNet18 in terms of classification accuracy. Here we see that ResNet34 also seems to take more of the image into consideration as well. The top row (jeans) and bottom row (messenger bag) shows two good examples of this. Whereas ResNet18 tries to locate small regions, ResNet34 is looking at bigger parts of the image before making a classification decision. The middle row (long hair) shows a very hard to classify attribute. Here, it appears that ResNet34 is looking to take contextual information (possibly gender and clothing) into consideration as well. ResNet18 focuses only on the hair area.
\begin{figure*}[t!]
\centering
\begin{subfigure}[b]{0.4\textwidth}
\centering
\includegraphics[height=30mm,width=15mm]{fig/resnet18/000_45ShortSleeveTrue.png}
\includegraphics[height=30mm,width=15mm]{fig/resnet18/004_0Long_hairTrue.png}
\includegraphics[height=30mm,width=15mm]{fig/resnet18/011_0SkirtTrue.png}
\caption{ResNet18 false positives. From left to right: \\Wearing short sleeves, Long hair, Wearing skirt}
\end{subfigure}
\begin{subfigure}[b]{0.4\textwidth}
\centering
\includegraphics[height=30mm,width=15mm]{fig/resnet34/001_45MaleTrue.png}
\includegraphics[height=30mm,width=15mm]{fig/resnet34/004_0Long_hairTrue.png}
\includegraphics[height=30mm,width=15mm]{fig/resnet34/024_0Age31-45True.png}
\caption{ResNet34 false positives. From left to right: \\Male, Long Hair, and Age 31-45.}
\end{subfigure}
\caption{False Positives: ResNet18 (left) and ResNet34 (right) visualization using GradCAM}
\label{Interpret2}
\end{figure*}
Figure \ref{Interpret2} shows three false positives from ResNet18 (left) and
ResNet34 (right). The images on the left show misclassifications of short
sleeves, long hair, and skirt. The images on the right show misclassifications
of gender, long hair, and age (31-45 predicted). We show these because in some
cases, the interpretation is odd enough to call into question the accuracy of
that classification. In some cases (short sleeves, skirt) the network is not looking at
the correct part of the image. In other cases (gender, age) it is making predictions based on very odd patterns in the image.
\section{Conclusion}
\label{sec:conclusion}
Recognizing attributes in the wild can be very challenging. Environmental conditions such as weather, lighting and shadow can impact results. Poor color calibration of the camera is also quite common. People also can be partially occluded by other things in the environment. Despite all of these challenges, we wish to have a network that can recognize a wide range of attributes about a person while doing so quite quickly.
From our experiments, we draw the following conclusions. First, residual networks are appropriate when training deeper networks with limited size datasets. We have demonstrated that both ResNet34 and ResNet50 outperform state-of-the-art, with the later resulting in our best overall performance. These networks perform well at the most important metric, example accuracy, showing that the network is trying to strike a balance between recognizing frequently appearing attributes such as gender, while not completely ignoring infrequently appearing attributes like v-neck shirt.
A number of strategies helped to contribute to this balanced performance. We found the best improvement on our accuracy to come from preserving the aspect ratio of the input image. We hypothesize that this has a huge impact on attributes that can be distorted during the resizing process. For example, a v-neck t-shirt becomes hard to identify if the shirt has been stretched out too far. Data augmentation can have a slight increase in the performance of the network, but we have also found that the augmentation should well match the data collection procedure.
Probability calibration strategies can also greatly impact the results, but care needs to be taken to ensure that the chosen strategy performs well across a wide range of attributes, and not just biasing the results towards those classes that appear most frequently. Finally, it is important to consider the amount of time that is required to recognize the attributes of a person. ResNet50 has some initial cost associated with loading the model and initializing weights, but once running it will process images of persons very quickly.
\section*{Acknowledgements}
Wallace Lawson was supported by the Office of Naval Research, Esube Bekele was supported by the National Research Council.
\bibliographystyle{ieee}
| {'timestamp': '2019-01-15T02:02:35', 'yymm': '1901', 'arxiv_id': '1901.03756', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03756'} | arxiv |
\section{Conclusions}
The Res-Seg module proposed in this paper facilitates the
multi-resolution processing of hierarchical presentations and
information flow in a network. Mounted onto the expansion path of an
FCN, it can help each layer focus on learning incremental refinements
from its previous layer. Both primary object shapes and boundary
details can be potentially better captured through the valuable
mechanism brought by Res-Seg-Net. Exploring applications of
Res-Seg-Net on more datasets, as well as the potential integrations of
Res-Seg module with deep neural networks in other application areas,
e.g., detection, are the directions of our future efforts.
\section{Experiments}
{\bf{Data}} To evaluate the effectiveness of our proposed Res-Seg-Net for follicle segmentation, we conducted experiments on histology slides of rat thyroid stained with hematoxylin-eosin (H \& E). The images have resolution of 1$\mu$m/pixel. Ground-truth segmentations were generated based on manual delineations. A veterinary pathologist traced the boundaries of all distinguishable follicles and colloids in one particular lobe. QuPath \cite{bankhead2017qupath} was employed to trace continuous contours, which are actually polygons. As our network processes and outputs image matrices, we converted the ground-truth segmentation from polygons to binary masks through the point-in-polygon algorithm \cite{shimrat1962algorithm}.
Fixed-sized square subimages (800 $\times$ 800) were randomly sampled from
the slides. Totally 100 such subimages were extracted from the
original pathology slides, and together with the manual masks, they
make up our data in this work. To validate our models, the 100
image-mask pairs were randomly separated into training, validation and
test groups, with a size ratio of 8:1:1. In order to obtain
more training samples, as well as to reduce overfitting, we further
extracted smaller-sized (640 $\times$ 640) patches from the subimages, also
in a random manner. The patches are also arbitrarily flipped
to augment the training data. The validation set
is used to select optimal hyper-parameters in our models (which is epoch number of early stopping).
\begin{figure}[htb]
\centering
\begin{tcbraster}[raster columns=3, raster equal height,
raster column skip=10pt, raster row skip=4pt, raster every box/.style={blank}, width=5cm]
\tcbincludegraphics{origin_1.pdf}
\tcbincludegraphics{label_1.pdf}
\tcbincludegraphics{unet_1.pdf}
\tcbincludegraphics{sameleves_1.pdf}
\tcbincludegraphics{noFix_1.pdf}
\tcbincludegraphics{fix_1.pdf}
\end{tcbraster}
\begin{tcbraster}[raster columns=3, raster equal height,
raster column skip=10pt, raster row skip=4pt, raster every box/.style={blank}]
\tcbincludegraphics{origin_2.pdf}
\tcbincludegraphics{label_2.pdf}
\tcbincludegraphics{unet_2.pdf}
\tcbincludegraphics{sameleves_2.pdf}
\tcbincludegraphics{noFix_2.pdf}
\tcbincludegraphics{fix_2.pdf}
\end{tcbraster}
\caption{Two image examples and their segmentations. First row:
input image, ground-truth, and result from U-Net. Second row: results
from Res-Seg-Net$_\textrm{horz}$, Res-Seg-Net$_\textrm{non-fixed}$,
and Res-Seg-Net$_\textrm{fixed}$. Rows 3 and 4 show another example.}
\label{fig:results_3}
\end{figure}
\begin{figure}[htb]
\centering
\begin{tcbraster}[raster columns=3, raster equal height,
raster column skip=10pt, raster row skip=4pt, raster every box/.style={blank}]
\tcbincludegraphics{origin_2.pdf}
\tcbincludegraphics{4_pred_label.pdf}
\tcbincludegraphics{4_0_pred_seg.pdf}
\tcbincludegraphics{4_1_pred_seg.pdf}
\tcbincludegraphics{4_2_pred_seg.pdf}
\tcbincludegraphics{4_4_pred_seg.pdf}
\end{tcbraster}
\caption{Segmentation results of Res-Seg-Net$_\textrm{fixed}$. Top
row: input, ground-truth, first level segmentation. Bottom row:
results from the second, third and fifth levels. }
\label{fig:results_4}
\end{figure}
{\bf{Results}} As we mentioned in section 2.1, we intend to explore two different weight updating schemes in our Res-Seg-Net. One version is to fix upsampled prob-map after it is sent to the upper layer. We call this version Res-Seg-Net$_\textrm{fixed}$. The other setup allows all weights to be updated freely, which we term Res-Seg-Net$_\textrm{non-fixed}$.
To explore the effectiveness of the notion of vertical refinements, i.e., residual updates along coarse-fine hierarchy, we also designed a solution of horizontal refinements as a competing model. More specifically, we stack five Res-Seg modules with upsampling removed, only at the last layer of the modified U-Net, which would carry out segmentation refining only along the highest resolution. We name this model Res-Seg-Net$_\textrm{horz}$. The weights updating scheme in Res-Seg-Net$_\textrm{horz}$ is the fixed version -- prob-maps sent to the upper layers are all set to untrainable.
\begin{table
\caption{Segmentation results on Follicles}
\vspace{0.05in}
\centering
\scalebox{0.9}{
\begin{tabular}{c|cc}
\hline
\hline
\multicolumn{1}{c|}{\textbf{FCN}} &
\multicolumn{2}{c}{\textbf{Dataset}}\\
\cline{2-3}
\multicolumn{1}{c}{\textbf{ }}&
\multicolumn{1}{|c}{\textbf{Validation}} &
\multicolumn{1}{c}{\textbf{Test}}\\
\hline
\multicolumn{1}{c|}{\text{Res-Seg-Net$_\textrm{fixed}$}}& 86.44&{\bf{85.51}} \\
\cline{1-3}
\multicolumn{1}{c|}{\text{Res-Seg-Net$_\textrm{non-fixed}$}}&86.67&84.97 \\
\cline{1-3}
\multicolumn{1}{c|}{\text{Res-Seg-Net$_\textrm{horz}$}}&86.19&85.23\\
\cline{1-3}
\multicolumn{1}{c|}{\text{UNet (Baseline)}}& 86.11&84.79 \\
\hline
\end{tabular}
}
\label{T:follicle}
\end{table}
The results of the four competing models are shown in
Table~\ref{T:follicle}. The {\it{Validation}} column shows the best
result of each model on the validation set, while the {\it{Test}}
column contains the results on the test dataset. The results show that
all the Res-Seg based models outperform the U-Net, where
Res-Seg-Net$_\textrm{fixed}$ obtained the highest DSC on the test
data.
Fig.~\ref{fig:results_3} shows two image examples, their ground-truth
masks, and the final segmentations generated by competing
models. Comparing with U-Net, Res-Seg based models generally have
fewer false positives. Comparing with Res-Seg-Net$_\textrm{horz}$,
Res-Seg-Net$_\textrm{fixed}$ and Res-Seg-Net$_\textrm{non-fixed}$ both
generate cleaner outputs, which can serve as an evidence that
hierarchical refinings are effective in improving segmentations in
both accuracy and robustness. These effects can be clearly seen within
the areas highlighted with green boxes.
We fed Res-Seg-Net$_\textrm{fixed}$ with the patch in the first row of
Fig.~\ref{fig:results_3}, and output their segmentations maps of each
layer in Fig.~\ref{fig:results_4}. The segmentation refining process
is evident, as more and more details are added to the finer
outputs. The low resolution segmentations tend to catch the primary
shapes of the target objects. Moving upwards, they not only provide
guidance for fine-resolution labelings to capture more details, but
also set up certain guard to reduce the appearance of noisy spots.
\section{Introduction}
Thyroid is the largest endocrine gland in human body and it produces
hormones that influence the metabolic rate and protein
synthesis. Follicles make up one of the major components of thyroid
glands. The morphology of follicle cells can often serve as a reliable
indicator of the health status of the glands –- healthy cells are
usually homogeneous while cell polymorphism likely signals an abnormal
mutation, from inflammations to cancers \cite{wang2010detection}.
Therefore, Identification and evaluation of follicle polymorphism
through histological images are of great importance for thyroid cancer
diagnosis, as well as treatment planning.
Separating follicles from the surrounding tissue is often a
prerequisite step for many other analysis tasks. As manual
delineations are normally tedious, time-consuming and prone to intra-
and inter-operator errors, various automatic solutions have been
proposed in the past 20 years or so. Traditional approaches include
boundary tracing \cite{borst1979thresholding},
watershed \cite{adiga2006high}, graph cuts
\cite{boykov2001interactive},
and Gaussian mixture models \cite{liu_2009_mmbia}. They commonly take
certain hand-crafted features, e.g., edges or texture, as the basis
for pixel labeling and subsequent analysis.
In recent years, deep neural networks have emerged as a new and more
powerful paradigm, which revolutionized many artificial intelligence
areas, including semantic segmentation. Fully convolutional network
(FCN) \cite{long2015fully} and its variants, including U-Net
\cite{ronneberger2015u}, produce state-of-art results on many data and
applications. The success of FCNs should be attributed, in great part,
to their capability of processing input images at different spatial
scales. FCNs are commonly constructed with an encoder-decoder
architecture. In the encoding path, input images are processed through
a number of convolution + pooling layers to generate high-level latent
features, which are then progressively upsampled in the decoder to
reconstruct the target pixel labels.
A crucial issue in FCN design is how to effectively integrate the
feature maps produced in higher (finer) layers and those in lower
(coarser) layers. The former are richer in semantics, while the latter
carry more spatial details that define class boundaries. Early efforts
lead to the developments of skip architecture \cite{long2015fully},
bridges with feature concatenation \cite{ronneberger2015u}, dilated
convolution \cite{yu2017dilated}, up-down-sampling
\cite{zhang2018exfuse}, among others. New models have emerged in the
past two years, such as the utilizations of dilated pooling
\cite{sarker2018slsdeep}, supervision with additional labels
\cite{zhang2018deep}, multi-task learning \cite{playout2018multitask},
multi-view ensemble \cite{chen_isbi_2017}, convolutional LSTM
\cite{chen_mlmi_2017} and shape preserving loss
\cite{yan2018deep}. Originated from the first FCN, most existing
solutions follow a common setup: the network objective function is
defined at the last layer, between its outputs and the ground-truth
masks. While the features are learned and propagated along layers in a
multi-scale manner, their updates are solely driven with an overall
penalty defined on the final outputs. Hierarchical updates through
image pyramids, proven effective in many previous studies
\cite{burt1987laplacian}, are essentially lacking in most of the
existing FCN models. Zhang {\it et al.} \cite{zhang2018deep} utilizes
a multi-resolution loss, but the computation is still not conducted
within a sequential update framework.
To seek a remedy, we propose a new FCN-based model in this paper and apply it to thyroid follicle segmentation. The design goal is to equip FCNs with a level-by-level hierarchical updating mechanism, hoping it will lead to more robust and accurate segmentation performance. To this end, we include additional loss terms based on low-layer feature maps to ensure a good starting segmentation at coarse levels. We also employ residual units to facilitate level-by-level segmentation refinements, when network inference is carrying out along the decoding path. With these two setups, our model can take full advantage of hierarchical multi-resolution processing.
\section{Method}
Many traditional image analysis solutions \cite{marfil2006pyramid,
thevenaz1998pyramid} have demonstrated that multi-resolution
representations \cite{burt1987laplacian} enable effective processing
pipelines for both segmentation and registration tasks. In these
models, input images are resampled and transformed into coarse levels
in a bottom-up manner. The processed results are then propagated in a
reverse top-down direction to provide the fine levels with better
starting estimations, often leading to more accurate final results.
However, such bottom-up and top-down input/result transitions are
absent in FCNs. No intermediate segmentation result at any coarse
resolution is generated in FCNs to serve as a guidance for finer
levels. The loss functions in most FCNs are defined only at their
final layers, between the network predictions and ground-truth
segmentations. With such losses, which put no emphasis on coarse level
results, the efficacy of an end-to-end learning, especially through a
network with many layers, may be greatly hindered.
These observations lead us to the development of a new FCN model. We
modify the decoding layers of U-Net with an intention to impose a
bottom-up structure, through which the segmentations from coarse
levels can be transited and refined in fine layers. To further ensure
the refinements to take place in an effective way, we adopt the
residual concept \cite{he2016deep} to design a residual module as the
building block for our network. We term this module Res-Seg.
\subsection{Res-Seg module}
\begin{figure}[htb]
\begin{minipage}[b]{1.0\linewidth}
\centering
\centerline{\includegraphics[width = 8.5cm]{fig1.pdf}}
\end{minipage}
\caption{(a) Res-Seg module for segmentation. Picture is best viewed in color. (b) Residual blocks proposed in ResNet \cite{he2016deep}.}
\label{fig:res-seg}
\end{figure}
Fig.~\ref{fig:res-seg} (a) shows a Res-Seg unit of two consecutive
layers. At each layer, an intermediate probability map (prob-map),
shown as a red bar, is generated and compared (after upsampling) with
the ground-truth segmentation. Meanwhile, the prob-map from a low
resolution layer is sent to its upper (finer) layer with two aims: 1)
it will provide a good starting point for the latter; 2) it will get
refined in the upper layer. To facilitate the finer layer to focus on
learning the increment details, we adopt a similar residual-connection
structure from the ResNet \cite{he2016deep} for our Res-Seg module.
As shown in Fig.~\ref{fig:res-seg} (a), the prob-map from the low
level is upsampled (blue bar) and then sent to the high layer at two
spots. Firstly, the blue bar is concatenated with the feature maps to
help produce the prob-map at the finer level. The second location is
on the path from the concatenated feature/prob maps to their own
prob-map at the upper layer. With that, the fine layer essentially
learns the residual (yellow bar) between the upsampled coarse and
ground-truth segmentations. In other words, the fine layer is
positioned to learn refinements for the coarse segmentation.
We have two considerations in the design of this residual unit. Firstly, the upsampled lower layer prob-map, the blue bar, has the values in the range of [0, 1]. The direct output of the upper layer, the yellow bar, which is the residual between the blue bar and the ground-truth, is in the range of [-1, 1]. With this consideration, tanh is a good choice for the activation function to be applied on the concatenated feature/prob maps. This operation is shown as a yellow arrow in Fig.~\ref{fig:res-seg}. The second consideration is about the activation function in generating the prob-map at the upper layer. In this work, we chose a truncated ReLU, $f(x) = \max(\min(x, 1), 0)$, to map the output of this layer into the range of [0, 1].
While our Res-Seg module is inspired by the residual layers in ResNet, there are several major differences in their designs and functionalities. Firstly, our Res-Seg module is designed for segmentation and the output of each layer is supervised by the ground truth. The ResNet blocks in Fig.~\ref{fig:res-seg} (b), however, are not directly regulated by the ground-truth class labels. The purpose of ResNet blocks is to propagate the context information to the next layer, while our Res-Seg module aims to bring a direct guidance from the ground-truth at each layer. The second major distinction lies in the structures of the two modules. As illustrated in the last paragraph, there are several well-grounded connections and activation function setups in our res-seg, designed specifically for semantic segmentation.
{\bf Two updating schemes} To ensure each upper layer to only focus on refining the results (prob-maps) sent from the previous layer, these prob-maps should be fixed at both plugging spots in the upper layers. This setup would conform to the design goal of our level-by-level updating scheme. In our implementation, the prob-map of each layer along the decoding path is copied to its upper layer, and set to untrainable there. By doing so, we force the higher layer learn the differences between the lower layer prob-map and the ground-truth. A different setting, however, can be borrowed from the ResNet, where all layers/weights are updated through backpropagation. While deviating from our level-by-level design notion, this approach certainly grants more flexibility over the learning procedure, allowing the network to minimize the total loss to its full potential. In this work, we implement both settings to compare their performance.
It should be noted that our residual module is rather general, and it can be integrated into the decoding path of many FCN networks. We choose U-Net as the baseline network for comparison and modification. We term our overall segmentation network as Res-Seg-Net.
\subsection{Res-Seg-Net}
We keep the overall architecture of the original U-Net, including the number of layers, in our Res-Seg-Net. Two major modifications have been made on U-Net to fit our data and task. Firstly, we reduce the number of channels at each layer, to have fewer parameters. We start with 32 channels (64 channels in U-Net), followed by doubling the number of channels at each down-sampling step along the contraction path. The expansion path is kept symmetric to the contraction path. Secondly, we use padding in every convolution operation to maintain the spatial dimension. Dimension changes only occur at polling (reduced to half) and upsampling (enlarge two times). In this way, we do not have to crop the contraction layers, as U-Net does, for skip connections.
\begin{figure}[htb]
\begin{minipage}[b]{1.0\linewidth}
\centering
\centerline{\includegraphics[width = 8.5cm]{fig2.pdf}}
\end{minipage}
\caption{Res-Seg-Net architecture. $GT$ stands for ground-truth.}
\label{fig:res-u-net}
\end{figure}
The integration of modified U-Net with our proposed Res-Seg module starts at the bottom (lowest resolution) layer of the network. Following the expansion path, our residual module is applied on each pair of adjacent upsampling layers, as shown in Fig.~\ref{fig:res-u-net}. Overall, the network produces four intermediate and one final probabilistic segmentation maps. At each layer, the intermediate segmentation map is obtained by upsampling the respective prob-map, through a single bilinear filter, to match the dimension and resolution of the ground-truth mask.
{\bf Multi-resolution loss function} We resort to Dice loss \cite{vnet_2016} to measure the difference between each segmentation map with the ground-truth mask. The choice is based on the facts: 1) Dice Similarity Coefficient (DSC) is a common metric to evaluate segmentation performance, which is also adopted in this work; 2) Dice loss has been widely used as a differentiable approximation of DSC.
Let $S$ be the segmentation result produced by a solution and $R$ be the ground truth. In Dice loss, segmentation $S$ is relaxed to a probability map of real numbers between 0 and 1, and the loss is computed as:
\begin{equation} \label{eq:1}
\textrm{Dice loss} = -\frac{2\sum_i{s_ir_i}}{\sum_is_i+\sum_ir_i}
\end{equation}
where $s_i\in[0,1]$ is the label prediction at pixel $i$, and
$r_i\in \{0,1\}$ is the corresponding binary ground truth. The overall object function in our Res-Seg-Net is defined as the
summation of weighted Dice losses, which is
\begin{equation} \label{eq:2}
{L_{Dice}} = -\sum_iw_iD_i
\end{equation}
where $D_i$ is the Dice loss of an individual layer, and $w_i$ is the
corresponding weight. In our experiment, the weight of the Dice loss
is set as 1/4 for intermediate layers, and 1 for the final layer. We
give the highest resolution layer larger weight as it produces the
ultimate segmentation prediction of the network.
\section{Introduction}
\label{sec:intro}
These guidelines include complete descriptions of the fonts, spacing, and
related information for producing your proceedings manuscripts.
\section{Formatting your paper}
\label{sec:format}
All printed material, including text, illustrations, and charts, must be kept
within a print area of 7 inches (178 mm) wide by 9 inches (229 mm) high. Do
not write or print anything outside the print area. The top margin must be 1
inch (25 mm), except for the title page, and the left margin must be 0.75 inch
(19 mm). All {\it text} must be in a two-column format. Columns are to be 3.39
inches (86 mm) wide, with a 0.24 inch (6 mm) space between them. Text must be
fully justified.
\section{PAGE TITLE SECTION}
\label{sec:pagestyle}
The paper title (on the first page) should begin 1.38 inches (35 mm) from the
top edge of the page, centered, completely capitalized, and in Times 14-point,
boldface type. The authors' name(s) and affiliation(s) appear below the title
in capital and lower case letters. Papers with multiple authors and
affiliations may require two or more lines for this information.
\section{TYPE-STYLE AND FONTS}
\label{sec:typestyle}
To achieve the best rendering both in the proceedings and from the CD-ROM, we
strongly encourage you to use Times-Roman font. In addition, this will give
the proceedings a more uniform look. Use a font that is no smaller than nine
point type throughout the paper, including figure captions.
In nine point type font, capital letters are 2 mm high. If you use the
smallest point size, there should be no more than 3.2 lines/cm (8 lines/inch)
vertically. This is a minimum spacing; 2.75 lines/cm (7 lines/inch) will make
the paper much more readable. Larger type sizes require correspondingly larger
vertical spacing. Please do not double-space your paper. True-Type 1 fonts
are preferred.
The first paragraph in each section should not be indented, but all the
following paragraphs within the section should be indented as these paragraphs
demonstrate.
\section{MAJOR HEADINGS}
\label{sec:majhead}
Major headings, for example, "1. Introduction", should appear in all capital
letters, bold face if possible, centered in the column, with one blank line
before, and one blank line after. Use a period (".") after the heading number,
not a colon.
\subsection{Subheadings}
\label{ssec:subhead}
Subheadings should appear in lower case (initial word capitalized) in
boldface. They should start at the left margin on a separate line.
\subsubsection{Sub-subheadings}
\label{sssec:subsubhead}
Sub-subheadings, as in this paragraph, are discouraged. However, if you
must use them, they should appear in lower case (initial word
capitalized) and start at the left margin on a separate line, with paragraph
text beginning on the following line. They should be in italics.
\section{PRINTING YOUR PAPER}
\label{sec:print}
Print your properly formatted text on high-quality, 8.5 x 11-inch white printer
paper. A4 paper is also acceptable, but please leave the extra 0.5 inch (12 mm)
empty at the BOTTOM of the page and follow the top and left margins as
specified. If the last page of your paper is only partially filled, arrange
the columns so that they are evenly balanced if possible, rather than having
one long column.
In \LaTeX, to start a new column (but not a new page) and help balance the
last-page column lengths, you can use the command ``$\backslash$pagebreak'' as
demonstrated on this page (see the \LaTeX\ source below).
\section{PAGE NUMBERING}
\label{sec:page}
Please do {\bf not} paginate your paper. Page numbers, session numbers, and
conference identification will be inserted when the paper is included in the
proceedings.
\section{ILLUSTRATIONS, GRAPHS, AND PHOTOGRAPHS}
\label{sec:illust}
Illustrations must appear within the designated margins. They may span the two
columns. If possible, position illustrations at the top of columns, rather
than in the middle or at the bottom. Caption and number every illustration.
All halftone illustrations must be clear black and white prints. If you use
color, make sure that the color figures are clear when printed on a black-only
printer.
Since there are many ways, often incompatible, of including images (e.g., with
experimental results) in a \LaTeX\ document, below is an example of how to do
this \cite{Lamp86}.
\begin{figure}[htb]
\begin{minipage}[b]{1.0\linewidth}
\centering
\centerline{\includegraphics[width=8.5cm]{image1}}
\centerline{(a) Result 1}\medskip
\end{minipage}
\begin{minipage}[b]{.48\linewidth}
\centering
\centerline{\includegraphics[width=4.0cm]{image2}}
\centerline{(b) Results 3}\medskip
\end{minipage}
\hfill
\begin{minipage}[b]{0.48\linewidth}
\centering
\centerline{\includegraphics[width=4.0cm]{image3}}
\centerline{(c) Result 4}\medskip
\end{minipage}
\caption{Example of placing a figure with experimental results.}
\label{fig:res}
\end{figure}
\vfill
\pagebreak
\section{FOOTNOTES}
\label{sec:foot}
Use footnotes sparingly (or not at all!) and place them at the bottom of the
column on the page on which they are referenced. Use Times 9-point type,
single-spaced. To help your readers, avoid using footnotes altogether and
include necessary peripheral observations in the text (within parentheses, if
you prefer, as in this sentence).
\section{COPYRIGHT FORMS}
\label{sec:copyright}
You must include your fully completed, signed IEEE copyright release form when
you submit your paper. We {\bf must} have this form before your paper can be
published in the proceedings. The copyright form is available as a Word file,
a PDF file, and an HTML file. You can also use the form sent with your author
kit.
\section{REFERENCES}
\label{sec:ref}
\cite{chen2016dcan}
List and number all bibliographical references at the end of the paper. The references can be numbered in alphabetic order or in order of appearance in the document. When referring to them in the text, type the corresponding reference number in square brackets as shown at the end of this sentence \cite{C2}.
\bibliographystyle{IEEEbib}
| {'timestamp': '2019-01-15T02:02:48', 'yymm': '1901', 'arxiv_id': '1901.03760', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03760'} | arxiv |
\section{\label{sec:intro}Introduction}
In the last few decades, scientists started to look at cities as evolving systems that exhibit global order built from local-level decisions\cite{Batty1995}.
Cities bring people together to interact, leading to the emergence of self-organization\cite{Batty1999,Portugali2000,Batty2012,Batty2008}.
Though local-level processes and decisions seem disordered, cities exhibit remarkable regularities that are argued to result from their propensity to expand and to develop\cite{Batty2008,Batty2013b,Bettencourt2007b,Batty2008b,Samaniego2008,DeLong2015,Schiff2015,Bettencourt2016,Youn2016,VanRaan2016,Batty2012}.
Indeed, evidence of nonlinear growth in urban indicators (e.g.,~wages, serious crime) with city size has motivated scholars to envision cities as complex systems\cite{Batty2013,Bettencourt2010a,Gomez-Lievano2012,Bettencourt2007}.
From this perspective, researchers have unveiled scaling relationships in criminal activity\cite{Bettencourt2007,Bettencourt2010,Gomez-Lievano2012,Alves2013,Hanley2016} which hints at regularities in crime\cite{Oliveira2015a,Caminha2017,Oliveira2017,Oliveira2018}.
The existence of scaling suggests general pro\-ces\-ses be\-hind ur\-ban development\cite{Bettencourt2013hyp}.
It indicates a general mechanism underlying urbanization and implies that regularities exist in cities regardless of their idiosyncrasies.
The study of urban scaling has provided the means to understand urban growth and its impact on indicators such as employment, patent, wage, and crime\cite{Bettencourt2007,Bettencourt2010,Bettencourt2013,Gomez-Lievano2016}. Most of these analyses, however, neglect details of the indicators such as spatial distribution across the city, probably because of the lack of fine-grained data\cite{Oliveira2017}. In the case of crime, researchers have taken advantage of the availability of data to study the phenomenon\cite{White2015,PachecoOM17,Kadar2018,DaCunha2018} and to describe its regularities\cite{Davies2015,Oliveira2015a,Alves2015,Caminha2017,Oliveira2017,Oliveira2018}.
Evidence of regularities in crime traces back to the nineteenth century.
Almost simultaneously, Adolphe Quetelet and Andr\'{e}-Michel Guerry were the first to describe regularities in criminal activity\cite{friendly2007,quetelet1842treatise,BalbiGuerry:1829,quetelet1833recherches}.
For almost two centuries, crime in cities has been known to exhibit seasonality and to be unevenly distributed\cite{BalbiGuerry:1829,quetelet1833recherches}.
With these findings, Quetelet and Guerry pioneered the viewpoint of physical laws governing human populations\cite{friendly2007}.
Though distinct socio-economic factors influence crime, remarkable regularities exist in its dynamics.
In this chapter, we discuss regularities in crime concerning its spatial distribution and its temporal dynamics.
In the case of spatial regularities, researchers have found that criminal events tend to cluster spatially\cite{Weisburd2015}. Offenses concentrate in such a way that most of the occurrences happen at very few places.
This concentration has been confirmed regardless of spatial granularity levels in a myriad of studies. The overwhelming amount of evidence makes us expect that, in any city, some areas will have disproportionately more crime than others\cite{Weisburd2015}.
Such ubiquity has brought to this observation the status of a law, namely the \emph{law of crime concentration}, which states that a small number of micro-geographic units account for most of the offenses in a neighborhood or city\cite{Weisburd2015}. In Section~\ref{sec:concentration}, we discuss the characteristics of crime concentration in cities and its relationship with the type of crime and city size.
In addition to displaying spatial regularities, crime is known to depend on time constraints and to exhibit temporal regularities\cite{Cheatwood2009}. Much research has been devoted to describing periodic changes in crime rates such as annually and weekly. Adolphe Quetelet linked weather variations to aggression to explain criminal seasonality\cite{quetelet1842treatise,Cheatwood2009}.
From his perspective, the heat would cause the stress needed to turn people more likely to offend. His so-called ``thermic law" of crime, however, has been since replaced by an understanding of indirect relevant effects\cite{Harries1984,Cheatwood2009}.
For instance, fluctuations in social dynamics may affect three requirements for crime: {\em offender}, {\em target}, and {\em opportunity}\cite{Cohen1979,Cheatwood2009}.
In Section~\ref{sec:rhythms}, we discuss the temporal regularities in crime when we account for both spatial heterogeneity and non-stationarity in cities.
The regularities as mentioned earlier have a direct impact on how we see cities. With the their characterization, we provide a pathway for researchers to create realistic models of crime and present the grounds to understand the impact of local activities on global patterns of cities.
In the last section of this chapter, we discuss such aspects and the implication to policymaking.
\section{Spatial concentration}
\label{sec:concentration}
The spatial concentration of crime has been confirmed in different cities using various spatial aggregation units including street and area level (e.g.,~census tracts, street segments)\cite{EckE.2007,Johnson2010,Braga2010,PrietoCuriel2017}.
For instance, Fig.~\ref{fig:fig1}A depicts the spatial distribution of thefts in Chicago, IL. In this example, we can see some regions of the city having disproportionately more criminal activity than others.
We want to characterize the phenomenon over different cities to further study this spatial regularity. For this, first, we need a general approach to analyze the city. With a general method, we avoid biases due to cities' particularities (e.g., blocks size, length of the street segments)\cite{Oliveira2017}.
We can achieve this by building spatial aggregation units based on the population distribution across the city. Specifically, we divide the area of a city into regions with equal population size (i.e., number of residents), then we aggregate offenses that happened within the same regions.
\begin{figure}[t!]
\begin{minipage}{4.6in}
\centering
\includegraphics[width=4.6in]{fig1}
\caption{\textbf{Crime clusters spatially with a concentration level that depends on the offense type.}
For example, (\textbf{A}) depicts the spatial distribution of theft in Chicago,~IL. In the figure, darker colors mean higher crime rates. This map illustrates the tendency of crime to cluster in specific regions of Chicago. This concentration depends on the type of offense. Each curve in (\textbf{B}) shows the relationship between the cumulative crime share and the cumulative share of the corresponding number of regions ordered by crime counts (i.e., Lorenz curves). Theft concentrates more than robbery, and robbery more than burglary. This spatial concentration of crime can be describe with (\textbf{C}) a power-law distribution $p(x) \propto x^{-\alpha}$ where the exponent $\alpha$ relates to the type of crime. Figures adapted from\cite{Oliveira2017}.
}
\label{fig:fig1}
\end{minipage}
\end{figure}
With these counts, we can now analyze the empirical distribution of crime in cities. Fig.~\ref{fig:fig1}B shows the Lorenz curves of the crime distribution in Chicago for burglaries, robberies, and thefts.
The Lorenz curves help us to assess the concentration of crime.
The curves in Fig.~\ref{fig:fig1}B indicate the tendency of crime to concentrate spatially regardless of the offense type. However, note that the \textit{level} of concentration seems to depend on the offense type.
A similar tendency also occurs in $25$ other locations from the United States and the United Kingdom:~theft concentrates more than robbery, and robbery more than burglary (see Fig.~\ref{fig:fig2}A).
To describe these quantities statistically, we can fit the distribution of crime with different distributions and then compare them using the likelihood ratio test\cite{Oliveira2017}. In the majority of the $25$ cities, the probability distribution of crime across a city can be described by a power law
$p(x) \propto x^{-\alpha}$
where the exponent $\alpha$ relates to the type of crime. The different types of crime present distinct levels of concentration which manifests on the range of the power-law exponent: for thefts, $\alpha_t$ is between $2.1$ and $3.0$; whereas the exponents for burglaries $\alpha_b$ and robberies $\alpha_r$ vary in wider ranges with $\alpha_r$ within $2.4$ and $4.1$, and $\alpha_b$ between $2.9$ and $6.0$. The different dynamics of each type of crime might be the cause of the distinct exponent intervals and thus the level of concentration.
Note that, in some cases that $\alpha$ exhibits large values (e.g., burglary), the exponential and the power-law distributions are both good descriptions of the data\cite{Oliveira2017}.
\begin{figure}[t!]
\begin{minipage}{4.6in}
\includegraphics[width=4.6in]{fig2}
\caption{\textbf{Crime concentration is scale-invariant but depends on crime type.}
With data from 25 cities, the Lorenz curves in (\textbf{A}) demonstrate the dependence between the type of crime and concentration level. This concentration, however, is independent of city size. (\textbf{B}) depicts a comparison between concentration exponent for theft, population size, and the number of thefts.
In this double-y-axes plot, squares represent the number of crime in a city during one year, and diamonds stand for the average power-law exponent for a city. Though population size has a clear relationship with the number of offenses, it fails to have an association with $\alpha$. This independence is confirmed using the Hoeffding's test of independence. Figures adapted from\cite{Oliveira2017}.
}
\label{fig:fig2}
\end{minipage}
\end{figure}
We also need to study the stability of the concentration, since such a high level of concentration could indicate a somehow static city\cite{Oliveira2017}.
To examine the stability, we can measure the uncertainty of the positions in the rank of criminal spots over time.
Precisely, we calculate the Shannon entropy ${H}_{r_t}(i)$ of each position $i$ in the criminal ranks of regions $r_t$ which are created using the number of offenses weekly aggregated\cite{Oliveira2017}.
Using data from $20$ cities of the U.S., the mean normalized entropy (i.e., the sample mean over the positions in the rank) is around $0.95$, indicating that criminal spots are likely to vary across regions over time.
The hottest spots (i.e., the first positions in the rank), however, present distinct dynamics with the entropy ${H}_{r_t}(i)$ increasing quickly with the position $i$. This result means that the regions with the most criminal activity tend to be the same ones.
Similarly, the places with the least criminal activity (i.e., the last positions in the rank) are usually the same regions.
This analysis also reveals that the rank of thefts presents lower entropy in the first rank positions in comparison to the other types of crime\cite{Oliveira2017}.
In other words, we have more certainty about the whereabouts of the hottest spots of theft than the hottest spots of robbery and burglary.
These findings indicate the level of spatial crime concentration as a regularity that occurs regardless of idiosyncrasies of the city. In particular, this is an intriguing finding because of the allometric scaling of crime in cities.
Fig.~\ref{fig:fig2}B shows the relationship between $\alpha_t$ of some U.S. cities and their population size. On the one hand, crime numbers relate to city size; on the other hand, crime concentration (i.e., the exponent) seems to be independent of city size.
We can study the statistical dependence of this relationship using the Hoeffding's test of independence\cite{nsm}.
Specifically, we can test the relationship between the population size of the cities and the average power-law exponent $\alpha$.
With data from the considered U.S. cities, we could not reject the hypothesis that the size of the city and the level of crime concentration are independent with the 95\% confidence\cite{Oliveira2017}. This result suggests crime concentration as an attribute of criminal phenomena which occurs regardless of the population size of the city.
\section{Criminal rhythms}
\label{sec:rhythms}
Much effort has been devoted to studying temporal regularities in crime since Quetelet's seminal work on crime seasonality\cite{BAUMER1996} . Researchers have confirmed annual seasonality in several cities and studied other regularities related to different temporal conditionals such as the day of the week, the hour of the day, and the presence of holidays\cite{BAUMER1996}.
Most of the studies in the literature, however, assume a temporal regularity of crime activity limited within fixed regional localities\cite{Oliveira2018}.
From the perspective of cities as complex systems, this assumption neglects the continuous process of organization in cities\cite{Batty1995,Batty2008}.
Such stationary assumption implies that the urban dynamics in all regions across the city remain constant over time\cite{Oliveira2018}.
To study crime from the viewpoint of dynamic cities, we have to consider the possibility of non-stationarity and spatial heterogeneity.
For this task, we can use wavelet analysis to track the periodicity of a criminal time series. With wavelet analysis, we can evaluate the statistical significance of a component (e.g., annual, biannual) in a time series over time. If we account the spatial heterogeneity, we are also able to describe how the rhythms of crime are distributed across the city and how they vary over time.
In our case, a time series is a discrete sequence $\smash Y = \left\{y\left(1\right), \hdots, y\left(N\right)\right\}$ with observations of uniform time step $\delta t$ in which $y(t)$ represents the processed number of thefts (i.e., without long-term trends) at the week $t$. Here we denote $Y^c$ as the city-level time series of city $c$, whereas $Y^c_i$ represents the time series of the region $i$ in the city $c$. For instance, Fig.~\ref{fig:fig3}A depicts $Y^c$ of selected cities from the United States.
\begin{figure}[t!]
\begin{minipage}{4.6in}
\includegraphics[width=4.6in]{fig3}
\caption{\textbf{Crime exhibits a circannual cycle at the city level.} In (\textbf{A}), the time series of theft $y(t)$ for selected cities indicate the rhythms of crime. With crime data from 12 cities, this cycle is confirmed using (\textbf{B}) the global wavelet spectrum of the wavelet transform of $y(t)$ and comparing against the null model $P_k$ generated from autocorrelated random noise (dashed line); two cities, however, failed to exhibit this periodicity. This striking temporal regularity is seen in (\textbf{A}) the waves (black curves) that are reconstructed using only the circannual band. Figures adapted from\cite{Oliveira2018}.
}
\label{fig:fig3}
\end{minipage}
\end{figure}
First we study the temporal regularities (i.e., periodicity) in $Y^c$ using its wavelet transform $\smash{{\rm W}_{Y^c}(s,n)}$.
This transform gives us the contribution of a periodicity (scale) $s$ at different moments $n$ in the time series. The \emph{local wavelet spectrum}, defined as $\smash{|{\rm W}_{Y^c}(s,n)|^2}$, enables us to identify temporal regularities in a series.
For this, we average the spectrum across either time $n$ or period $s$.
To identify cycles in the entire series, we average $\smash{{\rm W}_{Y^c}\left(s,n\right)}$ over $n$, known as the \emph{global wavelet spectrum} and denoted as $\smash{\overline{{\rm W}}^2\left(s\right)}$, which provides us an averaged picture of the periods in the time series\cite{Percival1995}. Fig.~\ref{fig:fig3}B shows the global spectrum of some cities in the United States. The peak around $1.0$ indicates the existence of a statistically significant annual periodicity of crime. This analysis confirms previously well-documented evidence that crime exhibits circannual cycles\cite{BAUMER1996}.
Note that $\smash{\overline{{\rm W}}^2\left(s\right)}$ is an average over time $n$ and thus neglects any temporal dynamics such as non-stationarity. To test the stationarity in these regularities, we average $|{\rm W}_{Y^c}(s,n)|^2$ over scale $s$, yielding the \emph{scale-averaged wavelet power}. It enables us to analyze the temporal evolution of a periodic signal in terms of a given band $b=\left(j_1, j_2\right)$. In our case, we want to examine the circannual stationarity, so we evaluate the scale-averaged wavelet power with $j_1=0.8$ and $j_2=1.1$ for each city and test this periodicity against a null model. Fig.~\ref{fig:fig4}A shows the scale-averaged wavelet power for some cities. Most of them exhibit stationary time series; that is, the circannual component is present throughout the series.
In fact, this stationarity is already evident in Fig.~\ref{fig:fig3}A where the circannual component stays the same over time.
\begin{figure}[t!]
\begin{minipage}{4.6in}
\centering
\includegraphics[width=4.6in]{fig4}
\caption{\textbf{The circannual cycle is stationary at the city level but non-stationary at the local level.}
In (\textbf{A}), the scale-averaged wavelet power of the wavelet transform of the city-level time series with respect to the circannual band shows that the city-level time series are stationary over time (selected cities in the figure). At the local level, however, the time series are non-stationary. For instance, (\textbf{B}) depicts the scale-averaged wavelet power of four regions in Chicago. These curves exemplify local-level time series changing their circannual periodicity over time. Figures adapted from\cite{Oliveira2018}.}
\label{fig:fig4}
\end{minipage}
\end{figure}
At such a city level, crime has a striking temporal regularity that offers the impression of cities as stationary objects. This analysis, however, neglects spatial heterogeneity. The continuous organization process in cities suggests local-level dynamics changing across the city.
We expect variations that result from changes in human dynamics at the local and global levels of the city (e.g., an influx of new residents, closing establishments, new subway stations). To have a local-level view of cities, we can examine the time series from smaller spatial aggregation units. Similarly to Section~\ref{sec:concentration}, we divide each city $c$ into regions of similar population size and build the time series $Y^c_i$ for each region $i$.
Now we can examine the stationarity of crime at the local level. Fig.~\ref{fig:fig4}B shows the scale-averaged power of three regions in Chicago regarding the circannual component. Though they all exhibited a circannual cycle at some interval, they have distinct dynamics.
For example, region {\tt \#40} presents stationarity while region {\tt \#247} loses its circannual periodicity in 2014.
Though at the city level crime exhibits stationarity, circannual rhythms change over time at the local level. The aggregated data hide local dynamics. In fact, other periodicities take place at lower spatial granularity such as biannual and triannual but disappear at city level\cite{Oliveira2018}.
With all the time series $Y^c_i$ of a city, now we can examine crime from bottom to up.
We can study the non-stationarity in cities at the local level from a holistic perspective. For this, we count the number of regions that significantly show the circannual period at each time step. Specifically, the \textit{composed scale-averaged power} $C^b(t)$ is defined as the number of regions that exhibit a statistically significant band $b=(j_1, j_2)$ at the time step~$t$\cite{Oliveira2018}.
With data from $12$ cities in the U.S., we can show that $C^b(t)$ exhibits a typical value without much variability over time;~that is, cities stay with a similar number of regions with 1-year cycle over time.
This result is intriguing: though the time series are non-stationarity, the number of time series with a circannual period remains somewhat the same throughout the series.
Yet, note that $C^b(t)$ considers only the \textit{number} of regions and neglects the regions themselves.
We do not know if the number of regions stays the same because of the \textit{same set} of regions.
To understand better $C^b(t)$, we are also interested in the amount of time $\Delta t$ that a region exhibits a significant circannual periodicity. Precisely, we count the number of weeks that each region keeps the circannual band significant continuously.
From all the considered cities, $\Delta t$ decays much earlier than the total time of the criminal series.
That is, in general, the amount of time that a region has a circannual cycle is shorter than the entire time series.
This result coupled with the form of $C^b(t)$ implies waves of crime traveling across the city---a finding that agrees with the notion of cities continuously changing over time.
\section{Discussion}
Cities are evolving systems that exhibit global phenomena emerging from local-level actions, presenting messy but ordered patterns at different levels\cite{Batty2008,Oliveira2018}. From this perspective, we expect to find regularities in crime which transcend cultural and socio-economic particularities of cities. With the description of these regularities, we move towards better models to understand cities. In this chapter, we considered regularities present in two fundamental aspects of crime: space and time.
The spatial concentration of crime is not only ubiquitous in cities but also independent of the city size. The concentration level, however, depends on the type of crime---perhaps because of different kinds of crime exhibit particular dynamics. Such concentration coexists with the continuous displacement of crime spots in cities. That is, crime constantly flows across the city while maintaining the system organization in a way that its dynamics and regularities appear to be scale-invariant. These features suggest an understanding of crime from a complex-system perspective.
The well-documented seasonality in crime has a different picture when we admit cities as dynamic and continually organizing processes. When we account for spatial heterogeneity, we find that the circannual cycles of crime are unevenly distributed across the city. When we also consider non-stationarity, we observe features that agree with complex cities. On the one hand, the seasonality is stationary at the city level, but on the other hand, the criminal waves are non-stationary at the local level---they travel across the city. These findings support analyzing crime under the perspective of dynamic cities.
The complex-system perspective of crime asks for tools and analyses that cover the system as a whole in order to understand crime dynamics. Indeed, the connectedness of the city rejects studies focusing on the hotspots of crime and neglecting the ``cold" areas. In this scenario, network-based approaches might be essential to handle such mezzo level\cite{White2015,Oliveira2015a,Davies2015,DaCunha2018}.
The regularities discussed in this chapter have impacts on policy-making. The independence of crime concentration with city size implies that high crime regions are expected to exist as the city grows, urging for proper government policies.
Still, cities continuously change over time; thus policy-making needs evolving approaches and a constant assessment of the city. In this regard, policy-makers need tools and up-to-date data to assess the changes happening in cities. With the proper tools, we can learn more about cities and help to improve them.
\bibliographystyle{naturemag}
| {'timestamp': '2019-01-14T02:16:42', 'yymm': '1901', 'arxiv_id': '1901.03589', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03589'} | arxiv |
\section{Introduction}
Much of the current effort and literature in deep learning focuses on performance from a statistical pattern recognition perspective. In contrast, we go back to a biological motivation and look to build a model that includes aspects of the human visual system. The eminent computational neuroscientist David Marr posited that vision is composed of stages which lead from a two dimensional input to a three dimensional contextual model with an established notion of object~\citep{marr1982vision}. This higher order model is built up in the visual working memory as a visual sketchpad which integrates notions of pattern and texture with a notion of pose \citep{baddeley1974working}. Visual attention models often draw inspiration from some of these concepts and perform well at various tasks \citep{ablavatski2017enriched,ba2014multiple,gregor2015draw,jaderberg2015spatial,mnih2014recurrent,sonderby2015recurrent}. Inspired by vision in nature, visual attention corresponds to adaptive filtering of the model input, typically, through the use of a glimpsing mechanism which allows the model to select a portion of the image to be processed at each step. Broadly speaking, visual attention models exist at the crux of two key challenges. The first is to separate notions of pose and object from visual features. The second is to effectively model long range dependencies over a sequence of observations.
Various models have been proposed and studied which hope to enable deep networks to construct a notion of pose. For example, transformational attention models learn an implicit representation of object pose by applying a series of transforms to an image \citep{jaderberg2015spatial,ablavatski2017enriched}. Other models such as Transformational Autoencoders and Capsule Networks harness an explicit understanding of positional relationships between objects \citep{hinton2011transforming,sabour2017dynamic}. Short term memories have previously been studied as a way of improving the ability of Recurrent Neural Networks (RNNs) to learn long range dependencies. The ubiquitous Long Short-Term Memory (LSTM) network is perhaps the most commonly used example of such a model \citep{hochreiter1997long}. More recently, the fast weights model, proposed by \citet{ba2016using} provides a way of imbuing recurrent networks with an ability to attend to the recent past.
From these approaches, it is evident that memory is a central requirement for any method which attempts to augment deep networks with the ability to attend to visual scenes. The core concept which underpins memory in neuroscience is synaptic plasticity, the notion that synaptic efficacy, the strength of a connection, changes as a result of experience~\citep{purves1997neuroscience}. These changes occur at multiple time scales and, consequently, much of high level cognition can be explained in terms of the interplay between immediate, short and long term memories. An example of this can be found in vision, where each movement of our eyes requires an immediate contextual awareness and triggers a short term change. We then aggregate these changes to make meaningful observations over a long series of glimpses. Fast weights~\citep{ba2016using} draw inspiration from the Hebbian theory of learning~\citep{hebb1949organization} which gives a framework for how this plasticity may occur. Furthermore, differentiable plasticity \citep{miconi2018differentiable} combines neural network weights with weights updated by a Hebbian rule to demonstrate that backpropagation can be used to learn a substrate over which the plastic network acts as a content-addressable memory.
In this paper, we propose augmenting transformational attention models with a visual working memory in order to move towards two key goals. Firstly, we wish to understand if visual attention and working memory provide more than just increased efficiency and enable functions that cannot otherwise be achieved. Secondly, we wish to understand and seek answers to some of the challenges faced when attempting to model such psychophysical concepts in deep networks. We demonstrate classification performance on MNIST \citep{lecun1998mnist} and CIFAR-10 \citep{krizhevsky2009learning} that is competitive with the state of the art and vastly superior to previous models of attention, demonstrating the value of a working memory. We then demonstrate that it is possible to learn this memory representation in an unsupervised manner by painting images, similar to the Deep Recurrent Attentive Writer (DRAW) network \citep{gregor2015draw}. Using this representation, we demonstrate competitive classification performance on MNIST with self supervised features. Furthermore, we demonstrate that the model can learn a disentangled space over the images in CelebA \citep{liu2015faceattributes}, shedding light on some of the higher order functions that are enabled by visual attention. Finally, we show that the model can perform multiple tasks in parallel and how a visual sketchpad can be used to produce interpretable classifiers.
\section{Related Work and the Psychology of Visual Memory}
In this section we discuss related work on visual attention and relevant concepts from psychology and neuroscience which have motivated our approach. We will use the terms motivation and inspiration interchangeably throughout the paper to capture the notion that our decisions have been influenced by atypical factors. This is necessary as there are several facets to our approach which may seem nonsensical outside of a biological context.
Attention in deep models can be broadly split into two types: hard attention and soft attention. In hard attention a non-differentiable step is performed to extract the desired pixels from the image to be used in later operations. Conversely, in soft attention, differentiable interpolation is used. The training mechanism differs between the two approaches. Early hard attention models such as the Recurrent Attention Model (RAM) and the Deep Recurrent Attention Model (DRAM) used the REINFORCE algorithm to learn an attention policy over non-differentiable glimpses \citep{mnih2014recurrent,ba2014multiple}. More recent architectures such as Spatial Transformer Networks (STNs)~\citep{jaderberg2015spatial}, Recurrent STNs~\citep{sonderby2015recurrent} and the Enriched DRAM (EDRAM)~\citep{ablavatski2017enriched} use soft attention and are trained end to end with backpropagation. The DRAM model and its derivatives use a two layer LSTM to learn the attention policy. The first layer is intended to aggregate information from the glimpses and the second layer to observe this information in the context of the whole image and decide where to look next. The attention models described thus far predominantly focus on single and multi-object classification on the MNIST and Street View House Numbers~\citep{goodfellow2013multi} datasets respectively. Conversely, the DRAW network from \citet{gregor2015draw} is a fully differentiable spatial attention model that can make a sequence of updates to a canvas in order to draw the input image. Here, the canvas acts as a type of working memory which is constrained to also be the output of the network.
A common theme to these models is the explicit separation of pose and feature information. The Two Streams Hypothesis, suggests that in human vision there exists a `what' pathway and a `where' pathway \citep{goodale1992separate}. The `what' pathway is concerned with recognition and classification tasks and the `where' pathway is concerned with spatial attention and awareness. In the DRAM model, a multiplicative interaction between the pose and feature information, first proposed in \citet{larochelle2010learning}, is used to emulate this. The capacity for humans to understand pose has been studied extensively. Specifically, there is the notion that we are endowed with two methods of spatial understanding. The first is the ability to infer pose from visual cues and the second is the knowledge we have of our own pose \citep{gibson1950perception}.
Memory is generally split into three temporal categories, immediate memory, short term (working) memory and long term memory \citep{purves1997neuroscience}. Weights learned through error correction procedures in a neural network are analogous to a long term memory in that they change gradually over the course of the models existence. We can go further to suggest that the activation captured in the hidden state of a recurrent network corresponds to an immediate memory. There is, however, a missing component in current deep architectures, the working memory, which we study here. We will later draw inspiration from the Baddeley model of working memory \citep{baddeley1974working} which includes a visual sketchpad that allows individuals to momentarily create and revisit a mental image that is pertinent to the task at hand. This sketchpad is the integration of `what' and `where' information that is inferred from context and/or egomotion.
\section{An Associative Visual Working Memory}
Here we will outline our approach to augmenting models of visual attention with a working memory in order to seek a deeper understanding of the value of visual attention. In Section \ref{hebb-rose} we will detail the `plastic' Hebb-Rosenblatt network and update policy that comprise our visual memory. Then in Section \ref{stam} we will describe the STAWM model of visual attention which is used to build up the memory representation for each image. The key advantage of this approach that will form the basis of our experimentation lies in the ability to project multiple query vectors through the memory and obtain different, goal-oriented, latent representations for one set of weights. In Section \ref{using} we will discuss the different model `heads' which use these spaces to perform different tasks.
\subsection{Hebb-Rosenblatt Redux}
\label{hebb-rose}
\begin{figure}
\centering
\includegraphics[width=\linewidth]{assoc}
\caption{The two layer Hebb-Rosenblatt memory architecture. This is a novel, differentiable module inspired by Rosenblatts perceptron that can be used to `learn' a Hebbian style memory representation over a sequence and can subsequently be projected through to obtain a latent space.}
\label{model:memory}
\end{figure}
We will now draw inspiration from various models of plasticity to derive a differentiable learning rule that can be used to iteratively update the weights of a memory space, during the forward pass of a deep network. Early neural network models used learning rules derived from the Hebbian notion of synaptic plasticity \citep{hebb1949organization,block1962perceptron,block1962analysis,rosenblatt1962principles}. The phrase `neurons that fire together wire together' captures this well. If two neurons activate for the same input, we increase the synaptic weight between them; otherwise we decrease. In a spiking neural network this activation is binary, \textit{on} or \textit{off}. However, we can obtain a continuous activation by integrating over the spike train in a given window $\Delta t$. Although the information in biological networks is typically seen as being encoded by the timing of activations and not their number, this spike train integral can approximate it to a reasonable degree \citep{dayan2001theoretical}. Using this, we can create a novel short-term memory unit that can be integrated with other networks that are trained with backpropagation.
Consider the two layer network shown in Figure \ref{model:memory} with an input layer $L^\RN{1}$ and output layer $L^\RN{2}$, each of size $M$ with weights $\mathbf{W} \in \mathbb{R}^{M\times M}$. For a signal vector $\mathbf{e} \in \mathbb{R}^M$, propagating through $L^\RN{1}$, $L^\RN{2}$ will activate according to some activation function $\phi$ of the projection $\mathbf{W}\mathbf{e}$. The increase in the synaptic weight will be proportional to the product of the activations in the input and output neurons. We can model this with the outer product (denoted $\otimes$) to obtain the increment expression
\begin{equation}
\label{learn1}
\mathbf{W}(t + 1) = \mathbf{W}(t) + \eta \lbrack \mathbf{e} \otimes \phi(\mathbf{W}(t)\mathbf{e}) \rbrack - \delta \lbrack \mathbf{W}(t) \rbrack\enspace,
\end{equation}
where at each step, we reduce the weights matrix by some decay rate $\delta$ and apply the increment with some learning rate $\eta$. This rule allows for the memory to make associative observations over the sequence of states such that salient information will become increasingly prevalent in the latent space. However, if we initialize the weights to zero, the increment term will always be zero and nothing can be learned. We could perhaps consider a different initialisation such as a Gaussian but this would be analogous to implanting a false memory, which may be undesirable. Instead, a solution is offered in the early multi layer perceptron models of \citet{rosenblatt1962principles}. Here, neurons in the first layer transmit a fixed amount, $\theta$, of their input to a second layer counterpart as well as the weighted signal, as seen in Figure \ref{model:memory}. Combining both terms we obtain the final, biologically inspired learning rule that we will herein refer to as the Hebb-Rosenblatt rule,
\begin{equation}
\label{learnf}
\mathbf{W}(t + 1) = \mathbf{W}(t) + \eta \lbrack \mathbf{e} \otimes \phi(\mathbf{W}(t)\mathbf{e} + \theta \mathbf{e}) \rbrack - \delta \lbrack \mathbf{W}(t) \rbrack\enspace .
\end{equation}
Note that if we remove the projection term ($\mathbf{W}\mathbf{e}$) and set $\theta = 0$ and $\phi(x)=x$ we obtain the term used in the fast weights model of \citet{ba2016using} which also shares some similarities with the rules considered in \citet{miconi2018differentiable}. Analytically, this learning rule can be seen to develop high values for features which are consistently active and low values elsewhere. In this way the memory can make observations about the associations between salient features from a sequence of images.
\subsection{The Short Term Attentive Working Memory Model (STAWM)} \label{stam}
\begin{figure}
\includegraphics[trim={0.1cm 0 0 0}, clip, width=\linewidth]{memory_model}
\caption{The attentional working memory model which produces an \textit{update} to the memory. See Section \ref{stam} for a description of the structure and function of each module.}
\label{model:main}
\end{figure}
Here we describe in detail the STAWM model shown in Figure \ref{model:main}. This is an attention model that allows for a sequence of sub-images to be extracted from the input so that we can iteratively learn a memory representation from a single image. STAWM is based on the Deep Recurrent Attention Model (DRAM) and uses components from Spatial Transformer Networks (STNs) and the Enriched DRAM (EDRAM) \citep{ba2014multiple,jaderberg2015spatial,ablavatski2017enriched}. The design is intented to be comparable with previous models of visual attention whilst preserving proximity to the discussed psychological concepts, allowing us to achieve the goals set out in the introduction. At the core of the model, a two layer RNN defines an attention policy over the input image. As with EDRAM, each glimpse is parameterised by an affine matrix, ${\mathbf{A}} \in \mathbb{R}^{3 \times 2}$, which is sampled from the output of the RNN. At each step, ${\mathbf{A}}$ is used to construct a flow field that is interpolated over the image to obtain a fixed size glimpse in a process denoted as the glimpse transform, ${t_{{\mathbf{A}}}: \mathbb{R}^{H_i \times W_i} \rightarrow \mathbb{R}^{H_g \times W_g}}$, where $H_g \times W_g$ and $H_i \times W_i$ are the sizes of the glimpse and image respectively. Typically the glimpse is a square of size $S_g$ such that $H_g = W_g = S_g$. Features obtained from the glimpse are then combined with the location features and used to update the memory with Equation \ref{learnf}.
\paragraph{Context and Glimpse CNNs:}
The context and glimpse CNNs are used to obtain features from the image and the glimpses respectively. The context CNN is given the full input image and expected to establish the contextual information required when making decisions about where to glimpse. The precise CNN architecture depends on the dataset used and can be found in Appendix \ref{app:exp}. We avoid pooling as we wish for the final feature representation to preserve as much spatial information as possible. Output from the context CNN is used as the initial input and initial hidden state for the emission RNN. From each glimpse we extract features with the glimpse CNN which typically has a similar structure to the context CNN.
\paragraph{Aggregator and Emission RNNs:}
The aggregator and emission RNNs, shown in Figure \ref{model:main}, formulate the glimpse policy over the input image. The aggregator RNN is intended to collect information from the series of glimpses in its hidden state which is initialised to zero. The emission RNN takes this aggregate of knowledge about the image and an initial hidden state from the context network to inform subsequent glimpses. By initialising the hidden states in this way, we expect the model to learn an attention policy which is motivated by the difference between what has been seen so far and the total available information. We use LSTM units for both networks because of their stable learning dynamics \citep{hochreiter1997long}, both with the same hidden size. As these networks have the same size they can be conveniently implemented as a two layer LSTM. We use two fully connected layers to transpose the output down to the six dimensions of ${\mathbf{A}}$ for each glimpse. The last of these layers has the weights initialised to zero and the biases initialised to the affine identity matrix as with STNs.
\paragraph{Memory Network:}
The memory network takes the output from a multiplicative `what, where' pathway and passes it through a square Hebb-Rosenblatt memory with weights $\mathbf{W} \in \mathbb{R}^{M\times M}$, where $M$ is the memory size. The `what' and `where' pathways are fully connected layers which project the glimpse features (`what') and the RNN output (`where') to the memory size. We then take the elementwise product of these two features to obtain the input to the memory, ${\mathbf{e}} \in \mathbb{R}^M$. We can think of the memory network as being in one of three states at any point in time, these are: \textit{update}, \textit{intermediate} and \textit{terminal}. The \textit{update} state of the memory is a dynamic state where any signal which propagates through it will trigger an update to the weights using the rule in Equation \ref{learnf}. In STAWM, this update will happen $N$ times per image, once for each glimpse. Each of the three learning rates ($\delta$, $\eta$ and $\theta$) are hyper-parameters of the model. These can be made learnable to allow for the model to trade-off between information recall, associative observation and the individual glimpse. However, the stability of the memory model is closely bound to the choices of learning rate and so we derive necessary initial conditions in Appendix \ref{stabilising}.
For the \textit{intermediate} and \textit{terminal} states, no update is made to the Hebb-Rosenblatt memory for signals that are projected through. In the \textit{intermediate} state we observe the memory at some point during the course of the attention policy. Conversely, in the \textit{terminal} state we observe the fixed, final value for the memory after all $N$ glimpses have been made. We can use the \textit{intermediate} or \textit{terminal} states to observe the latent space of our model conditioned on some query vector. That is, at different points during the glimpse sequence, different query vectors can be projected through the memory to obtain different latent representations. For a self-supervised setting we can fix the weights of STAWM so that the memory inputs cannot be changed by the optimizer.
\subsection{Using the Memory}
\label{using}
We now have an architecture that can be used to build up or `learn' a Hebb-Rosenblatt memory over an image. Note that when projecting through the memory, we do not include $\theta\mathbf{e}$ in the output. This is so that it is not possible for the memory to simply learn the identity function. We use the output from the context CNN as a base that is projected into different queries for the different aims of the network. We do this using linear layers, the biases of which can learn a static representation which is then modulated by the weighted image context. We detach the gradient of the image context so that the context network is not polluted by divergent updates. In this section we will characterise the two network `heads' which make use of latent spaces derived from the memory to perform the tasks of classification and drawing. We will also go on to discuss ways of constraining the glimpse sub-spaces in a variational setting.
\paragraph{Classification:}
\begin{figure}
\centering
\includegraphics[trim={0.1cm 0 0 0}, clip, width=0.75\linewidth]{classification}
\caption{The classification model which uses the \textit{terminal} state of the memory.}
\label{model:class}
\end{figure}
For the task of classification, the query vector is projected through the memory in exactly the same fashion as a linear layer to derive a latent vector. This latent representation is then passed through a single classification layer which projects from the memory space down to the number of classes as shown in Figure \ref{model:class}. A softmax is applied to the network output and the entire model (including the attenion mechanism) is trained by backpropagation to minimise the categorical cross entropy between the network predictions and the ground truth targets.
\paragraph{Learning to Draw:}
\label{sec:drawing}
\begin{figure}
\centering
\includegraphics[trim={0.1cm 0 0 0}, clip, width=\linewidth]{drawing}
\caption{The drawing model which uses \textit{intermediate} states of the memory.}
\label{model:draw}
\end{figure}
To construct a visual sketchpad we will use a novel approach to perform the same task as the DRAW network with the auxiliary model in Figure \ref{model:draw}. Our approach differs from DRAW in that we have a memory that is independent from the canvas and can represent more than just the contents of the reconstruction. However, it will be seen that an important consequence of this is that it is not clear how to use STAWM as a generative model in the event that some of the skecthes are co-dependent. The drawing model uses each intermediate state of the memory to query a latent space and compute an update, $\mathbf{U} \in \mathbb{R}^{H_g \times W_g}$, to the canvas, $\mathbf{C} \in \mathbb{R}^{H_i \times W_i}$, that is made after each glimpse. Computing the update or sketch is straightforward, we simply use a transpose convolutional network (`Transpose CNN') with the same structure as the glimpse CNN in reverse. However, as the features were observed under the glimpse transform, $t_{{\mathbf{A}}}$, we allow the emission network to further output the parameters, ${\mathbf{A}}^{-1} \in \mathbb{R}^{3 \times 2}$, of an inverse transform, ${t_{{\mathbf{A}}^{-1}}: \mathbb{R}^{H_g \times W_g} \rightarrow \mathbb{R}^{H_i \times W_i}}$, at the same time. The sketch will be warped according to $t_{{\mathbf{A}}^{-1}}$ before it is added to the canvas. To add the sketch to the canvas there are a few options. We will consider two possibilities here: the addition method and the Bernoulli method.
The addition method is to simply add each update to the canvas matrix and finally apply a sigmoid after the glimpse sequence has completed to obtain pixel values. This gives an expression for the final canvas
\begin{equation}
\label{canvas:addition}
\mathbf{C}_N = \rm{S}\left(\mathbf{C}_0 + \sum_{n=0}^{N} t_{{\mathbf{A}}^{-1}}(\mathbf{U}_m)\right)\enspace ,
\end{equation}
where $\mathbf{C}_0 \in \{-6\}^{H_i \times W_i}$, $\rm{S}$ is the sigmoid function and $N$ is the total number of glimpses. We set $\mathbf{C}_0$ to $-6$ so that when no additions are made the canvas is black and not grey. The virtue of this method is its simplicity, however, for complex reconstructions, overlapping sketches will be required to counteract each other such that they may not be viewable independently in an interprettable manner.
An alternative approach, the Bernoulli method, could help to prevent these issues. Ideally, we would like the additions to the canvas to be as close as possible to painting in real life. In such a case, each brush stroke replaces what previously existed underneath it, which is dramatically different to the effect of the addition method. In order to achieve the desired replacement effect we can allow the model to mask out areas of the canvas before the addition is made. We therefore add an extra channel to the output of the transpose CNN, the alpha channel. This mask, ${\mathbf{P}} \in \mathbb{R}^{H_g \times W_g}$, is warped by $t_{{\mathbf{A}}^{-1}}$ as with the rest of the sketch. A sigmoid is applied to the output from the transpose CNN so that the mask contains values close to one where replacement should occur and close to zero elsewhere. Ideally, the mask values would be precisely zero or one. To achieve this, we could take ${\mathbf{P}}$ as the probabilities of a Bernoulli distribution and then draw ${\mathbf{B}} \sim \mathit{Bern}(t_{{\mathbf{A}}^{-1}}(\rm{S}(\mathbf{P}))$. However, the Bernoulli distribution cannot be sampled in a differentiable manner. We will therefore use an approximation, the Gumbel-Softmax \citep{jang2016categorical} or Concrete \citep{maddison2016concrete} distribution, which can be differentiably sampled using the reparameterization trick. The Concrete distribution is modulated with the temperature parameter, $\tau$, such that $\lim_{\tau \rightarrow 0}\mathit{Concrete}(p, \tau) = \mathit{Bern}(p)$. We can then construct the canvas iteratively with the expression
\begin{equation}
\label{canvas:bern}
\mathbf{C}_{N} = \mathbf{C}_{N-1} \;\odot\; (1 - {\mathbf{B}}) \;+\; t_{{\mathbf{A}}^{-1}}(\rm{S}(\mathbf{U}_N)) \;\odot\; {\mathbf{B}} \enspace , \enspace{\mathbf{B}} \sim \mathit{Concrete}(t_{{\mathbf{A}}^{-1}}(\rm{S}(\mathbf{P})), \tau)\enspace ,
\end{equation}
where $\mathbf{C}_0 \in \{0\}^{H_i \times W_i}$ and $\odot$ is the elementwise multiplication operator. Note that this is a simplified \textit{over} operator from alpha compositing where we assume that objects already drawn have an alpha value of one \citep{porter1984compositing}.
\paragraph{Constraining Glimpse Sub-spaces:} A common approach in reconstructive models is to model the latent space as a distribution whose shape over a mini-batch is constrained using a Kullback-Liebler divergence against a (typically Gaussian) prior distribution. We employ this variational approach as shown in Figure \ref{model:draw} where, as with Variational Auto-Encoders (VAEs), the latent space is modelled as the variance ($\bm{\sigma}^2$) and mean ($\bm{\mu}$) of a multivariate Gaussian with $K$ components and diagonal covariance \citep{kingma2013auto}. For input ${\mathbf{x}} \in \mathbb{R}^{H_i \times W_i}$ and some sample ${\mathbf{z}} \in \mathbb{R}^{K}$ from the latent space, the $\beta$-VAE \citep{higgins2016beta} uses the objective
\begin{equation}
\label{kl:beta}
\mathcal{L}(\theta, \phi; {\mathbf{x}}, {\mathbf{z}}, \beta) = \mathbb{E}_{q_{\phi}({\mathbf{z}}\given{\mathbf{x}})} \left[\log p_{\theta}({\mathbf{x}} \given {\mathbf{z}})\right] - \betaD_{\mathrm{KL}}\left(q_\phi({\mathbf{z}} \given {\mathbf{x}}) \,\|\, p({\mathbf{z}})\right) \enspace .
\end{equation}
For our model, we do not have a single latent space but a sequence of glimpse sub-spaces ${G=({\mathbf{g}}_n)_{n=0}^{N},\enskip{\mathbf{g}}_n\in\mathbb{R}^{K}}$. For the addition method, we can simply concatenate the sub-spaces to obtain ${\mathbf{z}} \in \mathbb{R}^{N \times K}$ and use the divergence term above. In the Bernoulli method, however, we can derive a more appropriate objective by acknowledging that outputs from the decoder are conditioned on the joint distribution of the glimpse sub-spaces. In this case, assuming that elements of $G$ are conditionally independent, following from the derivation given in Appendix \ref{klderiv}, we have
\begin{equation}
\label{kl:joint}
\mathcal{L}(\theta, \phi; {\mathbf{x}}, G, \beta) = \mathbb{E}_{q_{\phi}(G\given{\mathbf{x}})} \left[\log p_{\theta}({\mathbf{x}} \given G)\right] - \beta\sum_{n=0}^{N}D_{\mathrm{KL}}\left(q_\phi({\mathbf{g}}_n\given{\mathbf{x}})\,\|\, p({\mathbf{g}}_n)\right) \enspace .
\end{equation}
\section{Experiments}
In this section we discuss the results that have been obtained using the STAWM model. The training scheme and specific architecture details differ for each setting, for full details see Appendix \ref{app:exp}. For the memory we use a ReLU6 activation, $y = \rm{min}(\rm{max}(\mathnormal{x}, 0), 6)$ \citep{krizhevsky2010convolutional} on both the input and output layers. Following the analysis in Appendix \ref{stabilising}, we initialise the memory learning rates $\delta$, $\eta$ and $\theta$ to $0.2$, $0.4$ and $0.5$ respectively. For some of the experiments these are learnable and are updated by the optimiser during training. Our code is implemented in PyTorch \citep{paszke2017automatic} with torchbearer \citep{torchbearer2018} and can be found at \url{https://github.com/ethanwharris/STAWM}. Examples in all figures have not been cherry picked.
\subsection{Classification}
\begin{table}
\caption{Classification performance of our model on the MNIST and CIFAR-10 datasets. Mean and standard deviation reported from $5$ trials.}
\label{results}
\centering
\begin{tabular}{ll}
\multicolumn{2}{c}{\textbf{(a) MNIST Supervised}}\\
\toprule
Model & Error\\
\midrule
RAM, $S_g = 8$, $N=5$ & $1.55\%$\\
RAM, $S_g = 8$, $N=6$ & $1.29\%$\\
RAM, $S_g = 8$, $N=7$ & $1.47\%$\\
STAWM, $S_g = 8$, $N=8$ & $0.41\%_{\pm 0.03}$\\
STAWM, $S_g = 28$, $N=10$ & $0.35\%_{\pm 0.02}$\\
\bottomrule
\end{tabular}
\begin{tabular}{ll}
\multicolumn{2}{c}{\textbf{(b) MNIST Self-supervised}} \\
\toprule
Model & Error\\
\midrule
DBM, Dropout \citep{srivastava2014dropout}& $0.79\%$\\
Adversarial \citep{goodfellow2014explaining}& $0.78\%$\\
Virtual Adversarial \citep{miyato2015distributional} & $0.64\%$\\
Ladder \citep{rasmus2015semi}& $0.57\%$\\
STAWM, $S_g = 6$, $N=12$& $0.77\%$\\
\bottomrule
\end{tabular}
\newline
\vspace*{0.5em}
\newline
\begin{tabular}{ll}
\multicolumn{2}{c}{\textbf{(c) CIFAR-10 Self-supervised}} \\
\toprule
Model & Error\\
\midrule
Baseline $\beta$-VAE & $63.44\%_{\pm 0.31}$\\
STAWM, $S_g=16$, $N=8$& $55.40\%_{\pm 0.63}$\\
\bottomrule
\end{tabular}
\end{table}
We first perform classification experiments on handwritten digits from the MNIST dataset \citep{lecun1998mnist} using the model in Figure \ref{model:class}. We perform some experiments with $S_g = 8$ in order to be comparable to previous results in the literature. We also perform experiments with $S_g = 28$ to see whether attention can be used to learn a positional manifold over an image by subjecting it to different transforms. The MNIST results are reported in Table \ref{results} and show that STAWM obtains superior classification performance on MNIST compared to the RAM model. It can also be seen that the over-complete strategy obtains performance that is competitive with the state of the art of around $0.25\%$ for a single model \citep{sabour2017dynamic}, with the best STAWM model from the $5$ trials obtaining a test error of $0.31\%$. This suggests an alternative view of visual attention as enabling the model to learn a more powerful representation of the image. We experimented with classification on CIFAR-10 \citep{krizhevsky2009learning} but found that the choice of glimpse CNN was the dominating factor in performance. For example, using MobileNetV2 \citep{sandler2018mobilenetv2} as the glimpse CNN we obtained a single run accuracy of $93.05\%$.
\subsection{Drawing - Addition}
Following experimentation with MNIST we observed that there are three valid ways to draw using the addition method. First, the model could simply compress the image into a square equal to the glimpse size and decompress later. Second, the model could learn to trace lines such that all of the notion of object is contained in the pose information instead of the features. Finally, the model could learn a pose invariant, parts based representation as we originally intended. The most significant control of this behaviour is the glimpse size. At $S_g = 8$ or above, enough information can be stored to make a simple compression the most successful option. Conversely, at $S_g = 4$ or below, the model is forced to simply draw lines. In light of these observations, we use $N = 12$ with $S_g = 6$ to obtain an appropriate balance. Sample update sequences for these models are shown in Figure~\ref{draw:mnist} in Appendix~\ref{app:stages}. For $S_g = 6$ it can be seen that the model has learned a repeatable parts-based representation which it uses to draw images. In this way the model has learned an implicit notion of class.
\begin{figure}
\centering
\includegraphics[width=\linewidth]{cifar}
\caption{CIFAR-10 reconstructions for the baseline $\beta$-VAE and the drawing model with $N = 8$, $S_g = 16$. Top: baseline results. Middle: drawn results. Bottom: target images. Best viewed in colour.}
\label{draw:cifar}
\end{figure}
We also experimented with painting images in CIFAR-10. To establish a baseline we also show reconstructions from a reimplementation of $\beta$-VAE \citep{higgins2016beta}. To be as fair as possible, our baseline uses the same CNN architecture and latent space size as STAWM. This is still only an indicative comparison as the two models operate in fundamentally different ways. Autoencoding CIFAR-10 is a much harder task due to the large diversity in the training set for relatively few images. However, our model significantly outperforms the baseline with a terminal mean squared error of $0.0083_{\pm 0.0006}$ vs $0.0113_{\pm 0.0001}$ for the VAE. On inspection of the glimpse sequence given in Appendix \ref{app:stages} we can see that although STAWM has not learned the kind of parts-based representation we had hoped for, it has learned to scan the image vertically and produce a series of slices. We again experimented with different glimpse sizes and found that we were unable to induce the desired behaviour. The reason for this seems clear; any `edges' in the output where one sketch overlaps another would have values that are scaled away from the target, resulting in a constant pressure for the sketch space to expand. This is not the case in MNIST, where overlapping values will only saturate the sigmoid.
\paragraph{Self-Supervised Classification:} We can fix the weights of the STAWM model learned from the drawing setting and add the classification head to learn to classify using the self-supervised features. In this case, the only learnable parameters are the weights of the two linear layers and the learning rates for the memory construction. This allows the model to place greater emphasis on previous glimpses to aid classification. As can be seen from Table \ref{results}, we obtain performance on the self-supervised MNIST features that is competitive with the state of the art models, none of which use an attention mechanism. The self-supervised performance on CIFAR-10 is less competitive with the state of the art, but does show a clear improvement over the results obtained using the baseline VAE.
\subsection{Drawing - Bernoulli}
\begin{figure}
\centering
\includegraphics[width=\linewidth]{celeb_draw}
\caption{Output from the drawing model for CelebA with $N = 8$, $S_g = 32$. Top: the drawn results. Middle: the target images. Bottom: the learned mask from the last glimpse, pointwise multiplied with the target image. Best viewed in colour.}
\label{draw:celeb}
\end{figure}
As discussed previously, the canvas for the drawing model can be constructed using the Bernoulli method given in Section \ref{sec:drawing}. In this setting we trained on the CelebA dataset \citep{liu2015faceattributes} which contains a large number of pictures of celebrity faces and add the KL divergence for the joint distribution of the glimpse spaces with a Gaussian prior given in Equation \ref{jointkldiv} in Appendix~\ref{klderiv}. An advantage of the Bernoulli method is that we sample an explicit mask for the regions drawn at each step. If interesting regions are learned, we can use this as an unsupervised segmentation mask. Figure~\ref{draw:celeb} shows the result of the drawing model on CelebA along with the target image and the learned mask from the final glimpse elementwise multiplied with the ground truth. Here, STAWM has learned to separate the salient face region from the background in an unsupervised setting. Analytically, the KL term we have derived will ask for the subsequent glimpse spaces to transition smoothly as the image is observed. Coupled with the fact that the memory can only build up a representation over the sequence, it follows that the model will learn to sketch increasingly complex areas with each new glimpse. This is precisely the case, as seen from the sketch sequence, Figure~\ref{draw:celeb_stages} in Appendix~\ref{app:stages}.
\subsection{Visual Sketchpad}
\begin{figure}
\centering
\includegraphics[width=\linewidth]{wrong}
\setlength\tabcolsep{5.45pt}
\begin{tabular}{ccccccccccccccccccccccccc}
$8$ & $2$ & $9$ & $0$ & $5$ & $2$ & $7$ & $6$ & $3$ & $7$ & $5$ & $9$ & $6$ & $2$ & $5$ & $5$ & $7$ & $2$ & $3$ & $7$ & $7$ & $6$ & $7$ & $5$ & $2$ \\
\end{tabular}
\includegraphics[width=\linewidth]{target}
\begin{tabular}{ccccccccccccccccccccccccc}
$3$ & $7$ & $4$ & $6$ & $3$ & $8$ & $2$ & $0$ & $7$ & $4$ & $3$ & $8$ & $4$ & $7$ & $9$ & $3$ & $5$ & $8$ & $5$ & $9$ & $8$ & $0$ & $3$ & $8$ & $7$ \\
\end{tabular}
\caption{Top: sketchpad results and associated predictions for a sample of misclassifications. Bottom: associated input images and target classes.}
\label{draw:sketch}
\end{figure}
One of the interesting properties of the STAWM model is the ability to project different things through the memory to obtain different views on the latent space. We can therefore use both the drawing network and the classification network in tandem by simply summing the losses. We scale each loss so that one does not take precedence over the other. We also must be careful to avoid overfitting so that the drawing is a good reflection of the classification space. For this experiment, with $S_g = 8$, the terminal classification error for the model is $1.0\%$. We show the terminal state of the canvas for a sample of misclassifications in Figure \ref{draw:sketch}. Here, the drawing gives an interesting reflection of what the model `sees' and in many cases the drawn result looks closer to the predicted class than to the target. For example, in the rightmost image, the model has drawn and predicted a `$2$' despite attending to a `$7$'. This advantage of memories constructed as the weights of a layer, coupled with their ability to perform different tasks well with shared information, is evident and a clear point for further research.
\section{Conclusions and Future Work}
In this paper we have described a novel, biologically motivated short term attentive working memory model (STAWM) which demonstrates impressive results on a series of tasks and makes a strong case for further study of short term memories in deep networks. As well as demonstrating competitive classification results on MNIST and CIFAR-10, we have shown that the core model can be used for image reconstruction and for disentangling foreground from background in an unsupervised setting with CelebA. Finally, we have given a concrete example of how a model augmented with a visual sketchpad can `describe what it sees' in a way that is naturally interpretable for humans. It is easy to see how similar systems could be used in future technologies to help open the `black-box' and understand why a decision was made, through the eyes of the model that made it. Furthermore, we have explored the notion that building up a memory representation over an attention policy, coupled with a smooth changing latent space can result in a movement from simple to complex regions of a scene. This perhaps gives us some insight into how humans learn to attend to their environment when endowed with a highly capable visual memory. Future work will look to see if variants of this model can be used to good effect on higher resolution images. Experimentation and analysis should also be done to further understand the dynamics of the Hebb-Rosenblatt memory and the representation it learns. We further intend to investigate if the memory model can be used for other applications such as fusion of features from multi-modal inputs. Finally, we will look further into the relationship between visual memories and saliency.
\bibliographystyle{abbrvnat}
| {'timestamp': '2019-01-14T02:21:42', 'yymm': '1901', 'arxiv_id': '1901.03665', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03665'} | arxiv |
\section{Code Generation for fused operations}
\label{sec:codegen}
The JIT compiler used within Grumpy is based on
LambdaJIT~\cite{lambdajit}. It is an LLVM based compiler that can
generate code to execute either on the multicore CPU or on the
GPU. Its supports code generation for three primitive operations:
\emph{map}, \emph{map-reduce} and \emph{map-scan}. This section
provides details of the code-generation process.
\subsection{Map operations}
\label{subsec:map-codegen}
Map operations are a natural representation of computations where the
same operations is to be performed on a different elements of an
array. These operations can be done in parallel without any need for
synchronization. For example, consider the code in
Listing~\ref{lst:example-code} that implements the computation
represented by the DAG in Figure~\ref{fig:example}. This computation
can be viewed as executing the function \texttt{example\_pt\_fn} shown
in Listing~\ref{lst:example-lambda} over a 2D orthogonal iteration
space. Given this function (refered to as point function) and the
iteration space dimensions, the JIT compiler will generate code that
partitions this iteration space to either
\begin{itemize}
\item CPU threads on multicore CPUs with each thread executing a block
of this iteration space, or
\item GPU with each thread executing one point in this iteration space
\end{itemize}
\begin{figure}
\lstinputlisting[language=c, caption={Map function that is used to
generate the fused code similar to
Listing~\ref{lst:example-code}}, label={lst:example-lambda},
rangeprefix={\/\/\ \{\ }, rangesuffix={\ \}},
linerange=lambdastart-lambdaend]{src/example.c}
\vspace{-2em}
\end{figure}
In general the code-generator accepts a point function and an
$n$-Dimensional iteration space to generate the code for the parallel
execution of the map operation. It is expected that the first $n$
arguments of point function are integers that represent the point in
the iteration space being executed.
To generate the point function for a subgraph found in
Algorithm~\ref{algo:create_subgraph}, the code generation starts from
the root of the subgraph. The shape of the result tensor (i.e., the
result of the operation represented by the root node) gives the
dimensionality and shape of the iteration space to be used in the
generated code. The first $n$ arguments of the point function also
represent the index into the result tensor where the value computed by
the point function is to be stored. These indices are translated into
indices for predecessors, and so on till the leaves of the subgraph
are reached. The index expression at the leaves are used to reads
inputs to the subgraph (Algorithm~\ref{algo:create_subgraph} ensures
that the leaves are materialized). For example, consider a subgraph
with a transpose operation of a 2D tensor as the root. Say, the first
two arguments of the point function are $i$ and $j$, i.e., the point
function computes the value of element $(i,j)$. Then the indices to
use for the predecessor would be $(j, i)$. The index expression
translation needs to account for broadcast semantics, slicing, and
other index transformation operations. The point function generated
and the shape of the root node are passed to a routine that generates
code for map operation. This function, when invoked, executes the
computation represented by the subgraph.
\subsection{Map-Reduce and Map-Scan operations}
\label{subsec:mapreduce-codegen}
The \emph{map-reduce} operations represents the computation where
elements of a tensor are combined to produce a single value using an
associative and commutative operation (we assume floating point
operations satisfy both within some error bounds). For example, the
\texttt{numpy.sum()} operation, which is a reduction with sum operator
over all axis of the input array fits such an abstraction. To generate
code for such computations, the code generators takes two functions as
inputs. First, a binary operation that takes two values of the same
type and combines them using an associative and commutative operation
to generate a result of the same type. The second is a map function,
similar to the function describes in Section~\ref{subsec:map-codegen},
but instead of \texttt{void} return type, it returns a value that is
of the same type as the arguments of the binary operator. The map
function is used to produce all the elements that are to be combined
using the binary operator to produce a single final result value. For
example, the Listing~\ref{lst:innerproduct} shows the map function,
\texttt{ip\_map} and the binary operator, \texttt{ip\_reduce} to be
used to implement an inner-product of two $1$-D vectors \texttt{a} and
\texttt{b}. The map operations first performs the element wise
multiplication of the two vectors to generate the values that are to
be combined using \texttt{+} operation to get the final result.
\begin{figure}
\lstinputlisting[language=c, caption={Map and Reduce function used
to generate the map-reduce function that computes the inner
product of two $1$-D vectors}, label={lst:innerproduct},
rangeprefix={\/\/\ \{\ }, rangesuffix={\ \}},
linerange=start-end]{src/ip.c}
\vspace{-2em}
\end{figure}
When the subgraph to be JIT compiled has a root which represents a
reduction value to generate a single value, it first generates the
binary function based on the reduction operation being used. It then
generates the point function for the map in a process similar to the
one described in Section~\ref{subsec:map-codegen}. The dimensionality
of the map function is same as that of the operand of the root node,
since its the result of the operand that are the values to be combined
during the reduction operation represented by the root. The shape of
the operand to the root node, the map function and the binary
operation is used to the map-reduce code for the desired target.
On CPU the iteration space for the map operation is split amongst the
threads in a blocked fashion. The result of the map operation are then
combined using the binary operator to get a value per thread. The
values generated for each thread is then combined using the binary
operator to get the final result.
On the GPU, the iteration space of the map operation is distributed
amongst threads, with one point per thread. The result generated from
threads in a thread block are combined in shared memory to a single
value. The result from each thread block is written out to global
memory. A separate kernel is used to do the final reduction of these
values to get the final result. Note that for this kernel does not use
the map operation. It only uses the binary operation to combine these
values.
For cases where the root of the subgraph that is to be JIT compiled is
a scan operation, a map-scan primitive is used. It requires the same
map point function and binary operator as above. Further details about
the mechanism to compute the map-scan in parallel on the CPU and GPU
are not relevant to this paper. For further details about the scan
algorithm generated please refer to the work-efficient parallel scan
algorithm described here~\cite{gpuscan}.
\section{Experimental Results}
\label{sec:results}
The Grumpy framework described in Sections~\ref{sec:fusion}
and~\ref{sec:codegen} is deployed as a python module, called
\texttt{grumpy} that implements the same interface as Numpy. The goal
is that the only change a user has to make is to import this module
instead of \texttt{numpy}. While we would like handle all the numpy
methods within Grumpy, it is a daunting task due to sheer number of
methods that Numpy supports. To ensure we achieve the desired
deployment model we ensure that \texttt{grumpy} and \texttt{numpy}
modules interact seamlessly. Internally, the \texttt{grumpy} module
intercepts operation sequence that can handled by the framework and
passes it on to the core Grumpy libraries. For the unhandled
operations, it is forwarded to the \texttt{numpy} module. We describe
briefly few aspects of this mechanism.
\subsection{\texttt{grumpy} - \texttt{numpy} Interoperability}
\label{subsec:grumpy_numpy}
The \texttt{grumpy} python module provides an \texttt{ndarray} object
similar to the one that is provided by \texttt{numpy}. This object has
the same methods, attributes, etc. as Numpy version of the same
object. While it is not implemented this way, it can be thought of as
a derived object of the \texttt{numpy.ndarray}. An instance of the
\texttt{grumpy.ndarray} object represents a node in the DAG internal
representation in Grumpy. To be able to inter-operate with
\texttt{numpy} seamlessly, we have to ensure that each method provided
by \texttt{grumpy} knows how to handle input arguments being
\texttt{numpy} arrays. These typically form the leaves of the sequence
of operations that are then evaluated lazily using Grumpy, and
therefore act as inputs to the computation. If an unsupported
operation is encountered (which would include print methods), before
falling back to \texttt{numpy}, the nodes that correspond to the
arrays being passed to the fallback routine need to be
materialized. This triggers the materialization process, and the
result is forwarded to the numpy methods as a numpy array.
\subsection{Performance gains on multi-core CPUs and GPU}
\label{subsec:perf}
\begin{figure}
\lstinputlisting[caption={Jacobi stencil in Numpy},
label={lst:jacobi}]{src/jacobi.py}
\vspace{-2em}
\end{figure}
\begin{figure*}
\centering \subfloat[][BlackScholes]{
\includegraphics[scale=0.7]{figs/blackscholes.png}
\label{fig:blackscholes}
}
\subfloat[][KMeans]{
\includegraphics[scale=0.7]{figs/kmeans.png}
\label{fig:kmeans}
}
\\
\subfloat[][Jacobian Stencil]{
\includegraphics[scale=0.7]{figs/jacobi.png}
\label{fig:jacobi}
}
\subfloat[][RNN]{
\includegraphics[scale=0.7]{figs/rnn.png}
\label{fig:rnn}
}
\caption{Performance comparison against Numpy on multicore CPU and NVIDIA GPU}
\label{fig:perfbase}
\end{figure*}
For the rest of the section we discuss some of the benchmarks that
were targeted using this approach. We picked six benchmarks from
different fields for evaluation. Black-Scholes is a widely used
computation in financial application domain. KMeans is a basic
clustering algorithm from statistical analysis domain. Jacobi stencil
represents a stencil computation used in many simulation
applications. Listing~\ref{lst:jacobi} so the numpy implementation
used for the baseline. The fourth application is from deep-learning
domain and is an RNN training sample. The Grumpy JIT-Compiler was
implemented in LLVM-3.8. On the CPU, we can use LLVM to JIT-Compile to
\texttt{x86} code. On the GPU LLVM produces PTX~\cite{ptx}
instructions, that are similar to assembly instructions. The
CUDA~\cite{cuda} driver can compile the PTX to the machine
instructions. We use CUDA-9.0 for our experiments. To support GPU
execution, inputs to the kernel to be executed are automatically
copied onto the device and the results are copied back to the
host. Our implementation does not implement any specific CPU or GPU
optimization to reduce the complexity of handling multiple
backends. For example, we do not use vectorization for CPUs. We do not
make use of fast shared memory on GPUs to improve performance. As a
result the main benefit from using Grumpy would be only through fusion
or through use of specialized libraries for certain operations.
Figure~\ref{fig:perfbase} shows the performance improvements over Numpy
execution when using Grumpy. For each individual figure the speedup
over Numpy when using $1$, $2$ and $4$ CPU threads are shown (these
lines use values from the left side y-axis). The figure also shows the
speed up when executing the computation using a GP 100 (using the
value from the right side y-axis).The performance numbers include the
overhead of JIT compilation. It is expected that for small problem
sizes, the overhead of JIT compilation dominates. As a result it
should be expected that Grumpy would be considerably slower than
Numpy. As problem size increases and the computation time dominates the
overall execution time, the performance benefits of fusion in Grumpy
as well as the ability to execute the computation in parallel on CPUs
or to offload to GPUs starts showing dividends. We present below on
analysis of the performance improvements on each of these benchmarks.
Black-Scholes (Figure~\ref{fig:blackscholes}) is a computation that
contain a lot of point-wise operations which could be completely
fused. For small problem sizes, the JIT compilation overhead
dominates, but for large problem sizes, Grumpy provides as much as
$76$x speed up over Numpy. No hand tuned kernels from libraries are
needed for executing this computation. KMeans computation is
inherently poorly suited for the GPU execution model due to irregular
accesses to the input data during clustering. For this computation as
well, there are no computations offloaded to libraries. Due to these
factors, the GPU performance (Figure~\ref{fig:kmeans}) is not as
drastic from Grumpy. Interestingly, for large problem sizes, the
multi-core CPU performance shows good improvement, both due to fusion
and parallelism.
The Jacobian stencil computation shows that Grumpy is able to fuse the
computation into a single kernel even when slicing. The generated code
is what one would have written in a low-language like CUDA. An
interesting point to note is that slicing in Numpy doesn't create a new
array, but a view of the same buffer. That is the main reason behind
almost no improvement on CPU from fusion. Further, being bandwidth
bound, parallelism doesn't help as much on the CPU. GPU performance
still shows about $6$ times improvement over Numpy.
The RNN training sample has a lot of dot products, and very few
sequences of point functions. This results in the compilation overhead
having a major impact on the performance. Consequently, Grumpy obtains
a speed up of just $2.5$ times over Numpy when running on GPUs. On
CPUs no improvement is seen. One issue here is specific to the current
implementation. Grumpy doesn't use BLAS libraries for CPUs. Instead it
uses a rudimentary matrix-matrix multiply kernel which is not
optimized for cache or to use vector instruction units on CPUs. Since
matrix-matrix multiplies form a major portion of the computation, this
implementation deficiency hurts the speed up achieved with Grumpy on
CPUs
Another interesting metric to look at is the performance benefit when
the JIT compilation overhead is not accounted for. This would be an
estimate of the benefit from fusion and library usage when compared to
Numpy. For each of the benchmark, Figure~\ref{fig:perfbase-nocompile}
shows the speed up over Numpy when the JIT compilation overhead is not
included in the overall execution time for Grumpy. In general, one
would expect that for small problem sizes the JIT compilation overhead
is large, and this is shown to be the case. The JIT overhead seems to
affect RNN (Figure~\ref{fig:rnn_nocompile}) the most due to high
startup cost, and many small kernels compiled.
\begin{figure*}
\centering \subfloat[][BlackScholes]{
\includegraphics[scale=0.7]{figs/blackscholes_nocompile.png}
\label{fig:blackscholes_nocompile}
}
\subfloat[][KMeans]{
\includegraphics[scale=0.7]{figs/kmeans_nocompile.png}
\label{fig:kmeans_nocompile}
}
\\
\subfloat[][Jacobian Stencil]{
\includegraphics[scale=0.7]{figs/jacobi_nocompile.png}
\label{fig:jacobi_nocompile}
}
\subfloat[][RNN]{
\includegraphics[scale=0.7]{figs/rnn_nocompile.png}
\label{fig:rnn_nocompile}
}
\caption{Performance comparison against Numpy on multicore CPU and
NVIDIA GPU without JIT overhead}
\label{fig:perfbase-nocompile}
\end{figure*}
\section{Future Work}
\label{sec:future}
In this paper we have discussed Grumpy, a drop-in replacement for
Numpy that can automatically build a representation of operations
specified in a Numpy application. This representation is then used to
fuse operations and execute them either on multicore CPUs or GPUs. For
operations where a hand-tuned implementation is available these are
used automatically. While the performance evaluation shown in
Section~\ref{sec:results} show considerable promise, there are several
bottlenecks that need to be addressed.
The main bottleneck is the cost of JIT compilation. Strategies that
hide this cost need to be incorporated into Grumpy. One way to do this
is through pipelining. The entire computation is not executed as a
single fused function in Grumpy, but rather a sequence of
functions. It is possible to overlap the compilation with the
execution of these functions.
The generated code could also be made more efficient. The Grumpy
generated code doesn't employ machine specific optimization like use of
vector instructions on CPUs or shared memory on GPUs. On CPUs, Grumpy
doesn't make use of efficient BLAS libraries either
\section{Introduction}
\label{sec:introduction}
Numpy~\cite{numpy} has long been the default module for developing
applications in Python that rely on array-based data structures. Image
processing, deep learning, bio-informatics are just a few domains
where Python and Numpy are used to either develop prototypes or
applications that are deployed for public use. The main reason for
this is that Numpy provides efficient implementation for operations
involving arrays. At the same time, Numpy has several
limitations. Firstly, efficient implementations are provided for CPU
execution, i.e., there is no off the shelf method to execute the Numpy
operation on the GPU. A majority of the operations provided by Numpy,
like \texttt{numpy.add} or \texttt{numpy.subtract} are embarrassingly
parallel, i.e., The same computation is executed independently on each
element of the array. Such a computation pattern matches well with the
GPU execution model which requires the use of lots of parallel threads
with minimal communication for efficient execution. For more complex
operations like \texttt{np.dot}, which implements matrix-matrix and
matrix-vector multiplications, existing libraries provide efficient
implementation on GPUs. For example, cuBLAS~\cite{cublas} provides
efficient GEMM implementation for NVIDIA GPUs. Yet, there is no
mechanism in Numpy to leverage these libraries.
\begin{figure}
\lstinputlisting[caption={Numpy implementation of simple arithmetic
ops}, label={lst:example}]{src/example.py}
\vspace{-2em}
\end{figure}
A second limitation comes from the fact that Numpy is a library. Each
operation provided by Numpy is implemented through a dedicated
function. For example, consider the snippet shown in
Listing~\ref{lst:example}. The four multiplications and two additions
are done eagerly with intermediate result (which in itself is an
array), stored in memory. These are read again during its subsequent
uses. Since the actual computation is simple, the entire execution is
bandwidth bound. As the arrays get larger, streaming the array from
memory multiple times results in poor performance. The overhead of
memory allocation and deallocation of temporary arrays further worsens
the situation.
In this paper, we propose a framework called Grumpy, that employs an
alternative approach that addresses both of these issues. Instead of
performing each operation eagerly, we build a representation of the
operations seen so far. This is done by providing a python module
called \texttt{grumpy} that can be used instead of numpy. It provides
the same operations as \texttt{numpy} and can be used as a drop-in
replacement for it. When the result of the operation is needed (due to
the \texttt{print} operation, for example), we use a JIT compiler to
generate code for all the operations seen so far and execute it as a
single function.
This approach has the following advantages
\begin{itemize}
\item There is no need to explicitly store the intermediate results in
memory. For example, for Listing~\ref{lst:example}, the generated
function directly computes the value of \texttt{z} without storing
the values of all the intermediate arrays in memory.
\item Since the JIT compiler can see more of the computation than
individual operations, traditional compiler optimizations can now be
applied to generate a more efficient function.
\item The JIT compiler can generate native code to target multiple
architectures. By using the embarrassingly parallel nature of the
array operations in numpy, we can automatically generate code and
run the computation either on GPUs (specifically NVIDIA GPUs) or on
multi-core CPUs.
\end{itemize}
In general, it is not always efficient to do all evaluation lazily, or
to generated code for all operations using a JIT compiler. For
example, consider the snippet in Listing~\ref{lst:mnist} which
representative of MNIST computation from Deep Learning domain. It
contains operations such as transpose and matrix-vector
multiplies. Instead of generating code using a JIT compiler, it is
more efficient to use tuned implementations provided by libraries such
as LAPACK~\cite{lapack} or cuBLAS~\cite{cublas}. To account for this
Grumpy recognizes computations that are better offloaded to efficient
library implementation, while generating optimized fused kernels for
the rest of the computation.
\begin{figure}
\lstinputlisting[caption={Simple MNIST in Numpy},
label={lst:mnist}]{src/mnist.py}
\vspace{-2em}
\end{figure}
The rest of the paper is organized as follows. Section~\ref{sec:fusion}
describes the internal representation used to describe the
computation, and how this is used to offload parts of the computation
to a library while the rest of the computation is JIT
compiled. Section~\ref{sec:codegen} describes the code-generation
process within the JIT compiler. Section~\ref{sec:results}
evaluates the performance improvements from using this approach on a
few benchmarks. Section~\ref{sec:related} describes other frameworks
that have similar goals and describes the advantages/disadvantages of
the Grumpy compared with these frameworks.
\section{Fusion of operations in the DAG}
\label{sec:fusion}
To move from an eager evaluation approach to a lazy evaluation
approach we need a representation of the computation seen so far. A
Directed Acyclic Graph, $G = (V, E)$ is a natural abstraction to
represent the sequence of operations to be evaluated, and the data
dependencies between them. A node $n \in V$ represent the result of an
operation, which is in general an $n$-dimensional tensor. An edge $e
\in E$ represents the use of the tensor produced by the source node in
the target node. The leaves of the graph represent inputs to the
computation. The root is the result of the computation. It is not
required to store the intermediates in memory, but it is required to
produce the output in memory. Similar to numpy, the size of the tensor
represented by each node, and the data type of the tensor elements are
computed automatically while the DAG is built based on the semantics
of each operation. Figure~\ref{fig:example} shows the DAG that
represents the computation in
Listing~\ref{lst:example}. \texttt{output} is the result of the
computation and is therefore the root. \texttt{W}, \texttt{a} and
\texttt{b} are inputs to the computation and are the leaves of the
DAG.
\begin{figure}
\centering
\includegraphics[scale=0.4]{src/example.pdf}
\caption{DAG representation of the computation in Listing~\ref{lst:example}}
\label{fig:example}
\vspace{-1em}
\end{figure}
The nodes in the graph can be used to represent any mathematical
operation ranging from addition, subtraction of arrays to more complex
operations like,
\begin{itemize}
\item BLAS computations such as matrix-vector multiply or
matrix-matrix multiply
\item Reduction and scan along multiple (or all) dimension of the
array.
\item Reads and writes of portion of array through slicing operations.
\item Index and layout transformation operations like reshape and
multi-dimensional transpose operations.
\end{itemize}
to name a few. The semantics of all operations match the semantics of
the corresponding numpy operations, including aspects like
broadcast~\cite{broadcast} for pointwise operations. Note that we do not
need to account for branching constructs like \emph{if-then-else} or
loops. Since Python is an interpreted language, only the operations
executed are seen by the Grumpy module, and needs to be represented in
the DAG.
Each node in the graph has three attributes
\begin{itemize}
\item \emph{operation}: Represents the operations being represented by
the node
\item \emph{data}: Contains the values in the $n$-dimensional tensor
that would be generated after the operation represented by this node
is executed.
\item \emph{is\_materialized} : A boolean attribute that signifies if
the \emph{data} has been computed and stored in memory or not.
\end{itemize}
At the start of the computation, only the inputs nodes have the
\emph{data} field non-empty and represents the values in the arrays
that are inputs to the computation. The \emph{is\_materialized} field
is also \texttt{true} only for the inputs. As more operations are
encountered, the DAG is built to capture the semantics of the
operations specified for lazy evaluation. The \emph{is\_materialized}
field is set to \texttt{false} for these nodes and the \emph{data}
field is empty. If the result of a particular node is needed (through
a print or other similar operations), the DAG is traversed backwards
to find all the operations needed to evaluate the result. On
encountering a materialized node (one with the \emph{is\_materialized}
field set to \texttt{true}), none of its predecessors are visited as
part of the traversal. At the end of the traversal, all visited nodes
form a subgraph, which itself is a DAG where the leaves, and only the
leaves, are materialized. This subDAG is passed to the JIT compiler
that compiles the graph into a single fused function, which accepts
the input arrays as arguments, and the generates the array containing
the result of the operation at the
root.. Listing~\ref{lst:example-code} is representative of the code
generated for the subDAG rooted at \texttt{z} with leaves \texttt{x}
and \texttt{y} in Figure~\ref{fig:example}. Note that the generated
code correctly implements the broadcast semantics of multiplying
arrays \texttt{x} and \texttt{y}. Details of code-generation are
presented in Section~\ref{sec:codegen}.
\begin{figure}
\lstinputlisting[language=c, caption={Representative function that
fuses the computation in Listing~\ref{lst:example}},
label={lst:example-code}, rangeprefix={\/\/\ \{\ },
rangesuffix={\ \}},
linerange=targetcodegenstart-targetcodegenend]{src/example.c}
\vspace{-2em}
\end{figure}
The JIT compiler in Grumpy compiles this code to execute on a
multi-core CPU or NVIDIA GPU. On execution, the result of the output
is stored in memory. The attribute \emph{data} of this node is
associated with these result array stored in memory, and the node is
set as been materialized. Since Python is an interpreted language, at
this point it is not known how the values computed for this node will
be used. Marking the node as materialized ensures that other nodes
which depend on this node will use the value computed in memory,
instead of recomputing these values.
As mentioned in Section~\ref{sec:introduction}, for some computations
(like the matrix-vector multiply in Listing~\ref{lst:mnist}) it is
better to fall back to more efficient library implementation than to
have the JIT compiler generate code for such operations. To enable
this, when such an operation is encountered, all the operands to this
operation are materialized. This is done since all the operands would
have been computed and stored in memory, for use within the library
function invoked to compute the result of the operation. On return
from the library call, the node corresponding to the operation is
marked as materialized so that all uses of this node will use the
values generated from the library call.
\begin{figure}
\centering
\includegraphics[scale=0.4]{src/mnist.pdf}
\caption{DAG representation of MNIST computation in Listing~\ref{lst:mnist}}
\label{fig:mnist}
\vspace{-1em}
\end{figure}
To illustrate the above mechanism, consider the DAG for the MNIST
example from Listing~\ref{lst:mnist} shown in
Figure~\ref{fig:mnist}. The operation for node \texttt{matvec} is
better handled by cuBLAS for GPU execution, by invoking the relevant
\emph{gemv} API calls. Before invoking the function, the values of the
matrix and the vector (which are the operands to matvec) need to be
materialized. The value of \texttt{max} is computed by generating a
function to implement the max function, JIT-compiling it and executing
it. cuBLAS also provides a version of \emph{gemv} computation where
the input matrix is stored as transpose. This is recognized by Grumpy,
and it proceeds to materialize the operand of the transpose. Since
this is the array \texttt{W} that is already materialized, there is
nothing to do here. On return from the cuBLAS function, the
\texttt{matvec} node is marked as materialized. The rest of the
operations to compute the \texttt{output} can be fused into a single
function with \texttt{matvec} and \texttt{b} being inputs to the
function.
\input{algorithm/materialize}
The algorithm used to split an input DAG into a list of sub-graphs,
each of which is to be either JIT compiled and executed or handed off
to a library is shown in Algorithm~\ref{algo:create_subgraph}. The
sub-graphs are to be executed in the order specified by this list. It
uses two helper functions to create the sub-graphs,
\texttt{materialize\_node} and \texttt{materialize\_pred\_of\_node}.
\texttt{materialize\_node} is a function that checks if a node has to
be materialized based on the properties of the operation. Some of the
cases where this function returns \texttt{true} are listed below.
\begin{itemize}
\item When the operation is better handled through use of libraries,
like cuBLAS.
\item When the operation is not embarrassingly parallel, like
reductions or scans (along one or many dimensions of the
array). These operations require inter-thread communication. When
executed in parallel, fusing these operations with their successors
one would either need a explicit synchronization between threads or
these computations have to be executed redundantly in all the
threads. Not all hardware have effective mechanism to do the former
(for example on NVIDIA GPUs it is not always possible to synchronize
threads across all thread blocks) and the latter is not efficient.
\end{itemize}
\texttt{materialize\_pred\_of\_node} is a function that returns
\texttt{true} if a predecessors of a node has to be materialized. This
function returns \texttt{true} for cases where the node represents an
operation that is to be executed by a library. Since the operands of
the library have to be computed and stored in memory before the
library call, this step is required. Note that sometimes it is better
to not materialize the immediate predecessor. For example, for an
matrix-matrix multiply or a matrix-vector multiply, if the predecessor
is a transpose, cuBLAS provides methods that allow the input to be
transposed before the computation is performed. In this case it is
better to materialize the predecessor of the transpose. This detail is
omitted from the Algorithm~\ref{algo:create_subgraph} for sake of
clarity.
Another aspect of algorithm to note is in
lines~\ref{algoline:multipleUse}. If a node encountered has been
visited during the subgraph creation, but does not belong to the
current subgraph, then it is a node that belongs to a subgraph that
was created earlier. One way to handle this is to include all the
nodes in the sub-DAG rooted at this node into the current
subgraph. This would mean the computation represent by this sub-DAG is
replicated in all subgraphs that use the result of this node. An
alternative approach is to materialize this node so that it becomes a
leaf to all subgraphs that use this node. This is the approach used in
Grumpy.
To control JIT compilation overhead, when the size of the subDAG
rooted as each node reaches a threshold it is JIT compiled. The
heuristics used here are outside the scope of this paper.
\section{Numpy Interoperation}
\label{sec:numpy}
\section{Related Work}
\label{sec:related}
Previous works have targeted a similar
approach. Bohrium~\cite{bohrium} offers similar support for
accelerating Numpy frameworks on CPU and GPUs. It effectively supports
lazy evaluation by use of a \emph{GPU Vector Engine} that aggregates
operations into a single CUDA kernel. This effectively implements lazy
evaluation, but does not seem to have a DAG IR that can allow further
optimizations like CSE at the level of array expressions. While such
operations are not currently implemented in Grumpy, having an explicit
DAG IR opens the possibility to do more complex optimization on array
expressions.
ArrayFire~\cite{arrayfire} provides a similar interface to array
computing as Numpy and targets multiple architectures as well. Since
it doesn't support Numpy directly, any Numpy application would have to
be manually ported to this framework. CuPy~\cite{cupy} is listed as a
drop-in replacement of Numpy, but fusion is only possible through user
defined functions through special API. Theano~\cite{theano} with
PyCUDA provides a similar interface. Unlike these frameworks, Grumpy
and Bohrium are true drop-in replacement for Numpy that automatically
generate fused kernels for element-wise operations.
There have also been previous work that support a similar execution
model specifically for Deep Learning applications. XLA~\cite{xla} is
a compiler framework within Tensorflow that intercepts operations in
Tensorflow to build a graph representation of the operation sequence
and JIT compiles them. These meta operations are then inserted back
into the TensorFlow graph for execution. While it addresses many of
the similar concerns, the focus of this work has mainly been
Deep-Learning applications. NNVM~\cite{nnvm} is a compiler framework
similar to XLA for MxNET. PyTorch~\cite{pytorch} has recently added a
JIT compilation support as well. Being specific to deep-learning the
space of computations supported by these are not as general as
application written in Numpy.
| {'timestamp': '2019-01-15T02:03:22', 'yymm': '1901', 'arxiv_id': '1901.03771', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03771'} | arxiv |
\section{Additional Figures}
We include some additional figures to illustrate our findings from above. Figures~\ref{fig:passage-highlight-overlap} and \ref{fig:passage-highlight-2-overlap} shows the agreement between turkers' annotations and the suggested words. The two figures correspond to the Passage Highlight and Passage Highlighting with Suggested words settings respectively. In addition, we plot the histogram of QA text similarity under each quality level in Figure~\ref{fig:quality-vs-similarity}.
\begin{figure}[ht]
\centering
\begin{minipage}{0.231\textwidth}
\centering
\includegraphics[width=1\linewidth]{img/passage_highlight_overlap.pdf}
\caption{Suggestion overlap for the second setting}
\label{fig:passage-highlight-overlap}
\end{minipage}
\hspace{0.1cm}
\begin{minipage}{0.231\textwidth}
\centering
\includegraphics[width=1\linewidth]{img/passage_highlight_2_overlap.pdf}
\caption{Suggestion overlap for the third setting}
\label{fig:passage-highlight-2-overlap}
\end{minipage}
\end{figure}
\begin{figure}[ht]
\centering
\includegraphics[width=1\linewidth]{img/quality_vs_similarity_new.pdf}
\caption{QA text similarity under each quality level}
\label{fig:quality-vs-similarity}
\end{figure}
\end{document}
\section{Introduction}
\label{sec:intro}
Classic information retrieval (IR) systems aim to return a list of relevant documents on a search engine result page (SERP). This type of presentation is often described as ``ten blue links'', because users typically need to click on the ranked results and be redirected to the documents. Modern search engines have paid attention to search results diversification~\cite{Agrawal2009Diverse, Santos2015Diverse} and heterogeneous content presentation~\cite{Wang2016BeyondRanking}. Recently, several works have focused on retrieving extractive answers instead of documents~\cite{Yih2013FactoidQA, Yu2014FactoidQA, Keikha2014NonFactoidQA, Park2015NonFactoidQA,Yang2016NonFactoidQA}. Industrial examples include Google's \textit{featured snippets},\footnote{https://support.google.com/webmasters/answer/6229325} which display a potential answer extracted from the top search result.
If search engines can return a list of potential answers rather than documents, it is essential to study the most effective way to present these answers and interact with users. Specifically, this research question should be emphasized in non-factoid question answering (QA) systems. This is because non-factoid QA poses unique challenges to answer presentation and interaction as it requires several answer sentences or passages, instead of simple entity-based answers as in factoid QA.
User interaction with SERPs has been widely studied using search logs that contain clicks and query reformulations~\cite{Agichtein2006QueryLog, Silverstein1999QueryLog}. Furthermore, other works focus on interaction and feedback methods for document retrieval by studying real users instead of search logs~\cite{Kelly2001Interaction, Koenemann1996Interaction}. However, fine-grained presentation and interaction processes with answers have rarely been investigated in previous work. Additional information is needed from observing what constitutes a good answer when users provide fine-grained and precise feedback, instead of simply indicating whether the answer is relevant or not. We believe that studying fine-grained user interaction and feedback can lead to more effective answer finding, as well as having an impact on the design of conversational search systems.
In this work, we investigate three answer presentation and interaction approaches (Line by Line, Passage Highlight, and Passage Highlighting with Suggested Words) to understand how people perceive good and bad answers. The Line by Line setting reveals a potential answer passage one line at a time and observes people's reactions as they go through the passage. The Passage Highlight setting presents the full passage, and instructs users to highlight important words that make them believe the passage is a good or bad answer. The third setting is built upon the second one, and includes some suggested words emphasized with special styles. We hired crowdsourcing workers from Amazon Mechanical Turk (MTurk)\footnote{\url{https://www.mturk.com/}} to conduct the experiments. Based on these fine-grained experiments, we find that people perceive good answers and bad answers very differently, which could lead to more effective relevance feedback schemes. For example, people do not hesitate to rate a bad answer, but they can be severe on the answer quality judgments even in some cases where the passage is the answer. Another finding is that people's initial impressions of answer quality are usually correct, and they become more and more confident about answer quality as they go through the answer. In addition, we investigate the relation between answer quality and QA text similarity and find that they are not always correlated.
Our contributions can be summarized as follows. (1) We conduct one of the first fine-grained analyses on answer presentation and interaction in a non-factoid QA setting. (2) We provide an empirical analysis to answer an important research question: is answer quality related to QA text similarity? Our findings can be used to design a more interactive IR system that emphasizes answer retrieval. In addition, our work also has implications for conversational search, since it is essentially a multi-turn interaction process.
\section{Related Work}
\label{sec:relatedwork}
\textbf{User Interaction and Relevance Feedback}. Relevance feedback~\cite{Lv2009RF, Diaz2008RF, Zhai2001RF, Brondwine2016RF, Kelly2001Interaction} is an important and early interactive method in IR systems. In practice, pseudo-relevance feedback (PRF)~\cite{Lv2010PRF, Lavrenko2001PRF, Collins-Thompson2007PRF} is widely used. It assumes that top-ranked documents are relevant and thus can be used for query expansion. In contrast to PRF, some approaches focus on explicit interactions with the user~\cite{Oddy1977Information, Croft1987Feedback, Aalbersberg1992Feedback, Koenemann1996Interaction}.
This work builds on these early papers and focuses on explicit and fine-grained user interaction with answers. Our methods could be especially useful when the interaction bandwidth is limited, such as in mobile search and conversational search.
\textbf{Answer Retrieval}. IR systems are evolving from document retrieval to answer retrieval. Substantial work has been done in factoid QA~\cite{Severyn2015FactoidQA, Yu2014FactoidQA, Yih2013FactoidQA, Yang2016FactoidQA, Iyyer2014FactoidQA}, community QA~\cite{Xue2008CQA, Yang2013CQA, Jansen2014CQA, Surdeanu2008CQA, Surdeanu2008CQA, Surdeanu2011CQA}, and non-factoid QA~\cite{Park2015NonFactoidQA, Cohen2016NonFactoidQA, Keikha2014NonFactoidQA,Yang2016NonFactoidQA}. All these works focus on finding effective methods for answer retrieval. However, even the most effective method can occasionally fail to find the answers. In that case, it is essential to employ user interaction and feedback methods to retrieve the answer in an iterative manner. In this work, we study answer presentation and interaction techniques in a non-factoid QA setting, as an essential complement to answer retrieval models.
\textbf{Information-seeking Conversations}. An information-seeking conversation typically involves multiple turns of interaction and information exchange between an information seeker and provider. Radlinski and Craswell~\cite{Radlinski2017ConvSearch} described a theoretical framework for conversational search and desirable properties in such systems. In addition, several works~\cite{Trippas2018ConvSearch, thomas2017MISC, Qu2018AnalyzingAC, Wu2003InfoSeeking, Wu2003InfoSeeking2} observed and studied information-seeking conversations between humans and addressed different facets of such interactions. Finally, conversational recommendation~\cite{Zhang2018Rec} and response ranking~\cite{Yang2018RespRank} have been explored under this multi-turn interaction setting.
\section{Our Approach}
\label{sec:approach}
\subsection{Overview}
\label{subsec:overview}
We conduct an observational study of how people perceive answer quality under different interactive settings. This can help us identify effective methods for answer presentation and interaction. In this task, people are given a question and a short passage. The passage may or may not be a good answer to the question.\footnote{``Good'' refers to good quality. Verifying the facts in the passages is not required.} We present the answer passage in three ways, namely, Line by Line, Passage Highlight, and Passage Highlighting with Suggested Words. These settings are designed to obtain fine-grained user feedback to test various answer presentation and interaction methods.
\subsection{Line by Line}
\label{subsec:line-by-line}
In this setting, the answer passage is presented line by line. One line is typically one sentence. At each line, we instruct the annotators to give a rating of how confident they are that the passage is or contains a good answer to the question. This rating is based on the current line and previous lines. Lines that follow the current line are hidden. The confidence rating is provided on a scale of -2 to 2:
\begin{itemize}[leftmargin=*, noitemsep, topsep=0pt]
\item -2: Confident this passage is not an answer to the question.
\item -1: Believe that this passage might not be an answer.
\item 0: Not sure yet.
\item 1: Believe that the passage might be an answer to the question.
\item 2: Confident this passage is an answer to the question.
\end{itemize}
This setting is designed to observe the evaluation of answer quality as people go through a potential answer.
\subsection{Passage Highlight}
\label{subsec:passage-highlight}
In this setting, we present the full answer passages and instruct the annotators to highlight positive and negative words or phrases in the passage (sentences are not encouraged). The \textit{positive words} are those that help to convince the annotators that the passage is a good answer. For example, these words may present a specific answer or introduce key arguments. In contrast, the \textit{negative words} make the annotators feel the answer is of bad quality. For example, these words can be indicators of irrelevant issues, or may reveal that the answer providers are uncertain about their answers. Annotators are instructed to highlight complete words only. At least one highlight for each passage needs to be made for a successful submission. Figure~\ref{fig:interface-example} gives an illustration for the highlighting interface.\footnote{The words in blue are marked for the next setting. They are in black in this setting.} In addition, annotators are asked to give a rating on overall answer quality. The answer quality can be chosen on a scale of 0 to 2:
\begin{itemize}[leftmargin=*, noitemsep, topsep=0pt]
\item 0: It is not an answer to the question.
\item 1: It is an answer to the question, but not of good quality.
\item 2: It is a good answer to the question.
\end{itemize}
This setting is designed to obtain fine-grained feedback on answer quality evaluation and observe rating agreement.
The main challenge of this setting is to quantify annotators' agreement on highlights. Although the annotators are instructed to highlight whole words only, they sometimes highlight partial words. So first, the character-level highlights need to be transformed into word-level highlights. Then a \textit{consistency rule} is applied to highlight all occurrences of a word if this word is highlighted by the annotator. This rule is not applicable to stop words. Then the next step is transforming the highlighted passage into a string by denoting the highlighted words as ``1'' with others as ``0''. In this way the agreement of highlights can be cast into a string similarity problem. The overlap coefficient~\cite{overlap_coef} is used to tackle this problem:
\begin{equation}\label{eqn:overlap-coef}
\footnotesize
\begin{aligned}
\text{overlap}(H_1, H_2) = \frac{|H_1 \cap H_2|}{\text{min}(|H_1|, |H_2|)}
\end{aligned}
\end{equation}
where $H_1$ and $H_2$ are string representations of highlights from two annotators. This method can compute agreement among multiple annotators. However, since complete agreement with more than two annotators is rare due to the open style of the task, only pairwise agreement is computed.
The largest value among all pairwise agreements is considered as the agreement for this QA pair. We adopt this setting because perceptions and highlights of answer key words are highly subjective.
\subsection{Passage Highlighting with Suggested Words}
This setting is very similar to the previous setting. The only difference is that we mark some suggested words in the passage for the annotators' reference. These suggested words are marked in bold font and blue color to draw user attention. Figure~\ref{fig:interface-example} gives an example of the highlighting interface. The suggested words meet one of the following criteria: (1) Words that start with a capital letter, such as acronyms or proper nouns. Words that start a sentence have been excluded. (2) Words that have the top five tf-idf value in this passage. Idf values are computed with a Wikipedia dump (date: 20180520). The annotators understand that they do not have to keep to the suggested words. This setting is designed to compare reactions with and without the suggested words.
\section{Experiments}
\label{sec:experiments}
\subsection{Data Preparation}
\label{subsec:data}
We sampled 200 QA pairs from nfL6,\footnote{https://ciir.cs.umass.edu/downloads/nfL6/} a non-factoid community QA dataset.
A question typically comes with multiple answers provided by the community, with one of them selected as the accepted answer. Our sampled data contains 100 questions, and each question has a good answer and a bad answer. The good answers are the accepted answers of the questions. To match a bad answer to each question, we first use BM25 to collect a small pool of candidate answers for each question and then use a BLSTM model~\cite{Cohen2016NonFactoidQA} to rerank.
We set a criterion that all the answers can be naturally split into four sentences so that the answers would have appropriate lengths, and to work with a fixed number of lines in the Line by Line setting.
\subsection{MTurk Setup}
\label{subsec:mturk-setup}
We employed crowdsourcing workers (turkers) through Amazon Mechanical Turk (MTurk) to annotate the QA pairs. The three settings are conducted separately. Each QA pair receives annotations from three different turkers. Turkers conduct annotation in the form of assignments, which contain instructions, annotation examples, quiz questions on the instructions, and five QA pairs to annotate (with a combination of good and bad answers).
We only use annotations from turkers who have passed the quiz test in the analysis. In addition, the turkers are required to have a HIT (Human Intelligence Task) approval rate of 95\% or higher, a minimum of 1,000 approved HITs, and be located in US, Canada,
Australia or Great Britain. The turkers are paid \$0.5/assignment.
\subsection{Line by Line}
\label{subsec:line-by-line-exp}
Figure~\ref{fig:line-by-line-ratings-good} presents the distribution of confidence ratings from line 1 to line 4 for good answers. The most common confidence rating for line 1 and line 2 is 1.
The most common rating gradually shifts to 2 at line 3 and line 4.
The distribution of ratings consistently moves up to 2 from line 1 to line 4.
Figure~\ref{fig:line-by-line-ratings-bad} presents the distribution of confidence ratings from line 1 to line 4 for bad answers. The most common confidence rating is always -2 through line 1 to line 4.
The number of -2 ratings gradually increases as the passage is revealed to the turkers.
These indicate that, \textit{for good answers, the turkers have a sense that the answers might be good at the beginning, but they hesitate to make confident ratings until the latter half of the passage is revealed. In contrast, for bad answers, most of the turkers are able to determine the answer quality from the beginning. }
\begin{figure}[ht]
\centering
\begin{subfigure}[b]{0.45\textwidth}
\includegraphics[width=\textwidth]{img/line_by_line_ratings_good.pdf}
\vspace{-0.7cm}
\caption{Good}
\label{fig:line-by-line-ratings-good}
\end{subfigure}
\begin{subfigure}[b]{0.45\textwidth}
\includegraphics[width=\textwidth]{img/line_by_line_ratings_bad.pdf}
\vspace{-0.7cm}
\caption{Bad}
\label{fig:line-by-line-ratings-bad}
\end{subfigure}
\vspace{-0.5cm}
\caption{Distribution of confidence ratings from line 1 to 4}
\label{fig:dist-confidence-ratings}
\end{figure}
We also use a $\chi^2$ test to evaluate the difference of confidence ratings between the previous line (expectation) and the current line (observation). We observe the same patterns for good answers and bad answers: the shifts of confidence ratings from line 1 $\rightarrow$ 2 and line 2 $\rightarrow$ 3 are statistically significant with p-value \textless 0.01, while line 3 $\rightarrow$ 4 shows an insignificant difference. This indicates that \textit{some people can determine answer quality quickly while others are slower, but they can make a decision before the last line is revealed}.
Figure~\ref{fig:line-by-line-overall-majority} presents the majority of confidence ratings for all questions. The rating leaps from 1 to 2 between line 2 and line 3 for good answers. The rating remains at -2 throughout the passage for bad answers. This result double confirms the conclusions above.
In addition to the overall analysis presented above, we also focus on the level of individual QA pairs. Since each QA pair is annotated by three different turkers, we take the majority vote of the ratings at each line as the final rating. We plot the rating trends of individual QA pairs for a better illustration in Figure~\ref{fig:line-by-line-common-trends}. We only plot the most commonly observed trends with more than two occurrences (in blue or red) to reduce noise. For example, if four QA pairs have the same trend of ``$0 \rightarrow 1 \rightarrow 2 \rightarrow 2$'', we consider the occurrence of this trend as four. These common trends constitute about half of total trends. We also plot the remaining trends in gray to show that infrequent trends can be very diverse. The line widths are set to the square root of the trend occurrences to demonstrate trend frequency, while avoiding lines being too wide.
\begin{figure}[ht]
\centering
\begin{minipage}{0.238\textwidth}
\centering
\includegraphics[width=0.98\linewidth]{img/line_by_line_overall_majority.pdf}
\vspace{-0.5cm}
\caption{Overall confidence}
\label{fig:line-by-line-overall-majority}
\end{minipage}%
\begin{minipage}{0.238\textwidth}
\centering
\includegraphics[width=0.98\linewidth]{img/line_by_line_common_trends.pdf}
\vspace{-0.5cm}
\caption{Common trends}
\label{fig:line-by-line-common-trends}
\end{minipage}
\end{figure}
As presented in the figure above, the common answer quality ratings start at (0, 1, 2) and converge to 2 for good answers. For bad answers, common ratings start at (0, -1, -2) and converge to -2. In addition, a large portion of good answers have consistent ratings of 2 at all lines. Similarly, a very common trend for bad answers is -2 at all lines. These observations indicate that \textit{initial impressions of answer quality are usually correct, because good answers have positive ratings and bad answers have negative ratings from the very beginning. In addition, people become more and more confident about answer quality as they go through the answer}.
\subsection{Passage Highlight}
\label{subsec:passage-highlight-res}
Turkers are instructed to rate the answer quality after highlighting the passage. Figure~\ref{fig:passage-highlight-ratings} presents the histogram of rated answer quality.
We observe that turkers typically rate 1 or 2 for good answers and 0 for bad answers.
This indicates that \textit{turkers do not hesitate to rate a bad answer, but they can be severe on the answer quality judgments even in some cases where the passage is the answer}.
\begin{figure}[ht]
\centering
\begin{minipage}{0.225\textwidth}
\centering
\includegraphics[width=1\linewidth]{img/passage_highlight_ratings.pdf}
\vspace{-0.85cm}
\caption{Confidence ratings for the second setting}
\label{fig:passage-highlight-ratings}
\end{minipage}%
\hspace{0.2cm}
\begin{minipage}{0.225\textwidth}
\centering
\includegraphics[width=1\linewidth]{img/interface_example.pdf}
\vspace{-0.6cm}
\caption{An illustration of the highlighting interface }
\label{fig:interface-example}
\end{minipage}
\end{figure}
On average, turkers highlight 7.57 words in good answers and 6.35 words in bad answers. In addition, the consistency rule adds about 0.5 words in both cases. Figure~\ref{fig:passage-highlight-agreement} presents the agreement of highlights in four different cases: positive highlight on good answers, positive highlight on bad answers, negative highlight on good answers, and negative highlight on bad answers.
\begin{figure}[ht]
\centering
\begin{minipage}{0.233\textwidth}
\centering
\includegraphics[width=1\linewidth]{img/passage_highlight_agreement.pdf}
\vspace{-0.85cm}
\caption{Agreement for the second setting}
\label{fig:passage-highlight-agreement}
\end{minipage}%
\hspace{0.1cm}
\begin{minipage}{0.233\textwidth}
\centering
\includegraphics[width=1\linewidth]{img/passage_highlight_2_agreement.pdf}
\vspace{-0.85cm}
\caption{Agreement for the third setting}
\label{fig:passage-highlight-2-agreement}
\end{minipage}
\end{figure}
We notice the low agreement in Figures ``Good\_Neg'' and ``Bad\_Pos''. This can be accounted for by the fact that turkers rarely use negative highlights for good answers or positive highlights for bad answers. When one or both turkers in an agreement pair do not use a certain type of highlight (positive or negative), the agreement is 0 (turkers need to make at least one highlight, but they do not have to use both types of highlights). Therefore, we focus on positive highlights on good answers and negative highlights on bad answers. In the former case, more than half of the QA pairs achieve complete agreement, which means one turker's annotation is either exactly the same with or a subset of the other's. In the latter case, the agreement is fuzzy but it shows a total agreement in about 30\% of the QA pairs. The results indicate that \textit{people tend to get good agreement on what makes a good answer good. In contrast, when deciding what makes a bad answer bad, people tend to have more diverse opinions while still managing to achieve some agreement}.
\subsection{Passage Highlighting with Suggested Words}
\label{subsec:passage-highlight-2}
In this setting, the distributions of answer quality ratings are very similar to the last setting, where the suggested words are unmarked.
We mark an average of 9.48 suggested words in special styles. The average number of highlighted words by turkers is 6.98 for good answers and 6.06 for bad answers, slightly smaller than the last setting.
Overall, the agreement for the last setting (Figure~\ref{fig:passage-highlight-agreement}) is more polarized while the agreement for this setting (Figure~\ref{fig:passage-highlight-2-agreement}) has some distribution weight in the middle. These results indicate that some turkers may consider it unnecessary to highlight the marked words even when they believe the words are positive or negative.
One of the goals of this setting is to observe turkers' behavior under the impact of suggested words. This could be done by quantifying the agreement between highlights and suggested words with overlap coefficient. Figure~\ref{fig:passage-highlight-overlap} and \ref{fig:passage-highlight-2-overlap} shows the results for Passage Highlight and Passage Highlighting with Suggested Words settings.
They indicate that \textit{turkers tend to base their decision more on the suggested words when these words are marked in special styles. This suggests that marking important words in answers could influence peoples' decision making process in answer quality evaluation.}
\subsection{Answer Quality vs. QA Text Similarity}
\label{subsec:quality-vs-similarity}
Some QA systems use the text similarity of questions and answers to perform answer retrieval \cite{Cohen2016NonFactoidQA,Yang2016NonFactoidQA}. However, we show that answer quality is not the same as QA text similarity. We take the majority vote of overall ratings for each QA pair as the final answer quality rating. The rating data comes from the third setting (data from the second setting also gives a very similar result). To compute the text similarity between the question and answer in a QA pair, we obtain the tf-idf representations and the aggregated word embedding representations (the sum of the word embeddings in a passage). Then we calculate the cosine similarity for both representations respectively and compute their harmonic mean as the QA similarity measure. We plot the histogram of QA text similarity under each quality level in Figure~\ref{fig:quality-vs-similarity}.
We observe from the figure that the QA text similarity is relatively low in general for non-factoid QA. We further make three observations: (1) Quality level 2 has some high similarity values (such as 0.7 and 0.8), which are rare in quality level 1 and 0. (2) Quality level 0 has more low similarity (such as 0) QA pairs than the other two. (3) All three quality levels have large numbers of medium level similarities.
These results indicate that \textit{QA text similarity does not necessarily capture answer quality. They can be positively correlated when it comes to very similar or very different QA pairs. However, text similarity cannot determine answer quality effectively if the QA pair has medium level similarity.} For example, the QA pair shown in Figure~\ref{fig:interface-example} only has a text similarity of 0.56, but received quality level 2 ratings from all three turkers. We plan to investigate this in more detail in future work.
\section{Conclusions}
\label{sec:conclusion}
In this paper, we studied three different fine-grained answer presentation methods in a non-factoid QA setting.
We also discovered that QA text similarity does not necessarily capture answer quality in this setting. Our findings are based on crowdsourcing and thus need to be generalized with caution. Our findings can be used in designing a more interactive IR system that emphasizes answer retrieval. Future work will include verifying our findings and exploring other answer interaction methods in a conversational setting.
| {'timestamp': '2019-01-16T02:08:31', 'yymm': '1901', 'arxiv_id': '1901.03491', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03491'} | arxiv |
\section{Introduction}\label{sec:intro}
Unpaired cross-domain image-to-image translation is achieving exceptionally convincing results in a variety of domains \cite{zhu2017unpaired}.
\textit{High-fidelity} image translation requires not only credible translations, but also strict preservation of the factors that are common to both domains.
Consider Figure~\ref{fig:teaser}. We wish to translate an image of a face across two domains that mostly differ in texture. It is inappropriate for the translator to additionally change the face's expression. Unfortunately, this failure mode is surprisingly common in standard unsupervised image-to-image models.
Why does this happen? In the standard approach (based on CycleGAN \cite{zhu2017unpaired}), there are two main networks: a forward translator, and a backward translator. There are also two main losses: an adversarial loss, which encourages the translated images to be indistinguishable from ones in their target domain, and a cycle consistency loss, which encourages that forward translation (\ie, A to B) followed by backward translation (\ie, B back to A) yields the original input (\ie, forming a cycle). The problem with this setup is that there is no ``fidelity loss'' on the translation. In other words, the forward translator may generate arbitrary samples in domain B, and as long as the backward translator reconstructs the input, there is no penalty. One can add geometric constraints to the translation \cite{gcgan, mueller2018ganerated}, but these only approximate a loss on fidelity.
We present an approach that directly penalizes unfaithful translations, by ensuring that forward-translation errors are \textit{preserved} during back-translation, as shown in Figure~\ref{fig:teaser} (bottom).
\begin{figure}[t!]
\centering
\includegraphics[width=1.0\linewidth]{figures/cycleloss3.pdf}
\caption{
Top: Two strategies for optimizing the cycle-consistency loss: compensation and correction.
Optimizing the cycle-consistency loss
encourages the forward-translator to find better mappings (i.e., correction), but also encourages the back-translator to compensate for bad mappings (i.e., compensation).
Bottom: real examples of compensation learned by a CycleGAN; cycle-consistency is being met, but the translations are not faithful.
}
\label{fig:cycleloss}
\vspace{-1.5em}
\end{figure}
Our main insight is that cycles are problematic when the two mapping functions are allowed to \textit{cooperate}. By ``cooperate'' we mean that they optimize for each other's outputs.
CycleGAN and its many variants \cite{zhu2017unpaired,huang2018multimodal,lee2018diverse,gonzalez2018image,liu2017unsupervised,almahairi2018augmented} all have a cooperative training setup: in each cycle, the first translator receives a real input, and the second translator receives a fake input (\ie, an attempted translation/disentanglement) which it back-translates, and \textit{both} networks get penalized according to the reconstruction error. This essentially asks the second network to compensate for the first network's errors. This is counter-productive, because if the second network succeeds, then the first network need not improve. Given sufficient optimization time, these cooperative setups find extremely effective ``cheats'', in which subtle signals are encoded into low-fidelity forward translations and subsequently decoded to achieve near-perfect back-translation, thus defeating the reconstruction error \cite{chu2017cyclegan}. This is illustrated in Figure~\ref{fig:cycleloss}.
Our main contribution is in preventing the networks from compensating for each other's errors, via a simple optimization technique: simply train each network \textit{only} when its input data is real. With this technique, neither network learns about the other's behavior, which renders cooperation impossible. Instead, the back-translator simply \textit{preserves} any errors made during forward-translation, and the reconstruction penalty is put entirely on the forward translator.
This forces the networks to learn more faithful mappings to their target domains.
Our ``uncooperative'' training also provides a route to unsupervised factor disentanglement.
Several prior works have modified CycleGANs to perform a disentanglement and subsequent re-entanglement: the first translator disentangles the input into (1) an image in the second domain, and (2) a residual; the second translator entangles these to reconstruct the input \cite{zhu2017toward,huang2018multimodal,almahairi2018augmented}. In practice, however,
an unconstrained ``residual'' path can actually be detrimental to the final results,
since the model may exploit this path to encode the \textit{entire input,} greatly facilitating the the cycle-consistency objective. Prior works have proposed a variety of methods to mitigate this problem, but usually at the cost of severely reducing the representational capacity of the residual (e.g., limiting it to 8 dimensions), and making assumptions about its distribution (e.g., assuming it is standard normal) \cite{almahairi2018augmented,huang2018multimodal,lee2018diverse,liu2017unsupervised}. After applying these constraints, some prior works report that the residual path simply goes \textit{ignored} by the model, unless its usage is facilitated by careful design choices (e.g., using the residual as layer-wise normalization coefficients) \cite{almahairi2018augmented,liu2017unsupervised}. Our optimization technique allows us to disentangle multi-scale high-dimensional residuals, without requiring parameter-sensitive representational constraints.
In experiments with real images, we show that our optimization method delivers an obvious qualitative improvement over the current state-of-the-art, both in terms of semantics-preservation and residual-factor disentanglement. In synthetic data (where the residual is known), we demonstrate that our ``uncooperative'' optimization leads to quantitatively accurate disentanglement, whereas ``cooperative'' optimization does not.
\section{Related Work} \label{sec:related}
\textbf{Image-to-image translation} has recently attracted great attention, partly thanks to the success of generative adversarial networks (GANs)~\cite{goodfellow2014generative,mirza2014conditional, aaron16conditional, kossaifi2017gagan}.
The goal in image-to-image translation is to translate an image in one domain to a corresponding image in the second domain.
Pix2Pix~\cite{isola2017image} trains models for this task using paired data from the two domains (\ie, input-output pairs, exemplifying good translations).
CycleGAN~\cite{zhu2017unpaired} removes the need for paired data by forming a translation ``cycle''---forward translation followed by backward translation---which permits a natural reconstruction objective between the input and the back-translation.
This is important, because in many domains, paired examples do not exist (e.g., a face in the exact same pose/expression in two different physical environments).
CycleGAN often preserves the structural content of the images, but this may simply be a consequence of the convolutional architecture \cite{lenc2015understanding}.
CycleGAN is only capable of learning one-to-one mappings, but several works (not all unsupervised) have proposed variants that are capable of one-to-many mappings, such as Augmented CycleGAN~\cite{almahairi2018augmented}, DRIT~\cite{lee2018diverse}, MUNIT~\cite{huang2018multimodal}, BicycleGAN \cite{zhu2017toward}, and cross-domain disentanglers \cite{gonzalez2018image}. These methods are able to generate diverse image with similar ``content'' (\ie, structural pattern) but different ``style'' (\ie, textural rendering) through disentanglement.
These methods
use strong assumptions or regularizations to avoid undesirable local optima, including shared latent spaces \cite{huang2018multimodal,lee2018diverse,gonzalez2018image}, loss on KL divergence from simple Gaussians \cite{huang2018multimodal,lee2018diverse,zhu2017toward}, or low-dimensional representations \cite{lee2018diverse,almahairi2018augmented,zhu2017toward,gonzalez2018image}. The effectiveness of these methods is therefore highly dependent on parameter selection.
\textbf{Image factor disentanglement} is necessary if we wish to control the latent factors in the generated images.
Hadad \etal~\cite{hadad2018two} assumes the availability of attribute labels in a particular domain, where the goal is to disentangle images into a target domain plus a residual (\ie, ``everything else'').
Many disentanglement works also make strong assumptions on domain
knowledge of the latent space, which includes having data pre-grouped according to individual factors \cite{reed2014learning, kulkarni2015deep}, or having exact knowledge of the structure and function of individual factors (e.g., for faces: identity, pose, shape, texture \cite{shu2017neural, shu2018deforming}).
In this work, we do not have attribute labels, we do not make assumptions on the latent space, and we perform disentanglement using only the unpaired image data.
Similar to our method, InfoGAN \cite{chen2016infogan} and MINE \cite{belghazi2018mine} are completely unsupervised, but the approach in these works is quite different: these methods maximize the mutual information between the inferred latent variables and the observations, while we use discriminators and reconstruction to achieve disentanglement.
\section{Method}\label{sec:model}
There are three key ingredients to our method: (1) adversarial priors, which
encourages the translated images to be indistinguishable from ones in their target domain, (2) cycle-consistency, which encourages the translations to be invertible, and (3) ``uncooperative'' optimization, which ensures the networks do not ``cheat'' toward an undesirable local minimum.
\subsection{Preliminaries}
Let $V$ and $C$ be two image domains, such that the images $v \in V$ have more information than the images $c \in C$. That is, $V$ contains variation in some latent factor that is either constant or absent in $C$. This implies that the mapping $V \mapsto C$ is many-to-one, and the mapping $C \mapsto V$ is one-to-many. As a mnemonic, note that $V$ is \textbf{v}ariable in some aspect where $C$ is \textbf{c}onstant.
Let $R$ be the \textbf{r}esidual information that is in $V$ but not in $C$. Accessing this extra information allows us to form bijective (one-to-one) mappings, $\vcr$ and $\crv$. Note that $R$ is not necessarily an image domain. In our implementation, each $r \in R$ is a collection of deep featuremaps at multiple scales, which allows its actual form to be determined entirely by the data.
Our goal is to learn functions that can map between these domains. We call the first mapping a disentanglement, denoted $D$, since it performs an intricate splitting operation: $D(v) = (c,r)$. We call the second mapping an entanglement, denoted $\E$, since it performs a merging operation: $\E(c,r) = v$.
Figure~\ref{fig:arch} relates the notation to the data and architecture. Note that $D$ and $\E$ are inverses of one another.
Our input is a set of samples $\{c_i\}_{i=1}^N$ from $C$, and samples $\{v_j\}_{j=1}^M$ from $V$. The two datasets are unpaired, and true correspondences might not exist.
\subsection{Adversarial priors}
Our model has two main networks, $D$ and $\E$. We would like to have $D : \vcr$, and $\E : \crv$. To achieve this, we introduce adversarial networks $\A_C$ and $\A_V$, which learn and impose priors on the distributions of our networks' outputs.
The adversarial networks attempt to discriminate between real and fake (\ie, generated) samples of the domains $C$ and $V$. In our notation, we distinguish ``fake'' samples with a prime symbol.
We train our main networks against the adversarial labels with the least-squares loss \cite{mao2017least}:
\eq{ \mathcal{L}_{\text{GAN}} = \left[ \AV(v')-1\right]^2 + \left[\AC(c')-1 \right]^2 .}
In a separate (but concurrent) optimization, we also train the parameters of the adversaries, with the losses
$\mathcal{L}_{\AC} = \left[\AC(c)-1\right]^2 + \left[\AC(c')\right]^2$, and $\mathcal{L}_{\AV} = \left[\AV(v)-1\right]^2 + \left[\AV(v')\right]^2$.
Note that we have no priors on the $r'$ samples generated by $D$, because there is no dataset of ``true'' $r$ samples. Prior works manufactured a prior by assuming that $R$ is a low-dimensional Gaussian distribution (e.g., 8 dimensions, with zero mean and unit variance) \cite{huang2018multimodal,lee2018diverse,gonzalez2018image,liu2017unsupervised}. Here, we avoid this limiting assumption. We are able to do this because of our unique optimization procedure, detailed in Sec~\ref{sec:optim}.
However, we do obtain some constraints on $R$ by enforcing cycle consistency, described next.
\begin{figure*}[t!]
\centering
\includegraphics[width=1.0\linewidth]{figures/cycles_big_small.pdf}
\vspace{-1em}
\caption{Disentanglement-Entanglement architecture. The networks are $\bo{D}$ (disentangler), $\bo{E}$ (entangler), $\bo{A}_C$ (adversary on $C$), and $\bo{A}_V$ (adversary on $V$). Primes indicate tensors that are generated by the model during the forward pass. Each generated tensor is subject to either reconstruction loss or an adversarial loss. $R$ is a multi-scale output of $\bo{D}$; it is concatenated to the featuremaps of $\bo{E}$ at the corresponding scales.
}
\label{fig:arch}
\vspace{-1.5em}
\end{figure*}
\subsection{Cycle consistency}
On each training step, the model runs two ``cycles''. Each cycle generates a reconstruction loss, which constrains the model to perform consistent forward-backward translation. Figure~\ref{fig:arch} illustrates the cycles.
In the first cycle, the disentangler $D$ receives a random $v$ from the dataset, and generates two outputs: $(c', r') = D(v)$. These outputs are passed to the entangler $\E$, which generates $v' = \E(c',r')$. If the disentanglement and re-entanglement are successful, this output should correspond to the original $v$. Therefore, we form the reconstruction objective $\ell_v = \norm{v - v'}_1$, where $\norm{\cdot}_1$ denotes the L1 norm. In summary, this cycle performs $\E(D(v)) = v' \approx v$.
The second cycle is symmetric to the first. The entangler $\E$ receives a random $c$ from the dataset, and an $r$ generated from a random $v$. Note that it is necessary to use generated $r$ samples here, since $R$ is completely determined by the network. We omit the prime on this $r$ since it is treated as an input rather than an output.
From the input $(c,r)$, the entangler generates $v' = \E(c,r)$. We then pass $v'$ to the disentangler, which generates two new outputs $(c', r') = D(v')$. If the entanglement and disentanglement are successful, these outputs should correspond to the original inputs. We therefore form the reconstruction objectives $\ell_c = \norm{c - c'}_1$ and $\ell_r = \norm{r - r'}_1$. In summary, this cycle performs $D(\E(c,r)) = (c',r') \approx (c,r)$.
Collecting the reconstruction objectives, we have
\eq{ \mathcal{L}_\text{recon} = \lambda_v \ell_v + \lambda_c \ell_c + \lambda_r \ell_r.}
Observe that there is no ``fidelity'' objective on the translated tensor of each cycle (\ie, $c'$ in Cycle 1, and $v'$ in Cycle 2); these tensors only have an adversarial loss. In other words, there is nothing in the design to force $c'$ to correspond to $v$, or $v'$ to correspond to $c$, other than the back-translation error. As we will show in experiments, this back-translation requirement is not sufficient, because the networks are able to cooperate on the back-translation: when $\E$ is the back-translator, it can compensate for errors made by $D$, and vice versa.
In practice, many of these ``errors'' are never corrected. Instead, they are adapted and refined, to minimize the adversarial loss while facilitating reconstruction. We call these ``cheats'': undesirable outputs that yield near-zero loss.
At convergence, cheats often take the form of a within-domain transformation: this causes the adversary to not impose a loss (since the output is still in the correct domain), yet allows the second network to (jointly) learn how to undo the transformation.
These cheats are especially visible in experiments with faces, likely because humans are so sensitive to faces \cite{ekman1980face}. Figures~\ref{fig:teaser} and~\ref{fig:translate} show clear examples of this cheating behavior: while the two domains only differ in texture/lighting, the networks learn to additionally (and unpredictably) alter the facial expression.
We observe that this undesirable solution to the reconstruction error requires both $D$ and $\E$ to be complicit in the scheme.
For example, if $D$ transforms its input while translating it, but $\E$ is unaware of the cheat, $\E$ will not undo the transformation while back-translating, yielding a loss.
This leads us to our optimization procedure, which essentially prevents $D$ and $\E$ from cooperating in this way.
\subsection{Uncooperative optimization}\label{sec:optim}
The total loss we wish to minimize is
${
\mathcal{L}_\text{total} = \mathcal{L}_\text{recon} + \mathcal{L}_\text{GAN}.
}$
As long as the forward translations land in the target domains, $\mathcal{L}_\text{GAN}$ is minimized; as long as the backward translations reconstruct the inputs, $\mathcal{L}_\text{recon}$ is minimized.
As explained, there is a local minimum to this loss, in which forward translation includes an undesirable transformation, and back-translation includes an inverse transformation. This ruins the fidelity of the translation.
To reach this bad minimum, each network needs to learn \textit{two} functions: (1) translating ``real'' inputs into outputs in a target domain, and (2) decoding ``fake'' inputs by undoing generated translations. Referring to Figure~\ref{fig:arch}, the disentangler $D$ learns the first task in Cycle 1, and learns the second task in Cycle 2; the entangler $\E$ learns these functions in the opposite order.
To prevent this from happening, we prevent the networks from learning how to decode fake inputs. We do this by \textit{freezing} the networks when they receive fake inputs. When a network is ``frozen'', it is treated as a fixed but differentiable function, so that gradients flow through it, but it does not learn. Referring again to Figure~\ref{fig:arch}, this means training $D$ only in the first cycle, and training $\E$ only in the second cycle (where they respectively receive real inputs).
With this optimization technique, the networks are incapable of learning how to compensate for each other's errors. This means that an erroneous forward translation will always be taken ``at face value'' by the backward translator, and produce an appropriate loss. This is because the backward translator's only experience (in terms of gradient steps) comes from real data.
This method is a type of alternating optimization, in the sense that we keep one set of parameters fixed while optimizing the other set, and alternate. In practice, we alternate on every step. Specifically, we do a forward pass through Cycle 1, freeze $\E$ while we update $D$, and then do a forward pass through Cycle 2, and freeze $D$ while we update $\E$.
Including the independent update required for the adversarial networks, this setup requires three optimizers in total.
\subsection{Implementation details}\label{sec:impl}
\paragraph{Network architecture} Our implementation is based on CycleGAN \cite{zhu2017unpaired}. The translators' architecture originally comes from Johnson \etal \cite{johnson2016perceptual}: two stride-2 convolutions, four residual blocks, and two transposed convolutions.
We implement the disentangler as two separate networks: one for the $C$ stream and one for the $R$ stream; the $R$ stream ends before the transposed convolutions. We found this worked significantly better than using a single network to produce both $C$ and $R$.
The entangler uses the same architecture, except it receives skip connections from the $R$ stream. There are three such connections: the first uses the featuremap produced after the stride-2 convolutions; the second uses the featuremap after two residual blocks, and the third uses the featuremap after the next (and final) two residual blocks. These $R$ featuremaps are simply concatenated with the corresponding featuremaps in $\E$. The intent with multiple skip connections is to allow the network the capacity to transfer residuals at multiple levels of scale and abstraction. Our model has fewer residual blocks than CycleGAN, but the added $R$ stream makes the total parameter count similar.
For discriminators, we use the $70 \times 70$ PatchGANs \cite{isola2017image} which were also used in CycleGAN. In all models, we apply spectral normalization to the weights of the discriminators \cite{miyato2018spectral}, which we found to stabilize the adversarial training.
\paragraph{Training} We set the reconstruction coefficients on $V$ and $C$ to be ten times the GAN loss, so $\lambda_v = \lambda_c = 10$. We use a smaller coefficient on the the $R$ reconstruction, since it is a much larger tensor: $\lambda_r = 0.1$. We update the discriminator using generated images drawn randomly from a history buffer of size 50. We use the Adam solver \cite{kingma2014adam}, with $\beta_1 = 0.5, \beta_2 = 0.999$, a batch size of 4, and a learning rate of 0.0002. After the reconstruction errors stop descending, we linearly decay the learning rate to zero. In total, training can take up to 300,000 steps, which is approximately 3 days on a single Nvidia GTX 1080 TI. This is slower convergence than a traditional CycleGAN (which takes ~100,000 iterations on our data), likely because the objective is harder to optimize when ``cheating'' is disallowed.
\paragraph{Simplified settings for synthetic data} For the experiments with synthetic data, we use a model with fewer parameters. We implement each generator as a fully-connected network with one hidden layer of 32 units and ReLU activation. We implement each adversarial discriminator as a fully-connected network with one hidden layer of 32 units, and leaky ReLU activation. Our experiments suggest that the discriminators have more than sufficient capacity to correctly learn the distributions of $C$ and $V$ and keep equilibrium with the generators. We use the same training setup as in the real-image experiments, except we set the batch size to 128, and training to convergence takes approximately 60,000 iterations, which is 1 hour on a single GPU.
\section{Experiments} \label{sec:experiments}
In this section, we demonstrate that our method outperforms prior work on (1) \textbf{accuracy} of disentanglement, (2) \textbf{fidelity} of translation, (3) \textbf{coverage} of modes (in multi-modal translations).
Ground-truth disentanglements do not exist in real image data, so we use a simple synthetic scenario to quantitatively evaluate accuracy, then present real-world qualitative results for fidelity and coverage.
\subsection{Disentanglement accuracy}
One of our claims is that uncooperative optimization is critical for accurate disentanglement. This is based on the idea that a uncooperative models are less able to find ``cheats'' which bypass the need for accuracy.
In other words, we need to show that ``uncooperative'' optimization leads to correctly disentangling $R,C$ from within $V$, in a setting where ``cooperative'' optimization fails.
We present one in which the ground-truth factors are 1D, and entanglement/disentanglement is simply concatenation/splitting. We find that cooperative optimization is incapable of learning this simple operation, whereas uncooperative optimization succeeds.
\paragraph{Models} In this experiment, we use two \textit{identical} models (see the ``Simplified settings for synthetic data'' in Sec.~\ref{sec:impl}), and change only the optimization method: one uses the proposed ``uncooperative'' optimization, and the other uses the baseline ``cooperative'' optimization.
\paragraph{Data} Since ground-truth latent factors are generally unknown in real data, it is necessary to design synthetic data for this experiment.
We define the latent factors $C$ and $R$ to be Gaussian distributions. We generate synthetic entanglements $v_i \in V$ by concatenating a sample $c_i \sim C$ with a sample $r_i \sim R$.
Specifically, we draw the elements of $C$ from a 1D Gaussian with $\mu=2.0, \sigma=1.0$, and draw the elements of $R$ from a 1D Gaussian with $\mu=-2.0, \sigma=1.0$. We find that results are not sensitive to dimensionality (except in convergence time), and so present only the simplest version here, setting the dimensionality of both $C$ and $R$ to 1, making the dimensionality of $V$ equal to 2. Note that the $R$ domain is never encountered at training time, except in its entangled form inside $V$. The task is to recover $R$, using only disentanglement/entanglement cycles, and unpaired samples of $V$ and $C$.
\paragraph{Metrics}
We measure the similarity of the actual $R$ domain (used to generate $V$ samples) to the learned $R'$ domain (disentangled from $V$ samples) using the absolute value of the Pearson correlation coefficient $\rho = |\text{cov}(R,R')/(\sigma_{R} \sigma_{R'})|$, which equals 1 if the two variables have a totally linear relationship, and is closer to 0 otherwise. This (unlike a distance metric) allows solutions where the learned $R'$ is a scaled version of the true $R$, which is appropriate since scaling may be absorbed in the model weights.
\begin{figure}[t!]
\centering
\includegraphics[width=\linewidth]{figures/face_translation3.pdf}
\caption{
Domain translation results on the face dataset, compared with MUNIT and CycleGAN. In both translation directions, MUNIT and CycleGAN sometimes alter the expression of the subject; our method keeps expression intact.
}
\label{fig:translate}
\vspace{-1em}
\end{figure}
\paragraph{Results} Our results are summarized in Figure~\ref{fig:plots}. The two models converge in approximately the same number of iterations. At the end of training, the cooperative version achieves a correlation coefficient of 0.695, while the uncooperative version achieves 0.998. Results vary slightly across iterations (and across initializations), but correlation does not noticeably improve for the cooperative version, even if training is extended to 200k iterations.
Overall, this shows that uncooperative optimization leads the model to disentangle the \textit{true} latent factors, while cooperative optimization does not.
\subsection{High-fidelity translation}
One of our claims is that the uncooperative training leads to \textit{high-fidelity} translations. By this, we mean that the translation retains as much information as possible from the input, without altering it. To evaluate this, we compare our compare our model's \textit{forward translations} against those of CycleGAN and MUNIT.
\paragraph{Baselines}
CycleGAN is a popular baseline in unsupervised (but unimodal) image-to-image translation; our architecture is based on it. MUNIT is a state-of-the-art unsupervised \textit{multimodal} image-to-image translation method.
\paragraph{Data} We note that MUNIT was originally applied to translating between widely different domains, e.g., translating dogs to lions. While this type of translation is impressive, it is also difficult to evaluate, and it is not clear that close pixel-wise correspondence/fidelity is even desirable in that task.
In this paper, we primarily focus on translating a human face across two appearance domains: photos of the face captured by a head-mounted camera, and renders of the face produced by a parametric face model (already adapted to the input face). This has an application in social virtual/augmented reality (VR/AR), where we would like users to interact with each other ``face-to-face'' (inside the virtual environment) as naturally as possible.
We collected the face data ourselves.
The real photos (representing the $V$ domain) were captured by a camera attached to the actor's headset, with the lens pointed toward the bottom half of the actor's face; lighting variation was achieved with a set of lights surrounding the actor; background variation was achieved by placing large computer monitors behind the actor and displaying random images. Rendered images of the same face (representing the $C$ domain) were produced by fitting a deep parametric face model to the actor \cite{lombardi2018deep}, and generating random expressions from a viewpoint similar to the headset view. There are 7074 real photos, and 1000 rendered images.
The task is to translate a photo of a face to (or from) a rendered-like image of the same face, while maintaining the face's expression.
For completeness, we also show results on translating architectural facades $\leftrightarrow$ labels \cite{tylevcek2013spatial}, which is a task used in prior work \cite{zhu2017unpaired}. We have also experimented with the aerial photos $\leftrightarrow$ Google maps task \cite{zhu2017unpaired}, but did not find noticeable differences between the methods on that task.
\begin{figure}[t!]
\centering
\includegraphics[width=1.0\linewidth]{figures/facades2_small.pdf}
\caption{
Domain translation results on facade/label images. While MUNIT and CycleGAN introduce artifacts (which make back-translation easier during training), our model performs high-fidelity translation.
}
\label{fig:facades}
\vspace{-1.2em}
\end{figure}
\paragraph{Metrics}
In the face image experiments---which are necessarily qualitative---we rely on the fact that humans are extremely adept at reading faces \cite{ekman1980face}, and attempt to demonstrate that our model achieves obviously better disentanglements than prior methods. The results on aerial and facade data (introduced in prior work) is harder to interpret at a glance, but close inspection can reveal differences in sharpness and spatial consistency with the input. We note that even when ground truth translations exist, it does not make sense to evaluate against them, since these are many-to-one/one-to-many mappings, and totally unsupervised models (as considered here) cannot be expected to generate labels that match the ground truth (e.g., as assumed in the ``FCN score'' used in Pix2Pix \cite{isola2017image} and CycleGAN \cite{zhu2017unpaired}).
\paragraph{Results}
Figure~\ref{fig:translate} compares our method against MUNIT and CycleGAN on the face dataset.
The results show that while CycleGAN and MUNIT perform the appearance translation, they make small but very noticeable shifts in the facial expression, e.g., turning a closed mouth into a smile, or changing a grimace to a pout. This is due to the drawbacks of cooperative training, described earlier. Our method does not have this problem, and translates the faces across domains without altering expression. Figure~\ref{fig:facades} shows the same experiment but for the facades $\leftrightarrow$ labels task, with similar results: while our method retains, for instance, exact spatial positions of the features in either domain, the baseline methods tend to make small shifts in position and scale.
\subsection{Multi-modal outputs}
Our model is designed to produce multi-modal outputs, through a ``mix-and-match'' method, where we use $C$ from one input and $R$ from another input, and entangle these to form a novel sample of $V$. We compare against MUNIT, which is the current state-of-the-art method for this task.
More specifically, generating multiple outputs from a single input involves the following steps: (1) given $v_i$ as input, generate $c_i$; (2) given an unrelated $v_j$ as input, generate $r_j$; (3) entangle $c_i, r_j$, to produce the composite $v_{ij}$. In the face context, since the domain $C$ contains expression but not lighting, this setup means extracting expression from one image, and extracting everything else (which is mostly lighting and backgrounds) from another image, and combining these factors into a new image. The experimental setup is similar for MUNIT: a ``content code'' is generated from $v_i$, and a ``style code'' is generated from $v_j$, and these are encoded into the final output. We do this for multiple $v_j$, to show the effect of transferring a variety of residual factors onto the same face.
\paragraph{Data} We use the same face data as in the high-fidelity task, and also aerial photos $\leftrightarrow$ Google maps \cite{zhu2017unpaired}, which we find has more evident multi-modality than the facades.
\paragraph{Results} Figure~\ref{fig:relighting} shows the results of this experiment on the faces dataset, for MUNIT and our model.
The figure shows expressions from $v_i$ across rows, and residuals from $v_j$ (\ie, lighting/background conditions) across columns.
For an overview of the results, the reader may scan across rows to inspect that expression is transferred from the leftmost row, and scan across columns to inspect that lighting and backgrounds are transferred from the topmost row.
MUNIT appears to have only learned to transfer the global intensity from the $v_j$ source. Our model appears to be transferring backgrounds, and even casting distinct shadows onto the face. However, some shadows appear reduced in intensity (e.g., third column), suggesting that expression-lighting disentanglement is not perfect here.
In the supplementary, we also show results of this experiment on the aerial photos $\leftrightarrow$ Google maps dataset, where we treat the Google map as $C$ (assuming it has less information), and the aerial photos as $V$.
In this domain, it appears MUNIT transfers very little from the residual, while our model incorporates textures and objects (e.g., note the white object transferred from the first residual).
Both methods appear to retain the spatial layout of the input map.
\begin{figure}[t]
\centering
\includegraphics[width=\linewidth]{figures/relighting_vs_munit4.pdf}
\caption{
Face relighting results of MUNIT (top) vs our model (bottom). In each table, the leftmost column shows the input $c_i$ from which expression is drawn; the top row shows the input $v_i$ from which everything else is drawn.
}
\label{fig:relighting}
\vspace{-1.5em}
\end{figure}
\section{Discussion}
\label{sec:conclusion}
In this work, we address the \textit{compensation} issue in translation cycle-consistency, which typically diminishes the utility of the reconstruction loss. In compensation, the back-translator (undesirably) adapts to the weaknesses and shortcuts of the forward-translator. Hypothetically, there is another way to (partially) defeat the loss, which may be called \textit{exploitation}.
In exploitation, the forward-translator (undesirably) adapts to the weaknesses and shortcuts of the back-translator. The enduring exploitation issue may explain the subtle imperfections in our outputs.
Another limitation of our approach is that we do not address \textit{many-to-many} mappings. Our approach is only multi-modal in one direction.
In summary, we introduced the problem of high-fidelity image-to-image translation, motivated it for augmented reality applications, and presented an unsupervised method for solving it.
We identified a fundamental cause of low-fidelity translations: cooperation between the forward translator and the backward translator, which allows the forward-translation to ``hide'' information, and the back-translator to ``recover'' from noticeable errors. This is a critical problem in real applications. We presented an ``uncooperative'' optimization scheme that prevents the problem. Our results demonstrate that uncooperative optimization leads to high-fidelity image translations, making image-to-image translation not only fun, but useful for augmented reality.
\section{Details of ``cheating'', and the necessity of uncooperative optimization}
\section{How ``cheating'' happens in practice}
It is relatively easy to see how the ``uncooperative'' optimization prevents the networks from developing a ``cheating'' scheme, since the networks only train when their inputs are real. It is less easy to see how a ``cheating'' scheme can develop at all, considering the losses that already constrain the model.
In this section, we will first summarize a tempting (but flawed) argument suggesting that ``cheating is penalized by the losses'', and then demonstrate how the intuition is generally proven wrong in practice.
To see how cheating may intuitively seem impossible, consider the following, with reference to Figure~3 in the main text.
Suppose $r$ is used as a ``shortcut'' to cheat Cycle 1, in the sense that $D$ copies $v$ into $r'$, and then $\E$ copies $r'$ into $v'$, meeting the cycle-consistency constraint of $v' \approx v$. Meanwhile, to meet the adversarial constraint, $D$ may write any target-domain image into $c'$.
But this leads to errors in Cycle 2: if $\E$ simply copies its input $r$ into $v'$, and/or $D$ does not produce an output $c'$ which strictly corresponds to its input $v'$, then $c$ is essentially ignored, and we will have $c' \neq c$ and a loss. Therefore, it seems that cheating should be eliminated at convergence.
In practice, however, the networks achieve a far more subtle type of cheat, which eventually yields zero loss. At training time, the visual manifestation of the cheat is that the translations do not correspond to the inputs, and yet they are back-translated perfectly.
Our experiments suggest that the networks generate outputs that facilitate reconstruction of the corresponding inputs, and the networks treat these generated tensors differently from real tensors.
In particular, when we generate $(c', r') = D(v)$, then $r'$ tends to hide $v$ inside, to facilitate its reconstruction by $\E$. Similarly, when we generate $v' = \E(c,r)$, then $v'$ tends to hide $c$ inside, to facilitate its reconstruction by $D$.
Figure~\ref{fig:cheat} illustrates how to empirically reveal this behavior, and shows sample non-corresponding outputs from a converged ``cooperative'' model. For a brief reading of the figure,
observe that $v$ and $v_2'$ appear visually identical, but $D$ decodes (the real) $v$ into a closed mouth, and decodes (the fake) $v_2'$ into a wide open mouth.
Parallel work \cite{chu2017cyclegan} has also observed this phenomenon, under the label of \textit{steganography}. That work showed that the secret/cheating signal is often hidden in high frequencies, where presumably the discriminators are less effective. With sufficient training, a discriminator should learn to block this strategy (since such high-frequency content is not present in real examples), which would force the signal to shift to lower (and more semantically-relevant) frequencies, as observed here.
\section{Additional results}
Figure~\ref{fig:aerial_relighting} shows results on the aerial photos $\leftrightarrow$ Google maps dataset.
Both methods appear to retain the spatial layout of the input map, but our method transfers textures and lighting/brightness from the residual, while MUNIT does not.
\begin{figure}[t!]
\centering
\includegraphics[width=\linewidth]{figures/cheating5.pdf}
\caption{{Exploration of cheating behavior.}
Left: Decoding \textit{matched} tensors yields apparently good output. Right: decoding \textit{mismatched} tensors reveals clear cheating.
}\label{fig:cheat}
\end{figure}
\begin{figure*}[t]
\centering
\includegraphics[width=\linewidth]{figures/aerial_relighting_small.pdf}
\caption{
Aerial image composition of our method (left) vs MUNIT (right). Our method successfully transfers textures from the residual, while MUNIT does not; both retain the spatial structure of the map in this case.
}
\label{fig:aerial_relighting}
\end{figure*}
| {'timestamp': '2019-10-22T02:11:32', 'yymm': '1901', 'arxiv_id': '1901.03628', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03628'} | arxiv |
\subsection{Main Results}\label{sec:results}
\begin{graytbox}
\begin{theorem}[main result]\label{thm:main}
Given an $n$-vertex graph $G$ with $m$ edges and max degree $\Delta$, there exists a randomized \MPC{} algorithm for computing a maximal matching that \begin{enumerate}[label={(\arabic*)}, itemsep=0ex]
\item takes $O(\log \log \Delta)$ rounds using $O(n)$ space per machine,
\item or takes $O(\log \frac{1}{\delta})$ rounds using $O(n^{1+\delta})$ space per machine, for any parameter $\delta \in (0, 1)$.
\end{enumerate}
The algorithm succeeds w.e.h.p.\footnote{We say an event occurs \emph{with exponentially high probability} (w.e.h.p.) if it occurs with probability $1 - e^{-n^{\Omega(1)}}$.} and requires an optimal total space of $O(m)$.
\end{theorem}
\end{graytbox}
Theorem~\ref{thm:main} part (1) provides the first subpolylogarithmic round \MPC{} algorithm for maximal matching that does not require a super-linear space in $n$. In fact, it improves exponentially over the prior algorithms in this regime, which all take polylogarithmic rounds \cite{DBLP:conf/stoc/Luby85,DBLP:conf/spaa/LattanziMSV11,ghaffariuitto}. Furthermore, Theorem~\ref{thm:main} part (2) exponentially improves over the $\delta$-dependency of Lattanzi \etal{}'s algorithm \cite{DBLP:conf/spaa/LattanziMSV11} which requires $O(1/\delta)$ rounds using $O(n^{1+\delta})$ space.
\begin{theorem}\label{thm:sublinearspace}
Given an $n$-vertex graph $G$ with $m$ edges and max degree $\Delta$, there exists an \MPC{} algorithm for computing a maximal matching that takes $O(\log \log \Delta + \log \log \log n)$ rounds and uses $n/2^{\Omega(\sqrt{\log n})}$ space per machine. The algorithm succeeds w.e.h.p. and uses a total space of $O(m + n^{1+\gamma})$ for any constant $\gamma > 0$.
\end{theorem}
Theorem~\ref{thm:sublinearspace} further improves the space per machine to {\em mildly sublinear} with the same round complexity (ignoring the lower terms). We comment that the $n/2^{\Omega(\sqrt{\log n})}$ space usage here goes below the $n/\poly\log n$ space that has commonly been considered for problems such as approximate matching \cite{DBLP:conf/stoc/CzumajLMMOS18, DBLP:conf/podc/GhaffariGKMR18, assadiedcs} and graph connectivity \cite{DBLP:journals/corr/abs-1805-02974}.
\paragraph{Other implications.} Our algorithm also has a few other implications when used as a black-box.
\begin{corollary}\label{cor:vertexcover}
By a well-known reduction, the set of matched vertices in a maximal matching is a 2-approximation of minimum vertex cover. As such, all algorithms of Theorems~\ref{thm:main} and \ref{thm:sublinearspace} can be applied to the 2-approximate minimum vertex cover problem as well.
\end{corollary}
The problem of whether an approximate vertex cover can be found faster in \MPC{} with $O(n)$ space was first asked by Czumaj \etal{}~\cite{DBLP:conf/stoc/CzumajLMMOS18}. Subsequent works showed that indeed $O(\log \log n)$ algorithms are achievable and the approximation factor has been improved from $O(\log n)$ to $O(1)$ to $2+\varepsilon$ \cite{DBLP:journals/corr/abs-1709-04599, DBLP:conf/podc/GhaffariGKMR18, assadiedcs}. Corollary~\ref{cor:vertexcover} reaches a culminating point: If we restrict the machines to run a polynomial-time algorithm, which is a standard assumption (see \cite{DBLP:conf/soda/KarloffSV10, DBLP:conf/stoc/AndoniNOY14}), no algorithm can achieve a better approximation under the Unique Games Conjecture \cite{khot2008vertex}.
\begin{corollary}\label{cor:congestedclique}
By known reductions \cite{DBLP:journals/corr/abs-1802-10297, DBLP:conf/podc/Lenzen13}, Theorem~\ref{thm:main} directly implies an $O(\log \log \Delta)$ round algorithm for maximal matching in the congested clique model. It also leads to $O(\log \log \Delta)$ round congested clique algorithms for 2-approximate vertex cover, $1+ \varepsilon$ approximate maximum matching, and $2 + \varepsilon$ approximate maximum weighted matching by known reductions.
\end{corollary}
The problem of maximal matching in the congested clique model was first asked by Ghaffari~\cite{DBLP:conf/podc/Ghaffari17}. Prior to our work, the fastest known algorithm for this problem remained the classic $O(\log n)$ round algorithm of Luby \cite{DBLP:conf/stoc/Luby85}.\footnote{We comment that although it is unclaimed, a recent algorithm of Ghaffari and Uitto \cite{ghaffariuitto} can also be simulated in the congested clique model leading to an $\widetilde{O}(\sqrt{\log \Delta})$ round algorithm.} Corollary~\ref{cor:congestedclique} exponentially improves over this bound.
\begin{corollary}\label{cor:approximatematching}
For any constant $\varepsilon \in (0, 1)$, Theorem~\ref{thm:main} can be used to give algorithms for $1+\varepsilon$ approximate matching and $2+\varepsilon$ approximate maximum weighted matching in asymptotically the same number of rounds and space.
\end{corollary}
The reduction from maximal matching (and in fact, any $O(1)$ approximate matching) to $1+\varepsilon$ approximate matching is due to an algorithm by McGregor \cite{DBLP:conf/approx/McGregor05} (see \cite{assadiedcs}) and the reduction to $2+\varepsilon$ approximate weighted matching is due to an algorithm by Lotker et al.~\cite{DBLP:journals/siamcomp/LotkerPR09} (see \cite{DBLP:conf/stoc/CzumajLMMOS18}). We also note that if the space is $O(n \polylog n)$, then our algorithm can be used in a framework of Gamlath \etal{}~\cite{gamlath2018weighted} to get an $O(\log \log \Delta)$ round algorithm for $1+\epsilon$ approximate maximum weighted matching.
Corollary~\ref{cor:approximatematching} also strengthens the round-complexity of the results in \cite{DBLP:conf/stoc/CzumajLMMOS18, DBLP:conf/podc/GhaffariGKMR18, assadiedcs} from $O(\log \log n)$ to $O(\log \log \Delta)$ using $O(n)$ space. To our knowledge, the algorithms of \cite{DBLP:conf/stoc/CzumajLMMOS18, DBLP:conf/podc/GhaffariGKMR18, assadiedcs} do require $\Omega(\log \log n)$ rounds even when $\Delta = \poly\log n$ since they switch to an $O(\log \Delta)$ round algorithm at this threshold. Corollary~\ref{cor:approximatematching}, however, implies an $O(\log \log \log n)$ round algorithm on such graphs.
\section{Useful Properties of Sequential Greedy Maximal Matching}
\label{app:greedy}
In this section we prove the properties of the sequential greedy maximal matching that we used throughout the paper.
The first property concerns the behavior of greedy matching when it is run on an edge-sampled subgraph of a graph. This property is very similar to some results in \cite{DBLP:conf/icml/AhnCGMW15, DBLP:conf/podc/GhaffariGKMR18,DBLP:journals/corr/Konrad} on greedy algorithms for correlation clustering and maximal independent set.
\begin{lemma}\label{lem:edgesamplegreedy}
Fix a graph $G = (V, E)$, let $\pi$ be a permutation over $E$, and let $p \in (0,1]$ be an arbitrary parameter. We define $G_p = (V, E_p)$ to be the random subgraph of $G$ formed wherein each edge in $E$ appears in $E_p$ independently with probability $p$ and define $M := \greedymatching{G_p, \pi}$. For any vertex $v$ and any parameter $\beta \in (0,1/2)$, with probability at least $1 - \beta$, $\deg_{M}^{\text{res}}(v) \leq \frac{\ln (1/\beta)}{p}$.
\end{lemma}
\begin{proof}
Consider the following equivalent method of generating $M$. We iterate over the edges in $E$ in the order of $\pi$. Upon visiting an edge $e$, if one of its incident edges belongs to $M$, we call it {\em irrelevant} and discard it. Otherwise, we draw a Bernoulli-$p$ random variable $X_e$; if $X_e = 1$, we call $e$ {\em lucky} and add it to $M$ otherwise we call $e$ \emph{unlucky}.
If $v$ is matched in $M$, then $\deg_M^{\text{res}}(v) = 0$. Otherwise, all of its remaining edges in $G[V \setminus M]$ should have been unlucky. That is, every time we encounter an edge $e$ in this process, it must have been irrelevant or we must have chosen $X_e = 0$. Furthermore, in order to have $\deg_M^{\text{res}}(v) > \tau = \frac{\ln(1/\beta)}{p}$, there must remain at least $\tau$ edges which are not irrelevant. During this process, the probability that all such edges are marked unlucky is at most $(1-p)^\tau \leq \exp(-\tau p) = \beta$.
\end{proof}
The second useful property of the greedy matching is that modifying a single vertex or edge of $G$ does not change the set of matched vertices too much. Note that that the set of \emph{edges} selected for $M$ can change significantly.
\begin{lemma}\label{lem:lipschitzproperties}
Fix some graph $G(V,E)$ and let $\rho: E \rightarrow [0,1]$ be an associated list of priorities:
\begin{enumerate}[itemsep=-0.5ex]
\item If graph $G'$ is derived by removing a vertex of $G$, then there are at most $2$ vertices whose match-status differs in $\greedymatching{G, \rho}$ and $\greedymatching{G', \rho}$.
\item If graph $G'$ is derived by removing an edge of $G$, then there are at most $2$ vertices whose match-status differs in $\greedymatching{G, \rho}$ and $\greedymatching{G', \rho}$.
\item If $\rho'$ is derived by changing a single entry of $\rho$, then there are at most $2$ vertices whose match-status differs in $\greedymatching{G, \rho}$ and $\greedymatching{G, \rho'}$.
\end{enumerate}
\end{lemma}
\begin{proof}
We start with the proof of the first part. Suppose that $G'$ is obtained by removing some vertex $v$ from $G$. Let $M := \greedymatching{G, \rho}$ and $M' := \greedymatching{G', \rho}$. Furthermore, let $D := M \oplus M'$ denote the symmetric difference of $M$ and $M'$, i.e. the set $(M \setminus M') \cup (M' \setminus M)$. Note that the match-status of a vertex $v$ differs in $M$ and $M'$ if and only if its degree in $D$ is one. Therefore, it suffices to show that there are at most two such vertices in $D$.
We first claim that $D$ has at most one connected component (apart from singleton vertices). For sake of contradiction, suppose that $D$ has multiple such connected components; fix one component $C$ that does not contain $v$. Let $e$ be the edge in $C$ with the highest priority. The fact that no higher priority edge that is connected to $e$ is part of $M$ or $M'$ (otherwise $e$ would not be the highest priority edge in $C$) shows that $e$ has to belong to both $M$ and $M'$. By definition of $D$, this means that $e \notin D$ which is a contradiction. Next, observe that since $D$ is composed of the edges of two matchings, its maximum degree is at most 2 and thus its unique component is either a path or a cycle. The latter has no vertex of degree one and the former has two; proving part 1 of Lemma~\ref{lem:lipschitzproperties}.
The proof of the other two parts of Lemma~\ref{lem:lipschitzproperties} follows from a similar argument. If an edge $e$ is removed from $G$ or its entry in $\rho$ is changed, then for the same argument, the symmetric difference $M \oplus M'$ of the two greedy matchings $M$ and $M'$ that are obtained would contain only one connected component which has to contain $e$. Since this component is a cycle or a path, the match-statuses of at most two vertices are different in the two matchings.
\end{proof}
The third property is the most subtle: it can be summarized as stating that the presence of any given edge $e $ appearing in $M$ can be determined from a relatively small number of other edges. To make this more precise, let us consider the following query-based method which we refer to as the ``edge oracle'' $\edgeoracle_{\pi}(e)$ for determining whether an edge $e$ appears in $\greedymatching{G, \pi}$:
\begin{titledtbox}{$\edgeoracle_{\pi}(e)$: A query-process to determine whether $e \in \greedymatching{G, \pi}$.}
\begin{algorithmic}
\State Let $e_1, \ldots, e_d$ be the incident edges to $e$ in $G$ sorted such that $\pi(e_1) < \pi(e_2) < \dots < \pi(e_d)$.
\For{$i = 1, \ldots, d$}
\If{$\pi(e_i) < \pi(e)$}
\State \textbf{if} $\edgeoracle_{\pi}(e_j) = \yes$ \textbf{then return} \no{}
\EndIf
\EndFor
\State \Return \yes{}
\end{algorithmic}
\end{titledtbox}
It is clear that $e \in \greedymatching{G, \pi}$ if and only if $\edgeoracle_{\pi}(e) = \yes{}$. For any edge $e \in E$, let us define $A(e)$ to be the number of (recursive) calls to $\edgeoracle_{\pi}$ that are generated by running $\edgeoracle_{\pi}(e)$. Translating a result of Yoshida \etal{}~\cite{DBLP:conf/stoc/YoshidaYI09} for maximal independent set into our context, gives:
\begin{proposition}[\cite{DBLP:conf/stoc/YoshidaYI09}]
\label{prop:greedmatchquery}
Let $G$ be a graph with $m$ edges and $r$ pairs of intersecting edges. If $\pi$ is drawn u.a.r. from permutations on $m$ elements, then $\E_{\pi} [ \sum_{e \in E} A(e) ] \leq O( m + r )$.
\end{proposition}
\begin{proof}
Let $H$ be the line graph of $G$. Then $H$ has $m$ vertices and $r$ edges, and hence has average degree $2r/m$. Also, $\E_{\pi}[A(e)]$ is the expected query complexity of the maximal independent set of $H$ under a random sequential greedy independent set. The result of Yoshida \etal{}~\cite[Theorem 2.1]{DBLP:conf/stoc/YoshidaYI09} implies the following bound on the average value of $A(e)$ in terms of the average degree of $H$:
$$
\frac{1}{m} \E_{\pi} \Big[ \sum_{e \in L} A(e) \Big] \leq 1 + \frac{2r}{m}.
$$
We obtain the stated result by multiplying through by $m$.
\end{proof}
\section{Introduction}
The success of modern parallel frameworks such as MapReduce~\cite{DBLP:journals/cacm/DeanG08}, Hadoop~\cite{DBLP:books/daglib/0025439}, or Spark~\cite{DBLP:conf/hotcloud/ZahariaCFSS10} has resulted in an active area of research over the past few years for understanding the true computational power of such systems. The {\em Massively Parallel Computations} (\MPC{}) model, which provides a clean abstraction of these frameworks, has become the standard theoretical model for this purpose (see Section~\ref{sec:mpc} for the model).
In this work, we consider the {\em maximal matching} problem in the \MPC{} model. It is one of the most fundamental graph problems in parallel and distributed computing with far reaching practical and theoretical implications. The study of maximal matching can be traced back to \PRAM{} algorithms of 1980s \cite{DBLP:conf/stoc/Luby85, DBLP:journals/ipl/IsraelI86, DBLP:journals/jal/AlonBI86} and has been studied in various computational models since then.
In the \MPC{} model, maximal matching is particularly important; an algorithm for it directly gives rise to algorithms for $1+\varepsilon$ approximate {\em maximum matching}, $2+\varepsilon$ approximate {\em maximum weighted matching}, and $2$ approximate {\em minimum vertex cover} with essentially the same number of rounds and space. Each of these problems has been studied on its own \cite{DBLP:conf/stoc/CzumajLMMOS18, DBLP:journals/corr/abs-1709-04599, DBLP:conf/podc/GhaffariGKMR18, assadiedcs, DBLP:conf/spaa/AssadiK17, DBLP:conf/spaa/BehnezhadDETY17, DBLP:journals/corr/abs-1807-08745, DBLP:conf/spaa/AhnG15}.
\paragraph{Known bounds.} For many graph problems, including maximal matching, $O(\log n)$ round \MPC{} algorithms can be achieved in a straightforward way by simulating \PRAM{} algorithms \cite{DBLP:conf/stoc/Luby85, DBLP:journals/ipl/IsraelI86, DBLP:journals/jal/AlonBI86} using $n^{\Omega(1)}$ space. This bound was recently improved by Ghaffari and Uitto \cite{ghaffariuitto} to $\widetilde{O}(\sqrt{\log \Delta})$ rounds with the same memory. The main goal, however, is to obtain significantly faster (i.e., subpolylogarithmic round) algorithms by further utilizing \MPC{}'s additional powers.
Currently, the only known such algorithm for maximal matching is that of Lattanzi \etal~\cite{DBLP:conf/spaa/LattanziMSV11} which requires $O(1/\delta)$ rounds using a space of $O(n^{1+\delta})$. Their algorithm's round complexity, however, blows up back to $\Theta(\log n)$ as soon as memory becomes $O(n)$. In comparison, due to a breakthrough of Czumaj \etal{}~\cite{DBLP:conf/stoc/CzumajLMMOS18}, we have algorithms for $1+\varepsilon$ approximate matching that take $O(\log \log n)$ rounds using a space of $O(n)$ \cite{DBLP:conf/stoc/CzumajLMMOS18, DBLP:conf/podc/GhaffariGKMR18, assadiedcs}. Unfortunately, this progress on approximate matching offers no help for maximal matching or related problems. In fact, these algorithms also require up to $\Omega(\log n)$ rounds to maintain maximality.
\paragraph{Our contribution.} In this paper, we give \MPC{} algorithms for maximal matching that are exponentially faster than the state-of-the-art (we describe our precise results in Section~\ref{sec:results}). We achieve this by providing a novel analysis of an extremely simple and natural algorithm.
The algorithm edge-samples the graph, randomly partitions the vertices into disjoint subsets, and finds a greedy maximal matching within the induced subgraph of each partition. This partitioning is useful since each induced subgraph can be sent to a different machine. We show that if we commit the edges of each of these greedy matchings to the final output, the vertex degrees in the residual graph are drastically dropped. Czumaj \etal{}~\cite{DBLP:conf/stoc/CzumajLMMOS18} had conjectured that a variant of this algorithm might work and left its analysis as one of their main open problems:\footnote{A more detailed variant of the algorithm was also described in the following TCS+ talk by Artur Czumaj (starts from 1:03:23): \url{https://youtu.be/eq0jwAnJu9c?t=3803}.}
\begin{quotation}
\noindent ``{\em Finally, we suspect that there is a simpler algorithm for the problem {\normalfont [...]} by simply greedily matching high-degree vertices on induced subgraphs {\normalfont [...]} in every phase. Unfortunately, we do not know how to analyze this kind of approach.}'' \cite{DBLP:conf/stoc/CzumajLMMOS18}
\end{quotation}
We summarize our results and their implications in Section~\ref{sec:results} and give a high-level overview of the analysis in Section~\ref{sec:highlevel}.
\input{contributions}
\input{vertexpartitioning}
\section{Putting Everything Together}\label{sec:leftoververtices}
We now prove Lemma~\ref{lem:degreereduction}, showing that Algorithm~\ref{alg:nearmaximal} can be used to reduce the overall graph degree. There are two parts to doing this. First, we need to amplify the success probability of Lemma~\ref{lem:nearmaximal}, which only showed a degree reduction in expectation, into one holding w.e.h.p. Next, we need to remove the remaining high-degree vertices.
\begin{claim}
\label{cl:alg1whp}
There is an algorithm to generate a matching $M$ which w.e.h.p. uses $n/\Delta^{\Omega(1)}$ space per machine and $O(m)$ total space, such that there are at most $n/\Delta^{0.02}$ vertices $v$ with $\deg^{\text{res}}_M(v) > \Delta^{0.99}$.
\end{claim}
\begin{proof}
We may assume that the original graph has as least $n/\Delta^{0.02}$ vertices with $\deg(v) > \Delta^{0.99}$, as otherwise there is nothing to do. This implies that $m \geq n \Delta^{0.97}$.
Now consider running Algorithm~\ref{alg:nearmaximal} to generate a matching $M$. Let us define $Y$ to be the number of vertices $v \in V$ with $\deg^{\text{res}}_M(v) > \Delta^{0.99}$. Lemma~\ref{alg:nearmaximal} has shown that $\E[Y] \leq O(n/\Delta^{0.03})$, and so we need to show concentration for $Y$. There are two cases depending on the size of $\Delta$.
\smparagraph{Case 1: $\Delta > n^{0.1}$.} In this case, Markov's inequality applied to $Y$ shows that $\Pr[Y > n \Delta^{-0.02}] \leq O(\Delta^{-0.01}) \leq 1/2$. Now consider running $t = n^a$ parallel iterations of Algorithm~\ref{alg:nearmaximal} for some constant $a > 0$, generating matchings $M_1, \dots, M_t$. Since they are independent, there is a probability of at least $1 - 2^{-t}$ that at least one matching $M_i$ has the property that its residual set of high-degree vertices satisfies $Y > n \Delta^{-0.02}$. Thus, w.e.h.p., this algorithm satisfies the condition on the high-degree vertices. Each application of Algorithm~\ref{alg:nearmaximal} separately uses $O(n) + m/\poly(\Delta)$ space. Therefore, the $t$ iterations in total use $O(n^{1+a}) + n^a m/\poly(\Delta)$ space. Since $\Delta > n^{0.1}$ and $m \geq \Delta n^{0.97} > n^{1.07}$, this is $O(m)$ for $a$ a sufficiently small constant.
\smparagraph{Case 2: $\Delta < n^{0.1}$.} We can regard $Y$ as being determined by $O(n \Delta)$ random variables, namely, the values $\rho, \chi, L$. By Lemma~\ref{lem:lipschitzproperties}, modifying each entry of $\rho, \chi$, or $L$ can only change the match-status of at most $O(1)$ vertices. Each of these, in turn, has only $\Delta$ neighbors, which are the only vertices whose degree in $G[ V \setminus M]$ is changed. Thus, changing each of the underlying random variables can only change $Y$ by $O( \Delta )$. By Proposition~\ref{prop:bd-dif2}, therefore, w.e.h.p. we have
$$
Y \leq \E[Y] + O(\Delta) n^{0.01} \sqrt{ n \Delta } \leq O(n \Delta^{-0.03}) + O(n^{0.51} \Delta^{1.5}).
$$
As $\Delta \leq n^{0.1}$ and $\Delta$ is larger than any needed constants, this is at most $n \Delta^{-0.02}$. Therefore, already a single application of Algorithm~\ref{alg:nearmaximal} suceeds w.e.h.p.
\end{proof}
Having slightly reduced the number of high-degree vertices, we next use the following Algorithm~\ref{alg:leftoververtices}, which significantly decreases the number of high-degree vertices.
\begin{tboxalg}{}\label{alg:leftoververtices}
\begin{enumerate}[label={(\arabic*)},ref={\arabic*-}, topsep=0pt,itemsep=0ex,partopsep=0ex,parsep=1ex, leftmargin=*]
\item Let $\mathcal Y$ be the set of vertices in $G[V \setminus M]$ with degree greater than $\tau = \Delta^{0.999}$.
\item Sample each edge with at least one end-point in $\mathcal Y$ with probability $q := \Delta^{-0.99}$ and let $L$ be the set of sampled edges.
\item Put $G^L = (V, L)$ in machine 1, choose an arbitrary permutation $\pi$ over its edges and return matching $M' := \greedymatching{G^L, \pi}$.
\end{enumerate}
\end{tboxalg}
\begin{claim}
\label{cl:left1}
Given a graph $G$, suppose we apply Claim~\ref{cl:alg1whp}; let $M$ be the resulting matching and $G' = G[ V \setminus M]$. Suppose we next run Algorithm~\ref{alg:leftoververtices} on $G'$ and let $M'$ denote the resulting matching. Let $\mathcal Y'$ denote the set of vertices $v$ with $\deg_{M \cup M'}^{\text{res}} (v) > \tau$. Then, w.e.h.p., $|\mathcal Y'| \leq n/\Delta^{1.01}$.
\end{claim}
\begin{proof}
Let $\mathcal Y$ be the set of vertices with $\deg^{\text{res}}_M(v) > \tau$ and $Y = |\mathcal Y|$. By Claim~\ref{cl:alg1whp}, w.e.h.p. $Y \leq n/\Delta^{0.02}$. For the remainder of this proof, we assume that $M$ (and hence $Y$) is fixed and it satisfies this bound.
We first analyze $\E[ Y' ]$ where we define $Y' = | \mathcal Y' |$. Consider some vertex $v \in \mathcal Y$. By Lemma~\ref{lem:edgesamplegreedy}, with probability at least $1 - \beta$ the vertex $v$ has $\deg_{M \cup M'}^{\text{res}} \leq O( \frac{\log 1/\beta}{q} )$. Setting $\beta = e^{-\Delta^{0.001}}$, we get that $\deg_{M \cup M'}^{\text{res}}(v) \leq O( \Delta^{0.991} )$ with probability $1 - \exp(-\Delta^{\Omega(1)})$. Since this holds for any vertex $v \in \mathcal Y$, we have shown that
$$
E[ Y' ] \leq Y \cdot \exp(-\Delta^{\Omega(1)}) \leq n e^{-\Delta^{\Omega(1)}}.
$$
We next need to show concentration for $Y'$. For this, note that if $\Delta > n^{0.01}$, then the above bound on $\E[Y']$ already implies (by Markov's inequality) that $Y' < 1$ w.e.h.p.
If $\Delta < n^{0.01}$, then we use the bounded differences inequality. Here, $Y'$ can be regarded as a function of $n \Delta$ random variables (the membership of each edge in $L$). By Lemma~\ref{lem:lipschitzproperties}, each such edge can affect the match-status of $O(1)$ vertices. Each such vertex $w$, in turn, can only change the membership in $\mathcal Y'$ of its neighbors. Hence, each random variable changes $Y'$ by at most $O(\Delta)$. By Proposition~\ref{prop:bd-dif2}, we therefore have w.h.p.
$$
Y' \leq \E[Y'] + O( \Delta \times \sqrt{n \Delta} \times n^{0.01}) \leq n \exp(-\Delta^{\Omega(1)}) + O( \Delta^{1.5} n^{0.51}).
$$
By our assumption that $\Delta \leq n^{0.01}$, this is easily seen to be smaller than $n/\Delta^{1.01}$.
\end{proof}
\begin{proof}[Proof of Lemma~\ref{lem:degreereduction}]
When we apply Claim~\ref{cl:alg1whp} and then apply Claim~\ref{cl:left1}, this w.e.h.p. gives matchings $M, M' $ respectively such that $G[ V \setminus (M \cup M') ]$ has at most $n/\Delta^{1.01}$ vertices of degree larger than $\Delta^{0.999}$. Claim~\ref{cl:alg1whp} already obeys the stated space bounds. For Algorithm~\ref{alg:leftoververtices}, observe that $|\mathcal Y| \leq n/\Delta^{0.02}$, and so there are at most $n \Delta^{0.98}$ edges incident to $\mathcal Y$. This means $\E[ |L| ] \leq n / \Delta^{0.01}$ and a simple Chernoff bound thus shows that $L \leq n/\Delta^{\Omega(1)}$ w.e.h.p.
Finally, we place all vertices with degree at least $\Delta^{0.999}$ and their incident edges onto a single machine; this clearly takes $O(n/\Delta^{0.01})$ space. Since $\Delta$ is larger than any needed constant, this is at most $n/\Delta^{\Omega(1)}$. We thus expand $M \cup M'$ to a maximal matching $M''$ of $G[V \setminus (M \cup M')]$. At the end of this process, all remaining vertices of $G$ must have degree less than $\Delta^{0.999}$.
\end{proof}
\subsection{The Algorithm with Mildly Sublinear Space}\label{sec:sublinearspace}
We now turn to proving Theorem~\ref{thm:sublinearspace}, where we reduce the space per machine to $n/2^{\Omega(\sqrt{\log n})}$ with round complexity at $O(\log \log \Delta + \log \log \log n)$. The follows by combining the fact that our algorithms require $n/\Delta^{\Omega(1)}$ space with a known technique for simulating \local{} algorithm on low-degree graphs in an exponentially faster time.
\begin{proof}[Proof of Theorem~\ref{thm:sublinearspace}]
The degree reduction algorithm of Lemma~\ref{lem:degreereduction} uses a space per machine of $n/\Delta^{\Omega(1)}$ to get the degree down from $\Delta$ to $\Delta^{1-\Omega(1)}$. Therefore, if $\Delta \geq 2^{\Omega(\sqrt{\log n})}$, the degree reduction automatically requires $n/2^{\Omega(\sqrt{\log n})}$ space. This means that within $O(\log \log \Delta)$ rounds, we can get the maximum degree down to $\Delta' \leq 2^{ (\gamma/2) \sqrt{\log n}}$ w.e.h.p., where $\gamma \in (0,1)$ is any small constant. (If $\Delta \leq 2^{ (\gamma/2) \sqrt{\log n}}$ originally, then we simply have $\Delta' = \Delta$.)
At this point, we switch to a different algorithm: we simulate the known $ t = O(\log \Delta + \poly(\log\log n))$ round \local{} algorithms for maximal matching \cite{DBLP:conf/focs/BarenboimEPS12}. This requires $O(\log t) = O(\log \log \Delta + \log \log \log n)$ rounds; this is possible for the all-to-all communication of the machines (compared to \local{}) and the fact that the maximum degree is small (so that the neighborhood is not too large that it does not fit the memory). For more details, see for example the {\em blind coordination lemma} of \cite{DBLP:journals/corr/abs-1807-06701} which shows one can simulate $t$ rounds of all {\em state-congested} \local{} algorithms (such as that of \cite{DBLP:conf/focs/BarenboimEPS12}) in $O(\frac{t}{\log_{\Delta} n} + \log t)$ rounds of \MPC{} with $n^{1-\Omega(1)}$ space per machine and $O(n^{1+\gamma/2})$ total space. (This excludes the space needed to store the original graph.)
In our case, since we apply this algorithm to a graph of maximum degree $\Delta' = 2^{(\gamma/2) \sqrt{\log n}}$ and $t = O(\log \Delta' + \poly(\log\log n))$, and we get a runtime of
$$
O\Big(\frac{\log \Delta' + \poly\log\log n}{\log_{\Delta'}n} + \log \log \Delta' + \log \log \log n\Big).
$$
Since $\Delta' \leq 2^{O(\sqrt{\log n})}$, the first term is $O(1)$; since $\Delta' \leq \Delta$, the second term is at most $\log \log \Delta$.
Note that the \local{} maximal matching algorithm we are simulating here only succeeds with high probability, i.e. with probability $1 - 1/\poly(n)$. In order to amplify it to exponential success probability, we can run $n^{\gamma/2}$ separate independent executions; w.e.h.p., at least one will succeed. This multiplies the total space by $n^{\gamma/2}$, bringing the total space (aside from the storage of $G$) up to $n^{1+\gamma}$.
\end{proof}
\section{Missing Proofs}\label{apx:missingproofs}
\section{Preliminaries}
\subsection{Notation}
Throughout the paper for any positive integer $k$, we use $[k]$ to denote the set $\{1, \ldots, k\}$. For any graph $G = (V, E)$ and any $V' \subseteq V$, we let $G[V']$ denote the induced subgraph; that is, $G[V']$ contains edge $e$ in $E$ if and only if both of its endpoints are in $V'$. For a vertex $v$, we define the \emph{neighborhood} $N(v)$ to be the set of vertices $u$ with $\{u,v\} \in E$.
An edge subset $M \subseteq E$ is a {\em matching} if no two edges in $M$ share an endpoint. A matching $M$ of a graph $G$ is a {\em maximal matching} if it is not possible to add any other edge of $G$ to $M$ and it is a {\em maximum matching} if every matching in $G$ has size at most $|M|$. When it is clear from the context, we abuse notation to use $M$ for the vertex set of matching $M$. In particular, we use $G[V \setminus M]$ to denote the graph obtained by removing every vertex of $M$ from $G$. Furthermore, for any vertex $v \in V$ and matching $M$, we define the \emph{residual degree} $\deg_{M}^{\text{res}}(v)$ to be zero if $v \in M$, and otherwise $\deg_M^{\text{res}}(v) := \deg_{G[ V \setminus M ]}(v)$. Finally, we define the \emph{match-status} of vertex $v$ according to some matching $M$ to be the indicator for the event that $v \in M$.
\subsection{The \MPC{} Model}\label{sec:mpc}
The Massively Parallel Computations (\MPC{}) model was first introduced by Karloff \etal{}~\cite{DBLP:conf/soda/KarloffSV10} and further refined by \cite{DBLP:conf/isaac/GoodrichSZ11, DBLP:conf/pods/BeameKS13, DBLP:journals/jacm/BeameKS17, DBLP:conf/stoc/AndoniNOY14}. An input of size $N$ is initially distributed among $M$ machines, each with a local space of size $S$. Computation proceeds in synchronous rounds in which each machine can perform an arbitrary local computation on its data and can send messages to other machines. The messages are delivered at the start of the next round. Furthermore, the total messages sent or received by each machine in each round should not exceed its memory.
We desire algorithms that use a sublinear space per machine (i.e., $S = N^{1-\Omega(1)}$) and only enough total space to store the input (i.e., $S \cdot M = O(N)$). For graph problems, the edges of an input graph $G(V, E)$ with $n := |V|$ and $m := |E|$ are initially distributed arbitrarily among the machines, meaning that $N = \Theta(m)$ words (or $\Theta(m \log n)$ bits). Moreover, we mainly consider the regime of \MPC{} with space per machine of $S = \Theta(n)$ words.
\subsection{Concentration inequalities}
We will use two main concentration inequalities: the \emph{Efron-Stein} inequality and the \emph{bounded differences inequality}. These both concern functions $f(x_1, \dots, x_n)$ which have \emph{Lipschitz properties}, namely, changing each coordinate $x_i$ has a relatively small change to the value of $f$.
\begin{proposition}[Efron-Stein inequality \cite{steele1986efron}]\label{prop:efronstein}
Fix an arbitrary function $f: \{0, 1\}^n \to \mathbb{R}$ and let $X_1, \ldots, X_n$ and $X'_1, \ldots, X'_n$ be $2n$ i.i.d. Bernoulli random variables. For $\vec{X} := (X_1, \ldots, X_n)$ and $\vec{X}^{(i)} := (X_1, \ldots, X_{i-1}, X'_i, X_{i+1}, \ldots, X_n)$, we have
$$\var(f(\vec{X})) \leq \frac{1}{2} \cdot \E \Big[ \sum_{i=1}^n \big(f(\vec{X}) - f(\vec{X}^{(i)})\big)^2\Big].$$
\end{proposition}
We consider the following form the of the bounded differences inequality (which is a special case of McDiarmid's inequality):
\begin{proposition}[Bounded differences inequality]\label{prop:bd-dif}
Let $f$ be a $\lambda$-Lipschitz function on $k$ variables, and let $\vec{X} = (X_1, \dots, X_k)$ be a vector of $k$ independent (not necessarily identically distributed) random variables. Then,
$
\Pr \big[f(\vec{X}) \geq \E[f(\vec{X})] + t \big] \leq \exp\Big(\frac{-2 t^2}{k \lambda^2}\Big).
$
\end{proposition}
A slight reformulation of this, which is more useful for us to use directly, is the following:
\begin{proposition}\label{prop:bd-dif2}
Let $f$ be a $\lambda$-Lipschitz function on $k$ variables, and let $\vec{X} = (X_1, \dots, X_k)$ be a vector of $k$ independent (not necessarily identically distributed) random variables. Then w.e.h.p.,
$$
f(\vec{X}) \leq \E[f(\vec{X})] + \lambda n^{0.01} \sqrt{k}.
$$
\end{proposition}
\subsection{Sequential Greedy Maximal Matching}
\label{sec:greedy}
As described in Section~\ref{sec:highlevel}, a maximal matching can be found by a sequential greedy algorithm:
\begin{definition}[Greedy maximal matching]
Given a graph $G = (V, E)$ and an ordering $\pi$ over the edges in $E$, the greedy maximal matching algorithm processes the edges in the order of $\pi$ and adds an edge $e$ to the matching if none of its incident edges have joined the matching so far. We denote the resulting maximal matching by $\greedymatching{G, \pi}$.
\end{definition}
This greedy maximal matching has a number of nice properties that play a critical role in the analysis of our algorithm. We summarize these properties in Appendix~\ref{app:greedy}.
We view the permutation $\pi$ as a function mapping $E$ to $[m]$; we say that $e$ has \emph{higher priority than $e'$} if $\pi(e) < \pi(e')$. In analyzing the greedy matching algorithm, it is often convenient to use the following local method of generating the permutation: each edge $e$ is associated with a real $\rho_e \in [0,1]$; we then form $\pi$ by sorting in order of $\rho$. Slightly abusing notation, we write $\greedymatching{G, \rho}$ in this case as shorthand for $\greedymatching{G, \pi}$ where $\pi$ is the permutation associated to $\rho$.
\section{Roadmap}
As discussed in Section~\ref{sec:highlevel}, the key to proving Theorem~\ref{thm:main} and Theorem~\ref{thm:sublinearspace} is an algorithm to reduce the graph degree by a polynomial factor. The precise statement of this lemma is as follows:
\begin{lemma}[degree reduction]
\label{lem:degreereduction}
There is an $O(1)$ round \MPC{} algorithm to produce a matching $M$, with the following behavior w.e.h.p.: it uses $n/\Delta^{\Omega(1)}$ space per machine and $O(m)$ space in total, and the residual graph $G[V \setminus M]$ has maximum degree $\Delta^{1-\Omega(1)}$.
\end{lemma}
Our main result, and the technical core of our analysis in proving Lemma~\ref{lem:degreereduction} lies in showing that the following Algorithm~\ref{alg:nearmaximal} significantly reduces the degree of nearly all vertices in $G$.
\begin{tboxalg}{}\label{alg:nearmaximal}
\textbf{Input:} A graph $G = (V, E)$ with maximum degree $\Delta$.
\textbf{Output:} A matching $M$ in $G$.
\begin{enumerate}[label={(\arabic*)},ref={\arabic*}, topsep=5pt,itemsep=-0.3ex,partopsep=0ex,parsep=1ex, leftmargin=*]
\item \textbf{Permutation:} Choose a permutation $\pi$ uniformly at random over the edges in $E$.\label{line:permutation}
\item \textbf{Edge-sampling:} Let $G^L(V, L)$ be an edge-sampled subgraph of $G$ where each edge in $E$ is sampled independently with probability $p := \Delta^{-0.85}$. \label{line:edgesampling}
\item \textbf{Vertex partitioning:} Partition the vertices of $V$ into $k := \Delta^{0.1}$ groups $V_1, \ldots, V_k$ such that the partition of every vertex in $V$ is chosen independently and uniformly at random.\label{line:vertexpartitioning}
\item Each machine $i \in [k]$ receives the graph $G^L[V_i]$ and finds the greedy maximal matching $M_i := \greedymatching{G^L[V_i], \pi}$.
\item Return matching $M := \bigcup_{i=1}^{k} M_i$.
\end{enumerate}
\end{tboxalg}
Specifically, we will show the following:
\begin{lemma}\label{lem:nearmaximal}
Algorithm~\ref{alg:nearmaximal} has the following desirable behavior:
\begin{enumerate}[itemsep=-0.5ex]
\item W.e.h.p., it uses $n/\Delta^{\Omega(1)}$ space per machine.
\item W.e.h.p., it uses $O(n) + m/\Delta^{\Omega(1)}$ space in total (aside from storing the original input graph.)
\item The expected number of vertices $v \in V$ such that $\deg^{\text{res}}_M(v) > \Delta^{0.99}$ is at most $O(n/\Delta^{0.03})$.
\end{enumerate}
\end{lemma}
We will prove Lemma~\ref{lem:nearmaximal} in Section~\ref{sec:nearmaximal} and we will prove Lemma~\ref{lem:degreereduction} in Section~\ref{sec:leftoververtices}. Before this, let us show how the degree reduction algorithm of Lemma~\ref{lem:degreereduction} can be used to prove Theorem~\ref{thm:main}.
\begin{proof}[Proof of Theorem~\ref{thm:main}]
The algorithm consists of $r$ iterations that each commits a number of edges to the final maximal matching using the algorithm of Lemma~\ref{lem:degreereduction}. In each iteration, the maximum degree in the remaining graph is reduced from $\Delta$ to $\Delta^{1-\alpha}$ given that $\Delta > c$ for some constant $c$ and $\alpha$. This ensures that by the end of iteration $r$, maximum degree is at most $\max\{c, \Delta^{(1-\alpha)^{r}}\}$.
To get the first result, take $r = \Theta( \log \log \Delta )$; at the end of this process, the residual graph has degree $O(1)$. At this point, we put the entire residual graph onto a single machine, and compute its maximal matching. To get the second result, take $r = \Theta( \log (1/\delta) )$; at the end of this process, the residual graph has degree $n^{\delta}$. At this point, we again put the entire residual graph onto a single machine, and compute its maximal matching.
\end{proof}
\subsection{High Level Technical Overview}\label{sec:highlevel}
As discussed above, if the space per machine is $n^{1+\Omega(1)}$, we already know how to find a maximal matching efficiently \cite{DBLP:conf/spaa/LattanziMSV11}. The main problem, roughly speaking, is that once the space becomes $O(n)$, the computational power of {\em a single machine} alone does not seem to be sufficient to have a significant effect on the whole graph. More concretely, the known algorithms that work based on ideas such as edge-sampling the graph into a single machine and finding a matching there \cite{DBLP:conf/spaa/LattanziMSV11,DBLP:conf/spaa/BehnezhadDETY17,DBLP:conf/spaa/AhnG15}, all require $\Omega(\log n)$ rounds of repeating this procedure if the space is $O(n)$.
Vertex partitioning \cite{DBLP:conf/soda/KarloffSV10, DBLP:conf/nips/BateniBDHKLM17, DBLP:conf/stoc/CzumajLMMOS18, assadiedcs, DBLP:conf/podc/GhaffariGKMR18}, which in the context of matching was first used by \cite{DBLP:conf/stoc/CzumajLMMOS18}, helps in utilizing several machines. The general idea is to randomly partition the vertices and find a matching in the induced subgraph of each partition individually in a different machine. It turns out that the choice of the internal matching algorithm over these induced subgraphs, has a significant effect on the global progress made over the whole graph. This is, in fact, the fundamental way that the algorithms within this framework differ \cite{DBLP:conf/stoc/CzumajLMMOS18, assadiedcs, DBLP:conf/podc/GhaffariGKMR18}.
We show that \emph{greedy maximal matching}, which is perhaps the simplest matching algorithm one can think of, has several desirable structural properties that make it a perfect candidate for this purpose. This procedure iterates over the edges for some given ordering $\pi$, and at the time of processing each edge, adds it to the matching iff none of its incident edges are part of the matching so far. In other words, it is the lexicographically-first MIS of the line graph of $G$. We give a brief overview of our algorithm first, then describe the key ideas behind its analysis.
\smparagraph{The algorithm.} Our main algorithm, which is formalized as Algorithm~\ref{alg:nearmaximal}, uses three randomization steps, all of which are necessary for the analysis:
\begin{itemize}[topsep=5pt,itemsep=0ex,partopsep=0ex,parsep=1ex]
\item An ordering $\pi$ over the edges is chosen uniformly at random.
\item Each edge of the graph is sampled independently with some probability $p$.
\item For some $k$, the vertex set $V$ is partitioned into disjoint subsets $V_1, \ldots, V_k$ where the partition of each vertex is chosen independently at random.
\end{itemize}
After these steps, for any $i \in [k]$, we put the edge-sampled induced subgraph of $V_i$ into machine $i$ and compute a greedy maximal matching $M_i$ according to ordering $\pi$. We note that the choice of $k$ and $p$ in Algorithm~\ref{alg:nearmaximal} ensure that the induced subgraphs fit the memory of a machine.
\smparagraph{The analysis outline.} Observe that $M = \bigcup_{i\in[k]} M_i$ is a valid matching since the partitions are vertex disjoint. The key to our results, and the technically interesting part of our paper, is to show that if we commit the edges of $M$ to the final maximal matching, then the degree of almost all vertices drops to $\Delta^{1-\Omega(1)}$ in the residual graph. The main challenge here is to bound the vertex degrees across the partitions.
To do this, for any vertex $v$ and any partition $i \in [k]$, we let $Z_{v, i}$ denote the number of neighbors of $v$ in partition $i$ that remain unmatched in greedy matching $M_i$. Note that $Z_{v, i}$ is a random variable of the three randomizations involved in the algorithm, and that $\sum_{i \in [k]} Z_{v, i}$ is precisely equal to the remaining degree of vertex $v$. We show the abovementioned degree reduction guarantee through a concentration bound on random variable $Z_{v, i}$.
Let us first outline how a concentration bound on $Z_{v, i}$ can be useful. Suppose, wishfully thinking, that $Z_{v, i} = (1 \pm o(1)) \E[Z_{v, i}]$ for every $i \in [k]$ with high probability. By symmetry of the partitions, we have $\E[Z_{v, i}] = \E[Z_{v, 1}]$ for every $i \in [k]$. This means that all random variables $Z_{v, 1}, \ldots, Z_{v, k}$ take on the same values ignoring the lower terms. Now, if $\E[Z_{v, 1}]$ is small enough that $k \cdot \E[Z_{v, 1}] < \Delta^{1-\Omega(1)}$, we get the desired bound on residual degree of $v$. Otherwise, due to the huge number of unmatched neighbors in its own partition, we show that $v$ must have been matched and, thus, cannot survive to the residual graph!
Unfortunately, $Z_{v, i}$ is a rather complicated function and it is not straightforward to prove such sharp concentration bounds on it. Recall that Chernoff-Hoeffding bounds work only on sum of independent random variables. Furthermore, concentration bounds obtained by Azuma's or other ``dimension dependent'' inequalities seem useless for our purposes: because the partition of every vertex in the graph may potentially affect $Z_{v, i}$, these would give bounds on the order of $Z_{v, i} = \E[Z_{v, i}] \pm \widetilde{O}(\sqrt{n})$. As $\E[Z_{v,i}]$ should be on the order of $\Delta$, this is useless when $\Delta$ is small.
Instead of an exponential concentration bound, we aim for a weaker concentration bound by proving an upper bound on the variance of $Z_{v, i}$. To achieve this upper bound, we use a method known as the Efron-Stein inequality (see Proposition~\ref{prop:efronstein}) which plays a central role in our analysis. On one hand, this weaker concentration bound is still strong enough for our purpose of degree reduction. On the other hand, since we are only bounding the variance, the required conditions are much more relaxed and can be shown to be satisfied by the algorithm.
On a conceptual level, one contribution of our paper is to provide a natural example for how the Efron-Stein inequality, which is often not among the standard tools used in theoretical computer science, can be extremely useful in the analysis of randomized algorithms.
\smparagraph{How greedy maximal matching helps.} Our proof of the concentration bound relies on a number of unique properties of the random greedy maximal matching algorithm:
\begin{enumerate}[topsep=8pt,itemsep=1ex,partopsep=0ex,parsep=1ex]
\item If we run greedy maximal matching on an edge-sampled subgraph of a graph, the maximum degree in the residual graph drops significantly (see Lemma~\ref{lem:edgesamplegreedy}).
\item The set of matched vertices in the greedy maximal matching changes by a constant number of elements if a single vertex or edge is removed (see Lemma~\ref{lem:lipschitzproperties}).
\item If an ordering $\pi$ is chosen randomly and an edge $e$ of the graph is also chosen randomly, then determining whether $e$ belongs to the greedy maximal matching according to $\pi$ requires ``looking'' only at $O(d)$ edges of the graph in expectation, where $d$ is the average degree of the line graph (see Proposition~\ref{prop:greedmatchquery}).
\end{enumerate}
We summarize these properties in Appendix~\ref{app:greedy}. Property 3 was originally developed in the context of {\em sublinear time algorithms} for approximating maximum matching size. To our knowledge, it was first formalized by Nguyen and Onak~\cite{DBLP:conf/focs/NguyenO08}, with the precise bound of Proposition~\ref{prop:greedmatchquery} proved by Yoshida \etal{}~\cite{DBLP:conf/stoc/YoshidaYI09}. We find the application of this methodology in proving concentration bounds extraordinary and possibly of independent interest.
\section{Matching Almost All High-Degree Vertices:\\ Proof of Lemma~\ref{lem:nearmaximal}}\label{sec:nearmaximal}
We now turn to proving Lemma~\ref{lem:nearmaximal}. We first need some notation for the analysis of Algorithm~\ref{alg:nearmaximal}. For simplicity, we write $G_i$ for the graph $G[V_i]$. Note that $G_i$ is different from $G^L_i$ in that $G^L_i$ includes only a subset of the edges in $G_i$; those that were sampled in Line~\ref{line:edgesampling} of Algorithm~\ref{alg:nearmaximal}. We let $L_i$ be the set of edges $\{u,v\} \in L$ with $u,v \in V_i$; that is, $L_i$ is the edge-set of $G_i^L$. We further define $\chi$ to be the partition function of the vertices; that is, each vertex select a value $\chi(v)$ u.a.r from $[k]$, and then we set $V_i = \chi^{-1}(i)$. We also note that throughout the proof, we assume $m \geq n^{0.9}$. This assumption comes w.l.o.g. since otherwise one can put all the edges into one machine with even sublinear memory of $O(n^{0.9})$ and find a maximal matching there.
We begin by analyzing the residual degree of a vertex within its own partition, which are some simple consequences of the method used to generate $L$.
\begin{claim}\label{cl:edgesamplingdegrees}
The following bounds on the edge set $L$ hold w.e.h.p.:
\begin{enumerate}[itemsep=-0.5ex]
\item Every $i \in [k]$ has $|V_i| = \Theta(n/\Delta^{0.1})$.
\item The graph $G^L$ contains $O(m/\Delta^{0.85})$ edges.
\item Each graph $G_i^L$ contains $O(n/\Delta^{0.05})$ edges.
\end{enumerate}
\end{claim}
\begin{proof}
The first property follows from a straightforward Chernoff bound, noting that $\E[V_i] = n/k = n/\Delta^{0.1} \geq \poly(n)$. For the second property, observe that the expected number of edges in $G^L$ is $m\cdot p = m/\Delta^{0.85}$. As we have discussed above, we can assume that $m \geq n^{0.9}$ and we also know that $\Delta \leq n$; therefore, $m/\Delta^{0.85} \geq n^{0.05}$ and by Chernoff's bound the number of such edges is $O(m/\Delta^{0.85})$ w.e.h.p. For the third property, we consider two cases where $\Delta \geq n^{0.01}$ and $\Delta < n^{0.01}$ separately.
\smparagraph{Case 1: $\Delta \geq n^{0.01}$.} For each vertex $v \in V_i$, its incident edge $e = \{u, v\}$ will belong to $G^L_i$ if $e$ is sampled in $L$ and vertex $u$ also belongs to $V_i$. Both of these events occur at the same time with probability $p \cdot k^{-1} = \Delta^{-0.95}$. This means that the expected number of neighbors of $v$ in $G^L_i$ will be $\Delta \cdot \Delta^{-0.95} = \Delta^{0.05}$. Since we assumed $\Delta \geq n^{0.01}$, a simple Chernoff bound can show that this random variable is concentrated around $O(\Delta^{0.05})$ w.e.h.p. Combined with the first property, the number of edges in each $G^L_i$ will be $O(n/\Delta^{0.1}) \cdot O(\Delta^{0.05}) = O(n/\Delta^{0.05})$ w.e.h.p.
\smparagraph{Case 2: $\Delta < n^{0.01}$.} Let $U$ denote the number of edges in $G_i^L$. For the arguments discussed above, we still have $\E[U] \leq O(n/\Delta^{0.05})$. Furthermore, $U$ can be regarded as a function of the vertex partition $\chi$ and the edge set $L$. There are $O(n \Delta)$ such random variables, and each of these can change $U$ by at most $\Delta$. Therefore, by Proposition~\ref{prop:bd-dif2}, w.e.h.p., we have
$$
U \leq \E[U] + \Delta \cdot n^{0.01} \cdot \sqrt{O(n \Delta)};
$$
as $\Delta \leq n^{0.01}$ this in turn implies that $U \leq O(n/\Delta^{0.05})$ w.e.h.p.
\end{proof}
These allow us to prove the first two parts of Lemma~\ref{lem:nearmaximal}:
\begin{proof} [Proof of Lemma~\ref{lem:nearmaximal} part 1 and 2]
For the space bounds, Claim~\ref{cl:edgesamplingdegrees} shows that for each $G_i^L$, we require $O(n/\Delta^{0.05})$ space for its edges and $O(n/\Delta^{0.1})$ for its vertices. Since $\Delta$ is larger than any constant, this is smaller than $n/\Delta^{\Omega(1)}$. To show the bounds on total space usage note that the total edge count of all the graphs $G^L_i$ is clearly at most $|L|$, since each edge lives on at most one machine, and this is at most $m/\poly(\Delta)$. Furthermore, storing partition of each vertex requires only $O(n)$ total space.
\end{proof}
As we have discussed before, for any vertex $v \in V$ and any $i \in [k]$, we define the random variable
$$
Z_{v, i} := \bigl| V_i \cap N_{G[V \setminus M]}(v) \bigr|,
$$ to be the degree of vertex $v$ in the $i^{\text{th}}$ partition of the residual graph $G[ V \setminus M ]$. Note here that $v$ does not necessarily belong to $V_i$. With this definition, if a vertex $v$ is not matched in $M$, we have $\deg_M^{\text{res}}(v) = Z_{v, 1} + \dots + Z_{v, k}$. We further define the related random variable $Z'_v$ as:
$$
Z'_v := \begin{cases}
Z_{v, \chi(v)} & \text{if $v \notin M$} \\
0 & \text{if $v \in M$,}
\end{cases}
$$
which is equivalent to the residual degree of $v$ in its own partition.
\begin{claim}\label{cl:intrapartitiondegree}
For any vertex $v$, we have $\Pr( Z'_v > \Delta^{0.86} ) \leq \exp(-\poly(\Delta))$.
\end{claim}
\begin{proof}
We will show that this bound holds, even after conditioning on the random variables $\chi$ and $\pi$. Suppose now that $v \in V_i$ and so we need to bound the probability that $Z_{v,i} > \Delta^{0.86}$. Note, here, that $Z'_v = \deg_{M_i}^{\text{res}}(v)$. Also, $M_i$ is formed by performing independent edge sampling on $G[V_i]$ and then taking the greedy maximal matching. Thus by Lemma~\ref{lem:edgesamplegreedy}, the probability that $Z'_v > \frac{\ln(1/\beta)}{p}$ is at most $\beta$. Setting $\beta = e^{-\Delta^{0.01}}$, we have $Z'_v > \Delta^{0.86}$ with probability at most $\exp(-\poly(\Delta))$.
\end{proof}
\subsection{Analysis of the Inter-partition Degrees}
The key to analyzing Algorithm~\ref{alg:nearmaximal} is to show that for most vertices $v$, the values of $Z_{v,i}$ take on similar values across all possible indices $i$. We had sketched how this leads to the desired bound on vertex degrees in Section~\ref{sec:highlevel}; let us provide some more technical details here.
Recall from Section~\ref{sec:highlevel} that our concentration inequalities should not have an additive factor depending on $n$ or they become too weak to be useful as $\Delta$ gets smaller. To overcome this, we show that with careful analysis, the Efron-Stein inequality (Proposition~\ref{prop:efronstein}) yields our desired concentration bound; in particular, it gives concentration on the order $Z_{v,i} = \E[Z_{v,i}] \pm \Delta^{1-\Omega(1)}$. However, we emphasize that this concentration bound is \emph{not} with exponentially high probability, or even with high probability: it only holds with a relatively small probability $1 - 1/\poly(\Delta)$. This is the reason that we can only show that the number of high-degree vertices reduces by a $1/\poly(\Delta)$ factor, and not that Algorithm~\ref{alg:nearmaximal} reduces the maximum degree outright.
Due to symmetry, we may consider showing a concentration bound for $Z_{v,1}$. Let us furthermore assume that $L$ and $\pi$ have been fixed. Therefore, $Z_{v, 1}$ becomes only a function of the vertex partitioning $\chi$, or more precisely, a function of the set of vertices that belong to partition $V_1$. Let us define the vector $\vec x$, by setting $x_v = 1$ if $\chi(v) = 1$, and $x_v = 0$ otherwise. We may write $Z_{v, 1}(\vec{x})$ to emphasize that $Z_{v, 1}$ is merely a function of $\vec{x}$. Observe that $\vec{x}$ is a vector of $n$ i.i.d. Bernoulli-$1/k$ random variables. To use the Efron-Stein inequality for bounding the variance, we have to upper bound the right-hand-side of inequality
\begin{equation}\label{eq:efronvertex}
\var(Z_{v, 1}) \leq \frac{1}{2}\E_{\vec{x}}\Big[\sum_{w \in V} \big(Z_{v, 1}(\vec{x}) - Z_{v, 1}(\vec{x}^{(w)})\big)^2\Big],
\end{equation}
where $\vec{x}^{(w)}$ is obtained by replacing the value of $x_w$ in $\vec{x}$ with $x'_w$ which is drawn independently from the same distribution. In other words, the $w$ summand of (\ref{eq:efronvertex}) corresponds to the effect of repartitioning vertex $w$ on the value of $Z_{v, 1}$. Thus, we need to show that for most of the vertices in $V$, whether they belong to $V_1$ or not does not affect $Z_{v, 1}$.
To show this, consider a game where we determine $Z_{v, 1}(\vec{x})$ by querying entries of $\vec{x}$. The queries can be conducted adaptively, i.e., each query can depend on the answers to previous queries. If we show an upper bound $\beta_v$ on the number of queries required to determine $Z_{v, 1}(\vec{x})$, then no matter what the other $n - \beta_v$ entries of $\vec{x}$ are, $Z_{v, 1}(\vec{x})$ remains unchanged and so clearly $Z_{v, 1}(\vec{x}) - Z_{v, 1}(\vec{x}^{(w)}) = 0$ for all such unqueried vertices $w$. (The subscript $v$ in $\beta_v$ is used to emphasize that the upper bound can be different for different choices of $v$.) Therefore, one way to show that most vertices of $V$ do not affect $Z_{v, 1}$ is to design an efficient query process. We also note a particularly useful property of the Efron-Stein inequality in (\ref{eq:efronvertex}) is that even an upper bound on the expected number (taken over choice of $\vec{x}$) of queries suffices.
In addition to showing that most vertices do not affect $Z_{v,1}$, we also need to show that the query process yields an appropriate Lipschitz property on $Z_{v, 1}$ as well. That is, even if the query process can guarantee $Z_{v, 1}(\vec{x}) - Z_{v, 1}(\vec{x}^{(w)}) = 0$ for most vertices $w$, we still have to bound the value of $(Z_{v, 1}(\vec{x}) - Z_{v, 1}(\vec{x}^{(w)}))^2$ on those vertices $w$ where $Z_{v, 1}(\vec{x}) \not= Z_{v, 1}(\vec{x}^{(w)})$. This also follows from the nice structure of the greedy maximal matching algorithm.
\begin{claim}[Lipschitz property]\label{cl:lipschitz}
For any vertex partitioning $\vec{x}$, let $\vec{x}^{(w)}$ be obtained by changing the $w$ index of $\vec{x}$. Then $(Z_{v, 1}(\vec{x}) - Z_{v, 1}(\vec{x}^{(w)}))^2 \leq 4$.
\end{claim}
\begin{proof}
Suppose that $x_w = 0$ which means $x^{(w)}_w = 1$. Let $V_1$ and $V'_1$ denote the vertex partitions due to $\vec{x}$ and $\vec{x}^{(w)}$ respectively, i.e., $V_1 = \{ u \mid x_u = 1 \}$ and $V'_1 = \{ u \mid x^{(w)}_u = 1 \}$. Observe that $V_1$ and $V'_1$ differ in only one vertex $w$ which belongs to $V'_1$ but not $V_1$. Define $M_1 := \greedymatching{G[V_1], \pi}$ and $M'_1 := \greedymatching{G[V'_1], \pi}$. By Lemma~\ref{lem:lipschitzproperties} part 1, there are at most two vertices in $V$ whose match-status differs between $M_1$ and $M'_1$. Even if these two vertices happen to be neighbors of $v$, we still have $|Z_{v, 1}(\vec{x}) - Z_{v, 1}(\vec{x}^{(w)})| \leq 2$ and thus get the desired bound. The case with $x_w = 1$ and $x^{(w)}_w=0$ follows from a similar argument.
\end{proof}
The Lipschitz property can be plugged directly into (\ref{eq:efronvertex}) to show $\var(Z_{v, 1}) \leq O(n\Delta^{-0.1})$. In what follows, however, we describe a query process which significantly reduces this upper bound to $\poly(\Delta)$ for nearly all the vertices, i.e., removes the dependence on $n$.
\smparagraph{The query process.} We start with a query process to determine whether a given edge belongs to matching $M_1(\vec{x})$ -- where here we write $M_1(\vec{x})$ to emphasize that the parameters $\pi, L$ should be regarded as fixed and so matching $M_1$ is only a function of the vertex partitioning $\vec{x}$. This process is very similar to a generic edge oracle for the greedy matching (which we briefly discuss in Appendix~\ref{app:greedy}), except that instead of querying the edges, it queries the entries of the vector $\vec{x}$.
Suppose that we have to determine whether a given edge $e \in L$ belongs to the matching $M_1(\vec{x})$. Instead of revealing the whole vector $\vec{x}$, first note that if one of the end-points of $e$ does not belong to $V_1$, then $e$ cannot be in the induced subgraph $G^L_1$ and thus we can answer $\no$ immediately. Suppose that $e$ appears in $G^L_1$. Since the greedy maximal matching algorithm processes the edges in the order of $\pi$, it suffices to recursively determine whether any of the incident edges to $e$ belongs to $M_1(\vec{x})$ in the order of their priorities. At any point that we find such incident edge to $e$, we immediately return \no{} as $e$ certainly cannot join $M_1(\vec{x})$. Otherwise $e$ has to join $M_1(\vec{x})$, thus we return \yes{}. We summarize the resulting query process as $\edgeoracle_{\pi}(e, \vec{x})$:
\begin{titledtbox}{$\edgeoracle_{\pi}(e, \vec{x})$: A query-process to determine whether $e \in M_1(\vec{x})$.}
\begin{algorithmic}
\State Let $e = \{u, v\}$. Query $x_u$ and $x_v$; \textbf{if} $x_u = 0$ or $x_v = 0$, \textbf{then} \Return \no.
\State Let $e_1, \ldots, e_d$ be the incident edges to $e$ in $G^L$ sorted as $\pi(e_1) < \pi(e_2) < \dots < \pi(e_d)$.
\For{$i = 1, \ldots, d$}
\If{$\pi(e_i) < \pi(e)$}
\State \textbf{if} {$\edgeoracle_{\pi}(e_j, \vec{x}) = \yes$} \textbf{then return} \no{}
\EndIf
\EndFor
\State \Return \yes{}
\end{algorithmic}
\end{titledtbox}
We also define a {\em degree oracle} $\degreeoracle_{\pi}(v, \vec{x})$ to determine the value of $Z_{v, 1}(\vec{x})$. This checks whether each $w \in N_G(v)$ appears in $V_1$ and is matched, which in turn requires checking whether every edge incident to $w$ appears in matching of $G^L[V_1]$:
\begin{titledtbox}{$\degreeoracle_{\pi}(v, \vec{x})$: A query process to determine the value of $Z_{v, 1}(\vec{x})$.}
\begin{algorithmic}
\State $c \gets 0$
\For{all vertices $u \in N_G(v)$}
\State Query $x_u$.
\If{$x_u = 1$}
\State Execute $\edgeoracle_{\pi}( (u, w), \vec{x})$ for all vertices $w \in N_{G^L}(u)$.
\State \textbf{if} $\edgeoracle_{\pi}( (u, w), \vec{x}) = \no{}$ for all such vertices $w$ \textbf{then} $c \gets c+1$ \Comment{$u$ is unmatched in $M_1$}
\EndIf
\EndFor
\State \Return $c$
\end{algorithmic}
\end{titledtbox}
\smparagraph{Analysis of the query complexity.} We now analyze the {\em query complexity} of the oracle $\degreeoracle_{\pi}$, i.e., the number of indices in $\vec{x}$ that it queries. For any vertex $v$, we let $B(v)$ denote the number of vertices that are queried when running $\degreeoracle_{\pi}(v)$. This is precisely the quantity that we need to bound for arguing that $\var(Z_{v, 1})$ is small according to (\ref{eq:efronvertex}). Formally:
\begin{claim}\label{cl:varboundedbyB}
Fix any $\vec{x}, \pi, L$ and and let $\vec{x}^{(w)}$ be a vector obtained by resampling the index $x_w$. Then
$$
\sum_{w \in V} (Z_{v, 1}(\vec{x}) - Z_{v, 1}(\vec{x}^{(w)}))^2 \leq 4 B(v).
$$
\end{claim}
\begin{proof}
By definition, the value of $Z_{v, 1}(\vec{x})$ can be uniquely determined by only revealing indices of $\vec{x}$ which are quered by $\degreeoracle_\pi(v, \vec{x})$. Therefore, changing other indices $w$ of $\vec{x}$ cannot affect $Z_{v, 1}$ and so $Z_{v, 1}(\vec{x}) - Z_{v, 1}(\vec{x}^{(w)}) = 0$. There are $B(v)$ indices queries by $v$. For any such index $w$, Claim~\ref{cl:lipschitz} shows that $(Z_{v, 1}(\vec{x}) - Z_{v, 1}(\vec{x}^{(w)}))^2 \leq 4$.
\end{proof}
To bound $B(v)$, let us first define $A(e)$ for an edge $e \in L_1$ to be the number of edges in $L_1$, on which the edge oracle is called (recursively) in the course of running $\edgeoracle_\pi(e, \vec{x})$. Note that when running $\edgeoracle$, only edges that are in $L_1$ can generate new recursive calls; other edges are checked, but immediately discarded.
\begin{claim}
\label{claim:aebound}
We have $\E [ \sum_{e \in L_1} A(e) ] \leq O( n )$ where the expectation is taken over $\chi$, $L$, and $\pi$.
\end{claim}
\begin{proof}
Let us first suppose that the random variables $L$ and $\chi$ are fixed. Thus also $G_i^L$ is determined. The only randomness remaining is the permutation $\pi$. As we are only interested in edges of $L_1$, the edges outside $L_1$ have no effect on the behavior of $\edgeoracle_{\pi}$. Thus, $A(e)$ is essentially the query complexity of $\greedymatching{G_1, \pi}$ under a random permutation. By Proposition~\ref{prop:greedmatchquery}, we have:
$$
\E_{\pi} \Big[ \sum_{e \in L_1} A(e) \mid L, \chi \Big] \leq O( |L_1| + |R_1|),
$$
where $R_1$ is the set of intersecting edge pairs in $G_1$. Integrating now over the random variables $L$ and $\chi$, we get:
$$
\E \Big[ \sum_{e \in L_1} A(e) \Big] \leq O( \E[ |L_1| + |R_1| ]).
$$
Each edge $e \in E$ goes into $L_1$ with probability $p/k^2 = \Delta^{-1.05}$, and so $\E[ |L_1| ] = m \Delta^{-1.05}$. Likewise, $G$ contains at most $m \Delta / 2$ pairs of intersecting edges and each of these survives to $R_1$ with probability $p^2/k^3 = \Delta^{-2}$. Therefore, $\E[ |R_1| ] \leq m \Delta^{-1}$. Since $m \leq n \Delta$, we therefore get $\E[ \sum_{e \in L_1} A(e) ] \leq O( n ).$
\end{proof}
\begin{claim}
\label{cl:l1tol}
Suppose that we condition on the event that when running $\degreeoracle_{\pi}(v, \vec x)$, we make a total of $t$ calls to $\edgeoracle_{\pi}(e, \vec{x})$ with $e \in L_1$. Then the expected number of total entries of $\vec x$ queried during $\degreeoracle_{\pi}(v, \vec x)$ is at most $O(\Delta^{1.15} + t \Delta^{0.15})$.
\end{claim}
\begin{proof}
Let us condition on the random variables $\chi, L_1$ and $\pi$. This determines the full listing of all edges in $L_1$ that are queried during the execution of $\degreeoracle_{\pi}(v)$, because only such edges can generate new recursive calls to $\edgeoracle_{\pi}$. Thus, if we show that this bound holds conditioned on $\chi, L_1, \pi$ it will also show that it holds conditioned on the value $t$. The only remaining randomness at this point is the set $L \setminus L_1$.
Let $J$ denote the set of edges in $L_1$ queried during $\degreeoracle_{\pi}(v, \vec{x})$, with $|J| = t$. Then $\degreeoracle_{\pi}(v, \vec x)$ will query $x_u$ for all $u \in N_G(v)$, and it will query $w$ for all $w \in N_{G^L}(u)$ for all such $u \in N_G(v)$. Finally, whenever it encounters edge $e \in J$, it will call $\edgeoracle_{\pi}(f, \vec{x})$ for some edges $f \in L \setminus L_1$ which touch $e$; each of these will query two vertices, but the query process will not proceed further when they are discovered to lie outside $L_1$.
The number of vertices $u \in N_G(v)$ queried is clearly at most $\Delta$. Now let us fix some $u \in N_G(v)$ and count the number of vertices $w \in N_{G^L}(u)$ queried. This is precisely $\deg_{L}(u)$, and for any fixed $u$, the expected number of such vertices $w$ is at most $\Delta p = \Delta^{0.15}$. Thus, the total expected number of queried vertices in the first two categories is at most $\Delta^{1.15}$.
Finally, let us consider some edge $e = (a,b) \in J$. The number of corresponding queried edges of $L \setminus L_1$ is at most $\deg_{L \setminus L_1}(a) + \deg_{L \setminus L_1}(b)$. Clearly again, for any fixed $e$ we have $\E[ \deg_{L \setminus L_1}(a) ] \leq \Delta p = \Delta^{0.15}$ and similarly for $b$. Thus, the expected number of queried entries of $\vec{x}$ corresponding to edge $e$ is at most $4 \Delta^{0.15}$.
Putting all these together, the expected number of queried entries of $\vec{x}$ is $O(\Delta^{1.15} + t \Delta^{0.15})$.
\end{proof}
\begin{lemma}\label{lem:boundonA}
We have $\E[ \sum_{v \in V} B(v) ] \leq O( n \Delta^{1.15})$ where the expectation is taken over $\chi, L, \pi$.
\end{lemma}
\begin{proof}
For any vertex $v \in V$, let us first define $B'(v)$ to the number of edges in $L_1$ that are queried in the course of running $\degreeoracle_{\pi}(v)$. This can be bounded by:
$$
B'(v) \leq \sum_{u \in N_G(v) \cap V_1} \sum_{w: (u,w) \in L_1} A(u, w).
$$
Summing over $v \in V$, we get:
\begin{align*}
\sum_v B'(v) &\leq \sum_v \sum_{u \in N_G(v) \cap V_1} \sum_{w: (u,w) \in L_1} A(u, w) \leq \sum_{(u,w) \in L_1} A(u,w) \Bigl( \sum_{v \in N_G(u)} 1 + \sum_{v \in N_G(w)} 1 \Bigr) \leq 2 \Delta \sum_{e \in L_1} A(e).
\end{align*}
Taking expectations and applying Claim~\ref{claim:aebound}, we therefore have
$$
\E \Big[ \sum_v B'(v) \Big] \leq 2 \Delta \E \Big[ \sum_{e \in L_1} A(e) \Big] \leq O( \Delta n ).
$$
By Claim~\ref{cl:l1tol}, we have $\E[ B(v) \mid B'(v) = t] \leq O( \Delta^{1.15} + t \Delta^{0.15})$ for any vertex $v$. This further implies that $\E[ B(v) ] \leq O(\Delta^{1.15} + \E[ B'(v)] \Delta^{0.15})$; thus
$$
\E \Big[ \sum_v B(v) \Big] \leq O\Big( \Delta^{0.15} \E \Big[ \sum_v B'(v) \Big] + \Delta^{1.15} n \Big) \leq O( \Delta^{1.15} n),
$$
as desired.
\end{proof}
We now say that a vertex $v$ is \emph{bad} if $\E_{\vec{x}}[B(v) \mid \pi, L] > \Delta^{1.4}$ (i.e., $\Omega(\Delta^{0.25})$ times larger than the average value given by Lemma~\ref{lem:boundonA}) and {\em good} otherwise. Let us define $\mathcal B$ to be the set of bad vertices. Note that, because $\mathcal B$ is based on a conditional expectation, it is determined solely by the random variables $\pi, L$.
\begin{claim}\label{cl:fewbads}
The expected size of $\mathcal B$ satisfies $\E_{\pi, L}[ |\mathcal B| ] \leq O( n/\Delta^{0.25} )$.
\end{claim}
\begin{proof}
Observe that we have $\sum_{v \in V} \E_{\chi} [B(v) \mid \pi, L] \geq |\mathcal B| \cdot \Delta^{1.4}$ with probability one since for each bad vertex $v \in \mathcal B$, by definition the expected value of $B(v)$ is at least $\Delta^{1.4}$. Taking expectations over $\pi$ and $L$, we therefore get
$$
\E_{\pi, L}[ |\mathcal B| ] \leq \Delta^{-1.4} \cdot \E_{\pi, L} \bigg[ \sum_{v \in V} \E_{\vec{x}} [B(v) ] \mid \pi, L] \bigg] = \Delta^{-1.4} \sum_{v \in V} \E[B(v)].
$$
By Lemma~\ref{lem:boundonA}, we have $ \sum_{v \in V} \E[ B(v)] \leq O(\Delta^{1.15} n)$. Putting these two bounds together gives $\E[ |\mathcal B| ] \leq O(n \Delta^{-0.25})$.
\end{proof}
\begin{claim}\label{cl:goodsmallvariance}
For any $\pi, L$, any good vertex $v$ has $\var(Z_{v, 1} \mid \pi, L) \leq O(\Delta^{1.4})$.
\end{claim}
\begin{proof}
By Claim~\ref{cl:varboundedbyB}, for any vertex partitioning $\vec{x}$, we have $\sum_{w \in V} (Z_{v, 1}(\vec{x}) - Z_{v, 1}(\vec{x}^{(w)}))^2 \leq 4 B(v)$, where $\vec{x}^{(w)}$ is obtained by changing the $w$ entry of $\vec{x}$. If we fix $\pi, L$ and take expectations over $\vec{x}$, this gives
$$
\E_{\vec{x}}\Big[\sum_{w \in V} (Z_{v, 1}(\vec{x}) - Z_{v, 1}(\vec{x}^{(w)}))^2 \mid \pi, L \Big] \leq 4 \E_{\vec{x}}[B(v) \mid \pi, L].
$$
On the other hand, by (\ref{eq:efronvertex}), any vertex $v$ has
$$
\var(Z_{v, 1} \mid \pi, L) \leq \frac{1}{2}\E_{\vec{x}}\Big[\sum_{w \in V} \big(Z_{v, 1}(\vec{x}) - Z_{v, 1}(\vec{x}^{(w)})\big)^2 \mid \pi, L \Big].
$$
Combining the two inequalities gives $\var(Z_{v, 1} \mid \pi, L) \leq 2 \E[ B(v) \mid \pi, L]$. Since $v$ is good with respect to $\pi, L$, it satisfies $\E_{\vec{x}} [B(v) \mid \pi, L]\leq O(\Delta^{1.4})$ by definition. Thus $\var(Z_{v, 1} \mid \pi, L) \leq O(\Delta^{1.4})$.
\end{proof}
We are now ready to prove the main part of Lemma~\ref{lem:nearmaximal}.
\begin{proof} [Proof of Lemma~\ref{lem:nearmaximal}, part (3)]
For each vertex $v \in V$, define the random variable $y_v$ to be the indicator function that $\deg_M^{\text{res}}(v) > \Delta^{0.99}$ after running Algorithm~\ref{alg:nearmaximal}. We need to show that $\E[ \sum_{v \in V} y_v ] \leq O(n/\Delta^{0.03})$.
Depending on $\pi$ and $L$, let us partition the vertices in $V$ into two subsets $\mathcal{B}$ and $\mathcal{G}$ of respectively bad and good vertices as defined before. Furthermore, fix $\tau = 2 \Delta^{0.86}$ and partition the set $\mathcal{G}$ of good vertices into two subsets $\mathcal{H}$ and $\mathcal{L}$ where for any vertex $v \in \mathcal{H}$, $\E_{\vec{x}}[Z_{v, 1} \mid \pi, L] \geq \tau$ and for any $v \in \mathcal{L}$, $\E_{\vec{x}}[Z_{v, 1} \mid \pi, L] < \tau$. We have:
\begin{equation*}
\sum_{v \in V} y_v = \sum_{v \in \mathcal{B}} y_v + \sum_{v \in \mathcal{L}} y_v + \sum_{v \in \mathcal{H}} y_v.
\end{equation*}
By Claim~\ref{cl:fewbads}, we know directly that $\E[ |\mathcal{B}| ] \leq O(n/\Delta^{0.25})$. Since $y_v \leq 1$ for any vertex $v$, we have $\E[\sum_{v \in \mathcal{B}}y_v] \leq \E[|\mathcal{B}|] \leq O(n/\Delta^{0.25})$.
Now, for any fixed $v \in V$, we compute the probability of the event that $v \in \mathcal L$ and $y_v = 1$ (respectively, $v \in \mathcal H$ and $y_v = 1$); we show that each such event has probability $O(\Delta^{-0.03})$.
\smparagraph{Good vertices of type $\mathcal{L}$.} Recall that $\deg_M^{\text{res}}(v) \leq Z_{v, 1} + \ldots + Z_{v, k}$ where $k = \Delta^{0.1}$ denotes the number of partitions. Taking expectations we get
$$\E[\deg_M^{\text{res}}(v) \mid \pi, L] \leq \E[Z_{v, 1} + \ldots + Z_{v, k} \mid \pi, L] = k\E[Z_{v, 1} \mid \pi, L]$$
where the latter equality for symmetry of the partitions. If $v \in \mathcal L$, then $\E[Z_{v, 1} \mid \pi, L] < \tau$, thus, $\E[\deg_M^{\text{res}}(v) \mid \pi, L] \leq k\tau = \Delta^{0.1} \cdot 2 \Delta^{0.86} =2 \Delta^{0.96}$. By Markov's inequality, $\Pr[\deg_M^{\text{res}}(v) > \Delta^{0.99} \mid \pi, L] < O(\Delta^{-0.03})$. Therefore, $\Pr[y_v = 1 \wedge v \in \mathcal{L} \mid \pi, L] \leq O(\Delta^{-0.03})$. Integrating over $\pi, L$ also $\Pr[y_v = 1 \wedge v \in \mathcal{L}] \leq O(\Delta^{-0.03})$ as desired.
\smparagraph{Good vertices of type $\mathcal{H}$.} We show that good vertices of type $\mathcal{H}$ are highly likely to be matched in their own partition and thus not too many of them will remain in the graph. For such a vertex $v$, one of the following two events must occur: either $Z'_{v} \geq \Delta^{0.86}$ or $Z'_{v} < \Delta^{0.86}$. The first of these events has probability $\exp(-\poly(\Delta)) \ll \Delta^{-0.03}$ by Claim~\ref{cl:intrapartitiondegree}. We next need to bound the probability of having $v \in \mathcal H$ and also having $Z'_v \leq \Delta^{0.86}$. If this occurs, by definition of $Z'_v$, we have at least one index $j \in [k]$ with $Z_{v,j} < \Delta^{0.86}$. We bound the occurrence probability of this event.
Since $v \in \mathcal{H}$, by definition it is a good vertex and thus Claim~\ref{cl:goodsmallvariance} shows that $\var(Z_{v, i} \mid \pi, L) \leq O(\Delta^{1.4})$. Also, $\E[ Z_{v,i} \mid \pi, L] \geq 2 \Delta^{0.86}$. Therefore, by Chebyshev's inequality, for any fixed $i \in [k]$,
\begin{align*}
\Pr \big[ Z_{v,i} < \Delta^{0.86} \mid \pi, L \big] &\leq \Pr \Big[ \big|Z_{v,i} - \E[Z_{v,i} \mid \pi, L]\big| \geq 2 \Delta^{0.86} - \Delta^{0.86} \Big]\\
& \leq O\bigg(\frac{\var(Z_{v,i} \mid \pi, L)}{ (\Delta^{0.86})^2}\bigg) \leq O\bigg(\frac{\Delta^{1.4}}{\Delta^{1.72}}\bigg) \leq O(\Delta^{-0.32}).
\end{align*}
By a union bound over the $k = \Delta^{0.1}$ choices of $j$, we have
$$
\Pr \big[ v \in \mathcal{H} \text{ and there exists some $j \in [k]$ with $Z_{v, j} \leq \Delta^{0.86}$} \mid \pi, L \big] \leq O(\Delta^{-0.22}).
$$
This means that overall, the probability that $y_v = 1$ and $v \in \mathcal H$ is $O(\Delta^{-0.22})\ll O(\Delta^{-0.03})$.
\end{proof}
| {'timestamp': '2019-10-18T02:04:13', 'yymm': '1901', 'arxiv_id': '1901.03744', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03744'} | arxiv |
\section*{APPENDIX}
\input{sec_for_arXiv_v2/11_appendix_pwm_ineq_reformulation}
\input{sec_for_arXiv_v2/11_appendix_inner_problem_proofs}
\input{sec_for_arXiv_v2/11_appendix_formulation_for_solver}
\bibliographystyle{IEEEtran}
\section{Dynamic Programming (DP) Formulation} \label{sec:dp}
\subsection{Stochastic Optimal Control Formulation and Assumptions} \label{sec:dp:soc}
We consider discrete time, infinite horizon, discounted cost, stochastic optimal control problems over continuous state and action spaces.
The state of the system at time $t$ is denoted by $\smash{x_t \!\in\! \mathcal{X} \subseteq \rdim{n_x}}$. The system state is influenced by the control decisions $\smash{u_t \!\in\! \mathcal{U} \subseteq \rdim{n_u}}$, and by the stochastic exogenous disturbance $\smash{\xi_t \!\in\! \Xi \subseteq \rdim{n_\xi}}$. In this setting, the states evolves according to the function $\smash{g:\mathcal{X} \!\times\! \mathcal{U} \!\times\! \Xi \rightarrow \mathcal{X}}$ as $\smash{x_{t+1} = g\left( x_t , u_t , \xi_t \right)}$, incurring the stage cost $\gamma^t \, l\left(x_t,u_t\right)$ at each time step, where $\smash{\gamma \!\in\! \left[0,1\right)}$ is the discount factor.
By $\Pi$ we denote the set of all feasible deterministic Markov policies, defined as $\smash{\setdef{\pi(\cdot)}{\pi(x) \!\in\! \mathcal{U} ,\, \forall x\!\in\!\mathcal{X}}}$.
The goal is to find a policy $\smash{x_t \mapsto \pi\left(x_t\right)}$ that minimizes the cumulative cost over an infinite horizon, with initial condition $x\!\in\!\mathcal{X}$,
\begin{equation} \label{eq:soc_general}
\begin{aligned}
V^\ast(x) \,:=\,
\inf\limits_{\pi\in\Pi} \hspace{0.15cm}&
\mathbb{E} \left[\, \sum\nolimits_{t=0}^{\infty} \, \gamma^t \, l(x_t,u_t) \,\right]
\\
\text{s.t.} \hspace{0.15cm}& x_{t+1} \,=\, g\left( x_t , u_t , \xi_t \right)
\,,\hspace{0.2cm}
\forall t \geq 0
\,,
\\
& u_t = \pi(x_t)
\,,\hspace{1.7cm}
\forall t \geq 0
\,,
\\
& x_t \in \mathcal{X}
\,,\hspace{0.2cm}
u_t \in \mathcal{U}
\,,\hspace{0.85cm}
\forall t \geq 0
\,,
\\
& x_0 = x
\,.
\end{aligned}
\end{equation}
The function $\smash{V^\ast : \mathcal{X} \rightarrow \rdim{}}$ is the value function that represents the optimal cost-to-go from any state of the system if the optimal control policy is played.
To ensure that the problem is well posed we work in that same setting as \cite[\S 6.3]{hernandez_2012_discreteTimeMCP}, specifically under \cite[Assumption~4.2.1(a)]{hernandez_2012_discreteTimeMCP} that the stage cost is lower semi-continuous, non-negative, and inf-compact, and also under \cite[Assumptions 4.2.1(b), 4.2.2]{hernandez_2012_discreteTimeMCP}.
The assumptions ensure that from the class of time-varying stochastic policies, the minimum is attained by a stationary deterministic policy, see \cite[Theorem 4.2.3]{hernandez_2012_discreteTimeMCP}.
Finally, $\mathcal{F}\!\left(\mathcal{X}\!\times\!\mathcal{U}\right)$ and $\mathcal{F}\!\left(\mathcal{X}\right)$ are defined as the vector spaces of bounded, real-valued, Borel-measurable functions on $\mathcal{X} \! \times \! \mathcal{U}$ and $\mathcal{X}$ respectively, where \cite[Definition 6.3.2, 6.3.4]{hernandez_2012_discreteTimeMCP} provides the definitions of boundedness.
\subsection{Linear Programming (LP) Formulation of DP} \label{sec:dp:lp}
Solving the stochastic optimal control problem is equivalent to finding $V^\ast$ as the solution of the Bellman equation \cite{bellman_1952_theory},
\begin{equation} \label{eq:bellman}
V^\ast(x) = \underbrace{
\inf\limits_{u\in\mathcal{U}}
\,\,
\overbrace{
\Big\{\,
l(x,u) \,+\, \gamma \, \expval{}{V^\ast\left( g(x,u,\xi) \right)}
\,\Big\}
}^{\left(\bellmanOp[u]{}V^\ast\right)(x,u)}
}_{\left(\bellmanOp{}V^\ast\right)(x)}
\,,\hspace{0.1cm}
\forall \, x\!\in\!\mathcal{X}
\,.
\end{equation}
$\bellmanOp{}$ is known as the Bellman operator, and the $\bellmanOp[u]{}$ operator represents the cost of making decision $u$ now and then playing optimally from the next time step forward. The optimal policy can be defined using $V^\ast$ by,
\begin{equation} \label{eq:greedy_policy}
\pi^{\ast}(x) \,=\,
\left\{\,
\argmin{u\in\mathcal{U}} \hspace{0.1cm} l(x,u) \,+\, \gamma \, \expval{}{V^\ast\left( g(x,u,\xi) \right)}
\,\right\}
\,.
\end{equation}
The existence of a $V^\ast$ and $\pi^{\ast}$ that are Borel measurable and attain the infimum is ensured by \cite[Assumptions 4.2.1(a), 4.2.1(b), 4.2.2]{hernandez_2012_discreteTimeMCP}.
If $\nu(\cdot)$ is a finite measure on $\mathcal{X}$ that assigns positive mass to all open subsets of $\mathcal{X}$, then it can be shown that the solutions of the following linear program,
\begin{subequations} \label{eq:lp_for_V}
\begin{align}
\max_{V} \hspace{0.15cm}&
\int\nolimits_{\mathcal{X}} \, V(x) \, \nu(\intd{x})
\label{eq:lp_for_V:objective}
\\
\text{s.t.} \hspace{0.15cm}&
V \in \mathcal{F}\!\left(\mathcal{X}\right)
\\
& V(x) \,\leq\, \left( \bellmanOp[u]{} V \right) (x,u)
\,, \hspace{0.3cm}
\forall \, x\in\mathcal{X} ,\, u\in\mathcal{U}
\label{eq:lp_for_V:bellman_ineq}
\end{align}
\end{subequations}
satisfy \eqref{eq:bellman} for $\nu$-almost all ($\nu$-a.a.) $\smash{x\!\in\!\mathcal{X}}$, see \cite[\S 6.3]{hernandez_2012_discreteTimeMCP}. Constraint \eqref{eq:lp_for_V:bellman_ineq} is referred to as the \emph{Bellman Inequality}.
A key feature of the LP formulation is that any choice of $\nu(\cdot)$ that places mass over the whole state space $\mathcal{X}$ leads \eqref{eq:lp_for_V} to recover a solution of the stochastic optimal control problem.
\subsection{Point-wise Maximum Formulation of DP} \label{sec:dp:pwm}
Following \cite{beuchat_2017_pwm_at_CDC}, we introduce additional decision variables and use a point-wise maximum of value functions in the objective and the Bellman inequality constraint,
\begin{subequations} \label{eq:pwm_nlp_for_V}
\begin{align}
\max_{V_1 , \dots , V_J} \hspace{0.15cm}&
\int\nolimits_{\mathcal{X}} \, V_{\mathrm{PWM}}(x) \, \nu(\intd{x})
\label{eq:pwm_nlp_for_V:objecitve}
\\
\text{s.t.} \hspace{0.15cm}&
V_j \in \mathcal{F}\!\left(\mathcal{X}\right)
\,,\hspace{0.3cm}
j=1,\dots,J
\\
& V_{\mathrm{PWM}}(x) \leq \left( \bellmanOp[u]{} V_{\mathrm{PWM}} \right) (x,u)
, \hspace{0.14cm}
\forall \, x\!\in\!\mathcal{X} ,\, u\!\in\!\mathcal{U}
\label{eq:pwm_nlp_for_V:pwm_ineq}
\\
& V_{\mathrm{PWM}}(x) = \max\limits_{j=1,\dots,J} \, V_j(x)
, \hspace{0.60cm}
\forall \, x\!\in\!\mathcal{X}
\end{align}
\end{subequations}
where $\smash{J\!\in\!\ndim{}}$ specifies the number of value function decision variables.
We refer to problem \eqref{eq:pwm_nlp_for_V} as the \emph{point-wise maximum formulation}, and the key difference from \cite{beuchat_2017_pwm_at_CDC} is the use of the point-wise maximum $V_{\mathrm{PWM}}$ in the objective \eqref{eq:pwm_nlp_for_V:objecitve}.
The following lemma establish some important properties of \eqref{eq:pwm_nlp_for_V}.
\vspace{0.1cm}
\begin{lemma} \label{thm:pwm_equivalence}
Problems \eqref{eq:lp_for_V} and \eqref{eq:pwm_nlp_for_V} are equivalent in the sense that there exist mappings between the feasible solutions and the optimal solutions of the two problems. Moreover, objective \eqref{eq:pwm_nlp_for_V:objecitve} is jointly convex in the decision variables $V_j$, $\smash{j\!=\!1,\dots,J}$.
\end{lemma}
\begin{IEEEproof}
Under the assumptions and definitions of Section~\ref{sec:dp:soc}, one can easily see there is a mapping between feasible solutions since the space $\mathcal{F}\!\left(\mathcal{X}\right)$ is closed under the maximum operation, i.e., $V_j \!=\! V$ for all $x\!\in\!\mathcal{X}$, $\smash{j\!=\!1,\dots,J}$ in one direction, and $V \!=\! V_{\mathrm{PWM}}$ for all $x\!\in\!\mathcal{X}$ in the other direction. This gives equivalent objective value by construction, and thus $\int V^\ast d\nu$ is the optimal value for both \eqref{eq:lp_for_V} and \eqref{eq:pwm_nlp_for_V}.
The function $V_{\mathrm{PWM}}$ is convex in $V_j$, $\smash{j\!=\! 1,\dots,J}$ by definition of the $\max$ function over a finite number of elements. Thus \eqref{eq:pwm_nlp_for_V:objecitve} is convex as integration is a linear operation, see for example \cite[Lemma 2.1]{bertsekas_1973_stochopt}.
\end{IEEEproof}
\vspace{0.1cm}
The reason for the point-wise maximum formulation becomes apparent when we consider approximating the solution to \eqref{eq:lp_for_V} and \eqref{eq:pwm_nlp_for_V} by restricting the space of the decision variables to subspaces of $\mathcal{F}\!\left(\mathcal{X}\right)$. To gain some initial insight, observe that the Bellman inequality constraint \eqref{eq:pwm_nlp_for_V:pwm_ineq} implies that feasible decisions for \eqref{eq:pwm_nlp_for_V} will be point-wise under-estimators of $V^\ast$. Thus a point-wise maximum is a natural way to combine a family of feasible but sub-optimal decisions.
Computing a solution of problem \eqref{eq:pwm_nlp_for_V} poses the following difficulties
\begin{enumerate}
\renewcommand{\labelenumi}{(D\theenumi)}
\item $\mathcal{F}\!\left(\mathcal{X}\right)$ is an infinite dimensional space;
\label{difficulty:F}
\item Objective \eqref{eq:pwm_nlp_for_V:objecitve} involves a multidimensional integral over $\mathcal{X}$;
\label{difficulty:intobj}
\item The $\bellmanOp[u]{}$-operator involves a multidimensional dimensional integral over $\Xi$;
\label{difficulty:Tu}
\item Constraint \eqref{eq:pwm_nlp_for_V:pwm_ineq} involves an infinite number of constraints;
\label{difficulty:infcon}
\item Constraint \eqref{eq:pwm_nlp_for_V:pwm_ineq} is non-convex in the decision variables;
\label{difficulty:nccon}
\item The objective \eqref{eq:pwm_nlp_for_V:objecitve} involves the maximization of a convex function;
\label{difficulty:ncobj}
\end{enumerate}
Difficulties (D1-D4) apply also to problem \eqref{eq:lp_for_V} and a variety of approaches have been proposed to address them, see for example \cite{swaroop_2010_pwcValueFunc,vanroy_2004_sampDP,boyd_2012_quadraticADP,sutter_2014_ADPsamp,summers_2017_inf_dim_LPapproach}. In Section \ref{sec:adp} we take inspiration from previous approaches to propose an approximation algorithm that additionally overcomes difficulties (D5-D6).
\section{Properties of the Inner Problem of Section \ref{sec:adp:gradient_algorithm}} \label{app:inner_problem}
All the material in this appendix is formulated for a minimization optimization objective, chosen to make the results readily comparable with existing optimization literature. Problem \eqref{eq:canonical_inner_problem} and Algorithm \ref{alg:inner_problem} are readily converted to minimization problems by taking the negative of the objective.
\subsection{Differentiability definitions} \label{app:differentiability_definitions}
We provide for completeness the definitions of the \textbf{regular} and \textbf{general} sub-differential as taken from \cite[\S 7.D, \S8.A]{rockafellar_2009_variationalanalysis}.
The definition of the sub-differential commonly used for convex optimization problems is special case of the regular sub-differential defined below \cite[Proposition 8.12]{rockafellar_2009_variationalanalysis}, required here because \eqref{eq:canonical_inner_problem:objective} is non-convex when cast as a minimization problem. We require additionally the general sub-differential definition because \eqref{eq:canonical_inner_problem:objective} is non-smooth.
Given a function $\smash{f : \rdim{n} \rightarrow \rdim{} \cup \{-\infty,\infty\}}$, a vector $\smash{d\!\in\!\rdim{n}}$ is a \emph{regular lower subgradient} of $f$ at the point $\smash{x\!\in\!\rdim{n}}$ if the following one-sided limit condition holds,
\begin{equation} \nonumber
\liminf\limits_{z \rightarrow x,\, z\neq x}
\hspace{0.1cm}
\frac{f(z) - f(x) - \left(z-x\right)^\intercal \, d }{ \left\| z - x \right\| }
\,\geq\, 0
\,.
\end{equation}
The \emph{regular lower subdifferential} of $f$ at $x$, denoted $\smash{\hat{\partial} f(x)}$ is the set of regular lower subgradients of $f$ at $x$.
A vector $\smash{d\!\in\!\rdim{n}}$ is a \emph{general lower subgradient} of $f$ at the point $x$ if there exists sequences $\smash{ x^{(i)} \!\stackrel{f}{\rightarrow}\! x }$ and $\smash{ d^{(i)} \!\rightarrow\! d }$ with $\smash{ d^{(i)} \!\in\! \hat{\partial} f(x^{(i)}) }$, where the notation $\stackrel{f}{\rightarrow}$ stands for $f$-attentive, defined as,
\begin{equation} \nonumber
x^{(i)} \!\stackrel{f}{\rightarrow}\! x
\hspace{0.4cm} \Leftrightarrow \hspace{0.4cm}
x^{(i)} \!\rightarrow\! x
\hspace{0.2cm} \text{with} \hspace{0.2cm}
f(x^{(i)}) \!\rightarrow\! f(x)
\,.
\end{equation}
The \emph{general lower subdifferential} of $f$ at $x$, denoted $\smash{\partial f(x)}$ is the set of general lower subgradients of $f$ at $x$.
At a point $x$ where $f$ is finite, the set $\smash{\partial f(x)}$ and $\smash{\hat{\partial} f(x)}$ are closed, with $\smash{\hat{\partial} f(x)}$ convex and $\smash{\hat{\partial} f(x) \!\subseteq\! \partial f(x)}$.
The function $f$ is \emph{subdifferentially regular} at a point $x$ if $\smash{\hat{\partial} f(x) \!=\! \partial f(x)}$.
These definitions and properties correspond to \cite[Definition 8.3, Theorem 8.6, Definition 7.25]{rockafellar_2009_variationalanalysis}.
Note that if $f$ is differentiable at $x$, then $\smash{ \hat{\partial} f(x) \!=\! \{ \nabla f(x) \} }$, i.e., a singleton, and if additionally $f$ is smooth on a neighbourhood of $x$, then $\smash{ \partial f(x) \!=\! \{ \nabla f(x) \} }$ also. For the standard definitions of the gradient $\nabla f(x)$ of a function $f$ at a differentiable point $x$, the reader is referred to \cite[\S B.5]{bertsekas_2016_nlprog_book}.
The regular and general \emph{upper} subdifferential are computed as $\smash{ -\hat{\partial}\left(-f\right) }$ and $\smash{ -\partial\left(-f\right) }$, and denoted ${\hat{\partial}^+ f}$ and ${\partial^+ f}$, respectively.
\subsection{Necessary condition for local optimality} \label{app:stationary_definition}
A function $\smash{f : \rdim{n} \rightarrow \rdim{}}$ is proper, for a minimisation objective, if $\smash{f(x)\!<\!+\infty}$ for at least one $\smash{x\!\in\!\rdim{n}}$, and $\smash{f(x)\!>\!-\infty}$ for all $\smash{x\!\in\!\rdim{n}}$.
Consider the minimization of a proper, lower-semi-continuous function $\smash{f : \rdim{n} \rightarrow \rdim{}}$ over a closed set $\mathcal{C} \subseteq \rdim{n}$, i.e., $\smash{\min_{x\in\mathcal{C}} f(x)}$. As per \cite[Theorem 8.15]{rockafellar_2009_variationalanalysis}, a necessary condition for the local optimality of a point $\overline{x} \in \mathcal{C}$ is:
\begin{equation} \label{eq:locally_optimal_definition}
0 \,\in\, \partial f(\overline{x}) \,+\, \gennormalcone{\mathcal{C}}(\overline{x})
\,,
\end{equation}
where $\gennormalcone{\mathcal{C}}$ is the \emph{general normal cone} of the set $\mathcal{C}$ at the point $\overline{x}$, see \cite[Definition 6.3]{rockafellar_2009_variationalanalysis}.
If in addition $\mathcal{C}$ is a convex set, then this condition is equivalent to the existence of a $\smash{ d \!\in\! \partial f(\overline{x}) }$ satisfying
\begin{equation} \label{eq:locally_optimal_definition_useful}
\left(z-\overline{x}\right)^\intercal \, d \,\geq\, 0
\,,\hspace{0.3cm}
\forall \, z \in \mathcal{C}
\,.
\end{equation}
see \cite[Theorem 6.9]{rockafellar_2009_variationalanalysis}.
Note further that if $f$ is convex then these conditions are necessary and sufficient for $\overline{x}$ to be globally optimal.
A stationary point of the optimisation problem $\smash{\min_{x\in\mathcal{C}} f(x)}$ is one satisfying $\smash{0 \!\in\! \partial\left(f(\overline{x})+\delta_\mathcal{C}(\overline{x})\right)}$, where $\delta_\mathcal{C}$ is the indicator function of the set $\mathcal{C}$. All stationary points satisfy \eqref{eq:locally_optimal_definition} as,
\begin{equation} \nonumber
\partial\left(f(\overline{x}) + \delta_\mathcal{C}(\overline{x})\right)
\,\subseteq\,
\partial f(\overline{x}) + \partial\delta_\mathcal{C}(\overline{x})
\,=\,
\partial f(\overline{x}) + \gennormalcone{\mathcal{C}}(\overline{x})
\,.
\end{equation}
If $\mathcal{C}$ is convex, then the inclusion becomes an equality at a point $\overline{x}$ where $f$ is sub-differentially regular, \cite[Corollary 10.9]{rockafellar_2009_variationalanalysis}.
\subsection{Proof of convergence for a more general problem statement} \label{app:minimize_concave_function_convergence_proof}
To streamline the proof of Theorem \ref{thm:inner_problem_algorithm_convergence}, we consider now a more a general problem statement, and then in Appendix \ref{app:inner_problem_algorithm_convergence_proof} below we show that problem \eqref{eq:canonical_inner_problem} and Algorithm \ref{alg:inner_problem} has this form. Given a proper, lower-semi-continuous, \textbf{concave function} $\smash{f : \rdim{n} \rightarrow \rdim{}}$ and a \textbf{convex constraint} set $\mathcal{C} \subseteq \rdim{n}$ such that $f$ is \textbf{bounded below} on $\mathcal{C}$, we consider the optimization problem,
\begin{equation} \label{eq:minimize_concave_function}
\min \hspace{0.05cm} f(x)
,\hspace{0.10cm}
\text{s.t.} \hspace{0.1cm} x \in \mathcal{C}
\,.
\end{equation}
We show that Algorithm \ref{alg:minimize_concave_function} finds points that satisfy \eqref{eq:locally_optimal_definition_useful}; note that in line \ref{alg:minimize_concave_function:subdiff} we use the lower sub-differential because \eqref{eq:minimize_concave_function} is a minimization problem.
\newcommand{k}{k}
\begin{figure}[h]
\removelatexerror
\begin{algorithm}[H]
\caption{Find points satisfying necessary optimality conditions of problem \eqref{eq:minimize_concave_function}}
\label{alg:minimize_concave_function}
\begin{algorithmic}[1]
%
\Procedure{MinimizeConcaveFunction}{ $\smash{x^{(0)}}$ , $\epsilon$ }
%
\State $k\gets 0$
%
\Repeat
%
\State $d^{(k)} \gets$ an element from $\partial f\left( x^{(k)} \right)$
\label{alg:minimize_concave_function:subdiff}
%
\If{$\left( d^{(k)} = 0 \right)$ }
\label{alg:minimize_concave_function:zero_subdiff}
%
\State $x^{(k+1)} \gets x^{(k)}$
\label{alg:minimize_concave_function:zero_subdiff:break}
%
\Else
\State $x^{(k+1)} \gets \hspace{0.05cm} x^\ast \in \arg\min \left\{\, x^\intercal \, d^{(k)} ,\hspace{0.05cm} \text{s.t.} \hspace{0.05cm} x \in \mathcal{C} \right\}$
\label{alg:minimize_concave_function:lp}
%
\EndIf
%
\State $k\gets k+1$
%
\Until{$\Big( f\left(x^{(k)}\right) - f\left(x^{(k-1)}\right) \Big) < \epsilon$,}
\label{alg:minimize_concave_function:equal_objective}
%
\State \textbf{return} $x^{(k)}$
%
\EndProcedure
\end{algorithmic}
\end{algorithm}
\end{figure}
\begin{theorem} \label{thm:minimize_concave_function_convergence}
For any initial condition $\smash{x^{(0)} \!\in\! \mathcal{C}}$ and any $\smash{\epsilon \!>\! 0}$, Algorithm \ref{alg:minimize_concave_function} generates a non-decreasing sequence $\smash{f\left(x^{(k)}\right)}$ and terminates after a finite number of iterations.
%
%
%
With $\smash{\epsilon \!=\! 0}$, and assuming that the $\arg\min$ on line~\ref{alg:minimize_concave_function:lp} is always attained, the sequence $\smash{f\left(x^{(k)}\right)}$, converges to a finite value, and the sequences $\smash{x^{(k)}}$, $\smash{d^{(k)}}$, satisfy condition~\eqref{eq:locally_optimal_definition_useful} in the following sense,
\begin{equation} \nonumber
\lim\limits_{k \rightarrow \infty}\left(\,
\min\limits_{x\in\mathcal{C}} \, \left(x-x^{(k)}\right)^\intercal d^{(k)}
\,\right)
\,=\, 0
\,.
\end{equation}
\end{theorem}
\begin{IEEEproof}[Proof of Theorem \ref{thm:minimize_concave_function_convergence}]
\textbf{The sub-differential gives majorizing functions}
We first show that given any element of the general lower subdifferential, $\smash{d^{(k)} \!\in\! \partial f \left(x^{(k)}\right)}$, the surrogate function,
\begin{equation} \label{eq:app:inner_problem_algorithm_convergence_proof:surrogate}
s_{k}\left(x\right) \,=\,
\left( x - x^{(k)} \right)^\intercal \, d^{(k)}
\,+\, f\left( x^{(k)} \right)
,
\end{equation}
is a point-wise upper-bound of the concave function $f$. This is trivial for a differentiable point $\smash{x^{(k)}}$ as we have that the gradient is the only element of both the general lower and upper subdifferential of $f$ at $\smash{x^{(k)}}$ and hence $\smash{s_{k}\left(x\right)}$ is a global upper-bound of $f$. Pathological functions where the gradient is not an element of general subdifferential at a differentiable point are excluded by virtue of the $f$ being concave.
At a non-differentiable point $\smash{x^{(k)}}$, as $f$ is concave, the regular lower subdifferential is empty at this point. Thus the general lower subdifferential is defined by the limits along all sequences of differentiable points leading to $\smash{x^{(k)}}$.
%
As the regular lower and upper subdifferential are equal at all points along any such sequence we have that,
\begin{equation} \nonumber
\partial f (x^{(k)}) \,\subset\, -\partial\left( -f \right) (x^{(k)})
\,.
\end{equation}
Thus is remains to show that $\partial\left( -f \right) (x^{(k)})$ contains only supporting hyperplanes of the hypograph of $f$ at $\smash{x^{(k)}}$. As $-f$ is convex, we have by \cite[Proposition 8.12]{rockafellar_2009_variationalanalysis} that the general lower subdifferential of $-f$ is,
\begin{equation} \nonumber
\begin{aligned}
&\, \partial\left( -f(x^{(k)}) \right)
= \hat{\partial}\left( -f(x^{(k)}) \right)
\\
=&\, \setdef{ -d \in \rdim{n} }{ f(x) \leq f(x^{(k)}) + \left(x-x^{(k)}\right)^\intercal d ,\, \forall x\!\in\!\mathcal{X} }
\,,
\end{aligned}
\end{equation}
Thus we have shown that the surrogate function $\smash{ s_{k}\left(x\right) }$ is a point-wise upper-bound of the concave function $f$ at any point $\smash{x^{(k)}}$ that it is constructed.
\vspace{0.2cm}
\textbf{Termination in finite iterations}
By definition, the minimization problem on line \ref{alg:minimize_concave_function:lp} returns $\smash{x^{(k+1)}}$ satisfying the optimality condition,
\begin{equation} \label{eq:app:inner_problem_algorithm_convergence_proof:lp_optimality}
\left(x-x^{(k+1)}\right)^\intercal \, d^{(k)} \,\geq\, 0
\,,\hspace{0.3cm}
\forall \, x \in \mathcal{C}
\,.
\end{equation}
Combining the properties of the surrogate function $s_k$ with the definition of line \ref{alg:minimize_concave_function:lp} as a minimization problem, we have that,
\begin{equation} \label{eq:app:inner_problem_algorithm_convergence_proof:nonincreasing}
f\left( x^{(k)} \right)
\,=\,
s_{k}\left(x^{(k)}\right)
\,\geq\,
s_{k}\left(x^{(k+1)}\right)
\,\geq\,
f\left( x^{(k+1)} \right)
,
\hspace{-0.1cm}
\end{equation}
with $\smash{ x^{(k)},x^{(k+1)} \!\in\! \mathcal{C} }$ ensured by the constraints of line \ref{alg:minimize_concave_function:lp}. The equality is by~\eqref{eq:app:inner_problem_algorithm_convergence_proof:surrogate}, the first inequality is by definition of the minimization on line \ref{alg:minimize_concave_function:lp}, and the final inequality is by the fact that the surrogate is a point-wise upper-bound.
By the assumption that $f$ is bounded below on $\mathcal{C}$, the sequences $\smash{ f\left( x^{(k)} \right) }$ and $\smash{ s_{k}\left( x^{(k)} \right) }$, for $\smash{k\!\geq\!0}$, are convergent, hence Cauchy. Therefore, for all $\smash{\epsilon \!>\! 0}$ there must exist a $\smash{k \!\geq\! 1}$ such that the condition on line \ref{alg:inner_problem:equal_objective} triggers.
\vspace{0.2cm}
\textbf{Convergence to necessary conditions for optimality}
For $\smash{\epsilon \!=\! 0}$ we have from the argument above that the sequences $\smash{ f\left( x^{(k)} \right) }$ and $\smash{ s_{k}\left( x^{(k)} \right) }$ converge to a finite value.
%
To show that the sequence $\smash{x^{(k)}}$ satisfies condition \eqref{eq:locally_optimal_definition_useful} in the limit, we need to show that,
\begin{equation} \nonumber
\lim\limits_{k \rightarrow \infty}\left(\,
\sup\limits_{d\in\partial f (x^{(k)})} \left(\,
\min\limits_{x\in\mathcal{C}} \, \left(x-x^{(k)}\right)^\intercal d
\,\right)
\,\right)
\,\geq\, 0
\,.
\end{equation}
%
To show this it is sufficient to show that the sequence $\smash{ x^{(k)} }$ converges to an optimal point of $\smash{ \min\nolimits_{x\in\mathcal{C}} s_k(x)}$, i.e., we show that sequences $\smash{ x^{(k)} }$, $\smash{ d^{(k)} }$, satisfy,
\begin{equation} \label{eq:app:inner_problem_algorithm_convergence_proof:sufficient_limsup}
\lim\limits_{k \rightarrow \infty}\left(\,
\min\limits_{x\in\mathcal{C}} \, \left(x-x^{(k)}\right)^\intercal d^{(k)}
\,\right)
\,=\, 0
\,.
\end{equation}
%
The $\min$ here is attained by the assumption in the theorem statement that line~\ref{alg:minimize_concave_function:lp} of Algorithm~\ref{alg:minimize_concave_function} attains at every iteration.
%
To show that the limit in \eqref{eq:app:inner_problem_algorithm_convergence_proof:sufficient_limsup} exists and equals zero, we first consider for the sake of contradiction that the sequences $\smash{x^{(k)}}$, $\smash{d^{(k)}}$ satisfy,
\begin{equation} \nonumber
\liminf\limits_{k \rightarrow \infty}\left(\,
\min\limits_{x\in\mathcal{C}} \, \left(x-x^{(k)}\right)^\intercal d^{(k)}
\,\right)
\,=\, -\delta
\,<\, 0
\,.
\end{equation}
By definition of the $\liminf$, for every $\smash{k\!\geq\!0}$ there exists a $\smash{j\!\geq\!k}$ for which,
\begin{equation} \label{eq:app:inner_problem_algorithm_convergence_proof:contradiction_limsup}
\min\limits_{x\in\mathcal{C}} \, \left(x-x^{(j)}\right)^\intercal d^{(j)}
\,\leq\, - \,\frac{\delta}{2}
\,.
\end{equation}
By definition of line \ref{alg:minimize_concave_function:lp} as a minimization problem we have for this pair $k,j$ that,
%
\begin{equation} \nonumber
\begin{aligned}
s_{j+1}\left( x^{(j+1)} \right)
\,&\stackrel{\eqref{eq:app:inner_problem_algorithm_convergence_proof:nonincreasing}}{\leq}\,
s_{j}\left( x^{(j+1)} \right)
\\
&\stackrel{\eqref{eq:app:inner_problem_algorithm_convergence_proof:surrogate}}{=}\,
\left( x^{(j+1)} - x^{(j)} \right)^\intercal \, d^{(j)} \,+\, f\left( x^{(j)} \right)
\\
&\stackrel{\eqref{eq:app:inner_problem_algorithm_convergence_proof:contradiction_limsup}}{\leq}\,
-\,\frac{\delta}{2} \,+\, f\left( x^{(j)} \right)
\\
\,&\stackrel{\eqref{eq:app:inner_problem_algorithm_convergence_proof:nonincreasing}}{\leq}\,
-\,\frac{\delta}{2} \,+\, s_{k}\left( x^{(k)} \right)
\,.
\end{aligned}
\end{equation}
%
Repeating this argument starting from $j+1$, we readily establish that,
\begin{equation} \nonumber
\limsup\limits_{k\rightarrow\infty} \, s_{k}\left( x^{(k)} \right)
\,\leq\, \limsup\limits_{N\rightarrow\infty} \left(\,
s_{0}\left(x^{(0)}\right) \,-\, N \, \frac{\delta}{2}
\,\right)
\,=\, -\infty
\,,
\end{equation}
which contradicts the previous conclusion that the sequence $\smash{ s_{k}\left( x^{(k)} \right) }$ converges to a finite value.
%
Moreover we have that,
\begin{equation} \nonumber
\min\limits_{x\in\mathcal{C}} \, \left(x-x^{(k)}\right)^\intercal d^{(k)}
\,\leq\, 0
\,,\hspace{0.3cm}
\text{for $\smash{k\!\geq\!0}$,}
\end{equation}
because $\smash{x^{(k)} \!\in\! \mathcal{C}}$, for $\smash{k\!\geq\!0}$.
%
Thus, by contradiction we have shown that,
\begin{equation} \nonumber
\begin{aligned}
0 \,\geq&\, \limsup\limits_{k \rightarrow \infty}\left(\,
\min\limits_{x\in\mathcal{C}} \, \left(x-x^{(k)}\right)^\intercal d^{(k)}
\,\right)
\\
\,\geq&\,\,
\liminf\limits_{k \rightarrow \infty}\left(\,
\min\limits_{x\in\mathcal{C}} \, \left(x-x^{(k)}\right)^\intercal d^{(k)}
\,\right)
\,\geq\, 0
\,,
\end{aligned}
\end{equation}
and hence the limit in~\eqref{eq:app:inner_problem_algorithm_convergence_proof:sufficient_limsup} exists and equals zero.
%
%
\end{IEEEproof}
\vspace{0.1cm}
Note that if line \ref{alg:minimize_concave_function:zero_subdiff} of Algorithm \ref{alg:minimize_concave_function} triggers, then the subgradient is zero and condition \eqref{eq:locally_optimal_definition_useful} is satisfied. In this case the $x^{(k)}$ returned is a global maximizer of the concave function $f$.
Note also that for a positive $\epsilon$, if the condition on line \ref{alg:inner_problem:equal_objective} triggers with $\smash{ f\left(x^{(k)}\right) = f\left(x^{(k-1)}\right) }$, then $x^{(k-1)}$ satisfies \eqref{eq:locally_optimal_definition_useful}.
To show this, first note that by \eqref{eq:app:inner_problem_algorithm_convergence_proof:surrogate} and \eqref{eq:app:inner_problem_algorithm_convergence_proof:nonincreasing} we have,
\begin{equation} \nonumber
\begin{aligned}
f\left( x^{(k-1)} \right)
&\,\stackrel{\eqref{eq:app:inner_problem_algorithm_convergence_proof:nonincreasing}}{=}\,
s_{k-1}\left(x^{(k)}\right)
\\
&\,\stackrel{\eqref{eq:app:inner_problem_algorithm_convergence_proof:surrogate}}{=}\,
\left( x^{(k)} - x^{(k-1)} \right)^\intercal d^{(k-1)}
+ f\left( x^{(k-1)} \right)
.
\end{aligned}
\end{equation}
From this we substitute $\smash{x^{(k)\intercal} d^{(k-1)} = x^{(k-1)\intercal} d^{(k-1)} }$ into the optimality condition \eqref{eq:app:inner_problem_algorithm_convergence_proof:lp_optimality} that $\smash{x^{(k)}}$ satisfies, and we get that the $\smash{d^{(k-1)} \!\in\! \partial f \left(x^{(k-1)}\right)}$ from line \ref{alg:minimize_concave_function:subdiff} of Algorithm \ref{alg:minimize_concave_function} satisfies condition \eqref{eq:locally_optimal_definition_useful} at $\smash{x^{(k-1)}}$.
\subsection{Proof of convergence for Algorithm \ref{alg:inner_problem}} \label{app:inner_problem_algorithm_convergence_proof}
\begin{IEEEproof}[Proof of Theorem \ref{thm:inner_problem_algorithm_convergence}]
We show that the objective function $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$ and the convex constraint $\smash{\alpha \!\in\! BI(\mathcal{A}_{\mathrm{con}})}$ satisfy the assumptions of Theorem \ref{thm:minimize_concave_function_convergence}. Casting~\eqref{eq:canonical_inner_problem} as a minimization problem, the objective is,
\begin{equation} \nonumber
-\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}\left( \alpha \right) =
-\sum\limits_{i=1}^{N_c} \, \left(\, \max\left\{ \alpha^\intercal \hspace{-0.02cm} \Vbasis(x_{c,i}) , \bar{V}_{\mathrm{obj}}(x_{c,i}) \right\} \,\right)
\,.
\end{equation}
The two elements of the $\max$ are linear in the decision variable $\alpha$, and thus the objective is concave in $\alpha$.
We now show that $-\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$ is bounded below on the constraint set. The assumption that $\bar{V}_{\mathrm{con}}$ is a point-wise lower bound of $V^\ast$ means that for any $\alpha$ satisfying constraint \eqref{eq:canonical_inner_problem:pwm_ineq}, the function $\smash{ \alpha^\intercal \hspace{-0.02cm} \Vbasis(x) }$ is also a point-wise lower bound of $\smash{V^\ast(x)}$ for all $x\!\in\!\mathcal{X}$. This is ensured by the Bellman operator $\bellmanOp[]{}$ being monotone and $\gamma$-contractive. Moreover, under \cite[Assumptions 4.2.1(a), 4.2.1(b), 4.2.2]{hernandez_2012_discreteTimeMCP} we have that $\smash{V^\ast(x)}$ is finite for all $x\!\in\!\mathcal{X}$. As $\bar{V}_{\mathrm{obj}}$ is also a point-wise lower bound of $V^\ast$, we have that all elements of the sum in $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$ are bounded above, and hence $-\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$ is bounded below for all $\smash{\alpha \!\in\! BI(\mathcal{A}_{\mathrm{con}})}$.
Next we show that equation \eqref{eq:pwmobj_subdiff} correctly computes an element of the general upper subdifferential of $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$. For an $\alpha$ where $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$ is differentiable, we have that $\smash{ \alpha^\intercal \hspace{-0.02cm} \Vbasis(x_{c,i}) \!\neq\! \bar{V}_{\mathrm{obj}}(x_{c,i}) }$ for all $\smash{i=1,\dots,N_c}$, and thus equation \eqref{eq:pwmobj_subdiff} computes the gradient at this point. The objective function $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$ is non-differentiable for an $\alpha$ where $\smash{ \alpha^\intercal \hspace{-0.02cm} \Vbasis(x_{c,i}) \!=\! \bar{V}_{\mathrm{obj}}(x_{c,i}) }$ for at least one point $\smash{i=1,\dots,N_c}$. Letting $\mathcal{I}_{<}(\alpha)$, $\mathcal{I}_{=}(\alpha)$, and $\mathcal{I}_{>}(\alpha)$ denote the indices $\smash{i=1,\dots,N_c}$ where $\smash{\alpha^\intercal \hspace{-0.02cm} \Vbasis(x_{c,i})}$ is respectively less than, equal, and greater than $\smash{\bar{V}_{\mathrm{obj}}(x_{c,i}) }$, we define $\delta_{\min}(\alpha)$ as,
\begin{equation} \nonumber
\delta_{\min}(\alpha) \,=\,
\min_{i \,\in\, \big(\, \mathcal{I}_{<}(\alpha) \,\cup\, \mathcal{I}_{>}(\alpha) \,\big) }
\hspace{0.1cm}
\left| \alpha^\intercal \hspace{-0.02cm} \Vbasis(x_{c,i}) - \bar{V}_{\mathrm{obj}}(x_{c,i}) \right|
\,.
\end{equation}
Recall that under Assumption \ref{ass:basisfunctions}, $\phi_1$ is taken to be the constant function and let $e_1$ denote a vector with $1$ as the first element and zero otherwise. Thus for all $\smash{ \delta \!\in\! (0,\delta_{\min}) }$ we have that $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$ is differentiable at $\smash{ \left(\alpha+\delta \, e_1 \right) }$ with gradient given by equation \eqref{eq:pwmobj_subdiff}.
%
For any sequence $\delta \rightarrow 0$, the sequence $\smash{ \left(\alpha+\delta \, e_1 \right) }$ is $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$-attentive, i.e., $\smash{\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}\left(\alpha+\delta \, e_1 \right) \rightarrow \mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}\left(\alpha\right)}$ by continuity of $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$.
%
As the gradient is the same for all $\smash{ \delta \!\in\! (0,\delta_{\min}) }$, equation \eqref{eq:pwmobj_subdiff} correctly computes an element of the general upper subdifferential of $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$ at $\alpha$.
Finally, we need to show that the maximum on line \ref{alg:inner_problem:lp} of Algorithm \ref{alg:inner_problem} is always attained. First note that the objective coefficient vector on line \ref{alg:inner_problem:lp} of Algorithm \ref{alg:inner_problem} is given by,
\begin{equation} \nonumber
d^{(i)} \,=\, \sum\nolimits_{\big(\mathcal{I}_{>}(\alpha^{(i)}) \,\cup\, \mathcal{I}_{=}(\alpha^{(i)})\big)} \, \phi(x_{c,i})
\,.
\end{equation}
%
By Assumption \ref{ass:lp_attainment} we have that,
\begin{equation} \nonumber
\max_{\alpha\in\rdim{K}}\left\{ \alpha^\intercal \phi(x_{c,i}) \,;\, \text{s.t.}\, \alpha \in BI(\mathcal{A}_{\mathrm{con}}) \right\}
\end{equation}
attains its maximum for all $\smash{x_{c,i}}$, $\smash{i\!=\!1,\dots,N_c}$, and denote $f_i^\ast$ as the optimal value.
%
Thus the hyperplanes $\smash{\alpha^\intercal \phi(x_{c,i}) \!\leq\! f_i^\ast}$ are all supporting hyperplanes of the convex constraint set $BI(\mathcal{A}_{\mathrm{con}})$. The following finite dimensional linear program relaxation of line \ref{alg:inner_problem:lp} of Algorithm \ref{alg:inner_problem} also attains its maximum,
\begin{equation} \label{eq:inner_problem_algorithm_convergence:proof:finiteLP}
\begin{aligned}
\max\limits_{\alpha \in \rdim{K}}
\hspace{0.2cm}
& \sum\nolimits_{\left(\mathcal{I}_{>} \,\cup\, \mathcal{I}_{=}\right)} \, \alpha^\intercal \, \phi(x_{c,i})
\\
\text{s.t.} \hspace{0.2cm}
& \alpha^\intercal \phi(x_{c,i}) \leq f_i^\ast
\,,\hspace{0.1cm} i=1,\dots,N_c
\,.
\end{aligned}
\end{equation}
%
To show this, first observe that~\eqref{eq:inner_problem_algorithm_convergence:proof:finiteLP} is feasible and bounded above by $\sum\nolimits_{\left(\mathcal{I}_{>} \,\cup\, \mathcal{I}_{=}\right)} \smash{f_i^\ast}$, and thus by \cite[Corollary 27.3.2]{rockafellar_2015_convexanalysis} problem~\eqref{eq:inner_problem_algorithm_convergence:proof:finiteLP} attains its maximum.
%
Finally, by \cite[Corollary 27.3.3]{rockafellar_2015_convexanalysis} we have that attainment for \eqref{eq:inner_problem_algorithm_convergence:proof:finiteLP} implies attainment for line \ref{alg:inner_problem:lp} of Algorithm \ref{alg:inner_problem}.
We have shown that the assumptions of Theorem \ref{thm:inner_problem_algorithm_convergence} satisfy also the assumptions of Theorem \ref{thm:minimize_concave_function_convergence} and hence the claims follow from Theorem \ref{thm:minimize_concave_function_convergence}.
%
\end{IEEEproof}
\section{Conclusion} \label{sec:conclusion}
We proposed an algorithm that computes a family of lower bounding approximate value functions in an iterative fashion, with the choice of initial state distribution as the only parameter to be selected by the designer. We motivate our algorithm by considering the non-convex objective of maximizing the point-wise maximum of lower bounding value functions, and use sub-gradient information to find (potentially) sub-optimal solutions. Testing our algorithm on linear-quadratic examples, we demonstrated a significant tightening of the lower bound compared to existing methods, achieved with a modest or negligible increase in the computation time.
As future work, we will investigate adaptations of the proposed algorithm that are tailored to policy performance. This is a more challenging setting because the computation restriction are more stringent for evaluation of a policy. Moreover, counter-examples can readily be constructed where an approximate value function that provides a relatively tight lower bound leads to a greedy policy with relatively poor online performance.
A weakness of the proposed method is that by sampling from the initial state distribution we forgo the direct theoretical connection to the Bellman equation. An interesting direction for extending our algorithm is to consider methods that directly maximize the integral with respect to the initial state distribution, for example stochastic gradient ascent. This would also address the open question about whether the lower bound quality is sensitive to the choice of samples in our proposed algorithm.
\section{Problem setting for Section \ref{sec:numerical}} \label{app:implementation_details}
\subsection{Quadratic Basis Functions} \label{app:quadratic_basis_functions}
The space of quadratic functions is parameterized by a constant offset $\smash{s\in\rdim{}}$, a linear co-efficient $\smash{p\in\rdim{n_x}}$, and a quadratic coefficient as a symmetric matrix $\smash{P\in\sdim{n_x}}$. Thus we express the restricted function space as,
\begin{equation} \label{eq:quadratic_basis_function_space}
\begin{aligned}
\hat{\mathcal{F}}\!\left(\mathcal{X}\right) =
\setdef{ \hat{V}(x) }{
\begin{matrix}
V(x) \!=\! x^\intercal P x + p^{\intercal} x + s^{}
\\
P \in \sdim{n_x} \,,\,\, p \in \rdim{n_x} \,,\,\, s \in \rdim{}
\end{matrix}
}
\,.
\end{aligned}
\end{equation}
Thus the $\alpha$ is the stacked vector of $s$, $p$, and the unique elements of $P$, and the basis functions $\phi$ are the monomials of $x$ up to degree two, which clearly satisfy Assumption \ref{ass:basisfunctions}.
Similar to Section \ref{sec:adp:existing} we use a subscript on $s$, $p$, and $P$ to label the approximate value function they correspond to, for example, $\smash{\hat{V}\left(#1\right)_j\!\in\!\hat{\mathcal{F}}\!\left(\mathcal{X}\right)}$ is equivalent to $\smash{\hat{V}\left(#1\right)_j(x) \!=\! x^\intercal P_j x + p_j^{\intercal} x + s_j}$ for all $x\!\in\!\mathcal{X}$.
This space of convex quadratic functions is considered by restricting matrix $P$ to be positive semi-definite.
\subsection{Formulating line \ref{alg:inner_problem:lp} of Algorithm \ref{alg:inner_problem} for commercial solver} \label{app:solver_formulation}
See Section \ref{sec:numerical} for the definitions of $A$, $B_u$, and $B_\xi$ as the linear dynamics, and Appendix \ref{app:quadratic_basis_functions} for the specification of the quadratic basis functions.
We introduce $\smash{\underline{u}_i,\overline{u}_i \in \mathbb{R}}$, $\smash{i\!=\!1,\dots,n_u}$, with $\smash{\underline{u}_i < \overline{u}_i}$, to denote the lower and upper bounds that describe each coordinate of the $\smash{\mathcal{U} \subseteq \mathbb{R}^{n_u}}$ space.
The quadratic stage cost is condensed into the matrix $\smash{L \in \mathbb{R}^{(n_x+n_u+1)\times(n_x+n_u+1)}}$ that takes the form $\smash{l(x,u) = [x^\intercal,u^\intercal,1] \, L \, [x^\intercal,u^\intercal,1]^\intercal}$.
The notation $\smash{\diag{\cdot}}$ places the vector argument on the diagonal of an otherwise zero matrix, and $e_i$ is the standard basis column vector with $1$ in the $i^{\mathrm{th}}$ element and zeros elsewhere, with the dimension clear from context.
We overload the notation $\hat{V}\left(#1\right)$ and introduce the notation $\hat{\mathbb{V}}$ as the following matrices,
\begin{subequations} \nonumber
\begin{align}
\hat{V}\left(#1\right) \,&=\,
\begin{bmatrix}
P & 0 & \frac{1}{2} p
\\
\star & 0 & 0
\\
\star & \star & s
\end{bmatrix}
\,,
\\
\hat{\mathbb{V}} \,&=\,
\begin{bmatrix}
A^\intercal P A
& A^\intercal P B_u
& \frac{1}{2} A^\intercal p + A^\intercal P B_\xi \expval{}{\xi}
\\
\star
& B_u^\intercal P B_u
& \frac{1}{2} B_u^\intercal p + B_u^\intercal P B_\xi \expval{}{\xi}
\\
\star
& \star
& s + \trace{ B_\xi^\intercal P B_\xi \expval{}{\xi \xi^\intercal}}
\end{bmatrix}
\,,
\end{align}
\end{subequations}
where $\star$ indicates that the matrix is symmetric. Again, any subscript $\hat{V}\left(#1\right)_{(\cdot)}$, $\mathbb{V}_{(\cdot)}$ also applies to $s$, $p$, and $P$. Both matrices are symmetric with dimension $\smash{(n_x+n_u+1)}$.
Using this notation, the point-wise maximum Bellman inequality \eqref{eq:canonical_inner_problem:pwm_ineq}, repeated here for convenience,
\begin{equation} \nonumber
\alpha^\intercal \hspace{-0.02cm} \Vbasis(x) \leq \left( \bellmanOp[u]{} \bar{V}_{\mathrm{con}} \right) (x,u)
\,, \hspace{0.2cm}
\forall \, x\!\in\!\mathcal{X} ,\, u\!\in\!\mathcal{U}
\,,
\end{equation}
is sufficiently reformulated as the following LMI:
\begin{equation} \label{eq:app:solver_formulation:LMI}
\begin{aligned}
\hspace{-0.10cm}
0 \preceq&
\,-\,
\begin{bmatrix}
\hat{V}\left(#1\right) & 0
\\
\star & 0
\end{bmatrix}
\,+\,
\begin{bmatrix} L & 0 \\ \star & 0 \end{bmatrix}
\,+\,
\begin{bmatrix}
0 & 0
\\
\star & \gamma
\end{bmatrix}
\\
&\,-\, \sum\limits_{\bar{\alpha}\in\mathcal{A}_{\mathrm{con}}} \, \lambda_{\bar{\alpha}} \,
\begin{bmatrix}
-\hat{\mathbb{V}}_{\bar{\alpha}} & 0
\\
\star & 1
\end{bmatrix}
\\
&\,-\, \sum\limits_{i=1}^{n_u} \, \lambda_i \,
\begin{bmatrix}
0_{n_x \times n_x} & 0 & 0
\\
\star & -\smash{\diag{e_i}}
& \smash{\frac{1}{2}\left( \underline{u}_i + \overline{u}_i \right)} e_i
\\
\star
& \star
& -\underline{u}_i \, \overline{u}_i
\end{bmatrix}
\!.
\end{aligned}
\end{equation}
The $s$, $p$, and $P$ in $\hat{V}\left(#1\right)$ are decision variables, as well as the $\smash{\lambda_i \in \mathbb{R}_+}$ and $\smash{\lambda_{\bar{\alpha}} \in \mathbb{R}_+}$, with everything else as fixed problem data.
The $\smash{\lambda_i}$ are the auxiliary variables introduced when using the S-procedure to reformulate the for all $\smash{u\in\mathcal{U}}$ part of the constraint in Appendix \ref{app:pwm_ineq_reformulation:actual}, while the $\smash{\lambda_{\bar{\alpha}}}$ are the auxiliary variables described in Appendix \ref{app:pwm_ineq_reformulation:actual}.
The objective function on line~\ref{alg:inner_problem:lp} of Algorithm~\ref{alg:inner_problem} is linear in the decision variables, and when computed as per line~\ref{alg:inner_problem:subdiff} of Algorithm~\ref{alg:inner_problem} it requires computation of the first and second moments of the $x_{c,i}$ for the indices, $\smash{i=1,\dots,N_c}$, where the approximate value function under consideration dominates $\bar{V}_{\mathrm{con}}$. Letting $\mu_c$ and $\Sigma_c$ denote the first and second moments respectively, the problem on line~\ref{alg:inner_problem:lp} of Algorithm~\ref{alg:inner_problem} becomes
\begin{equation} \label{eq:adp:lp_approach_with_LMI}
\max\limits_{s,p,P} \, \left\{\, \trace{P \Sigma_c} + p^\intercal \mu_c + s ,\; \text{s.t.} \text{\eqref{eq:app:solver_formulation:LMI}} \,\right\}
\,,
\end{equation}
where $\trace{\cdot}$ denotes the trace of a square matrix.
Note that the constraint $\smash{P\,\succeq\,0}$ can be added to restrict to the space of convex quadratic functions.
\section{Numerical Examples} \label{sec:numerical}
\begin{figure*}
\centering
\begin{tikzpicture}
\coordinate (FO) at (0.0cm,0.0cm);
\node[inner sep=0pt,anchor=south west] at ($(FO)+(0.5cm,1.0cm)$){
\includegraphics[width=8.0cm]
{img/sys_001D_001_pwm_inner_iter002_v03.pdf}
};
\node[inner sep=0pt,anchor=south west] at ($(FO)+(9.5cm,1.0cm)$){
\includegraphics[width=8.0cm]
{img/sys_001D_001_pwm_inner_iter002_zoomed_v03.pdf}
};
%
%
\node[align=center , anchor=center , rotate=90] at ($(FO)+(0.2cm,6.0cm)$)
{{\small Value Function }};
\node[align=center , anchor=center , rotate=90] at ($(FO)+(9.4cm,6.0cm)$)
{{\small Value Function }};
\node[align=center , anchor=center , rotate=0] at ($(FO)+(4.8cm,0.7cm)$)
{{\small State Space, $\mathcal{X} = \rdim{}$ }};
\node[align=center , anchor=center , rotate=90] at ($(FO)+(0.2cm,2.2cm)$)
{{\small $\nu(x)$ }};
\node[align=center , anchor=center , rotate=90] at ($(FO)+(9.3cm,2.2cm)$)
{{\small $\nu(x)$ }};
\node[align=center , anchor=center , rotate=0] at ($(FO)+(13.8cm,0.7cm)$)
{{\small State Space, $\mathcal{X} = \rdim{}$ }};
%
%
\node[align=center , anchor=center , rotate=0] at ($(FO)+( 4.80cm,0.2cm)$)
{\small{ (a) }};
\node[align=center , anchor=center , rotate=0] at ($(FO)+(13.80cm,0.2cm)$)
{\small{ (b) }};
%
%
\end{tikzpicture}
%
%
%
\caption[Short-hand caption]{
Providing visual insight for Algorithm \ref{alg:inner_problem} using the 1-dimensional example described in Section \ref{sec:numerical:1d}. Sub-figure (b) is a zoomed view of sub-figure (a).
%
On the upper axes, the dotted black line is $\bar{V}_{\mathrm{obj}}$ and $\bar{V}_{\mathrm{con}}$, the blue dot and blue line are the $x_{c,i}$ and $\alpha^{(0)}$ generated on line \ref{alg:outer_problem:generate} of Algorithm \ref{alg:outer_problem}. The red lines (solid and dashed) are the approximate value functions from the refinement steps of Algorithm \ref{alg:inner_problem}, with the solid line corresponding to the terminal iteration. Algorithm \ref{alg:inner_problem} converged in four steps to a $0.1\%$ relative tolerance on the objective value increase. The lower axes show the $\smash{N_c \!=\! 10^6}$ samples as a histogram, with grey bars showing all samples, blue bars showing where the blue line is greater than $\bar{V}_{\mathrm{obj}}$, and red bars showing where the solid red line is greater than $\bar{V}_{\mathrm{obj}}$.
}
\label{fig:alg_insight}
\end{figure*}
\begin{figure*}
\centering
\begin{tikzpicture}
%
%
\coordinate (1DO) at (0.0cm,0.0cm);
%
\node[inner sep=0pt,anchor=south west] at ($(1DO)+(0.50cm,3.7cm)$)
{
\includegraphics[width=8.0cm]
{img/sys_001D_001_pwmobj_w_decade_comparison_1e4.pdf}
};
\node[inner sep=0pt,anchor=south west] at ($(1DO)+(0.62cm,0.7cm)$)
{
\includegraphics[width=7.86cm]
{img/sys_001D_001_pwmnumiter_fancy_1e4.pdf}
};
%
%
\node[align=center , anchor=center , rotate=90] at ($(1DO)+(0.2cm,5.7)$)
{{\small $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$ }};
\node[align=center , anchor=center , rotate=90] at ($(1DO)+(0.3cm,2.2)$)
{{\small \# Iter of Alg. \ref{alg:inner_problem} }};
\node[align=center , anchor=center , rotate=0] at ($(1DO)+(4.50cm,0.4)$)
{{\small \# Iterations of Alg. \ref{alg:outer_problem} }};
%
\node[align=center , anchor=center ] at ($(1DO)+(4.25cm,7.6cm)$)
{\small For $\smash{\mathcal{X} = \rdim{}}$ example of Section~\ref{sec:numerical:1d} };
%
%
%
%
%
\coordinate (10DO) at (9.0cm,0.0cm);
%
\node[inner sep=0pt,anchor=south west] at ($(10DO)+(0.50cm,3.7cm)$)
{
\includegraphics[width=8.0cm]
{img/sys_010D_001_pwmobj_plain_w_decade_comparison_w_online.pdf}
};
\node[inner sep=0pt,anchor=south west] at ($(10DO)+(0.75cm,0.7cm)$)
{
\includegraphics[width=7.70cm]
{img/sys_010D_001_pwmnumiter_fancy.pdf}
};
\node[align=center , anchor=center , rotate=90] at ($(10DO)+(0.2cm,5.7)$)
{{\small $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$ }};
\node[align=center , anchor=center , rotate=90] at ($(10DO)+(0.3cm,2.2)$)
{{\small \# Iter of Alg. \ref{alg:inner_problem} }};
\node[align=center , anchor=center , rotate=0] at ($(10DO)+(4.50cm,0.4)$)
{{\small \# Iterations of Alg. \ref{alg:outer_problem} }};
%
\node[align=center , anchor=center ] at ($(10DO)+(4.25cm,7.6cm)$)
{\small For $\smash{\mathcal{X} = \rdim{10}}$ example of Section~\ref{sec:numerical:linquad_ND} };
%
%
%
\coordinate (LO) at (0.5cm,0.0cm);
\draw[gray70,line width = 0.5pt,fill=white] ($(LO)+(-0.2cm,0.0cm)$) rectangle ($(LO)+(16.6cm,-0.7cm)$);
\coordinate (LE1) at ($(LO)+(0.0cm,-0.4cm)$);
\draw[matlabblue,line width = 1.2pt,solid]
($(LE1)+(0.2cm,0cm)$) -- ($(LE1)+(0.74cm,0cm)$);
\node[right] at ($(LE1)+(0.85cm,0cm)$) {\color{matlabblue}
{\small Algorithm \ref{alg:outer_problem} without refinement }};
\coordinate (LE2) at ($(LE1)+(5.5cm,0.0cm)$);
\draw[myred,line width = 1.2pt,solid]
($(LE2)+(0.2cm,0cm)$) -- ($(LE2)+(0.74cm,0cm)$);
\node[right] at ($(LE2)+(0.85cm,0cm)$) {\color{myred}
{\small Algorithm \ref{alg:outer_problem} with refinement }};
\coordinate (LE3) at ($(LE2)+(5.5cm,0.0cm)$);
\draw[black,line width = 1.2pt,dashed]
($(LE3)+(0.2cm,0cm)$) -- ($(LE3)+(0.74cm,0cm)$);
\node[right] at ($(LE3)+(0.85cm,0cm)$) {\color{black}
{\small Online performance of a policy }};
%
%
%
%
%
\end{tikzpicture}
%
%
%
\caption[Short-hand caption]{
Details of the proposed algorithms for: (left) the 1-dimensional example described in Section \ref{sec:numerical:1d}; (right) the 10-dimensional example described in Section \ref{sec:numerical:linquad_ND}.
%
The blue lines show the results from running Algorithm \ref{alg:outer_problem} without using Algorithm \ref{alg:inner_problem} to refine the solution at each iteration, while the red lines show the results with refinement.
The top figures show the point-wise maximum objective integrated with respect to the $N_c$ samples. The bottom figures show number of iterations of Algorithm \ref{alg:inner_problem} until the $\epsilon$-convergence criterion is triggered, i.e., the number of refinement steps performed. To make the bottom figures readable, the results are grouped between the deciles of each order of magnitude, with the horizontal red line showing the average number of iterations, and the grey box spanning the minimum and maximum.
%
The online performance of a representative policy is shown by the dotted black line on the top figures. For the 1-dimensional example (left) an LQR policy was used with the input clipped to the constraints, while for the 10-dimensional example (right) a Model Predictive Controller was used with a 10-time-step horizon length and the Riccati equation solution as the terminal cost.
}
\label{fig:linquad}
\end{figure*}
In the following numerical example we consider problems with linear dynamics, convex quadratic stage costs, hyper-cube constraints on the input space, and use convex quadratics for the restricted function space $\hat{\mathcal{F}}\!\left(\mathcal{X}\right)$. In Appendix \ref{app:implementation_details} we provide the definition of $\hat{\mathcal{F}}\!\left(\mathcal{X}\right)$, formulate line~\ref{alg:inner_problem:lp} of Algorithm~\ref{alg:inner_problem} so that it can be passed to a standard solver, and verify that Assumption~\ref{ass:basisfunctions} holds.
Assumption~\ref{ass:lp_attainment} was observed to hold empirically, in that the solver returned a finite, optimal solution at each iteration.
\subsection{Algorithm insight on 1-dimensional example} \label{sec:numerical:1d}
To provide visual insight into how Algorithms 1 and 2 adapt the linear combination of basis functions, we use the simple 1-dimension example from \cite{boyd_2014_iterated_bellman_inequality}, i.e., with $\smash{n_x\!=\!n_u \!=\! 1}$. The dynamics, costs, constraints, and initial state distribution are given by,
\begin{equation} \nonumber
\begin{aligned}
&\hspace{0.0cm}
x_{t+1} = x_t - 0.5 u_t
\,,\hspace{0.2cm}
x_0 \sim \mathcal{N}(0,10)
\,,
\\
&\hspace{0.0cm}
|u| \leq 1
\,,\hspace{0.2cm}
\gamma = 0.95
\,,\hspace{0.2cm}
l(x,u) = x^2 + 0.1 u^2
\,,
\end{aligned}
\end{equation}
and we use the space of univariate quadratics as $\hat{\mathcal{F}}\!\left(\mathcal{X}\right)$.
We initialise $\bar{V}_{\mathrm{obj}}$ and $\bar{V}_{\mathrm{con}}$ with the solution of the LP approach using a single Bellman inequality constraint, i.e.,
\begin{equation} \label{eq:LP_single_BI}
\argmax{\hat{V}\left(#1\right)\in\hat{\mathcal{F}}\!\left(\mathcal{X}\right)} \left\{\,
\int_{\mathcal{X}} \, \hat{V}\left(#1\right)(x) \, \nu(\intd{x})
;\hspace{0.1cm}
\hat{V}\left(#1\right)(x) \leq \bellmanOp{} \hat{V}\left(#1\right)(x),\; \forall x\in\mathcal{X}
\,\right\}
,
\end{equation}
with $\nu$ chosen as the initial state distribution. The solution of \eqref{eq:LP_single_BI} represents the lower bound proposed in \cite{vanRoy_2003_lpapproach}.
In this setting \eqref{eq:LP_single_BI} is a convex semi-definite optimization program, with the objective requiring the first and second moments of $\nu$ and the constraint reformulated as a linear matrix inequality with respect to the quadratic coefficient decision variables, see \cite[\S6]{boyd_2014_iterated_bellman_inequality}.
Choosing $c$ as $\smash{N_c \!=\! 10^6}$ samples from the initial state distribution,
Figure \ref{fig:alg_insight} shows the first iteration of Algorithm \ref{alg:outer_problem}, with sub-figure (b) as zoomed view of sub-figure (a). Sub-figure (a) shows that the candidate approximate value function generated by line \ref{alg:outer_problem:generate} of Algorithm \ref{alg:outer_problem} (blue) is a significantly worse lower bound compared to that resulting from four refinement iterations of Algorithm \ref{alg:inner_problem} (red), when integrated with respect to the $N_c$ samples (grey histogram).
Figure \ref{fig:alg_insight}(b) shows that at the $x_{c,i}$ used on line \ref{alg:outer_problem:generate} of Algorithm \ref{alg:outer_problem} (blue dot), the generated value function (blue line) strictly improves on $\bar{V}_{\mathrm{obj}}$ (dotted black line). All of the refinement iterations (red) trade-off a decrease at this $x_{c,i}$ for a significant increase at the other samples. For this example and at this iteration, the significant increase in the point-wise maximum objective value $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$ is gained in regions away from the origin.
Figure~\ref{fig:linquad} (top left) shows the lower bound and online performance integrated with respect to the $\smash{N_c \!=\! 10^6}$ samples from the initial state distribution.
This shows that 1000 iterations of Algorithm~\ref{alg:outer_problem} combined with the refinement steps of Algorithm~\ref{alg:inner_problem} (red line) allow the clipped-LQR controller to be certified as within 1.5\% of the optimal. Without the refinement steps (blue line) the sub-optimality bound is 4.5\%, even after $10^4$ iterations.
Figure~\ref{fig:linquad} (bottom left) shows the number of iterations of Algorithm~\ref{alg:inner_problem} performed at each iteration of Algorithm~\ref{alg:outer_problem}. Together with Figure~\ref{fig:linquad} (top left), this shows that the handful of Algorithm~\ref{alg:inner_problem} iterations improves the bound (red line) with an order of magnitude fewer iterations than Algorithm~\ref{alg:outer_problem} without refinement (blue line).
In fact, computations performed for $10^5$ iterations empirically suggest that Algorithm~\ref{alg:outer_problem} without refinement will not give better than a 4.5\% sub-optimality bound within a practical number of iterations, for this example.
\subsection{Higher Dimensional Linear-Quadratic Problems} \label{sec:numerical:linquad_ND}
We consider again the an input constrained linear-quadratic system, this time with dimension $n_x \!=\! 10$, and $n_u \!=\! 3$. The system dynamics take the form,
\begin{equation} \nonumber
\begin{aligned}
x_{t+1} \,=\, A \, x_t \,+\, B_u \, u_t
\,,
\end{aligned}
\end{equation}
where $A$ and $B_u$ are matrices of compatible size, and the quadratic stage cost is, $\smash{l(x,u) \!=\! x^\intercal I_{n_x} x + u^\intercal I_{n_u} u}$, where $I_n$ denotes an identity matrix of size $n$, and we use discount factor $\smash{\gamma \!=\! 0.99}$.
The initial state is normally distributed as $x_0 \!\sim\! \mathcal{N}\left( 0 , \Sigma_{\nu} \right)$ with $\Sigma_{\nu} \!=\! 9 I_{n_x}$.
The $A$ and $B_u$ matrices are randomly generated, with the $A$ matrix scaled to be marginally stable, i.e., a spectral radius equal to 1.
Figure~\ref{fig:linquad} (top right) shows the lower bound achieved by running Algorithm \ref{alg:outer_problem} without (blue) and with (red) the refinement iterations of Algorithm~\ref{alg:inner_problem}, with the number of refinement iterations shown in Figure~\ref{fig:linquad} (bottom right).
To demonstrate the benefit of our proposed Algorithm relative to previous work, the sets $\mathcal{A}_{\mathrm{obj}}$ and $\mathcal{A}_{\mathrm{con}}$ are initialised with the solution of \eqref{eq:LP_single_BI}, with $\nu$ chosen as the initial distribution, i.e., $\mathcal{N}\left( 0 , \Sigma_{\nu} \right)$. Thus, the value for iteration 1 of the blue and red lines in Figure~\ref{fig:linquad} (top right), approximately 291, is the lower bound achieved by the method proposed in \cite{vanRoy_2003_lpapproach}.
The key feature of the result is that, although Algorithm~\ref{alg:outer_problem} without refinement is guaranteed to converge, the number of iterations required to reach a reasonable lower bound is significant. Algorithm~\ref{alg:outer_problem} with refinement, on the other hand, achieves a significantly better lower bound with orders of magnitude fewer iterations.
The improvement in the lower bound achieved with the refinement steps of Algorithm \ref{alg:inner_problem} is only meaningful if it significantly tightens the online performance bound for a particular policy. For this example, an MPC policy with a time horizon of $10$ achieves an online performance of $870$, shown by the dotted black line on Figure~\ref{fig:linquad} (top right). Thus the refinement steps of Algorithm~\ref{alg:inner_problem} (red) certify this policy to be within 11\% of the optimal, while the bound without the refinement steps (blue) provides only a 70\% sub-optimality certificate.
\begin{figure}
\centering
\begin{tikzpicture}
%
%
\coordinate (10DO) at (0.0cm,0.0cm);
%
\node[inner sep=0pt,anchor=south west] at ($(10DO)+(0.50cm,3.7cm)$)
{
\includegraphics[width=8.0cm]
{img/sys_010D_001_pwmobj_w_iteratedBellman_w_expandcx.pdf}
};
%
\node[inner sep=0pt,anchor=south west] at ($(10DO)+(0.42cm,0.7cm)$)
{
\includegraphics[width=8.07cm]
{img/sys_010D_001_comptime_w_iteratedBellman_w_expandcx.pdf}
};
%
%
\node[align=center , anchor=center , rotate=90] at ($(10DO)+(0.2cm,5.7cm)$)
{{\small $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$ }};
\node[align=center , anchor=center , rotate=90] at ($(10DO)+(0.2cm,2.2cm)$)
{{\small Time [seconds] }};
\node[align=center , anchor=center , rotate=0] at ($(10DO)+(4.50cm,0.4cm)$)
{{\small \# Iterations of Alg. \ref{alg:outer_problem} }};
%
%
\coordinate (LO) at (1.2cm,-0.0cm);
\draw[gray70,line width = 0.5pt,fill=white] ($(LO)+(-0.2cm,0.0cm)$) rectangle ($(LO)+(6.7cm,-2.0cm)$);
\coordinate (LE1) at ($(LO)+(0.0cm,-0.4cm)$);
\draw[mygreen,line width = 1.2pt,solid]
($(LE1)+(0.2cm,0cm)$) -- ($(LE1)+(0.74cm,0cm)$);
\node[right] at ($(LE1)+(0.85cm,0cm)$) {\color{mygreen}
{\small Iterated Bellman Inequality \cite{boyd_2013_iteratedApproxValueFunctions} }};
\coordinate (LE2) at ($(LE1)+(0.0cm,-0.4cm)$);
\draw[mygreen,line width = 1.2pt,dotted]
($(LE2)+(0.2cm,0cm)$) -- ($(LE2)+(0.74cm,0cm)$);
\node[right] at ($(LE2)+(0.85cm,0cm)$) {\color{mygreen}
{\small Hand-tuned sequence of $c(x)$ \cite{beuchat_2017_pwm_at_CDC} }};
\coordinate (LE3) at ($(LE2)+(0.0cm,-0.4cm)$);
\draw[matlabblue,line width = 1.2pt,solid]
($(LE3)+(0.2cm,0cm)$) -- ($(LE3)+(0.74cm,0cm)$);
\node[right] at ($(LE3)+(0.85cm,0cm)$) {\color{matlabblue}
{\small Algorithm \ref{alg:outer_problem} without refinement }};
\coordinate (LE4) at ($(LE3)+(0.0cm,-0.4cm)$);
\draw[myred,line width = 1.2pt,solid]
($(LE4)+(0.2cm,0cm)$) -- ($(LE4)+(0.74cm,0cm)$);
\node[right] at ($(LE4)+(0.85cm,0cm)$) {\color{myred}
{\small Algorithm \ref{alg:outer_problem} with refinement }};
%
%
\end{tikzpicture}
%
%
%
\caption[Short-hand caption]{
Comparison with existing methods for computing lower bounds using a point-wise maximum of approximate value functions for the 10-dimensional example of Section~\ref{sec:numerical:linquad_ND}. The top figure is comparable with Figure~\ref{fig:linquad} (top right). The iterated Bellman inequality method \cite{boyd_2013_iteratedApproxValueFunctions} (solid green) is computed with $100$ Bellman inequality iterations, while hand-tuning method \cite{beuchat_2017_pwm_at_CDC} (dotted green) uses a sequence of 20 zero-mean Gaussian distributions in the objective with the variance increasing from $\smash{\Sigma_{\nu} \!=\! 0.1 I_{n_x}}$ to $\smash{\Sigma_{\nu} \!=\! 18 I_{n_x}}$ and repeated 10 times, i.e., 200 iterations total. The bottom figure shows the cumulative computation time for solving line~\ref{alg:inner_problem:lp} of Algorithm~\ref{alg:inner_problem} and line~\ref{alg:outer_problem:generate} of Algorithm~\ref{alg:outer_problem}.
}
\label{fig:linquad_with_expanding_cx}
\end{figure}
As another point of comparison, we show in Figure~\ref{fig:linquad_with_expanding_cx} (top) the lower bound achieved by two alternative methods (green), and then we use the output of these methods to initialize our proposed algorithm (blue and red lines).
For the iterated Bellman inequality method proposed in \cite{boyd_2013_iteratedApproxValueFunctions} (solid green), we use $100$ Bellman inequality iterations, achieving a lower bound of $656$, and we note that more iterations did not improve the bound. This method computes $100$ approximate value functions from the solution of one optimization problem, hence the computation time in Figure~\ref{fig:linquad_with_expanding_cx} (bottom) is constant for the first $100$ iterations, while the lower bound increases because we add the $100$ approximate value functions sequentially to the point-wise maximum approximation.
For implementing the hand-tuning method suggested in \cite{beuchat_2017_pwm_at_CDC} (dotted green) we run Algorithm~\ref{alg:outer_problem} without refinement and with the modification that on line \ref{alg:outer_problem:generate} we manually select a different objective at each iteration. We performed this for a range of options and show in Figure~\ref{fig:linquad_with_expanding_cx} the option achieving the tightest bound.
For both of the comparisons, we then use the approximate value functions computed to initialize the sets $\mathcal{A}_{\mathrm{obj}}$ and $\mathcal{A}_{\mathrm{con}}$ and again run Algorithm \ref{alg:outer_problem} without (blue) and with (red) the refinement steps of Algorithm~\ref{alg:inner_problem}.
In both cases, only a handful of iterations of Algorithm \ref{alg:inner_problem} are required to achieve the improved lower bound of $783$, an $11\%$ and $19\%$ improvement respectively.
The combination of results in Figure~\ref{fig:linquad} (top right) and Figure~\ref{fig:linquad_with_expanding_cx} (top) suggests that the lower bound achieved by Algorithm \ref{alg:outer_problem} with refinement (red lines) is not overly sensitive to the initialization of $\mathcal{A}_{\mathrm{obj}}$ and $\mathcal{A}_{\mathrm{con}}$, provided that a reasonable number of iterations are performed.
The results also suggest that Algorithm \ref{alg:outer_problem} without refinement (blue lines) requires an impractically large number of iterations to achieve comparatively small improvements of the lower bound.
Figure~\ref{fig:linquad_with_expanding_cx} (bottom) shows the cumulative computation time required for computing the approximate value functions, i.e., solving line~\ref{alg:inner_problem:lp} of Algorithm~\ref{alg:inner_problem} and line~\ref{alg:outer_problem:generate} of Algorithm~\ref{alg:outer_problem}.
This indicates that the hand-tuning method suggested in \cite{beuchat_2017_pwm_at_CDC} can achieve a tighter lower bound with less computation time compared to the method suggested in \cite{boyd_2013_iteratedApproxValueFunctions}. However, both methods have a limit beyond which extra computation did not improve the lower bound.
We note that the computation times for the results in Figure~\ref{fig:linquad} fall between the lines shown in Figure~\ref{fig:linquad_with_expanding_cx} (bottom), and are not shown for the sake of clarity.
The results on this higher dimensional example empirically support our claim that sub-gradients of the point-wise maximum objective function are effective for computing tighter lower bounds.
\section{Reformulation of Point-wise Maximum Inequality} \label{app:pwm_ineq_reformulation}
This appendix summarises our previous work \cite{beuchat_2017_pwm_at_CDC} in the context of this paper.
\subsection{Jensen's inequality and epigraph reformulation} \label{app:pwm_ineq_reformulation:jensen_epigraph}
The point-wise maximum constraint \eqref{eq:pwm_nlp_for_V:pwm_ineq} is equivalent to $J$ separate constraints of the form,
\begin{equation} \nonumber
\begin{aligned}
l(x,u) \,+\, \gamma \, \expval{}{\max\limits_{k=1,\dots,J} \, V_k\left( g(x,u,\xi) \right)}
\,.
\end{aligned}
\end{equation}
As $\max(\cdot)$ is a convex function, by Jensen's inequality a sufficient condition for constraint \eqref{eq:pwm_nlp_for_V:pwm_ineq} is,
\begin{equation} \label{eq:app:pwm_ineq_reformulation:jensen}
\begin{aligned}
&V_j(x) \,\leq\, l(x,u)
\,+\, \gamma \, \max\limits_{k=1,\dots,J} \, \expval{}{ V_k\left( g(x,u,\xi) \right) }
\,,
\\
&\hspace{3.6cm} \forall \, x\!\in\!\mathcal{X},\, u\!\in\!\mathcal{U},\, j\!=\!1,\dots,J
\,.
\end{aligned}
\end{equation}
An exact epigraph reformulation can now be applied \cite[Theorem 1]{beuchat_2017_ADPwithPenalty} with the epigraph variable denoted $s_V$, i.e.,
\begin{equation} \label{eq:pwm_ineq_sufficient}
V_j(x) \,\leq\, l(x,u) \,+\, \gamma \, s_V^2
\,,\hspace{0.1cm}
\forall \, (x,u,s_V) \in \mathcal{S}
\,,
\end{equation}
for $j=1,\dots,J$, where the set $\mathcal{S}$ is defined as,
\begin{equation} \nonumber
\mathcal{S} = \setdef{x,u,s_V}{
\begin{matrix}
x\in\mathcal{X},\, u\in\mathcal{U}\,, s_V\in\rdim{},\,
\\
s_V^2 \geq \expval{}{ V_k\left( g(x,u,\xi) \right) } \; \forall \, k=1,\dots,J
\end{matrix}
}
\,,
\end{equation}
We choose to square the epigraph variable $s_V$ without loss of generality because \cite[Assumptions 4.2.1(b)]{hernandez_2012_discreteTimeMCP} implies that $V^\ast$ is non-negative.
\subsection{S-procedure reformulation} \label{app:pwm_ineq_reformulation:sprocedure}
The S-procedure \cite{petersen_2012_robustHinfcontrol} is used to obtain a sufficient condition for \eqref{eq:pwm_ineq_sufficient}.
Applying the S-procedure to the relevant part of $\mathcal{S}$ leads to,
\begin{equation} \label{eq:app:pwm_ineq_reformulation:sprocedure}
\begin{aligned}
&V_j(x) \leq l(x,u) + \gamma \, s_V^2 - \sum\limits_{k=1}^J \lambda_k \left( s_V^2 - \expval{}{ V_k\left( g(x,u,\xi) \right) } \right)
,
\\
&\hspace{3.5cm} \forall \, x\!\in\!\mathcal{X},\, u\!\in\!\mathcal{U},\, s_V\!\in\!\rdim{},\, j\!=\!1,\dots,J
,
\end{aligned}
\end{equation}
with $\lambda_k \!\in\! \rdim{}_+$ as the non-negative decision variables introduced by the S-procedure.
Reformulation \eqref{eq:app:pwm_ineq_reformulation:sprocedure} still suffers from difficulty (D\ref{difficulty:nccon}): there will be $J$ bilinear terms of the form $\smash{\lambda_k \, \expval{}{ V_k\left( g(x,u,\xi) \right) }}$ in each of the $J$ constraints.
The following implications summarize the approximation steps described,
\begin{equation} \nonumber
\text{\eqref{eq:pwm_nlp_for_V:pwm_ineq}}
\stackrel{\text{(Jensen)}}{\quad\Leftarrow\quad}
\text{\eqref{eq:app:pwm_ineq_reformulation:jensen}}
\stackrel{\text{(Epigraph)}}{\quad\Leftrightarrow\quad}
\text{\eqref{eq:pwm_ineq_sufficient}}
\stackrel{\text{(S-procedure)}}{\quad\Leftarrow\quad}
\text{\eqref{eq:app:pwm_ineq_reformulation:sprocedure}}
\,.
\end{equation}
In words, this reformulation is sufficient in the sense that if a family of functions $\smash{V_1,\dots, V_J}$ satisfies \eqref{eq:app:pwm_ineq_reformulation:sprocedure} then it also satisfies \eqref{eq:pwm_nlp_for_V:pwm_ineq} (but not necessarily the other way around).
An equivalent or tighter approximation can be found by allowing the S-procedure multipliers to depend on the state and input, i.e., $\smash{\lambda_k : \mathcal{X} \!\times\! \mathcal{U} \rightarrow \rdim{}_+}$. This would require the introduction of a restricted function space on $\smash{ \left(\mathcal{X}\!\times\!\mathcal{U}\right) }$, denoted $\hat{\mathcal{F}}\!\left(\mathcal{X}\!\times\!\mathcal{U}\right)$, and defined similar to $\hat{\mathcal{F}}\!\left(\mathcal{X}\right)$ in \eqref{eq:approx_func_spaces}.
\subsection{Overcoming difficulty (D\ref{difficulty:nccon}) for \eqref{eq:canonical_inner_problem}} \label{app:pwm_ineq_reformulation:actual}
The auxiliary problem \eqref{eq:canonical_inner_problem} introduced in Section~\ref{sec:adp:pwm_objective} has a form similar to \eqref{eq:app:pwm_ineq_reformulation:jensen} except that the only constraint included is the one with the decision variable on the left side of the inequality. Letting $V_1$ in \eqref{eq:app:pwm_ineq_reformulation:jensen} correspond to $\alpha^\intercal \hspace{-0.02cm} \Vbasis$ in \eqref{eq:canonical_inner_problem} and applying reformulation \eqref{eq:app:pwm_ineq_reformulation:sprocedure} we get the following sufficient condition for \eqref{eq:canonical_inner_problem:pwm_ineq},
\begin{equation} \nonumber
\begin{aligned}
&\alpha^\intercal \hspace{-0.02cm} \Vbasis(x) \,\leq\, l(x,u) \,+\, \gamma \, s_V^2
\\
&\hspace{1.6cm}
-\, \sum\limits_{\bar{\alpha}_{\mathrm{con}}\in\mathcal{A}_{\mathrm{con}}} \lambda_{\bar{\alpha}_{\mathrm{con}}} \left( s_V^2 - \bar{\alpha}_{\mathrm{con}}^\intercal \expval{}{\phi(g(x,u,\xi))} \right)
,
\end{aligned}
\end{equation}
for all $x\!\in\!\mathcal{X},\, u\!\in\!\mathcal{U},\, s_V\!\in\!\rdim{}$, where the multipliers $\lambda_{\bar{\alpha}_{\mathrm{con}}}$ are additional non-negative decision variable for each element of $\mathcal{A}_{\mathrm{con}}$. As the $\bar{\alpha}_{\mathrm{con}}$ are fixed parameters in problem \eqref{eq:canonical_inner_problem}, it is clear that this reformulation is linear in the decision variables $\alpha$ and $\lambda_{\bar{\alpha}_{\mathrm{con}}}$. When the problem data and basis functions are polynomial, the infinite constraints are reformulated in the usual way, see \cite[Appendix A]{boyd_2014_iterated_bellman_inequality} for example, the result is a single Linear Matrix Inequality (LMI) constraint.
\section{Introduction} \label{sec:intro}
Many important challenges in science and engineering can be cast in the problem formulation of infinite horizon stochastic optimal control (SOC), from climate control of a building \cite{jones_2012_buildings_journal} to control of a cell population \cite{khammash_2016_cell_integral_feedback}.
The goal of such problems is to find a state feedback policy that minimizes an infinite-horizon discounted cost function.
For a general SOC problem instance, the solution, i.e., the optimal policy, is typically characterized by the theory of dynamic programming (DP) \cite{bellman_1952_theory,bertsekas_1996_stochopt_book,hernandez_2012_discreteTimeMCP}.
However, in all but a few special cases, solving the SOC directly or applying the DP theory is intractable due to the so-called \emph{curse of dimensionality}.
As such, an extensive body of literature has proposed approximation techniques for computing sub-optimal solutions to SOC problems, ranging from model-free and simulation-based algorithms \cite{sutton_2018_rlbook}, to model-based approaches \cite{rawlings_1999_MPCtextbook,goulart_2006_robust_policies,nemirovski_2006_chance_constrained_programs,bertsekas_2005_fromADPtoMPC}. Any technique based on DP theory falls in the category of Approximate DP (ADP), see \cite{2004_adp_handbook,powell_2011_ADP_book,bertsekas_2012_DP_book_vol2} for an overview.
Although the optimal policy is intractable to compute, techniques have been developed to bound the sub-optimality of an approximate policy. These type of bounds provide the designer with valuable information about the potential benefit of synthesizing and evaluating alternative policies. In this paper we consider and propose approaches that provide sub-optimality bounds based on the so-called \emph{Linear Programming (LP) approach to ADP} \cite{schweitzer_1985_originalMDP}.
The LP approach to ADP provides sub-optimality bounds by computing approximations that are lower bounds of the so-called \emph{value function}, i.e., the solution of the Bellman equation for DP \cite{bellman_1952_theory}.
The LP approach parameterizes approximate value functions as a linear combination of fixed basis functions and uses the so-called \emph{Bellman inequality} to restrict consideration to only those linear combinations that are point-wise lower bounds of the value function. To compute an approximate value function the designer specifies the regions of the state space that are of interest via the \emph{state relevance weighting} function, and then solves an optimization problem to find a linear combination of basis functions that maximizes the integral with respect to this weighting.
The LP approach was first proposed for finite state and input spaces in \cite{depenoux_1960_original_lp_approach}, and equipped with theoretical guarantees in \cite{vanRoy_2003_lpapproach}. The authors of \cite{vanRoy_2003_lpapproach} also provide a discussion on the importance and difficulty of choosing the state relevance weighting to give the best performance and lower bound. An iterated version of the Bellman inequality was proposed in \cite{boyd_2014_iterated_bellman_inequality} and used to compute tighter lower bounds, however, the topic of choosing the state relevance weighting is not addressed. The subsequent works \cite{boyd_2011_minmax_adp,boyd_2013_iteratedApproxValueFunctions} avoid the need for a state relevance weighting by focusing on the design of policies rather than providing tighter lower bounds.
In \cite{summers_ADPwithSOS} the authors use sum-of-squares programming techniques to compute high-order polynomial approximate value functions using the iterated Bellman inequality. The use of high-order polynomials would reduce the difficulty of choosing the state relevance weighting, however, the optimization problem to solve becomes formidable.
Given a family of lower bounding approximate value functions, computed via the LP approach to ADP, taking a point-wise maximum over the family will yield the same or better approximation of the value function. However, to the best of our knowledge, no algorithm exists that explicitly aims to maximize this point-wise maximum combination; attempting to do this directly leads to a non-convex optimization problem.
The benefit of a point-wise maximum combination is empirically demonstrated in \cite{boyd_2014_iterated_bellman_inequality} for a simple example, with the set of state relevance weighting parameters hand-picked using problem-specific insight.
In our previous work \cite{beuchat_2017_pwm_at_CDC}, we proposed a problem formulation with the point-wise maximum combination used in the Bellman inequality. The formulation was used to develop an iterative algorithm for computing lower bounding approximate value functions, however, the quality of the approximation, comparable with that of \cite{boyd_2014_iterated_bellman_inequality}, still relies on the designer choosing a sequence of state relevance weightings.
The algorithm proposed in \cite{hohmann_2018_moment_ddp} also uses the point-wise maximum combination in the Bellman inequality, and the authors propose an algorithm that computes the sequence of state relevance weightings based on simulating the evolution of the system in a so-called \emph{forward pass}. They consider a finite horizon setting and it is not clear how to extend the algorithm to an infinite horizon setting.
A variety of other ADP algorithms compute lower bounds using theoretical tools different from the Bellman inequality, for example \cite{pereira_1991_ddp,rantzer_2006_relaxing_dp,bart_2013_performance_bounds}, each with its advantages and disadvantages, and none of which are similar to the algorithms we propose.
In this paper, we propose a formulation that explicitly aims to maximize a point-wise maximum of lower bounding approximate value functions, and we use this to develop novel algorithms for computing sub-optimality bounds.
In particular, the contributions of the paper are:
\begin{itemize}
\item We introduce the point-wise maximum formulation of DP and prove that it is equivalent to the LP approach under standard assumptions for SOC problems.
\item We propose a gradient ascent algorithm for finding approximate solutions to the point-wise maximum formulation, and prove that it converges to stationary points. We provide an interpretation of the gradient ascent steps as an algorithmic choice of the state relevance weighting for the non-convex problem of maximizing the point-wise maximum objective.
\item We propose an algorithm for computing initial conditions for the gradient ascent and prove that it converges in finite iterations for any tolerance. This algorithm is required because, for non-convex problems, the quality of a gradient ascent solution is influenced by the initial condition.
\end{itemize}
In support of the contributions, we provide numerical results to demonstrate the sub-optimality bounds achieved and computation time required.
Section~\ref{sec:dp} presents the point-wise maximum DP formulation.
Section~\ref{sec:adp} introduces the approximation methods and our proposed algorithms.
Section~\ref{sec:numerical} demonstrates the performance through numerical examples.
\section{Approximate Dynamic Programming (ADP)} \label{sec:adp}
This section proposes an algorithm for computing an approximate value function that is feasible for problem \eqref{eq:pwm_nlp_for_V} at every iteration and analyzes its convergence.
\subsection{Approaches Adopted for Difficulties (D\ref{difficulty:F}), (D\ref{difficulty:Tu}) and (D\ref{difficulty:infcon})} \label{sec:adp:existing}
To overcome difficulty (D1), as suggested in \cite{schweitzer_1985_originalMDP}, we restrict the value functions candidates to the span of a finite family of Borel-measurable basis functions $\smash{\phi_k \!:\! \mathcal{X} \!\rightarrow\! \rdim{}}$, $\smash{k\!=\!1,\dots,K}$. We parameterize the restricted function space as,
\begin{equation} \label{eq:approx_func_spaces}
\hat{\mathcal{F}}\!\left(\mathcal{X}\right) = \setdef{ \alpha^\intercal \, \phi(x)}{ \alpha\in\rdim{K} }
,\hspace{0.20cm}
\text{with}
\;
\phi(x) = \matb{\phi_1(x) \\ \vdots \\ \phi_K(x) }
\hspace{-0.00cm}.
\end{equation}
The benefit of this parameterization is that it is linear in the $\alpha$ parameter.
Each approximate value function $\hat{V}\left(#1\right)_j$ is parameterized by its own vector that we denote $\alpha_j$, i.e., $\smash{\hat{V}\left(#1\right)_j(x) \!=\! \alpha_j^\intercal \, \phi(x)}$ for all $x\!\in\!\mathcal{X}$.
For the numerical examples in Section~\ref{sec:numerical} we use the space of polynomial functions up to a certain degree by choosing the $\phi_k$ to be each of the monomials up to that degree.
To overcome difficulty (D\ref{difficulty:Tu}) we first use Jensen's inequality to switch the order of expectation and maximisation in the $\bellmanOp[u]{}V_{\mathrm{PWM}}$ term, thus providing a sufficient condition for constraint \eqref{eq:pwm_nlp_for_V:pwm_ineq}. We then require that for each basis function $\smash{\expval{}{\phi\left( g(x,u,\xi)\right)}}$ has an analytic expression.
In the case of polynomial basis functions and polynomial dynamics, this requires knowledge of the moments of the distribution of $\xi$ up to the maximum degree of $\xi$ in $\phi\left( g(x,u,\xi)\right)$. If the required moments are not analytically available, then the Monte Carlo sampling can be used to approximate them, and, as the distribution is stationary, this only needs to be computed once.
To overcome difficulty (D\ref{difficulty:infcon}), a variety of convex sufficient conditions techniques are proposed in the literature for approximating \eqref{eq:pwm_nlp_for_V:pwm_ineq} with a finite number of constraints, for example \cite{boyd_2014_iterated_bellman_inequality, summers_ADPwithSOS,lasserre_2009_soc_via_occupation_measures,nikos_2013_ADPforReachability}. The applicable reformulation depends on the problem data and basis functions, and the algorithm we propose in the sequel applies for all such convex inner approximations.
For example, when all problem data is polynomial and polynomial basis functions are used, then constraint \eqref{eq:pwm_nlp_for_V:pwm_ineq} can be inner approximated using the sum-of-squares (SOS) S-procedure \cite{summers_ADPwithSOS}.
\subsection{Proposed Approach for Difficulties (D\ref{difficulty:intobj}), (D\ref{difficulty:nccon}) and (D\ref{difficulty:ncobj})} \label{sec:adp:pwm_objective}
The inclusion of the point-wise maximum value function in the objective \eqref{eq:pwm_nlp_for_V:objecitve} is pivotal in the algorithm we propose, however, it precludes the use of previous approaches for evaluating the integral in the objective.
To overcome difficulty (D\ref{difficulty:intobj}) we replace $\nu$ by a finitely supported measure denoted $c$. Specifically, we choose $c$ as a finite sum of $N_c$ Dirac pulses located at $\smash{ \{x_{c,i}\}_{i=1}^{N_c} \subset \mathcal{X}}$.
This violates the hypothesis for equivalence between \eqref{eq:bellman} and \eqref{eq:lp_for_V}, but reduces the multidimensional integral in \eqref{eq:pwm_nlp_for_V:objecitve} to a sum over the locations of the Dirac pulses.
For clarity of presentation, we consider now an auxiliary problem that highlights our proposed approach for overcoming difficulties (D\ref{difficulty:nccon}) and (D\ref{difficulty:ncobj}).
We consider two families of functions defined by two finite sets $\smash{\mathcal{A}_{\mathrm{obj}}, \mathcal{A}_{\mathrm{con}} \!\subset\! \rdim{K}}$. The first family, parameterized by $\smash{\bar{\alpha}_{\mathrm{obj}} \!\in\! \mathcal{A}_{\mathrm{obj}}}$ is used in a point-wise maximum objective, while the second, parameterized by $\smash{\bar{\alpha}_{\mathrm{con}} \!\in\! \mathcal{A}_{\mathrm{con}}}$, is used in a point-wise maximum constraint. We then define,
\begin{subequations}
\begin{align}
\bar{V}_{\mathrm{obj}}(x) = \max_{\bar{\alpha}_{\mathrm{obj}}\in\mathcal{A}_{\mathrm{obj}}} \hspace{0.2cm}
\bar{\alpha}_{\mathrm{obj}}^\intercal \phi(x)
\,,\hspace{0.2cm} \forall \, x\!\in\!\mathcal{X}
,
\\
\bar{V}_{\mathrm{con}}(x) = \max_{\bar{\alpha}_{\mathrm{con}}\in\mathcal{A}_{\mathrm{con}}} \hspace{0.2cm}
\bar{\alpha}_{\mathrm{con}}^\intercal \phi(x)
\,,\hspace{0.2cm} \forall \, x\!\in\!\mathcal{X}
,
\end{align}
\end{subequations}
and assume that $\mathcal{A}_{\mathrm{obj}}$ and $\mathcal{A}_{\mathrm{con}}$ have been selected such that $\smash{\bar{V}_{\mathrm{obj}} \!\leq\! V^\ast}$ and $\smash{\bar{V}_{\mathrm{con}} \!\leq\! V^\ast}$ for all $\smash{x\!\in\!\mathcal{X}}$.
Additionally, we introduce $\smash{\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M} : \rdim{K} \rightarrow \rdim{}}$ as the point-wise maximum objective function when adding an additional function $\smash{\alpha^\intercal \phi(x) \!\in\! \hat{\mathcal{F}}\!\left(\mathcal{X}\right)}$ to the function $\bar{V}_{\mathrm{obj}}$, i.e.,
\begin{equation}
\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}\left(\alpha \right) = \frac{1}{N_c} \sum\limits_{i=1}^{N_c} \, \max\left\{ \alpha^\intercal \hspace{-0.02cm} \Vbasis(x_{c,i}) , \bar{V}_{\mathrm{obj}}(x_{c,i}) \right\}
\,,
\end{equation}
where $x_{c,i}$ are the points selected to overcome difficulty (D\ref{difficulty:intobj}).
The auxiliary problem for maximizing $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$ in the presence of $\bar{V}_{\mathrm{obj}}$ and $\bar{V}_{\mathrm{con}}$ is,
\begin{subequations} \label{eq:canonical_inner_problem}
\begin{align}
\max_{\alpha \in \rdim{K}} \hspace{0.15cm}&
\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}\left(\alpha \right)
\label{eq:canonical_inner_problem:objective}
\\
\text{s.t.} \hspace{0.15cm}&
\alpha^\intercal \hspace{-0.02cm} \Vbasis(x) \leq \left( \bellmanOp[u]{} \bar{V}_{\mathrm{con}} \right) (x,u)
\,, \hspace{0.2cm}
\forall \, x\!\in\!\mathcal{X} ,\, u\!\in\!\mathcal{U}
\,.
\label{eq:canonical_inner_problem:pwm_ineq}
\end{align}
\end{subequations}
With $\bar{V}_{\mathrm{con}}$ as fixed parameters in \eqref{eq:canonical_inner_problem} the constraint is convex in the decision variable $\alpha$, thus overcoming difficulty (D\ref{difficulty:nccon}). Moreover, if $\bar{V}_{\mathrm{con}}$ satisfies the Bellman inequality, then \eqref{eq:canonical_inner_problem:pwm_ineq} implies that $\max\left\{\alpha^\intercal \hspace{-0.02cm} \Vbasis,\bar{V}_{\mathrm{con}}\right\}$ also satisfies the Bellman inequality. The steps to show convexity of constraint \eqref{eq:canonical_inner_problem:pwm_ineq}, first presented in \cite{beuchat_2017_pwm_at_CDC}, are provided in Appendix \ref{app:pwm_ineq_reformulation} for completeness.
In Section~\ref{sec:adp:pwm_algorithm} we present the proposed algorithm for iteratively adding elements to $\mathcal{A}_{\mathrm{con}}$ in a greedy fashion, where the difference compared to \cite{beuchat_2017_pwm_at_CDC} is the choice of objective weighting.
To simplify the presentation, we introduce the notation,
\begin{equation} \nonumber
\alpha \in BI\left(\mathcal{A}_{\mathrm{con}}\right) \subseteq \rdim{K}
\hspace{0.2cm} \Rightarrow \hspace{0.2cm}
\alpha \text{ satisfies \eqref{eq:canonical_inner_problem:pwm_ineq}}
\,,
\end{equation}
to represent the convexified Bellman inequality constraint \eqref{eq:canonical_inner_problem:pwm_ineq}.
Despite the convexified constraint, \eqref{eq:canonical_inner_problem} is still a non-convex problem due to (D\ref{difficulty:ncobj}).
In general, problem \eqref{eq:canonical_inner_problem} will have multiple distinct local maxima and stationary points.
The convexity of the objective means that given element of the sub-differential, constructed at a particular point in the decision variable space $\alpha$, it parameterizes a hyperplane that is a point-wise lower-bound on the objective function.
Thus we propose to iteratively maximize along sub-gradient directions to overcome difficulty (D\ref{difficulty:ncobj}), and in Section~\ref{sec:adp:gradient_algorithm} we introduce the algorithm and its convergence properties.
\newcommand{k}{k}
\begin{figure}
%
\removelatexerror
%
\begin{algorithm}[H]
\caption{Find points satisfying necessary optimality conditions of problem \eqref{eq:canonical_inner_problem} with $c$ as a sum of Dirac pulses}
\label{alg:inner_problem}
\begin{algorithmic}[1]
%
\Procedure{InnerProblem}{ $\smash{\alpha^{(0)}}$, $\mathcal{A}_{\mathrm{obj}}$, $\mathcal{A}_{\mathrm{con}}$ , $\epsilon$ }
%
\State $k\gets 0$
%
\Repeat
%
\State $d^{(k)} \gets$ an element from $\partial^+ \mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}\left( \alpha^{(k)} \right)$
\label{alg:inner_problem:subdiff}
%
\If{$\left( d^{(k)} = 0 \right)$ }
\label{alg:inner_problem:zero_subdiff}
%
\State $\alpha^{(k+1)} \gets \alpha^{(k)}$
\label{alg:inner_problem:zero_subdiff:break}
%
\Else
\State $\alpha^{(k+1)} \gets$ $\smash{\argmax{} \!\! \left\{ \alpha^\intercal \, d^{(k)} \,;\, \alpha \!\in\! BI(\mathcal{A}_{\mathrm{con}}) \right\}}$
\label{alg:inner_problem:lp}
%
\EndIf
%
\State $k\gets k+1$
%
\Until{$\Big( \mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}\left(\alpha^{(k)} \right) - \mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}\left(\alpha^{(k-1)} \right) \Big) < \epsilon$.}
\label{alg:inner_problem:equal_objective}
%
\State \textbf{return} $\alpha^{(k)}$
%
\EndProcedure
\end{algorithmic}
\end{algorithm}
%
\end{figure}
\subsection{First-order method for the point-wise maximum objective}\label{sec:adp:gradient_algorithm}
We propose Algorithm \ref{alg:inner_problem} to improve $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$ from a given feasible initial condition $\alpha^{(0)}$ using only first-order information of the objective function.
The objective $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$ is in general non-smooth as it is a maximum of functions, thus in line \ref{alg:inner_problem:subdiff} we use the upper sub-differential for selecting gradient ascent directions, denoted as $\partial^+ \mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$ and defined in Appendix \ref{app:differentiability_definitions}; an upper sub-differential is considered because \eqref{eq:canonical_inner_problem} is a maximization problem.
Given a non-zero element from the upper sub-differential, i.e., an upper sub-gradient, in line \ref{alg:inner_problem:lp} we update the decision variable by maximizing along the sub-gradient direction within the feasible region.
The algorithm terminates when the change in objective value between two subsequent iterations is less than a pre-specified tolerance.
To compute an element from the upper sub-differential of $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$, to be used in line \ref{alg:inner_problem:subdiff} of Algorithm~\ref{alg:inner_problem}, we introduce the following assumption on the basis functions.
\vspace{0.1cm}
\begin{assumption} \label{ass:basisfunctions}
%
The basis functions in the set $\smash{ \left\{ \phi_k \right\}_{k=1}^{K} }$ are continuous for all $x\!\in\!\mathcal{X}$ and include the constant function.
%
\end{assumption}
\vspace{0.1cm}
Without loss of generality we take $\smash{ \phi_1(x) \,=\, 1 }$ for all $x\!\in\!\mathcal{X}$.
For a general choice of basis functions $\phi_k$ it is difficult to characterize the upper sub-differential set at non-smooth points.
Instead, we work with a particular element from the upper sub-differential of $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$ that is readily computable at $\alpha$ under Assumption \ref{ass:basisfunctions},
\begin{equation} \label{eq:pwmobj_subdiff}
\partial^+ \mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}\left( \alpha \right) \ni
\frac{1}{N_c} \sum\limits_{i=1}^{N_c}
\begin{cases}
\phi(x_{c,i}) & \text{if}\, \alpha^\intercal \hspace{-0.02cm} \Vbasis(x_{c,i}) \geq \bar{V}_{\mathrm{obj}}(x_{c,i})
\\
0 & \text{if}\, \alpha^\intercal \hspace{-0.02cm} \Vbasis(x_{c,i}) < \bar{V}_{\mathrm{obj}}(x_{c,i})
\end{cases}
,
\end{equation}
where the term inside the sum is an element from the upper sub-differential of $\smash{\max\left\{ \alpha^\intercal \hspace{-0.02cm} \Vbasis(x) , \bar{V}_{\mathrm{obj}}(x) \right\}}$.
Given the element $\smash{\bar{d} \in \partial^+ \mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}}\left( \bar{\alpha} \right)$ computed as per \eqref{eq:pwmobj_subdiff} at a point $\smash{\bar{\alpha}\!\in\!\rdim{K}}$, the hyperplane
$\smash{\left( \alpha - \bar{\alpha} \right)^\intercal \bar{d} + f\left( \bar{\alpha} \right)}$
is a supporting hyperplane of the convex function $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$. However, we note that for maximization of a convex function not all supporting hyperplanes are in the upper sub-differential.
In the proof of Theorem \ref{thm:inner_problem_algorithm_convergence} we show that \eqref{eq:pwmobj_subdiff} is indeed an element of the upper sub-differential.
Algorithm \ref{alg:inner_problem} can be seen as a method that iteratively adjusts the objective of line~\ref{alg:inner_problem:lp} along sub-gradient directions of problem~\eqref{eq:canonical_inner_problem}.
To ensure that an element from the argmax can always be computed in line~\ref{alg:inner_problem:lp}, we introduce the following assumption on the choice of basis functions and inner approximation set.
\vspace{0.1cm}
\begin{assumption} \label{ass:lp_attainment}
The basis function set $\smash{ \left\{ \phi_k \right\}_{k=1}^{K} }$, Bellman inequality inner approximation set $BI(\mathcal{A}_{\mathrm{con}})$, and problem data are such that the following optimization problem,
\begin{equation} \label{eq:adp:lp_approach:dirac_objective}
\max\limits_{\alpha\in\rdim{K}} \left\{\,
\alpha^\intercal \hspace{-0.02cm} \Vbasis(x_{c,i})
\hspace{0.1cm};\hspace{0.1cm}
\alpha \in BI(\mathcal{A}_{\mathrm{con}})
\,\right\}
\end{equation}
attains its maximum for all $\smash{ \{x_{c,i}\}_{i=1}^{N_c} }$.
\end{assumption}
\vspace{0.1cm}
This assumption is not overly restrictive as it can be ensured for any general problem instance by placing an upper bound on a norm of $\alpha$, see \cite{sutter_2018_infinite_to_finite} for example. For a particular problem instance the assumption can be verified by, for example, showing the existence of a strictly feasible point in the dual of \eqref{eq:adp:lp_approach:dirac_objective} \cite[Theorem 3.1]{boyd_1996_sdp} \cite[Corollary 30.5.2]{rockafellar_2015_convexanalysis}.
\vspace{0.2cm}
\begin{theorem} \label{thm:inner_problem_algorithm_convergence}
Under Assumptions~\ref{ass:basisfunctions} and~\ref{ass:lp_attainment}, for any initial condition $\smash{\alpha^{(0)} \!\in\! BI(\mathcal{A}_{\mathrm{con}})}$ and any $\smash{\epsilon \!>\! 0}$, Algorithm \ref{alg:inner_problem} generates a non-decreasing sequence $\smash{ \mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}\left(\alpha^{(k)}\right)}$ and terminates after a finite number of iterations.
%
With $\smash{\epsilon \!=\! 0}$, the sequence $\smash{ \mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}\left(\alpha^{(k)}\right)}$, converges to a finite value, and the sequences $\smash{ \alpha^{(k)} }$, $\smash{ d^{(k)} }$, satisfy the following necessary optimality condition for $\smash{ \max\nolimits_{\alpha\in\rdim{K}} \left\{ \mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}(\alpha) \hspace{0.01cm};\hspace{0.05cm} \alpha \!\in\! BI(\mathcal{A}_{\mathrm{con}}) \right\} }$ in the limit,
\begin{equation} \nonumber
\lim\limits_{k \rightarrow \infty}\left(\,
\min\limits_{\alpha \in BI(\mathcal{A}_{\mathrm{con}})} \, \left(\alpha-\alpha^{(k)}\right)^\intercal d^{(k)}
\,\right)
\,=\, 0
\,.
\end{equation}
\end{theorem}
\vspace{0.1cm}
\begin{IEEEproof}
see Appendix \ref{app:inner_problem_algorithm_convergence_proof}.
\end{IEEEproof}
\vspace{0.2cm}
Theorem \ref{thm:inner_problem_algorithm_convergence} guarantees that if the initial condition $\alpha^{(0)}$ strictly improves on $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}(0)$, then $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}(\alpha^{(i)})$ returned also strictly improves on $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}(0)$. The convergence in finite iterations ensures that the algorithm is practical to implement, and the limiting behaviour suggests that in the best case the $\alpha^{(i)}$ returned could be close to a local maxima. Although Theorem \ref{thm:inner_problem_algorithm_convergence} provides no insight into the rate of convergence, the numerical examples in Section \ref{sec:numerical} demonstrate that significant improvement in $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$ can be achieved with only a handful of iterations.
Algorithm \ref{alg:inner_problem} is a so-called \emph{Minorize Maximize} algorithm for maximizing a convex function, and we now contrast with generic algorithms that exist in the literature for this same purpose.
In the case where $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$ is differentiable, then line \ref{alg:inner_problem:subdiff} of Algorithm \ref{alg:inner_problem} becomes $\smash{d^{(k)} \leftarrow \nabla \mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}( \alpha^{(k)})}$ and is a special-case of the so-called \emph{convex-concave procedure} introduced in \cite{yuille_2003_cccp}, and for which convergence guarantees are given in \cite[Theorem 4]{lanckriet_2009_cccp_convergence}.
Algorithms applicable for non-smooth problems like \eqref{eq:canonical_inner_problem} are presented together with convergence guarantees in \cite[Theorem 3]{pham_1997_dca} and \cite[Proposition 1]{koulik_2018_cccp_nonsmooth}. Applying the algorithm from \cite{pham_1997_dca} or \cite{koulik_2018_cccp_nonsmooth} to problem \eqref{eq:canonical_inner_problem} would require using the lower sub-differential of $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$ in line \ref{alg:inner_problem:subdiff} of Algorithm \ref{alg:inner_problem}.
For a non-smooth convex function the lower sub-differential contains the upper sub-differential, thus allowing more flexibility on line \ref{alg:inner_problem:subdiff} of Algorithm \ref{alg:inner_problem}.
However, \cite{pham_1997_dca} and \cite{koulik_2018_cccp_nonsmooth} use the lower sub-differential also for defining necessary optimality conditions. This means that, compared to Algorithm \ref{alg:inner_problem}, the algorithms from \cite{pham_1997_dca} and \cite{koulik_2018_cccp_nonsmooth} may have additional points in their convergence set that are not local maxima of the non-smooth convex maximization problem.
\newcommand{m}{m}
\begin{figure}
%
\removelatexerror
%
\begin{algorithm}[H]
\caption{Maximise the value of $\int \bar{V}_{\mathrm{obj}} dc$}
\label{alg:outer_problem}
\begin{algorithmic}[1]
\Procedure{OuterProblem}{}
\State \textbf{Select} $\mathcal{A}_{\mathrm{obj}}$ , $\mathcal{A}_{\mathrm{con}}$ , $\smash{ \{x_{c,i}\}_{i=1}^{N_c} }$ according to \textsection\ref{sec:adp:discussion}
\State \textbf{Select} $\epsilon_{\mathrm{IN}} ,\, \epsilon_{\mathrm{OUT}} \,<\, 0$
\State $m\gets 0$
\Repeat{}
\State $f^{(m)} \gets$ $\frac{1}{N_c} \sum\limits_{i=1}^{N_c} \left(\, \max\limits_{\bar{\alpha}_{\mathrm{obj}}\in\mathcal{A}_{\mathrm{obj}}} \hspace{0.1cm} \bar{\alpha}_{\mathrm{obj}}^\intercal \phi(x_{c,i}) \,\right)$
\vspace{0.1cm}
\label{alg:outer_problem:start_objective}
\ForAll{ $\{x_{c,i}\}_{i=1}^{N_c}$ }
\label{alg:outer_problem:start_for}
\State $\alpha^{(0)} \gets$ $\smash{\argmax{} \!\! \left\{ \alpha^\intercal \hspace{-0.02cm} \Vbasis(x_{c,i}) ; \alpha \!\in\! BI(\mathcal{A}_{\mathrm{con}}) \right\}}$
\label{alg:outer_problem:generate}
\State $\tilde{\alpha} \gets$ \textsc{InnerProblem}$\left(\smash{\alpha^{(0)}}, \bar{V}_{\mathrm{obj}}, \bar{V}_{\mathrm{con}}, \epsilon_{\mathrm{IN}} \right)$
\label{alg:outer_problem:refine}
\State $\mathcal{A}_{\mathrm{obj}} \gets$ $\tilde{\alpha} \,\cup\,\mathcal{A}_{\mathrm{obj}}$
\State $\mathcal{A}_{\mathrm{con}} \gets$ $\tilde{\alpha} \,\cup\,\mathcal{A}_{\mathrm{con}}$
\EndFor
\label{alg:outer_problem:end_for}
\State $m\gets m+1$
\vspace{0.1cm}
\State $f^{(m)} \gets$ $\frac{1}{N_c} \sum\limits_{i=1}^{N_c} \left(\, \max\limits_{\bar{\alpha}_{\mathrm{obj}}\in\mathcal{A}_{\mathrm{obj}}} \hspace{0.1cm} \bar{\alpha}_{\mathrm{obj}}^\intercal \phi(x_{c,i}) \,\right)$
\vspace{0.1cm}
\label{alg:outer_problem:end_objective}
\Until{$\left( f^{(m)} - f^{(m-1)} \right) < \epsilon_{\mathrm{OUT}}$,}
\label{alg:outer_problem:equal_objective}
\State \textbf{return} $\mathcal{A}_{\mathrm{obj}}$ , $\mathcal{A}_{\mathrm{con}}$
\EndProcedure
\end{algorithmic}
\end{algorithm}
\end{figure}
\subsection{Point-wise Maximum ADP Algorithm} \label{sec:adp:pwm_algorithm}
In this section we propose Algorithm \ref{alg:outer_problem}, which iteratively updates the value function estimates used in the objective and constraints of problem \eqref{eq:canonical_inner_problem}, i.e., $\bar{V}_{\mathrm{obj}}$ and $\bar{V}_{\mathrm{con}}$.
At each iteration of lines \ref{alg:outer_problem:start_for}--\ref{alg:outer_problem:end_for}, a candidate approximate value function $\alpha^{(0)}$ is generated by solving \eqref{eq:adp:lp_approach:dirac_objective} with $x_{c,i}$ as one of the Dirac pulse locations from $c(\cdot)$. Algorithm \ref{alg:inner_problem} refines this candidate before it is added to the collections $\mathcal{A}_{\mathrm{obj}}$ and $\mathcal{A}_{\mathrm{con}}$. This process of generating, refining, and adding is repeated for all $x_{c,i}$, $\smash{i=1,\dots,N_c}$. The algorithm terminates when the improvement in $\bar{V}_{\mathrm{obj}}$ is below some pre-specified threshold.
The following theorem formalises the convergence properties of Algorithm \ref{alg:outer_problem}.
\vspace{0.2cm}
\begin{theorem} \label{thm:outer_problem_algorithm_convergence}
For any sets $\mathcal{A}_{\mathrm{obj}}$ and $\mathcal{A}_{\mathrm{con}}$ such that $\bar{V}_{\mathrm{obj}}$ and $\bar{V}_{\mathrm{con}}$ are point-wise under-estimators of $V^\ast$, and for any $\smash{ \epsilon_{\mathrm{IN}},\, \epsilon_{\mathrm{OUT}} > 0 }$, Algorithm \ref{alg:outer_problem} terminates after a finite number of iterations.
\end{theorem}
\vspace{0.1cm}
\begin{IEEEproof}
%
By Theorem \ref{thm:inner_problem_algorithm_convergence} we have that line \ref{alg:outer_problem:refine} of Algorithm \ref{alg:outer_problem} terminates after finite iterations for all $\smash{\epsilon_{\mathrm{IN}}\!>\!0}$.
%
The sequence $f^{(m)}$ in non-decreasing by definition as a point-wise maximum of functions and because elements are never removed from the set $\mathcal{A}_{\mathrm{obj}}$. The same reasoning as Appendix \ref{app:inner_problem_algorithm_convergence_proof} establishes that $\smash{ \max\nolimits_{\left\{ \bar{\alpha}_{\mathrm{obj}}\in\mathcal{A}_{\mathrm{obj}} \right\}} \hspace{0.1cm} \bar{\alpha}_{\mathrm{obj}}^\intercal \phi(x)}$ is bounded above for all $\smash{ \{x_{c,i}\}_{i=1}^{N_c} }$ at all iterations of Algorithm \ref{alg:outer_problem}. Hence $f^{(m)}$ is bounded above and is thus a convergent sequence.
%
Therefore, for all $\smash{\epsilon_{\mathrm{OUT}} \!>\! 0}$ there must exist an $\smash{m \!\geq\! 1}$ such that the condition on line \ref{alg:outer_problem:equal_objective} triggers.
%
\end{IEEEproof}
\vspace{0.2cm}
The convergence of Algorithm \ref{alg:outer_problem} is guaranteed even without the refinement steps of Algorithm \ref{alg:inner_problem}. However, our numerical results in Section~\ref{sec:numerical} show that without refinement convergence tends to be much slower, and that significant improvements are achieved with only a few iterations of Algorithm \ref{alg:inner_problem}. Hence, the gradient-based motivation and theoretical guarantees of Theorem \ref{thm:inner_problem_algorithm_convergence} suggests that performing the refinement steps of Algorithm \ref{alg:inner_problem} is beneficial.
The objective $\alpha^\intercal \hspace{-0.02cm} \Vbasis(x_{c,i})$ in line \ref{alg:outer_problem:generate} of Algorithm \ref{alg:outer_problem} is chosen so that the $\alpha^{(0)}$ passed to Algorithm \ref{alg:inner_problem} has a non-zero sub-gradient $d^{(0)}$ (line~\ref{alg:inner_problem:subdiff} of Algorithm~\ref{alg:inner_problem}). To see this, note that the sub-gradient in \eqref{eq:pwmobj_subdiff} is non-zero if $\alpha^\intercal \hspace{-0.02cm} \Vbasis(x_{c,i})$ weakly dominates $\bar{V}_{\mathrm{obj}}(x_{c,i})$ for at least one $\smash{i=1,\dots,N_c}$. Thus, by Assumption \ref{ass:lp_attainment}, line \ref{alg:outer_problem:generate} of Algorithm \ref{alg:outer_problem} computes an $\alpha^{(0)}$ that weakly dominates $\bar{V}_{\mathrm{obj}}$ at the chosen point $x_{c,i}$ if such a solution exists in the feasible set $\alpha \!\in\! BI(\mathcal{A}_{\mathrm{con}})$.
Different objectives for line \ref{alg:outer_problem:generate} of Algorithm \ref{alg:outer_problem} can be considered and still enjoy the convergence guarantee of Theorem \ref{thm:outer_problem_algorithm_convergence}. However, this would introduce a tuning parameter and empirical testing has shown no benefit when hand-tuning the objective.
\subsection{Discussion and extensions} \label{sec:adp:discussion}
Considering the motivating problem \eqref{eq:pwm_nlp_for_V} with objective $\int V_{\mathrm{PWM}} d\nu$, the obvious choice for $c$ is to draw samples from $\nu$, and to choose $\nu$ as the initial state distribution. However, sampling $c$ in different ways may improve the objective $\int V_{\mathrm{PWM}} d\nu$, and for this reason $c$ is commonly referred to as the \emph{state relevance weighting} \cite{vanRoy_2003_lpapproach}. The sub-gradient computed by \eqref{eq:pwmobj_subdiff} effectively sub-samples the points from $c$ where the current approximate value function dominates the fixed $\bar{V}_{\mathrm{obj}}$. Thus Algorithm \ref{alg:inner_problem} can be seen a method for automatically choosing the state relevance weighting parameter to maximize $\mathcal{P}\hspace{-0.08cm}\mathcal{W}\hspace{-0.12cm}\mathcal{M}$, i.e., the surrogate for $\int V_{\mathrm{PWM}} d\nu$.
If the goal is to optimize the on-line performance of the greedy policy, it is again likely that difference choices of $\nu$, and hence different samples for $c$, lead to differing on-line performance. Motivated by the performance bounds provided in \cite{vanRoy_2003_lpapproach}, a reasonable choice is to place Algorithm \ref{alg:outer_problem} inside another iteration that updates $\nu$ as the discounted occupancy measure for the current greedy policy, computed empirically by simulating the system evolution using Monte Carlo sampling.
For real-time applications where the greedy policy must be computed very fast, it is necessary that the cardinality of $\mathcal{A}_{\mathrm{obj}}$ is small, and perhaps even a singleton.
For examples with linear dynamics, quadratic stage costs, polytopic spaces, and using the space of quadratics for $\hat{\mathcal{F}}\!\left(\mathcal{X}\right)$, then the greedy policy is a Quadratically Constrained Quadratic Program (QCQP), with the number of quadratic constraints equal to the cardinality of $\mathcal{A}_{\mathrm{obj}}$. In such examples, a low cardinality of $\mathcal{A}_{\mathrm{obj}}$ has clear benefits from an on-line compution perspective.
In these cases it is beneficial to run Algorithm~\ref{alg:outer_problem} twice. First, Algorithm~\ref{alg:outer_problem} is run for as long as practical to achieve a good under-estimate of $V^\ast$, with a simple initialization, for example $\smash{\mathcal{A}_{\mathrm{obj}}\!=\!\mathcal{A}_{\mathrm{con}}\!=\!\{0\}}$. Second, Algorithm~\ref{alg:outer_problem} is run for as many iterations as the desired cardinality of $\mathcal{A}_{\mathrm{obj}}$, with $\mathcal{A}_{\mathrm{con}}$ initialized as the under-estimate resulting from the first run.
The approximate value function computed by Algorithm~\ref{alg:outer_problem} can be used off-line to certify the empirical performance of alternative policies that do not use the approximate value function.
In this case Algorithm~\ref{alg:outer_problem} is run for as long as practical, then the chosen policy is simulated from a particular initial state, $\hat{x}$, for a time horizon such that $\gamma^t$ has decayed sufficiently. The approximate value function evaluated at the initial state is a lower bound on $V^\ast(\hat{x})$ and thus provides a bound on the sub-optimality of the policy, and hence indicates the potential benefit of considering further alternatives.
In \cite{beuchat_2017_pwm_at_CDC} the value function decision variable was also included in the right-hand-side of constraint \eqref{eq:canonical_inner_problem:pwm_ineq}, i.e.,
\begin{equation} \nonumber
\alpha^\intercal \hspace{-0.02cm} \Vbasis(x) \leq \left( \bellmanOp[u]{} \left( \max\left\{ \alpha^\intercal \hspace{-0.02cm} \Vbasis(x) , \bar{V}_{\mathrm{con}}(x) \right\} \right) \right) (x,u)
\,,
\end{equation}
for all $x\!\in\!\mathcal{X}$ and $u\!\in\!\mathcal{U}$.
This results in a bi-linear term in the constraint, and in that work the authors suggest gridding the multiplier of the bi-linear term. We do not consider this extension in the numerical examples because it adds significant computation time and empirically it provides little or no benefit for the examples considered.
Algorithm \ref{alg:inner_problem} can be extended to fit multiple new lower bounding functions at the same time. To exemplify, consider the case of adding two new lower bounding functions. The non-convex optimization problem then becomes,
\begin{subequations} \nonumber
\begin{align}
\max_{\alpha,\beta \in \rdim{K}} \hspace{0.15cm}&
\frac{1}{N_c} \sum\limits_{i=1}^{N_c} \, \max\left\{ \alpha^\intercal \hspace{-0.02cm} \Vbasis(x_{c,i}) , \beta^\intercal \hspace{-0.02cm} \phi(x_{c,i}) , \bar{V}_{\mathrm{obj}}(x_{c,i}) \right\}
\\
\text{s.t.} \hspace{0.15cm}&
\alpha \!\in\! BI(\mathcal{A}_{\mathrm{con}})
\,, \hspace{0.2cm}
\beta \!\in\! BI(\mathcal{A}_{\mathrm{con}})
\,.
\end{align}
\end{subequations}
We construct an element from the upper subdifferential in a similar fashion,
\begin{equation} \nonumber
\begin{aligned}
&\, \partial^+\left(\, \max\left\{ \alpha^\intercal \hspace{-0.02cm} \Vbasis(x) , \beta^\intercal \hspace{-0.02cm} \phi(x) , \bar{V}_{\mathrm{obj}}(x) \right\} \,\right)
\\
=&\, \begin{cases}
\matb{ \phi(x)^\intercal , 0 }^\intercal & \text{if}\, \alpha^\intercal \hspace{-0.02cm} \Vbasis(x) \geq \max\left\{ \beta^\intercal \hspace{-0.02cm} \phi(x) , \bar{V}_{\mathrm{obj}}(x) \right\}
\\
\matb{ 0 , \phi(x)^\intercal }^\intercal & \text{if}\, \beta^\intercal \hspace{-0.02cm} \phi(x) > \max\left\{ \alpha^\intercal \hspace{-0.02cm} \Vbasis(x) , \bar{V}_{\mathrm{obj}}(x) \right\}
\\
\matb{ 0 , 0 }^\intercal & \text{if}\, \bar{V}_{\mathrm{obj}}(x) > \max\left\{ \alpha^\intercal \hspace{-0.02cm} \Vbasis(x) , \beta^\intercal \hspace{-0.02cm} \phi(x) \right\}
\end{cases}
\,.
\end{aligned}
\end{equation}
As the constraints are separable we see that once the subdifferential element is computed, then line~\ref{alg:inner_problem:lp} of Algorithm~\ref{alg:inner_problem} can be solved in parallel for $\alpha$ and $\beta$, differing only in the objective vector. | {'timestamp': '2019-03-19T01:02:49', 'yymm': '1901', 'arxiv_id': '1901.03619', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03619'} | arxiv |
\section{Introduction}
\begin{figure*}[!t]
\centering
\includegraphics[width=6.5in]{Framework.pdf}
\DeclareGraphicsExtensions.
\caption{The pipeline of the proposed LGAN schema which includes a generator network and a discriminator network. A Deep Deconvnet Network is trained to generate the lung mask while an Adversarial Network is trained to discriminate segmentation maps from the ground truth and the generator, which, in turn, helps the generator to learn an accurate and realistic lung segmentation of the input CT scans.}
\vspace{-15pt}
\label{fig_lgan}
\end{figure*}
Computerized tomography (CT) is a clinical imaging modality, that is key to, and sometimes the first step in, the diagnosis of various lung diseases, including lung cancer, which has been the leading cause of cancer-related deaths in the United States with the overall five-year survival rate of $17\%$ \cite{c1}. CT scan images allow a physician to confirm the presence of a tumor, measure its size, identify its precise location and determine the extent of its involvement with other nearby tissue. With an increasing use of CT imaging for diagnosis, treatment planning, and clinical studies, it has become almost compulsory to use computers to assist radiologists in clinical diagnosis and treatment planning.
Lung segmentation is an initial step in analyzing medical images obtained to assess lung disease. For example, early detection of lung nodules in lung cancer screening with CT is a tedious task for human readers and could be significantly improved with artificial intelligence. Researchers proposed a number of lung segmentation methods which fall into two categories: hand-crafted feature-based methods and deep learning-based methods. Compared to the hand-crafted feature-based methods, such as region growing \cite{adams1994seeded}, active contour model \cite{kass1988snakes}, and morphological based model \cite{mansoor2015segmentation}, deep learning-based methods (\cite{harrison2017progressive}, \cite{mansoor2015segmentation}, \cite{adams1994seeded}, \cite{kass1988snakes}, \cite{lalonde2018capsules}, \cite{zhao2018lung}) could automatically learn useful features \cite{lecun2015deep} without manually empirical parameter adjustments.
Existing hand-crafted feature-based lung segmentation methods are usually performed through a series of procedures with manually empirical parameter adjustments. Various sets of 2D-based \cite{mansoor2015segmentation} and 3D-based methods \cite{sun2012automated} are developed to achieve a high quality segmented result.
However, these traditional segmentation techniques are designed for specific applications, imaging modalities, and even datasets. They are difficult to be generalized for different types of CT images or various datasets since different kinds of features and different parameter/threshold values are extracted from different datasets. Moreover, the feature extraction procedure is monitored by users and the features/parameters are analyzed and manually and interactively adjusted.
In this paper, in contrast, we propose an end-to-end deep learning Generative Adversarial Network (GAN) based lung segmentation schema (LGAN), where the input is a slice of lung CT scan and the output is a pixel-wise mask showing the position of the lungs by identifying whether each pixel belongs to lung or not. Furthermore, the proposed schema can be generalized to different kinds of networks with improved performance.
Recently, several deep learning-based pixel-wise classification methods have been proposed in computer vision area and some of them have been successfully applied in medical imaging. Early deep learning-based methods are based on bounding box \cite{Tan2017}. The task is to predict the class label of the central pixel(s) via a patch including its neighbors. Kallenberg \textit{et al.} \cite{kallenberg2016unsupervised} designed a bounding box based deep learning method to perform breast density segmentation and scoring of mammographic texture. Shin \textit{et al.} \cite{shin2016deep} compared several networks on the performance of computer-aided detection and proposed a transfer learning method by utilizing models trained in computer vision domain for medical imaging problem. Instead of running a pixel-wise classification with a bounding box, Long \textit{et al.} \cite{long2015fully} proposed a fully convolutional network (FCN) for semantic segmentation by replacing the fully connected layers with convolutional layers. An Auto-Encoder alike structure has been used by Noh \textit{et al.} \cite{noh2015learning} to improve the quality of the segmented objects. Later, Ronneberger \textit{et al.} \cite{ronneberger2015u} proposed a U-net model for segmentation, which consists of a contracting part as an encoder to analyze the whole image and an expanding part as a decoder to produce a full-resolution segmentation. The U-net architecture is different from \cite{long2015fully} in that, at each level of the decoder, a concatenation is performed with the correspondingly cropped feature maps from the encoder. This design has been widely used and proved to be successful in many medical imaging applications such as Lumbar Surgery\cite{baka2017ultrasound} and gland segmentation\cite{manivannan2017structure}. Most recently, Lalonde et al. \cite{lalonde2018capsules} designed a convolutional-deconvolutional capsule network, called SegCaps, to perform lung segmentation, where they proposed the concept of deconvolutional capsules.
After the emergence of Generative Adversarial Network (GAN) \cite{GAN} based models, which have shown a better efficiency in leveraging the inconsistency of the generated image and ground truth in the task of image generation, Luc \textit{et al.} \cite{luc2016semantic} proposed a GAN based semantic segmentation model. The motivation is to apply GAN to detect and correct the high-order inconsistencies between ground truth segmentation maps and the generated results. The model trains a segmentation network along with an adversarial network that discriminates segmentation maps coming either from the ground truth or from the segmentation network. Following this idea, Zhao et al. \cite{zhao2018lung} proposed to use adversary loss to perform lung segmentation, where the segmentor is a fully convolutional neural network.
Both of their works utilize the original GAN structure, which, however, due to its loss function design, original GAN suffers from the problem of learning instability such as {mode collapse, which means all or most of the generator outputs are identical} (\cite{arjovsky2017wasserstein},\cite{arjovsky2017towards}).
To avoid this problem, Arjovsky et al. \cite{arjovsky2017wasserstein} proposed an optimized GAN structure which uses a new loss function based on the Earth Mover (EM) distance and in the literature is denoted as WGAN. It should be noted that WGAN is designed to solve the same problem as the original GAN, which is to leverage the inconsistency of the generated image and ground truth in the task of image reconstruction instead of generating an accurate segmentation from a given type of images.
In this paper, to solve the medical image segmentation problem, especially the problem of lung segmentation in CT scan images, we propose LGAN (Generative Adversarial Network based Lung Segmentation) schema which is a general deep learning model for segmentation of lungs from CT images based on a Generative Adversarial Network (GAN) structure combining the EM distance based loss function. In the proposed schema, a Deep Deconvnet Network is trained to generate the lung mask while an Adversarial Network is trained to discriminate segmentation maps from the ground truth and the generator, which, in turn, helps the generator to learn an accurate and realistic lung segmentation of the input CT scans. The performance analysis on the dataset from a public database founded by the Lung Image Database Consortium and Image Database Resource Initiative (LIDC-IDRI) shows the effectiveness and stability of this new approach. The main contributions of this paper include:
\begin{enumerate}
\item We propose a novel end-to-end deep learning Generative Adversarial Network (GAN) based lung segmentation schema (LGAN) with EM distance to perform pixel-wised semantic segmentation.
\item We apply the LGAN schema to five different GAN structures for lung segmentation and compare them with different metrics including segmentation quality, segmentation accuracy, and shape similarity.
\item We perform experiments and evaluate our five LGAN segmentation algorithms as well as the baseline U-net model using LIDC-IDRI dataset with ground truth generated by our radiologists.
\item Our experimental results show that the proposed LGAN schema outperforms current state-of-the-art methods on our dataset and debuts itself as a promising tool for automatic lung segmentation and other medical imaging segmentation tasks.
\end{enumerate}
\begin{figure}[!t]
\centering
\includegraphics[width=0.5\textwidth]{Generator.pdf}
\DeclareGraphicsExtensions.
\caption{The architecture of the generator in the framework. Each blue box represents the feature map generated by convolution block. The number of channels is denoted on the bottom of the box. The lines on the top of the boxes indicate the concatenation operation of the feature map.}
\vspace{-10pt}
\label{generator}
\end{figure}
\section{The Proposed Method}
In this section, we first introduce the background knowledge of Generative Adversarial Network and then present the proposed LGAN schema.
\subsection{Generative Adversarial Networks}
Generative Adversarial Network (GAN) is a deep generative model initially proposed in \cite{GAN}, and later improved by DCGAN \cite{radford2015unsupervised} and WGAN \cite{arjovsky2017wasserstein}. A general GAN model consists of two kinds of networks named as the generator network and the discriminator network. The generator network is trained to generate an image similar to the ground-truth and meanwhile the discriminator network is trained to distinguish the generated image from the ground-truth image. By playing this two-player game, the results from the discriminator network help the generator network to generate more similar images and simultaneously the generated images as the input data help the discriminator network to improve its differentiation ability. Therefore, the generator network and the discriminator network are competing against each other while at the same time make each other stronger.
Mathematically, the goal of the generator network $G$ is to learn a distribution $p_z$ matching the ground-truth data in order to generate the similar data, while the goal of discriminator network $D$ is also to learn the distribution of the ground-truth data but for distinguishing the real data (i.e. from the real distribution $p_{data}$) from the generated data from $G$. The adversarial comes from the min-max game between $G$ and $D$, and is formulated as:
\begin{equation}
\small
\min_{G}\max_{D}V(D,G)=\mathbb{E}_{x \sim p_{data}(x)[log D(x)]}+
\mathbb{E}_{z\sim p_{z}(z)[log(1-D(G(z)))]},
\end{equation}
where, for a given real data $x$ and the corresponding generated data $G(z)$, the adversarial discriminator is trained to maximize the probability output for the real data $x$ (that is, $\mathbb{E}_{x \sim p_{data}(x)[log D(x)]}$) and minimize the probability output for the generated data (that is, $\mathbb{E}_{x \sim p_{data}(x)[log D(G(z))]}$) which is equivalent to maximizing $\mathbb{E}_{z\sim p_{z}(z)[log(1-D(G(z)))]}$, and on the other side, the generator is trained to generate $G(z)$ as similar as possible to $x$ so that the discriminator outputs the bigger probability value for $G(z)$, that is, to maximize $\mathbb{E}_{x \sim p_{data}(x)[log D(G(z))]}$ and equivalently minimize $\mathbb{E}_{z\sim p_{z}(z)[log(1-D(G(z)))]}$.
Luc et al. \cite{luc2016semantic} employed GAN model to perform segmentation task, where the role of the generator has been changed from generating synthetic images to generating segmentation masks for the original images, which has been proved to be effective on the task of lung segmentation by Zhao et al \cite{zhao2018lung}. The details of GAN based segmentation design will be specified in the next section.
As illustrated in \cite{arjovsky2017wasserstein}, the original GAN structure, which although achieves a great performance in various tasks, including replicating images, human language, and image segmentation, suffers from a \text{mode collapse} problem due to its loss design. To make the training process more stable, Arjovsky \textit{et al.} proposed WGAN using Earth Mover (EM) distance to measure the divergence between the real distribution and the learned distribution \cite{arjovsky2017wasserstein}. Specifically, given the two distributions, $P_{data}$ and $P_z$, with samples $x \sim P_{data}$ and $y \sim P_z$, the EM distance is defined as: \begin{equation}
W(P_{data},P_z)=\inf_{\gamma \in \prod(P_{data},P_z)}\mathbb{E}_{(x,y)\sim \gamma}[\left \| x-y \right \|],
\end{equation}
where $\prod (P_{data},P_z)$ represents the set of all joint distributions $\gamma(x, y)$ whose marginals are respectively $P_{data}$ and $P_z$, and the term $\gamma(x, y)$ represents the cost from $x$ to $y$ in order to transform the distributions $P_{data}$ into the distribution $P_z$. The EM loss actually indicates optimal transport cost. In this design, the loss for the generator network is:
\begin{equation}
L_G = -\mathbb{E}_{x \sim P_z}[D(x)].
\end{equation}
And the loss for the discriminator network is:
\begin{equation}
L_D = \mathbb{E}_{x \sim P_z}[D(G(x))]-\mathbb{E}_{x \sim P_{real}}[D(x)].
\end{equation}
\begin{figure}[!t]
\centering
\includegraphics[width=0.5\textwidth]{Discriminator.png}
\vspace{-10pt}
\DeclareGraphicsExtensions.
\caption{The architecture of different $D$ networks, where \textit{Conv} stands for convolution layer, \textit{FC} stands for fully-connected layer, \textit{BN} stands for Batch Normalization and \textit{LR} stands for LeakyReLU. For each convolution layer, the numbers represent kernel size, (down) pooling stride and number of kernels accordingly. Feature concatenation layer combines feature maps from different branches.}
\vspace{-10pt}
\label{fig:Discriminator}
\end{figure}
With the EM distance based loss, the GAN model becomes more powerful in generating high-quality realistic images and outperforms other generative models. While the WGAN is designed for image reconstruction, here we take advantage of the basic idea of WGAN, and design an efficient and enhanced deep learning Generative Adversarial Network based Lung Segmentation (LGAN) schema.
\subsection{Our LGAN Schema}
Our Generative Adversarial Network based Lung Segmentation (LGAN) schema is designed to force the generated lung segmentation mask to be more consistent and close to the ground truth and its architecture is illustrated in Fig. \ref{fig_lgan}.
LGAN consists of two networks: the generator network and the discriminator network, and both of them are convolution neural networks. The generator network is to predict the lung segmentation masks based on the grayscale input images of CT slices, while the discriminator computes the EM distance between the predicted masks and the ground truth masks.
During the training and testing, the LGAN schema takes a slice of the lung CT scan $I_i$ as input, then the generator predicts a mask $M_i$ to illustrate the pixels belong to the lung. The quality of lung segmentation is judged by how well $M_i$ fools the discriminator network. In the rest of this section, we describe the three main components of our LGAN schema: Generator Network, Discriminator Network, and Training Loss.
\subsubsection{Generator Network}
The generator network is designed to generate the segmented mask of the input lung CT scan image. The mask labels all the pixels belonging to the lung. This segmentation task can be addressed as a pixel-wise classification problem to identify whether a pixel belongs to the lung area or not. Given an input CT slice $I_i$, the generator will predict the category of each pixel and generate a corresponding mask $M_i$ based on the classification result.
The architecture of our designed generator is illustrated in Fig.~\ref{generator}. The generator model consists of encoder and decoder parts. The encoder extracts the high-level features from the input CT scan by a bunch of convolution blocks, while the decoder reconstructs the mask from the high-level features. Both encoder and decoder are composed of convolution blocks, which are represented as blue boxes in the figure. The input of the generator network is normalized to $224 \times 224$ pixels and the generated mask is the same size as the input.
In the encoder part, each block has two convolution layers, both of which have the same number of filters with filter size $3 \times 3$ followed by a max-pooling layer, which performs a $2\times2$ down-pooling on the feature map.
In the decoder part, each block consists of one deconvolution layer and two convolution layers. For the convolution layers, similarly, each has the same number of filters with filter size $3 \times 3$. Instead of an up-pooling layer, we use the deconvolution layer with stride $2$ as suggested by Tran \textit{et al.} \cite{tran2016deep} because deconvolution layer can generate better quality images than an up-pooling layer. {Following other work, we add skip connection between the encoder and decoder.}
Following DCGAN \cite{radford2015unsupervised}, we employ LeakRelu as the activation function for the convolution layers which is first proposed in \cite{maas2013rectifier}. As shown below, to alleviate potential problems caused by ReLU, which sets $0$ to all negative values, LeakyReLU set a small non-zero gradient NegativeSlope, which is user pre-defined, to negative values. In the equation below, we represent this negative slope as $\alpha$.
\begin{equation}
\label{eq.evenly}
LeakyReLU(x,\alpha)= max(x,0)+ \alpha \times min(x,0).
\end{equation}
At the final layer, a $1*1$ convolution is performed to map each component feature vector to the final segmentation mask.
\begin{table*}[t]%
\centering
\caption{The list of all the proposed five LGAN structures and their corresponding descriptions.}
\label{tab:Models}
\begin{center}
\begin{tabular}{|c|c|c|c|}
\hline
Network & Input \\
\hline
{$LGAN_{Basic}$} & generated mask, one at a time.\\
\hline
{ $LGAN_{Product}$}&segmented original image based on the predicted mask.\\
\hline
$LGAN_{EF}$ &mask and original image are combined as one input with two channels. \\
\hline
$LGAN_{LF}$ & mask and original image as two inputs.\\
\hline
$LGAN_{Regression}$ & generated mask and ground truth, so as to approximate EM loss directly. \\
\hline
\end{tabular}
\end{center}
\centering
\vspace{-10pt}
\end{table*}%
\subsubsection{Discriminative Network}\label{DNet}
The task of the discriminative network is to distinguish the ground truth mask from the generated segmentation mask. We employ the EM distance to measure the difference between the real and the learned distributions as it has been proved to be a smooth metric \cite{arjovsky2017wasserstein}.
Given a generator, the discriminator approximates $E[X]$ function such that the EM loss $E[X]-E[Y]$ is approximated by $D(G(z))-D(Real)$. Compared to the discriminator in the original GAN, which performs a classification task, the new discriminator is actually performing a regression task (approximating the function $E(X)$).
Based on the different assumptions that could help improve the performance of the discriminator network, we propose five different designs for the discriminator network, which thus yield five different LGAN structures. The details of the five frameworks are demonstrated in Table \ref{tab:Models}. We discuss these five designs one by one in the next section.
\subsubsection{Training Loss}\label{GLoss}
As the original WGAN is designed for image reconstruction tasks, here we modify the training loss to fit for the segmentation task. Specifically, we modify the loss of generator $G$ by adding a Binary Cross Entropy (BCE) loss which calculates the cross-entropy between the generated mask and ground truth mask. Therefore, the loss of the generator network is:
\begin{equation}
\mathbb{BCE}[G(x),Real]-\mathbb{E}_{x \sim P_z}[D(x)],
\end{equation}
Where $P_z$ is the learned distribution from the ground-truth mask by $G$.
For the training loss of the discriminator $D$, different designs for the discriminator network may have the different training loss functions which are described in the next section.
\section{The Proposed LGAN Structures}\label{FiveLGAN}
In GAN-based image reconstruction tasks, the generated image and the ground truth image are very similar. However, for lung segmentation task, the pixel intensity in the generated mask is in $[0, 1]$ while the value in the ground truth mask is binary, that is, either $0$ or $1$. This fact may mislead the discriminator to distinguish the generated mask and the ground truth mask by simply detecting if the mask consists of only zeros and ones (one-hot coding of ground truth), or the values between zero and one (output of segmentation network).
With this observation, we explore all possible discriminator designs for lung segmentation task based on various assumptions, and provide five different LGAN structures: LGAN with Basic Network, LGAN with Product Network, LGAN with Early Fusion Network, LGAN with Late Fusion Network and LGAN with Regression Network. Their corresponding architectures are illustrated in Fig.~\ref{fig:Discriminator}. In the rest of this section, we introduce them accordingly.
\subsection{LGAN with Basic Discriminator}
The basic discriminator is to evaluate the generated mask and the ground truth mask separately and minimize the distance between the two distributions, which can be illustrated as (a) in Fig.~\ref{fig:Discriminator}. We denote the LGAN with this basic discriminator as $LGAN_{Basic}$ and it has a single channel with the network input size of $224\times224$.
In $LGAN_{Basic}$, the training loss of $G$ is the same as we described in section \ref{GLoss} and the training loss of $D$ is the following:
\begin{equation}
\mathbb{E}_{x \sim P_z}[D(G(x))]-\mathbb{E}_{x \sim P_{real}}[D(x)].
\end{equation}
Based on $LGAN_{Basic}$, we conjecture that the discriminator network may have a more precise evaluation if the original image is also provided as additional information. Under this assumption, we examine three strategies and design the $LGAN_{Product}$, $LGAN_{EF}$, and $LGAN_{LF}$ structures.
\begin{table}[!t]
\renewcommand{\arraystretch}{1.3}
\caption{ Performance comparison of different LGAN structures.}
\label{table_example}
\centering
\begin{tabular}{|c|c|c|c|c|}
\hline
&\multicolumn{2}{|c|}{Mean} & \multicolumn{2}{|c|}{Median} \\
\hline
Model &IOU & Hausdorff &IOU & Hausdorff\\
\hline
$Benchmark$ &0.6248 & 6.1062 & 0.7582 & 5.8310\\
\hline
$LGAN_{Basic}$ &0.9018 & 3.3672 & 0.9655 & 3.1622\\
\hline
$LGAN_{Product}$ &0.8858 & 3.4095 & 0.9635 & 3.3166\\
\hline
$LGAN_{EF}$ &0.9015 & 3.2836 & 0.9656 & 3.1622\\
\hline
$LGAN_{LF}$ &0.7911 & 3.5318 & 0.9444 & \textbf{3.0}\\
\hline
$LGAN_{Regression}$ &\textbf{0.9225} & \textbf{3.3802} & \textbf{0.9715} & 3.1622\\
\hline
\end{tabular}
\end{table}
\subsection{LGAN with Product Network}
Different from the basic discriminator where the inputs are the segmented mask and the ground-truth mask with only binary value, the product network takes, as the inputs, the lung volume images which are mapped out from the original CT scan image by the segmented mask and the ground-truth mask respectively. That is, given the segmentation mask, we obtain the lung volume image by modifying the original image such that the values within the segmented lung area are kept as they are but the values in the rest of the area are set to be 0. This design is motivated by the work of Luc et al. \cite{luc2016semantic}.
With this input, the discriminator network might be biased by the value distribution. Although in \cite{luc2016semantic} the deep learning model with the product network is not designed based on WGAN, we observe that the product network could still be used in our LGAN model and we define this LGAN structure as $LGAN_{Product}$. Note that the discriminator in $LGAN_{Product}$ differs from $LGAN_{Origin}$ only in inputs, so the discriminator in $LGAN_{Product}$ shares the same architecture as $LGAN_{Origin}$ shown in (a) of Fig.~\ref{fig:Discriminator}.
In $LGAN_{Product}$, the loss of G is the same as we described in section \ref{GLoss} and the training loss of D, which is product network, is the following:
\begin{equation}
\mathbb{E}_{x \sim P_z}[D(G(x)\circ I_i)]-\mathbb{E}_{x \sim P_{real}}[D(x)],
\end{equation}
where $\mathit{x} \circ \mathit{y}$ is a pixel-wise multiplication of matrix $\mathit{x}$ and $\mathit{y}$, and the mask and the original image has the same size.
\subsection{LGAN with Early Fusion Network}
Instead of taking only the mask as inputs, early fusion network takes both the whole original CT scan image and the segmentation/ground-truth mask as an input. To keep the design of single input, we concatenate the original image and the mask as one single image with two channels, where one channel is the original CT scan and the other is the mask. We denote $LGAN$ with this early fusion discriminator network as $LGAN_{EF}$.
The architecture of the discriminator in $LGAN_{EF}$ is shown in (a) of Fig.\ref{fig:Discriminator}. Different from $LGAN_{Basic}$ and $LGAN_{Product}$, $LGAN_{EF}$ has the input size of $224\times224$ with 2 channels which are the concatenation of the original CT scan and its mask. In $LGAN_{EF}$, the training loss of G is the same as we described in section \ref{GLoss} and the loss of the discriminator network is:
\begin{equation}
\mathbb{E}_{x \sim P_z}[D(G(x)\bigoplus I_i)]-\mathbb{E}_{x \sim P_{real}}[D(x)\bigoplus I_i],
\end{equation}
where $\mathit{x} \bigoplus \mathit{y}$ represents the operation of concatenating matrix $\mathit{x}$ and $\mathit{y}$ into a single matrix with 2 channels.
\subsection{LGAN with Late Fusion Network}
Another way of taking both the original image and the mask as an input in the discriminator network is to employ the late fusion technique. Specifically, the input of the discriminator is the concatenation of the high-level feature of the CT scan and the mask. We denote LGAN with this type of discriminator as $LGAN_{LF}$.
The corresponding architecture of the discriminator in $LGAN_{LF}$ is shown in (b) of Figure \ref{fig:Discriminator}. There are two branches of convolution operations in this discriminator. One is for the CT scans, and the other is for the masks. The two inputs first pass the two branches separately, and then their features are fused by a concatenate layer and pass through several convolution layers and down-sampling layers before they pass through the fully-connected layers to reach the final result. As the CT scan is more complicated than the mask to be understood by the network, we let the CT scan pass through more convolution layers before it features are concatenated.
In $LGAN_{LF}$, the training loss of $G$ is the same as we described in section \ref{GLoss} and the loss of the discriminator network is:
\begin{equation}
\mathbb{E}_{x \sim P_z}[D(G(x),I_i )]-\mathbb{E}_{x \sim P_{real}}[D(x, I_i)].
\end{equation}
\subsection{LGAN with Regression Network}
As we addressed in section~\ref{DNet}, in WGAN, the EM loss $E[X]-E[Y]$ is approximated by $D(G(z))-D(Real)$ where $D(G(z))$ and $D(Real)$ are evaluated separately and independently. Differently, we design the discriminator as a regression network to approximate the $E[D(G(z))]-E[D(Real)]$ where $D(G(z))$ and $D(Real)$ are evaluated together in the same network setting. The regression discriminator network takes two inputs, the real mask and the mask generated by the generator network. The output of the network is the approximated EM distance, and the network is optimized by minimizing the distance. We denote LGAN with this regression discriminator network as $LGAN_{Regression}$.
The architecture of the discriminator in $LGAN_{Regression}$ is shown in (c) of Figure \ref{fig:Discriminator}. Similar to the previous networks, the inputs in the regression discriminator network first separately pass through their own convolution branches and down-sampling layers before their features are concatenated together. And then the concatenated features pass through more convolution layers before getting into the fully-connected layer. In this discriminator network, the convolution branch consists of a long set of individual convolution layers.
In $LGAN_{Regression}$, the loss of $G$ is the same as we described in section \ref{GLoss} and the loss of the discriminator network is:
\begin{equation}
\mathbb{E}_{x_1 \sim P_z,x_2 \sim P_{real}}[D(G(x_1),x_2 )].
\end{equation}
{By playing the min-max game, the generator prevents the distance computed by discriminator from going to positive infinity while the discriminator network prevents it from going to negative infinity. The generator and the discriminator networks play this min-max game for several rounds until a tie is reached.}
\section{Experiments}
\subsection{Dataset}
The original RAW CT Scan images are acquired from the public database founded by the Lung Image Database Consortium and Image Database Resource Initiative (LIDC-IDRI), as we have previously used in \cite{han2015fast}.
There are 220 patients' CT Scans in our dataset, and each scan contains more than 130 slices. Each CT slice has a size of $512 \times 512$ pixels. We randomly select 180 patients' scans as the training data and the other 40 patients' scans as the testing data for experiments. To generate the ground-truth segmentation mask for lung segmentation, on each CT scan, we first apply the Vector Quantization based Lung segmentation method as described in \cite{han2015fast} to filter out major lung parts with region growing applied to smooth the result. Then the mask is further corrected by radiologists.
\subsection{Experiment Design}
Our proposed methods of five different LGAN structures are validated and compared on LIDC dataset. The comparison on structures are described in section~\ref{FiveLGAN} and are listed in TABLE~\ref{tab:Models}.
Furthermore, our best model is compared with the state-of-the-arts for lung segmentation task on LIDC-IDRI dataset following the same settings and evaluation metrics.
At last, as our method could serve as a pre-processing step for nodule detection. Therefore, three cases with lung nodules located close to the lung boundary are investigated to understand if our generated masks could include those nodules.
We use Adam \cite{kingma2014adam} optimizer with a batch size of $32$. All models are trained from scratch without using pretrained weights. The learning rate is set to $10^{-5}$, momentum to $0.9$, and weight decay to $0.0005$. The network is initialized with a Gaussian Distribution. During testing, only the Segmentor network is employed to generate the final mask. The source code will be made publicly available on the project website following the acceptance of the paper.
\subsection{Evaluation Metrics}
We take two metrics to evaluate the performance of the networks: segmentation quality and shape similarity.
\subsubsection{Segmentation Quality}
Intersection over Union (IOU) score is a commonly used for semantic segmentation. Given two images $X$ and $Y$, where $X$ is the predicted mask and $Y$ is the ground truth. The IOU score is calculated as:
\begin{equation}
IOU=\frac{X\cap Y}{X\cup Y},
\end{equation}
which is the proportion of the overlapped area to the combined area.
\subsubsection{Shape Similarity}
To evaluate the similarity between shapes, the commonly used Hausdorff distance \cite{rockafellar2009variational} is employed to measure the similarity between the segmented lung and the ground truth. In this paper, we use the symmetrical Hausdorff distance mentioned in \cite{nutanong2011incremental} as the shape similarity evaluation metric.
Given generated mask $ \mathfrak{M}$ and groundtruth $ \mathfrak{G}$, the symmetrical Hausdorff distance is calculated as:
\begin{equation}
\small
HausDist(\mathfrak{M},\mathfrak{G})=\max\begin{Bmatrix}
\sup_{x\in \mathfrak{M} } \inf_{y\in \mathfrak{G}} \left \| x-y \right \| ,
\\
\sup_{x\in \mathfrak{G} } \inf_{y\in \mathfrak{M}} \left \| x-y \right \|
\end{Bmatrix}.
\end{equation}
For all three evaluation metrics, we compute and compare their mean values as well as their median values.
\section{RESULTS}
\subsection{Comparison results of our proposed different structures}
\begin{figure}[!t]
\centering
\includegraphics[width=0.5\textwidth]{SegResult.pdf}
\vspace{-10pt}
\DeclareGraphicsExtensions.
\caption{Segmentation results of different LGAN structures on 3 lung CT slices. The first column is the ground truth masks of the lung areas on the CT slices. The green color represents the lung areas, while the blue color represents the other areas. The other columns are the segmentation results of different LGAN structures. }
\vspace{-15pt}
\label{fig_comp}
\end{figure}
The experimental results of LGAN are shown in TABLE~\ref{table_example}. The LGAN models achieve a significant improvement in the performance compared with U-Net, which is a segmentation network that has the same architecture as the generator network. The performance of LGAN is more than $20$\% higher than the benchmark, which demonstrates the effectiveness of the LGAN. All the LGAN achieve better performance than the generator alone, among which the $LGAN_{Regression}$ obtains the best performance.
To qualitatively study the performance of the proposed architectures and demonstrate the strength of our proposed GAN framework, we compare the performance of all the models on three CT slices. As shown in Fig.~\ref{fig_comp}, the significant improvement in lung segmentation using LGAN structures can be observed. All of the LGAN models can capture the lung area, while the $LGAN_{Regression}$ achieves the best result.
One problem of the neural network based methods is that it is hard to know what really happened inside the network. Therefore, besides segmentation accuracy, we would like to attain further insight into the learned convolution models. We select the most representative feature maps obtained by each layer of the generator. The feature maps of LGANs are illustrated in Fig.~\ref{fig_fmap}. The feature maps show that the network can extract the major information about lung boundary through the contracting part, and then gradually expanding the extracted highly compressed features into a clear mask. Obviously, the lung area tends to have a brighter color, which means higher activation, than the rest parts of the image.
\begin{figure}[!t]
\centering
\includegraphics[width=0.5\textwidth]{2D_Featuremap.pdf}
\DeclareGraphicsExtensions.
\vspace{-5pt}
\caption{Visualization of activations of the generator network. The activation maps from (b) to (i) correspond to the output maps from lower to higher layers in the generator. We select the most representative activation in each layer for effective visualization. The image (a) is the input image and image (k) is the predicted mask. The finer details of the lung are revealed, as the features are forward-propagated through the layers in the generator. It shows that the learned filters tend to capture the boundary of the lung.}
\vspace{-5pt}
\label{fig_fmap}
\end{figure}
\subsection{Comparison with State-of-the-Arts}
We compare the performance of our LGAN\textsubscript{Regression} model with the current state-of-the-arts of lung segmentation on LIDC-IDRI dataset, including the traditional benchmark method \cite{mansoor2015segmentation}, U-net model \cite{ronneberger2015u}, Tiramisu Network\cite{jegou2017one}, and SegCaps \cite{lalonde2018capsules}. The commonly used 3D Dice-score metrics and the mean as well as median values are calculated following the same settings. As shown in TABLE ~\ref{workcomp}, our model achieves the highest score comparing to current state-of-the-arts with an average Dice-score of 0.985 and a median Dice-score of 0.9864. Although SegCaps \cite{lalonde2018capsules} claims to have fewer parameters, the designed capsule is very memory consuming. Also, our model is much shallower than the 100-layer Tiramisu model \cite{jegou2017one} and achieves better performance. Meanwhile, our model outperforms the gNet \cite{zhao2018lung}, which utilizes the original GAN loss. Comparing to the traditional methods, such as Morph, which requires a series of thresholding, morphological operations, and component analysis, our end-to-end model provides an one-step solution. Moreover, as mentioned in \cite{zhao2018lung}, due to the high-resolution of the LIDC-IDRI CT volumes, 0.001 better Dice-score indicates that 5k more pixels are correctly covered.
\begin{table}[!t]
\renewcommand{\arraystretch}{1.3}
\caption{Performance Comparison with the state-of-the- arts (3D Dice-score).}
\label{workcomp}
\centering
\begin{tabular}{|c|c|c|}
\hline
Model &Mean& Median\\
\hline
Morph \cite{mansoor2015segmentation} &0.862$\pm$2.93 & - \\
\hline
U-net \cite{ronneberger2015u} &0.970$\pm$0.59 & 0.98449 \\
\hline
Fusion gNet \cite{zhao2018lung} &0.983$\pm$0.05 & - \\
\hline
Tiramisu \cite{jegou2017one} & - & 0.9841 \\
\hline
SegCaps \cite{lalonde2018capsules} & - & 0.9847 \\
\hline
LGAN\textsubscript{Regression} & \textbf{0.985$\pm$0.03} & \textbf{0.9864}\\
\hline
\end{tabular}
\end{table}
\subsection{Case Study}
As lung segmentation usually serves as a pre-processing step for many tasks such as lung nodule detection, we investigate whether the segmented lung areas by our model include all nodules even when the nodules are very close to lung boundary. As shown in fig.~\ref{fig_nodule}, our method can include all the nodules inside the lung area besides achieving high-quality lung mask.
\begin{figure}[!t]
\centering
\includegraphics[width=0.5\textwidth]{compare.png}
\DeclareGraphicsExtensions.
\caption{Examples demonstrate our models are able to segment nodules which are close to lung boundary. The areas in Brown are the segmented lung and the green areas are the lung nodules.}
\vspace{-15pt}
\label{fig_nodule}
\end{figure}
\subsection{Discussion}
For our LGAN schema, we have designed five different discriminative networks, and evaluate these five structures with experiments on lung segmentation. The experimental results demonstrate that our proposed LGAN structures significantly outperform the basic GAN framework, which shows the effectiveness of the LGAN schema. Our model outperforms current state-of-the-arts of segmentation task on LIDC-IDRI dataset with higher Dice-score. Furthermore, our method can be an effective step for lung nodule detection task and can be applied to the nodules on lung boundary.
The generator network in our LGAN model is designed based on the currently most widely used benchmark method, U-Net. As the task of finding an optimal network structure is still ongoing, our LGAN schema could also be optimized correspondingly. A deeper network design would extract higher-level features but requires more data as well as more parameters and higher computation cost. Patch normalization and random initialization in our model training show a significant effect and the optimization method by Adam \cite{kingma2014adam} is also used in our work.
\section{CONCLUSIONS}
Lung segmentation is usually performed by methods such as thresholding and region growing. Such methods, on the one hand, require dataset-specific parameters, and on the other hand, require a series of pre- and post-processing to improve the segmentation quality. To reduce the processing steps for lung segmentation and eliminate the empirical based parameters adjustments, we have proposed a Generative Adversarial Network based lung segmentation schema (LGAN) by redesign the discriminator with EM loss. The lung segmentation is achieved by the adversarial between the segmentation mask generator network and the discriminator network which can differentiate the real mask from the generated mask. Such adversarial makes the generated mask more realistic and accurate than a single network for image segmentation. Moreover, our schema can be applied to different kinds of segmentation networks.
\bibliographystyle{IEEEtran}
| {'timestamp': '2019-01-14T02:08:57', 'yymm': '1901', 'arxiv_id': '1901.03473', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03473'} | arxiv |
\section{Introduction}\label{sec:Intro}
Over the years, different models have been proposed to describe evolutionary dynamics; they all describe how populations composed of members of different species change with time. These changes occur through death and birth events, and typically involve competition between individuals\cite{MaynardSmith1982, Ewens2004, Nowak2006a}. The models differ in the order in which these events are implemented and how competition takes place. For example, one distinguishes between `birth-death' and `death-birth' processes, or between global and local selection \cite{Nowak2006a,Zukewich2013,Kaveh2015}. Even though these seem to be relatively minor details, under certain circumstances they can lead to rather disparate outcomes\cite{Zukewich2013, Kaveh2015, Hindersin2015}. Choosing the right evolutionary model for a given biological system is therefore of great importance, but it is not a simple task.
There appears to be some tendency in the literature to simply choose one model and not argue in detail whether, for example, a birth-death or a death-birth process is better suited for the particular application at hand. While one could argue that most of these models are so stylised that the subtle differences between them are unimportant, significant differences in their predicted outcomes make it desirable to be able to distinguish between the options. This would enable one to make a more informed choice, and to identify the model which best captures the known behaviour of a given biological system.
In this paper we propose that such a possibility may exist if the members of the population are advected by an external flow. Specifically, we focus on the stochastic dynamics of a population initially composed only of wildtype individuals and a single invading mutant. The mutant will either be eliminated or its offspring will take over the population. We are interested in the latter outcome, and study the rate of successful fixation. We show that the response of the fixation probability to the flow speed can be very different for each evolutionary process. We speculate that this may be used to discriminate between different stylised models. In some experimental settings flow can be controlled externally, or situations without flow can be compared to those with fast flows. Differences in fixation probabilities have been found in static versus stirred populations of {\em Escherichia coli} for example\cite{Kerr2002,Habets2006,Perfeito2008a}. If such data is available, systematically studying the behaviour of different computational models of evolution in flowing populations can help to select the update mechanism which best captures the features of the biological system at hand.
\bigskip
The simplest approach to modelling stochastic evolution dispenses entirely with the notion of space and population structure, and assumes that the only relevant factors are the frequencies with which the different types of individuals are found in the population \cite{MaynardSmith1982,Ewens2004,Nowak2006a}. Each individual in such an unstructured population can interact with all other individuals at all times. To further simplify matters, birth and death events are usually coupled, so that one is immediately followed by the other; this facilitates the mathematical analysis, as it keeps the size of the population constant\cite{MaynardSmith1982, Ewens2004, Nowak2006a}.
If individuals are distributed in space, and have a limited range of interaction, the population becomes structured. Not every individual can interact with every other individual at all times. It is then helpful to consider the interaction graph of the population \cite{Nowak1992, Ebel2002, Nowak2006, Santos2006, Ohtsuki2006, Nowak2010, Szabo2007, Gross2008, Poncela2009, Masuda2009a, Broom2011, Perc2012, Wang2013, Perc2013, Hindersin2014, Jiang2014, Allen2017, Pavlogiannisa2018, Lieberman2005, Shakarian2012}. Nodes of these networks represent individuals, and links between nodes stand for potential interactions. Birth and death events take place between neighbouring nodes, that is, pairs of individuals connected by a link. The case of an unstructured population is recovered if links exist between any two individuals at all times; the interaction graph is then said to be complete.
Population structure has the potential to change the dynamics of evolutionary processes \cite{Nowak1992, Ebel2002, Nowak2006, Santos2006, Ohtsuki2006, Nowak2010, Szabo2007, Gross2008, Poncela2009, Masuda2009a, Broom2011, Perc2012, Wang2013, Perc2013, Hindersin2014, Jiang2014, Allen2017, Pavlogiannisa2018, Lieberman2005, Shakarian2012}. For example, species that would be selected against in an unstructured population are found to organise in clusters on networks, and in this way they can coexist with fitter types, or even eradicate the resident species. The time it takes for a species to reach fixation can be reduced or increased on networks. Evolution on simple graphs has been characterised mathematically (see for instance\cite{Lieberman2005,Broom2008,Broom2009,Houchmandzadeh2011a,Shakarian2012,Pattni2015} and references therein), but on more complicated networks the dynamics become much harder to describe analytically.
Further complication arises if the members of the populations are in motion. The interaction graph then becomes dynamic, making mathematical approaches more difficult. At the same time motion is a ubiquitous feature of biological systems, for example due to self-propulsion of microswimmers by means of flagella \cite{Lushi2014}, or advection of bacteria in a fluid environment \cite{Lapin2006}.
Common ways of implementing motion in computer models include migration; in such models individuals move to neighbouring sites on the interaction graph \cite{Nagylaki1980, McPeek1992, Hill2002a, Casagrandi2006, Houchmandzadeh2011, Thalhauser2015, Krieger2017}. Alternatively, adaptive networks have been considered; in these the link connecting two individuals is re-wired to a different individual, usually with preference for links between individuals of similar types \cite{Zimmermann2004, Zimmermann2005, Gross2006, Ehrhardt2006, Pacheco2006}. For further examples see also ref.~\cite{Gross2008} and references therein.
In this work, instead, we focus on populations that are not self-propelled, and use the type of motion one could expect in dynamic gaseous or aqueous environments. Specifically, the motion is due to a flow of the medium in which the population resides. The movement is not constrained by the current interaction network, and the interaction graph itself is dynamic. Evolutionary systems with this type of motion have been studied comparatively little; existing work includes refs.\cite{Krieger2017, Karolyi2005, Perlekar2011, Pigolotti2012, Pigolotti2012a, Pigolotti2013, Pigolotti2014, Plummer2018, Minors2018}. In ref.~\cite{Herrerias2018} we investigated stirred populations, and presented analytical solutions for the limit of very fast flows. Naively, one would expect that the success of a mutant under fast stirring is the same as the one on a complete graph, a situation also referred to as `well mixed' \cite{Ohtsuki2006, Nowak2010, Santos2006}. However, the results of ref.~\cite{Herrerias2018} showed that the fixation probability of an invading mutant approaches a different limiting value for very fast flows.
In this paper we investigate in more detail the effect of the flow speed on the fixation probability of invading mutants. In particular we also focus on intermediate and slow flows. We find that the way in which the flow affects the success of mutants depends on the choice of the evolutionary update rules.
We identify three main contributing factors: how well connected the initial mutant is with the rest of the population, the opportunities mutants have to organise in clustered groups, and how long individuals remain connected for as the flow moves them in space. These factors are influenced by the speed of the flow and, depending on the evolutionary update rule, they can either amplify or suppress selection relative to unstructured populations. This suggests the response of the fixation probability to flow speed as an indicator of the underlying evolutionary process. We think this can be a useful aid for choosing the most appropriate evolutionary model for given biological applications.
\section{Methods}\label{sec:Methods}
We use the same setup as ref.\cite{Herrerias2018}, and consider a population of fixed size $N$ composed of individuals of two species (wildtype and mutant). Unless specified otherwise, we use $N=100$. Individuals take positions in space within the two-dimensional domain $0\le x,y<1$ with periodic boundary conditions. Particles are subject to a continuous-time flow, moving them around in space, and to evolutionary dynamics, which change the frequencies of the two species in the population.
The motion of the particles is simulated through the so-called parallel shear flow\cite{Ottino1989,Neufeld2010}; we discuss the validity of our results for different flow fields in Sec.~\ref{sec:Discussion}. The velocity field of this flow is periodic in time, except for a random phase described below. During the first half of each period particles are moved vertically; the speed of each individual depends on the horizontal component of their position. During the second half of the period individuals move horizontally, with speeds dependent on their vertical positions. We write $v_x(x,y,t)$ and $v_y(x,y,t)$ for the velocity components of a particle at position $(x,y)$ at time $t$. Specifically, we use
\begin{align*}
v_y(x,y,t)=0,~&~v_x(x,y,t)= V_{\rm max}\sin\left[2\pi y+\psi\right], && \hspace{-6em} \mbox{for~} t\in[nT,nT+T/2),\\
v_x(x,y,t)=0,~&~v_y(x,y,t)= V_{\rm max}\sin\left[2\pi x+\psi\right], && \hspace{-6em} \mbox{for~} t\in[nT+T/2,(n+1)T),
\end{align*}
with $n=0,1,2,...$. The constant $V_{\rm max}$ sets the amplitude of the flow, and $T$ the period. The phase $\psi$ is drawn randomly from the interval $[0,2\pi)$ at the beginning of each half-period. Due to this random phase, the flow mimics chaotic motion; the trajectories of individuals who are initially close to each other diverge over time. At long times, the distribution of individuals moved by this flow is uniform in space \cite{Ottino1989,Neufeld2010}.
The evolutionary process is implemented through coupled birth and death events. The order in which reproduction and removal take place is important, and so we will distinguish between birth-death and death-birth processes. The evolutionary dynamics occur on an undirected interaction graph, dynamically generated by the flow. Specifically, we will say that one individual is a neighbour of another if they are within a distance $R$ of each other.
\medskip
Individuals are in continuous motion, but evolutionary events occur at discrete times, ${t=\Delta t, ~2\Delta t,...}$ in our model. Simulations are then implemented as follows:
\begin{enumerate}[nolistsep]
\item At $t=0$, a population of $N$ particles is placed into the spatial domain at designated initial positions. These define an initial interaction graph. Of these individuals, $N-1$ are wildtype and one is a mutant. The mutant is chosen uniformly at random from the population.
\item The individuals are moved by the flow for a time interval $\Delta t$, leading to a new interaction graph.
\item An individual is chosen from the entire population. In the case of a birth-death process, it is designated to reproduce; for death-birth processes it is designated to die.
\item One of the neighbours of this individual is chosen to be replaced (birth-death) or to reproduce (death-birth).
\item The individual chosen for death adopts the species (wildtype or mutant) of the reproducing individual.
\item Repeat from step 2.
\end{enumerate}
\medskip
In each evolutionary step two individuals are chosen. They can either be \textit{picked} at random or \textit{selected} proportional to fitness. For the latter case we focus on frequency-independent selection; we set the wildtype fitness to one, and write $r$ for the fitness of the mutant species. Consider for example a group of $n_w$ wildtype individuals and $n_m$ mutants. A mutant would be selected to reproduce from this group with probability $rn_m/(rn_m+n_w)$, or a wildtype with probability $n_w/(rn_m+n_w)$. If selection is for death we proceed similarly, but with $r$ replaced by $1/r$. In this way, mutants are less likely to die than wildypes if $r>1$. For $r<1$ the mutant species is selected against. The simulation results shown in this paper focus on advantageous mutants; we set $r=1.05$ throughout.
Selection proportional to fitness can take place either in step 3 of the above algorithm (when an individual is chosen from the entire population) or in step 4 (when it is chosen from the neighbours of an individual). We refer to these cases as \textit{global} and \textit{local} selection, respectively. Since we distinguish between birth-death and death-birth processes, four combinations are possible: global birth-death (\textbf{Bd}), global death-birth (\textbf{Db}), local birth-death (\textbf{bD}) and local death-birth (\textbf{dB}). The capital letter in these acronyms indicates that selection dependent on fitness occurs in the respective step.
In principle, one could also consider processes in which individuals are chosen proportional to fitness in both steps of the algorithm (\textbf{BD}, \textbf{DB})\cite{Zukewich2013,Kaveh2015}. In order to be able to disentangle the effects that the flow has on fixation probabilities due to local or global selection, we limit the discussion in the main text to scenarios in which selection acts either globally or locally, but not both. The \textbf{BD} ~and \textbf{DB} ~processes are discussed in the Supporting Information.
\begin{figure}[t]
\center
\includegraphics[width=0.65\textwidth]{Evol_Processes}
\caption{\textbf{Illustration of the update rules.}
Each row represents one of the different evolutionary update mechanisms. The columns indicate the different steps of each evolutionary event.
In column a) an individual is chosen from the whole population; it can be \textit{`selected'} through competition by fitness (red shading), or \textit{`picked'} at random, irrespective of its species (blue shading).
This node is destined to either reproduce (pink shading), or to be replaced (brown shading), as shown in column b).
Column c) indicates that one neighbour of this node is either \textit{selected} (red), or \textit{picked} (blue).
This second node is destined to reproduce (pink), or to be replaced (brown), shown in column d).
Column e) shows the result of the evolutionary event; the node chosen to reproduce places an offspring in place of the node chosen to die. Each row is composed of one box of each colour; the sequence of the colours distinguishes the different processes.
From top to bottom, the rows correspond to:
(i) global birth-death process (\textbf{Bd}): an individual is \textit{selected} from the whole population to reproduce, and one of its neighbours is \textit{picked} to be replaced by the first individual's offspring;
(ii) global death-birth process (\textbf{Db}): an individual is \textit{selected} to die from the whole population, and one of its neighbours is \textit{picked} to place an offspring in its place;
(iii) local birth-death process (\textbf{bD}): an individual is \textit{picked} from the whole population to reproduce, and one of its neighbours is \textit{selected} to die;
(iv) local death-birth process (\textbf{dB}): an individual is \textit{picked} from the whole population to die, and one of its neighbours is \textit{selected} to reproduce.
}
\label{fig:Processes}
\end{figure}
We illustrate the different evolutionary processes in Fig.~\ref{fig:Processes}. The upper two rows correspond to processes in which competition takes place among the entire population (\textit{global selection}). In the lower two rows the first node is picked irrespective of fitness, and competition takes place only among the neighbours of this node (\textit{local selection}). A step-by-step description of each of the processes can be found in the figure caption.
\medskip
One important characteristic of the flow is the typical timescale over which the set of neighbours of a given individual is renewed. More precisely, the set of neighbours of a given individual at time $t$, and at a later time $t+\tau$, will be uncorrelated provided $\tau$ is sufficiently large (see ref.\cite{Herrerias2018}, and the Supporting Information). This renewal time is in turn determined by the parameters $V_{\rm max}$, $T$ and $R$; following refs.\cite{Perez-Munuzuri2007,Galla2016}, we use $V_{\rm max}=1.4$ and $T=1$ throughout, and choose an interaction radius of $R=0.11$.
This choice of parameters leads to an estimate for the network renewal time of $\tau\approx 6.4$ (see Sec.~\ref{app:Timescales} in the Supporting Information for details). That is, the set of neighbours of one individual at one time is uncorrelated from its set of neighbours approximately six and a half flow periods earlier. It remains to specify how frequent evolutionary events are, i.e. to define the time step $\Delta t$ in the simulation described above. We treat this as a model parameter, and use $S=N \Delta t/T$ to quantify the number of generations elapsed in one flow period. Thus, $S$ indicates the speed of the flow relative to that of evolution. For small $S$, individuals move relatively little between evolutionary events (`slow flow'). Large values of $S$ describe fast flows. From here on, we will refer to $S$ as the \textit{speed} of the flow, and investigate the outcome of evolution for different choices of this parameter. The flow speed $S$ is understood throughout as relative to the rate of evolutionary events. We note that the inverse of $S$ is related to the Damk\"{o}hler number in fluid dynamics \cite{Young2001,Sandulescu2007,Neufeld2002}.
\section{Results}\label{sec:Results}
\subsection{Effects of the flow speed on the fixation probability}\label{sec:Random}
We first address the case in which the initial coordinates of each individual are drawn from a uniform distribution on the domain $0\leq x,y<1$. The initial interaction graph is then a random geometric graph (RGG)\cite{Gilbert1961}.
For any non-zero flow rate ($S>0$) any member of the population can eventually interact with any other individual, even if they were not connected on the initial interaction graph. This is due to the mixing properties of the flow, and means that no individual can indefinitely remain isolated from the rest of the population. As a consequence, the final outcome of the evolutionary process is either fixation or extinction of the mutant.
The fixation probability, $\phi$, for a beneficial mutation is depicted in Fig.~\ref{fig:FixProbS_R} as a function of the flow speed,~$S$. We show simulation results for the four different evolutionary processes \textbf{bD}, \textbf{dB}, \textbf{Bd}, and \textbf{Db}. Each data point is obtained from an ensemble of realisations. For comparison, we also show the fixation probability on a complete graph,~$\phi_{\rm {CG}}$. By definition, $\phi_{\rm CG}$ is independent of the flow speed, as all individuals interact with all others at all times. On complete graphs the fixation probability for global and local selection processes differ by a small amount\cite{Kaveh2015}.
\begin{figure}[t]
\center
\includegraphics[width=0.65\textwidth]{FixProbS_R}
\caption{\textbf{Fixation probability as a function of the flow speed for unrestricted random initial positions (random geometric graphs, RGGs).}
For the global death-birth process, increasing the flow speed increases the fixation probability. The reverse is found for the remaining three processes. Circle markers show fixation probabilities in the fast-flow limit; square markers are results for fixed connected random geometric graphs (CRGGs); see text for further details. The fixation probabilities on a complete graph are shown for reference.
}
\label{fig:FixProbS_R}
\end{figure}
Several interesting features can be observed in Fig.~\ref{fig:FixProbS_R}:
For slow flows, the order of reproduction and removal is found to have a strong effect on the fixation probability, and it is less relevant whether selection takes place in the first or the second step of each evolutionary event. For the local and global death-birth processes ($\textbf{dB}$, $\textbf{Db}$) the fixation probability is lower than on a complete graph, as shown by the green and blue lines in Fig.~\ref{fig:FixProbS_R}. Conversely, both \textbf{Bd} ~and \textbf{bD} ~show a higher fixation probability than on complete graphs (red and purple lines).
In the limit of fast flows, however, the outcome of evolution is mostly determined by whether selection is global or local, and not by the order of the reproduction and removal events (birth-death vs. death-birth). Specifically, when selection acts locally the fixation probability of the mutant is lower than on a complete graph (purple and blue lines). In contrast, when selection is global the fixation probability is the same as on a complete graph (red and green lines).
\medskip
These observations indicate unique responses of the fixation probability to the flow speed for the different processes. For the \textbf{Db} ~process (continuous green line in Fig.~\ref{fig:FixProbS_R}) the mutant's probability of success increases with the speed of the flow.
For the \textbf{Bd} ~process (continuous red line), the fixation probability decreases with increased flow speed, but is always greater than or equal to the one on a complete graph, $\phi\geq\phi_{\text CG}$. In contrast, the fixation probability for a \textbf{dB} ~process (dashed blue line) is always smaller than $\phi_{\text CG}$. Finally, for the \textbf{bD} ~process (dashed purple line) the fixation probability is higher than on a complete graph when the flow is very slow, but decreases at higher flow speeds and eventually becomes lower than on the complete graph. The \textbf{bD} ~process is the only case in which we observe a transition from amplification to suppression of selection (relative to the complete graph) as the flow speed is increased.
\medskip
In order to gain some insight into these observations, we first describe the dynamics in the limit of fast flows, summarising the results of ref.~\cite{Herrerias2018}. Then we discuss the no-flow limit, and subsequently the transition between the two extremes, at intermediate flow speeds.
\subsubsection*{Fast-flow limit: evolution of well-stirred populations}
When the flow is sufficiently fast the probability that any two particles are neighbours at the time of an evolutionary event is the same, irrespective of whether they were neighbours at the previous event or not\cite{Herrerias2018}. In global processes selection takes place when the first individual is chosen, i.e., competition acts amongst the whole population. Then, a second individual is picked at random from the neighbours of this first individual. Since any individual is equally likely to be neighbours of the individual selected in the initial step, the second, random pick, is equivalent to a random pick from the entire population. Therefore, in the limit of fast flows the fixation probability of global processes coincides with the one on complete graphs, as observed in Fig.~\ref{fig:FixProbS_R}.
For local processes, on the other hand, in each evolutionary event the first individual is chosen at random from the entire population, irrespective of fitness. Competition then takes place between the neighbours of this individual. Although all members of the population are equally likely to be part of this neighbourhood, at any one time the group of neighbours is a random subset of the population. This subset may not reflect the composition of the population as a whole, which can be shown to lead to suppression of selection\cite{Herrerias2018}. We briefly illustrate this for the case of a very small interaction radius; the majority of individuals then have at most one neighbour at any given time. Since this neighbour is the only contestant in local selection, fitness is irrelevant. Therefore, as the interaction radius becomes small the fixation probability of the mutant approaches the limit of neutral selection. When the interaction radius is large, however, it is more likely that the group of neighbours is large as well, and that population-wide frequencies are accurately represented. Therefore, the suppression effect relative to the complete graph is reduced. If the interaction range is so large that all individuals are connected with all other individuals at all times, a complete interaction graph is recovered.
Analytical results can be obtained for all four processes in the limit of very fast flows\cite{Herrerias2018}. Predictions from this theoretical approach are shown as filled circles on the right edge of Fig.~\ref{fig:FixProbS_R}.
\subsubsection*{No-flow limit: evolution on static heterogeneous graphs}
On the left-hand side of Fig.~\ref{fig:FixProbS_R} the flow is so slow that the evolutionary dynamics effectively take place on fixed graphs. Evolutionary processes on static graphs have been widely discussed in the literature (see e.g. \cite{Nowak2010, Perc2013, Shakarian2012} and references therein). The focus is often on characterizing specific graphs or graph structures, which either amplify or suppress selection\cite{Hindersin2016,Giakkoupis2016,Adlam2015}. Notably, the authors of ref.\cite{Hindersin2015} report that most undirected graphs amplify selection for birth-death processes, but suppress selection for death-birth processes. However, these findings are only given for relatively small networks, and only for processes in which selection acts in the reproduction step (\textbf{Bd} ~and \textbf{dB}).
In order to obtain a more complete picture, we measured in simulations the fixation probability of a single mutant on networks of different sizes, averaged over different static heterogeneous graphs. Each graph is generated by placing individuals at random in the spatial domain (see Sec.~\ref{sec:Methods}), resulting in a random geometric interaction graph. It is possible that a graph generated in this way consists of several disconnected components. In the absence of flow, the mutant then cannot reach fixation. We therefore restrict simulations to graphs with a single connected component and henceforth use the term \textit{connected} random geometric graphs (CRGGs). We present results for the different evolutionary processes as a function of the size of the graph in Fig.~\ref{fig:RandDomFix}.
The data shows that the average fixation probability of a single mutant on CRGGs is higher than on the complete graph for birth-death processes, $\phi\geq\phi_{\text CG}$. For death-birth processes, on the other hand, $\phi\leq\phi_{\text CG}$. This is in line with the results reported in ref.\cite{Hindersin2015} for small graphs. The data in Fig.~\ref{fig:RandDomFix} confirms that the amplification of selection (for birth-death processes) or suppression (for death-birth processes) is present regardless of the size of the network, if an average over many graphs is taken. The rightmost data points in Fig.~\ref{fig:RandDomFix} correspond to a population of the same size as the one in Fig.~\ref{fig:FixProbS_R}.
\begin{figure}[b]
\center
\includegraphics[width=0.45\textwidth]{RandDomFix_Rel}
\caption{\textbf{Fixed heterogeneous graphs amplify selection for birth-death processes and suppress it for death-birth processes.}
The figure shows the fixation probability of an invading mutant ($\phi$), averaged over static CRGGs. Data is shown relative to the corresponding fixation probability on a complete graph ($\phi_{CG}$).
Regardless of the population size, selection is amplified for \textbf{Bd} ~and \textbf{bD} ~processes, and suppressed for \textbf{Db} ~and \textbf{dB} ~processes.
}
\label{fig:RandDomFix}
\end{figure}
Intuition regarding the amplification or suppression of selection on static networks can be gained by studying the connectivity of the initial mutant (see refs.\cite{Antal2006,Sood2008,Broom2011,Maciejewski2014,Tan2014}). For death-birth processes, these studies find that the success of an advantageous mutant increases with its degree; for birth-death processes, its success decreases with connectivity. This can be understood in the following way: In each evolutionary event two individuals are chosen, the first from the entire population, and the second as a neighbour of the first. The degree of an individual does not affect its chances of being chosen in the first step, irrespective of whether selection acts in this step or not. However, the probability of being neighbours with the initial individual is higher for well connected individuals than for individuals with a low degree. Under birth-death processes, higher connectivity of the mutant therefore results in a higher chance of being replaced. For death-birth processes it results in a higher chance of reproduction.
In the literature these predictions have been tested for \textbf{Bd} ~and \textbf{dB} ~processes \cite{Antal2006,Sood2008,Broom2011,Maciejewski2014,Tan2014}. In the lower panel of Fig.~\ref{fig:MutPos0} we verify that the argument extends to all four evolutionary update rules defined above. We show, for CRGGs, the fixation probability of a mutant, $\phi_k$, as a function of its degree, $k$. For the global and local death-birth processes (\textbf{Db}, \textbf{dB}) the mutant's success is lower than on a complete graph when the mutant is sparsely connected, but larger if it is highly connected; the reverse is found for global and local birth-death processes (\textbf{Bd}, \textbf{bD}). These observations are consistent with the above reasoning.
\begin{figure}[t]
\center
\includegraphics[width=0.45\textwidth]{MutPos0}
\caption{\textbf{Significance of the degree of the initial mutant.} The upper panel shows the degree distribution, $p_k$, of the ensemble of connected random geometric graphs (CRGGs), obtained by placing $N=100$ individuals into the spatial domain $0\leq x,y\leq 1$ with uniform distribution, and using an interaction radius $R=0.11$ and periodic boundary conditions.
The lower panel shows the fixation probability obtained from simulating the evolutionary process on these graphs, as a function of the degree of the initial mutant. For the two death-birth processes the mutant's success is below the one on a complete graph if its degree is low, and above $\phi_{CG}$ at high connectivity. The reverse is found for the two birth-death processes. Data points have been connected as a visual guide.}
\label{fig:MutPos0}
\end{figure}
\medskip
In our model, the initial mutant is chosen uniformly at random from the members of the population. The probability that it has degree $k$ is thus determined by the degree distribution of CRGGs. We write $p_k$ for the probability of a random node to have degree $k$ in such a graph, and show the degree distribution for networks of size $N=100$ in the upper panel of Fig.~\ref{fig:MutPos0} for illustration. The overall probability of fixation of a single mutant is then $\phi=\sum_k p_k\phi_k$. Fixation probabilities obtained in this way are shown as square markers in Fig.~\ref{fig:FixProbS_R}~and~\ref{fig:RandDomFix}.
The results reproduce the amplification and suppression of selection (for birth-death or death-birth processes, respectively) in the limit of slow flows. We attribute quantitative differences between the markers and lines in Fig. \ref{fig:FixProbS_R} to effects of the non-zero flow and to the difference in initial conditions; the data shown as lines is obtained from simulations of slowly flowing populations in which the initial graph may consist of more than one component. In Sec.~\ref{sec:InitialPositions} we will discuss the difference due to initial positions in more detail.
\subsubsection*{Transition between fast-flow and no-flow limits}
As seen above, the outcome of evolution in rapidly stirred populations is very different to that on static interaction graphs. With fast flows, local competition leads to suppression of selection; on the other hand, the success of a mutant is the same as on a complete graph if selection is global. When there is no flow, the order of the birth and death events in the evolutionary process is crucial. In this case, selection is amplified for birth-death processes and suppressed for death-birth processes. At intermediate flow speeds, a crossover between these two regimes is seen. We will now discuss this transition in more detail.
On fixed heterogeneous graphs, the degree of the initial mutant determines whether its chances of success are greater or smaller than on a complete graph. In the presence of flow the interaction network constantly changes, and the number of neighbours of any one individual thus varies over time. Classifying a member of the population as highly or poorly connected is then at best possible over limited time windows. If the flow is slow relative to evolution, many evolutionary events occur in such a time window, and the evolutionary dynamics can conclude before the degrees of nodes undergo significant changes. Therefore the amplification or suppression effect due to the degree of the mutant can still be observed. For faster flows, however, the interaction network changes so quickly that there is no clearly defined notion of a degree of an individual on the time scale of evolution. The amplification or suppression effect set by the initial heterogeneous network is then washed out.
At very fast flow speeds, the set of neighbours of the individual chosen in the first step of an evolutionary update effectively becomes a group sampled at random from the entire population. Therefore, suppression of selection sets in for local processes. The fixation probability of global processes, on the other hand, approaches the one on a complete graph, as described previously.
The main effects leading to the transition between the no-flow and the fast-flow limits are thus the increasing variability (over time) of the degree of individuals, and the random sampling of the group of individuals taking part in evolutionary events. As a result of these two mechanisms, in Fig.~\ref{fig:FixProbS_R} we see a smooth transition between the two limits. The different responses of the fixation probability to the speed are a consequence of the limiting behaviours for very slow and very fast flows.
Although it is not immediately transparent from the results in Fig.~\ref{fig:FixProbS_R}, the flow has further effects on the evolutionary process. For example, it removes the influence of the initial positions of the individuals in space. Another important feature, particularly at intermediate flow speeds, is that the evolutionary process takes place on slowly changing heterogeneous graphs. The dynamic network constantly splits into disconnected components, which later merge and form new components. This fragmentation promotes the formation of `clusters' --- groups of nodes which are of the same species. This gives rise to further amplification or suppression effects, depending on the details of the evolutionary mechanics. In the following section, we explore these effects further.
\subsection{Effects of the initial positions of individuals}\label{sec:InitialPositions}
Our model describes a population in constant motion. It is then natural to assume that the positions of the individuals at the time the initial mutation occurs is drawn from the stationary distribution of the flow. For the periodic parallel shear flow this is the uniform distribution, used as an initial condition in the previous section. However, exploring different starting positions allows us to gain further insight into the effect of the flow on fixation probabilities.
\subsection*{Connected random geometric graphs (CRGGs)}
The data shown as lines in Fig.~\ref{fig:FixProbS_R} was obtained from simulations with random initial positions (RGGs) and non-vanishing flows. For this setup the interaction graph may not be connected, but fixation or extinction will still occur, provided there is non-zero flow. In order to explore the no-flow limit, in Figs.~\ref{fig:RandDomFix}~and~\ref{fig:MutPos0} we focused on static heterogeneous graphs instead; studying fixation in the strict absence of flow only makes sense when the interaction graph consists of one single connected component, and so we restricted the discussion to connected random geometric graphs (CRGGs).
As a result, comparison with the data in Fig.~\ref{fig:FixProbS_R} is difficult; in particular, we note the quantitative differences between the square markers, obtained from static connected graphs, and the limiting values of the data shown as lines in Fig.~\ref{fig:FixProbS_R}, obtained from slowly moving populations started from RGGs.
For comparison, we show data obtained from mobile populations, but started on CRGGs, in Fig.~\ref{fig:FixProbS_C}. The limiting values of the fixation probabilities for very slow flows (end of the tick lines on the left-hand side of the figure) now agree quantitatively with those obtained from static CRGGs (square markers).
\begin{figure}[t]
\center
\includegraphics[width=0.65\textwidth]{FixProbS_C}
\caption{\textbf{Comparison of fixation probability for simulations started from unrestricted and connected random geometric graphs (RGGs and CRGGs, respectively).}
The fixation probability as a function of the flow speed is shown as thick lines for simulations started on connected graphs; thin lines are for unrestricted initial positions (some of this data is also shown in Fig.~\ref{fig:FixProbS_R}). Square markers indicate the fixation probabilities on \textit{static} CRGGs; see text for details. The fixation probability on complete graphs is shown for reference. A minimum of $\phi$ is found for the \textbf{Db} ~process; maxima are discernible for \textbf{Bd} ~and \textbf{bD} ~when the dynamics are started from connected graphs. The effect of amplification/suppression of selection at slow flow speeds is more pronounced for simulations initialized from RGGs than from CRGGs.
}
\label{fig:FixProbS_C}
\end{figure}
The simulation data from Fig.~\ref{fig:FixProbS_R}, from simulations with unrestricted random initial positions, is also shown in Fig.~\ref{fig:FixProbS_C} (thin lines). If the flow is sufficiently fast, initial conditions are immaterial. On the contrary, for slow flows the fixation probability, $\phi$, for simulations started from unrestricted random graphs is different from that for connected initial conditions. For birth-death processes, $\phi$ is greater for the unrestricted case than for the connected one. The opposite is observed for death-birth processes. This indicates that the initial condition can have a significant effect on the outcome when then flow is slow.
\medskip
As briefly mentioned before, the fragmented nature of the unrestricted setup can isolate groups of nodes from the rest of the population. As the evolutionary dynamics proceed, this promotes the formation of clusters, i.e. parts of the graph in which all individuals are of the same species.
The degree of clustering can be quantified through the fraction of active links in the network, that is, the proportion of links between mutants and wildtypes among all links in the graph, $L_{\rm act}/L_{\rm tot}$. A small fraction of active links is an indicator of clustering. We show measurements of the fraction of active links in Fig.~\ref{fig:ActiveLinks} for both unrestricted and restricted random initial conditions (thin dotted lines and thick continuous lines, respectively). The data indicates that the fraction of active links is significantly larger when simulations are initialised on CRGGs than when started on RGGs.
\begin{figure}[t]
\center
\includegraphics[width=0.65\textwidth]{ActiveLinks}
\caption{\textbf{Fragmented initialization promotes the formation of clusters.}
The main panel shows the average proportion of active links as the evolutionary dynamics proceed. Thick lines correspond to simulations started from connected graphs (CRGGs); thin dotted lines to simulations initialized from unrestricted random positions (RGGs). The fraction of active links is lower for RGGs, regardless of the evolutionary process. \textbf{Inset:} Fixation probability of the mutant species, once there are $i$ mutants in the population. When mutants are a minority, a small increase in their frequency greatly increases their fixation probability. Conversely, reducing their numbers when they are a majority has only minor effects on their chances of success. Simulations in the inset are initialized from CRGGs.
}
\label{fig:ActiveLinks}
\end{figure}
The amplification or suppression of selection (for birth-death and death-birth processes, respectively) can then be supported by a similar argument to the one presented for the degree of the initial mutant. A smaller number of active links has the same effect as poor connectivity of the initial mutant; it does not affect the probability that the individual chosen in the first step of the evolutionary process is a mutant or a wildtype, but it reduces the probability that the individual chosen in the second step is of the opposite species (see also Sec.~\ref{app:WheelGraphs} of the Supporting Information).
In the early stages of the evolutionary process mutants are a minority, and are therefore less likely to be chosen in the initial step. A large number of active links then increases the chances that the neighbour of the initial individual is a mutant. Under birth-death processes this means that mutants are more likely to die; for death-birth processes they have more opportunities to reproduce. Therefore, a connected initial configuration (CRGGs), leading to a larger fraction of active links than arbitrary RGGs, reduces the fixation probability of a mutant under birth-death processes, and increases it for death-birth processes. This is in line with the results on the left-hand side of Fig.~\ref{fig:FixProbS_C}; the fixation probabilities for RGGs (dotted lines) are higher than their counterparts on CRGGs for birth-death processes (red and purple lines), but lower for death-birth processes (green and blue lines).
This argument is only valid when mutants are less abundant than wildtypes. The effect is reversed at later stages of the evolutionary process (if mutants become a majority). However, the results presented in Fig.~\ref{fig:FixProbS_C} suggest that there is a net advantage for the mutant in having fewer active links, for birth-death processes, or in having increased inter-species connectivity, for death-birth mechanics.
The inset in Fig.~\ref{fig:ActiveLinks} helps to understand this further. It shows the conditional fixation probability of the mutant species, given that a state with $i$ mutants has been reached. The shape of the curves indicates that increasing the number of mutants in the population has stronger repercussions on the fixation probability when mutants are a minority ($i/N\leq0.5$) than when they are the majority ($i/N\geq0.5$).
For death-birth processes, the selective effect due to increased active links drives the population composition to states with approximately equal frequencies of the two species. However, the mutants have more to gain (in terms of fixation probability) when their numbers are small than what they may lose when they are abundant. For birth-death processes, on the other hand, a large number active links acts in the opposite way; it hinders the spread of the mutant species when they are a minority and encourages it once they are abundant. Since more is lost in the early invasion than what can be gained at later stages, the overall fixation probability is lower than when there are fewer active links. The net effect of fragmentation (i.e., a reduced number of active links) is therefore amplification of selection for birth-death processes, and suppression for death-birth update rules.
\medskip
The amplification/suppression effect caused by the fragmented nature of the network can also be noticed at intermediate flow speeds. In this regime, the flow is sufficiently fast to disrupt the initial network structure before the evolutionary process reaches its conclusion (fixation or extinction of the mutant); disconnected components then develop. At the same time the flow is also slow enough to allow the formation of organised clusters of mutants and wildtypes through the evolutionary dynamics. Indeed, for simulations started on connected graphs a minimum in the fixation probability as a function of the flow speed is discernible for the \textbf{Db} ~process (thick green line in Fig.~\ref{fig:FixProbS_C}), and we also notice a shallow maximum for the \textbf{Bd} ~and \textbf{bD} ~processes (thick red and purple lines, respectively). The fragmentation from an initially connected network increases the fixation probability for birth-death processes and decreases it for death-birth processes. Movement of the population, and the resulting mixing between evolutionary events counteracts this amplification or suppression, driving fixation probabilities to their fast-flow limits. The balance of these two effects leads to the extrema in Fig.~\ref{fig:FixProbS_C}.
\subsection*{Square lattice}
Regular lattices are particularly convenient for the study of fixation probabilities. The nodes are distributed equidistantly in space, and they all have the same number of neighbours. This means that analytical results can be obtained in the absence of flows. For example, the isothermal theorem\cite{Lieberman2005} applies; the fixation probabilities of the global birth-death and death-processes are the same as those for complete graphs; only small deviations from $\phi_{CG}$ are expected for local-selection processes\cite{Kaveh2015}.
In order to relate the success of mutants in populations advected by flows to these benchmark results, we show the outcome of simulations in which individuals are initially placed on the nodes of a regular lattice in Fig.~\ref{fig:FixProbS_L}. Broadly, three different regimes can be distinguished:
\begin{figure}[t]
\center
\includegraphics[width=0.63\textwidth]{FixProbS_L}
\caption{\textbf{Fixation probability at different flow speeds for simulations started from a square lattice.}
For the global death-birth process a minimum of fixation probability is found at intermediate flow speeds; conversely, the global birth-death process shows a maximum. For the local processes no extrema are found; instead varying the flow speed interpolates monotonously between the behaviour on fixed lattices and the limit of fast flows.
}
\label{fig:FixProbS_L}
\end{figure}
\medskip
{\em Quasi-isothermal regime.} On the left-hand side of Fig.~\ref{fig:FixProbS_L} (slow flows) fixation probabilities for all processes are approximately the same as on complete graphs. This is to be expected; in the limit of slow flows the evolutionary process concludes before the lattice structure is modified. The interaction network remains regular and, in line with the isothermal theorem, the fixation probability for global processes (continuous lines) is the one known from complete graphs; results for local processes (dashed lines) only differ slightly from $\phi_{CG}$.
With the periodic parallel shear flow, this agreement extends to slow, but non-vanishing flows. As described in Sec.~\ref{sec:Methods}, during the first half of each period the flow moves the particles only vertically, with velocities dependent on their horizontal position. This means that some elements of the initial lattice remain intact; for example initial `columns' of individuals (those with the same horizontal coordinate) move jointly. There is then only limited variation in the degree of the nodes in the network, and the interaction graph remains nearly regular. If fixation or extinction occurs before the flow disrupts this {quasi-isothermal} structure, the predictions of the isothermal theorem remain a good approximation. The flow speed above which this is no longer the case can be estimated from a comparison of the the time until the lattice structure is disrupted and the time-to-fixation; see Sec.~\ref{app:Timescales} of the Supporting Information for further details.
\medskip
{\em Intermediate regime.} At intermediate flow speeds the fixation probability for the \textbf{Bd} ~process exhibits a maximum; a minimum is found for the \textbf{Db} ~process. These features can be related to the amplification or suppression effects on heterogeneous graphs, discussed in the previous sections. For intermediate flow speeds, the individuals' motion is fast enough to distort the initial lattice structure before the evolutionary process concludes. On the other hand the flow is also sufficiently slow so that evolution has time to organise in clusters on the heterogeneous interaction network. Effectively evolution takes place on a slowly moving heterogeneous graph. This heterogeneity, in conjunction with the clustering of species, leads to amplification of selection for birth-death processes and suppression for death-birth processes. When selection is local this merely accelerates or delays the approach to the behaviour on complete graphs. When selection is global, however, the minimum (for \textbf{Db}) and maximum (for \textbf{Bd}) are generated. A rough estimate for the flow speed at which the extrema are seen can be obtained by comparing the time-to-fixation of the mutant species with the network renewal time; details can be found in Sec.~\ref{app:Timescales} of the Supporting Information.
\medskip
{\em Fast flow.} In this regime the positions of individuals in space at each evolutionary event are essentially random, and the set of neighbours of any one particle is uncorrelated from an evolutionary event to the next one. The population is then `well-stirred', and the analytical predictions from Ref.~\cite{Herrerias2018} apply.
\section{Discussion}\label{sec:Discussion}
We studied evolutionary dynamics in populations immersed in flows. In computer simulations, we measured the effect that the speed of the motion has on the success of an invading mutant, and found that different evolutionary processes show distinct responses of the fixation probability to the flow speed.
Our results highlight the importance of including motion in the modelling of evolutionary dynamics. Just as population structure can generate amplification or suppression of selection, we find that the flow can act against or in favour of mutant invasion. While the models we study are stylised, we can identify general emerging principles. For instance, for the majority of evolutionary processes we observe a decrease in fixation probability when populations are in motion. This observation could be useful, for example, in industries where mutations are detrimental for the desired product but beneficial to the mutant, such as in microalgae, bacteria, fungi and yeast, relevant for the production of biodiesel\cite{Ma1999,Chisti2007a,Jeon2010a,Meng2009a}. Another example are the features we found to dominate fixation probability in the limits of very slow or very fast flows. If populations are mostly static in an experiment, our results indicate that whether selection acts locally or globally is a more important factor than the order of birth and death events. If an experiment involves populations in motion, on the other hand, careful consideration has to be given whether to use a birth-death or a death-birth process as a model, and it is less important in what step of evolutionary events competition takes place.
We hypothesise that the characteristic responses to flow may be used as an aid for choosing the most adequate update mechanism to model a given biological system. Despite the fact that direct measurements of the success of a specific mutation are not necessarily easy to perform, there is experimental evidence of differences in fixation probabilities in static and in stirred populations\cite{Kerr2002,Habets2006,Perfeito2008a}. In these studies, cultures of \textit{E. coli} were grown in a continuously stirred liquid medium, on Petri dishes, mixed every 24 hours, and on static Petri dishes. The structure and cluster formation of the cultures were found to have different dynamics under the different mixing conditions. The authors of ref.~\cite{Perfeito2008a}, for example, find that the ability to adapt, as measured by reproduction rates, is greater in the continuously-stirred case than in the case of only occasional mixing. This suggests a lower fixation probability in the slowly moving medium. Comparing this with our results, we speculate that a \textbf{Db}~process might best describe this biological system.
It is appropriate to briefly comment on the limitations of our study. For example, we focused on the periodic parallel shear flow in our simulations. However, we note that most features of the amplification or suppression of selection are not due to particulars of the flow field. Instead they arise from the mixing of the population and the heterogeneity of the interaction network. Both of these features can be expected in most real flows, and we believe that the essence of our findings is relevant beyond the exemplar of the shear flow. This is supported by observations in our earlier work\cite{Herrerias2018}, in which we obtained analytic results for limit of fast flows and demonstrated that these predictions are independent of many details of the flow field. Our study is also limited to frequency-independent selection; natural extensions would include more complex fitness functions to better model the experimental situation in ref.\cite{Habets2006}, where frequency-dependent fitness was identified for completely static conditions. We are aware that our simulations are for relatively small populations; this is due to computational costs associated with numerical experiments on a larger scale. Further work may also be necessary to relax assumption of a fixed population size. This may be useful to explore the effects of demographic stochasticity. On the other hand, dilution techniques or resource-limited environments can be used in experiments to keep the population approximately constant without significantly modifying the mutants' chances of success\cite{Wahl2002}.
Recent advances in technology make direct measurements of the fixation probability of a specific mutation feasible\cite{Patwa2008}. We believe that this, together with computational studies of different evolutionary models in varying conditions, can open up promising routes to more informed choices of evolutionary mechanics for systems in evolutionary biology.
\section*{Acknowledgements}\vspace{-.2cm}
FHA thanks Consejo Nacional de Ciencia y Tecnolog\'ia (CONACyT, Mexico) for support. VPM acknowledges financial support by CRETUS strategic partnership (ED431E2018/01), co-funded by the ERDF (EU).
We would also like to thank Joseph W. Baron for his helpful comments.
\vspace{-.2cm}
\section*{Author contributions statement}\vspace{-.3cm}
FHA carried out the simulations and analytical calculations. All authors contributed to designing the research, to analysing the data and to writing the paper.
\vspace{-.3cm}
\section*{Additional information}\vspace{-.3cm}
We declare no competing interests.
| {'timestamp': '2019-01-14T02:17:23', 'yymm': '1901', 'arxiv_id': '1901.03596', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03596'} | arxiv |
\section*{Abstract}
In addition to the learning check testing results performed at each lectures, we have extended the factors to find the key dropping out factors. Among them are, the number of successes in the learning check testing, the number of attendances to the follow-up program classes, and etc.
Then, we have found key factors strongly related to the students at risk.
They are the following.
1) Badly failed students (score range is 0-39 in the final examination) tend to be absent for the regular classes and fail in the learning check testing even if they attended, and they are very reluctant to attend the follow-up program classes. 2) Successful students (score range is 60-100 in the final examination) attend classes and get good scores in every learning check testing. 3) Failed students but not so badly (score range is 40-59 in the final examination) reveal both sides of features appeared in score range of 0-39 and score range of 60-100. Therefore, it is crucial to attend the lectures in order not to drop out.
Students who failed in learning check testing more than half out of all testing times almost absolutely failed in the final examination, which could cause the drop out. Also, students who were successful to learning check testing more than two third out of all testing times took better score in the final examination.
\\[2mm]
{\it Keywords: }learning check testing, placement test, follow-up program, item response theory, multiple linear regression, final examination.
\section{Introduction}
It is crucial to identify students at risk for failing courses and/or dropping out as early as possible because a variety of students are now enrolled in universities and we teachers have to educate them altogether.
This circumstance prohibits us to use conventional methods such as a mass education method. However, the number of staffs and classes are limited. New assisting systems using ICTs shall be introduced to solve such a difficulty.
To overcome this, we established online testing systems aimed at helping students who need further learning skills in mathematics subjects.
Such systems include 1) the learning check testing, the LCT, for every class to check if students comprehend the contents of lectures or not, 2) the collaborative working testing, the CWT, for training skills with supporters and teachers, and 3) the follow-up program testing, the FPT, to check if the follow-up program class members understand the standard level of the lectures.
The system has been successfully operating (see \cite{LTLE2016a}, \cite{LTLE2016b}), and some computational results were reported \cite{LTLE2017}. In addition, other relevant cases were well investigated (see \cite{LTLE2016c}, \cite{BIC2016}, \cite{IEE2018}, \cite{PISM2018}, \cite{IJSCAI2017}, \cite{LTLE2016d}).
Using the accumulated data in the database, we may find some key factors strongly related to the students at risk,
as indicated in \cite{Elouazizi}, \cite{Siemens2015}, \cite{Siemens2012}, and \cite{Waddington2016}, if we pay attention to learning analytics.
Then, we may be able to actively make a appropriate decision for better learning methods.
As indicated in \cite{WiseShaffer}, it is also important to analyze the data theoretically.
This paper is aimed at obtaining effective learning strategies for students at risk for failing courses and/or dropping out, using a large-scale of learning data accumulated from the follow-up program systems.
They consists of the placement scores, every LCT scores, FPT success/failure times, FPC attendances, etc.
In this paper, we use the ability values for students' learning skills obtained from the item response theory (IRT, e.g., see \cite{Ayala}, \cite{Hambleton91}, \cite{LindenHambleton}).
Although the subjects we deal with are analysis basic (similar to calculus) and linear algebra, we show the case of linear algebra as a typical case.
\section{Success/Failure Responses and the LCT Ability Values}
The LCT is a kind of short-time testing using five questions in each LCT in the first semester in 2017. All the students in regular classes take the LCT for ten minutes via the online testing system. All the questions are the same to each student, but the order to each question to a student is sorted in a different order from the next student. We have fourteen lectures with one midterm and one final examinations in the semester; thus, the number of LCT is fourteen. We can estimate the students abilities to each LCT using the item response theory (IRT) evaluation method.
Each problem in five items consists of multiple small questions. Students select appropriate answers to each small question from many choices.
We adopts the two-parameter logistic function $P(\theta_i;a_j,b_j)$ shown below instead of the three-parameter logistic function including pseudo-guessing parameter.
\begin{eqnarray}
P_{i,j}=P(\theta_i;a_j,b_j)={1 \over 1+\exp\{-1.7a_j(\theta_i-b_j)\} }=1-Q_{i,j},
\end{eqnarray}
where $\theta_i$ expresses the ability for student $i$, and $a_j, b_j$ are constants in the logistic function for item $j$, and they are called the discrimination parameter and the difficulty parameter, respectively.
Then, the likelihood for all the examinees, $i=1,2,\dots,N$, and all the items, $j=1,2,\dots,n$, will become
\begin{eqnarray}
L=\prod_{i=1}^N \prod_{j=1}^n \left(P_{i,j}^{\delta_{i,j}}
\times Q_{i,j}^{1-\delta_{i,j}} \right),
\end{eqnarray}
where $\delta_{i,j}$ denotes the indicator function such that $\delta=1$ for success and $\delta=0$ for failure.
In a sense, $P_{i,j}$ in Equation (1) is a logistic probability distribution function with unknown parameters $a_j$ and $b_j$, and the random variable is $\theta_i$.
However, $a_j$, $b_j$, and $\theta_i$ are all unknown here. We have to obtain the maximum likelihood estimates for $a_j$ and $b_j$, and $\theta_i$ simultaneously by maximizing $L$ in Equation (2).
However, as easily imagined with so small number of questions, the estimated ability values tend to have biases and the variances are large (see \cite{IJSCAI2017}, \cite{LTLE2016d}). It would be difficult to classify the students into a successful group and a failed group in the final examination using each LCT result.
Thus, we first use all the LCT results in classifying.
Figure 1 shows the histogram of estimated abilities of LCT to successful students overlaid the histogram of estimated abilities of LCT to failed students in the case of linear algebra in the first semester in 2017. We can see that it would be difficult to find the optimal discriminating threshold to success/failure students.
The numbers of successful students is 898, and failed students is 145; the ratio of failed students to all the students is $0.14$.
\begin{figure}[htbp]
\begin{center}
\includegraphics[height=6.5cm]{LAASFhistogram2.pdf}
\end{center}
\caption{Histograms of estimated abilities of LCT to successful students and to failed students (linear algebra in the first semester in 2017).}
\end{figure}
Except for very low values of estimates, the histograms indicate the normal distributions with different mean values (around $0.63$ for successful students and $-0.17$ for failed students); the lowest estimates around $-3.0$ in both groups were resulting from the absence for testing. However, it seems very difficult to discriminate students into two groups by using certain ability threshold value. When we adopt the decision tree method, the most appropriate ability threshold values becomes to be $-0.1065$.
The confusion matrix using this threshold is illustrated in table 1. The misclassification rate for this confusion matrix is $0.11$. Limited to failed students, the decision tree predicted 107 students may fail, and 70 students actually failed; the hitting ratio is $65\%$.
\begin{table}[htbp]
\caption{Confusion matrix determined by decision tree using full response matrix.}
\begin{center}
\begin{tabular}{cc|ccc}
\hline
&&&predicted \\
& & successful & failed & total \\
\hline
& successful & 861 & 37& 898 \\
observed & failed & 75 & 70 & 145\\
& total & 936 & 107 & 1043\\
\hline
\multicolumn{4}{l}{\qquad \qquad \qquad \qquad \quad threshold $= -0.1065$}
\end{tabular}
\label{tab1}
\end{center}
\end{table}
In addition to the LCT results, we have incorporated the placement test (PT) results taken at the very beginning of the first semester. We have two kinds of tests: one is rather fundamental test and the other is advanced test in high school level. Using the fundamental PT and the LCT results, we plotted the correlations for these two tests in three groups in Figure 2 in the case of linear algebra in the first semester in 2017; first group is the successful in the final examination (score range is 60-100 expressed by green dots in the figure), second group is the badly failed group (score range is 0-39 expressed by red dots), and the rest is the group (score range is 40-59 expressed by yellow dots). The horizontal axis means the ability values standardized to the standard normal distribution, and the vertical axis means the fundamental PT score.
Although the information is added, it is still hard to find the boundaries to classify students into three groups or two successful/failed groups.
In order to discriminate the successful/failed students much more clearly, it would be recommended to include other kind of information.
\begin{figure}[htbp]
\begin{center}
\includegraphics[height=5.5cm]{PTLCTvsSuccessFail2.pdf}
\end{center}
\caption{Correlations for the LCT results and the placement test results in three successful/failed groups (linear algebra in the first semester in 2017).}
\end{figure}
\section{Attendance to the Lectures and the Follow-up Program Classes}
Attendance/absence to classes is other discrete type information. Intuitively, we feel that the more frequently attend the classes, the higher the scores of the final examination. Recently, it is often seen that attendance/absence information is memorized to the database automatically using the electric card attendance check system. However, the system is not perfectly working; some students may disappear after exposing their cards.
The LCT compensate this defect. The attendance information cannot be guaranteed unless the testing is completed. Figure 3 shows that the attendance/absence information are classified into three groups: the first is for score range is 60-100 seen on the right in the figure, the second is for score range is 40-59 seen in the middle, and third is for score range is 0-39 seen on the left. In these matrices, row means the student id, and column means the question id. Using two kinds of attendance/absence information by electric cards (expressed by $y$ shown below) and LCT results (expressed by $x$ shown below), the value of each element, $s$, is determined and is colored by the formula of $s = 10 x + y$, where meanings of $s$, $x$, and $y$ are indicated in Figure 4. The figure shows the scheme of the attendance/absence information and LCT successful/failed information.
For example, $s=55$ means that a student was absolutely absent for the class, and $s=11$ means that a student is absolutely attended the class; they are also indicated in Figure 3.
Since each element is colored by green to red according to $s$ value from lower to higher, red and orange colors indicate the absence or failed in the LCT, and green color indicate the success in the LCT.
Obviously, three groups can be classified clearly by these colors by looking at the figure.
This indicates that the attendance/absence information may play a key role in determining the risk of a student in addition to the LCT results.
\begin{figure}[htbp]
\begin{center}
\includegraphics[height=9.5cm]{AttendanceVsSuccessFail3.pdf}
\end{center}
\caption{Three groups classified by using the attendance/absence information and LCT successful/failed information.}
\end{figure}
\begin{figure}[htbp]
\begin{center}
\includegraphics[height=9cm]{AttendanceAbsenceInformation.pdf}
\end{center}
\caption{Scheme of the attendance/absence information and LCT successful/failed information.}
\end{figure}
\section{Finding the Important Factors for Risk}
We first show the relationships among the factors we are concerned with in Figures 5 and 6.
In these figures, for example, we see that there is a strong relationship between the LCT successes and the no requirement for the FPT (see first column and sixth row in the figures), but it seems unclear which factors are key factors in classifying the successful/failed groups.
In this paper, however, we will not deeply discuss the dimension reduction problem.
We are only interested in finding the key factors related to the risky students in the final examination.
Thus, a much easier method will be taken in the following.
\begin{figure}[htbp]
\begin{center}
\includegraphics[height=8cm]{0-59old.pdf}
\end{center}
\caption{Relationships among the factors when the score range is 0-59.}
\end{figure}
\begin{figure}[htbp]
\begin{center}
\includegraphics[height=8cm]{60-100old.pdf}
\end{center}
\caption{Relationships among the factors when the score range is 60-100.}
\end{figure}
Since we have known that the attendance/absence information may be effective for classifying the students groups into successful/failed students in the final examination, we apply the multiple regression analysis of $Y=X\beta$ in finding the key factors; candidates of factors are shown in Figure 7.
\begin{figure}[htbp]
\begin{center}
\includegraphics[height=7cm]{MLR.pdf}
\end{center}
\caption{Factors in the multiple regression analysis.}
\end{figure}
Applying the multiple linear regression using the accumulated learning data, e.g., estimated LCT ability values, placement scores, class attendance/absence, follow-up class attendance/absence, and etc., we obtained the result shown in Figure 8.
Marked symbols by asterisks indicate that these factors are significant with given $p$-values in using R {\cite R}, the statistical computing and graphics language and environment. The symbol of FPTnotrequired means that students took the LCT and successful, resulting no requirement for follow-up class attendance. That is, attendance/absence for FPT is the most significant information in deciding successful/failed students.
\begin{figure}[htbp]
\begin{center}
\includegraphics[height=4.3cm]{regressionanalysis3.pdf}
\end{center}
\caption{Multiple linear regression analysis result.}
\end{figure}
Therefore, we next focus on this factor. Figure 9 shows the 2-dimensional relationship between the number of successes in the LCT and the number of absents for the follow-up classes for the three groups, score ranges are 60-100, 40-59, and 0-39 in the final examination.
At a first glance, we can see that a clear linear relationship between the number of successes in the LCT and the number of absents for the FPC when score range is 0-39.
We also see some similarity between the cases score range 40-59 and the cases score range 60-100, but it is unclear.
Since each dot represents a student in the figure, overlaid dots representing the same position hinder the accumulated numbers of the students.
\begin{figure}[htbp]
\begin{center}
\includegraphics[height=8cm]{regression1.pdf}
\end{center}
\caption{2-dimensional relationship between the number of successes in the LCT and the number of absents for the FPC.}
\end{figure}
Figure 10 shows the 3-dimensional bar charts representing the relationship between the number of successes in the LCT and the number of absents for the follow-up classes for the three groups, score ranges are 60-100, 40-59, and 0-39 in the final examination.
By looking at the figure, we find the following: 1) When score range is 60-100, almost all the students show successful results in the LCT and very small number of absences for the FPC (almost all are not required the attendance for the FPC). 2) When score range is 0-39, we see a clear linear relationship between the number of successes in the LCT and the number of absents for the FPC, which means that almost all the failed students in the LCT or students absent for the classes ignore the attendance for the FPC. 3) When score range is 40-59, students reveal both sides of features appeared in score range of 0-39 and score range of 60-100. Some students tried to make effort to be successful, and some were successful but unfortunately some were not. Therefore, we have found that failed students in the final examination were reluctant to attend the classes and showed failed LCT results, and they were unwilling to attend the FPC in addition. As intuition suggests, the most crucial factor for the success in the final examination is attendance to the class.
\begin{figure}[htbp]
\begin{center}
\includegraphics[height=8cm]{3Dplot.pdf}
\end{center}
\caption{3-dimensional bar charts representing the relationship between the number of successes in the LCT and the number of absents for the FPC.}
\end{figure}
\section{Discussions}
We have been looking at some factors to classify successes and failures in the final examination. To investigate such factors much more precisely, more detailed information may be required. Thus, we have classified the successful group into four groups such as A+, A, B, C, where scores in these groups are distributed to be 90-100, 80-89, 70-79, 60-69. The possible factor to discriminate these groups is considered to be the number of successful LCT.
Figure 11 shows the frequency bar charts for the number of successful LCT to each group.
Taking a look at the figure, we can see that students who failed in LCT more than seven times almost absolutely failed in the final examination, which could cause the drop out. Also, students who were successful to LCT more than ten times took better score in the final examination. Since all the testing times were 13 in this case, this means that students who failed in learning check testing more than half out of all testing times almost absolutely failed in the final examination, and students who were successful to learning check testing more than two third out of all testing times took better score in the final examination.
\begin{figure}[htbp]
\begin{center}
\includegraphics[height=10cm]{LCTsuccess.pdf}
\end{center}
\caption{Histograms of estimated abilities of LCT to successful students and to failed students (linear algebra in the first semester in 2017).}
\end{figure}
\section{Concluding Remarks}
It is crucial to identify students at risk for failing courses and/or dropping out as early as possible because a variety of students are now enrolled in universities and we teachers have to educate them altogether.
To overcome this, we established online testing systems aimed at helping students who need further learning skills in mathematics subjects,
including the learning check testing, the collaborative working testing, and the follow-up program testing.
Using the accumulated data from these testings in the database,
we aimed at obtaining effective learning strategies for students at risk for failing courses and/or dropping out.
Although the subjects we deal with are analysis basic (similar to calculus) and linear algebra, we focused on linear algebra case as a typical one.
In this paper, we have found some key factors strongly related to the students at risk.
The findings are the following. 1) Badly failed students (score range is 0-39 in the final examination) tend to be absent for the regular classes and fail in the learning check testing even if they attended, and they are very reluctant to attend the follow-up program classes. 2) Successful students (score range is 60-100 in the final examination) attend classes and get good scores in every learning check testing. 3) Failed students but not so badly (score range is 40-59 in the final examination) reveal both sides of features appeared in score range of 0-39 and score range of 60-100. Therefore, it is crucial to attend the lectures in order not to drop out.
Students who failed in learning check testing more than half out of all testing times almost absolutely failed in the final examination, which could cause the drop out. Also, students who were successful to learning check testing more than two third out of all testing times took better score in the final examination.
\section*{Acknowledgment}
The author would like to thank
mathematical staffs at Hiroshima Institute of Technology.
| {'timestamp': '2019-01-14T02:22:28', 'yymm': '1901', 'arxiv_id': '1901.03696', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03696'} | arxiv |
\section{Introduction}
Convolutional Neural Network (CNN) has been found to be effective for learning better feature representations in the field of computer vision \cite{alexnet, vggnet, googlenet, resnet, dccrf, off, gao2018question}. Thereby, the design of CNN becomes a fundamental task that can help to boost the performance of many other related tasks. As the CNN becomes increasingly deeper, recent works endeavor to refine or reuse the features from previous layers through identity mappings \cite{preact-resnet} or concatenation \cite{densenet}.
The CNNs designed for image-level, region-level, and pixel-level tasks begin to diverge in network structure. Networks for image classification use consecutive down-sampling to obtain deep features of low resolution. However, the features with low resolution are not suitable for pixel-level or even region-level tasks. Direct use of high-resolution shallow features for region and pixel-level tasks, however, does not work well.
%
In order to obtain deeper features with high resolution, the well-known network structures for pixel-level tasks use U-Net or hourglass-like networks \cite{hourglass, unet, yang2017pyramid}. Recent works on region-level tasks like object detection also use networks with up-sampling mechanism \cite{fpn, Li2018} so that small objects can be described by the features with relatively high resolution.
Driven by the success of using high-resolution features for region-level and pixel-level tasks, this paper proposes a fish-like network, namely FishNet, which enables the features of high resolution to contain high-level semantic information. In this way, features pre-trained from image classification are more friendly for region and pixel level tasks.
We carefully design a mechanism that have the following three advantages.
First, \textbf{it is the first backbone network that unifies the advantages of networks designed for pixel-level, region-level, and image-level tasks.}
Compared to the networks designed purely for the image classification task, our network as a backbone is more effective for pixel-level and region-level tasks.
\begin{figure}[t]
\begin{minipage}{0.5\textwidth}
\centering
\includegraphics[scale=0.5]{figures/basic_idea_1.pdf}
\end{minipage}
%
\begin{minipage}{0.5\textwidth}
\centering
\includegraphics[scale=0.5]{figures/basic_idea_2.pdf}
\end{minipage}
\caption{The up/down-sampling block for ResNet (\textit{left}), and FishNet (\textit{right}). The $1\times1$ convolution layer in yellow indicates the \textit{Isolated convolution (I-conv, see Section \ref{Sec:Res})}, which makes the direct BP incapable and degrades the gradient from the output to shallow layers.}
\label{fig:basic_idea}
\end{figure}
Second, \textbf{it enables the gradient from the very deep layer to be \emph{directly} propagated to shallow layers, called direct BP in this paper. }
%
Recent works show that there are two designs that can enable direct BP, identity mapping with residual block \citep{preact-resnet} and concatenation \citep{densenet}.
%
However, the untold fact is that existing network designs, e.g. \citep{resnet, preact-resnet, densenet, googlenet, wrn, drn}, still do not enable direct BP. This problem is caused by the convolutional layer between features of different resolutions.
%
As shown in the Figure ~\ref{fig:basic_idea}, the ResNet \cite{resnet} utilize a convolutional layer with stride on the skip connection to deal with the inconsistency between the numbers of input and output channels, which makes the identity mapping inapplicable. Convolution without identity mapping or concatenation degrades the gradient from the output to shallow layers.
%
Our design better solves this problem by concatenating features of very different depths to the final output.
%
We also carefully design the components in the network to ensure the direct BP. With our design, the semantic meaning of features are also preserved throughout the whole network.
%
Third, \textbf{features of very different depth are preserved and used for refining each other.} Features with different depth have different levels of abstraction of the image.
All of them should be kept to improve the diversity of features.
Because of their complementarity, they can be used for refining each other.
Therefore, we design a feature preserving-and-refining mechanism to achieve this goal.
A possibly counter-intuitive effect of our design is that it performs better than traditional convolutional networks in the trade-off between the number of parameters and accuracy for image classification. The reasons are as follows: 1) the features preserved and refined are complementary to each other and more useful than designing networks with more width or depth; and 2) it facilitates the direct BP.
%
Experimental results show that our compact model FishNet-150, of which the number of parameters is close to ResNet-50, is able to surpass the accuracy of ResNet-101 and DenseNet-161(k=48) on ImageNet-1k.
%
For region and pixel level tasks like object detection and instance segmentation, our model as a backbone for Mask R-CNN \cite{maskrcnn} improves the absolute AP by $2.8\%$ and $2.3\%$ respectively on MS COCO compared to the baseline ResNet-50.
\subsection{Related works}
\textbf{CNN architectures for image classification.}
The design of deep CNN architecture is a fundamental but challenging task in deep learning. Networks with better design extract better features, which can boost the performance of many other tasks.
The remarkable improvement in the image recognition challenge ILSVRC \cite{ilsvrc} achieved by AlexNet \citep{alexnet} symbolizes a new era of deep learning for computer vision.
%
After that, a number of works, e.g. VGG \cite{vggnet}, Inception \citep{googlenet}, all propose to promote the network capability by making the network deeper. However, the network at this time still cannot be too deep because of the problem of vanishing gradient.
%
Recently, the problem of vanishing gradient is greatly relieved by introducing the skip connections into the network \citep{resnet}. There is a series of on-going works on this direction \citep{resnext, wrn, drn, densenet, dpn, senet, cliquenet, dla}.
However, among all these networks designed for image classification, the features of high resolution are extracted by the shallow layers with small receptive field, which lack the high-level semantic meaning that can only be obtained on deeper layers.
Our work is the first to extract high-resolution deep feature with high-level semantic meaning and improve image classification accuracy at the same time.
\textbf{Design in combining features from different layers.}
Features from different resolution or depth could be combined using nested sparse networks \cite{nestednet}, hyper-column \cite{hypercolumns}, addition \cite{fractalnet} and residual blocks \cite{hourglass, fpn}(conv-deconv using residual blocks). Hyper-column networks directly concatenate features from different layers for segmentation and localization in \cite{hypercolumns}.
%
However, features from deep layers and shallow layers were not used for refining each other. Addition \cite{fractalnet} is a fusion of the features from deep and shallow layers. However, addition only mix the features of different abstraction levels, but cannot preserve or refine both of them. Concatenation followed by convolution is similar to addition \cite{dla}.
When residual blocks \cite{hourglass, fpn}, also with addition, are used for combining features, existing works have a pre-defined target to be refined.
%
If the skip layer is for the deep features, then the shallow features serve only for refining the deep features, which will be discarded after the residual blocks in this case. In summary, addition and residual blocks in existing works do not preserve features from both shallow and deep layers, while our design preserves and refines them.
\textbf{Networks with up-sampling mechanism.}
As there are many other tasks in computer vision, e.g. object detection, segmentation, that require large feature maps to keep the resolution, it is necessary to apply up-sampling methods to the network. Such mechanism often includes the communication between the features with very different depths.
%
The series of works including U-Net \cite{unet}, FPN \cite{fpn}, stacked hourglass \cite{hourglass} etc., have all shown their capability in pixel-level tasks \cite{hourglass} and region-level tasks \cite{fpn, Li2018}.
%
However, none of them has been proven to be effective for the image classification task. MSDNet \cite{multi-scale-densenet} tries to keep the feature maps with large resolution, which is the most similar work to our architecture.
%
However, the architecture of MSDNet still uses convolution between features of different resolutions, which cannot preserve the representations.
%
Besides, it does not provide an up-sampling pathway to enable features with large resolution and more semantic meaning.
%
The aim of MSDNet introducing the multi-scale mechanism into its architecture is to do budget prediction. Such design, however, did not show improvement in accuracy for image classification.
%
Our FishNet is the first in showing that the U-Net structure can be effective for image classification. Besides, our work preserves and refines features from both shallow and deep layers for the final task, which is not achieved in existing networks with up-sampling or MSDNet.
\textbf{Message passing among features/outputs.} There are some approaches using message passing among features for segmentation \cite{crfrnn}, pose estimation \cite{crfcnn} and object detection \cite{gbdnet}. These designs are based on backbone networks, and the FishNet is a backbone network complementary to them.
%
\begin{figure}[t]
\centering
\includegraphics[scale=0.38]{figures/overview2.pdf}
\caption{Overview of the FishNet. It has three parts. \emph{Tail} uses existing works to obtain deep low-resolution features from the input image. \emph{Body} obtains high-resolution features of high-level semantic information. \emph{Head} preserves and refines the features from the three parts.
}
\label{fig:overall}
\end{figure}
\section{Identity Mappings in Deep Residual Networks and Isolated Convolution}
\label{Sec:Res}
The basic building block for ResNet is called the residual block. The residual blocks with identity mapping \citep{preact-resnet} can be formulated as
\begin{equation}
x_{l+1} = x_l + \mathcal{F}(x_l, W_l),
\label{eq:res}
\end{equation}
where $x_l$ denotes the input feature for the residual block at layer $l$, and $\mathcal{F}(x_l,W_l)$ denotes the residual function with input $x_l$ and parameters $W_l$. We consider the stack of all residual blocks for the same resolution as a \textit{stage}. Denote the feature at the $l$th layer of stage $s$ by $x_{l, s}$. We have:
\begin{equation}
x_{L_s, s} = x_{0, s} + \sum_{l=1}^{L_s}\mathcal{F}(x_{l, s}, W_{l, s}),\ \ \ \ \frac{\partial \mathcal{L}}{\partial x_{0, s}}=\frac{\partial \mathcal{L}}{\partial x_{L_s, s}}(1+\frac{\partial }{\partial x_{0, s}}\sum_{l=1}^{L_s}\mathcal{F}(x_{l, s}, W_{l, s}))
\label{eq:idmap}
\end{equation}
where $L_s$ denotes the number of stacked residual blocks at the stage $s$, $\mathcal{L}$ is a loss function. The additive term $\frac{\partial \mathcal{L}}{\partial x_{L_s, s}}$ in (\ref{eq:idmap}) ensures that the gradient of $x_{L_s, s}$ can be \emph{directly propagated} to $x_{0, s}$.
We consider features with different resolutions as having different stages. In the original ResNet, the features of different resolutions are different in number of channels. Therefore, a transition function $h(\cdot)$ is needed to change the number of channels before down-sampling:
\begin{equation}
x'_{0, s+1} = h(x_{L_s, s}) = \sigma(\lambda_{s} \otimes x_{L_s, s} + b_{L_s, s})
\label{eq:transition}
\end{equation}
where $\sigma(\cdot)$ is the activation function. $\lambda_{s}$ is the filter and $b_{L_s, s}$ is the bias at the transition layer of stage $s$ respectively. The symbol $\otimes$ represents the convolution. Since the numbers of channels for $x_{L_s, s}$ and $x'_{0, s+1}$ are different, identity mapping is not applicable.
\textbf{Gradient propagation problem from Isolated convolution (I-conv)}. Isolated convolution (I-conv) is the convolution in (\ref{eq:transition}) without identity mapping or concatenation. As analyzed and validated by experiments in \cite{preact-resnet}, it is desirable to have the gradients from a deep layer directly transmitted to shallow layers. Residual blocks with identity mapping \cite{preact-resnet} and dense block with concatenation \cite{densenet} facilitate such direct gradient propagation. Gradients from the deep layer cannot be directly transmitted to the shallow layers if there is an I-conv.
%
The I-conv between features with different resolutions in ResNet \cite{preact-resnet} and the I-conv (called transition layer in \cite{densenet}) between adjacent dense blocks, however, hinders the direct gradient propagation.
Since ResNet and DenseNet still have I-convs, the gradients from the output cannot be directly propagated to shallow layers for them, similarly for the networks in \cite{alexnet, vggnet}.
The invertible down-sampling in \cite{revnet} avoids the problem of I-conv by using all features from the current stage for the next stage. The problem is that it will exponentially increase the number of parameters as the stage ID increases (188M in \cite{revnet}).
We have identified the gradient propagation problem of I-conv in existing networks. Therefore, we propose a new architecture, namely FishNet, to solve this problem.
\begin{figure}[t]
\centering
\includegraphics[scale=0.468]{figures/sample_block.pdf}
\vspace{0pt}
\caption{(Better seen in color and zoomed in.) \textbf{(a) Interaction among the tail, body and head for features of two stages,} the two figures listed on the right exhibit the detailed structure for \textbf{(b) the Up-sampling \& Refinement block (UR-block)}, and \textbf{(c) the Down-sampling \& Refinement block (DR-block).} In the Figure (a), feature concatenation is used when vertical and horizontal arrows meet.
%
The notations $C_*, *H, *W$ denote the number of channels, height, and width respectively. $k$ represents the channel-wise reduction rate described in Equation \ref{eq:ch_sum} and Section \ref{sec:refineblock}. Note that there is no Isolated convolution (I-conv) in the fish body and head. Therefore, the gradient from the loss can be directly propagated to shallow layers in tail, body and head. }
\label{fig:sample_block}
\end{figure}
\section{The FishNet}
\vspace{-10px}
Figure \ref{fig:overall} shows an overview of the FishNet. The whole "fish" is divided into three parts: tail, body, and head.
%
%
The fish tail is an existing CNN, e.g. ResNet, with the resolution of features becoming smaller as the CNN goes deeper. The fish body has several up-sampling and refining blocks for refining features from the tail and the body. The fish head has several down-sampling and refining blocks for preserving and refining features from the tail, body and head. The refined features at the last convolutional layer of the head are used for the final task.
\textbf{Stage} in this paper refers to a bunch of convolutional blocks fed by the features with the same resolution . Each part in the FishNet could be divided into several stages according to the resolution of the output features. \textbf{With the resolution becoming smaller, the stage ID goes higher.} For example, the blocks with outputs resolution $56\times 56$ and $28\times 28$ are at stage $1$ and $2$ respectively in all the three parts of the FishNet. Therefore, in the fish tail and head, the stage ID is becoming higher while forwarding, while in the body part the ID is getting smaller.
Figure \ref{fig:sample_block} shows the interaction among tail, body, and head for features of two stages.
The fish tail in Figure \ref{fig:sample_block}(a) could be regarded as a residual network. The features from the tail undergo several residual blocks and are also transmitted to the body through the horizontal arrows.
%
The body in Figure \ref{fig:sample_block}(a) preserves both the features from the tail and the features from the previous stage of the body by concatenation. Then these concatenated features will be up-sampled and refined with details shown in Figure \ref{fig:sample_block}(b) and the details about the UR-block will be discussed in Section \ref{sec:refineblock}. The refined features are then used for the head and the next stage of the body.
%
The head preserves and refines all the features from the body and the previous stage of the head. The refined features are then used for the next stage of the head. Details for message passing at the head are shown in Figure \ref{fig:sample_block}(c) and discussed in Section \ref{sec:refineblock}.
%
The horizontal connections represent the transferring blocks between the tail, the body and the head. In Figure \ref{fig:sample_block}(a), we use the residual block as the transferring blocks.
\subsection{Feature refinement}
\label{sec:refineblock}
In the FishNet, there are two kinds of blocks for up/down sampling and feature refinement: the Up-sampling \& Refinement block (UR-block) and Down-sampling \& Refinement block (DR-block).
\textbf{The UR-block.}
Denote the output features from the first layer at the stage $s$ by $x_{s}^t$ and $x_{s}^b$ for the tail and body respectively. $s \in \{1, 2, ..., min(N^t-1, N^b-1)\}$, $N^t$ and $N^b$ represent the number of stages for the tail part and the body part.
Denote feature concatenation as $concat(\cdot)$. The UR-block can be represented as follows:
\begin{equation}
x_{s-1}^b = UR(x_{s}^{b}, \mathcal{T}({x}_{s}^{t})) = up(\tilde{x}_{s}^{\prime b})
\end{equation}
%
where the $\mathcal{T}$ denotes residual block transferring the feature $x_{s-1}^{t}$ from tail to the body, the $up(\tilde{x}_{s}^{\prime b})$ represents the feature refined from the previous stage in the fish body.
The output ${x}_{s-1}^{b}$ for next stage is refined from $x_{s}^{t}$ and $x_{s}^{b}$ as follows:
\begin{ceqn}
\begin{align}
{x}_{s-1}^{b} &= up(\tilde{x}_{s}^{\prime b}), \label{eq:URblock1}\\
\tilde{x}_{s}^{\prime b} &= r(\tilde{x}_{s}^b) + \mathcal{M}({\tilde{x}_{s}^b}), \label{eq:URblock2}\\
\tilde{x}_{s}^{b} &= concat({x}_{s}^{b}, \mathcal{T}({x}_{s}^{t})), \label{eq:URblock3}
\end{align}
\end{ceqn}
where $up(\cdot)$ denotes the up-sampling function. As a summary, the UR-block concatenates features from body and tail in (\ref{eq:URblock3}) and refine them in (\ref{eq:URblock2}), then upsample them in (\ref{eq:URblock1}) to obtain the output ${x}_{s-1}^{b}$.
The $\mathcal{M}$ in (\ref{eq:URblock2}) denotes the function that extracts the message from features $\tilde{x}_{s}^{b}$. We implemented $\mathcal{M}$ as convolutions.
%
Similar to the residual function $\mathcal{F}$ in (\ref{eq:res}), the $\mathcal{M}$ in (\ref{eq:URblock2}) is implemented by bottleneck Residual Unit \cite{preact-resnet} with 3 convolutional layers. The channel-wise reduction function $r$ in (\ref{eq:URblock2}) can be formulated as follows:
\begin{equation}
r(x)= \hat{x} = [\hat{x}(1), \hat{x}(2), \ldots, \hat{x}(c_{out})],\ \ \hat x(n) = \sum_{j=0}^{k} x(k\cdot n+j), n \in \{0, 1, ..., c_{out}\},
\label{eq:ch_sum}
\end{equation}
where $x=\{x(1), x(2), \ldots, x(c_{in})\}$ denotes $c_{in}$ channels of input feature maps and $\hat{x}$ denotes $c_{out}$ channels of output feature maps for the function $r$, $c_{in}/c_{out}=k$. It is an element-wise summation of feature maps from the adjacent $k$ channels to 1 channel. We use this simple operation to reduce the number of channels into $1/k$, which makes the number of channels concatenated to the previous stage to be small for saving computation and parameter size.
\textbf{The DR-block.} The DR-block at the head is similar to the UR-block. There are only two different implementations between them. First, we use $2\times2$ max-pooling for down-sampling in the DR-block.
%
Second, in the DR-block, the channel reduction function in the UR-block is not used so that the gradient at the current stage can be directly transmitted to the parameters at the previous stage. Following the UR-block in (\ref{eq:URblock1})-(\ref{eq:URblock3}), the DR block can be implemented as follows:
%
\begin{equation}
\begin{split}
{x}_{s+1}^{h} &= down(\tilde{x}_{s}^{\prime h}), \\
\tilde{x}_{s}^{\prime h} &= \tilde{x}_{s}^h + \mathcal{M}({\tilde{x}_{s}^h}), \\
\tilde{x}_{s}^{h} &= concat({x}_{s}^{h}, \mathcal{T}({x}_{s}^{b})), \\
\end{split}
\label{eq:DRblock}
\end{equation}
%
where the ${x}_{s+1}^{h}$ denotes the features at the head part for the stage $s+1$. In this way, the features from every stage of the whole network is able to be directly connected to the final layer through concatenation, skip connection, and max-pooling. Note that we do not apply the channel-wise summation operation $r(\cdot)$ defined in (\ref{eq:URblock2}) to obtain $\tilde{x}_{s}^{h}$ from ${x}_s^h$ for the DR-block in (\ref{eq:DRblock}). Therefore, the layers obtaining $\tilde{x}_{s}^{h}$ from ${x}_s^h$ in the DR-block could be actually regarded as a residual block \cite{preact-resnet}.
\subsection{Detailed design and discussion}
\textbf{Design of FishNet for handling the gradient propagation problem}. With the body and head designed in the FishNet, the features from all stages at the tail and body are concatenated at the head. We carefully designed the layers in the head
so that there is no I-conv in it.
The layers in the head are composed of concatenation, convolution with identity mapping, and max-pooling.
Therefore, the gradient propagation problem from the previous backbone network in the tail are solved with the FishNet by 1) excluding I-conv at the head; and 2) using concatenation at the body and the head.
\textbf{Selection of up/down-sampling function.} The kernel size is set as $2\times2$ for down-sampling with stride 2 to avoid the overlapping between pixels. Ablation studies will show the effect of different kinds of kernel sizes in the network. To avoid the problem from I-conv, the weighted de-convolution in up-sampling method should be avoided.
%
For simplicity, we choose nearest neighbor interpolation for up-sampling. Since the up-sampling operation will dilute input features with lower resolution, we apply dilated convolution in the refining blocks.
\textbf{Bridge module between the fish body and tail.} As the tail part will down sample the features into resolution $1\times1$, these $1\times 1$ features need to be upsampled to $7\times 7$. We apply a SE-block \cite{senet} here to map the feature from $1\times1$ into $7\times7$ using a channel-wise attentive operation.
\section{Experiments and Results}
\subsection{Implementation details on image classification}
For image classification, we evaluate our network on the ImageNet 2012 classification dataset \cite{ilsvrc} that consists of 1000 classes. This dataset has 1.2 million images for training, and 50,000 images for validation (denoted by ImageNet-1k val). We implement the FishNet based on the prevalent deep learning framework PyTorch \cite{pytorch}.
%
For training, we randomly crop the images into the resolution of $224\times224$ with batch size 256, and choose stochastic gradient descent (SGD) as the training optimizer with the base learning rate set to 0.1. The weight decay and momentum are $10^{-4}$ and $0.9$ respectively.
%
We train the network for 100 epochs, and the learning rate is decreased by 10 times every 30 epochs.
The normalization process is done by first converting the value of each pixel into the interval $[0, 1]$, and then subtracting the mean and dividing the variance for each channel of the RGB respectively.
We follow the way of augmentation (random crop, horizontal flip and standard color augmentation \cite{alexnet}) used in \cite{resnet} for fair comparison.
%
All the experiments in this paper are evaluated through single-crop validation process on the validation dataset of ImageNet-1k. Specifically, an image region of size $224\times224$ is cropped from the center of an input image with its shorter side being resized to 256.This $224\times224$ image region is the input of the network.
FishNet is a framework. It does not specify the building block. For the experimental results in this paper, FishNet uses the Residual block with identity mapping \cite{preact-resnet} as the basic building block, FishNeXt uses the Residual block with identity mapping and grouping \cite{resnext} as the building block.
\begin{table}[t]
\begin{minipage}{1.0\textwidth}
\includegraphics[scale=0.63]{figures/performance.pdf}
\captionof{figure}{The comparison of the classification top-1 (top-5) error rates as a function of the number of parameters (left) and FLOP (right) for FishNet, DenseNet and ResNet (single-crop testing) on the validation set of ImageNet.}
\label{fig:imagenet}
\end{minipage}
\begin{minipage}{1.0\textwidth}
\begin{minipage}{0.4\textwidth}
\setlength{\tabcolsep}{4.88pt}
\begin{tabular}{l|lc}
Method & Params & \makecell[c]{Top-1 Error} \\
\hline
\hline
\makecell[l]{ResNeXt-50\\($32\times4d$)} & 25.0M & 22.2\% \\
\hline
\makecell[l]{FishNeXt-150\\(4d)}& 26.2M & \textbf{21.5}\% \\
\end{tabular}
\caption{ImageNet-1k val Top-1 error for the ResNeXt-based architectures. The 4d here for FishNeXt-150 (4d) indicates that the minimum number of channels for a single group is 4.}
\label{table:resnext}
\end{minipage}
\hspace{10px}
\begin{minipage}{0.56\textwidth}
\setlength{\tabcolsep}{5.6pt}
\centering
\begin{tabular}{l|lc}
\makecell[l]{Method} & Params & \makecell[c]{Top-1 Error} \\
\hline
\hline
\makecell[l]{Max-Pooling \\($3\times3$, stride=2)} & 26.4M & 22.51\% \\
\hline
\makecell[l]{Max-Pooling \\($2\times2$, stride=2)} & 26.4M & \textbf{21.93}\% \\
\hline
\makecell[l]{Avg-Pooling\\($2\times2$, stride=2)} & 26.4M & 22.86\% \\
\hline
\makecell[l]{Convolution \\ (stride=2)} & 30.2M & 22.75\%
\end{tabular}
\caption{ImageNet-1k val Top-1 error for different down-sampling methods based on FishNet-150.}
\vspace{-10px}
\label{table:down-sample}
\end{minipage}
\end{minipage}
\end{table}
\subsection{Experimental results on ImageNet}
Figure \ref{fig:imagenet} shows the top-1 error for ResNet, DenseNet, and FishNet as a function of the number of parameters on the validation dataset of ImageNet-1k.
When our network uses pre-activation ResNet as the tail part of the FishNet, the FishNet performs better than ResNet and DenseNet.
\textbf{FishNet vs. ResNet.} For fair comparison, we re-implement the ResNet and report the result of ResNet-50 and ResNet-101 in Figure \ref{fig:imagenet}. Our reported single-crop result for ResNet-50 and ResNet-101 with identity mapping is higher than that in \cite{resnet} as we select the residual block with pre-activation to be our basic building block.
%
Compared to ResNet, FishNet achieves a remarkable reduction in error rate. The FishNet-150 (21.93\%, 26.4M), for which the number of parameters is close to ResNet-50 (23.78\%, 25.5M), is able to surpass the performance of ResNet-101 (22.30\%, 44.5M).
%
In terms of FLOPs, as shown in the right figure of Figure \ref{fig:imagenet}, the FishNet is also able to achieve better performance with lower FLOPs compared with the ResNet.
\textbf{FishNet vs. DenseNet.}
DenseNet iteratively aggregates the features with the same resolution by concatenation and then reduce the dimension between each dense-block by a transition layer. According to the results in Figure \ref{fig:imagenet}, DenseNet is able to surpass the accuracy of ResNet using fewer parameters. Since FishNet preserves features with more diversity and better handles the gradient propagation problem, FishNet is able to achieve better performance than DenseNet with fewer parameters.
Besides, the memory cost of the FishNet is also lower than the DenseNet. Take the FishNet-150 as an example, when the batch size on a single GPU is 32, the memory cost of FishNet-150 is $6505$M, which is $2764$M smaller than the the cost of DenseNet-161 ($9269$M).
\textbf{FishNeXt vs. ResNeXt}
The architecture of FishNet could be combined with other kinds of designs, e.g., the channel-wise grouping adopted by ResNeXt.
%
We follow the criterion that the number of channels in a group for each block (UR/DR block and transfer block) of the same stage should be the same. The width of a single group will be doubled once the stage index increase by 1. In this way, the ResNet-based FishNet could be constructed into a ResNeXt-based network, namely FishNeXt.
%
We construct a compact model FishNeXt-150 with 26 million of parameters. The number of parameters for FishNeXt-150 is close to ResNeXt-50. From Table \ref{table:resnext}, the absolute top-1 error rate can be reduced by $0.7\%$ when compared with the corresponding ResNeXt architecture.
\subsection{Ablation studies}
\textbf{Pooling vs. convolution with stride.}
We investigated four kinds of down-sampling methods based on the network FishNet-150, including convolution, max-pooling with the kernel size of $2\times2$ and $3\times3$, and average pooling with kernel size $2\times2$\footnote{When convolution with a stride of 2 is used, it is used for both the tail and the head of the FishNet. When pooling is used, we still put a $1\times 1$ convolution on the skip connection of the last residual blocks for each stage at the tail to change the number of channels between two stages, but we do not use such convolution at the head.}.
%
As shown in Table \ref{table:down-sample}, the performance of applying $2\times2$ max-pooling is better than the other methods. Stride-Convolution will hinder the loss from directly propagating the gradient to the shallow layer while pooling will not.
%
We also find that max-pooling with kernel size $3\times 3$ performs worse than size $2\times 2$, as the structural information might be disturbed by the max-pooling with the $3\times 3$ kernel, which has overlapping pooling window.
\textbf{Dilated convolution.}
\citet{drn} found that the loss of spatial acuity may lead to the limitation of the accuracy for image classification.
%
In FishNet, the UR-block will dilute the original low-resolution features, therefore, we adopt dilated convolution in the fish body.
%
When the dilated kernels is used at the fish body for up-sampling, the absolute top-1 error rate is reduced by $0.13\%$ based on FishNet-150.
%
However, there is $0.1\%$ absolute error rate increase if dilated convolution is used in both the fish body and head compared to the model without any dilation introduced.
%
Besides, we replace the first $7\times7$ stride-convolution layer with two residual blocks, which reduces the absolute top-1 error by $0.18\%$.
\begin{table*}[t]
\renewcommand\arraystretch{1.2}
\begin{center}
\setlength{\tabcolsep}{2pt}
{\small
\begin{tabular}{l|c|cc}
\hline
& Instance Segmentation & \multicolumn{2}{c}{Object Detection} \\
& Mask R-CNN & Mask R-CNN & FPN \\
\hline
Backbone & \makecell[c]{AP$^{s}$/AP$_{S}^{s}$/AP$_{M}^{s}$/AP$_{L}^{s}$ }
& \makecell[c]{AP$^{d}$/AP$_{S}^{d}$/AP$_{M}^{d}$/AP$_{L}^{d}$}
& \makecell[c]{AP$^{d}$/AP$_{S}^{d}$/AP$_{M}^{d}$/AP$_{L}^{d}$} \\
\hline
ResNet-50 \cite{Detectron} & 34.5/15.6/37.1/52.1 & 38.6/22.2/41.5/50.8 & 37.9/21.5/41.1/49.9 \\
ResNet-50$^{\dagger}$ & 34.7/18.5/37.4/47.7 & 38.7/22.3/42.0/51.2 & 38.0/21.4/41.6/50.1 \\
ResNeXt-50 (32x4d)$^{\dagger}$ & 35.7/19.1/38.5/48.5 & 40.0/23.1/43.0/52.8 & 39.3/23.2/42.3/51.7 \\
\hline
\Xhline{2\arrayrulewidth}
FishNet-150 & \textbf{37.0}/19.8/40.2/50.3 & \textbf{41.5}/24.1/44.9/55.0 & \textbf{40.6}/23.3/43.9/53.7 \\
\hline
vs. ResNet-50$^\dagger$ & \textbf{+2.3/+1.3/+2.8/+2.6} & \textbf{+2.8/+1.8/+2.9/+3.8} & \textbf{+2.6/+1.9/+2.3/+3.6} \\
vs. ResNeXt-50$^\dagger$ & \textbf{+1.3/+0.7/+1.7/+1.8} & \textbf{+1.5/+1.0/+1.9/+2.2} & \textbf{+1.3/+0.1/+1.6/+2.0}
\end{tabular}
}
\caption{MS COCO \emph{val-2017} detection and segmentation Average Precision (\%) for different methods. AP$_*^{s}$ and AP$_*^{d}$ denote the average precision for segmentation and detection respectively. AP$^*_S$, AP$^*_M$, and AP$^*_L$ respectively denote the AP for the small, medium and large objects. The back-bone networks are used for two different segmentation and detection approaches, i.e. Mask R-CNN \cite{maskrcnn} and FPN \cite{fpn}. The model re-implemented by us is denoted by a symbol $^\dagger$. FishNet-150 does not use grouping, and the number of parameters for FishNet-150 is close to that of ResNet-50 and ResNeXt-50.}
\vspace{-10px}
\label{table:COCO}
\end{center}
\end{table*}
\subsection{Experimental investigations on MS COCO}
We evaluate the generalization capability of FishNet on object detection and instance segmentation on MS COCO \cite{coco}.
%
For fair comparison, all models implemented by ourselves use the same settings except for the network backbone. All the codes implementing the results reported in this paper about object detection and instance segmentation are released at \cite{mmdetection2018}.
\textbf{Dataset and Metrics}
MS COCO \cite{coco} is one of the most challenging datasets for object detection and instance segmentation. There are 80 classes with bounding box annotations and pixel-wise instance mask annotations. It consists of 118k images for training (\emph{train-2017}) and 5k images for validation (\emph{val-2017}). We train our models on the \emph{train-2017} and report results on the \emph{val-2017}. We evaluate all models with the standard COCO evaluation metrics AP (averaged mean Average Precision over different IoU thresholds) \cite{maskrcnn}, and the AP$_S$, AP$_M$, AP${_L}$ (AP at different scales).
\textbf{Implementation Details}
We re-implement the Feature Pyramid Networks (FPN) and Mask R-CNN based on PyTorch \cite{pytorch}, and report the re-implemented results in Table \ref{table:COCO}. Our re-implemented results are close to the results reported in Detectron\cite{Detectron}. With FishNet, we trained all networks on 16 GPUs with batch size 16 (one per GPU) for 32 epochs. SGD is used as the training optimizer with a learning rate 0.02, which is decreased by 10 at the 20 epoch and 28 epoch. As the mini-batch size is small, the batch-normalization layers \cite{batchnorm} in our network are all fixed during the whole training process. A warming-up training process \cite{trainimagenetin1hour} is applied for 1 epoch and the gradients are clipped below a maximum hyper-parameter of 5.0 in the first 2 epochs to handle the huge gradients during the initial training stage. The weights of the convolution on the resolution of $224\times224$ are all fixed. We use a weight decay of 0.0001 and a momentum of 0.9. The networks are trained and tested in an end-to-end manner. All other hyper-parameters used in experiments follow those in \cite{Detectron}.
\textbf{Object Detection Results Based on FPN.}
We report the results of detection using FPN with FishNet-150 on \emph{val-2017} for comparison. The top-down pathway and lateral connections in FPN are attached to the fish head. As shown in Table \ref{table:COCO}, the FishNet-150 obtains a 2.6\% absolute AP increase to ResNet-50, and a 1.3\% absolute AP increase to ResNeXt-50.
\textbf{Instance Segmentation and Object Detection Results Based on Mask R-CNN.}
Similar to the method adopted in FPN, we also plug FishNet into Mask R-CNN for simultaneous segmentation and detection. As shown in Table 3, for the task of instance segmentation, 2.3\% and 1.3\% absolute AP gains are achieved compared to the ResNet-50 and ResNeXt-50. Moreover, when the network is trained in such multi-task fashion, the performance of object detection could be even better. With the FishNet plugged into the Mask R-CNN, 2.8\% and 1.5\% improvement in absolute AP have been observed compared to the ResNet-50 and ResNeXt-50 respectively.
Note that FishNet-150 does NOT use channel-wise grouping, and the number of parameters for FishNet-150 is close to that of ResNet-50 and ResNeXt-50. When compared with ResNeXt-50, FishNet-150 only reduces absolute error rate by 0.2\% for image classification, while it improves the absolute AP by 1.3\% and 1.5\% respectively for object detection and instance segmentation. This shows that the FishNet provides features that are more effective for the region-level task of object detection and the pixel-level task of segmentation.
\textbf{COCO Detection Challenge 2018.} FishNet was used as one of the network backbones of the winning entry. By embedding the FishNet into our framework, the single model FishNeXt-229 could finally achieve 43.3\% on the task of instance segmentation on the \textit{test-dev} set.
\section{Conclusion}
\vspace{-10px}
In this paper, we propose a novel CNN architecture to unify the advantages of architectures designed for the tasks recognizing objects on different levels. The design of feature preservation and refinement not only helps to handle the problem of direct gradient propagation, but also is friendly to pixel-level and region-level tasks. Experimental results have demonstrated and validated the improvement of our network. For future works, we will investigate more detailed settings of our network, e.g., the number of channels/blocks for each stage, and also the integration with other network architectures. The performance for larger models on both datasets will also be reported.
\textbf{Acknowledgement}
We would like to thank Guo Lu and Olly Styles for their careful proofreading. We also appreciate Mr. Hui Zhou at SenseTime Research for his broad network that could incredibly organize the authors of this paper together.
{\small
\bibliographystyle{abbrvnat}
| {'timestamp': '2019-01-14T02:10:02', 'yymm': '1901', 'arxiv_id': '1901.03495', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03495'} | arxiv |
\section{Introduction}
\acp{UAV}, also known as drones, are becoming extremely popular due to their increasingly low prices and appealing functionalities. Indeed, drones are already adopted for several tasks such as inspections, perimeter control, remote surveillance, and emergencies \cite{Altawy2016}.
Unfortunately, drones represent the classical dual-use technology that, while providing great benefits, could also be adopted for malicious intents, such as
taking video/image pictures of---or violating \cite{londraiarport}---restricted-access areas \cite{Nassi_2019}, or even being used-as/carrying weapons against selected targets. The latter one is one of the major threats, not only for people \cite{maduro} but also for critical infrastructures such as airports and industrial sites, to name a few.
The International Air Transportation Association (IATA) warned of ``an exponential increase in reports of Remotely Piloted Aircraft Systems (RPA) operating dangerously close to manned aircraft and airports" \cite{iata}.
While self-operated drones represent an expensive attack vector, also subject to GPS spoofing/jamming countermeasures,
\ac{RPAS} drones are cheap and can be piloted for kilometers away from the operator due to the presence of a First Person View (FPV) channel. Furthermore, several unintentional near-hit and collisions have been reported between aircraft and drones \cite{asi}, due to the lack of understanding on the drones operators' side. Indeed, the frequency of these accidental events can only increase, due to the widespread use of drones for both recreational and commercial purposes \cite{amazon_drone}.
Moreover, drones can also be used to intentionally launch attacks against targets. For instance, an attack was launched in Syria on Russian military bases via a fleet of crudely made drones, each one equipped with GPS and powered by what appeared to be lawn mower engines, with each drone carrying nearly half a kilogram of high potential explosives \cite{asi}.
Several drone countermeasures have been developed and already deployed. Some of them involve the use of jammers to disable the remote controller of the drone, hence forcing it to land, the use of other drones to chase the not-authorized one and, finally, weapons to shoot the drone down \cite{Lin2018}. While several start-ups have already developed different anti-drone solutions mainly based on radar detection and jamming, an interesting academic solution is represented by ADS-ZJU \cite{shi}, where the authors propose an integrated approach combining multiple passive surveillance technologies to realize drone detection, localization, and radiofrequency jamming. \textcolor{black}{At the same time, several projects on drone detection have been funded by the European Union within the H2020 program, including \emph{SafeShore}\footnote{http://safeshore.eu} and \emph{Aladdin}\footnote{https://aladdin2020.eu}, to name a few (see Sec.~\ref{sec:related}) for more details.}
While drone counter-measures have already reached a significant level of reliability, drone detection can only rely on a few effective techniques \cite{azari}. Among the various techniques, four major strategies are emerging: (i) visual detection; (ii) audio detection; (iii) radar; and, (iv) RF detection. Visual detection mainly relies on the distribution of camera equipment in the area to be protected and the implementation of video processing techniques to identify anomalies in the video stream \cite{rozantsev}. Audio detection resorts to the generation of an audio signature of the drone propellers to be used to train a classifier \cite{kim};
such a technique further requires arrays of microphones to be deployed in the area to be monitored \cite{Busset2015}. Conversely, radar detection involves the transmission of RF signals to receive an RF echo that can be identified and tracked \cite{hoffmann}. Radars, while being the most powerful among the detection strategies, are expensive equipment that eventually might not be effective to detect small devices such as drones---since the radar signature is quite blurred.
Finally, RF-based techniques resort to the generation of RF fingerprints by looking at the communication channel between the drone and its remote controller \cite{nguyen}. RF fingerprinting is a promising technique that has been used for several purposes, but it requires specific equipment such as \acp{SDR}. However, cheap SDRs available on the market, such as the RTL-SDR, cannot be considered fully reliable, especially when operating at high frequencies.
Thus, we observe that the current literature still misses a viable and cheap solution, not requiring any dedicated hardware, while enabling the recognition not only of the presence of an \ac{RPAS} drone, but also its current state in a real-time perspective. What is more, such a solution should be robust to packet loss, as well as evasion attacks.
{\bf Our contribution.} In this manuscript, we present \emph{Picking a Needle in a Haystack} (\emph{PiNcH}), a solution to detect an RPAS drone based on encrypted network traffic analysis. Compared to our initial contribution in \cite{Sciancalepore2019_WiseML}, \emph{PiNcH} significantly improves the current state of the art in remotely-controlled drones detection with several contributions:
\begin{itemize}
\item \emph{Drone detection.} \emph{PiNcH}\ can detect the presence of a drone in different heterogeneous scenarios such as a library, a cafeteria, a conference, and outdoor areas.
\item \emph{Drone state identification.} \emph{PiNcH}\ can discriminate the current state of a powered-on drone, i.e., if the drone is either flying or lying on the ground.
\item \emph{Detection delay.} We provide a statistical analysis of the detection delay for each of the aforementioned classification scenarios as a function of the requested level of assurance.
\item \emph{Packet Loss}. We study the effect of packet loss on the performance of \emph{PiNcH}, by testing the detection accuracy when the eavesdropping equipment is located at increasing distances from the drone. We demonstrate \emph{PiNcH}\ to be able to overcome packet loss issues and to guarantee very high detection accuracy even at 200 meters from the position of the drone.
\item \emph{Evasion strategy}. We test the effectiveness of \emph{PiNcH}\ in the presence of evasion strategies, where the adversary reshapes the traffic profile of the controller-drone communication channel by introducing random delays between the message packets. We show that the effectiveness of such a strategy strongly depends on the specific deployment scenario, though, in general, it should be noted that it significantly reduces the maneuverability of the drone.
\item \emph{Movement identification.} \emph{PiNcH}\ can infer on the current movement of the drone, discriminating if the drone is increasing its altitude, moving forward, backward, left or right.
\end{itemize}
To the best of our knowledge, \emph{PiNcH}\ represents the first comprehensive solution able to detect an RPAS drone and, at the same time, its current state in real-time, looking only at the wireless traffic. Other unique features enjoyed by \emph{PiNcH}\ are its robustness to packet loss and the possibility to reject evasion attacks, based on the specific deployment scenario.
\textcolor{black}{At the same time, we stress that \emph{PiNcH}\ aims to detect an RPAS drone, where a remote controller is communicating with the drone. Indeed, \emph{PiNcH}\ cannot detect an autonomous drone, given that no communication between the controller and the drone is involved. However, for these scenarios, other solutions based on acoustic, visual, or radar techniques are applicable. In addition, due to its lightweight and non-invasive features, \emph{PiNcH}\ can be integrated with other drone detection techniques, to build a multi-method framework leveraging multiple means to detect an approaching drone.}
The results included in this paper have been obtained by using the popular drones' firmware ArduCopter, within the Ardupilot operating system. Thus, consistently with other recent work in the literature such as \cite{Chen_cns2019}, beyond the 3DR SOLO drone used in this paper, our results are fully applicable also to over 30 products, including DJI and HobbyKing vehicles, to name a few\footnote{\url{http://ardupilot.org/copter/docs/common-rtf.html\#common-rtf}}\footnote{\url{http://ardupilot.org/copter/docs/common-autopilots.html}}.
The drone-controller data traces we have generated in this work have been released as open-source (available at \cite{dataset}), to allow practitioners, industries, and academia to verify our claims and to use them as a basis for further development.
Finally, we remark that the aim of this paper is neither to propose a new intrusion detection algorithm nor to discuss new machine learning techniques. Indeed, we discuss and demonstrate, through an extensive measurement campaign run over an open-source operating system, that the presence, the status, and the specific operational mode of commercial remotely-operated drones can be identified using already available classification tools, paving the way to further research efforts by both critical infrastructure defense teams and drone operators.
{\bf Paper organization.} The paper is organized as follows: Section \ref{sec:related} reviews related work, Section \ref{sec:system_and_adversary_model} introduces the system and the adversary models assumed in this work, while Section \ref{sec:scenario_considerations} details the measurement scenario and provides some details about the measurements and the characterization of the network traffic generated by the drone. Section \ref{sec:classification_methodology} introduces the methodology we used for the acquisition, processing, and classification of the network traffic generated by the drone and the remote controller, while Sections \ref{sec:scenario_identification} and \ref{sec:detecting_a_drone} show the performance of our proposal for detecting the state of the drone and the presence of the drone in different heterogeneous scenarios, with a look also on the detection delay. Section \ref{sec:movement_identification} introduces the results related to the identification of each movement the drone can take, while Section \ref{sec:robustness} reports the performance of \emph{PiNcH}\ at increasing distances from the drone and when evasion strategies are applied by the adversary. Finally, Section \ref{sec:conclusions} reports some concluding remarks.
\section{Related work}
\label{sec:related}
In the last years, the widespread diffusion of commercial drones has paved the way for several research contributions discussing the potential identification of \acp{UAV} in a certain area of interest.
The authors in \cite{Nassi_2019} built a proof-of-concept system for counter-surveillance against spy drones by determining whether a certain person or object is under aerial surveillance. They show methods that leverage physical stimuli to detect whether the drone’s camera is directed towards a target in real-time. They demonstrate how an interceptor can perform a side-channel attack to detect whether a target is being streamed by analyzing the encrypted \ac{FPV} channel that is transmitted from a real drone (DJI Mavic) in two use cases: when the target is a private house and when the target is a subject. A similar target, i.e. video streaming detection, has been investigated in the recent work by the authors in \cite{birnbach2017wi}, focusing on the signal strength in the communication between the drone and its controller. Although being a significant step towards drone identification, these solutions are specifically designed to identify drones that are employed to target a specific target, while not being suitable for drone's detection at large or for drones that do not necessarily feature FPV.
The authors in \cite{Shoufan2018} showed that the radio control signal sent to a UAV using a typical transmitter can be captured and analyzed to identify the controlling pilot using machine learning techniques. The authors collected the messages exchanged between the drone and the remote controller, and used them to train multiple classifiers. They observed that the best performance is reached by a random forest classifier achieving an accuracy of around 90\% using simple time-domain features. The authors also provided extensive tests showing that the classification accuracy depends on the flight trajectory. In addition, they proved that the control signals, i.e., pitch, roll, yaw, and throttle, have specific importance for pilot identification. The work focused on a scenario where civil \acp{UAV} are remotely controlled by different pilots, there is no (or weak) authentication on the ground-to-aircraft command channel, and also there is little to null difference in the low-level timing or power of the control signals. In addition, they assumed that the pilots could carry out identical maneuvers, as well as the existence and availability of trustworthy recordings of each pilot’s behavior.
While exploiting the same principle, i.e., classification of the traffic, the related work focuses on the pilot and not on drone identification.
The authors in \cite{Nguyen2017} explored the feasibility of RF-based detection of drones by looking at radio physical characteristics of the communication channel when the drones' body is affected by vibration and body shifting. The analysis considered whether the received drone signals are uniquely differentiated from other mobile wireless phenomena such as cars equipped with Wi-Fi or humans carrying a mobile phone. The sensitivity of detection at distances of hundreds of meters as well as the accuracy of the overall detection system are evaluated using a \ac{SDR} implementation. Being based on both \ac{RSSI} and phase of the signals, the precision of the approach varies with the distance of the receiver from the transmitter. In addition, the solution resorts to physical layer information and special hardware (SDR), while our current contribution only exploits network layer information that can be collected by any WiFi device.
An identification mechanism based on the correlation between motion observed from an external camera and acceleration measured on each UAV's accelerometer is proposed by the authors in \cite{ruiz}. This solution combines FPV information with accelerometer information to remotely control a subset of swarm drones that are not provided with a camera, and therefore it requires the collaboration of one or more drones in the swarm to perform the identification.
Fingerprinting of wireless radio traffic at the network layer is emerging as a promising technique to uniquely identify devices in the wild. The authors in \cite{xu} proved that the extraction of unique fingerprints provides a reliable and robust means for device identification.
A fingerprinting approach for drone identification is proposed in \cite{li}. The authors analyzed the WiFi communication protocol used by drones and developed three unique methods to identify a specific drone model: (i) examining the time intervals between probe request frames; (ii) utilizing the signal strength carried in the frame header; and, finally (iii) exploiting some frame header fields with specific values. However, fingerprint approaches require specific equipment to be used, such as the Software Defined Radios (SDRs).
Network-Based traffic classification is proposed in \cite{bisio}. The authors describe a WiFi-based approach aimed at detecting nearby aerial or terrestrial devices by performing statistical fingerprint analysis on wireless traffic. They proved network-layer classification to be a viable means to classify classes of drones, i.e., aerial, terrestrial, and hybrid scenarios. However, their approach does not take into account the identification of drone traffic compared to standard WiFi traffic. The same authors extend the aforementioned contribution in \cite{Bisio2018_TVT}, by proposing a WiFi statistical fingerprint method to drone detection. Their solution can identify the presence of a drone and the associated video streaming.
Similarly, the authors in \cite{Alipour2019} adopted encrypted traffic analysis techniques to identify the presence of a drone, considering Parrot, DJI, and DBPower drones.
However, these solutions (available on the arXiv portal later than the present contribution) take into account very specific drones based on a proprietary architecture (DJI, Parrot), and they can detect only the presence of the drone without inferring its current status. Finally, the authors prove the feasibility of their solution considering self-generated traces as network noise, while in this work, we consider 5 publicly available data-sets and one (generated by us) from an outdoor area.
Another passive detection technique is proposed in \cite{fu}. The authors presented a technique specifically designed for two reference scenarios: (i) a drone communicating with the ground controller, where the cyclo-stationarity signature of the drone signal and pseudo Doppler principle are employed; and, (ii) a drone that is not sending any signal, where a micro-Doppler signature generated by the RF signal is exploited for detection and identification. Also in this case, the authors resort to both SDRs and physical layer fingerprinting, thus making their solution very hardware-invasive.
Machine learning techniques have been successfully used for other purposes in this research field. In \cite{Jeong2017}, the authors proposed a wireless power transfer system that predicts the drone's behavior based on the flight data, utilizing machine learning techniques and Naive Bayes algorithms.
In \cite{Park2016}, the authors demonstrated that machine learning can successfully predict the transmission patterns in a drone network. The packet transmission rates of a communication network with twenty drones were simulated, and results were used to train the linear regression and Support Vector Machine with Quadratic Kernel (SVM-QK).
Standard anti-drone active detection techniques resort to radar \cite{lee, quilter, roding}. Nevertheless, those techniques involve the transmission of signals and specific devices for the detection of the echo fingerprint.
The authors in \cite{jain} analyze the basic architecture of a drone and propose a generic drone forensic model that would improve the digital investigation process. They also provide recommendations on how one should perform forensics on the various components of a drone such as a camera and Wi-Fi.
\textcolor{black}{
Finally, we highlight that several projects tackling the detection of amateur or remotely-piloted drones have been funded by the European Union within the H2020 program, including \emph{SafeShore}\footnote{http://safeshore.eu} and \emph{Aladdin}\footnote{https://aladdin2020.eu}, to name a few (see Sec.~\ref{sec:related}) for more details. With specific reference to coastal border-surveillance, the SafeShore project aims at detecting Remotely Piloted Aircraft Systems (RPAS) carrying out illegal activities via passive and low-cost technologies, being very close to the aim of this project. The threats and the system requirements considered in this project has been discussed by the authors in~\cite{buric2017_MTA}. The project SafeShore has also launched a specific challenge, namely the \emph{drone-vs-bird detection challenge}, dedicated to addressing one of the many technical issues arising in this context \cite{coluccia2017_avss}, \cite{coluccia2019_avss}.
Another solution is the one that is being developed within another EU project, namely Advanced hoListic Adverse Drone Detection, Identification \& Neutralization (ALADDIN). The ALADDIN project aims to develop a complete product for the drone detection problem, leveraging a combination of the systems described above, including radar, video, sound, and further detection methods (for more details and publication overview, see the website\footnote{https://aladdin2020.eu/reports-publications/} of the project).
}
To sum up, none of the previous contributions can detect a drone and its current status by only exploiting the wireless traffic. Moreover, differently from the current literature, our contribution provides a thorough measurement campaign adopting a widely accepted open-source operating system and firmware for drones, included in over 30 products, as well as a detailed analysis adopting a different type of wireless network traffic to prove its robustness.
Finally, a study of the effectiveness of evasion attacks against drone detection strategies based on traffic analysis is provided in our contribution, as well as how packet loss phenomena can affect our strategy, differently from the previous work.
We will provide a qualitative and experimental comparison between \emph{PiNcH}\ and related approaches in Section \ref{sec:comparison}.
\section{System and Adversary Model}
\label{sec:system_and_adversary_model}
{\bf Adversarial model.} In this paper, we assume a scenario characterized by an RPAS drone flying over a no-fly-zone, where the GPS is not available. Indeed, we recall that drones leveraging GPS navigation can be easily defeated by adopting GPS-spoofing and jamming techniques. We assume the drone is remotely controlled by a malicious operator that intentionally wants to fly the drone across the border of a restricted-access area such as an airport, industrial plant, or critical infrastructure. We also assume that the adversary is deploying additional countermeasures preventing drone identification, such as dynamically changing the MAC addresses of the network interfaces of both the drone and the remote controller. In addition, we assume the link between the RC and the drone is encrypted at the layer-2 of the communication link, and therefore packet content cannot be inspected. We assume also that the link between the controller and the drone cannot be jammed, as the same frequencies are used for legitimate communications by other devices.
Finally, we initially assume that the adversary does not apply any evasion techniques, e.g., it does not modify the transmission rate and the length of the packets to mitigate the detection. However, in Section \ref{sec:robustness} we discuss the effectiveness of \emph{PiNcH}\ in presence of a particular type of evasion attack, where the adversary delays on purpose the packets to be transmitted by the RC and the drone, to avoid the detection. Overall, while implementing such countermeasures might improve the probability of escaping detection, their overall efficacy is not guaranteed, as a new training of our model would suffice to identify again the status of the drone. Further, the application of evasion strategies requires further feasibility studies based on the specific requirements of the application \cite{Zhang2016adversarial}. Indeed, introducing an artificial delay in the communication between the RC and the drone could affect user experience, to the point that the planned mission could be aborted. In addition, none of the actual commercial products implement such features, making our proposed solution effective.
{\bf System model.} Our main goal is the passive detection of the remotely-controlled drone without resorting to: (i) active radar technology \cite{quilter}; (ii) audio/visual detection \cite{saqib}; or, (iii) physical stimuli to FPV \cite{Nassi_2019}. Our solution does not require any intervention in the already existing ICT infrastructure and it does not conflict with any already deployed RF system. Indeed, \emph{PiNcH}\ exploits only the messages transmitted between the remote controller and the drone, and therefore it only requires a fully passive eavesdropper to be deployed in the region to be controlled.
Figure \ref{fig:model} wraps up on the system and adversarial models: the adversary (A) is determined to remotely fly a drone (D) into a no-fly zone (CI). Our solution can detect the drone's presence by simply deploying a WiFi probe (P). We observe that the WiFi probe can eavesdrop both the traffic from the controller to the drone (A-D) and the one from the drone to the controller (D-A).
\begin{figure}[htbp]
\includegraphics[width=.8\columnwidth]{figures/model.jpg}
\centering
\caption{System model: a no-fly zone (e.g. critical infrastructure --- CI) featuring a WiFi probe (P) to detect an approaching drone (D) remotely controlled by an adversary (A).}.
\label{fig:model}
\end{figure}
Despite our measurement campaign was performed using the 2.4 GHz frequency band and the WiFi communication technology, the methodology proposed in this paper can be easily extended to work on any operating frequency, provided that one (or more) receivers are available on that particular frequency, independently on the usage of any encryption technique. Indeed, we remark that most of the commercial drones, including the ones running the ArduCopter Operating System, use either the 2.4~GHz frequency band or the 900~MHz ISM band.
\section{Measurement scenario and Preliminary considerations}
\label{sec:scenario_considerations}
Our measurement scenario is constituted by a 3DR SOLO drone\cite{3dr} and a wireless probe capable of eavesdropping the radio traffic. The 3DR Solo drone is an open-source architecture featuring the Pixhawk 2.0 flight controller and the ArduCopter 3.3 firmware. The drone has been configured for the \emph{manual mode}, i.e., GPS switched off, and therefore, being able to fly both in indoor and outdoor environments. As a wireless probe, we adopted Wireshark 2.4.5, running in a Lenovo Ideapad 320 featuring Linux Kali 4.15.0. We configured the WiFi card of our laptop to work in monitor mode, eavesdropping and logging all the transmitted packets by either the remote controller or the drone.
Figure \ref{fig:setup} shows our measurement set-up.
\begin{figure}[htbp]
\includegraphics[width=0.8\columnwidth]{figures/setup.jpg}
\centering
\caption{Our measurement set-up: the drone, the remote controller, and the laptop we used to eavesdrop the radio spectrum.}.
\label{fig:setup}
\end{figure}
Subsequently, we collected several packets from the controller-drone link, while the drone was performing two different types of actions, as depicted below:
\begin{itemize}
\item \emph{Steady} (S). The drone is associated with the remote controller but it lays on the ground.
\item \emph{Movement} (M). The drone is flying around, performing several movements in all directions.
\end{itemize}
Table \ref{tab:link_stats} wraps up on the two states of the drone and provides ground for some preliminary considerations on the collected measurements. Firstly, we break down the communication link into 4 different flows: (i) the packets sent by the RC to the Drone; (ii) the packets sent by the Drone to the RC; (iii) the packets broadcast by the RC; and, finally (iv) the packets broadcast by the drone.
Secondly, we considered a measurement lasting for about 10 minutes for the Steady-state, where the drone is associated to the remote controller but it is lying on the ground; then, we unscrewed the propellers from the drone and we ``flew" the drone for about 10 minutes for the Movement state.
During the flight, we performed different maneuvers by continuously moving the control sticks. The percentage of exchanged packets is similar in both the drone's states, i.e., about 36\% of the traffic is transmitted by the RC, while about 58\% of the traffic is received by the RC. This is consistent, as the drone is required to transmit more traffic to the RC, for the RC to be always able to know precisely the full status of the drone. Finally, we observe the presence of broadcast traffic transmitted by the RC (about 6\%), while we did not detect any broadcast communication transmitted by the drone after the pairing process.
\begin{table}[htbp]
\centering
\caption{Drone's states and flows: We considered 2 different states, i.e., Steady and Movement, and 4 different unidirectional communication flows, i.e., RC to Drone, Drone to RC, RC to broadcast and, finally, Drone to Broadcast.}
\begin{tabular}{|c|l|l|c|c|}
\hline
\multicolumn{1}{|l|}{\textbf{State}} & \textbf{Source} & \textbf{Destination} & \textbf{N. of Pkts} & \textbf{Flow/Link (\%)} \\ \hline
\multicolumn{1}{|c|}{\multirow{4}{*}{\makecell[c]{Steady \\ (S)}}} & RC & Drone & 32706 & 35.8 \\
\multicolumn{1}{|l|}{} & Drone & RC & 52856 & 57.8 \\
\multicolumn{1}{|l|}{} & RC & Broadcast & 5789 & 6.4 \\
\multicolumn{1}{|c|}{} & Drone & Broadcast & 0 & 0 \\ \hline
\multirow{4}{*}{\makecell[c]{Movement \\ (M)}} & RC & Drone & 32868 & 34.6 \\
& Drone & RC & 56248 & 59.2 \\
& RC & Broadcast & 5837 & 6.2 \\
& Drone & Broadcast & 0 & 0 \\ \hline
\end{tabular}
\label{tab:link_stats}
\end{table}
In the following analysis, we focus on two packet attributes: \emph{packet size} and \emph{packet inter-arrival time}. For both the attributes, we took the previously identified flows from Section \ref{sec:scenario_considerations}, and we analyzed the size of the packets for the 4 different flows combining the two states, i.e., Steady and Movement, and the packets traveling from the RC to the drone, and from the drone back to the RC.
\\
{\bf Packet size analysis.} Figure \ref{fig:packet_size_analysis} shows the frequency distribution function associated with each packet size belonging to the four different flows. Firstly, the vast majority of packets transmitted in the configuration \emph{S, RC to drone} (red circles) have the size equal to 156 Bytes. A similar phenomenon can be observed for \emph{M, RC to drone} (black crosses). Conversely, the flows coming from the drone are characterized by very different packet sizes spanning from 130 to 1144 Bytes, while more packets are transmitted by the drone when it is in the Steady-state, i.e., blue crosses have on average higher values than the green stars. These considerations motivated us to consider as ``discriminating features'' also the mean and the standard deviation of the packet size, computed over time windows of a different duration.
\begin{figure}[htbp!]
\includegraphics[width=.75\columnwidth]{figures/pkt_size_analysis.pdf}
\centering
\caption{Packet size analysis: Number of packets as a function of their size considering the four communication flows. The total number of collected packets (events) is 174677.}
\label{fig:packet_size_analysis}
\end{figure}
\\
{\bf Inter-arrival time analysis.} We extracted the time associated with all the events belonging to the same flow and we differentiated them obtaining the inter-arrival times. Figure \ref{fig:time_analysis} shows the number of packets as a function of their inter-arrival time. Firstly, we observe periodic packets at $20 ms$ and $40 ms$ transmitted by the RC to the drone in both the drone's states. Then, we observe how the two drone's states, i.e., Steady and Movement, are characterized by almost the same profile: there are only minor differences at about $31 \mu s$ and between $50 \mu s$ and $90 \mu s$. Indeed, the correlation coefficients computed over the frequency distribution functions are 0.71 and 0.75, for the flows transmitted and received by the remote controller, respectively. Finally, for both the considered drone's state, we observe that the drone is transmitting more data then the RC, i.e., blue and green curves are higher than the black and red ones.
\begin{figure}[htbp!]
\includegraphics[width=.75\columnwidth]{figures/time_analysis.pdf}
\centering
\caption{Packet size analysis: Number of packets as a function of their size considering the four communication flows. The total number of collected packets (events) is 174677.}
\label{fig:time_analysis}
\end{figure}
\\
{\bf Broadcast traffic.} Packets transmitted to the broadcast address by the remote controller have the same size (289 bytes) and an interarrival time equal to $100ms$ in both the drone's state. Given their strictly periodic nature, we do not consider them further in our analysis.
\section{Methodology}
\label{sec:classification_methodology}
We now introduce \emph{PiNcH}, our solution to drone's detection, and we test it against the previously introduced drone's states, i.e., Steady and Movement. As our classification tools, we adopted a series of scripts developed using Matlab R2019a and the \emph{Machine Learning} toolbox. For our analysis, we consider the following configuration:
\begin{itemize}
\item \emph{Classifiers.} We considered the Random Forest algorithm, being the best among those we tried (see \cite{Sciancalepore2019_WiseML} for more details).
\item \emph{Flows.} We consider 3 different flows, i.e., RC to drone, drone to RC, and the overall link.
\item \emph{Features.} We look at 6 different features, i.e., interarrival time, packet size, mean and standard deviation computed over a certain number of samples of interarrival time and packet size.
\end{itemize}
\textcolor{black}{
Figure \ref{fig:processing} introduces the details of \emph{PiNcH}, i.e., our proposed solution.\\
\begin{figure*}[htbp!]
\includegraphics[width=\columnwidth]{figures/processing.jpg}
\centering
\caption{\emph{PiNcH}\ classification methodology: (i) WiFi radio eavesdropping, (ii) attribute extraction, (iii) feature generation, and (iv) classification.}
\label{fig:processing}
\end{figure*}
The notation used throughout the rest of this work is summarized in Tab.~\ref{tab:notation}. Lower case letters refer to a scalar value, while a boldface lowercase letter, e.g., $\mathbf{l}$, is used to represent a vector. The vector elements are listed within brackets.
\begin{table}[htbp]
\centering
\color{black}
\caption{\textcolor{black}{Notation used throughout the paper}.}
\label{tab:notation}
\begin{tabular}{|P{0.13\columnwidth}|P{0.87\columnwidth}|}
\hline
{\bf Notation} & {\bf Description} \\
\hline
$N$ & Number of Packets of dataset $A$. \\
\hline
$a_n$ & Arrival Time of the generic n-th packet. \\
\hline
$p_n$ & Size of the generic n-th packet. \\
\hline
$s_n$ & Source MAC address of the generic n-th packet.\\
\hline
$d_n$ & Destination MAC address of the generic n-th packet.\\
\hline
$J$ & Number of Packets of dataset $B$.\\
\hline
$t_n$ & Interarrival Time between the n-th packet and $\left( n+1\right)$-th packet. \\
\hline
$F$ & Number of Features extracted from each trace. \\
\hline
$x_{n,f}$ & Generic f-th feature of the n-th packet. \\
\hline
$L$ & Number of labels. \\
\hline
$y_n$ & Label associated to the n-th packet, being $y_n = \left[ 0,1\right]$. \\
\hline
$W$ & Window size used for features computation. \\
\hline
$D$ & Overall matrix used for classification. \\
\hline
$M$ & Overall number of packets used for classification. \\
\hline
$\mathbf{x}$ & Feature set in the matrix $D$. \\
\hline
$\mathbf{y}$ & Label set in the matrix $D$. \\
\hline
$h_k (\mathbf{x})$ & Generic k-th decision tree classifier working on the features set $\mathbf{x}$. \\
\hline
$a_t$ & Threshold value on the node $t$ of the decision tree classifier. \\
\hline
$\Theta_k$ & Parameters set of the k-th decision tree classifier. \\
\hline
$H(T)$ & Entropy of the data-set $T$. \\
\hline
$P_l$ & Probability that the generic label $l$ is present in a dataset. \\
\hline
$IG(T,a)$ & Information Gain derived from the split of dataset $T$ with the threshold $a$. \\
\hline
$vals(x_k)$ & Set of possible values for the feature $x_k$. \\
\hline
\end{tabular}
\end{table}
We assume a communication link between the drone (D) and the adversary (A) constituted by two flows: remote controller to drone and backward. In summary, \emph{PiNcH}\ requires that both the flows are eavesdropped by a WiFi probe, collecting two attributes: the interarrival time between subsequent packets and the packet size. Subsequently, a set of features is generated from the attributes. Indeed, for each instance of the attributes, i.e., each pair of [interarrival time - packet size], we compute the mean and standard deviation on a predetermined sequence of lines, for both the interarrival time and the packet size. The new data set of features is then provided to the classifier.\\\\
Overall, PiNcH consists of four (4) phases, that are: (i) \emph{WiFi Radio Eavesdropping}; (ii) \emph{Attributes Extraction}; (iii) \emph{Feature Generation}; and (iv) \emph{Classification}. The operations executed in each of them are described below. \\\\
In the \emph{WiFi Radio Eavesdropping Phase}, we collect a large number of measurements, using standard WiFi eavesdropping equipment. Specifically, we first collected a dataset constituted by samples from a specific traffic profile that we want to detect. We denote with $N$ the number of packets included in such a dataset \\\\
{\bf Attribute Extraction.} During the \emph{Attribute Extraction Phase}, for each n-th packet, we denote with $a_n$ the arrival time of the packet, i.e., the time when the packet was received, and with $p_n$ the corresponding packet size. Also, we denote the source MAC address of the packet as $s_n$ and the destination MAC address as $d_n$. Thus, each received packet is represented by a vector in the form $\left[s_n, d_n, a_n, p_n \right]$. We denote this data-set as $A$, being characterized by a label value $y_n = 0$.\\
For training purposes, we also collect an additional trace, containing wireless traffic related to another profile, different from the one considered in the data-set $A$.
Each packet in this trace is represented by the attributes described before, and thus it is a vector in the form $\left[s_j, d_j, a_j, p_j \right]$. We assume a total number of $J$ packets, and we denote this data-set as $B$, being characterized by a label value $y_j = 1$.\\
Note that this methodology can be extended to include further profiles of traffic of interest, for a total number of labels equal to $L$, where each profile can be distinguished from the others for the specific value of the associated label. For ease of discussion and without loss of generality, in the following we assume two classes, and thus a binary problem ($L=2$), with $y=\left[ 0, 1 \right]$.\\\\
{\bf Feature Generation.} In the \emph{Feature Generation} phase, for all the data-sets, we extracted the interarrival times of the packets. Considering the generic n-th packet of the data-set $A$, we compute the interarrival time between the n-th packet and the $\left( n+1 \right)$-th packet, as $t_n = a_{n+1} - a_n$, and we replace the arrival time $a_n$ with the interarrival time $t_n$. As a result, the trace $A$ contains $N-1$ vectors in the form $\left[s_n, d_n, t_n, p_n \right]$, while the trace $B$ contains $J-1$ vectors in the form $\left[s_j, d_j, t_j, p_j \right]$. \\
Starting from these traces, we create new data-sets, by extracting a number of features $F=6$ for each packet, where each f-th feature ($f=1, \dots, 6$) is computed as described below. With reference to the trace $A$, the following steps are executed:
\begin{itemize}
\item The first feature ($x_1$) is the packet size, namely $x_{n,1} = p_n$;
\item the second feature ($x_2$) is the interarrival time between the n-th packet and the $\left( n+1 \right)$-th packet, namely $x_{n,2} = t_{n+1} - t_n$;
\item the third feature ($x_3$) is the mean packet size, computed over a vector having size $W$, namely $x_{n,3} = \frac{1}{W} \cdot \sum_{n=1}^W p_n$;
\item the fourth feature ($x_4$) is the mean interarrival time, computed over a vector having size $W$, namely $x_{n,4} = \frac{1}{W} \cdot \sum_{n=1}^W t_n$;
\item the fifth feature ($x_5$) is the standard deviation of the packet size, computed over a vector having size $W$, namely $x_{n,5} = \sqrt{ \frac{ \sum_{n=1}^W \left( p_n - x_{n,3} \right) }{W} }$;
\item the sixth feature ($x_6$) is the standard deviation of the interarrival time, computed over a vector having size $W$, namely $x_{n,6} = \sqrt{ \frac{ \sum_{n=1}^W \left( t_n - x_{n,4} \right) }{W} }$;
\item finally, for each n-th packet, we insert a label ($y_n$), where $y_n = \left[ 0, 1 \right]$, indicating the specific data-set the packet is related to.
\end{itemize}
Note that the above process is repeated also for the trace $B$. The result of the \emph{Feature Generation} phase is the creation of two matrices, namely $D_A$ and $D_B$, containing the features and the labels of all the packets in both the data-sets.
We mix the matrices $D_A$ and $D_B$, creating a single matrix $D$, having a total number of $M=N+J$ packets, in the form depicted in the following Eq.~\ref{eq:matrices}. \\
\begin{gather}
\label{eq:matrices}
\mathbf{D} =
\left\{
\begin{tabular}{ccccc}
$x_{1,1}$ & $x_{1,2}$ & \dots & $x_{1,6}$ & $y_{1}$ \\
$x_{2,1}$ & $x_{2,2}$ & \dots & $x_{2,6}$ & $y_{2}$ \\
$\vdots$& $\vdots$& $\ddots$&$\vdots$ \\
$x_{m,1}$ & $x_{m,2}$ & \dots & $x_{m,6}$ & $y_{m}$ \\
$\vdots$& $\vdots$& $\ddots$&$\vdots$ \\
$x_{M,1}$ & $x_{M,2}$ & \dots & $x_{M,6}$ & $y_{M}$ \\
\end{tabular}
\right\} = \left\{ \mathbf{x}, \mathbf{y} \right\}
\end{gather}
This matrix is given in input to the \emph{Classification Phase}, and it is used to classify and predict the class of the packets. \\\\
{\bf Classification.} The goal of the \emph{Classification Phase} is to build a classifier, which predicts the label $y_n$ from the features $x_n$, based on the data-set $D$, given an ensemble of classifiers $h = \left\{ h_1(\mathbf{x}), h_2 (\mathbf{x}), \dots, h_K (\mathbf{x}) \right\}$, where the classifiers $h$ are decision trees, and therefore, the ensemble is a \emph{Random Forest}.\\
Specifically, a decision tree is a classification tool leveraging a tree-like graph or decision model, including event probability, resource costs, and utility. It is a useful tool to represent an algorithm containing only conditional control statements. Formally, a classification tree is a decision tree where each node has a binary possible decision, depending on whether the input feature $x_f$ is subject or not to the condition $x_f < a$, being $a$ a threshold parameter of the decision tree. The top node of the decision tree is defined as the root node, and it contains the whole data-sample. Then, the data-sample is binarily sub-divided into smaller parts, namely sub-samples, where each sub-sample satisfies (or not) the condition defined by the threshold. The criterion is that the subdivision continues until each sub-group has only a single label, thus being related to a single class, or there is not any further sub-division that improves the actual situation.\\
There are several algorithms for constructing decision trees, i.e., to decide the value of the threshold $a$ on each node of the tree. These techniques work top-down, by choosing a threshold at each step that best splits the set of items. Some examples include Gain Impurity Maximization, Information Gain Maximization, and Variance Reduction. In our approach, we selected the Information Gain Maximization approach, whose main logic is described in the following.
\begin{itemize}
\item We first compute the entropy of the data-set, namely $H(T)$, as in the following Eq.~\ref{eq:entropy}.
\begin{equation}
\label{eq:entropy}
H ( T ) = - \sum_{l=0}^{L-1} P_l \cdot \log_2 P_l,
\end{equation}
where $P_l$ is the probability of each class present in the child node that results from a split in the tree, with $\sum_{l=0}^{L-1} P_l = 1$~\cite{frank2011}.
\item Then, given a threshold value $a$, the Information Gain $IG(T,a)$ derived from the split of trees with the threshold $a$ is defined as in the following Eq.~\ref{eq:ig}.
\begin{flalign} \nonumber
\label{eq:ig}
IG (T,a) &= H(T) - H(T|a) = &&\\%\nonumber
&= - \sum_{l=0}^{L-1} P_l \cdot \log_2 P_l - P(a) \cdot \sum_{l=0}^{L-1} P(l|a) \cdot \log_2 P(l|a).
\end{flalign}
\item The specific threshold value $a_t$, selected at the node $t$ of the tree, is the one that maximizes the information gain in the dataset $T$, as in Eq.~\ref{eq:max_ig}.
\begin{equation}
\label{eq:max_ig}
a_t = \max_{a \in vals(x_k)} IG (T,a),
\end{equation}
where the notation $vals(x_k)$ refers to the set of possible values for the feature $x_k$.
\end{itemize}
The above strategies are used to obtain the set of decision trees that best fit the data, i.e., by maximizing the information gain. Note that the specific parameters of the \emph{best} decision trees are not fixed, but they can vary due to the randomness in the usage order of the features and according to the specific strategy used to obtain the threshold at each node of the tree. More details on further techniques and optimizations used in the implementation of decision trees can be found in~\cite{frank2011} and~\cite{Rokach2008}.\\
Now, considering a large number of decision trees, a \emph{Random Forest} is a generalized classifier that considers many decision trees together. Formally, a Random Forest is a classifier based on a family of classification trees $h = \left\{ h( \mathbf{x}| \Theta_1), \dots, h( \mathbf{x}| \Theta_K) \right\} $, where $\Theta_k$ are the parameters of the classification trees, that are randomly chosen from a model random vector $\Theta$. Note that these parameters refer to the variables of the decision tree, including the structure of the tree, the number of layers, and the configuration of the threshold values. \\
Assuming the final classification of $\mathbf{x}$ is denoted by $f(\mathbf{x}) = \mathbf{y}$, and each decision tree $h_k (\mathbf{x})$ casts a vote for the most popular class that is $y_k (\mathbf{x})$, we have that $f(\mathbf{x})=\mathbf{y}$ is the most popular classification of $x$ in the ensemble of decision trees, i.e., formally:
\begin{equation}
\label{eq:rf}
f(\mathbf{x}) = \mathbf{y} = \max_{l_0, l_1} \left\{ \left[ \sum_{k=1}^K \left( h_k(\mathbf{x}) == 0 \right) , \sum_{k=1}^K \left( h_k(\mathbf{x}) == 1 \right
\right] \right\}.
\end{equation}
We refer the interested readers to the technical works on Decision Trees and Random Forest classification by the authors in~\cite{breiman2001} and \cite{Paul2018} for details about the classification accuracy and further improvements on specific estimation techniques. \\
Finally, we highlight that, for the Random Forest classification algorithm, we used the 10-folds cross-validation method, i.e., a technique to evaluate the classifier performance by partitioning the original sample into a training set (9 randomly chosen folds) to train the model, and a test set to evaluate it (the remaining fold from excluding the 9 previously chosen). This is a standard technique used in data mining processes, and further details can be found in~\cite{rodriguez2010}.}
\section{Drone scenario identification: Is it flying?}
\label{sec:scenario_identification}
In this section, we introduce the methodology used by \emph{PiNcH}\ to identify the current state of the drone, i.e., Steady or Movement. To this end, we structured the detection system over the following steps: eavesdropping the WiFi spectrum, collecting packets, generating the associated features, and classifying the incoming traffic, as discussed in Section \ref{sec:classification_methodology}. For each instance in the features set, we challenge the classifier to identify the state of the drone.
In particular, we consider 5 different metrics: \ac{TP}, \ac{FP}, \ac{FN}, \ac{TN}, and the overall \ac{SR} as the number of correct classifications (TP+TN) divided by the total number of classifications (TP+TN+FP+FN). Table \ref{table:static_mov} depicts the results of the 10-fold cross-validation, assuming the three aforementioned classifiers and metrics with the features computed over a reference time window of 200 consecutive samples. Link fingerprinting achieves the worst performance, while the unique flows, i.e., RC to Drone and Drone to RC, behave almost in the same way. Considering the one-way links, we observe that both FP and FN are less than 9\%. Finally, for each configuration, we report (in percentage) the overall \ac{SR} being equal to the total number of correctly classified instances.
\begin{table}[htbp]
\centering
\caption{Detection of drone's state considering different flows. All the values are in percentages [\%], while the Random Forest (RF) classifier is used as the classification tool.}
\label{table:static_mov}
\begin{tabular}{|l|l|c|c|c|c|c|}
\hline
{\bf Classifier} & {\bf Flow} & {\bf TP} & {\bf FP} & {\bf FN} & {\bf TN} & {\bf SR} \\
\hline
\hline
\multirow{3}{*}{RF} & RC to Drone & 92.37 & 7.63 & 8.65 & 91.35 & 91.86\\
& Drone to RC & 92.98 & 7.02 & 6.89 & 93.11 & 93.05\\
& Link & 88.15 & 11.85 & 8.57 & 91.43 & 89.69\\
\hline
\end{tabular}
\end{table}
\\
{\bf Detection delay.} We now consider the time to detect the state of the drone. Given the results of the previous section, we assume the Random Forest classifier using the 10-folds cross-validation method and the unicast traffic collected from the two links, i.e., RC to Drone and Drone to RC. Figure \ref{fig:mov_steady_ROC} shows the \ac{ROC} curve associated with the aforementioned configuration while varying the number of samples used for the generation of the features. Indeed, as in the previous case, we considered the inter-arrival time, the packet size, and their mean and standard deviation computed over partially overlapping sliding windows of size spanning between 50 and 500 samples.
\begin{figure}[htbp]
\includegraphics[width=.75\columnwidth]{figures/mov_steady_ROC.pdf}
\centering
\caption{\ac{TPR} and \ac{FPR} to detect the state of the drone as a function of the number of eavesdropped packets.}
\label{fig:mov_steady_ROC}
\end{figure}
Increasing the number of samples used to compute the mean and the standard deviation significantly improves the performance of the detection process. To provide few reference performance indicators, considering 200 samples, we can achieve 0.91 of \acl{TPR} and 0.11 of \acl{FPR}, while increasing the number of samples to 400 leads to 0.96 of TPR and 0.05 of FPR.
The number of samples used to compute the mean and the standard deviation for each of the above traffic features is proportional to the detection delay, i.e., the time window required to collect such a number of samples.
\begin{figure}[htbp]
\includegraphics[width=.75\columnwidth]{figures/detection_delay_mov.pdf}
\centering
\caption{Relationship between the number of samples and the detection delay, for each of the four flows.}
\label{fig:detection_delay_mov}
\end{figure}
Figure \ref{fig:detection_delay_mov} shows the quantile 0.05, 0.5, and 0.95 associated to the detection delay for each of the four flows, as a function of the number of samples. It is possible to notice that the flows from the RC to the drone (and similarly, from the drone to the RC) exhibit the same performance, independently from the particular operational mode of the drone, i.e., being it steady or moving. For the Drone to RC flow, being characterized by the highest throughput, the detection delay is smaller than the RC to drone flow.
Given the linear relationship between the number of samples and the detection delay, a good trade-off between detection performance and delay can be estimated in 200 samples (FPR=0.11, TPR=0.91) being equivalent to about 2.45 seconds and 0.73 seconds of eavesdropping time, for the \emph{RC to drone} and the \emph{drone to RC} flow, respectively. Better performance can be achieved using 400 samples (FPR=0.05, TPR=0.96) while incurring in a detection delay of about 4.8 seconds for the RC to drone flow and 1.5 seconds for the drone to RC flow.
To provide further insights, we also investigated the relative impact, i.e., the weight, that each feature has in the model. Figure \ref{fig:feat_imp_mov} summarizes our analysis, showing the normalized \emph{feature importance} in the above scenario, as it has been obtained via the Machine Learning Toolbox of MATLAB R2019a.
\begin{figure}[htbp]
\includegraphics[width=\columnwidth]{figures/feature_importance.jpg}
\centering
\caption{Normalized Feature Importance with different sample size (and detection delay).}
\label{fig:feat_imp_mov}
\end{figure}
The standard deviation of the interarrival time between the packets (yellow bars) has the highest impact, showing a feature importance value that is almost 35\%. Among the other features, we report that the mean of the interarrival time, as well as the ``raw'' interarrival time between packets, always emerge as the second important feature.
These considerations will be further leveraged later on in Section \ref{sec:robustness}, where we will discuss the effect of evasion strategies that an attacker can deploy.
\section{Detecting a drone into the wild}
\label{sec:detecting_a_drone}
This section introduces the techniques and methodologies used by \emph{PiNcH}\ to detect the presence of a drone in different scenarios. We consider five different traces from the CRAWDAD data-set \cite{crawdad} and one trace collected from a crowded outdoor area in Doha, Qatar. We considered these traces as our reference scenarios for testing the presence of the drone. The traces have been selected to guarantee the maximum scenario heterogeneity and the presence of different WiFi network patterns.
\begin{table}[htbp]
\centering
\caption{WiFi traces description.}
\label{table:wifi_traces}
\begin{tabular}{|P{0.02\columnwidth}|l|c|c|}
\hline
{\bf ID} & {\bf Description} & {\bf Size (B)} & {\bf Ref.} \\
\hline
S1 & \makecell[l]{Wireless LAN traffic trace collected from \\ PSU (Portland State University) Library.} & 89905 & \cite{t1} \\
\hline
S2 & \makecell[l]{Wireless LAN traffic trace collected from \\ PSU (Portland State University) Cafeteria.} & 131301 & \cite{t1} \\
\hline
S3 & \makecell[l]{Wireless LAN traffic trace collected from \\ a large outdoor area in downtown Portland.} & 29795 &\cite{t1} \\
\hline
S4 & \makecell[l]{Tcpdump trace from the wireless network \\ at a three-day computer-science conference.} & 110492 &\cite{t4} \\
\hline
S5 & \makecell[l]{Wireless probe requests collected at a \\ political meeting in Rome, Italy.} & 11799 & \cite{t5} \\
\hline
S6 & \makecell[l]{Measurement from an outdoor area in \\ Doha, Qatar.} & 82651 & \\
\hline
\end{tabular}
\end{table}
Table \ref{table:wifi_traces} shows the traces we selected to test the presence of the drone, together with a brief description of them.
We carefully analyzed the content of the traces and we selected a time period of 10 minutes from each trace, to provide a balanced data set, where the duration of the traces is the same. We consider several scenarios: a library (S1), a cafeteria (S2), outdoor areas (S3, S6), a computer science conference (S4), and a political meeting (S5). We selected both indoor (S1, S2, S4, S5) and outdoor scenarios (S3, S6), with the presence of both smart-phones and laptops, and characterized by different moving patterns.
\\
Given the performance of the previous configurations, we select the Random Forest classifier, the Drone to RC flow and the 10-fold cross-validation method. The Drone to RC flow guarantees also a more realistic scenario, being usually the drone more exposed to the eavesdropping equipment compared to the remote controller.
Moreover, in this section we consider the features computed over a time window of 20 samples, being equivalent to less than 0.28 seconds of channel eavesdropping (quantile 0.95 value). This leads to a total number of 2,142 instances, where for each test the 214 samples were randomly chosen to be the test set (10\%), while the remaining samples were used for training.
In addition, we only consider the scenario related to the moving drone, being more suitable for the detection problem introduced by Figure \ref{fig:model}. Finally, we mixed each of the above traces with a standalone trace of the moving drone.
\begin{figure}[htbp]
\includegraphics[width=.9\columnwidth]{figures/drone_yes_no.pdf}
\centering
\caption{TP and \ac{FP} rates for the detection of the drone in the 6 scenarios, i.e., S1, S2, S3, S4, S5, and S6. The red circle represents an average estimation of all the scenarios.}
\label{fig:yn_ROC}
\end{figure}
The green circles in Figure \ref{fig:yn_ROC} show the \ac{TPR} as a function of the \ac{FPR} for each of the previously introduced scenarios S1, S2, S3, S4, S5, and S6. We highlight that the Random Forest classifier performs extremely well, being able to detect the presence of the drone with FP $< 0.0027$ (worst case, S4) and TP $> 0.9984$ (worst case, S5). Finally, we report an estimation of the average behaviour by the red circle characterized by FP = $8.9 \cdot 10^{-4}$ and FN = 1-TP = $0.9 \cdot 10^{-4}$.
We further analyze the detection delay for the previously introduced scenarios S1, S2, S3, S4, S5, and S6. The detection delay is a particularly relevant metric, since it provides an estimation of the time required to detect the presence of the drone.
Recalling the scenario introduced in Figure \ref{fig:model}, we observe that the detection delay significantly affects the probes layout and the surveillance area. Indeed, large detection delays do imply larger reaction time and, in turn, a much larger surveillance area to guarantee enough reaction time. Conversely, short detection delays allow for faster reaction time and shorter distances between the target and probes.
We adopted the following configuration: Random Forest classifier, features computed over consecutive samples spanning between 5 and 200, 10-fold cross-validation method, and finally the scenarios S1, S2, S3, S4, S5, and S6. Figure \ref{fig:detection_delay} shows the \ac{TPR} as a function of the \ac{FPR}, varying the number of samples for the 6 different scenarios. We observe that the Random Forest classifier is effective in detecting the presence of the drone in all the scenarios, i.e., for the majority of the cases FP $< 3 \cdot 10^{-3}$ and TP $> 0.997$, even for the worst-case scenario where we consider a detection delay based on only five samples. We highlighted the trends by computing the linear regression for each scenario, i.e., solid lines in Figure \ref{fig:detection_delay}.
\begin{figure}[htbp]
\includegraphics[width=.79\columnwidth]{figures/drone_yes_no_ROC.pdf}
\centering
\caption{\ac{TPR} and \ac{FPR} for the 6 scenarios while varying the number of eavesdropped samples. Solid lines represent the linear regression for each of the considered scenario.}
\label{fig:detection_delay}
\end{figure}
To estimate the detection delay, we vary the number of samples required to generate one instance of the features and we compute the detection delay as a function of the overall \ac{SR} defined as SR = (TP+TN) / (TP+TN+FP+FN) as depicted in Figure \ref{fig:detection_delay_SR}.
The detection delay is directly proportional to the number of samples considered for the computation of the standard deviation and the mean of the packet size and the inter-arrival time. Such a delay spans between 0, i.e., only one packet is considered to infer on the presence of the drone, and 1 second.
Moreover, the detection delay might significantly increase when an overall \ac{SR} greater than 0.999 is required. Nevertheless, we observe that the Random Forest classifier guarantees a detection delay less or equal to half of a second, assuming a SR less than 0.999 for all the scenarios. The scenarios slightly affect the performance of the classifier: S4 (Computer Science Conference) is the worst, S2 and S6 (Cafeteria and Outdoor Doha) behave very similarly, and lastly, S1, S3, and S5 (Library, Outdoor Portland, and Political Meeting) have the best performance.
\begin{figure}[htbp]
\includegraphics[width=.8\columnwidth]{figures/drone_yes_no_SR_dd.pdf}
\centering
\caption{Detection delay as a function of the overall \ac{SR} for the 6 different scenarios.}
\label{fig:detection_delay_SR}
\end{figure}
\section{Drone movements identification}
\label{sec:movement_identification}
In this section, we consider the problem of identifying the specific movements performed by the drone. We consider 7 different movements as depicted in Table \ref{table:movements}. To collect the network patterns associated with each drone movement, we unscrewed the drone's propellers and we collected about 9400 packets (1 minute) for each drone movement. We used the Random Forest classifier, and the 10-folds classification method. Differently from our previous analysis, in this scenario, we do not use the Drone to RC flow but we consider the overall link, since preliminary experiments indicated that better performance could be seized.
\begin{table}[h]
\centering
\caption{Remote controller commands and corresponding drone movements.}
\centering
\label{table:movements}
\begin{tabular}{|l|l|}
\hline
{\bf Stick position} & {\bf Description} \\
\hline
Pitch down & \makecell[l]{The right stick is pushed forward and the drone \\ moves forward.} \\
\hline
Pitch up & \makecell[l]{The right stick is pushed backward and the drone \\ moves backward.} \\
\hline
Roll left & \makecell[l]{The right stick is pushed left and the drone \\ moves left.} \\
\hline
Roll right & \makecell[l]{The right stick is pushed right and the drone \\ moves right.} \\
\hline
Throttle up & \makecell[l]{The left stick is pushed forward and the drone \\ increases its altitude.} \\
\hline
Yaw left & \makecell[l]{The left stick is pushed left and the drone \\ rotates left.} \\
\hline
Yaw right & \makecell[l]{The left stick is pushed right and the drone \\ rotates right.} \\
\hline
\end{tabular}
\end{table}
Figure \ref{fig:mov_identification} shows the \ac{TPR} as a function of the \ac{FPR} associated to the seven aforementioned movements. For each movement, we consider different sample sizes to generate the features spanning between 50 and 500 consecutive packets. We observe that movement identification is significantly affected by the sample size; indeed, TPR and FPR span between [0.001, 1] and [0.07, 0.56], respectively.
\begin{figure}[htbp]
\includegraphics[width=.8\columnwidth]{figures/movements_identification.pdf}
\centering
\caption{\ac{TPR} and \ac{FPR} associated to each movement of the drone.}
\label{fig:mov_identification}
\end{figure}
We also investigate the detection delay related with each sample size. The results are provided in Figure \ref{fig:mov_identification_3}.
\begin{figure}[htbp]
\includegraphics[width=.8\columnwidth]{figures/detection_delay_mov_identification.pdf}
\centering
\caption{Detection delay associated to each movement of the drone.}
\label{fig:mov_identification_3}
\end{figure}
It is possible to note that in all the cases the quantile 0.05, 0.5, and 0.95 of the detection delays are almost overlapping, demonstrating that the interarrival time between packets shows a similar profile over the time, independently of the particular movement.
Finally, Figure \ref{fig:mov_identification_4} shows the overall \acfi{SR} as a function of the detection delay.
\begin{figure}[htbp]
\includegraphics[width=.8\columnwidth]{figures/detection_delay_mov_identification_SR.pdf}
\centering
\caption{Overall \ac{SR} of the Random Forest classifier as a function of the detection delay.}
\label{fig:mov_identification_4}
\end{figure}
It is worth noting that a total number of just 220 samples, i.e., approximately 1.5 seconds, are necessary for the Random Forest classifier to guarantee a value of the SR $> 0.95$ in the discrimination of any movement performed by the drone. Thus, it is enough to either push or pull the stick of the remote controller for a time frame longer than 1.5 seconds to allow \emph{PiNcH}\ to discriminate the specific movement performed by the drone.
\section{Assessing the Robustness of \emph{PiNcH}}
\label{sec:robustness}
In this section we discuss the robustness of the proposed detection strategy against packet loss and evasion strategies, being these the dominant factor that could affect the effective deployment of \emph{PiNcH}.
{\bf Drone Detection and Packet Loss}. In Section \ref{sec:detecting_a_drone} we showed the remarkable performance of \emph{PiNcH}\ in detecting the presence of a drone in several scenarios, being them indoor or outdoor.
Since our detection scheme is (partially) based on the interarrival time between packets, and such a feature is the most dominant, packet loss phenomena can have an impact on the detection performance, especially at long distances. In fact, the intuition suggests that when the drone-RC communication link becomes long enough, packets can be lost, leading to larger interarrival times and decreased detection rates.
To provide further insights on this phenomenon, we investigated the detection rate of \emph{PiNcH}\ in outdoor scenarios, by placing the RC-drone communication link at increasing distances from the location of the eavesdropping equipment. Figure \ref{fig:map} shows the deployment of our tests, where \textit{E} is the location of the WiFi probe, while the locations \textit{$S_1$, $S_2$, $S_3$, $S_4$, $S_5$, $S_6$,} and \textit{$S_7$} refer to the tested locations of the RC-drone communication link (i.e, distances of 30, 50, 70, 95, 115, 170, and 200 meters from the drone, respectively).
\begin{figure}[htbp]
\includegraphics[width=\columnwidth]{figures/map.jpg}
\centering
\caption{Map of the location where outdoor experiments have been performed (taken from Google Earth).}
\label{fig:map}
\end{figure}
We notice that the location is full of obstacles, providing realistic shadowing effects affecting outdoor application scenarios.
We first trained \emph{PiNcH}\ on the profile of the traffic acquired at a distance equal to $0.2$ m, and then we tested it on the acquisitions at the various distances, by considering the whole traffic acquired on the communication link mixed with the various traces discussed in Sec. \ref{sec:detecting_a_drone}. Average results are summarized in Tab. \ref{tab:p_loss}.
\begin{table*}[htbp]
\caption{Packet Loss and Detection Rate at increasing distances from the position of the eavesdropping equipment.}
\centering
\label{tab:p_loss}
\begin{tabular}{|P{1.7cm}|P{1.7cm}|P{1.7cm}|P{1.9cm}|}
\hline
{\bf Location } & {\bf Distance [m]} & {\bf Packet Loss [\%]} & {\bf Detection Rate [\%]} \\
\hline
$S_1$ & 30 & 0 & 99.999 \\
\hline
$S_2$ & 50 & 21.1 & 99.69 \\
\hline
$S_3$ & 70 & 33.2 & 99.23 \\
\hline
$S_4$ & 95 & 13.3 & 99.68 \\
\hline
$S_5$ & 115 & 16.7 & 99.18 \\
\hline
$S_6$ & 170 & 74.8 & 97.43\\
\hline
$S_7$ & 200 & 73.8 & 99.68\\
\hline
\end{tabular}
\end{table*}
We highlight that, despite the increasing packet loss percentage at increasing distances, \emph{PiNcH}\ is still able to identify the presence of the drone with outstanding accuracy ($\ge 97\%$), being robust to packet loss up to 74.8\%. These results suggest that the detection range could be further extended by using specialized equipment, such as directive antennas, to provide effective detection even to larger distances.
{\bf Evasion Strategies}. The previous sections highlighted the remarkable performance achieved by \emph{PiNcH}\ for identifying a drone. By resorting to the acquisition of packet size and interarrival times via general-purpose eavesdropping equipment, \emph{PiNcH}\ can identify the presence of a drone in several scenarios with outstanding accuracy, requiring just a negligible detection delay.
In this section, we assume the adversary is aware of the deployment of \emph{PiNcH}, and therefore, she implements a strategy to escape the detection, by modifying on purpose the profile of the features exploited to detect the presence of the drone.
For instance, being aware that the interarrival time is the most important feature of our drone detection solution, the attacker can delay the delivery time of the packets, in order for the eavesdropping equipment to record a profile of interarrival times that is different from the expected one, possibly leading to incorrect classification.
We emulated the evasion attack performed by the attacker, by summing random delays extracted from a uniform distribution $[0, \Delta]$ to the interarrival times, with $\Delta$ being arbitrarily large, up to $0.1$ s. By focusing on the six scenarios tackled in Section \ref{sec:detecting_a_drone} and assuming a window size of 21 samples, Figure \ref{fig:evasion} shows the \ac{FNR}, i.e., the number of samples incorrectly classified as ``no-drone'', although being from the drone communication channel, while increasing the maximum delay $\Delta$.
\begin{figure}[htbp]
\includegraphics[width=.79\columnwidth]{figures/drone_yes_no_evasion.pdf}
\centering
\caption{\acl{FNR} as a function of the maximum delay $\Delta$ in the communication pattern.}
\label{fig:evasion}
\end{figure}
We observe that the effectiveness of the evasion attack strictly depends on the particular scenario, i.e., on the features of the surrounding encrypted traffic.
With reference to the scenarios $S5$ and $S4$, we notice that the attacker could delay the delivery of the packets (either on the RC or on the drone) of a maximum value of $20$ ms to effectively escape the detection ($FNR \geq 0.8$ when the maximum injected delay is up to 0.2 seconds). This finding is due to the ``distance'' between the distribution of the traffic of the RC-drone communication link and the distribution of the surrounding traffic, which are close to each other.
Regarding the scenarios $S2$ and $S3$, a greater value of the maximum delay is necessary to effectively avoid the detection. Specifically, we notice that the attacker has to delay packets with a maximum delay of $60$ ms to cause the incorrect classification of about $25\%$ of the samples, while larger values of the FNR are obtained with a maximum delay of 80 ms, where FNR reaches values of about 70\%.
At the same time, evasion attacks seem not to be effective in the case of the scenario $S1$, where delaying the packets of 0.1 s lead to FNR values less than $15\%$.
Finally, in scenario $S6$, FNR reaches the value of 53\% for a maximum delay of 20 ms, and then, it remains almost constant for increasing delays. In this case, the profile of the ``modified'' traffic is equally different from the two known distributions, leading to an almost random decision.
Overall, the results reported above should be assessed also considering the maneuverability, latency, and response time of the drone itself. While very short delays of the packets do not affect the communication link and the drone maneuverability, large values (e.g., 100 ms) reduce the response time and the capability of controlling the drone, especially when it is moving at high speeds and characterized by a heavy weight (high inertia)--- this is common for drones carrying payloads. Note also that the on purpose introduced delay values sum up to the intrinsic delay of the RC-drone communication link, and therefore, further increase the overall latency of the communication link. Available reports on the subject indicate that military drones can tolerate up to a maximum latency of 1 ms, while for commercial drones values of delays exceeding 60-70 ms significantly affect the maneuverability of the drone and have an impact on the human perception of the performance \cite{TNOReport}.
Thus, depending on the specific scenario and the setup of the RC-drone communication link, the application of evasion strategies should be carefully evaluated by the attacker, trading off between the evasion of the detection and its effective capability of controlling the device, in particular at long distances.
We highlight that, despite the strategy discussed above is not the only one that can be used by the adversary to escape the detection, other strategies (such as the setup of a persistent active connection between the drone and the RC) would not guarantee any result and, in addition, they would quickly drain the battery of the drone, further reducing its operational time.
Finally, we point out that, despite the possible advantages that the adversary could gain in carefully implementing tailored evasion techniques, at this time there are no products actually implementing advanced evasion strategies.
\section{\textcolor{black}{Theoretical and Experimental Comparison}}
\label{sec:comparison}
\textcolor{black}{In this section we compare \emph{PiNcH}\ against the solutions available in the literature at the time of this writing. Section~\ref{sec:theor_comp} provides a thorough comparison based on several system requirements, while Section~\ref{sec:perf_comp} provides an experimental comparison on real data.}
\subsection{Theoretical Comparison}
\label{sec:theor_comp}
Table \ref{tab:related} provides a comparison between our proposed approach and the closest related work in the literature, based on several system requirements.
\begin{table}[htbp]
\rotatebox{90}{
\begin{tabular}{|P{1.1cm}|P{1.3cm}|P{1.4cm}|P{1.4cm}|P{1.7cm}|P{1.7cm}|P{1.6cm}|P{1.8cm}|P{1.8cm}|P{1.8cm}|}
\hline
{\bf Ref.} & {\bf Det. Type} & {\bf Drone OS Type} & {\bf Results Replicability} & {\bf Drone Det. in Various Scenarios } & {\bf Status Identification} & {\bf Mov. Identification} & {\bf Det. Delay Awareness} & {\bf Packet Loss / Distance Robustness} & {\bf Study of Evasion Attacks} \\
\hline
\cite{Nguyen2017} & RF-based & Closed & Single Brands & \cmark & \xmark & \xmark & \xmark & \cmark & \xmark \\
\hline
\cite{fu} & RF-based & Closed & Single Brand & \xmark & \xmark & \xmark & \xmark & \xmark & \xmark \\
\hline
\cite{bisio} & Traffic Analysis & Closed & Single Brand & \xmark & \xmark & \xmark & \xmark & \xmark & \xmark \\
\hline
\cite{Bisio2018_TVT} & Traffic Analysis & Closed & Single Brand & \xmark & \xmark & \xmark & \cmark & \xmark & \xmark \\
\hline
\cite{Alipour2019} & Traffic Analysis & Closed & Single Brands & \xmark & \xmark & \xmark & \cmark & \xmark & \xmark \\
\hline
\cite{alipour2019_journal} & Traffic Analysis & Closed & Single Brands & \xmark & \xmark & \cmark & \cmark & \xmark & \xmark \\
\hline
\emph{PiNcH}\ & Traffic Analysis & Open Source & Over 30 Brands & \cmark & \cmark & \cmark & \cmark & \cmark & \cmark \\
\hline
\end{tabular}
}
\caption{Comparison of \emph{PiNcH}\ with related work on passive drone detection.}
\centering
\label{tab:related}
\end{table}
On the one hand, RF-based approaches such as \cite{Nguyen2017} and \cite{fu} only accomplished the detection of a single brand of drone, whose firmware is based on a closed operating system. Thus, their results are not directly applicable to other brands. Moreover, as anticipated in Section \ref{sec:related}, these approaches usually have to rely on specific hardware, such as \acl{SDR}.
On the other hand, competing approaches based on encrypted traffic analysis are still based on closed source firmware and operating systems. In addition, none of the previous work evaluated the effectiveness of the drone detection scheme in various scenarios with real traces. Moreover, we are the first ones to prove the robustness of the detection scheme when confronting with packet loss, showing the practical applicability of encrypted traffic analysis toward the protection of critical infrastructures.
Furthermore, differently from competing approaches, in this paper, we provide an estimation of the detection performance of our methodology in the presence of evasion attacks, i.e., smart strategies where the attacker modifies the profile of the interarrival times of the packets on purpose to avoid detection. On the one hand, the effectiveness of such techniques strongly depends on the specific scenario, while on the other hand, their application could significantly decrease the response time and the maneuverability of the drone.
Finally, we remark that the source data adopted by this work have been released as open-source at the link \cite{dataset}, to allow practitioners, industries, and academia to verify our claims and use them as a basis for further development.
\textcolor{black}{
\subsection{Experimental Performance Comparison}
\label{sec:perf_comp}
To provide further insights, in this section we compare the performance of \emph{PiNcH}\ against the one of the most closed peer-reviewed scientific contribution at the time of this writing, that is the scheme proposed by the authors in~\cite{Alipour2019}.\\
The contribution in~\cite{Alipour2019} discusses a framework for the detection and brand identification of commercial drones based on Machine Learning, by using the same basic features adopted in our work, that are the packet size and packets interarrival times. However, despite \emph{PiNcH}, the work in~\cite{Alipour2019} selects the one-vs-all logistic multi-class classification algorithm as the tool to discriminate drone traffic from the generic one. Unfortunately, the authors did make neither the raw data nor the code publicly available for any direct comparison. Therefore, following the discussion in the reference paper, we replicated the implementation of the method they proposed and we tested its performance. Specifically, we compared the overall Success Rate (SR) of \emph{PiNcH}\ and the proposal in~\cite{Alipour2019} as for the drone detection performance in several real-life scenarios, matching the ones used in our analysis reported in Section~\ref{sec:detecting_a_drone}. \\
We investigated the performance of the approaches by increasing the number of samples used for the computation of the mean and standard deviation of the features, from 51 to 101 samples. We recall that, as depicted in Figure 7 of the manuscript, such a number of samples is directly connected to the detection delay, from a minimum value of $0.334$~s to the maximum value of $0.661$~s. The results are reported in Fig.~\ref{fig:comparison}.\\
\begin{figure}[htbp]
\includegraphics[width=.9\columnwidth]{figures/isDrone_comparison.jpg}
\centering
\caption{Overall Success Rate (SR) in detecting the presence of a drone for the 6 different scenarios investigated in our paper, using \emph{PiNcH}\ and the proposal by Alipour et al. in~\cite{Alipour2019}, by increasing the number of samples used for the computation of the features.}
\label{fig:comparison}
\end{figure}
The results show that the performance and the overall success rate of the approach proposed by the authors in~\cite{Alipour2019} depends strictly on the selected scenario. While in the political meeting (S5) and local outdoor (S6) scenarios the performance of the benchmarking technique are similar to the ones of \emph{PiNcH}\ (with detection rates that are in accordance to the ones reported in the reference paper), in the remaining four scenarios, the overall success rate is significantly lower than our technique. In addition, increasing the number of samples used for the computation of the statistical indexes of the features, i.e., increasing the detection delay, not always leads to a significant improvement.\\
Considering the same requirements on the detection delay, \emph{PiNcH}\ is characterized by remarkable performance in the detection of a drone in all the 6 analyzed scenarios,
and its performance always improve when increasing the detection delay. \\
Finally, despite the better performance with shorter detection delays of our proposed approach against the competing solutions, we stress that the major contributions of our work are the following: (i) we demonstrate that network traffic analysis can be considered as a valuable and meaningful tool to detect Remotely Piloted Aircraft Systems (RPAS); (ii) we experimentally show that network traffic analysis is a robust solution against packet losses and adversarial strategies; and, finally, that (iii) such technique could detect the presence of a drone, its current status, and its movements in a short time frame; all these features being seamlessly integrable with both commercial devices and additional drone detection solutions.
}
\section{Conclusions and Future Work}
\label{sec:conclusions}
In this paper, we have introduced \emph{PiNcH}: a methodology to detect the presence of a remotely-controlled drone in several heterogeneous environments with a high degree of assurance and a very short delay. \emph{PiNcH}\ is also capable of identifying the drone's movements. These results are achieved without resorting to any active techniques, but just eavesdropping the radio traffic.
In particular, we proved that network traffic classification can be effectively used to detect and identify the 3DR SOLO---the most popular open-source drone---as well as all the \acp{UAV} employing the popular operating system ArduCopter (such as some DJI and Hobbyking vehicles). Indeed, we provide an upper bound on the detection delay when using the aforementioned methodology.
We tested our methodology against six different scenarios and we proved that \emph{PiNcH}\ can detect an RPAS drone in less than 0.28 seconds with a \ac{SR} of about 0.998 (worst case). Further, \emph{PiNcH}\ can be effectively used to identify each of the drone's movements in about 1.5 seconds, with a \ac{SR} greater than 0.95.
The comparison against the competing solution in the literature does show that \emph{PiNcH}\ enjoys superior performance in several scenarios.
We also evaluated the effectiveness of \emph{PiNcH}\ in an outdoor scenario, showing that our methodology is still quite robust also when more than 70 \% of the packets are lost. Finally, we also evaluated the robustness of \emph{PiNcH}\ to evasion attacks, where the profile of the traffic of the drone is modified on purpose to avoid detection. In this scenario, we showed that the effectiveness of such strategy is strongly dependent on the specific scenario, and likely not of general applicability, since evasion techniques could severely degrade the controller-drone channel, and hence its maneuverability.
Given that our study has been performed on a popular open-source operating system for drones---and all the collected data have been publicly released---, it can be also used to detect and identify different brands and models of drones, other than applying to other contexts as well.
\section*{Acknowledgements}
The authors would like to thank the anonymous reviewers for their comments and insights, that have helped improving the quality of the paper.
This publication was partially supported by awards NPRP-S-11-0109-180242, UREP23-065-1-014, NPRP X-063-1-014, and GSRA6-1-0528-19046, from the QNRF-Qatar National Research Fund, a member of The Qatar Foundation. The information and views set out in this publication are those of the authors and do not necessarily reflect the official opinion of the QNRF.
\section*{References}
\balance
\bibliographystyle{IEEEtran}
| {'timestamp': '2019-12-10T02:08:04', 'yymm': '1901', 'arxiv_id': '1901.03535', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03535'} | arxiv |
\section{Introduction}
Future networks must provide higher channel capacity, lower latency, and better quality of service than contemporary networks \cite{Andrews2014b}. These goals can only be achieved by drastic improvements of the wireless network architecture \cite{Wang2014}. Among potential candidates, Massive MIMO (multiple-input multiple-output) is an emerging physical layer technology which allows a base station (BS) equipped with many antennas to serve tens of users on the same time and frequency resource \cite{Marzetta2010a}. Utilizing the same spectrum and power budget, Massive MIMO can increase both spectral and energy efficiency by orders of magnitude compared with contemporary systems. This is because the propagation channels of different users decorrelate when increasing the number of antennas at each BS and strong array gains are achievable with little inter-user interference.
Resource allocation is important in Massive MIMO networks to deal with the inter-user interference and, particularly, so-called pilot contamination \cite{Jose2011b, al2018successive}. Many resource allocation problems in Massive MIMO are easier to solve than in conventional systems since the channel hardening makes the utility functions only depend on the large-scale fading coefficients which are stable over a long time period \cite{Bjornson2016b}, while adaptation to the quickly varying small-scale fading is conventionally needed.
Table~\ref{tableOptimizationProblems} categorizes the existing works on power control for cellular Massive MIMO in terms of utility functions and optimization variables. There are only a few works that jointly optimize the pilot and data powers, which is of key importance to deal with pilot contamination in multi-cell systems. In this paper, we optimize the sum SE with respect to the pilot and data powers. To the best of our knowledge, it is the first paper that considers this problem in
cellular Massive MIMO systems, where each BS serves a varying number of users.
Note that we did not include single-cell papers in Table~\ref{tableOptimizationProblems}. For example,
the paper \cite{Victor2017a} exploits the special structure arising from imperfect channel state information (CSI) in single-cell systems to maximize the sum SE using an efficient algorithm. This finds the globally optimal pilot and data powers, but it does not extend to multi-cell systems since the structure is entirely different.
Deep learning \cite{Goodfellow-et-al-2016} is a popular data-driven approach to solve complicated problems and has shown superior performance in various applications in image restoration, pattern recognition, etc. Despite its complicated and rather heuristic training phase, deep learning has recently shown promising results in communication applications \cite{o2017introduction, liang2018towards}. From the universal approximation theorem \cite{hornik1989}, deep learning can learn to approximate functions for which we have no closed-form expression. In particular, it can be used to approximate the solution to resource allocation problems and achieve greatly reduced computational complexity. The authors in \cite{sun2018learning} construct a fully-connected deep neural network to allocate transmit power in an effort to maximize the sum SE in a wireless system serving a few tens of users. The same network structure is reused in \cite{zappone2018model} to solve an energy-efficiency problem. Standard fully-connected feed-forward networks with many layers are used, but since the considered problems are challenging, the prediction performance is substantially lower than when directly solving the optimization problems, e.g., the loss varies from $5\%$ to $16\%$ depending on the system setting. By using the methodology of ensemble learning to select the best prediction results among multiple fully connected feed-forward neural networks, \cite{liang2018towards} is able to achieve better performance than when solving a sum SE optimization problem to a stationary point. The paper considers a multi-user single-input single-output system in which each BS serves a single user and has perfect channel state information (CSI). Moreover, previous neural network designs for resource allocation in wireless communications are utilizing the instantaneous CSI which is practically questionable, especially in cellular Massive MIMO systems. This is because the small-scale fading varies very quickly and the deep neural networks have very limited time to process the collection of all the instantaneous channel vectors, each having a number of parameters proportional to the number of BS antennas. The recent work in \cite{Luca2018DL} designs a neural network utilizing only statistical channel information to predict transmit powers in an equally-loaded cellular Massive MIMO system with spatially correlated fading. Although the prediction performance is good, the paper does not discuss how to generalize the approach to having varying number of users per cell.
\begin{table*}[t]
\caption{Previous works on power control for cellular Massive MIMO}
\centerline{
\begin{tabular}{|c|c|c|}
\hline
\diagbox[width=11.5em]{Utility function }{Variables} & Data Powers Only & Joint Pilot \& Data \\
\hline
Minimum transmit power & \cite{senel2019joint, massivemimobook, Chien2016b} & \cite{Guo2014a} \\
\hline
Max-min fairness & \cite{Marzetta2016a, adhikary2017uplink, Chien2016b, massivemimobook, Luca2018DL} & \cite{Chien2017b,Ghazanfari2019, van2018joint} \\
\hline
Maximum product SINR & \cite{massivemimobook, Luca2018DL} & \cite{dao2018disjoint} \\
\hline
Maximum sum SE & \cite{Chien2019ICCa, tran2016network, li2017massive, Chien2018a} & \textbf{This paper}\\
\hline
\end{tabular}
} \vspace*{-0.2cm}
\label{tableOptimizationProblems}
\end{table*}
The main issue with the previous deep learning solutions is that many different neural networks, with varying number of inputs and outputs, need to be trained and used depending on the number of active users. For example, if there are $L$ cells and between $0$ and $K_{\max}$ users per cell, then \cite{Luca2018DL} would require $L2^{K_{\max}}$ different neural networks to cover all the cases that can appear. Even in the small setup of $L=4$ and $K_{\max}=5$ considered in \cite{Luca2018DL}, this requires $128$ different neural networks. We propose a solution to this problem by designing a single neural network that can handle a varying number of users; more precisely, we exploit the structure of the considered power control problem to train a neural network to simultaneously approximate $2^{K_{\max}}$ different power control functions, having varying number users (i.e., inputs/outputs).
In this paper, we consider the joint optimization of the pilot and data powers for maximum sum SE in multi-cell Massive MIMO systems.
Our main contributions are:
\begin{itemize}
\item We formulate a sum ergodic SE maximization problem, with the data and pilot powers as variables, where each cell may have a different number of active users. To overcome the inherent non-convexity, an equivalent problem with element-wise convex structure is derived. An alternating optimization algorithm is proposed to find a stationary point. Each iteration is solved in closed form.
\item To reduce the computational complexity, design a deep convolutional neural network (CNN) that learns the solution to the alternating optimization algorithm, from one or multiple starting points. Our deep CNN is named PowerNet, has a residual structure, and is densely connected. PowerNet is designed for a maximum number of users and can manage any number of active users up to the maximum. The inputs to PowerNet are the large-scale fading coefficients between each active user and BS, while the outputs are the pilot and data powers. Zeros are used for inactive users. Note that the number of inputs/outputs is independent of the number of antennas.
\item Numerical results manifest the effectiveness of the proposed alternating optimization algorithm as compared to the baseline of full transmit power. Meanwhile, PowerNet achieves highly accurate power prediction and a sub-milliseconds runtime.
\end{itemize}
The remainder of this paper is organized as follows: Section~\ref{Section: System Model} introduces our cellular Massive MIMO system model, with a varying number of users per cell, and the basic ergodic SE analysis. We formulate and solve the joint pilot and data power control problem for maximum sum SE in Section~\ref{Section:JointPilotDataforSumSE}. The proposed low complexity deep learning solution is given in Section~\ref{Section:CNN}. Finally, numerical results are shown in Section~\ref{Section:NumericalResults} and we provide the main conclusions in Section~\ref{Section:Conclusion}.
\textit{Notation}: Upper (lower) bold letters are used to denote matrices (vectors). $\mathbb{E} \{ \cdot \}$ is the expectation of a random variable. $(\cdot)^H$ is the Hermitian transpose and the cardinality of set $\mathcal{A}$ is $| \mathcal{A}|$. We let $\mathbf{I}_M$ denote the $M \times M$ identity matrix. $\mathbb{C}, \mathbb{R},$ and $\mathbb{R}_{+}$ denote the complex, real and non-negative real field, respectively. The floor operator denotes as $\left \lfloor \cdot \right \rfloor$ and the Frobenius norm as $\| . \|_F$. Finally, $\mathcal{CN}(\cdot, \cdot)$ is circularly symmetric complex Gaussian distribution.
\section{Dynamic Massive MIMO System Model} \label{Section: System Model}
We consider a multi-cell Massive MIMO system comprising of $L$ cells, each having a BS equipped with $M$ antennas. We call it a dynamic system model since each BS is able to serve $K_{\max}$ users, but maybe only a subset of the users are active at any given point in time. We will later model the active subset of users randomly and exploit this structure when training a neural network. Since the wireless channels vary over time and frequency, we consider the standard block fading model \cite{Marzetta2016a} where the time-frequency resources are divided into coherence intervals of $\tau_c$ modulation symbols for which the channels are static and frequency flat. At an arbitrary given coherence interval, BS~$l$ is serving a subset of active users. We define the set $\mathcal{A}_l $ containing the indices of all active users in cell~$l$, for which $0 \leq | \mathcal{A}_l | \leq K_{\max}$. The channel between active user~$t \in \mathcal{A}_i$ in cell~$i$ and BS~$l$ is denoted as $\mathbf{h}_{i,t}^l \in \mathbb{C}^{M}$ and follows an independent and identically distributed (i.i.d.) Rayleigh fading distribution:
\begin{equation}
\mathbf{h}_{i,t}^l \sim \mathcal{CN} \left(\mathbf{0}, \beta_{i,t}^l \mathbf{I}_{M} \right),
\end{equation}
where $\beta_{i,t}^l\geq0$ is the large-scale fading coefficient that models geometric pathloss and shadow fading. In this paper, we consider uncorrelated Rayleigh fading because the spectral efficiency obtained with this tractable model well matches the results obtained in non-line-of-sight measurement \cite{Gao2015a}. However, the data-driven part presented later in this paper can applied together with any other channel model. The distributions are known at the BSs, but the realizations are unknown and need to be estimated in every coherence interval using a pilot transmission phase.
\subsection{Uplink Pilot Transmission Phase}
We assume that a set of $K_{\max}$ orthonormal pilot signals are used in the system.
User~$k$ in each cell is preassigned the pilot $\pmb{\psi}_{k} \in \mathbb{C}^{K_{\max}}$ with $\|\pmb{\psi}_{k} \|^2 = K_{\max}$, no matter if the user is active or not in the given coherence interval, but this pilot is only transmitted when the user has data to transmit (or receive). This pilot assignment guarantees that there is no intra-cell pilot contamination. The channel estimation of a user is interfered by the other users that use the pilot signal, which is called pilot contamination. The received baseband pilot signal $\mathbf{Y}_l \in \mathbb{C}^{M \times K_{\max} }$ at BS~$l$ is
\begin{equation}
\mathbf{Y}_l = \sum_{i=1 }^L \sum_{t \in \mathcal{A}_i } \sqrt{\hat{p}_{i,t}}\mathbf{h}_{i,t}^l \pmb{\psi}_{t}^H + \mathbf{N}_l,
\end{equation}
where $\mathbf{N}_l \in \mathbb{C}^{M \times K }$ is the additive noise with i.i.d.~$\mathcal{CN}(0, \sigma_{\mathrm{UL}}^2)$ elements. Meanwhile, $\hat{p}_{i,t}$ is the pilot power that active user~$t$ in cell~$i$ allocates to its pilot transmission. The channel between a particular user~$t \in \mathcal{A}_i$ in cell~$i$ and BS~$l$ is estimated from
\begin{equation}
\mathbf{y}_{i,t} = \mathbf{Y}_l \pmb{\psi}_{t} = \sum_{i' \in \mathcal{P}_t } \sqrt{\hat{p}_{i',t}} \mathbf{h}_{i',t}^l \pmb{\psi}_{t}^H \pmb{\psi}_{t}+ \mathbf{N}_l \pmb{\psi}_{t},
\end{equation}
where the set $\mathcal{P}_t$ contains the indices of cells having user~$t$ in active mode, which is formulated from the user activity set of each cell as
\begin{equation}
\mathcal{P}_t = \left\{ i' \in \{1, \ldots,L \}: t \in \mathcal{A}_{i'} \right\}.
\end{equation}
By using minimum mean square error (MMSE) estimation~\cite{Kay1993a}, the channel estimate of an arbitrary active user is as follows.
\begin{lemma}\label{Lemma:DynamicChannelEst}
If BS~$l$ uses MMSE estimation, the channel estimate of active user~$t$ in cell~$i$ is
\begin{equation}
\hat{\mathbf{h}}_{i,t}^l = \mathbb{E} \left\{ \mathbf{h}_{i,t}^l | \mathbf{y}_{i,t} \right\} = \frac{\beta_{i,t}^l \sqrt{\hat{p}_{i,t}} }{K_{\max} \sum_{i' \in \mathcal{P}_t } \hat{p}_{i',t} \beta_{i',t}^l + \sigma_{\mathrm{UL}}^2 } \mathbf{y}_{i,t},
\end{equation}
which follows a complex Gaussian distribution as
\begin{equation} \label{eq:ChannelEstDynamicMRC}
\begin{split}
\hat{\mathbf{h}}_{i,t}^l &\sim \mathcal{CN} \left(\mathbf{0}, \frac{K_{\max} (\beta_{i,t}^l)^2 \hat{p}_{i,t} }{K_{\max} \sum_{i' \in \mathcal{P}_t } \hat{p}_{i',t} \beta_{i',t}^l + \sigma_{\mathrm{UL}}^2 } \mathbf{I}_{M} \right).
\end{split}
\end{equation}
The estimation error $\mathbf{e}_{i,t}^l = \mathbf{h}_{i,t}^l - \hat{\mathbf{h}}_{i,t}^l$ is independently distributed as
\begin{equation} \label{eq:estimationerror}
\mathbf{e}_{i,t}^l \sim \mathcal{CN} \left(\mathbf{0}, \frac{K_{\max} \sum_{i' \in \mathcal{P}_t \setminus \{ i\} } \hat{p}_{i',t} \beta_{i,t}^l \beta_{i',t}^l + \beta_{i,t}^l \sigma_{\mathrm{UL}}^2 }{K_{\max} \sum_{i' \in \mathcal{P}_t } \hat{p}_{i',t} \beta_{i',t}^l + \sigma_{\mathrm{UL}}^2 } \mathbf{I}_M \right).
\end{equation}
\end{lemma}
\begin{proof}
The proof follows directly from standard MMSE estimation techniques \cite{Kay1993a, massivemimobook}.
\end{proof}
The statistical information in Lemma~\ref{Lemma:DynamicChannelEst} of each channel estimate and estimation error are used to construct the linear combining vectors and to derive a closed-form expression of the uplink~SE.
\vspace*{-0.25cm}
\subsection{Uplink Data Transmission Phase}
During the uplink data transmission phase, every active user~$t \in \mathcal{A}_i$ in cell~$i$ transmits a data symbol $s_{i,t}$ with $\mathbb{E} \{ |s_{i,t}|^2\} =1$. The received signal $\mathbf{y}_{l} \in \mathbb{C}^{M}$ at BS~$l$ is the superposition of signals from all users across cells:
\begin{equation} \label{eq:ReceivedData}
\mathbf{y}_{l} = \sum_{i=1}^L \sum_{t \in \mathcal{A}_i } \sqrt{p_{i,t}} \mathbf{h}_{i,t}^l s_{i,t} + \mathbf{n}_{l},
\end{equation}
where $p_{i,t}$ is the power that active user $t$ in cell $i$ allocates to the data symbol $s_{i,t}$ and $\mathbf{n}_{l} \in \mathbb{C}^{M}$ is complex Gaussian noise distributed as $\mathcal{CN} \left(\mathbf{0}, \sigma_{\mathrm{UL}}^2 \mathbf{I}_{M} \right)$. Each BS uses maximum ratio combining (MRC) to
detect the desired signals from its users. In particular, BS~$l$ selects the combining vector for its user~$k$ as
$\mathbf{v}_{l,k} = \hat{\mathbf{h}}_{l,k}^l,$
and we will quantify the achievable spectral efficiency by using the use-and-then-forget capacity bounding technique \cite{Marzetta2016a}. The closed-form expression of the lower bound on the uplink capacity is shown in Lemma~\ref{LemmaMRC}.
\begin{lemma} \label{LemmaMRC}
If each BS uses MRC for data detection, a closed-form expression for the uplink ergodic SE of active user~$k$ in cell~$l$ is
\begin{equation} \label{eq:ULRateDynamicMRC}
R_{l,k} \left( \{ \hat{p}_{i,t},p_{i,t} \}\right) = \left(1 - \frac{K_{\max}}{\tau_c} \right) \log_2 \left( 1 + \mathrm{SINR}_{l,k} \right),
\end{equation}
where the effective SINR value of this user is
\begin{equation} \label{eq:DynamicSINRlk}
\mathrm{SINR}_{l,k} = M K_{\max} p_{l,k} \hat{p}_{l,k} (\beta_{l,k}^l)^2 / \mathit{D}_{l,k}
\end{equation}
and
\begin{equation} \label{eq:Denominatorlk}
\begin{split}
&\mathit{D}_{l,k} = M K_{\max} \sum\limits_{i \in \mathcal{P}_k \setminus \{l\}} p_{i,k} \hat{p}_{i,k} (\beta_{i,k}^l)^2 + \\
& \left( K_{\max} \sum\limits_{i \in \mathcal{P}_k } \hat{p}_{i,k} \beta_{i,k}^l + \sigma_{\mathrm{UL}}^2 \right)\left( \sum\limits_{i=1}^L \sum\limits_{t \in \mathcal{A}_i } p_{i,t} \beta_{i,t}^l + \sigma_{\mathrm{UL}}^2 \right).
\end{split}
\end{equation}
\end{lemma}
\begin{proof}
The proof follows along the lines of Corollary~$4.5$ in \cite{massivemimobook} except for the different notation and the fact that each user can assign a different power to its pilot and data.
\end{proof}
The numerator of the SINR expression in \eqref{eq:DynamicSINRlk} indicates contributions of the array gain which is directly proportional to the number of antennas at the serving BS. The first part in the denominator represents the pilot contamination effect and it is also proportional to the number of BS antennas. Interestingly, active user~$k$ in cell~$l$ will have unbounded capacity when $M \rightarrow \infty$ if all users using the same pilot sequence $\pmb{\psi}_k$ are silent (i.e., inactive or allocated zero transmit power), \textcolor{red}{thanks to the massive antenna array gain while inter-cell mutual interference and noise are negligible}. We notice that the remaining terms are non-coherent mutual interference and noise that can have a vanishing impact when the number of antennas grow. Furthermore, the SE of a user is proportional to $(1 - K_{\max}/\tau_c)$, which is the pre-log factor in \eqref{eq:ULRateDynamicMRC}. This is the fraction of symbols per coherence interval that are used for data transmission, which thus reduces when the number of pilots is increased. In the special case of $ |\mathcal{A}_1 | = \ldots = |\mathcal{A}_L |$, the analytical results in Lemma~\ref{LemmaMRC} particularize to equally-loaded systems as in the previous works. That special case is unlikely to occur in practice since the data traffic is generated independently for each user.
\section{Joint Pilot and Data Power Control for Sum Spectral Efficiency Optimization} \label{Section:JointPilotDataforSumSE}
The main goal of this paper is to solve the sum SE maximization problem. Achieving high SE is important for future networks, and the (weighted) sum SE maximization is also the core problem to be solved in practical algorithms for dynamic resource allocation \cite{Georgiadis2006a}. The previous works \cite{Victor2017a,Chien2018a} consider this problem for single-cell systems with joint pilot and data power control or multi-cell systems with only data power control, respectively. In contrast, we formulate and solve a sum SE maximization problem with joint pilot and data power control. This optimization problem has not been tackled before in the Massive MIMO literature due to its inherent non-convexity structure. In this section, we develop an iterative algorithm that achieves a stationary point in polynomial time by solving a series of convex sub-problems in closed form.
\subsection{Problem Formulation}
The considered optimization problem is to maximize the sum SE of all active users under power constraints on each transmitted symbol:
\begin{equation} \label{Prob:SumRate}
\begin{aligned}
& \underset{\{ \hat{p}_{l,k}, p_{l,k} \} }{\textrm{maximize}}
&& \sum_{l=1}^{L} \sum_{ k \in \mathcal{A}_l } R_{l,k} \left( \{ \hat{p}_{i,t},p_{i,t} \}\right) \\
& \textrm{subject to}
&& 0 \leq \hat{p}_{l,k} \leq P_{l,k}, \; \forall l,k,\\
&&& 0 \leq p_{l,k} \leq P_{l,k}, \; \forall l,k,
\end{aligned}
\end{equation}
where $P_{l,k} \geq 0$ is the maximum power that user~$k$ in cell~$l$ can supply to each transmitted symbol. Problem~\eqref{Prob:SumRate} is independent of the small-scale fading, so it allows for long-term performance optimization, if the users are continuously active and there is no large-scale user mobility. However, in practical systems, some users are moving quickly
and new scheduling decisions are made every few milliseconds based on the users' traffic. It is therefore important to be able to solve \eqref{Prob:SumRate} very quickly to adapt to these changes.\footnote{Note that the ergodic SE is a reasonable performance metric also in this scenario, since long codewords can span over the frequency domain and the channel hardening makes the channel after MRC almost deterministic. The simulations in \cite{Bjornson2016b} shows that coding over 1\,kB of data is sufficient to operate closely to the ergodic SE.} The sum SE optimization problem is non-convex in general and seeking the optimal solution has very high complexity in any non-trivial setup \cite{Al-Shatri2012a}. However, the pilot and data power constraints in \eqref{Prob:SumRate} guarantee a convex feasible set and make all ergodic SE expressions continuous functions of the power variables. According to Weierstrass’ theorem \cite{Horn2013a}, an optimal solution set of pilot and data powers always exist. The global optimum to problem~\eqref{Prob:SumRate} can be obtained by using the branch-and-bound approach, similar to \cite{joshi2011weighted} for conventional multiple-input single-output channels. However, the complexity of that approach grows exponentially with the number of users, thus, even if off-line optimization is considered, it can only be utilized in small-scale networks with a few users. Moreover, in the settings where it can be utilized, the stationary points obtained by the weighted MMSE methodology was shown in \cite{joshi2011weighted, Christensen2008a} to be close to the global optimum.
Inspired by the weighted MMSE methodology \cite{joshi2011weighted, Christensen2008a}, we will now propose an iterative algorithm to find a stationary point to \eqref{Prob:SumRate}. By removing the pre-log factor and setting $\hat{\rho}_{l,k} = \sqrt{\hat{p}_{l,k} }$ and $\rho_{l,k} = \sqrt{p_{l,k} }$, $\forall l,k,$ as the new optimization variables, we formulate a new problem that is equivalent with \eqref{Prob:SumRate}.
\begin{theorem} \label{Theorem:WMMSEMRC}
The following optimization problem is equivalent to problem \eqref{Prob:SumRate}:
\begin{equation} \label{Prob:WMMSEv1}
\begin{aligned}
& \underset{\substack{ \{ w_{l,k} \geq 0, u_{l,k} \}, \\ \{ \hat{\rho}_{l,k}, \rho_{l,k} \geq 0 \} }}{\mathrm{minimize}}
&& \sum_{l=1}^{L} \sum_{k \in \mathcal{A}_l } w_{l,k} e_{l,k} - \ln (w_{l,k}) \\
& \,\,\mathrm{subject\,\,to}
&& \hat{\rho}_{l,k}^2 \leq P_{l,k}, \; \forall l,k,\\
&&& \rho_{l,k}^2 \leq P_{l,k}, \; \forall l,k,
\end{aligned}
\end{equation}
where
\begin{equation} \label{Prob:WMMSEv2}
\begin{split}
e_{l,k} =& MK_{\max} u_{l,k}^2 \sum_{i \in \mathcal{P}_k} \rho_{i,k}^2 \hat{\rho}_{i,k}^2 (\beta_{i,k}^l)^2 - 2 \sqrt{M K_{\max}} \rho_{l,k} \hat{\rho}_{l,k} \times \\
&u_{l,k} \beta_{l,k}^l + u_{l,k}^2 \left( K_{\max} \sum_{i\in \mathcal{P}_k} \hat{\rho}_{i,k}^2 \beta_{i,k}^l + \sigma_{\mathrm{UL}}^2 \right)\times \\
& \left( \sum_{i=1}^L \sum_{t \in \mathcal{A}_i } \rho_{i,t}^2 \beta_{i,t}^l + \sigma_{\mathrm{UL}}^2 \right) +1,
\end{split}
\end{equation}
in the sense that if $\{u_{l,k}^{\ast}, w_{l,k}^{\ast}, \hat{\rho}_{l,k}^{\ast}, \rho_{l,k}^{\ast} \}$ is a global optimum to problem \eqref{Prob:WMMSEv1}, then $\{ (\hat{\rho}_{l,k}^{\ast})^2, (\rho_{l,k}^{\ast})^2 \}$ is a global optimum to problem \eqref{Prob:SumRate}.
\end{theorem}
\begin{proof}
The proof consists of two main steps: the mean square error $e_{l,k}$ is first formulated by considering a single-input single-output (SISO) communication system with deterministic channels having the same SE as in Lemma~\ref{LemmaMRC}, where $u_{l,k}$ is the beamforming coefficient utilized in such a SISO system and $w_{l,k}$ is the weight value in the receiver. After that, the equivalence of two problems \eqref{Prob:SumRate} and \eqref{Prob:WMMSEv1} is obtained by finding the optimal solution of $u_{l,k}$ and $w_{l,k},\forall l,k,$ given the other optimization variables. The detailed proof is given in Appendix~\ref{Appendix:WMMSEMRC}.
\end{proof}
The new problem formulation in Theorem~\ref{Theorem:WMMSEMRC} is still non-convex, but it has an important desired property: if we consider one of the sets $\{ u_{l,k}\}$, $\{ w_{l,k}\}$, $\{ \hat{\rho}_{l,k}\}$, and $\{ \rho_{l,k} \}$ as the only optimization variables, while the other variables are constant, then problem \eqref{Prob:WMMSEv2} is convex. Note that the set of optimization variables and SE expressions are different than in the previous works \cite{Shi2011, Weeraddana2012a} that followed similar paths of reformulating their sum SE problems, which is why Theorem~\ref{Theorem:WMMSEMRC} is a main contribution of this paper. From the closed-form SE expression, both channel estimation errors and pilot contamination effects are considered. In particular, we are optimizing both pilot and data powers, which is not the case in prior work. Moreover, in our case we can get closed-form solutions in each iteration, leading to a particularly efficient implementation. We exploit this property to derive an iterative algorithm to find a local optimum (stationary point) to \eqref{Prob:WMMSEv2} as shown in the following subsection.
\subsection{Iterative Algorithm}
\begin{algorithm}[t]
\caption{Alternating optimization approach for \eqref{Prob:WMMSEv1}} \label{Algorithm:AlternatingApproach}
\textbf{Input}: Large-scale fading $\beta_{i,t}^{l}, \forall, i,t,l$; Maximum power levels $P_{l,k}, \forall l,k$; Initial values $\hat{\rho}_{l,k}^{(0)}$ and $\rho_{l,k}^{(0)}, \forall l,k$. Set up $n=0$. \\
\textbf{While} \textit{Stopping criterion \eqref{eq:Stoping} is not satisfied} \textbf{do}
\begin{itemize}
\item[1.] Set $n = n+1$.
\item[2.] Update $u_{l,k}^{(n)}$, for all $l,k,$ by using \eqref{eq:ulkDynamicMRC} where every $\tilde{u}_{l,k}^{(n-1)}$ is computed by \eqref{eq:tildeulkDynamicMRC}.
\item[3.] Update $w_{l,k}^{(n)}$, for all $l,k,$ by using \eqref{eq:wlkDynamicMRC} where every $e_{l,k}^{(n)}$ is computed by \eqref{eq:elknDynamicMRC}.
\item[4.] Update $\hat{\rho}_{l,k}^{(n)}$, for all $l,k,$ by using \eqref{eq:dynamicrhohatlk}.
\item[5.] Update $\rho_{l,k}^{(n)}$, for all $l,k,$ by using \eqref{eq:dynamicrholk}.
\item[6.] Store the currently solution: $\hat{\rho}_{l,k}^{(n)}$ and $\rho_{l,k}^{(n)}$, $\forall l,k$.
\end{itemize}
\textbf{End While} \\
\textbf{Output}: The stationary point: $\hat{\rho}_{l,k}^{\mathrm{opt}} = \rho_{l,k}^{(n)}, \rho_{l,k}^{\mathrm{opt}}= \rho_{l,k}^{(n)} \forall l,k.$
\end{algorithm}
This subsection provides an iterative algorithm to obtain a stationary point to problem \eqref{Prob:WMMSEv1} by alternating between updating the different sets of optimization variables. This procedure is established by the following theorem.
\begin{theorem} \label{Theorem:IterativeAl}
From an initial point $\{ \hat{\rho}_{l,k}^{(0)}, \rho_{l,k}^{(0)} \}$ satisfying the constraints, a stationary point to problem~\eqref{Prob:WMMSEv1} is obtained by updating $\{ u_{l,k}, w_{l,k}, \hat{\rho}_{l,k}, \rho_{l,k} \}$ in an iterative manner. At iteration~$n$, the variables
are updated as follows:
\begin{itemize}[leftmargin=*]
\item The $u_{l,k}$ variables, for all $l,k \in \mathcal{A}_l,$ are updated as
\begin{equation} \label{eq:ulkDynamicMRC}
u_{l,k}^{(n)} = \sqrt{M K_{\max}} \rho_{l,k}^{(n-1)} \hat{\rho}_{l,k}^{(n-1)} \beta_{l,k}^l / \tilde{u}_{l,k}^{(n-1)},
\end{equation}
where
\begin{equation} \label{eq:tildeulkDynamicMRC}
\begin{split}
&\tilde{u}_{l,k}^{(n-1)} = M K_{\max} \sum\limits_{i \in \mathcal{P}_k} (\rho_{i,k}^{(n-1)})^2 (\hat{\rho}_{i,k}^{(n-1)})^2 (\beta_{i,k}^l)^2 +\\
&
\left( K_{\max} \sum\limits_{i \in \mathcal{P}_k} (\hat{\rho}_{i,k}^{(n-1)})^2 \beta_{i,k}^l + \sigma_{\mathrm{UL}}^2 \right)\left( \sum\limits_{i=1}^L \sum_{t \in \mathcal{A}_i } (\rho_{i,t}^{(n-1)})^2 \beta_{i,t}^l + \sigma_{\mathrm{UL}}^2 \right).
\end{split}
\end{equation}
\item The variables $w_{l,k}$, for all $l,k \in \mathcal{A}_l,$ are updated as
\begin{equation} \label{eq:wlkDynamicMRC}
w_{l,k}^{(n)} = 1/e_{l,k}^{(n)},
\end{equation}
where
\begin{equation} \label{eq:elknDynamicMRC}
e_{l,k}^{(n)} = (u_{l,k}^{(n)})^2 \tilde{u}_{l,k}^{(n-1)} - 2 \sqrt{M K_{\max}} \rho_{l,k}^{(n-1)} \hat{\rho}_{l,k}^{(n-1)} u_{l,k}^{(n)} \beta_{l,k}^l +1.
\end{equation}
\item The variables $\hat{\rho}_{l,k}$, for all $l,k \in \mathcal{A}_l,$ are updated as in \eqref{eq:dynamicrhohatlk}:
\begin{equation} \label{eq:dynamicrhohatlk}
\hat{\rho}_{l,k}^{(n)} = \min \left( \frac{ \sqrt{M K_{\max}} \rho_{l,k}^{(n-1)} u_{l,k}^{(n)} w_{l,k}^{(n)} \beta_{l,k}^l}{ \hat{\eta}_{l,k}^{(n)}} , \sqrt{P_{l,k}}\right),
\end{equation}
where $\hat{\eta}_{l,k}^{(n)}$ is given by
\begin{equation}
\begin{split}
\hat{\eta}_{l,k}^{(n)} =& (\rho_{l,k}^{(n-1)})^2 M K_{\max} \sum\limits_{i \in \mathcal{P}_k} w_{i,k}^{(n)} (u_{i,k}^{(n)})^2 (\beta_{l,k}^i)^2 + \\
& K_{\max} \sum\limits_{j \in \mathcal{P}_k} w_{j,k}^{(n)} (u_{j,k}^{(n)})^2 \beta_{l,k}^j \left( \sum\limits_{i=1}^L \sum\limits_{t \in \mathcal{A}_i } (\rho_{i,t}^{(n)})^2 \beta_{i,t}^j + \sigma_{\mathrm{UL}}^2 \right).
\end{split}
\end{equation}
\item The variables $\rho_{l,k}$, for all $l,k \in \mathcal{A}_l,$ are updated as in \eqref{eq:dynamicrholk}:
\begin{equation} \label{eq:dynamicrholk}
\begin{split}
\rho_{l,k}^{(n)} = \min \left( \frac{\sqrt{MK_{\max}} \hat{\rho}_{l,k}^{(n)} u_{l,k}^{(n)} w_{l,k}^{(n)} \beta_{l,k}^l }{ \eta_{l,k}^{(n)} }, \sqrt{P_{l,k}}\right),
\end{split}
\end{equation}
where $\eta_{l,k}^{(n)}$ is given by
\begin{equation}
\begin{split}
\eta_{l,k}^{(n)} =& (\hat{\rho}_{l,k}^{(n)})^2 M K_{\max} \sum\limits_{i \in \mathcal{P}_k} w_{i,k}^{(n)} (u_{i,k})^2 (\beta_{l,k}^i)^2 +\\
& \sum\limits_{i=1}^L \sum\limits_{t \in \mathcal{A}_i} w_{i,t}^{(n)} (u_{i,t}^{(n)})^2 \beta_{l,k}^i \left( K_{\max} \sum\limits_{j \in \mathcal{P}_k } (\hat{\rho}_{j,t}^{(n)})^2 \beta_{j,t}^i + \sigma_{\mathrm{UL}}^2\right).
\end{split}
\end{equation}
\end{itemize}
This iterative process converges to a stationary point $\{ u_{l,k}^{\mathrm{opt}}, w_{l,k}^{\mathrm{opt}}, \hat{\rho}_{l,k}^{\mathrm{opt}}, \rho_{l,k}^{\mathrm{opt}}\}$ to problem \eqref{Prob:WMMSEv1} and then $\{ (\hat{\rho}_{l,k}^{\mathrm{opt}})^2, (\rho_{l,k}^{\mathrm{opt}})^2 \}$ is also a stationary point to problem \eqref{Prob:SumRate}.
\end{theorem}
\begin{proof}
The proof derives the closed-form optimal solutions in \eqref{eq:ulkDynamicMRC}--\eqref{eq:dynamicrholk} to each of the optimization variables, when the other are fixed, by taking the first derivative of the partial Lagrangian function of \eqref{Prob:WMMSEv1} and equating it to zero. The fact that problems~\eqref{Prob:SumRate} and \eqref{Prob:WMMSEv1} have the same set of stationary points is further confirmed by the chain rule. The proof is given in Appendix~\ref{Appendix:IterativeAlgMRC}.
\end{proof}
Theorem~\ref{Theorem:IterativeAl} provides an iterative algorithm that obtains a local optimum to \eqref{Prob:SumRate} and \eqref{Prob:WMMSEv1} with relatively low computational complexity because of the closed-form solutions in each iteration. Algorithm~\ref{Algorithm:AlternatingApproach} gives a summary of this iterative process. From any feasible initial set of powers $\{ \hat{\rho}_{l,k}^{(0)}, \rho_{l,k}^{(0)} \}$, in each iteration, we update each optimization variable according to \eqref{eq:ulkDynamicMRC}--\eqref{eq:dynamicrholk}. This iterative process will be terminated when the variation of two consecutive iterations is small. For instance the stopping condition may be defined for a given accuracy $\epsilon > 0$ as
\begin{equation} \label{eq:Stoping}
\left| \sum_{l=1}^L \sum_{k \in \mathcal{A}_l } R_{l,k}^{(n)} - \sum_{l=1}^L \sum_{k \in \mathcal{A}_l } R_{l,k}^{(n-1)} \right| \leq \epsilon.
\end{equation}
By considering the multiplications, divisions, and logarithms as the dominated complexity, the number of arithmetic operations need for Algorithm~\ref{Algorithm:AlternatingApproach} to reach $\epsilon$-accuracy is
\begin{equation}
N_1 \left(8 \sum_{i=1}^L | \mathcal{A}_i| + 4 |\mathcal{P}_k | \sum_{i=1}^L | \mathcal{A}_i| + 23 |\mathcal{P}_k| + 50 \right) \sum_{i=1}^L | \mathcal{A}_i| ,
\end{equation}
where $N_1$ is the number iterations required for the convergence which depends on the given $\epsilon-$accuracy. From Theorem~\ref{Theorem:IterativeAl}, we further observe the following result which is key to achieve an efficient deep learning solution that can handle varying number of users.
\begin{corollary} \label{corollary:phatlkandplk}
If a user has the large-scale fading coefficient equal to zero, then it will always get zero transmit powers when using the algorithm in Theorem~\ref{Theorem:IterativeAl}. Hence, an equivalent way of managing inactive users is to set their large-scale fading coefficients to zero and use $\mathcal{A}_l=\{ 1, \ldots, K_{\max}\}$.
\end{corollary}
\begin{proof}
\textcolor{red}{The numerators of \eqref{eq:dynamicrhohatlk} and \eqref{eq:dynamicrholk} directly imply that any user with zero large-scale fading ($\beta_{l,k}^l =0$) will be allocated zero pilot power ($\hat{p}_{l,k} =0$) and zero data power ($p_{l,k} =0$).}
\end{proof}
\textcolor{red}{Note that, notwithstanding Corollary~\ref{corollary:phatlkandplk}, the system may reject some active users that have small but non-zero large-scale fading coefficients since Algorithm~\ref{Algorithm:AlternatingApproach} can assign zero power to these ones---similar to the behavior of standard waterfilling algorithms.} This is a key benefit of sum SE maximization as compared to max-min fairness power control \cite{Marzetta2016a, adhikary2017uplink, Chien2016b, massivemimobook, Luca2018DL,Chien2017b,Ghazanfari2019}
and maximum product-SINR power control \cite{massivemimobook,Luca2018DL,dao2018disjoint}, which always allocate non-zero power to all users and, therefore, require an additional heuristic user admission control step for selecting which users to drop from service due to their poor channel conditions. If a particular user~$t$ in cell~$i$ is not served this implies that $\hat{p}_{i,t}^{\mathrm{opt}} = 0$ and $p_{i,t}^{\mathrm{opt}} = 0$. Hence, this user is neither transmitting in the pilot nor data phase. Corollary~\ref{corollary:phatlkandplk} will enable us to design a single neural network that can mimic Algorithm~\ref{Algorithm:AlternatingApproach} for any number of active users.
\begin{figure}[t]
\centering
\includegraphics[trim=0cm 0cm 0cm 0cm, clip=true, width=3.0in]{images/LSFDiagram.eps} \vspace*{-0.0cm}
\caption{The flowchart of generating one realization of the Massive MIMO network with $LK_{\max}$ users having random large-scale fading realizations and activity.}
\label{FigLFSDig}
\vspace*{-0.2cm}
\end{figure}
\begin{figure}[t]
\centering
\begin{overpic}[trim=1.0cm 0.5cm 1.2cm 0.8cm, clip=true, width=3.2in]{images/FigPattern.eps}
\put (30,-4) {\fontsize{7}{7}{Cell of the user}}
\put(-5,20){\fontsize{7}{7}{\rotatebox{90}{Cell of the BS }}}
\end{overpic} \vspace*{0.3cm}
\caption{The pattern created by the average large-scale fading coefficients in dB between a user in a given cell and the BS in another cell, a coverage area $25$ km$^2$ with $L=256$ BSs on a $16 \times 16$ grid.}
\label{FigPatter}
\vspace*{-0.2cm}
\end{figure}
\begin{figure*}[t]
\centering
\includegraphics[trim=0.5cm 6.5cm 22cm 20.5cm, clip=true, width=5.6in]{images/FigResDenseNetCh.eps} \vspace*{-0.1cm}
\caption{The proposed PowerNet for the joint pilot and data power control from a given set of large-scale fading coefficients. }
\label{FigCNN}
\vspace*{-0.2cm}
\end{figure*}
\section{A low-complexity solution with convolutional neural network} \label{Section:CNN}
In this section, we introduce a deep learning framework for joint pilot and data power allocation in dynamic cellular Massive MIMO systems, which uses supervised learning to mimic the power control obtained by Algorithm~\ref{Algorithm:AlternatingApproach}. We stress that for non-convex optimization problems, a supervised learning approach with high prediction accuracy is both useful for achieving a low-complexity implementation, harnessing the advances in implementing neural networks on GPUs, and provides a good baseline for further activities, e.g., supervised learning as a warm start for unsupervised learning or to improve the performance of the testing phase \cite{lee2018deep}.
\subsection{Conditions on Large-Scale Fading Model}
We first make an explicit assumption on how the large-scale fading coefficients for active users are generated for each realization of the Massive MIMO network.
\begin{assumption} \label{assumption:UserLocation}
We consider an $L$-cell system where the activation of each user is determined by an independent Bernoulli distribution with activity probability $p\in [0,1]$. In each realization of the system, $K_{\max}$ i.i.d.~users are generated in each cell~$l$, in which user $t$ is active (i.e., $t \in \mathcal{A}_l$) with the probability $p$. The large-scale fading coefficients associated with an active user in cell $l$ have the probability density function (PDF) $f_l(\pmb{\beta})$, in which $\pmb{\beta} \in [0,1]^L$ and $[\pmb{\beta}]_l = \max_{i \in \{1, \ldots, L\}} [\pmb{\beta}]_i$, for $l=1,\ldots,L$.
The large-scale fading coefficients $\pmb{\beta}_{l,k} = [\beta_{l,k}^1, \ldots, \beta_{l,k}^L]^T$ of active user, $k \in \mathcal{A}_l$, is obtained as an i.i.d. realization with the PDF $f_l(\cdot)$ that satisfies
\begin{equation} \label{eq:LSFCond}
\beta_{l,t}^l = \underset{i \in \{1, \ldots, L\}}{\max} \, \, \beta_{l,t}^i, \forall t \in \mathcal{A}_l,
\end{equation}
such that it has its strongest channel from the serving BS. Since the activity of the $K_{\max}$ users in cell~$l$ is randomly generated, there are $2^{K_{\max}}$ different possible realizations of the active index user set $\mathcal{A}_l$.
\end{assumption}
The process of generating system realizations is illustrated in Fig.~\ref{FigLFSDig}.
Note that all users in cell $i$ have the same $f_i(\cdot)$, which represents the user distribution over the coverage area of this cell, but this function is different for each cell. For notational convenience, each cell has the same maximum number of users $K_{\max}$ and the activity probability is independent of the cell and location, but these assumptions can be easily generalized.
Assumption~\ref{assumption:UserLocation} indicates that a user should be handled equally irrespective of which number that it has in the cell. The fact that all large-scale fading coefficients belong the to compact set $[0,1]$ originates from the law of conservation of energy, and fits well with the structural conditions required to construct a neural networks \cite{hornik1989}. There are many ways to define the PDFs of the large-scale fading coefficients. One option is to match them to channel measurements obtained in a practical setup \cite{gao2013massive}. Another option is to define the BS locations and user distributions and then define a pathloss model with shadow fading. In the numerical part of this paper, we take the latter approach and follow the $3$GPP LTE standard \cite{LTE2010b} that utilizes a Rayleigh-lognormal fading model that matches well to channel measurements in non-line-of-sight conditions. The following model is used for simulations in Section~\ref{Section:NumericalResults}.
\begin{example} \label{Example:LSF}
Consider a setup with $L$ square cells. In each cell, the $K_{\max}$ users are uniformly distributed in the serving cell at distances to the serving BS that are larger than $35$\,m. Each user has the activity probability $p=2/3$.
For an active user~$t$ in cell~$l$, we generate the large-scale fading coefficient to BS~$i$ as
\begin{equation} \label{eq:ShadowFading}
\beta_{l,t}^i\, \mathrm{[dB]} = -148.1 - 37.6\log_{10} (d_{l,t}^i / 1\,\mathrm{km}) + z_{l,t}^i,
\end{equation}
where $d_{l,t}^i$ is the physical distance and $z_{l,t}^i$ is shadow fading that follows a normal distribution with zero mean and standard derivation $7$~dB. If the conditions \eqref{eq:LSFCond} and/or $\beta_{l,t}^i \leq 1$ are not satisfied for a particular user, we simply rerun all the shadow fading realizations for that user.
\end{example}
In order to work with deep neural networks, we now use the channel model in Assumption~\ref{assumption:UserLocation} to express Algorithm~\ref{Algorithm:AlternatingApproach} with the viewpoint of continuous mappings.\footnote{The process $h(\mathbf{x}) = [h_1(\mathbf{x}),\ldots, h_{N_1}(\mathbf{x}) ]$ is a continuous mapping if all $h_n (\mathbf{x}), \forall n \in \{1, \ldots, N_1 \},$ are continuous functions.} Let $\mathcal{F}_{u}, \mathcal{F}_{w}, \mathcal{F}_{p},$ and $\mathcal{F}_{d}$ define the multivariate functions that handle the updates of variables $u_{l,k}, w_{l,k}, \hat{\rho}_{l,k},$ and $\rho_{l,k}, \forall l,k \in \mathcal{A}_l$, which are formally defined as
\begin{align}
\{ u_{l,k}^{(n)} \}_{\forall l }^{k \in \mathcal{A}_l} &= \mathcal{F}_{u} \left(\{ \pmb{\psi}_{k} , \beta_{l,k}^{i} , \hat{\rho}_{l,k}^{(n-1)} , \rho_{l,k}^{(n-1)} \}_{\forall l,i }^{k \in \mathcal{A}_l} \right), \label{eq:Umap}\\
\{w_{l,k}^{(n)}\}_{\forall l }^{k \in \mathcal{A}_l} &= \mathcal{F}_{w} \left( \{ u_{l,k}^{(n)} , \pmb{\psi}_k , \beta_{l,k}^{i} , \hat{\rho}_{l,k}^{(n-1)} , \rho_{l,k}^{(n-1)} \}_{\forall l,i }^{k \in \mathcal{A}_l} \right), \\
\{ \hat{\rho}_{l,k}^{(n)} \}_{\forall l }^{k \in \mathcal{A}_l} &= \mathcal{F}_{p} \left(\{ u_{l,k}^{(n)} , w_{l,k}^{(n)}, \pmb{\psi}_k , \beta_{l,k}^{i} , \rho_{l,k}^{(n-1)} \}_{\forall l,i }^{k \in \mathcal{A}_l} \right),\\
\{ \rho_{l,k}^{(n)} \}_{\forall l }^{k \in \mathcal{A}_l} &= \mathcal{F}_{d} \left(\{ u_{l,k}^{(n)} ,w_{l,k}^{(n)} , \pmb{\psi}_k , \beta_{l,k}^{i}, \hat{\rho}_{l,k}^{(n)} \}_{\forall l,i }^{k \in \mathcal{A}_l} \right) \label{eq:Odmap},
\end{align}
The continuous mapping describing Algorithm~\ref{Algorithm:AlternatingApproach} at iteration~$n$ is now formulated in a compact form as
\begin{equation} \label{eq:ContMap}
\begin{split}
& \{ \hat{\rho}_{l,k}^{(n)} , \rho_{l,k}^{(n)} \}_{\forall l }^{k \in \mathcal{A}_l} = \mathcal{F}^{(n)} \left( \{ \pmb{\psi}_k , \beta_{l,k}^{i} , \hat{\rho}_{l,k}^{(n-1)}, \rho_{l,k}^{(n-1)} \}_{\forall l,i }^{k \in \mathcal{A}_l} \right) \\
&= \mathcal{F}^{(n)} \Big(\mathcal{F}^{(n-1)} \Big( \ldots \mathcal{F}^{(1)} \Big( \{ \hat{\rho}_{l,k}^{(0)} , \rho_{l,k}^{(0)} , \pmb{\psi}_k , \beta_{l,k}^{i} \}_{\forall l,i }^{k \in \mathcal{A}_l} \Big), \\
& \qquad \{ \pmb{\psi}_k , \beta_{l,k}^{i} \}_{\forall l,i }^{k \in \mathcal{A}_l} \Big), \{ \pmb{\psi}_k , \beta_{l,k}^{i} \}_{\forall l,i}^{k \in \mathcal{A}_l} \Big),
\end{split}
\end{equation}
where $\mathcal{F}^{(n)}$ is the continuous mapping representing for the whole process in \eqref{eq:Umap}--\eqref{eq:Odmap}, which is defined as $\mathcal{F}^{(n)} (\{ \pmb{\psi}_k , \beta_{l,k}^{i} , \hat{\rho}_{l,k}^{(n-1)} , \rho_{l,k}^{(n-1)} \}_{\forall l,i }^{k \in \mathcal{A}_l} ) = \mathcal{F}_{d} \circ \mathcal{F}_{p} \circ \mathcal{F}_{w} \circ \mathcal{F}_{u} (\{ \pmb{\psi}_k , \beta_{l,k}^{i}, \hat{\rho}_{l,k}^{(n-1)} , \rho_{l,k}^{(n-1)} \}_{\forall l,i }^{k \in \mathcal{A}_l} ),$
with $\circ$ being the composition operator. By assuming that Algorithm~\ref{Algorithm:AlternatingApproach} converges at iteration~$n$, i.e., $ \hat{\rho}_{l,k}^{\mathrm{opt}} = \hat{\rho}_{l,k}^{(n)}, \rho_{l,k}^{\mathrm{opt}} = \rho_{l,k}^{(n)}, \forall l, k \in \mathcal{A}_l,$ then the end-to-end continuous mapping for a given set of active users standing for the iterative processing of this algorithm is
\begin{equation} \label{eq:Mappingv1}
\mathcal{F}\left(\{ \pmb{\psi}_k , \beta_{l,k}^{i} , \rho_{l,k}^{(0)} , \hat{\rho}_{l,k}^{(0)} \}_{\forall l,i }^{k \in \mathcal{A}_l} \right) = \left\{ \hat{\rho}_{l,k}^{\mathrm{opt}} , \rho_{l,k}^{\mathrm{opt}} \right\}_{\forall l,i }^{k \in \mathcal{A}_l},
\end{equation}
where
\begin{equation}
\begin{split}
&\mathcal{F} \left(\{ \pmb{\psi}_k , \beta_{l,k}^{i}, \rho_{l,k}^{(0)} , \hat{\rho}_{l,k}^{(0)} \}_{\forall l,i }^{k \in \mathcal{A}_l} \right) =\\
& \mathcal{F}^{(n)} \left(\{ \pmb{\psi}_k , \beta_{l,k}^{i} , \rho_{l,k}^{(n-1)} , \hat{\rho}_{l,k}^{(n-1)} \}_{\forall l,i }^{k \in \mathcal{A}_l} \right)
\end{split}
\end{equation}
that shows a stationary point obtained from the input set of large-scale fading together with an initial set of powers and the pilot assignment after $n$ iterations. We stress that the input of the continuous mapping \eqref{eq:Mappingv1} varies as a function of the user activity per cell, i.e. $\mathcal{A}_l, \forall l$, thus there are many different power control functions that would need to be approximated with individual neural networks if one follows the standard approach taken in previous work \cite{Luca2018DL, sun2018learning}. A single neural network cannot have a varying number of inputs and outputs, so we would have to design a separate neural network for each value of $\mathcal{A}_l$. If the methods in previous works \cite{Luca2018DL, sun2018learning} are applied for the considered scenario in this paper, BS~$l$ must construct and train $2^{K_{\max}}$ separate neural networks to learn all subset relations created by $\mathcal{A}_l$ as a consequence of Assumption~\ref{assumption:UserLocation}. For a cellular network comprising $L$ cells, we will need to train and store $L2^{K_{\max}}$ different neural networks, which is a big number (up to $9126$ neural networks in the simulation part with $L= 9$ cells serving $K_{\max} = 10$ users). If we had to design all such specific neural networks, the solution is practically useless.
\subsection{Existence of a Single Neural Network for Joint Pilot and Data Power Control}
A main contribution of our framework is that we can exploit the structure of the optimization problem to build a single neural network that can handle the activity/inactivity pattern and has a unified structure for all training samples. We exploit Corollary~\ref{corollary:phatlkandplk} to design such a single neural network that approximates the whole family of functions in \eqref{eq:Mappingv1}. Recall that this corollary says that users with zero-valued large-scale fading coefficients are assigned zero power, without affecting the other users in the network. Corollary~\ref{corollary:phatlkandplk} is indeed used to remove the number of active users per cell and the pilot assignment as input variables. These variables are instead implicitly represented by the large-scale fading values, which are now vectors of a predefined size where non-existing users are represented by zeros, i.e., $\pmb{\beta}_{l,k} = [\beta_{l,k}^1, \ldots, \beta_{l,k}^L]^T = \mathbf{0}, \forall k \notin \mathcal{A}_l$. After that, we define a tensor $\mathsf{I} \in \mathbb{R}_{+}^{L \times L \times K_{\max}}$ containing all the large-scale fading coefficients, $\mathsf{O}_d^{\mathrm{opt}} \in \mathbb{R}_{+}^{L \times 1 \times K_{\max}}$ containing the optimized data powers, and $\mathsf{O}_p^{\mathrm{opt}} \in \mathbb{R}_{+}^{L \times 1 \times K_{\max}}$ containing the optimized pilot powers. Following similar steps as presented in \eqref{eq:Umap}--\eqref{eq:Mappingv1} and treating the starting point as the predetermined number, PowerNet will learn the unique continuous mapping
\begin{equation} \label{eq:Mapping}
\mathcal{F}(\mathsf{I}) = \left\{ \mathsf{O}_d^{\mathrm{opt}} , \mathsf{O}_p^{\mathrm{opt}} \right\}.
\end{equation}
The key distinction of the continuous mapping \eqref{eq:Mapping} compared with one in \eqref{eq:Mappingv1} is the fixed number of inputs and outputs, irrespective of the user activity. This allows a single deep neural network to handle the variation in user activity. We can view the solution to a power control optimization problem as a power control mapping. It is well known that deep learning can be used to approximate such a mapping, thanks to the universal approximation theorem \cite{hornik1989}. The input to the proposed feed-forward neural network is only the large-scale fading coefficients and the output is the data and pilot powers. This makes PowerNet more applicable for real-time communication systems than the previous works \cite{zappone2018model, sun2018learning}, which rely on perfect instantaneous CSI (i.e., small-scale fading) to predict the data power allocation, and neglected channel estimation and pilot contamination effects.
\begin{remark} \label{Remark:ProblemStructure}
The zero-insertion trick that was used to achieve~\eqref{eq:Mapping} works well thanks to the structure of our sum SE optimization problem as stated in Corollary~\ref{corollary:phatlkandplk}. The same trick cannot be applied along with previous works, for example \cite{Luca2018DL}, when using the maximum product-SINR or max-min fairness power control as the performance metric since then everyone would receive zero powers.
\end{remark}
\vspace*{-0.25cm}
\subsection{Convolutional Neural Network Architecture with Residual Dense Connections}
Among all neural network structures in the literature, CNN is a popular family that achieves higher performance than fully-connected deep neural network for many applications \cite{sainath2013, zhang2017beyond}. One main reason reported in \cite{sainath2013} is that CNN effectively deduces the spectral variation existing in a dataset. In order to demonstrate why the use of CNN is suitable for power control in Massive MIMO, let us consider an area of $5 \times 5$~km with $L = 256$ square cells, each serving $K_{\max} = 10$ users. The large-scale fading coefficients are generated as in Example~\ref{Example:LSF}, but all users are assumed to be in active mode. The interference in a real cellular system is imitated by wrap-around. We gather all the large-scale fading coefficients in a tensor of size $L \times L \times K_{\max}$. The main reason for using a CNN is that the third dimension contains $K_{\max}$ users that have i.i.d.~coefficients, which are processed identically when using convolutional kernels. An additional reason is that the geometry of the BS deployment can be learned and utilized. For visualization, we map this tensor to a matrix $\mathbf{Z}$ of size $L \times L$ by averaging over the third dimension (user dimension) and plot the result in Fig.~\ref{FigPatter}. The number of horizontal and vertical elements is equal to $L$.
The color map in Fig.~\ref{FigPatter} represents the large-scale fading coefficients. For example, the color of the square $(l,j)$ represents the average large-scale fading coefficient from a user in cell~$l$ to BS~$j$.\footnote{This figure considers a symmetric network, where the BSs are deployed on a square grid, to make the pattern clearly visible to the reader. We consider a network with the same shape in the simulation part but with fewer BSs. We have observed that a CNN can identify patterns in symmetric deployments since the BS locations follow a strict symmetric pattern. The design of a neural network that is capable of identifying similar patterns in networks with asymmetric BS locations is left for the future.}
Since there is a grid of $16 \times 16$ cells, and the cells are numbered row by row, the large-scale fading coefficients have a certain pattern determined by the fixed cell geometry. Users in neighboring cells have larger large-scale fading coefficients than cells that are further away. The strong intensity around the main diagonal represent the cell itself, while the sub-diagonals with strong intensities represent interference between neighboring cells. The strong intensities in the lower-left and upper-right corners are due to the wrap-around topology. In summary, we make the following observations:
\begin{itemize}
\item The elements of the $L \times L \times K_{\max}$ tensor with large-scale coefficients have a particular relation determined by the geometry of the cellular network. The neural network must learn these relationship and the neural network structure should be selected to facilitate this learning. A CNN is appropriate since the tensor can be directly used as input.\footnote{According to the universal approximation theorem, it is possible to design a fully-connected neural network (FDNN) to achieve the same prediction accuracy as any other neural network. However, we stress that the tensor with large-scale fading coefficients must be turned into a vector in that case. The network will be overparameterized since many weights and biases will do the same thing (e.g., treated users in the same cell) and is becomes harder for the neural network to identify the structure that we know exist in the input data. This intuition is confirmed by Figs.~\ref{FigSEperCellL4K10Ber2p3} and \ref{FigPerUserSEL4K10Ber2p3}, where we compare a CNN with an FDNN.}
\item Each of the $K_{\max}$ users in a cell have large-scale fading coefficients generated independently from the same distribution, thus these inputs should be treated equally.
It is therefore beneficial to have a set convolutional kernels that are reused among the users in a cell, instead of an overparameterized fully-connected network where we know that some of the weights and biases should be the same when we have trained the network properly.
\item Since the cell geometry and BS deployment is fixed in practical deployment, the CNN can learn recurrent spatial patterns of the type shown in Fig.~\ref{FigPatter}. In practice, the patterns might not be as visible to the human eye due to asymmetric cell deployment, but machine learning can anyway identify and exploit it to enable reuse of a set convolutional kernels that are reused in multiple cells, thereby reducing the number of trainable parameters.
\end{itemize}
This paper designs a CNN (illustrated in Fig.~\ref{FigCNN}) which is able to obtain performance close to the stationary point produced by the iterative algorithm in Theorem~\ref{Theorem:IterativeAl}. This CNN only uses the large-scale fading coefficients gathered in an $L \times L \times K_{\max}$ tensor as input, which reduces significantly the signaling overhead compared to using instantaneous channels as in \cite{van2018distributed}, and reduces the number of trainable parameters by exploiting the pattern created by the large-scale fading coefficients. We will further adopt the state-of-the-art residual dense block (ResDense) \cite{zhang2018a} which consists of densely connected convolutions \cite{huang2017} with the residual learning \cite{he2016deep}. The residual dense connections, which are demonstrated by concatenations, prevent the vanishing gradient problem that may often happen when some large-scale fading coefficients are small. It also prevents the overfitting problem by using many ResDense blocks to deploy a very deep neural network. Compared with the original ResDense in \cite{zhang2018a}, we use additional (rectified linear unit) ReLU activation unit, $\xi(x) = \max(0,x)$, after the residual connection since our mapping only concentrates on non-negative values. We notice that the proposed network might have more parameters than actually needed since our main goal is to provide a proof-of-concept. The optimal network with the lowest number of parameters is different for every propagation environment and therefore not considered in this work, which focuses on the general properties and not the fine-tuning.
\subsubsection{The forward propagation} From the large-scale fading tensor $\mathsf{I}$, the first component of the forward propagation is the convolutional layer
\begin{equation} \label{eq:1stFeatureMap}
\mathsf{X}_1^{(m)} = \mathcal{H}_1 \left(\mathsf{I}, \{ \mathsf{W}_{1, j}^{(m-1)}, b_{1, j}^{(m-1)} \}_{j=1}^Q \right),
\end{equation}
where $m$ is the epoch index. The operator $\mathcal{H}_1(\cdot, \cdot)$ denotes a series of $Q$ convolutions \cite{chen2016deep}, each using a kernel $\mathsf{W}_{1, j}^{(m-1)} \in \mathbb{R}^{3\times 3\times K_{\max}}$ and a bias $b_{1, j}^{(m-1)} \in \mathbb{R}$ to extract large-scale fading features of the input tensor $\mathsf{I}$.
All convolutions apply stride~$1$ and zero padding $1$ to guarantee the same height and width between the inputs and outputs. After the first layer in \eqref{eq:1stFeatureMap}, the feature map is a tensor with the size $L\times L \times Q$. PowerNet is constructed from $N$ sequential connected ResDense blocks to extract special features of large-scale fading coefficients. Each ResDense block uses the four sets of convolutional kernels to extract better propagation features. The first convolution begins with $\mathsf{X}_{2,1,4}^{(m)} = \mathsf{X}_1^{(m)}$, then the output signal at each of the $n$-th ResDense block is simultaneously computed by adapting the residual dense connection in \cite{he2016deep} to PowerNet as:
\begin{align}
\mathsf{X}_{2,n,i}^{(m)} &= \xi \left(\mathcal{H}_{2, i} \left( [\mathsf{X}_{2,n-1,4}^{(m)}, \mathsf{X}_{2,n,1}^{(m)}, \ldots, \mathsf{X}_{2,n,i-1}^{(m)} ], \{ \mathsf{W}_{2, i, j}^{(m-1)} \}_{j=1}^Q \right) \right), \label{eq:Resden1} \\
\mathsf{X}_{2,n,4}^{(m)} &= \mathcal{H}_{2, 4} \left([\mathsf{X}_{2,n-1,4}^{(m)}, \mathsf{X}_{2,n,1}^{(m)}, \mathsf{X}_{2,n,2}^{(m)}, \mathsf{X}_{2,n,3}^{(m)} ], \{ \mathsf{W}_{2, 4, j}^{(m-1)} \}_{j=1}^Q \right),\label{eq:Resden4}
\end{align}
where $i \in \{1,2,3 \}$ in \eqref{eq:Resden1}. Each operator $\mathcal{H}_{2,j} (\cdot, \cdot), j \in \{1,\ldots,4\},$ denotes a series of the $Q$ convolutions. In the three first modules, the kernels are $\mathsf{W}_{2, 1, j}^{(m-1)} \in \mathbb{R}^{3\times 3 \times Q}$, $\mathsf{W}_{2, 2, j}^{(m-1)} \in \mathbb{R}^{2 \times 3\times 3 \times Q}$, $\mathsf{W}_{2, 3, j}^{(m-1)} \in \mathbb{R}^{3 \times 3\times 3 \times Q}$, while the remaining has $\mathsf{W}_{2, 4, j}^{(m-1)} \in \mathbb{R}^{4 \times 1\times 1 \times Q}$. In the first three modules, the ReLU activation function $\xi(x)$ is used for each element.
Since the input and output size of the neural network are different, multiple $1$D convolutions are used to make the sides equal. In addition, both horizontal and vertical 1D convolutions are used to exploit correlation in both directions. A regular transpose layer is applied following vertical 1D convolution to ensure the data size of $L \times 1 \times K_{\max}$. This prediction is used for both pilot and data power as depicted in Fig.~\ref{FigCNN} and is mathematically expressed as
\begin{align}
\mathsf{X}_{z}^{(m)} = & \mathcal{H}_{ z}^v \left( \widetilde{\mathsf{X}}_{2,N,4}^{(m)} , \{ \mathsf{W}_{ z,j}^{v,(m-1)} , b_{ z,j}^{v,(m-1)} \}_{j=1}^{K_{\max}} \right) + \notag \\
&
\mathcal{H}_{ z}^h \left( \widetilde{\mathsf{X}}_{2,N,4}^{(m)} , \{ \mathsf{W}_{ z,j}^{h,(m-1)}, b_{ z,j}^{h,(m-1)} \}_{j=1}^{K_{\max}} \right), \label{eq:PilotTensor}
\end{align}
where the index $z$ stands for either the pilot or data tensor; $\widetilde{\mathsf{X}}_{2,N,4}^{(m)} = \mathsf{X}_{2,N,4}^{(m)} + \mathsf{X}_{1}^{(m)}$; $\mathcal{H}_{z}^v (\cdot, \cdot)$ and $\mathcal{H}_{ z}^h (\cdot, \cdot)$ denote the vertical and horizontal series of $K_{\max}$ convolution operators used to predict the optimized powers by convolutional kernels $\mathsf{W}_{ z,j}^{v,(m-1)} \in \mathbb{R}^{1 \times L \times Q}, \mathsf{W}_{ z,j}^{h,(m-1)} \in \mathbb{R}^{L \times 1 \times Q}, \forall j$ and their related biases $b_{z,j}^{v,(m-1)}, b_{ z,j}^{h,(m-1)} \in \mathbb{R}, \forall j$.
The feature maps from \eqref{eq:PilotTensor} are restricted in the closed unit interval $[0,1]$ by
\begin{equation}
\mathsf{X}_{z,s}^{(m)} = \mathrm{Sigmoid}\left( \mathsf{X}_{z}^{(m)} \right),
\end{equation}
where the element-wise sigmoid activation function is $\mathrm{Sigmoid} (x) = 1/(1 + \exp(-x))$. Finally, the predicted pilot and data powers at epoch~$m$ are obtained by scaling up $\mathsf{X}_{z,s}^{(m)}$ and $\mathsf{X}_{z,s}^{(m)}$ as
\begin{equation}
\mathsf{O}_z^{(m)} = \mathsf{P}\odot \mathsf{X}_{z,s}^{(m)},
\end{equation}
where $\mathsf{P} \in \mathbb{R}^{L\times 1 \times K_{\max}}$ is a collection of the maximum power budget $P_{l,k}$ from all users with $[\mathsf{P}]_{l,1,k} = P_{l,k}, \forall l,k$ and $\odot$ denotes the dot product of two tensors. The forward propagation is applied for both the training and testing phases.
\subsubsection{The back propagation} \label{Sec:BackPro}
The back propagation is only applied in the training phase. We consider supervised learning where the Frobenius norm is adopted to define the loss function as
\begin{equation} \label{eq:Loss}
f (\Theta^{(m)} ) = \frac{1}{D} \sum_{i=1}^D \big\| \mathsf{O}_{d}^{(m),i} - \mathsf{O}_{d}^{\mathrm{opt},i} \big\|_F^2 + \frac{1}{D} \sum_{i=1}^D \big\| \mathsf{O}_{p}^{(m),i} - \mathsf{O}_{p}^{\mathrm{opt},i} \big\|_F^2
\end{equation}
with respect to the convolution kernels and biases in $\Theta$. The loss in \eqref{eq:Loss} is averaged over the training dataset $\{ \mathsf{O}_{p}^{\mathrm{opt}, i}, \mathsf{O}_{d}^{\mathrm{opt}, i} \}, i = 1, \ldots, D,$ where $D$ is the total number of large-scale fading realizations. While the supervised learning provides a simple loss function for the back propagation, it make PowerNet on average perform not better than the continuous mapping~\eqref{eq:Mapping}.
The back propagation utilizes \eqref{eq:Loss} to update all weights and biases. PowerNet will use stochastic gradient descent \cite{Goodfellow-et-al-2016} to obtain a good local solution to $\Theta$. Beginning with a random initial value $\Theta = \Theta^{(0)} , \Delta \Theta^{(0)} = \mathbf{0},$ and remember the current $ \Delta \Theta^{(m)}$, epoch $m$ updates $\Theta^{(m)}$
using the so-called momentum $\alpha$ and the learning rate $\eta$. The computational complexity of the back propagation can be significantly reduced, while still can obtain a good solution to the kernel and bias if a random mini-batch $D_t$ with $D_t < D$ is properly selected \cite{Goodfellow-et-al-2016} rather than processing all the training data at once.
\begin{remark} \label{Remark:BestLabel}
Since Algorithm~\ref{Algorithm:AlternatingApproach} only finds a stationary point, different initializations will lead to different stationary points, some giving a higher sum SE than others. Instead of creating the labels by running Algorithm~\ref{Algorithm:AlternatingApproach} only once, we can run the algorithm multiple times with different initializations and use the one with the highest sum SE as the label. The more initializations are used, the more likely it is that the global optimum is found. This method only increases the computational complexity to generate good data labels, while PowerNet retains the computational complexity as before. We will evaluate the performance benefit in Section~\ref{Section:NumericalResults}.
\end{remark}
\vspace*{-0.5cm}
\subsection{Dataset, Training, and Testing Phases}
In order to train PowerNet, we use Algorithm~\ref{Algorithm:AlternatingApproach} to generate training pairs of user realizations and the corresponding outputs $\mathsf{O}_{p}^{\mathrm{opt}}, \mathsf{O}_{d}^{\mathrm{opt}}$ that are jointly optimized by our method presented in Algorithm~\ref{Algorithm:AlternatingApproach}. Aligned with the previous works \cite{Luca2018DL, lee2018deep}, an offline training phase is considered in this paper.\footnote{Future work can explore how to train the network using less training samples, for example, using semi-supervised methods.} Specifically, we generate data with the mini-batch size $L \times L \times K_{\max} \times D_t$ for the training and testing phase, respectively. We use the momentum and babysitting the learning rate to get the best prediction performance and minimize the training time as well. The Adam optimization is used to train our data set \cite{kingma2014adam}. PowerNet is dominated by exponentiations, divisions, and multiplications, the number of arithmetic operations required for the forward propagation at each epoch is computed as
\begin{equation}
9K_{\max}L^2Q + 28 Q^2 L^2 N + 4 L^2 Q K_{\max} + 4LK_{\max},
\end{equation}
which is also the exact computational complexity of the testing phase where each large-scale fading tensor only passes through the neural network once and there is no back propagation.
\vspace*{-0.25cm}
\begin{figure*}[t]
\begin{minipage}{0.49\textwidth}
\centering
\includegraphics[trim=0.6cm 0.0cm 1.1cm 0.7cm, clip=true, width=3.2in]{images/FigConvgL4K5.eps} \vspace*{-0.1cm} \\
(a)
\end{minipage}
\hfill
\begin{minipage}{0.49\textwidth}
\centering
\includegraphics[trim=0.6cm 0.0cm 1.1cm 0.7cm, clip=true, width=3.2in]{images/FigConvgL9K10.eps} \vspace*{-0.1cm} \\
(b)
\end{minipage}
\vspace*{-0.1cm}
\caption{The convergence of Algorithm~\ref{Algorithm:AlternatingApproach} for the different activity probabilities: Fig.~\ref{FigConvg}a: the system with $L=4, K_{\max}= 5$. Fig.~\ref{FigConvg}b: The system with $L=9, K_{\max} =10$. }
\label{FigConvg}
\vspace*{-0.2cm}
\end{figure*}
\section{Numerical Results} \label{Section:NumericalResults}
To demonstrate the performance of PowerNet, we consider the setup in Example $1$ with $L \in \{4, 9\}$ equally large square cells in a square area $1$~km$^2$. The coverage area is wrapped around at the edges to avoid boundary effects, so $9L$ cells are considered in total. Each user is served by the BS having the largest large-scale fading coefficient. In every cell, the BS is located at the center. The distribution of users and the large-scale fading coefficients are generated according to Example~\ref{Example:LSF}, but the activity probability will be defined later. The maximum power level is $P_{l,k} =200$~mW, $\forall l,k$. We use Algorithm~\ref{Algorithm:AlternatingApproach} to generate $1.5$ million data samples to train PowerNet. The mini-batch size is $512$. The number of epochs used for the training phase is $300$. We use a momentum of $0.99$ and babysitting of the learning rate which varies from $10^{-3}$ to $10^{-5}$. From our experiments, we note that the learning rate may be reduced by approximately three times if the test loss remains the same for $100$ consecutive epochs. \textcolor{red}{In the first convolutional layer, $64$ kernels are used and PowerNet has $5$ ResDense blocks}. For the loss function in \eqref{eq:Loss}, we set $w_1 = w_2 =1$ to treat the importance of the data and pilot powers equally. The following methods are compared:
\begin{itemize}[leftmargin=4mm]
\item[$1)$] \textit{Fixed power (FP) level}: Each user uses the fixed maximum power level $200$ mW for both pilot and data. It is denoted as FP in the figures.
\item[$2)$] \textit{Data power optimization only (DPOO)}: The system uses a simplification of Algorithm \ref{Algorithm:AlternatingApproach} to perform data power control, while the pilot power is fixed to $200$ mW. It is denoted as DPOO in the figures.
\item[$3)$] \textit{Joint pilot and data power optimization (JPDPO)}: The system uses Algorithm \ref{Algorithm:AlternatingApproach} to jointly optimize the optimal pilot and data powers for all users. It is denoted as JPDPO in the figures.
\item[$4)$] \textit{Joint pilot and data power optimization based on CNN (PowerNet)}: The system uses the proposed CNN described in Section~\ref{Section:CNN} to find the pilot and data powers for all users. It is denoted as PowerNet in the figures.
\item[$5)$] \textit{Joint pilot and data power optimization based on fully-connected deep neural network}: The system uses a modified version of the fully-connected deep neural network in \cite{sun2018learning} to find the solution to both the pilot and data powers for all users. It is denoted as FDNN in the figures.
\end{itemize}
\begin{figure*}[t]
\begin{minipage}{0.49\textwidth}
\centering
\includegraphics[trim=0.5cm 0.0cm 0.5cm 0.7cm, clip=true, width=3.2in]{images/Fig_DiffInt.eps} \vspace*{-0.1cm}
\caption{CDF of sum SE per cell [b/s/Hz] versus the number of random initializations that we select the best out of. We have $L=4$, $K_{\max} = 10, M=200,$ and activity probability $2/3$.}
\label{FigCDFDiffInitialization}
\vspace*{-0.5cm}
\end{minipage}
\hfill
\begin{minipage}{0.49\textwidth}
\centering
\includegraphics[trim=0.5cm 0.0cm 0.5cm 0.7cm, clip=true, width=3.2in]{images/FigPowerL4K10.eps} \vspace*{-0.1cm}
\caption{CDF of pilot and data power allocation [mW] by using JPDPO and DPOO with $L=4, K_{\max} = 10, M=200,$ and activity probability $2/3$.}
\label{FigPowerL4K10}
\vspace*{-0.2cm}
\end{minipage}
\end{figure*}
\begin{figure*}[t]
\begin{minipage}{0.49\textwidth}
\centering
\includegraphics[trim=0.5cm 0.0cm 0.5cm 0.7cm, clip=true, width=3.2in]{images/FigSumSEperCellBer2p3.eps} \vspace*{-0.1cm}
\caption{CDF of sum SE per cell [b/s/Hz] with $L=4, K_{\max} = 10,M=200,$ and activity probability $2/3$.}
\label{FigSEperCellL4K10Ber2p3}
\vspace*{-0.2cm}
\end{minipage}
\hfill
\noindent\begin{minipage}{0.49\textwidth}
\centering
\includegraphics[trim=0.5cm 0.0cm 0.5cm 0.7cm, clip=true, width=3.2in]{images/FigPerUserSEL4K10Ber2p3.eps} \vspace*{-0.1cm}
\caption{CDF of per user SE [b/s/Hz] with $L=4, K_{\max} = 10,M=200,$ and activity probability $2/3$.}
\label{FigPerUserSEL4K10Ber2p3}
\vspace*{-0.2cm}
\noindent \end{minipage}
\end{figure*}
\begin{figure*}[t]
\begin{minipage}{0.49\textwidth}
\centering
\includegraphics[trim=0.5cm 0.0cm 0.5cm 0.7cm, clip=true, width=3.2in]{images/FigSumSEperCellL9K10.eps} \vspace*{-0.1cm}
\caption{CDF of sum SE per cell [b/s/Hz] with $L=9, K_{\max} = 10,M=200,$ and activity probability $1$.}
\label{FigSumSEperCellL9K10}
\vspace*{-0.2cm}
\end{minipage}
\hfill
\begin{minipage}{0.49\textwidth}
\centering
\includegraphics[trim=0.5cm 0.0cm 0.5cm 0.7cm, clip=true, width=3.2in]{images/FigPerUserSEL9K10.eps} \vspace*{-0.1cm}
\caption{CDF of per user SE [b/s/Hz] with $L=9, K_{\max} = 10,M=200,$ and activity probability $1$.}
\label{FigCDFPerUserRateL9K10}
\vspace*{-0.2cm}
\end{minipage}
\end{figure*}
\begin{figure*}[t]
\noindent\begin{minipage}{0.49\textwidth}
\centering
\includegraphics[trim=0.5cm 0.0cm 0.5cm 0.7cm, clip=true, width=3.2in]{images/FigSumSEperCellL4K10Ber1p3.eps} \vspace*{-0.1cm}
\caption{CDF of SE per cell [b/s/Hz] with $L=4,K_{\max} = 10,$ and $M=200$. All users are in active mode with a probability $2/3$ in the training phase and $1/3$ in the testing phase.}
\label{FigSumSEperCellL4K10Ber1p3}
\vspace*{-0.2cm}
\noindent \end{minipage}
\hfill
\begin{minipage}{0.49\textwidth}
\centering
\includegraphics[trim=0.5cm 0.0cm 0.5cm 0.7cm, clip=true, width=3.2in]{images/FigSumSEperCellL4K10Ber5p6.eps} \vspace*{-0.1cm}
\caption{CDF of SE per cell [b/s/Hz] with $L=4, K_{\max} = 10,$ and $M=200$. All users are in active mode with a probability $2/3$ in the training phase and $5/6$ in the testing phase.}
\label{FigSumSEperCellL4K10Ber5p6}
\vspace*{-0.2cm}
\end{minipage}
\end{figure*}
\begin{figure*}[t]
\begin{minipage}{0.49\textwidth}
\centering
\includegraphics[trim=0.5cm 0.0cm 0.5cm 0.7cm, clip=true, width=3.2in]{images/FigSumSEperCellL4K10BerVaries.eps} \vspace*{-0.1cm}
\caption{CDF of SE per cell [b/s/Hz] with $L=4 ,K_{\max} = 10$, and $M=200$. Each user has the activity probability uniformly distributed in $[0,1]$.}
\label{FigSumSEperCellL4K10BerVaries}
\vspace*{-0.2cm}
\end{minipage}
\hfill
\noindent\begin{minipage}{0.49\textwidth}
\centering
\includegraphics[trim=0.5cm 0.0cm 0.5cm 0.7cm, clip=true, width=3.2in]{images/FigSumSEperCellL4K10M100.eps} \vspace*{-0.1cm}
\caption{CDF of SE per cell [b/s/Hz] with $L=4 ,K_{\max} = 10$, $M=200$ for the training phase, and $M=100$ for the testing phase. All users are in active mode with a probability $p=2/3$.}
\label{FigSumSEperCellL4K10M100}
\vspace*{-0.2cm}
\noindent \end{minipage}
\end{figure*}
\vspace*{-0.25cm}
\subsection{Convergence, Sum Spectral Efficiency, \& Power Consumption}
Fig.~\ref{FigConvg} shows the convergence of Algorithm~\ref{Algorithm:AlternatingApproach} for different activity probabilities. Fig.~\ref{FigConvg}a is for a system with $L=4, K_{\max} =5$. It demonstrates that the number of iterations to reach the stationary point varies when the activity probability of each user changes. For example, Algorithm~\ref{Algorithm:AlternatingApproach} needs an average of $400$ iterations to converge with the activity probability $1/3$, while it only needs $300$ iterations when all users are in active mode. As another example, Fig.~\ref{FigConvg}b shows the convergence of a system with $L=9, K_{\max} =10$. Comparing the two figures, we notice that the number of iterations needed to reach the stationary point does not vary significantly when increasing the network size. At iteration~$300$, the sum SE per cell is $99\%$ of the stationary point both with $L=4, K_{\max} =5$ and with $L=9, K_{\max} =10$.
Algorithm~\ref{Algorithm:AlternatingApproach} provides a local optimum to the sum SE optimization problem, but which local optimum that is found depends on the initialization.
One way to benchmark the quality of the obtained local optimum is to run the algorithm for many random initializations and take the best result.
Fig.~\ref{FigCDFDiffInitialization} shows the cumulative distribution function (CDF)
of the sum SE per cell obtained from Algorithm~\ref{Algorithm:AlternatingApproach} when using the best out of 1, 5, 20, or 40 different initializations. Each initial power coefficient is uniformly distributed in the range $[0, P_{l,k}]$. In comparison to one initialization, there are only tiny gains by spending more efforts on selecting the best out of multiple initializations. The largest relative improvement is when going from 1 to 5 initializations, but the average improvement is still less than $1\%$. Further increasing the number of initializations has very small impact on the sum SE. Hence, in the rest of this section, only one initialization is considered in the most figures, except Fig.~\ref{FigSumSEUSL}.
We show the pilot and data power coefficients produced by our proposed methods JPDPO and DPOO in Fig.~\ref{FigPowerL4K10} for the system with $L=4, K_{\max}=10,$ and $M=200$. All users has the activity probability $2/3$. Apart from the fact that 33\% of the users are inactive on the average, an additional $5\%$ of the users are rejected from service by JPDPO due to bad channel conditions, which leads to zero power when optimizing the sum SE. By utilizing JPDPO, we observe that an user in the active mode allocates $127$ mW to each data symbol on average, while that is $150$ mW for each pilot symbol. This $18\%$ extra power is to improve the channel estimation quality. Even though many data and pilot symbols spend full power $200$ mW to achieve the best SE, JPDPO provides $25\%$ and $36\%$ less power than FP. For DPOO, we are only optimizing the data power and each data symbol is allocated $124$ mW.
\vspace*{-0.5cm}
\subsection{Predicted Performance of PowerNet}
The CDF of sum SE per cell [b/s/Hz] is shown in Fig.~\ref{FigSEperCellL4K10Ber2p3} for a system with $L=4, K_{\max}=10$, and $M=200$. Each user has the activity probability $2/3$. The sum SE per cell predicted by PowerNet is almost the same as the ones obtained DPOO and it is $1.5\%$ less than by Algorithm~\ref{Algorithm:AlternatingApproach}. FDNN performs $11.6\%$ better than FP, but there is $12.9\%$ more to reach the performance of Algorithm~\ref{Algorithm:AlternatingApproach}. Fig.~\ref{FigPerUserSEL4K10Ber2p3} presents the prediction performance of per user SE for a four-cell system with $K_{\max}=10$ users. The SE obtained by PowerNet is very close to JPDPO with only about $1\%$ loss. Fig.~\ref{FigPerUserSEL4K10Ber2p3} also demonstrates that around $40\%$ of the users are out of service, in which case no power is allocated to the training and data transmission phases.
Fig.~\ref{FigSumSEperCellL9K10} shows the CDF of sum SE per user [b/s/Hz] for the system with $L=9, K_{\max} = 10$, and $M=200$, while the related case of per user SE is shown in Fig.~\ref{FigCDFPerUserRateL9K10}. All users have the activity probability $1$. FP provides the sum SE baseline of $23.26$ b/s/Hz which corresponds to a per user SE of $2.33$ b/s/Hz. FDNN can obtain $12.24\%$ better average SE than the baseline. In this scenario, a $4\%$ higher SE is achieved by optimizing both data and pilot powers, as compared to only optimizing the data powers. Even though the number of optimization variables is much larger than in previous figures, the average prediction error of PowerNet is still very low. The improvement of PowerNet over FP is up to $16.3\%$ for the sum SE, while it is $12.87\%$ for the per user SE. PowerNet yields $1.78\%$ better sum SE than JPDPO and the loss is only $2\%$ compared with JPDPO. These results prove the scalability of PowerNet. We emphasize that there are two main reasons why PowerNet outperforms FDNN: First, PowerNet can learn better special features from multiple observations of the large-scale fading tensors by extracting the spatial correlations among BSs based on different kernels. Second, the residual dense blocks can prevent the gradient vanishing problem effectively thanks to the extra connections between the input and output of each layer.
\vspace*{-0.25cm}
\subsection{Varying User Activity, Channel Models, and Data Label Effect}
In practice, the user activity probability will change over the day, thus it is important for PowerNet to handled this fact. Fig.~\ref{FigSumSEperCellL4K10Ber1p3} displays the CDF of the sum SE per cell [b/s/Hz] with $4$ cells, each serving $10$ users. In the training phase, each user has the activity probability $2/3$, while it is $1/3$ for the testing phase. Interestingly, PowerNet still predicts the pilot and data power coefficients very well. The sum SE per cell obtained by PowerNet is almost $99\%$ of JPDPO. Additionally, data power control is sufficient in this scenario since DPOO achieves $99\%$ of the sum SE that is produced by JPDPO. Fig.~\ref{FigSumSEperCellL4K10Ber5p6} considers a more highly-loaded system with the activity probability of each user in the testing phase being $5/6$. There is a $30\%$ gap between FP and JPDPO in this case. Furthermore, JPDPO brings $15\%$ the sum SE better than FDNN. PowerNet achieves about $98.4\%$ of what is produced by Algorithm~\ref{Algorithm:AlternatingApproach}.
The sum SE per cell [b/s/Hz] for a system with $L=4$, $K_{\max} =10$, and $M=200$ is displayed in Fig.~\ref{FigSumSEperCellL4K10BerVaries}. In the figure, each user has its own activity probability, which is uniformly distributed in the range $[0,1]$. FP yields the baseline average SE of $15.84$ b/s/Hz. Meanwhile, JPDPO produces the highest SE of $19.12$ b/s/Hz per cell, which is a gain of $20.71\%$. By only optimizing the data powers, DPOO loses $1.32\%$ in SE over JPDPO. Importantly, PowerNet predicts the power coefficients with high accuracy and the SE is very close to JPDPO with a loss of only $1.34\%$.
Therefore, we conclude that a single PowerNet can be trained and applied when the activity probability of users varies over time. Additionally, Fig.~\ref{FigSumSEperCellL4K10M100} displays the performance of a system where the number of antennas equipped at each BS in the testing phase is different from the training phase. It shows that PowerNet still provides very high prediction accuracy with the loss being only $1.30\%$. This indicates that PowerNet can be also applied in the scenarios where we may turn on and off antennas to improve energy-efficiency \cite{senel2019joint}.
To provide a sensitivity analysis, Fig.~\ref{FigSumSEperCellL4K10DiffChannels} shows the prediction accuracy of PowerNet when the large-scale fading follows different distributions in the training and testing phases. In particular, the large-scale fading coefficient of user~$t$ in cell~$l$ and BS~$i$ is defined in \eqref{eq:ShadowFading} when we train PowerNet. However, the testing phase assumes $\beta_{l,t}^i \mbox{[dB]} = -151.1 - 42.8 \log_{10} (d_{l,t}^i / 1 \mathrm{km}) + z_{l,t}^i, \forall l,t,i, $ as suggested by 3GPP \cite{LTE2010b}. PowerNet still yields very high sum SE per cell and the prediction loss is less than $2\%$ compared with JPDPO. It demonstrates that PowerNet achieves a good generalizability. We believe that this thanks to the random shadow fading realizations considered in the training phase. Meanwhile, Fig.~\ref{FigSumSEUSL} shows a zoomed-in version, where we have also trained PowerNet using the best of $40$ different initializations. At the $95\%$-likely, we observe an improvement of about $2.5\%$ over the supervised learning with using data labels from solving the optimization with one initial point. In particular, PowerNet trained using $40$ initializations outperforms JPDPO based on one initialization about $0.5\%$.
\begin{figure*}[t]
\begin{minipage}{0.49\textwidth}
\centering
\includegraphics[trim=0.2cm 0.0cm 0.5cm 0.7cm, clip=true, width=3.2in]{images/FigDiffChannelModel.eps} \vspace*{-0.1cm}
\caption{Performance of PowerNet by different large-scale fading models. The system has $L=4 ,K_{\max} = 10$, and $M=200$. Activity probability is $p=2/3$.}
\label{FigSumSEperCellL4K10DiffChannels}
\vspace*{-0.2cm}
\end{minipage}
\hfill
\noindent\begin{minipage}{0.49\textwidth}
\centering
\includegraphics[trim=0.2cm 0.0cm 0.5cm 0.7cm, clip=true, width=3.2in]{images/FigUnsupervisedLearning.eps} \vspace*{-0.1cm}
\caption{Performance of PowerNet by utilizing Remark~\ref{Remark:BestLabel}. The system has $L=4 ,K_{\max} = 10$, $M=200$. All users are in active mode with a probability $p=2/3$.}
\label{FigSumSEUSL}
\vspace*{-0.2cm}
\noindent \end{minipage}
\end{figure*}
\subsection{Runtime}
To evaluate the computational complexity, we implemented the testing phase in MatConvNet \cite{vedaldi2015matconvnet} and ran it on a Windows $10$ personal computer having the central processing unit (CPU) AMD Ryzen $1950$x $16$-Core with $3.40$ GHz and a Titan XP Nvidia GPU $12$~GB. Theorem~\ref{Theorem:IterativeAl} and its simplification version (DPOO) are implemented with the accuracy value $\epsilon$ in \eqref{eq:Stoping} being $0.01$ and our best efforts to optimize the implementations in Matlab environment. The average runtime is given in Table~\ref{tablerunningitme}. The algorithm in Theorem~\ref{Theorem:IterativeAl} gives the highest runtime among the considered methods.
For a system with $4$ cells, each serving maximum $5$ users, the runtime for Theorem~\ref{Theorem:IterativeAl} is $42.24$ ms, while it is $30.90$ ms if we only consider data powers as optimization variables. The proposed neural network is tested using the GPU or using only the CPU. For a system with $4$ cells, each serving $5$ users, the runtime when using the CPU is $2.99$~ms. If there are $9$ cells and $10$ users per cell, it requires approximately $5 \times$ more to obtain the solution than the system with $L=4, K_{\max} =5$. By enabling GPU mode, PowerNet can be applied for a nine-cell system ($L=9, K_{\max} =10$) with a runtime of $0.0283$~ms while taking about $0.018$~ms for a four-cell system. Hence, when using a GPU, the runtime is sufficiently low for real-time applications where each coherence interval may have a time duration of around $1$~ms and therefore require sub-millisecond resource allocation decisions.
\begin{table*}[t]
\caption{Average running time of different methods in millisecond.} \vspace*{-0.1cm} \label{tablerunningitme}
\centerline{
\begin{tabular}{|c|c|c|c|c|}
\hline
\diagbox[width=14em]{System Specifications}{Benchmark} & JPDPO (CPU) & DPOO (CPU) & PowerNet (CPU) & PowerNet (GPU) \\
\hline
$L=4,K_{\max}=5$ & $42.24$ & $30.90$ & $2.99$ & $0.0177$ \\
\hline
$L=9,K_{\max}=10$ & $491.08$ & $269.33$ & $14.90$ & $0.0283$ \\
\hline
\end{tabular}
}\vspace*{-0.2cm}
\end{table*}
\vspace*{-0.25cm}
\section{Conclusion} \label{Section:Conclusion}
This paper has constructed a framework for the joint pilot and data power control for the sum SE maximization in uplink cellular Massive MIMO systems with a varying number of active users. This is a non-convex problem but we proposed a new iterative algorithm, inspired by the weighted MMSE approach, to find a stationary point.
The joint pilot and data power optimization obtains 30\% higher sum SE than equal power transmission in our simulation setup. We have used the proposed algorithm to also construct a deep neural network, called PowerNet, that predicts both the data and pilot powers very well, leading to less than 1\% loss in sum SE in a symmetric multi-cell system serving 90 users.
PowerNet uses only the large-scale fading coefficients to predict the transmit power, making it scalable to Massive MIMO systems with an arbitrarily large number of antennas. It has a runtime that is far below a $1$\,ms, meaning that it enables real-time power control in systems where new power control coefficients need to be obtained at the millisecond level due to changes in the scheduling decisions or user mobility. Importantly, PowerNet is designed and trained such that a single neural network can handle varying number of users per cell, which has not been the case in prior works. This demonstrates the feasibility of using deep learning for real-time power control in Massive MIMO, while still attaining basically the same performance as when solving the original problems using optimization theory. Since PowerNet can be easily implemented on standard specialized hardware that is developed for CNNs, while an efficient implementation of classical optimization algorithm requires the design of dedicated hardware circuits.
| {'timestamp': '2020-05-28T02:06:34', 'yymm': '1901', 'arxiv_id': '1901.03620', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03620'} | arxiv |
\section{ Overview and Contribution}
The main novelty of this work is the combination of anticipation of current action with forecasting the next unseen action by learning from the past, using an accumulating memory.
Forecasting a next unseen action is challenging and it requires to anticipate to an early stage the recognition of the current action. Further, it requires to discriminate plausible future actions filtering out those that are implausible. Finally, it requires to understand the context of the current action, and a relevant part of the context is the past, for mastering action evolution.
To solve these problems we introduce a new end-to-end Anticipation and Forecasting Network (AFN) with memory to dynamically learn from past observations. The network schema is illustrated in Figure \ref{fig:schema}. AFN anticipates the recognition in an untrimmed video from 6 frames scattered in one second, examining several scenes and body elements, including motion and body pose for the current action and the action history. We fix the anticipation to one second to cope with the starting time uncertainty. Further, a relevant component of AFN, besides the memory, is a ProtoNet \cite{snell2017protonets} predicting which activity an action belongs to. Finally, based on the current action anticipation, AFN forecasts the next action, independently of the time horizon.
We illustrate our results on different baselines, considering all the newly introduced aspects. In particular, the anticipation is confronted with other methods on two datasets used by several approaches, namely JHMDB \cite{Jhuang:ICCV:2013} and UCF101 \cite{UCF101}. Forecasting is shown on four datasets Breakfast\cite{Kuehne12}, Charades \cite{sigurdsson2016hollywood}, CAD120 \cite{koppula2013dataset} and MPII cooking dataset \cite{rohrbach2012database}. We show that for both anticipation and forecasting, AFN outperforms the state of the art on these datasets. In the lack of a specific metric, we have introduce appropriate measures, detailed in Section \ref{sec:results}.
\section{Next action label}\label{sec:intro}
In this supplementary material we provide an evaluation for the proposed next action forecasting framework. In particular, we present confusion matrices for the datasets Charades, Breakfast, CAD120 and MPII-kitchen. We also provide an accuracy according to the time distance between the anticipation of the current action and the starting time of the next action (see also Table 6 in the paper). To produce the confusion matrices we specifically recorded the false positives. For true and false negatives we considered the ``action'' {\em null} in CAD120, the {\em background} in the dataset MPII-Kitchen, denoting when no activity is detected. Similarly for the dataset Breakfast we considered the {\em SIL} action specifying the start and end of an action.
The {\em time to next action} accuracy graph shows the time left to the next action start. To illustrate this accuracy value we have selected actions from the datasets with highest time variance defined as follows. Let $S$ be the set of reference (the test set), $A(t)$ be the label of an action,
and let $\Delta A(t)= A'(t)-A(t^+)$, with $A'$ a label of any of the actions following $A$ in the set considered, and $(t^+)$ the second at which $A$ is anticipated. Let $\mu_A = \frac{1}{N}\sum_{i=1}^N \Delta A(t_i)$ with $A(t_i)$ the same action $A$ with $t_i$ varying in all occurrence of $A\in S$. We say that $A$ has a high variation (with respect to forecasting and anticipation) if $\mu_{A}/\mu_{B}>\lambda$ for some $\lambda$ experimentally established for each set, and for a number of other actions $B$ in $S$ (where the number depends on $\lambda$). When $\Delta A(t)$ is negative then there is no next action $A'$. This variation is relevant because it shows if accuracy in forecasting is independent of the subject performing an action and the circumstances in which it is performed.
All evaluations are done on the test sets.
\subsection{CAD120 Dataset}
CAD120 dataset \cite{koppula2013dataset} has 120 videos annotated with 10 actions and 10 high-level activities.
Note that the actions are the same for all the activities. This is particularly interesting for the ProtoNet component of AFN, thus we show also the confusion matrix for the activities of CAD120.
Figure \ref{fig:confCAD} shows on the left the confusion matrix, including the {\em null} action and on the right it shows the classification by the ProtoNet component of AFN. Figure \ref{fig:CAD-time} shows the next action forecasting accuracy with respect to the time distance between the current action anticipation and the next action start. Here we considered all the actions.
\subsection{MPII-cooking dataset}
The MPII cooking activities \cite{rohrbach2012database} dataset consists of 65 actions recorded from 12 subjects.
For this dataset there are 44 videos at high resolution, with a framerate of 29.4hz. The confusion matrix for the next activity prediction is illustrated in Figure \ref{fig:confMPII}. True positive are illustrated with a jet map and small digits indicate the accuracy of correct predictions. In white the false positive. To record false negatives we used the fictitious action {\em background} included in the dataset annotations.
Figure \ref{fig:time-MPII} shows the accuracy of next action forecasting according to the time distance between the first second of the current action to the start point of the next action. We considered the 23 actions, of the 65 ones, with highest variation for $\lambda=2$.
Videos in MPII dataset are acquired at 29.4Hz. According to the framerate there is a $1\%$ of cases in which the time lapse between the current-action-start and the next-action-start is less than a second, this $1\%$ is collected as an error for AFN.
\subsection{Breakfast Dataset}
The Breakfast dataset \cite{Kuehne12}, in its rough version has 48 actions occurring in 10 activities (see Figure 6 in the submitted paper). Figure \ref{fig:ConMatBreakfast} shows the complete confusion matrix, including the {\em SIL} operator, considered for recording false negative. For breakfast it amounts to forecast the existence of a next action, while the activity should have been concluded.
In Breakfast dataset, framerate is 15Hz, and the time lapse between the current action anticipation and the next action start has a mean value of $5.1$ seconds. On the other hand a less than a second time lapse between the current action start and the next action start occurs only in $4\%$ of all the videos (77 hours of videos). We consider this amount an error for our framework. As we did for MPII-kitchen also in this case we considered the actions with highest variance to evaluate the accuracy on the time distance with respect to the next action start, here we choose $\lambda=0.82$. Accuracy for time distance is illustrated in Figure \ref{fig:time-Breakfast}.
\subsection{Charades Dataset}
The Charades dataset \cite{sigurdsson2018} is a very rich dataset with 157 action classes, objects, affordances and descriptions. Because all actions are specified with respect to a context scene we considered the context scenes as the high level activities for the ProtoNet. Each video has on average 6.8 actions and several actions are considered co-occurring, such as closing-opening a window, so to obtain a sequence we had to adapt the time intervals. For Charades we used the proposed separation in training and test. Figure \ref{fig:ConfMatCharades} shows the confusion matrix for a subset of 48 actions for visibility reasons (chosen randomly over the set of 156 actions). For an action sequence completion we have added an {\em end}, not shown in the confusion matrix.
Similarly, we have chosen a $\lambda = 0.94$ to analyze the accuracy with respect to time distance to next action, illustrated in Figure \ref{fig:time-Charades}.
\begin{figure*}
\centering
\includegraphics[width=0.43 \linewidth]{ConfusionMatrixCad120}
\includegraphics[width=0.53 \linewidth]{ConfusionMatrixCad120Activities}
\caption{On the left the Confusion Matrix for CAD120 dataset. Values less than 0.8 are not shown, the heat color-map is {\em jet}. The {\em null} action is recorded to show false negatives. On the right Confusion Matrix for CAD120 Activities. }\label{fig:confCADActivities}\label{fig:confCAD}
\end{figure*}
\typeout{*********************** MPII Dataset**********************}
\begin{figure*}
\centering
\includegraphics[width=0.98 \linewidth]{timeGraphCAD}
\caption{Accuracy with respect to time distance between current action anticipation to next action start for dataset CAD120. Time is computed according to videos framerate.} \label{fig:CAD-time}
\end{figure*}
\typeout{*********************** MPII Dataset**********************}
\begin{figure*}
\centering
\includegraphics[width=0.98 \linewidth]{ConfusionMatrixMPII}
\caption{Confusion matrix for the MPII-kitchen dataset. The heat-map is {\em jet}, values less than $1$ are not shown.} \label{fig:confMPII}
\end{figure*}
\begin{figure*}
\centering
\includegraphics[width=0.98 \linewidth]{timeGraphMPII}
\caption{Accuracy trends for next action prediction for MPII-kitchen dataset, considering the 23 actions with greatest variance over the 64 in the dataset. The time line indicates the time distance to the next action, for each occurrence of the indicated action, in the video dataset. Framerate is 29.4Hz} \label{fig:time-MPII}
\end{figure*}
\typeout{*************** Breakfast dataset***************}
\begin{figure*}
\centering
\includegraphics[width=0.98 \linewidth]{ConfusionMatrixBreakfast}
\caption{Confusion matrix for the Breakfast dataset. The heat-map is {\em jet}, values less than $1$ are not shown. The {\em SIL} actions is recorded for false negatives.} \label{fig:ConMatBreakfast}
\end{figure*}
\begin{figure*}
\centering
\includegraphics[width=0.98 \linewidth]{timeGraphBreakfast}
\caption{Accuracy trends for next action prediction, for the Breakfast dataset. The time line indicates the time distance to the next action, for each occurrence of the indicated action, in the video dataset.} \label{fig:time-Breakfast}
\end{figure*}
\typeout{*************** Charades***************}
\begin{figure*}
\centering
\includegraphics[width=0.98 \linewidth]{ConfusionMatrixCharades}
\caption{Confusion matrix for the CHARADES dataset. The heat-map is {\em jet}, values less than $1$ are not shown. } \label{fig:ConfMatCharades}
\end{figure*}
\begin{figure*}
\centering
\includegraphics[width=0.98 \linewidth]{timeGraphCharades}
\caption{Accuracy trends for next action forecasting, in CHARADES dataset. The codes for actions are those used in CHARADES since action names are often very long. Here the codes are used to avoid clumsiness.} \label{fig:time-Charades}
\end{figure*}
\typeout{*************** biblio***************}
{\small
\section{Introduction}\label{sec:intro}
\input{intro}
\typeout{*********************** RELATED**********************}
\section{Related Work}\label{sec:related}
\input{related}
\section{Anticipation and Forecasting Network}\label{sec:recognition}
\input{AFN}
\typeout{*************** Forecasting***************}
\input{recognition}
\subsection{Activities embedding}\label{sec:pred}
\input{prediction}
\typeout{*************** Results***************}
\section{Results}\label{sec:results}
\input{results}
{\small
\subsection{Input}\label{sec:input}
For the video datasets of activities taken into account, activities often allocate sequences of different actions, see Section \ref{sec:results} for details. Therefore,
given all the videos and activities taken from a chosen dataset, the input batch for a single run of the AFN network collects videos both considering a number of activities and of actions. More specifically, we consider a dataset as
\begin{equation}
{\mathcal D} =\{A_{j}{=}(a_{j,1},\ldots,a_{j,m}) | j{=}1,\ldots,N \mbox{ and } m{>}0\}
\end{equation}
Where $A_{j}$ is an activity from a set of $N$ activities in the dataset ${\mathcal D}$ and the $a_{j,k}$ are the actions the activity $A_{j}$ might be decomposed into. For each activity $A_{j}$ there is a varying number of videos available. The input batch to AFN is formed as follow. First we sample randomly from all the videos of all the activities in ${\mathcal D}$ a fixed number $\xi$ of videos, resulting in a sample of $K$, $K<\xi$ of different activities. Further, we sample a segment of $6$ RGB frames scattered on a time lapse of one second for each video.
From the sampled RGB frames we compute two heat maps of the human pose (see \cite{cao2017realtime}): one for the human joints and the other for the human limbs. We compute also the optical flow for each frame. This information is stacked as four more channels in addition to the RGB ones. Finally, all six frames, for each video, are collected into a single tensor as follows:
\begin{equation}\label{eq:input}
\begin{array}{l}
X_{j,i}(t_i){=} \pi(V_{j,i}(t_i)), \ t_i{\sim} Unif(0,T_i), i{=}1,{\ldots},\xi\\
\hspace*{15mm} T_i {=} length(V_{j,i}) \mbox{ in seconds}\ , j=1,{\ldots},K \\
\end{array}
\end{equation}
\noindent Here $\pi$ is the above described sampling and preprocessing of the $6$ frames sample, $V_{j,i}$ denotes the $i$-th video of $A_j$, $j=1,\ldots,K$, and $t_i$ is the time index, randomly sampled from a uniform distribution in the interval $[0,T_i]$, with $T_i$ the length of the video $V_{j,i}$, in seconds. Therefore, an input batch is formed by the tensors $X_{j,i}$. In the following when we focus on a single tensor, we drop the indexes both from $X$ and from $t$.
\subsection{Internal State Memory}\label{sec:memory}
To allow AFN to take into account the history of the whole previous sequence we introduce an Internal State Memory (ISM), which stores the internal states of the RNN network with {\em lstm} cells \cite{hochreiter1997} (indicated, resp., as ISM and $q_2$ in Figure \ref{fig:schema}). In this way every computation takes as input a single sample and the internal state corresponding to the previous second.
For every video in the dataset, a state vector $\mathbf{v} \in S^{T\times512}\subseteq {\mathbb R}^{T\times 512}$
is defined as:
\begin{equation}\label{eq:states}
\mathbf{v}=
\begin{pmatrix}
{\bf s}(0)\\
\vdots\\
{\bf s}(T)
\end{pmatrix}
\end{equation}
Here ${\bf s}(t)=({\bf h}(t)^{\top},\mathbf{c}(t)^{\top})^{\top}$, $t \in [0,T]$, are the $q_2$ states. Given $t$ we define ${\bf s}(t{-}1)$ as:
\begin{equation}
{\bf s}(t{-}1) =
\left\{
\begin{array}{ll}
\mathbf{0} & \mbox{if } J(t)=0 \\
{\bf s}(t{-}1)^{J(t)} & \mbox{otherwise}
\end{array}
\right.
\end{equation}
Here $J(t)$ denotes the number of times that $t$ was sampled up to the current training step.
Given the preprocessed input $X(t)$ and the internal state ${\bf s}(t{-}1)$ the $q_2$ component produces, beside the outputs, a new internal state ${\bf s}(t)^{J(t)}$. This new state is then used to update the states vector $\mathbf{v}$ (see eq. \ref{eq:states}).\\
The collection of all the state vectors forms the ISM.
Note that at inference time, samples are taken sequentially.
\subsection{Anticipation and next action prediction}
The first component of AFN are the 5 convolutional layers of C3D \cite{tran2015learning}, denoted $q_{0}$, in Figure \ref{fig:schema}. This $q_{0}$ component computes a feature tensor taking $X(t)$ (see eq. \ref{eq:input}) as input:
\begin{equation}\label{eq:M}
M(t) = q_{0}(X(t)).
\end{equation}
The tensor computed by $q_{0}$ has size ($7\times 7\times 512$) and is further reduced in size by a fully connected network $fc_{k}$, where $k$ indicates the network layers, here $k=2$.
\begin{equation}\label{eq:L}
L(t) = fc_k(M(t))
\end{equation}
The next component is $q_{2}$, introduced in \S \ref{sec:memory}, which computes the vector:
\begin{equation}\label{eq:nextstate}
{\bf s}(t) = (\mathbf{h}(t)^{\top},\mathbf{c}(t)^{\top})^{\top} = q_{2}(L(t),{\bf s}(t{-}1))
\end{equation}
\noindent
Here ${\bf s}(t)$ and ${\bf s}(t{-}1)$ are $q_2$ states and the way they are selected from the ISM is described in the previous paragraph \ref{sec:memory}.
At this point we introduce an advisory component $q_1$ supplying $q_2$ output with further information. This information is collected by a fully connected network, which learns the weights used to dynamically influence ${\bf h}(t)$.
More precisely, these weights are defined as follows:
\begin{equation}\label{eq:weights}
W(t) = vec^{-1}(fc_k([L(t), {\bf s}(t{-}1), \mathbf{u}(t)]))
\end{equation}
\noindent
Here $L(t), {\bf s}(t{-}1), \mathbf{u}(t)$ are concatenated, $fc_k$ is a fully connected layer with $k=1$, $L(t)$ is the tensor obtained in eq. \ref{eq:L} and ${\bf u}(t)$ is the latent vector obtained by the component $q_1$. The component $q_1$ is a prototypical network, detailed in \S \ref{sec:pred}, which predicts the activity the current input belongs to, hence it provides relevant information, restricting the search space for the final classification. The notation $vec^{-1}$ used in eq. \ref{eq:weights} indicates the inverse of the vectorization operator, namely $vec^{-1} : \mathbb{R}^{nm} \to \mathbb{R}^{m \times n}$.
\begin{figure}
\centering
\includegraphics[width=0.45 \textwidth]{figs/loss_acc}
\caption[]{Training loss and accuracy per epochs.}
\label{fig:accuracies}
\end{figure}
The weight matrix $W$ of size $256 \times 256$ is finally multiplied by the $q_2$ output ${\bf}(t)$, obtaining the vector ${\bf w}(t)$:
\begin{equation}
{\bf w}(t) = W(t){\bf h}(t)
\end{equation}
The last classification component is $q_{3}$, anticipating the current action as follows:
\begin{equation}\label{eq:finalActual}
{\bf y}_{now}(t) = q_{3}({\bf w}(t)) = \sigma(fc_k(\max(0, {\bf w}(t) + {\bf b}_{now})))
\end{equation}
where $\sigma(x_j)= e^{x_j}/\sum\limits_{j=0}^K e^{x_j}$ is the softmax, ${\bf b}_{now}$ is the bias, and $K$ are the action classes.
Finally, ${\bf y}_{now}(t)$ and ${\bf w}(t)$ are elaborated by a secondary fully connect layer $fc_k$ with $k=1$ to predict the next action ${\bf y}_{next}$. This is possible since the vector ${\bf w}(t)$ keeps both the information of the current input $X(t)$ (see eq. \ref{eq:input}) and the information of the previous actions, due to the interaction between the memory and $q_2$. The current action classification vector adds up these information to predict the next action:
\begin{equation}\label{eq:next}
{\bf y}_{next}(t) = \sigma(fc_k([\max(0, {\bf w}(t) + {\bf b}_{next}), {\bf y}_{now}(t)]))
\end{equation}
To speed up the contribution of the convolutional layers of $q_0$ to the optimization, we define a loss function taking into account a direct $M(t)$ classification (see eq. \ref{eq:M}):
\begin{equation}
{\bf aux}(t) = \sigma(fc_k(M(t)))
\end{equation}
\noindent
Here $fc_k$ is a fully connected layer with $k=3$.
Having defined the output of AFN we illustrate the cross entropy loss function on the three outputs, namely $\mathcal{L}_1$ on ${\bf y}_{now}$, $\mathcal{L}_2$ on ${\bf y}_{next}$ and $\mathcal{L}_3$ on ${\bf aux}$.
\begin{equation}\label{eq:L_actual}
\mathcal{L}_1(t) = - \sum_{i} {\bar{y}_{i}(t)} \log ({{y_{now}}_i(t)})\\
\end{equation}
\begin{equation}\label{eq:L_next}\
\mathcal{L}_2(t) = - \sum_{i} {{\hat{y}}_{i}(t)} \log ({{y_{next}}_i(t)})
\end{equation}
\begin{equation}\label{eq:L_aux}
\mathcal{L}_3(t) = - \sum_{i} {\bar{y}_{i}(t)} \log ({{aux}_i(t)})
\end{equation}
Here $\bar{y}$ and $\hat{y}$ are the target vectors, respectively for the current action and the next, and $i$ is the $i$-th element of the corresponding vector.
The total loss is obtained by combining the above loss function as follow:
\begin{equation}\label{eq:L_tot}
\begin{split}
\mathcal{L}_{tot}(t) & = \alpha(t^*)((1-\beta(t^*))\mathcal{L}_1(t)+\beta(t^*)\mathcal{L}_2(t)) \\
& + (1-\alpha(t^*))\mathcal{L}_3(t)
\end{split}
\end{equation}
Here $t^*$ is the previous training step, $\alpha$ is the accuracy measured on the auxiliary classification ${\bf aux}$, and $\beta$ is the accuracy computed on the current classification ${\bf y}_{now}$.
The accuracy parameters $\alpha$ and $\beta$ combine $\mathcal{L}_1$, $\mathcal{L}_2$ and $\mathcal{L}_3$ dynamically, according to the performances reached by the network at the previous training step $t^*$.
\noindent
The following equation illustrates how $\mathcal{L}_{tot}$ changes in four key steps of the training process, where $\epsilon$ is a small positive value:
\begin{equation}\label{eq:loss_dynamic}
\mathcal{L}_{tot}(t) =
\left\{
\begin{array}{ll}
\mathcal{L}_3(t) & \mbox{if } \alpha \in [0, \epsilon]\mbox{ and }\beta \in [0, \epsilon] \\
\\
\frac{1}{2}(\mathcal{L}_1(t) + \mathcal{L}_3(t)) & \mbox{if } \alpha \in [\frac{1}{2} - \epsilon, \frac{1}{2} + \epsilon]\mbox{ and }\\
& \beta \in [0, \epsilon] \\
\\
\frac{1}{2}(\mathcal{L}_2(t) + \mathcal{L}_1(t)) & \mbox{if } \alpha \in [1 - \epsilon, 1]\mbox{ and }\\
& \beta \in [\frac{1}{2} - \epsilon, \frac{1}{2} + \epsilon] \\
\\
\mathcal{L}_2(t) & \mbox{if } \alpha \in [1 - \epsilon, 1]\mbox{ and }\\
& \beta \in [1 - \epsilon, 1] \\
\end{array}
\right.
\end{equation}
The parameters $\alpha$ and $\beta$ in eq. \ref{eq:L_tot} enforce the optimization of the convolution component $q_{0}$ in the early training steps, when both $\alpha$ and $\beta$ are close to $\epsilon$ (first line in eq. \ref{eq:loss_dynamic}). On the other hand as they both reach max values (last line in eq. \ref{eq:loss_dynamic}), they push the optimization toward ${\bf y}_{next}$. In the intermediate steps (second and third line in eq. \ref{eq:loss_dynamic}) $\alpha$ and $\beta$ favor the optimization of ${\bf y}_{now}$. Clearly, the transitions among these steps are smooth and we can note that $\mathcal{L}_3$ optimization is gradually ignored as $\alpha$ increases. Similarly, $\mathcal{L}_1$ optimization is steadily disregarded as soon as $\beta$ increases. The graph in Figure \ref{fig:accuracies} illustrates the above considerations.
\subsection{Datasets Selection}\label{ssec:dataset}
For {\em action anticipation} we have selected the two datasets common to most of the recent works on early action recognition, namely {\bf JHMDB} and {\bf UCF101} datasets. JHMDB \cite{Jhuang:ICCV:2013} is composed by 928 videos of 21 selected actions out of the 51 of the original HMDB \cite{kuehne2011hmdb}.
\textbf{UCF101} \cite{UCF101} has 101 action categories for 430 hours of videos.
Experiments on {\em action forecasting}, are done on four datasets: {\bf Breakfast} \cite{Kuehne12}, {\bf Charades} \cite{sigurdsson2016hollywood}, {\bf CAD120} \cite{koppula2013dataset} and {\bf MPII cooking dataset} \cite{rohrbach2012database}.
The Breakfast \cite{Kuehne12} dataset has 10 activity categories over 48 actions. The dataset consists of 712 videos taken by 52 different actors.
\noindent
Charades dataset \cite{sigurdsson2016hollywood} combines 40 objects and 30 actions in 15 scenes generating a number of 157 action classes for 9848 videos. To experiment on Charades dataset, we defined the contexts as the activities, slightly modifying the temporal annotations, since we do not consider objects. For example, living-room-activity collects the actions performed in a living room.
MPII cooking activities dataset \cite{rohrbach2012database} has 65 action classes for 14 dishes preparation activities, performed by 12 participants. There are 44 videos for about 8 hours of videos.
\subsection{Implementation Details} The whole set of experiments has been performed on two computers, both equipped with an i9 Intel processor and 128GB of RAM, and with $4$ NVIDIA Titan V. AFN is developed using Tensorflow $1.11$.
\noindent
{\bf Protocols} For training and testing our system, we used in turn all the datasets, fixing $60\%$ for training, $30\%$ for testing and $10\%$ for validation, where not already defined by the dataset. We did not select the actors to separate training, validation and test, since in some datasets not all actions are performed by each actor. For optimization we used Adam \cite{kingma2014adam} and gradient clipped to $1$. We trained the model with different batch sizes, mainly to cope with the ProtoNet component of the network, $q_1$. The final size was $25$, due to the large tensors (see eq. \ref{eq:input}). The image size at input is $112{\times} 112$. We used a dynamic learning rate, starting with $10^{-4}$, decreasing it of a factor of $0.9$ every $3k$ steps. We used dropout $0.6$ only at the convolutional layers of $q_0$. The training speed is roughly 11 steps per sec. Having $45$ Epochs, each of $10k$ steps, the overall training time is about $43k$ seconds.
\input{SOTA_table}
\input{BonnTable}
\input{tabellaMPII}
\input{SensitivityTable}
\input{AblationTable}
\subsection{Comparison with the State-of-the-Art}
The comparison with the state of the art has been done for both anticipation and forecasting. Note that, as AFN uses softmax, accuracy is simply frequency count of correct predictions out of all predictions.
In order to make the confrontation as fair as possible for all the works taken into account, we have considered different measures for both anticipation and forecasting.
\vskip 0.3 \baselineskip
\noindent
{\bf Action anticipation}
For action anticipation we considered the datasets JHMDB \cite{Jhuang:ICCV:2013} and UCF101\cite{UCF101} as discussed in \S \ref{ssec:dataset}. Results are shown in Table \ref{tab:anticipation}. Anticipation values are defined as:
\begin{equation}
\Delta^{-} = 1/\mu_{\ell}(V)
\end{equation}
where $\Delta^{-}\in \{0.1,0.2,0.5\}$ is the anticipation value and $\mu_{\ell}(V)$ is the mean length of selected video $V$, for the specific dataset. In this way, we can relate the anticipation values chosen by the cited authors with our fixed anticipation value of 1 sec., which is independent of the video length.
Video length is shown in the first column, anticipation time in the second column. Footnotes in the table specify the number of activities in the dataset considered by the cited approach. In bold are the best in class. We can see that AFN outperforms all the approaches on anticipation, according to the displayed measure.
\noindent
{\bf Action forecasting}
Here we compare with two methods: \cite{yazanwill2018} on the Breakfast dataset, and \cite{mahmud2017joint} on the MPII dataset. No works on action forecasting are based on the Charades and CAD120 datasets, as far as we know.
Table \ref{tab:Bonn} confronts with \cite{yazanwill2018} and both Table \ref{tab:MPII1} and Table \ref{tab:MPII2} with \cite{mahmud2017joint}.
To compare with Farha {\em et Al.} \cite{yazanwill2018} on the Breakfast dataset we consider the $20\%$ and the $30\%$ of the video length as observation. This given we forecast over an horizon of $10\%$ of the remaining video. The comparison takes into account both the RNN-based anticipation and the CNN-based anticipation proposed in \cite{yazanwill2018}. We have chosen these forecasting measures, since we forecast precisely the next action, while \cite{yazanwill2018} forecast all actions up to the video end. Though this is done at the cost of an accuracy significantly lower than ours, as the table shows.
Comparisons with \cite{mahmud2017joint} are shown in Table \ref{tab:MPII1} and in Table \ref{tab:MPII2}.
In Table \ref{tab:MPII1} we compare precision and recall with respect to next action forecasting, considering only the top 1.
In Table \ref{tab:MPII2}, on the other hand, we compare the accuracy with respect to the number of past recognized actions.
We observe that the improvement is between $11\%$ and $13\%$ percent in the first comparison and from about $6\%$ up to $17\%$ in the second comparison, as as the past sequence length increases.
\begin{figure}[t!]
\centering
\includegraphics[width=0.80 \linewidth]{figs/act_confmat}
\caption{Confusion matrix for the Activities in Breakfast. Values less than $1$ are dropped.}\label{fig:confM}
\end{figure}
\subsection{Evaluation of AFN}\label{ssec:eval}
We evaluate AFN specifically on next action forecasting, since for anticipation all the datasets considered are covered in Table \ref{tab:anticipation}.
The confusion matrix shown in Figure \ref{fig:confM} shows the average accuracy of actions occurring in activities, for Breakfast dataset. In Table \ref{tab:NAF} we show the accuracy for next action forecasting when jumping into an activity video sequence. We consider four cases: 1) at the beginning of an action, namely when the timeline horizon to the next action is between $90\%$ and $100\%$, 2) after the $90\%$ but before the middle of the action; 3) after the middle, before the last $1\%$, and 4) at the end of the current action. We can see that
the accuracy of the prediction does not significantly improve with respect to the distance from next action. On the other hand the accuracy drops to zero when the selected sample is in between the current and next action, since AFN discards these cases, see also Figure \ref{fig:tempiazioni}. The best dataset for our experiments turns out to be Breakfast.
Ablation experiments are shown in Table \ref{tab:abx}. Here, we can observe the accuracy of AFN when, in turn, the components $q_1$, $q_4$, and the auxiliary connection to the convolutional layers of $q_0$, indicated in the table by ${\mathcal L}_3$, are removed.
\input{afnValue}
More results are shown in the supplementary materials.
| {'timestamp': '2019-01-15T02:00:55', 'yymm': '1901', 'arxiv_id': '1901.03728', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03728'} | arxiv |
\section{Introduction}
For a graph $H$, the Ramsey number $r(H)$ is the smallest integer $n$ such that
in any two-coloring of edges of the complete graph $K_n$, there is a monochromatic copy of $H$.
The size-Ramsey number $\rf(H)$, introduced by Erd\H os, Faudree, Rousseau, and Schelp~\cite{Erdos1978TheSRN},
is the smallest integer $m$ such that there exists a graph $G$ with $m$ edges such that
for any two-coloring of the edges of $G$ one will always find a monochromatic copy of $H$.
There are many interesting variants of the usual Ramsey function.
One important concept is the \emph{induced Ramsey number} $\ri(H)$,
which is the smallest integer $n$ for which there is a graph $G$ on $n$ vertices
such that every edge two-coloring of $G$ contains an induced monochromatic copy of $H$.
Erd\H os~\cite{Erdos75problemsand} conjectured the existence of a constant $c$
such that every graph $H$ with $n$ vertices satisfies $\ri(H)\le 2^{cn}$,
which would be best possible.
In 2012, Conlon, Fox and Sudakov~\cite{Conlon2012} proved that there is a constant $c$
such that every graph $H$ with $n$ vertices satisfies $\ri(H)\le 2^{cn\log n}$.
The proof uses a construction of explicit pseudorandom graphs, as opposed to
random graph construction techniques used by previous attempts.
For more on the topic see the excellent review by Conlon, Fox, and Sudakov~\cite{Conlon2015RecentDI}.
The induced size-Ramsey number $\rsif(H)$ is an analog of the size-Ramsey number:
we define $\rsif(H)$ as the smallest integer $m$ such that there exists a graph $G$ with $m$ edges
such that for any two-coloring of the edges of $G$ there is always a monochromatic copy of $H$.
In 1983, Beck~\cite{Beck1983size}, using probabilistic methods, proved the surprising fact that
$\ro(P_n)\le cn$, where $P_n$ is a path of length $n$ and $c$ is an absolute constant.
An even more surprising result came by Haxell, Kohayakawa, and \L uczak~\cite{Haxell1995InducedCycles},
who studied the induced size-Ramsey number of cycles showing that $\rsif(C_n)=O(n)$.
However, the proof uses random graph techniques and regularity lemma
and does not provide any reasonably small multiplicative constant.
\smallskip
In this paper, we study the online variant of size Ramsey number which was introduced independently
by Beck~\cite{Beck1993AchievementsGA} and Kurek and Ruci\'nski~\cite{Kurek2005TwoVariants}.
The best way to define it is in term of a game between two players, Builder and Painter.
An infinite set of vertices is given, in each round Builder draws a new edge and immediately
it is colored by Painter in either red or blue.
The goal of Builder is to force Painter to obtain a monochromatic copy of a fixed graph $H$ (called \emph{target graph}).
The minimum number of edges which Builder must draw in order to obtain such monochromatic
copy of $H$, assuming optimal strategy of Painter, is known as the online Ramsey number $\ro(H)$.
The graph $G$, which is being built by Builder, is called \emph{background graph}.
The online Ramsey number is guaranteed to exist because Builder can simply
create a big complete graph $K_{r(H)}$, which by Ramsey theorem trivially contains a monochromatic copy of $H$.
The winning condition for Builder is to obtain a copy of the target graph $H$.
However, there are more different notions of ``being a copy''.
This leads us to the following two definitions.
\begin{itemize}
\item The \emph{online Ramsey number} $\ro(H)$ is the minimum number of rounds of the Builder-Painter game Builder has
a strategy to obtain a monochromatic subgraph $H$.
\item The \emph{(strongly) induced online Ramsey number} $\ro_{ind}(H)$ is the minimum number of rounds of the Builder-Painter game
such that Builder has a strategy to obtain a monochromatic induced subgraph $H$ in $G$.
\end{itemize}
If there is no strategy of Builder to obtain the copy of $H$, we define the respective number as $\infty$.
Note that for any graph $H$ we have $\ro(H) \leq \ro_{ind}(H)$.
Also, note that the induced online Ramsey numbers provide lower bounds on the induced size-Ramsey numbers.
In 2008 Grytczuk, Kierstead and Pra{\ell}at~\cite{Grytczuk2008OnlineRN} studied the online Ramsey number of paths,
obtaining $\ro(P_n)\le 4n-3$, where $P_n$ is a path with $n$ edges, providing an interesting
counterpart to the result of Beck~\cite{Beck1983size}.
Also, the result by Haxell, Kohayakawa, and {\L}uczak.~\cite{Haxell1995InducedCycles} on induced size-Ramsey number
of cycles naturally bounds the online version as well, but with no reasonable multiplicative constant.
In this paper, we study the induced online Ramsey number of paths, cycles, and trees.
The summary of the results for paths and cycles is as follows.
\begin{theorem}
Let $P_n$ denote the path of length $n$ and let $C_n$ denote a cycle with $n$ vertices.
Then
\begin{itemize}
\item $\ro_{ind}(P_n) \le 28n-27$,
\item $\ro_{ind}(C_n) \le 367n-27$ for even $n$,
\item $\ro_{ind}(C_n) \le 735n-27$ for odd $n$.
\end{itemize}
\end{theorem}
A \emph{spider} $\sigma_{k,\ell}$ is a union of $k$ paths of length $\ell$ sharing
exactly one common endpoint. We further show that $\ro_{ind}(\sigma_{k,\ell}) = \Theta(k^2\ell)$
and $\ro(\sigma_{k,\ell}) = \Theta(k^2\ell)$.
Although we know that $\ro(H)\le\rf(H)$,
it is a challenging task to identify classes of graphs for which there
is an asymptotic gap between both numbers.
For complete graphs, Chv\'atal observed (see \cite{Erdos1978TheSRN}) that $\rf(K_t)=\binom{r(K_t)}{2}$.
The basic question, attributed to R\"odl (see \cite{Kurek2005TwoVariants}),
is to show $\lim_{t\to\infty} \ro(K_t)/\rf(K_t)$, or put differently, to show that $\ro(K_t) = o(\binom{r(K_t)}{2})$.
This conjecture remains open,
but in 2009 Conlon~\cite{Conlon2009OnlineRN} showed there exists $c>1$ such that for infinitely many $t$,
$$
\ro(K_t) \le c^{-t}\binom{r(K_t)}{2}.
$$
In this paper we contribute to this topic by showing that
there is an infinite family of trees $T_1,T_2,\dots$, with $|T_i|<|T_{i+1}|$ for $i\ge1$, such that
$$
\lim_{i\to\infty} \frac{\ro(T_i)}{\rf(T_i)} = 0,
$$
thus exhibiting the desired asymptotic gap. In fact, we prove a stronger statement,
exhibiting the asymptotic gap even for the induced online Ramsey number.
\section{Induced paths}
\label{sec:inducedPaths}
In this section we present an upper bound on the induced online Ramsey number of paths.
\begin{theorem}\label{thm:indPaths}
Let $P_n$ be a path of length $n$.
Then $\ro_{ind}(P_n) \le 28n-27$.
\end{theorem}
{
\begin{proof}
\def \mathbb{R} [#1,#2]{R^{#1}}
\def \B [#1,#2]{B^{#1}}
\def {{\sigma}_{k,\ell}} [#1]{p^{#1}}
\def \RR [#1]{R^{#1}}
\def \BB [#1]{B^{#1}}
\def \cup {\cup}
First we build the set $I$ of $2(7n-7)-1$ isolated edges,
then at least $7n-7$ have the same color, we say this color is \emph{abundant} in $I$.
Let $\mathbb{R}[0,0]$ and $\B[0,0]$ be the initial paths of lengths $0$.
In $s$-th step we have a red induced path $\mathbb{R}[s,r]=(r_0,\{r_0,r_1\},r_1,\dots,r_r)$ of length $r$
and a blue induced path $\B[s,b]=(b_0,\{b_0,b_1\},b_1,\dots,b_b)$ of length $b$.
We denote the concatenation of paths $A$ and $B$ by $A\cup B$.
The removal of vertices and incident edges is denoted by $A \setminus \{v\}$.
We define the potential of $s$-th step ${{\sigma}_{k,\ell}}[s]=3a+4o$ where $a$ is the length of the path in color
which is abundant in $I$ and $o$ is the length of path in the other color.
Further, we show that we are able to maintain the invariant
that there are no edges between the $\mathbb{R}[s,r]$ and $\B[s,b]$ and that $p^{s+1} > p^s$.
Assume without loss of generality\xspace that the blue edges are abundant in $I$.
Let $g=\{x,y\}$ be an unused blue edge from the set $I$.
One step of Builder is as follows.
Builder creates an edge $e=\{r_r,b_b\}$.
If Painter colored $e$ red then Builder creates an edge $f=\{b_b,x\}$,
however if $e$ is blue then Builder creates $f=\{r_r,x\}$.
Depending on how the $e$ and $f$ edges were colored we end up with four different scenarios.
These different cases are also depicted in Fig.~\ref{fig:paths}.
\bgroup
\small
\[
(\BB[s+1],\RR[s+1]) =
\begin{cases}
\bigl(\B[s,b] \cup (e,r_r,f,x,g,y), \mathbb{R}[s,r] \setminus \{r_r,r_{r-1}\}\bigr) & \text{if $e$ and $f$ are blue} \\
\bigl(\B[s,b] \setminus \{b_b\}, \mathbb{R}[s,r] \cup (f,x)\bigr) & \text{if $e$ is blue and $f$ is red} \\
\bigl(\B[s,b] \cup (f,x,g,y), \mathbb{R}[s,r] \setminus \{r_r\}\bigr) & \text{if $e$ is red and $f$ is blue} \\
\bigl(\B[s,b] \setminus \{b_b,b_{b-1}\}, \mathbb{R}[s,r] \cup (e,b_b,f,x)\bigr) & \text{if $e$ and $f$ are red}
\end{cases}
\]
\[
{{\sigma}_{k,\ell}}[s+1] =
\begin{cases}
3\bigl(|B^s|+3\bigr)+4\bigl(|R^s|-2\bigr) = {{\sigma}_{k,\ell}}[s]+1 &\text{if $e$ and $f$ are blue} \\
3\bigl(|B^s|-1\bigr)+4\bigl(|R^s|+1\bigr) = {{\sigma}_{k,\ell}}[s]+1 &\text{if $e$ is blue and $f$ is red} \\
3\bigl(|B^s|+2\bigr)+4\bigl(|R^s|-1\bigr) = {{\sigma}_{k,\ell}}[s]+2 &\text{if $e$ is red and $f$ is blue} \\
3\bigl(|B^s|-2\bigr)+4\bigl(|R^s|+2\bigr) = {{\sigma}_{k,\ell}}[s]+2 &\text{if $e$ and $f$ are red}
\end{cases}
\]
\egroup
We obtain a pair of paths $\BB[s+1], \RR[s+1]$ such that ${{\sigma}_{k,\ell}}[s+1]>{{\sigma}_{k,\ell}}[s]$ and invariant holds.
The maximum potential for which Builder did not win yet is ${{\sigma}_{k,\ell}}[s] = 7n-7$.
Therefore there are no more than $7n-6$ steps to finish one monochromatic induced path of length $n$.
To create the initial set $I$ Builder creates $2(7n-7)-1$ isolated edges.
In each step, Builder creates two edges.
The total number of edges created by Builder is no more than $2(7n-6)+2(7n-7)-1 = 28n-27$.
\qed\end{proof}
}
{%
\def\u{${b_b}$
\def${r_r}${${r_r}$}
\def$w${$w$}
\def$e${$e$}
\def$f${$f$}
\def$g${$g$}
\begin{figure}[h]
\centering
\input{./horizontal.tex}
\caption{One step in creating an induced monochromatic $P_n$}
\label{fig:paths}
\end{figure}
}
Note that the initial edges each span $2$ vertices and in each step only the first edge can lead to a new vertex.
This gives us bound on the number of vertices used in creating an induced path $P_n$
to be at most $2\bigl(2(7n-7)-1\bigr) + 7n-6 = 35n-36$.
\section{Cycles and Induced Cycles}
\label{sec:cycles}
\bgroup
\def24n-20{24n-20}
\def735n-27{735n-27}
\def367n-27{367n-27}
\def{{\sigma}_{k,\ell}}{\rho}
In this section, we present a constructive upper bound on the online Ramsey number of cycles $\ro(C_n)$ and induced cycles $\ro_{ind}(C_n)$.
\begin{theorem}\label{thm:evencycles}
Let $C_n$ be a cycle on $n$ vertices, where $n$ is even.
Then, $\ro_{ind}(C_n) \le 367n-27$.
\end{theorem}
\begin{proof}
First, Builder obtains disjoint paths $\spread[{{\sigma}_{k,\ell}},9]$ of length $4n/3-1$ and one path ${{\sigma}_{k,\ell}}_{10}$ of length $n-2$.
Instead of using Theorem~\ref{thm:indPaths} to create these paths separately
it is more efficient to create a $P_{13n}$ using at most $28(13n)-27$ edges
and define paths $\spread[{{\sigma}_{k,\ell}},10]$ as an induced subgraph of $P_{13n}$.
Let the $P_{13n}$ be without loss of generality\xspace red.
Let ${{\sigma}_{k,\ell}}_{i,j}$ denote the $j$-th vertex of ${{\sigma}_{k,\ell}}_i$.
\newcommand{p}{p}
Builder will create a red $C_n$ using $\spread[{{\sigma}_{k,\ell}},10]$ or three blue paths of length $n/2$ starting in $u$ and ending in either ${{\sigma}_{k,\ell}}_{10,1}$ or ${{\sigma}_{k,\ell}}_{10,n-1}$.
These three paths starting in the same vertex and two of them sharing a common endpoint will form a blue $C_n$.
Each blue path will go through a separate triple of paths from $\spread[{{\sigma}_{k,\ell}},9]$ and
alternate between them with each added vertex.
Let us run the following procedure three times -- once for each $k \in \{1,2,3\}$.
Let $p={{\sigma}_{k,\ell}}_{3k-2}$, $q={{\sigma}_{k,\ell}}_{3k-1}$ and $r={{\sigma}_{k,\ell}}_{3k}$.
Let us define cyclic order of these paths to be $p,q,r,p$ which defines a natural successor for each path.
Builder does the following three steps, which are also depicted in Fig.~\ref{fig:even_cycles_small}.
\begin{enumerate}
\item Create edges $\{u,p_{1}\}$ and $\{u,p_{n-1}\}$. If both of these edges are red Builder wins immediately. If that is not the case then at least one edge $\{u,v_1\}$ where $v_1\in\{p_{1}, p_{n-1}\}$ is blue.
\item Now for $i$ from $1$ to $n/2-1$ we do as follows:
\begin{itemize}
\item Let $j := 2\lfloor{i/3}\rfloor$. Let $t \in \{p,q,r\}$ such that $v_i \in t$ and set $s$ to be the successor of $t$.
\item We create edges $\{v_i,s_{j+1}\}$ and $\{v_i,s_{j+n-1}\}$. If both are red Builder wins, otherwise take an edge $\{v_i,v_{i+1}\}$ where $v_{i+1} \in \{s_{j+1}, s_{j+n-1}\}$ is blue.
\end{itemize}
\item Finish the path $(u,\spread[v,n/2-1])$ by creating edges $\{v_{n/2-1},{{\sigma}_{k,\ell}}_{10,1}\}$ and $\{v_{n/2-1},{{\sigma}_{k,\ell}}_{10,n-1}\}$. Again if both edges are red, Builder wins immediately. Otherwise, Builder creates a blue path from $u$ to ${{\sigma}_{k,\ell}}_{10,1}$ or to ${{\sigma}_{k,\ell}}_{10,n-1}$.
\end{enumerate}
\begin{figure}[h]
\centering
\begin{tikzpicture}[scale=0.45]
\node[main] (u) at (-3,5) {$u$};
\def\goal{18};
\def\mx{20};
\foreach \s[count=\si from 0] in {0,1,...,\mx}{
\node[main] (p\si) at (\s,4){};
\node[main] (q\si) at (\s,2){};
\node[main] (r\si) at (\s,0){};
}
\foreach \s[count=\si from 2, count=\ss from 4] in {2,...,\goal}{
\node[main] (x\s) at (\ss,-2.5){};
}
\foreach \s[count=\si from 2, count=\ss from 3] in {3,...,\goal}{
\draw[red] (x\si) -- (x\ss);
}
\foreach \s[count=\si from 0, count=\ss from 1] in {1,...,\mx}{
\draw[red] (p\si) -- (p\ss);
\draw[red] (q\si) -- (q\ss);
\draw[red] (r\si) -- (r\ss);
}
\node[main,draw=gray] (rcorner) at (\mx+1,3) {};
\node[main,draw=gray] (lcorner) at (-1,1) {};
\node[hide] () at (-1,4){$p$};
\node[hide] () at (-1,2){$q$};
\node[hide] () at (-1,0){$r$};
\node[hide] () at (3,-2.5){$\rho_{10}$};
\draw[dotted] (p\mx) -- (rcorner) -- (q\mx);
\draw[dotted] (q0) -- (lcorner) -- (r0);
\draw[blue] (u) edge [out=-20,in=140] (p0);
\draw[dotted] (u) edge [out=-10,in=155] (p16);
\draw[blue] (p0) -- (q0) -- (r0);
\draw[dotted] (p0) edge[out=-20,in=160] (q16);
\draw[blue] (r0) edge[bend right=20] (p2);
\draw[blue] (p2) -- (q2) -- (r2);
\draw[blue] (r2) edge[bend right=20] (p4);
\draw[dotted] (p4) -- (q4);
\draw[blue] (p4) edge[out=340,in=150] (q20);
\draw[blue] (q20) edge[out=260,in=40] (x2);
\draw[dotted] (q20) edge[out=280,in=120] (x\goal);
\draw[dotted] (r20) -- (\mx+1,0);
\draw[dotted] (x\goal) -- (\mx+1,-2.5);
\end{tikzpicture}
\caption{Creation of ${{\sigma}_{k,\ell}}_{n/2}$ for $n=18$.}
\label{fig:even_cycles_small}
\end{figure}
If the final circle is red then it is induced because the initial path is induced
and we neither create edges connecting two vertices of ${{\sigma}_{k,\ell}}_k$ to itself,
nor edges connecting $v_i$ to any vertices between endpoints of the cycle.
If the blue cycle is created it is induced because we use only odd vertices on $\spread[{{\sigma}_{k,\ell}},9]$ for creating the three blue paths and no edges are created between vertices which are further than $1$ apart on these blue paths.
Note that the length of paths $\spread[{{\sigma}_{k,\ell}},9]$ is sufficient
because they need to be at least $2\big\lfloor\frac{n/2 - 1}{3}\big\rfloor+(n-2) \leq \frac{4n - 8}{3} \leq 4n/3-1$.
By Theorem~\ref{thm:indPaths} we can create the initial induced $P_{13n}$ in $28(13n)-27$ rounds.
There are at most $3n$ additional edges, hence $\ro(C_n) \leq 367n-27$.
\qed\end{proof}
\begin{theorem}\label{thm:oddcycles}
Let $C_n$ be a cycle on $n$ vertices, where $n$ is odd.
Then $\ro_{ind}(C_n) \le \ro_{ind}(C_{2n})+n \le 735n-27$.
\end{theorem}
\begin{proof}
First, we create a monochromatic cycle $C_{2n}$.
Assume without loss of generality\xspace that this cycle is blue.
Let $c_0,c_1,\dots,c_{2n-1}$ denote vertices on the $C_{2n}$ in the natural order
and let $c_i$ for any $i \ge 2n$ denote vertex $c_j$, $j = i \bmod 2n$.
We join two vertices which lie $n-1$ apart on the even cycle by creating an edge $\{c_0, c_{n-1}\}$.
If the edge is blue it forms a blue $C_n$ with part of the blue even cycle (see Fig.~\ref{fig:odd_cycles}).
If the edge is red we can continue and create an edge $\{c_{n-1},c_{2(n-1)}\}$ and use the same argument.
This procedure can be repeated $n$ times finishing with the edge $\{c_{(n-1)(n-1)},c_{n(n-1)}\}$
where $c_{n(n-1)}=c_0$ because $n-1$ is even.
Let $E$ be all the new red edges we just created, i.e.,
$E=\bigl\{\{c_{i},c_{i+n-1}\} \mid i \in J\bigr\}$ where $J=\bigl\{j(n-1) \mid j \in \{0,1,\dots,n-1\}\bigr\}$.
Since $\gcd(n-1,2n)=2$ it follows that the edges of $E$
complete a cycle $C^{'}_n=\bigl(\{c_0,c_2,\dots,c_{2n-2}\}, E\bigr)$ (see Fig.~\ref{fig:odd_cycles}).
Since the $C_{2n}$ is induced then it follows trivially that the target $C_n$ will be induced as well.
We used Theorem~\ref{thm:evencycles} to create an even cycle $C_{2n}$.
Then we added $n$ edges to form the $C^{'}$.
This gives us an upper bound for induced odd cycles $\ro_{ind}(C_n) \le \ro_{ind}(C_{2n})+n \le 735n-27$.
\qed\end{proof}
\begin{figure}[h]
\centering
\begin{tikzpicture}[scale=1.6]
\begin{scope}[local bounding box=scope1]
\node at (0,0){};
\end{scope}
\foreach \s[count=\si from 0] in {0,20,...,340}{
\begin{scope}[shift={($(scope1) +(\s:0)$)}, scale=1,rotate=\s+30]
\node[draw,circle,inner sep=2pt] (\si) at (1,0){};
\end{scope}
}
\foreach \si in {16,...,23}{
\draw[selected blue] let \n1={int(mod(\si+1,18))}, \n2={int(mod(\si,18))} in (\n2) -- (\n1);
\draw[blue] let \n1={int(mod(\si+1,18))}, \n2={int(mod(\si,18))} in (\n2) -- (\n1);
}
\draw[selected blue] (16) -- (6);
\draw[blue] (16) -- (6);
\foreach \si in {24,...,33}{
\draw[blue] let \n1={int(mod(\si+1,18))}, \n2={int(mod(\si,18))} in (\n2) -- (\n1);
}
\foreach \s[count=\si from 0] in {20,40,...,160}{
\draw[draw=red] let \n1={int(mod(2*\si,18))},\n2={int(mod(2*\si+8,18))} in (\n1) -- (\n2);
}
\end{tikzpicture}
~~
\begin{tikzpicture}[scale=1.6]
\begin{scope}[local bounding box=scope1]
\node at (0,0){};
\end{scope}
\foreach \s[count=\si from 0] in {0,20,...,340}{
\begin{scope}[shift={($(scope1) +(\s:0)$)}, scale=1,rotate=\s+30]
\node[draw,circle,inner sep=2pt] (\si) at (1,0){};
\end{scope}
}
\foreach \s[count=\si from 0] in {0,20,...,360}{
\draw[blue] let \n1={int(mod(\si+1,18))},\n2={int(mod(\si,18))} in (\n2) -- (\n1);
}
\foreach \s[count=\si from 0] in {0,20,...,160}{
\draw[selected red] let \n1={int(mod(2*\si,18))},\n2={int(mod(2*\si+8,18))} in (\n1) -- (\n2);
}
\foreach \s[count=\si from 0] in {0,20,...,160}{
\draw[red] let \n1={int(mod(2*\si,18))},\n2={int(mod(2*\si+8,18))} in (\n1) -- (\n2);
}
\end{tikzpicture}
\caption{Final step of building $C_9$}
\label{fig:odd_cycles}
\end{figure}
\subsection*{Non-induced Cycles}
Although the induced cycle strategies are asymptotically tight we can get better constants for the non-induced cycles.
For even cycles, we can use the non-induced path strategy to create the initial $P_{17n/2}$ in $4(17n/2)-3$ rounds.
Then we add $3n/2$ edges in the similar fashion as for the induced cycles
however we can squeeze them more tightly as depicted in the Fig.~\ref{fig:evencyclesaving}.
\begin{figure}[h]
\centering
\begin{tikzpicture}[scale=0.5]
\newcommand{\drawtwopaths}[2]{
\def#1{#1}
\def#2{#2}
\foreach \s[count=\si from 0] in {0,1,...,7}{
\node[main] (#2\si#1) at (\s,0){};
}
\node[hide] at (8,0) {$\dots$};
\foreach \s[count=\si from 0, count=\ss from 1] in {0,1,...,6}{
\draw[red] (#2\si#1) -- (#2\ss#1);
}
}
\begin{scope}[shift={(0,2)}] \drawtwopaths{1}{u} \end{scope}
\begin{scope}[shift={(0,0)}] \drawtwopaths{1}{m} \end{scope}
\begin{scope}[shift={(0,-2)}] \drawtwopaths{1}{d} \end{scope}
\begin{scope}[shift={(12,1)}] \drawtwopaths{2}{u} \end{scope}
\begin{scope}[shift={(12,-1)}] \drawtwopaths{2}{d} \end{scope}
\draw[draw=black,->] (9,0) -- (11,0);
\draw[blue] (u01) -- (m01) -- (d01) edge[bend right=20] (u21);
\draw[blue] (u21) -- (m21) -- (d21) edge[bend right=20] (u41);
\draw[blue] (u41) -- (m41) -- (d41);
\draw[blue] (u02) -- (d02)
-- (u12) -- (d12)
-- (u22) -- (d22)
-- (u32) -- (d32);
\end{tikzpicture}
\caption{More efficient construction for even non-induced cycles.}
\label{fig:evencyclesaving}
\end{figure}
Using this method the paths $\spread[{{\sigma}_{k,\ell}},6]$ need only $5n/4$ vertices each, therefore the initial path $P_{17n/2}$ is sufficient.
This gives us $\ro(C_n) \leq 71n/2-3$ for even $n$ which directly translates to odd cycles
and gives us $\ro(C_n) \le \ro(C_{2n})+n \le 72n-3$ for odd $n$.
\egroup
\bgroup
\defk{k}
\def\ell{\ell}
\def\mathcal{T}{\mathcal{T}}
\defC{C}
\defS_{\k,\l}{S_{k,\ell}}
\section{Tight bounds for a family of trees}
\label{sec:spiders}
\bgroup
\newcommand{\V}[2]{{P_{{#1},{#2}}}}
\def{\sigma}{{\sigma}}
\def{{\sigma}_{k,\ell}}{{{\sigma}_{k,\ell}}}
\def\mathbb{P}{\mathbb{P}}
\def57\k^2\l+28\k^2-\k\l-27{57k^2\ell+28k^2-k\ell-27}
\def\k^2\l+15\k\l+2\k-12{k^2\ell+15k\ell+2k-12}
We first prove a general lower bound for the online Ramsey number of graphs.
It will be used to show the tightness of bounds in this section.
\begin{lemma}\label{lem:lowerboundorn}
The $\ro(H)$ is at least $\mbox{VC}(H) \bigl(\Delta(H)-1\bigr)/2 + |E(H)|$ where $\mbox{VC}(H)$ is the vertex cover
and $\Delta(H)$ is the highest vertex degree in $H$ and $|E(H)|$ is the number of edges.
\end{lemma}
\begin{proof}
Let $deg_b(v)$ be the number of blue edges incident to the vertex $v$.
Let us define the Painter's strategy against the target graph $H$ as:
\begin{enumerate}
\item if both incident vertices have $deg_b < \Delta(H)-1$ then color the edge blue,
\item otherwise color the edge red.
\end{enumerate}
It is clear that Builder cannot create $H$ in blue color because the blue graph can contain only vertices with degree at most $\Delta(H)-1$.
To obtain a red edge it has to have at least one incident vertex with high blue degree.
The minimal number of vertices with high blue degree which are required to complete $H$
is the vertex cover of $H$, therefore, Builder has to create at least $\mbox{VC}(H)(\Delta(H)-1)/2$ blue edges.
Then Builder has to create at least $|E(H)|$ edges to complete the target graph in red color.
\qed\end{proof}
Let us define a \emph{spider} ${{\sigma}_{k,\ell}}$ for $k \ge 3$ and $\ell \ge 2$ as a union of $k$ paths of length~$\ell$
that share exactly one common endpoint.
Let a \emph{center} of ${{\sigma}_{k,\ell}}$ denote the only vertex with degree equal to $k$.
In the following theorem we obtain an upper bound on $\ro({{\sigma}_{k,\ell}})$
that asymptotically matches the lower bound from Lemma~\ref{lem:lowerboundorn}.
\begin{theorem}\label{thm:induced spiders}
$\ro_{ind}({{\sigma}_{k,\ell}}) = \Theta(k^2 \ell)$.
\end{theorem}
\begin{proof}
We describe Builder's strategy for obtaining an induced monochromatic ${{\sigma}_{k,\ell}}$.
We start by creating an induced monochromatic path of length $k^2 (2\ell+1)$ which is without loss of generality\xspace blue.
This path contains $k^2$ copies of $P_{2\ell}$ as an induced subgraph.
Let $\V{i}{j}$ denote the $j$-th vertex on path $P_i$.
Let $\spreadu[\mathbb{P},k]$ be $k$ sets where each contains $k$ disjoint induced paths.
Let $u$ be a previously unused vertex.
Now for each $\mathbb{P}^j$ we do the following procedure:
\begin{enumerate}
\item Let $\{\spreadu[P,k]\}=\mathbb{P}^j$.
\item
Create edges $\bigl\{ \{ u, w \} \mid w \in \{\spreadu[P_1,k]\} \bigr\}$.
If there are $k$ blue edges there is a ${{\sigma}_{k,\ell}}$ with the center in $u$.
If that is not the case there is at least one red edge $e^1=\{u,v^1\}$ where $v^{1} \in \{\spreadu[P_1, k]\}$.
\item For $i$ from $2$ to $\ell$ we do as follows.
\begin{itemize}
\item
For $v^{i-1} \in P^z$ create edges $\bigl\{\{v^{i-1},w\} \mid w \in \{\spreadu[P_i,k]\} - P_i^z\bigr\}$.
If all of these edges are blue we have a ${{\sigma}_{k,\ell}}$ with the center in $v^{i-1}$,
otherwise there is a red edge $\{v^{i-1}, v^{i}\}$ where $v^{i} \in \{\spreadu[P_i, k]\}$.
\end{itemize}
\item We obtained a red induced path $L^j = \bigl(u,\{u,v^1\},\dots,v^\ell\bigr)$.
\end{enumerate}
If all iterations end up in obtaining a path $L^j$ we have $k$ induced paths of length~$\ell$
which all start in $u$ and together they form a ${{\sigma}_{k,\ell}}$ with the center in $u$.
We built a path $P_{k^2(2\ell+1)}$ using Theorem~\ref{thm:indPaths} using at most $28\bigl(k^2(2\ell+1)\bigr)-27$ edges.
During iterations, we created at most $k\ell(k-1)$ edges.
Therefore we either got a blue ${{\sigma}_{k,\ell}}$ during the process or a red ${{\sigma}_{k,\ell}}$ after using no more than $\ro_{ind}({{\sigma}_{k,\ell}}) \leq 57\k^2\l+28\k^2-\k\l-27 = O(k^2\ell)$ rounds.
The lower bound of Lemma~\ref{lem:lowerboundorn} gives us $\Omega(k^2\ell)$ therefore the $\ro_{ind}({{\sigma}_{k,\ell}})=\Theta(k^2\ell)$.
\qed\end{proof}
\begin{figure}[h]
\centering
\input{./builder.tex}
\caption{Building one red leg of a spider ${\sigma}_{4,5}$.}
\label{fig:spider}
\end{figure}
We can get the bound on non-induced spiders in a similar way,
however, we can use several tricks to get a bound which is not far from the lower bound.
\begin{theorem}\label{thm:spiders}
$\ro({{\sigma}_{k,\ell}}) \le \k^2\l+15\k\l+2\k-12 = O(k^2 \ell)$.
\end{theorem}
\begin{proof}
We create a path $P_{4k\ell}$ using strategy by Grytczuk et al.~\cite{Grytczuk2008OnlineRN}
in $4(4k\ell)-3$ rounds and split it into $2k$ paths of length~$2\ell$.
We follow the same strategy as in the induced case,
however, we work over the same set of paths in all iterations and we exclude those vertices which are already used by some path.
Choosing $2k$ paths guarantees that we have big enough set even for the last iteration.
We create $2k$ edges from $u$ and then we use $k\ell(k-1)$ to create the red paths.
We either get a blue ${{\sigma}_{k,\ell}}$ in the process or a red ${{\sigma}_{k,\ell}}$ after using no more than $\k^2\l+15\k\l+2\k-12$ rounds.
\qed\end{proof}
\egroup
\section{Family of induced trees with an asymptotic gap}
\label{sec:trees}
\newcommand{\overline{\deg}}{\overline{\deg}}
\newcommand{426k\ell-444k+280\ell-296}{426k\ell-444k+280\ell-296}
\newcommand{\restrees} {426k\ell-442k+308\ell-295}
In 2009 Conlon~\cite{Conlon2009OnlineRN} showed that the online Ramsey number and the size-Ramsey number
differ asymptotically for an infinite number of cliques.
In this section, we present a family of trees which exhibit the same property, i.e.,
their induced online Ramsey number and size-Ramsey number differ asymptotically.
\begin{definition}
Let the centipede $S_{\k,\l}$ be a tree consisting of a path $P_\ell$ of length~$\ell$ where each of its vertices is center of star $S_k$,
i.e., a thorn-regular caterpillar.
\end{definition}
Note that $S_{\k,\l}$ has $(k+1)(\ell+1)$ vertices and its maximum degree is $k+2$.
We will show that $S_{\k,\l}$ exhibits small induced online Ramsey number.
\newcommand{Q_r}{Q_r}
\newcommand{Q_b}{Q_b}
First, we need some ``degree-type'' notion.
Let $G = (V,E)$ be a graph whose edges are colored red and blue.
Let $U \subseteq V$.
For a vertex $v \in V$ let $\overline{\deg}(v,U)$ be a degree outside $U$.
Formally, $\overline{\deg}(v,U) = |N(v) \setminus U|$, where $N(v)$ is a neighborhood of $v$.
Let $\overline{\deg}_b(v,U)$ and $\overline{\deg}_r(v, U)$ be a vertex degree outside $U$ in blue or red color, respectively.
I.e.,
\[
\overline{\deg}_b(v,U) = \Bigl|\bigl\{ u \in N(v) \setminus U : \{u,v\} \text{ is a blue edge} \bigr\}\Bigr|.
\]
and similarly for $\overline{\deg}_r(v,U)$.
A \emph{center} of a star $S_k$ is the vertex of degree $k$.
A \emph{center} of union of stars are centers of all stars in the union.
A \emph{colorful star} is a star such that for its center $v$ holds
that $\overline{\deg}_b(v) \geq k$ and $\overline{\deg}_r(v) \geq k$.
Let $H$ be a centipede or a union of stars. We denote a center of $H$ by $c(H)$.
\begin{theorem}\label{thm:trees}
$\ro_{ind}(S_{\k,\l}) \le \restrees = O(k\ell)$.
\end{theorem}
\begin{proof}
We will proceed in steps where each step will get us closer to getting the result.
Let a superscript $X^i$ of any set $X$ denote the state of the set in $i$-th step.
Also, let $X^{i+1}=X^i$ if not mentioned otherwise.
We will gradually build two centipedes (one red, one blue) and a set of colorful stars.
Let $R^i$ ($B^i$) be a red (blue) centipede in the step $i$.
First, we assume that both $R^i$ and $B^i$ are nonempty.
We show later a strategy for the case $R^i$ or $B^i$ is empty (i.e., centipede of length 0).
Let $Q_r^i$ be a union of colorful stars such that for each star $S \in Q_r^i$ holds that $c(S) \in c(R^j)$ for some $j < i$, i.e. the center of $S$ were in the center of the red centipede in some previous step.
The $Q_b^i$ is defined similarly, i.e. it is a union of colorful stars such that for each star $S \in Q_b^i$ holds that $c(S) \in c(B^j)$ for some $j < i$.
Let $U^i = R^i \cup B^i \cup Q_r^i \cup Q_b^i$.
For $v \in c(R^i)$ let $\overline{\deg}_o(v)$ be $\overline{\deg}_b(v, U^i)$, i.e. blue degree of $v$ outside centipedes and colorful stars.
Similarly, let $\overline{\deg}_o(v)$ be $\overline{\deg}_r(v, U^i)$ for $v \in c(B^i)$.
Each step we either make one centipede longer by $1$, add one colorful star to $Q_r$ or $Q_b$ or increase $\overline{\deg}_o(v)$ of $v \in c(R^i) \cup c(B^i)$.
One step will proceed as follows:
\begin{enumerate}
\item Let $u$ and $v$ be endpoints of $c(R^i)$ and $c(B^i)$ respectively.
\item Create an edge $e=\{u,x\}$ where $x$ is previously unused vertex.
\item If $e$ is blue set $w:=u$, if $e$ is red create an edge $f=\{v,x\}$ and set $w:=v$.
\item \label{case:three} Perform one of the following:
\begin{enumerate}
\item \label{case:forkok} If $e$ is red and $f$ is blue,
create edges from $x$ until $k$ of them are in the same color and then add $x$ to respective centipede center set.
\item \label{case:forknok} Either $e$ is blue, or both $e$ and $f$ are red,
\begin{enumerate}
\item \label{case:forknoksmall} if $\overline{\deg}_o(w)<k$, the $\overline{\deg}_o(w)$ was increased by $1$,
\item \label{case:forknokbig} or $\overline{\deg}_o(w) \geq k$, we have a colorful star with center in $w$,
therefore we move $w$ from its centipede center set to respective colorful star set, i.e.,
$c(Q_r^{i+1})=c(Q_r^i) \cup \{u\}$ and $c(R^{i+1})=c(R^i) - u$ if $w=u$,
or $c(Q_b^{i+1})=c(Q_b^i) \cup \{v\}$ and $c(B^{i+1})=c(B^i)-v$ if $w=v$.
\end{enumerate}
\end{enumerate}
\end{enumerate}
See Figure~\ref{fig:star_star} for clarification of various cases during one step.
\begin{figure}[h]
\centering
\begin{tikzpicture}[
every node/.style = {main},
level 1/.style = {sibling distance=1em},
level distance = 2.4em,
scale=0.68,
font=\scriptsize,
]
\newcommand{\smallstar}[5]
\begin{scope}[grow=#2, shift={#4}]
\node (#3) {#5}
child {node {} edge from parent [#1] }
child {node {} edge from parent [#1] }
child {node {} edge from parent [#1] }
;
\end{scope}
}
\newcommand{\partcatepillar}{
\smallstar{red}{left}{u}{(0,2)}{$u$}
\smallstar{red}{left}{u1}{(0,1)}{}
\node[hide] (u2) at (0,0){};
\draw[selected red] (u) -- (u1);
\draw[red] (u) -- (u1);
\draw[selected red] (u1) -- (u2);
\draw[red,longpath] (u1) -- (u2);
\smallstar{blue}{right}{v}{(1,2)}{$v$}
\smallstar{blue}{right}{v1}{(1,1)}{}
\node[hide] (v2) at (1,0){};
\draw[selected blue] (v) -- (v1);
\draw[blue] (v) -- (v1);
\draw[selected blue] (v1) -- (v2);
\draw[blue,longpath] (v1) -- (v2);
}
\begin{scope}[local bounding box=a, shift={(0,0)}]
\draw[decorate,decoration={brace,amplitude=3pt},xshift=0pt,yshift=6pt] (-1,0.3) -- (-1,1.25) node [hide,midway,xshift=-0.3cm] {$k$};
\partcatepillar
\node (x) at (0.5,2.8){};
\draw[tobe] (u) -- (x) -- (v);
\end{scope}
\begin{scope}[local bounding box=b, shift={(6,2)}]
\partcatepillar
\begin{scope}[grow=up, shift={(0.5,2.8)}]
\node (x) {$x$}
child {node {} edge from parent [tobe] }
child {node {} edge from parent [tobe] }
child {node {} edge from parent [tobe] }
child {node {} edge from parent [tobe] }
child {node {} edge from parent [tobe] }
;
\end{scope}
\draw[red] (u) -- (x);
\draw[blue] (x) -- (v);
\draw[decorate,decoration={brace,amplitude=3pt},xshift=0pt,yshift=6pt] (-0.35,3.5) -- (1.35,3.5) node [hide,midway,yshift=0.25cm] {$k+m$};
\node[hide,text width=7em,inner sep=0.5em] () [right of=b,anchor=west,shift={(0,0.8)}] {one centipede gets longer by $1$};
\end{scope}
\begin{scope}[local bounding box=c, shift={(6,-2)}]
\partcatepillar
\node (x) at (0.5,2.8){};
\draw[tobe] (u) -- (x);
\draw[red] (x) -- (v);
\end{scope}
\begin{scope}[local bounding box=d, shift={(13,-2)}]
\smallstar{red}{left}{u}{(0,2)}{$u$}
\smallstar{red}{left}{u1}{(0,1)}{}
\node[hide] (u2) at (0,0){};
\draw[selected red] (u) -- (u1);
\draw[red] (u) -- (u1);
\draw[selected red] (u1) -- (u2);
\draw[red,longpath] (u1) -- (u2);
\smallstar{blue}{right}{v1}{(1,1)}{}
\begin{scope}[local bounding box=dd, grow=right, shift={(1.2,2.8)}]
\node (v) {$v$}
child {node {} edge from parent [blue] }
child {node {} edge from parent [blue] }
child {node {} edge from parent [blue] }
child {node {} edge from parent [red] }
child {node {} edge from parent [red] }
child {node (x) {} edge from parent [red] }
;
\end{scope}
\node[hide] (v2) at (1,0){};
\draw[blue] (v) -- (v1);
\draw[selected blue] (v1) -- (v2);
\draw[blue,longpath] (v1) -- (v2);
\draw[dotted] (u) edge [bend left] (x);
\node[draw=black,rectangle, dashed,fit=(dd),rounded corners=0.5em,inner sep=0.5em](box) {};
\node[hide,text width=6em] () [above of=box,anchor=south]{put the colorful star to $Q_b$};
\end{scope}
\begin{scope}[local bounding box=lc, shift={(10.5,1.8)}]
\node[hide] () {$\overline{\deg}_o(v)$ increased by $1$};
\end{scope}
\draw[->] (2.5,2) -- node[above,hide,sloped]{case~\ref{case:forkok}} (4.5,3.5);
\draw[->] (2.5,1) -- node[above,hide,sloped]{case~\ref{case:forknok}}
node[below,hide,sloped]{w.l.o.g. $w:=v$} (4.5,-0.5);
\draw[->] (8.5,0) -- node[above,hide,sloped]{case~\ref{case:forknoksmall}}
node[below,hide,sloped]{$\overline{\deg}_o(v) < k$} (10.5,1.3);
\draw[->] (8.5,-1) -- node[above,hide]{case~\ref{case:forknokbig}}
node[below,hide]{$\overline{\deg}_o(v) \geq k$} (11.8,-1);
\end{tikzpicture}
\caption{One step of building a $S_{\k,\l}$ where $k=3$}
\label{fig:star_star}
\end{figure}
Let $p^i$ be a potential in step $i$ defined as
\[
p^i=\bigl(|c(R^i)|+|c(B^i)|\bigr)\bigl(k+2\bigr)
+ \bigl(|c(Q_r^i)|+|c(Q_b^i)|\bigr)\bigl(3k+2\bigr)
+ 2\smashoperator{\sum_{v \in c(R^i) \cup c(B^i)}}{\overline{\deg}_o(v)}.
\]
Note that for all the outcomes of one step the potential will increase by at least the number of created edges.
\begin{itemize}
\item In case~\ref{case:forkok} we create $2+k+m$ edges. $k+1$ edges extend one centipede by one star, one edge is not used, and $m \leq k-1$ edges are additional edges of the other color on that star. Extending one centipede by a star with $m$ edges in other color increases $p$ by $(k+2)+2m$.
\item In case~\ref{case:forknoksmall} we create at most $2$ edges, increasing $\overline{\deg}_o$ of one vertex by one, which increases $p$ by $2$.
\item In case~\ref{case:forknokbig} we create at most $2$ edges, making one centipede shorter by one, however adding one colorful star to either $Q_r$ or $Q_b$ so $p$ increases by $(3k+2)-(k+2)-2(k-1)=2$.
\end{itemize}
Note that the graphs induced by $c(R^i)$ and $c(B^i)$ respectively are paths.
These graphs are altered by adding one vertex at the end or moving end-vertex to respective $c(Q^i)$ set.
It follows that the graphs induced by $c(Q_r^i)$ and $c(Q_b^i)$ are both forests.
Assume that after many steps we end up with $\bigl|c(R^i)\bigr|=\bigl|c(B^i)\bigr|=\ell$, $\bigl|c(Q_r^i)\bigr| = \bigl|c(Q_b^i)\bigr| = 2(35\ell-36)-2$, $\overline{\deg}_o(v)=k-1$ for all $v \in c(R^i)\cup c(B^i)$, and we did not win yet.
In such situation the potential is
\begin{align*}
p^i &= 2\ell(k+2)+2\bigl(2(35\ell-36)-2\bigr)(3k+2) + 2(k-1)2\ell \\
&= 426k\ell-444k+280\ell-296.
\end{align*}
We now perform one last step in which we might win, but if not then either $Q_r^{i+1}$ or $Q_b^{i+1}$ will have $2(35\ell-36)-1$ colorful stars.
We take the $35\ell-36$ independent colorful star centers of the bigger $Q^i$ set and perform the induced path strategy on them, which guarantees a monochromatic centipede.
The final step might add various number of rounds to our strategy depending on the case which we end up in.
Case~\ref{case:forkok} demands at most $1+2k$ edges and we win.
Case~\ref{case:forknoksmall} cannot happen because $\overline{\deg}_o(v)=\overline{\deg}_o(u)=k-1$.
And case~\ref{case:forknokbig} demands that we add $2$ edges and then we perform the path strategy using at most $\ro_{ind}(P_\ell) \leq 28\ell - 27$ edges.
We get the final upper bound on the number of edges $\ro_{ind}(S_{\k,\l}) \leq \restrees$.
We now discuss why the final centipede is induced.
First, let us partition all vertices used in the strategy into three groups: $\mathcal{R}=c(R) \cup c(Q_r)$, $\mathcal{B}=c(B) \cup c(Q_b)$, and $\mathcal{O}$ (which contains all the remaining vertices).
Note that in each step some vertices are added to the groups but once assigned they never change their group.
Vertices in $\mathcal{R}$ and $\mathcal{B}$ are always added to $c(R)$ or $c(B)$ and then they might be moved into $c(Q_r)$ and $c(Q_b)$ respectively.
Vertices in $\mathcal{O}$ are used during one step and are never used again, specifically in case~\ref{case:forkok} there are $k+m$ vertices created and all of them are connected to $1$ center vertex (in $c(R)$ or $c(B)$) and in case~\ref{case:forknok} one new vertex is connected to at most one vertex from $\mathcal{R}$ and one vertex from $\mathcal{B}$.
Assume without loss of generality\xspace that the centipede is in red color.
The centipede either appears with centers in $c(R)$ or $c(Q_r)$.
Assume the former occurred then the centers of $c(R)$ induce a path.
If the latter occurred then the vertices of $c(Q_r)$ we used in the induced path strategy were independent.
In both cases, the leaves of the centipede appear in the $\mathcal{O}$.
These vertices have at most one edge to the $\mathcal{R}$ and have no edges among each other.
If $R$ or $B$ is empty then the strategy changes slightly.
In all the cases we omit creation of edge $e$ if $R=\emptyset$ and $f$ if $B=\emptyset$.
If $e$ is omitted assume it is red when deciding what edges to draw, and respectively when $f$ is omitted assume it is blue.
We observe that all the steps stay the same and the potential increases in the same manner
but we created fewer edges than necessary which does not contradict the devised upper bound.
\qed\end{proof}
Due to Beck~\cite{Beck1990size} we have a lower bound for trees $T$
which is $\rf(T) \ge \beta(T)/4$ where $\beta(T)$ is defined as
\[
\beta(T)=|T_0|\Delta(T_0)+|T_1|\Delta(T_1),
\]
where $T_0$ and $T_1$ are partitions of the unique bipartitioning of the tree $T$.
The $\beta$ for our family of trees is $\beta(S_{\k,\l}) \approx \left({\ell/2} + {k\ell/2} \right)(k+2) = \Theta(k^2\ell)$,
which gives us the lower bound on size-Ramsey number $\rf(S_{\k,\l})=\Omega(k^2\ell)$.
Since by Theorem~\ref{thm:trees} we have $\ro(S_{\k,\l})\le\ro_{ind}(S_{\k,\l})=O(k\ell)$ the online Ramsey number for $S_{\k,\l}$
is asymptotically smaller than its size-Ramsey number.
\begin{corollary}\label{cor:trees}
There is an infinite sequence of trees $T_1, T_2, \dots$ such that $|T_i| < |T_{i+1}|$ for each $i \ge 1$ and
\[
\lim_{i\to\infty} \frac{\ro(T_i)}{\rf(T_i)} = 0.
\]
\end{corollary}
\egroup
\section*{Acknowledgments}
We would like to thank our colleagues Jiří Fiala, Pavel Veselý and Jana Syrovátková for fruitful discussions.
\bibliographystyle{plain}
| {'timestamp': '2019-01-14T02:21:47', 'yymm': '1901', 'arxiv_id': '1901.03671', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03671'} | arxiv |
\section{Introduction}
\IEEEPARstart{F}{ormation} control of networked multi-agent systems has
received considerable attention in recent years due to its
extensive applications in many areas including both civil and military fields.
One problem of extensive interest is \emph{formation shape
control}, i.e. designing controllers to achieve or maintain a geometrical shape for the formation \cite{oh2012survey}. By using graph rigidity theory, the formation
shape can be achieved by controlling a certain set of inter-agent
distances \cite{anderson2008rigid, krick2009stabilisation} and there is no requirement on a global coordinate system having to be known to all the agents. This is in contrast to the linear \emph{consensus-based} formation control approach, in which the target formation is defined by a certain set of relative positions and a global coordinate system is required for all the agents to implement the consensus-based formation control law (see detailed comparisons in \cite{oh2012survey}). Note that such a coordinate alignment condition is a rather strict requirement, which is undesirable for implementing formation controllers in e.g. a GPS-denied environment. Even if one assumes that such coordinate alignment is satisfied for all agents, slight coordinate misalignment, perhaps arising from sensor biases, can lead to a failure of formation control \cite{meng2016formation, meng20183}. Motivated by all these considerations, in this paper we focus on rigidity-based formation control.
There have been rich works on controller design and stability analysis of rigid formation control (see e.g. \cite{krick2009stabilisation, dorfler2010geometric, oh2014distance, anderson2014counting} and the review in \cite{oh2012survey}), most of which assume that the control input is updated in a continuous manner. The main objective of this paper is to provide alternative controllers to stabilize rigid formation shapes based on an event-triggered approach. This kind of controller design is attractive for real-world robots/vehicles equipped with \emph{digital} sensors or microprocessors \cite{astrom2008event, heemels2012introduction}. Furthermore, by using an event-triggered mechanism to update the controller input, instead of using a continuous updating strategy as discussed in e.g. \cite{krick2009stabilisation, dorfler2010geometric, oh2014distance, anderson2014counting}, the formation system can save resources in processors and thus can reduce much of the computation/actuation burden for each agent. Due to these favourable properties, event-based control has been studied extensively in recent years for linear and nonlinear systems \cite{sun2018event, ZhongkuiTNNLS, zhang2018cooperative, Zhongkui2018TAC}, and especially for networked control systems \cite{seyboth2012event, Duan2018, qin2018leader, jiang2018synchronization}. Examples of successful applications of the event-based control strategy on distributed control systems and networked control systems have been reported in e.g. \cite{Qingchen2018, zhao2018edge, duan2018event}.
We refer the readers to the recent survey papers \cite{ge2018survey, zhang2017overview, PENG2018113, nowzari2017event} which provide comprehensive and excellent reviews on event-based control for networked coordination and multi-agent systems.
Event-based control strategies in multi-agent formation systems have recently attracted increasing attention in the control community. Some recent attempts at applying event-triggered schemes in stabilizing multi-agent formations are reported in e.g., \cite{li2018event, ge2017distributed, viel2017distributed, yi2016formation}. However, these papers \cite{li2018event, ge2017distributed, viel2017distributed, yi2016formation} have focused on the event-triggered consensus-based formation control approach, in which the proposed event-based formation control schemes cannot be applied to stabilization control of rigid formation shapes.
We note that event-based rigid formation control has been discussed briefly as an example of team-triggered network coordination in \cite{Cortes_team_triggered}. However, no thorough results have been reported in the literature to achieve cooperative rigid formation control with feasible and simple event-based solutions. This paper is a first contribution to advance the event-based control strategy to the design and implementation of rigid formation control systems.
Some preliminary results have been presented in conference contributions \cite{sun2015event} and \cite{Liu2015event}. Compared to \cite{sun2015event} and \cite{Liu2015event}, this paper proposes new control methodologies to design event-based controllers as well as event-triggering functions. The event controller presented in \cite{sun2015event} is a preliminary one, which only updates parts of the control input and the control is not necessarily piecewise constant. This limitation is removed in the control design in this paper. Also, the complicated controllers in \cite{Liu2015event} have been simplified. Moreover, and centrally to the novelty of the paper, we will focus on the design of \emph{distributed }controllers based on novel event-triggering functions to achieve the cooperative formation task, while the event controllers in both \cite{sun2015event} and \cite{Liu2015event} are centralized. We prove that Zeno behavior is excluded in the distributed event-based formation control system by proving a positive lower bound of the inter-event triggering time. We also notice that a decentralized event-triggered control was recently proposed in \cite{CCC_CHENFEI} to achieve rigid formation tracking control. The triggering strategy in \cite{CCC_CHENFEI} requires each agent to update the control input both at its own triggering time and its neighbors' triggering times, which increases the communication burden within the network. Furthermore, the triggering condition discussed in \cite{CCC_CHENFEI} adopts the position information in the event function design, which results in very complicated control functions and may limit their practical applications.
In this paper, we will provide a thorough study of rigid formation stabilization control with cooperative event-based approaches. To be specific, we will propose two feasible event-based control schemes (a centralized triggering scheme and a distributed triggering scheme) that aim to stabilize a general rigid formation shape. In this paper, by a careful design of the triggering condition and event function,
the aforementioned communication requirements and controller complexity in e.g., \cite{sun2015event, CCC_CHENFEI, Liu2015event} are avoided.
For all cases, the triggering condition, event function and triggering behavior are discussed in detail.
One of the key results in the controller performance analysis with both centralized and distributed event-based controllers is an exponential stability of the rigid formation system. The exponential stability of the formation control system has important consequences relating to \emph{robustness issues} in undirected rigid formations, as discussed in the recent papers \cite{SMA14TACsub, sun2017rigid}.
The rest of this paper is organized as follows. In Section \ref{sec:pre}, preliminary concepts on graph theory and rigidity theory are introduced. In Section \ref{sec:centralized}, we propose a centralized event-based formation controller and discuss the convergence property and the exclusion of the Zeno behavior. Section \ref{sec:distributed} builds on the centralized scheme of Section \ref{sec:centralized} to develop a distributed event-based controller design, and presents detailed analysis of the triggering behavior and its feasibility. In Section \ref{sec:simulations}, some simulations are provided to demonstrate the controller performance. Finally, Section \ref{sec:conclusions} concludes this paper.
\section{Preliminaries} \label{sec:pre}
\subsection{Notations}
The notations used in this paper are fairly
standard. $\mathbb{R}^n$ denotes the $n$-dimensional Euclidean space. $\mathbb{R}^{m\times n}$
denotes the set of $m\times n$ real matrices. A matrix or vector transpose is denoted by a superscript $T$. The rank, image and null space of a matrix $M$ are denoted by $rank(M)$, $Im(M)$ and $ker(M)$, respectively. The notation $\|M\|$ denotes the induced 2-norm of a matrix $M$ or the 2-norm of a vector $M$, and $\|M\|_F$ denotes the Frobenius norm for a matrix $M$. Note that there holds $\|M\| \leq \|M\|_F$ for any matrix $M$ (see \cite[Chapter 5]{horn2012matrix}).
We use $\text{diag}\{x\}$ to denote a diagonal matrix with the vector $x$ on its diagonal, and $span\{v_1, v_2, \cdots, v_k\}$ to denote the subspace spanned by a set of vectors $v_1, v_2, \cdots, v_k$. The symbol $I_n$ denotes the $n \times n$ identity matrix, and $\mathbf{1}_n$ denotes an $n$-tuple column vector of all ones. The notation $\otimes$ represents the Kronecker product.
\subsection{Basic concepts on graph theory}
Consider an undirected graph with $m$ edges and $n$ vertices, denoted by $\mathcal{G} =( \mathcal{V}, \mathcal{E})$ with vertex set $\mathcal{V} = \{1,2,\cdots, n\}$ and edge set $\mathcal{E} \subset \mathcal{V} \times \mathcal{V}$. The neighbor set $\mathcal{N}_i$ of node $i$ is defined as $\mathcal{N}_i: = \{j \in \mathcal{V}: (i,j) \in \mathcal{E}\}$.
The matrix relating the nodes to the edges is called the incidence matrix $H = \{h_{ij}\} \in \mathbb{R}^{m \times n}$, whose entries are defined as (with arbitrary edge orientations for the \emph{undirected} formations considered here)
\begin{equation}
h_{ij} = \left\{
\begin{array}{cc}
1, &\text{ the } i\text{-th edge sinks at node }j \\ \nonumber
-1, &\text{ the } i\text{-th edge leaves node }j \\ \nonumber
0, & \text{otherwise} \\
\end{array}
\right.
\end{equation}
An important matrix representation of a graph $\mathcal{G}$ is the Laplacian matrix $L(\mathcal{G})$, which is defined as $L(\mathcal{G}) = H^TH$. For a connected undirected graph, one has $rank(L) = n-1$ and $ker(L) = ker(H) = span\{\mathbf{1}_n\}$. Note that for the rigid formation modelled by an \emph{undirected} graph as considered in this paper, the orientation of each edge for writing the incidence matrix can be defined arbitrarily; the graph Laplacian matrix $L(\mathcal{G})$ for the undirected graph is always the same regardless of what edge orientations are chosen (i.e., is orientation-independent) and the stability analysis remains unchanged.
\subsection{Basic concepts on rigidity theory}
Let $p_i \in \mathbb{R}^d$ where $d = \{2,3\}$ denote a point that is assigned to $i \in \mathcal{V}$. The stacked vector $p=[p_1^T, \,
p_2^T, \cdots, \, p_n^T]^T \in \mathbb{R}^{dn}$ represents the realization of $\mathcal{G}$ in $\mathbb{R}^d$. The pair $(\mathcal{G}, p)$ is said to be a framework of $\mathcal{G}$ in $\mathbb{R}^d$. By introducing the matrix $\bar H: = H\otimes I_d \in \mathbb{R}^{dm \times dn}$, one can construct the relative position vector as an image of $\bar H$ from the position vector $p$:
\begin{equation}
z = \bar H p \label{z_equation}
\end{equation}
where $z=[z_1^T, \,
z_2^T, \cdots, \, z_m^T]^T \in \mathbb{R}^{dm}$, with $z_k \in \mathbb{R}^d$ being the relative position vector for the vertex pair defined by the $k$-th edge.
Using the same ordering of the edge set $\mathcal{E}$ as in the definition of $H$, the rigidity function $r_{\mathcal{G}}(p): \mathbb{R}^{dn} \rightarrow \mathbb{R}^m$ associated with the framework $(\mathcal{G}, p)$ is given as:
\begin{equation}
r_{\mathcal{G}}(p) = \frac{1}{2} \left[\cdots, \|p_i-p_j\|^2, \cdots \right]^T, \,\,\, (i,j) \in \mathcal{E}
\end{equation}
where the $k$-th component in $r_{\mathcal{G}}(p)$, $\|p_i-p_j\|^2$, corresponds to the squared length of the relative position vector $z_k$ which connects the vertices $i$ and $j$.
The rigidity of frameworks is then defined as follows.
\begin{definition} (see \cite{asimow1979rigidity}) A framework $(\mathcal{G}, p)$ is rigid in $\mathbb{R}^d$ if there exists a neighborhood $\mathbb{U}$ of $p$ such that $r_{\mathcal{G}}^{-1}(r_{\mathcal{G}}(p))\cap \mathbb{U} = r_{\mathcal{K}}^{-1}(r_{\mathcal{K}}(p))\cap \mathbb{U}$ where $\mathcal{K}$ is the complete graph with the same vertices as $\mathcal{G}$.
\end{definition}
In the following, the set of all frameworks $(\mathcal{G}, p)$ which satisfies the distance constraints is referred to as the set of \emph{target formations}. Let $d_{k_{ij}}$ denote the desired distance in the target formation which links agents $i$ and $j$. We further define \begin{align}
e_{k_{ij}} = \|p_i - p_j\|^2 - (d_{k_{ij}})^2
\end{align}
to denote the squared distance error for edge $k$. Note that we will also use $e_k$ and $d_k$ occasionally for notational convenience if no confusion is expected. Define the distance square error vector $e = [e_1, \, e_2, \, \cdots, e_m]^T$.
One useful tool to characterize the rigidity property of a framework is the rigidity matrix $R \in \mathbb{R}^{m \times dn}$, which is defined as
\begin{equation}
R(p) = \frac{\partial r_{\mathcal{G}}(p) } {\partial p} \label{R_matrix}
\end{equation}
It is not difficult to see that each row of the rigidity matrix $R$ takes the following form
\begin{equation} \label{row_R}
[\mathbf{0}_{1 \times d}, \cdots, (p_i-p_j)^T, \cdots,\mathbf{0}_{1 \times d}, \cdots, (p_j-p_i)^T, \cdots, \mathbf{0}_{1 \times d}]
\end{equation}
Each edge gives rise to a row of $R$, and, if an edge links vertices $i$ and $j$, then the nonzero
entries of the corresponding row of $R$ are in the columns from $di - (d-1)$ to $di$ and from $dj - (d-1)$ to $dj$.
The equation \eqref{z_equation} shows that the relative position vector lies in the image of $\bar H$. Thus one can redefine the rigidity function, $g_{\mathcal{G}}(z): Im(\bar H) \rightarrow \mathbb{R}^m$ as $g_{\mathcal{G}}(z) = \frac{1}{2}\left[\|z_1\|^2, \|z_2\|^2, \cdots, \|z_m\|^2 \right]^T$. From \eqref{z_equation} and \eqref{R_matrix}, one can obtain the following simple form for the rigidity matrix
\begin{eqnarray}
R(p) = \frac{\partial r_{\mathcal{G}}(p)}{\partial p} = \frac{\partial g_{\mathcal{G}}(z)}{\partial z} \frac{\partial z} {\partial p} = Z^T \bar H \label{rigidity_matrix}
\end{eqnarray}
where $Z = \textrm{diag} \{z_1,\,z_2,\cdots,\,z_m\}$.
The rigidity matrix will be used to determine the infinitesimal rigidity of the framework, as shown in the following definition. \\
\begin{definition} (see \cite{hendrickson1992conditions}) A framework $(\mathcal{G}, p)$ is infinitesimally rigid in the $d$-dimensional space if
\begin{equation}
rank(R(p)) = dn-d(d+1)/2
\end{equation}
\end{definition}
Specifically, if the framework is infinitesimally rigid in $\mathbb{R}^2$ (resp. $\mathbb{R}^3$) and has exactly $2n-3$ (resp. $3n-6$) edges, then it is called a minimally and infinitesimally rigid framework. Fig. 1 shows several examples on rigid and nonrigid formations.
In this paper we focus on the stabilization problem of minimally and infinitesimally rigid formations. {\footnote{With some complexity of calculation, the results
extend to non-minimally rigid formations (see \cite{SMA14TACsub, sun2016exponential}).}}
From the definition of infinitesimal rigidity, one can easily prove the following lemma:
\begin{lemma} \label{L_RP}
If the framework $(\mathcal{G}, p)$ is minimally and infinitesimally rigid in the $d$-dimensional space, then the matrix $R(p)R(p)^T$ is positive definite.
\end{lemma}
Another useful observation shows that there exists a smooth function which maps the distance set of a minimally rigid framework to the distance set of its corresponding framework modeled by a \emph{complete} graph.
\begin{lemma}\label{L_Smooth}
Let $r_{\mathcal{G}}(q)$ be the rigidity function for a given infinitesimally minimally rigid framework $(\mathcal{G}, q)$ with agents' position vector $q$. Further let $\bar r_{\bar {\mathcal{G}}}(q)$ denote the rigidity function for an associated framework $(\bar {\mathcal{G}}, q)$, in which the vertex set remains the same as $(\mathcal{G}, q)$ but the underlying graph is a complete one (i.e. there exist $n(n-1)/2$ edges which link any vertex pairs). Then there exists a continuously differentiable function $\pi: r_{\mathcal{G}}(q) \rightarrow \mathbb{R}^{n(n-1)/2}$ for which $\bar r_{\bar {\mathcal{G}}}(q) = \pi(r_{\mathcal{G}}(q))$ holds locally.
\end{lemma}
Lemma \ref{L_Smooth} indicates that all the edge distances in the framework $(\bar {\mathcal{G}}, q)$ modeled by a complete graph can be expressed \textit{locally} in terms of the edge distances of a corresponding minimally infinitesimally rigid framework $(\mathcal{G}, q)$ via some smooth functions.
The proof of the
above Lemma is omitted here and can be found in \cite{SMA14TACsub}.
We emphasize that Lemma~\ref{L_Smooth} is important for later analysis of a distance error system (a definition of the term will be given in Section \ref{subsec:central_design}). Lemma~\ref{L_Smooth} (together with Lemma \ref{L_smooth1} given later) will enable us to obtain a self-contained distance error system so that a Lyapunov argument can be applied for convergence analysis.
\subsection{Problem statement}
The rigid formation control problem is formulated as follows.
\begin{problem*} Consider a group of $n$ agents in $d$-dimensional space modeled by single integrators
\begin{equation}
\dot p_i = u_i, \,\,\,\, i = 1,2,\cdots, n \label{single_in}
\end{equation} Design a \emph{distributed} control $u_i \in \mathbb{R}^n$ for each agent $i$ in terms of $p_i-p_j$, $j \in \mathcal{N}_i$ with \emph{event-based} control update such that $||p_i-p_j||$ converges to the desired distance $d_{k_{ij}}$ which forms a minimally and infinitesimally rigid formation.
\end{problem*}
In this paper, we will aim to propose two feasible event-based control strategies (a centralized triggering approach and a distributed triggering approach) to solve this formation control problem.
\begin{figure}
\centering
\includegraphics[width=80mm]{Rigid_example2.eps}
\caption{Examples on rigid and nonrigid formations. (a) non-rigid formation (a deformed formation with dashed lines is shown); (b) minimally rigid formation; (c) rigid but non-minimally rigid formation. }
\label{shape_new}
\label{fig:env}
\end{figure}
\section{Event-based controller design: Centralized case} \label{sec:centralized}
This section focuses on the design of feasible event-based formation controllers, by assuming that a centralized processor is available for collecting the global information and broadcasting the triggering signal to all the agents such that their control inputs can be updated. The results in this section extend the event-based formation control reported in \cite{sun2015event} by proposing an alternative approach for the event function design, which also simplifies the event-based controllers proposed in \cite{Liu2015event, CCC_CHENFEI}. Furthermore, the novel idea used for designing a simpler event function in this section will be useful for designing a feasible distributed version of an event-based formation control system, which will be reported in the next section.
\subsection{Centralized event controller design} \label{subsec:central_design}
We propose the following general form of event-based formation control system
\begin{align}\label{position_system}
\dot p_i(t) &= u_i(t) = u_i(t_h) \\ \nonumber
&= \sum_{j \in \mathcal{N}_i} (p_j(t_h) - p_i(t_h)) e_k(t_h)
\end{align}
for $t \in [t_h, t_{h+1})$, where $h = 0,1,2, \cdots$ and $t_h$ is the $h$-th triggering time for updating new information in the controller. \footnote{ The differential equation \eqref{position_system} that models the event-based formation control system involves switching controls at every event updating instant, for which we understand its solution in the sense of Filippov \cite{cortes2008discontinuous}. } The control law is an obvious variant of the standard law for non-event-based formation shape control \cite{krick2009stabilisation, sun2016exponential}. Evidently, the control input takes piecewise constant values in each time interval. In this section, we allow the switching times $t_h$ to be determined by a central controller. In a compact form, the above position system can be written as
\begin{equation} \label{position_system_compact}
\dot p(t) = - R(p(t_h))^T e(t_h)
\end{equation}
Denote a vector $\delta_i(t)$ as
\begin{align}
\delta_i(t) = & -\sum_{j \in \mathcal{N}_i} (p_j(t_h) - p_i(t_h)) e_k(t_h) \nonumber \\
& + \sum_{j \in \mathcal{N}_i} (p_j(t) - p_i(t)) e_k(t)
\end{align}
for $t \in [t_h, t_{h+1})$. Then the formation control system $\eqref{position_system}$ can be equivalently stated as
\begin{align}\label{position_system_new}
\dot p_i(t) = u_i(t_h) = \sum_{j \in \mathcal{N}_i} (p_j(t) - p_i(t)) e_k(t) - \delta_i(t)
\end{align}
Define a vector $\delta(t) = [\delta_1(t)^T, \delta_2(t)^T, \cdots, \delta_n(t)^T]^T \in \mathbb{R}^{dn}$. Then there holds
\begin{align}\label{eq:definition_delta}
\delta(t) = R(t_h)^T e(t_h) - R(t)^T e(t)
\end{align}
which enables one to rewrite the compact form of the position system as
\begin{equation} \label{eq:new_position_system}
\dot p(t) = - R(t)^T e(t) - \delta(t)
\end{equation}
To deal with the position system with the event-triggered controller \eqref{position_system}, we instead analyze the distance error system. By noting that $\dot{e}(t)=2R(t)\dot{p}(t)$, the distance error system with the event-triggered controller \eqref{position_system} can be derived as
\begin{align} \label{error_system}
\dot e(t) &= 2R(t) \dot p(t) \nonumber \\
&= -2R(t) R(p(t_h))^T e(t_h))\,\,\, \forall t \in [t_h, t_{h+1})
\end{align}
Note that all the entries of $R(t)$ and $e(t)$ contain the real-time values of $p(t)$, and all the entries $R(p(t_h))$ and $e(t_h)$ contain the piecewise-constant values $p(t_h)$ during the time interval $[t_h, t_{h+1})$.
The new form of the position system \eqref{eq:new_position_system} also implies that the compact form of the distance error system can be written as
\begin{equation} \label{error_system2}
\dot e(t) = -2R(t) (R(t)^T e(t) + \delta(t))
\end{equation}
Consider the function $V = \frac{1}{4}\sum_{k=1}^m e_k^2$ as a Lyapunov-like function candidate for \eqref{error_system2}. Similarly to the analysis in \cite{sun2015event}, we define a sub-level set $\mathcal{B}(\rho)= \{e: V(e) \leq \rho\}$ for some suitably small $\rho$, such that when $e \in \mathcal{B}(\rho)$ the formation is infinitesimally minimally rigid and $R(p(t))R(p(t))^T$ is positive definite.
Before giving the main proof, we record the following key result on the entries of the matrix $R(p(t))R(p(t))^T$.
\begin{lemma}\label{L_smooth1}
When the formation shape is close to the desired one such that the distance error $e$ is in the set $\mathcal{B}(\rho)$, the entries of the matrix $R(p(t))R(p(t))^T$ are continuously differentiable functions of $e$.
\end{lemma}
This lemma enables one to discuss the \emph{self-contained} distance error system \eqref{error_system2} and thus a Lyapunov argument can be applied to show the convergence of the distance errors. The proof of Lemma \ref{L_smooth1} can be found in \cite{SMA14TACsub} or \cite{sun2014finite} and will not be presented here. From Lemma \ref{L_smooth1}, one can show that
\begin{align} \label{derivative_lya2}
\dot V(t) &= \frac{1}{2} e(t)^T \dot e(t) = -e(t)^T R(t) (R(t)^T e(t) + \delta(t)) \nonumber \\
&= -e(t)^T R(t)R(t)^T e(t) - e(t)^T R(t) \delta(t) \nonumber \\
& \leq -\|R(t)^T e(t)\|^2 + \|e(t)^T R(t)\| \| \delta(t) \|
\end{align}
If we enforce the norm of $\delta(t)$ to satisfy
\begin{equation} \label{delta_norm}
\|\delta(t)\| \leq \gamma \|R(t)^T e(t)\|
\end{equation}
and choose the parameter $\gamma$ to satisfy $0< \gamma <1$, then we can guarantee that
\begin{equation} \label{eq:Derivative_Lya}
\dot V(t) \leq (\gamma -1) \|R(t)^T e(t)\|^2 <0
\end{equation}
This indicates that events are triggered when
\begin{equation} \label{trigger_function}
f := \|\delta(t)\| - \gamma \|R(t)^T e(t)\| = 0
\end{equation}
The event time $t_h$ is defined to satisfy $f(t_h) = 0$ for $h = 0,1,2, \cdots$. For the time interval $t \in [t_h, t_{h+1})$, the control input is chosen as $u(t) = u(t_h)$ until the next event is triggered. Furthermore, every time when an event is triggered, the event vector $\delta$ will be reset to zero.
We also show two key properties of the formation control system \eqref{position_system} with the above event function \eqref{trigger_function}.
\begin{lemma} \label{lemma_fixed_centroid}
The formation centroid remains constant under the control of \eqref{position_system} with the event function \eqref{trigger_function}.
\end{lemma}
\begin{proof}
Denote by $\bar p(t) \in \mathbb{R}^d$ the center of the mass of the formation, i.e., $\bar p(t) = \frac{1}{n} \sum_{i=1}^n p_i(t) = \frac{1}{n}(\mathbf{1}_n \otimes I_d)^T p(t)$.
One can show
\begin{align} \label{eq:formation_centroid_fixed}
\dot {\bar p}(t) &= \frac{1}{n}(\mathbf{1}_n \otimes I_d)^T \dot p(t) \nonumber \\
& = -\frac{1}{n}(\mathbf{1}_n \otimes I_d)^T R(p(t_h))^T e(t_h) \nonumber \\
&= -\frac{1}{n}\left( Z(t_h)^T \bar H (\mathbf{1}_n \otimes I_d) \right)^T e(t_h)
\end{align}
Note that $ker(H) = span\{\mathbf{1}_n\}$ and therefore $ker(\bar H) = span\{\mathbf{1}_n \otimes I_d\}$. Thus $\dot {\bar p}(t) = 0$, which indicates that the formation centroid remains constant.
\end{proof}
The following lemma concerns the coordinate frame requirement and enables each agent to use its local coordinate frame to implement the control law, which is favourable for networked formation control systems in e.g. GPS denied environments.
\begin{lemma} \label{lemma:local_coordinate}
To implement the controller \eqref{position_system} with the event-based control update condition in \eqref{trigger_function}, each agent can use its own local coordinate frame which does not need to be aligned with a global coordinate frame.
\end{lemma}
The proof for the above lemma is omitted here, as it follows similar steps as in \cite[Lemma 4]{sun2014finite}. Note that Lemma \ref{lemma:local_coordinate} implies the event-based formation system \eqref{position_system} guarantees the $SE(N)$ invariance of the controller, which is a nice property to enable convenient implementation for networked control systems without coordinate alignment for each individual agent \cite{SE_N_INVARIANCE}.
We now arrive at the following main result of this section.
\begin{theorem} \label{theorem_main_1}
Suppose the target formation is infinitesimally and minimally rigid and the initial formation shape is close to the target one. By using the above controller \eqref{position_system} and the event-triggering function \eqref{trigger_function}, all the agents will reach the desired formation shape locally exponentially fast.
\end{theorem}
\begin{proof}
The above analysis relating to Eq. \eqref{derivative_lya2}-\eqref{trigger_function} establishes boundedness of $e(t)$ since $\dot V$ is nonpositive. Now we show the exponential convergence of $e(t)$ to zero will occur from a ball around the origin, which is equivalent to the desired formation shape being reached
exponentially fast. According to Lemma \ref{L_RP}, let $\bar \lambda_{\text{min}}$ denote the smallest eigenvalue of $M(e) :=R(p)R(p)^T$ when $e(p)$ is in the set $\mathcal{B} (\rho) $ (i.e. $\bar \lambda_{\text{min}} = \mathop {\min }\limits_{e \in \mathcal{B}(\rho)} \lambda (M(e)) >0$). Note that $\bar \lambda_{\text{min}}$ exists because the set $\mathcal{B} (\rho)$ is a compact set with respect to $e$ and the eigenvalues of a matrix are continuous functions of the matrix elements. By recalling \eqref{eq:Derivative_Lya}, there further holds
\begin{align}
\dot V(t) \leq (\gamma - 1) \bar \lambda_{\text{min}} \| e(t)\|^2
\end{align}
Thus one concludes
\begin{align} \label{eq:exponential_e}
\|e(t)\| \leq \text{exp}({- \kappa t}) \|e(0)\|
\end{align}
with the exponential decaying rate no less than $\kappa = 2(1- \gamma) \bar \lambda_{\text{min}}$.
\end{proof}
Note that the convergence of the inter-agent distance error of itself does not directly guarantee the convergence of agents' positions $p(t)$ to some fixed points, even though it does guarantee convergence to a correct formation shape. This is because that the desired equilibrium corresponding to the correct rigid shape is not a single point, but is a set of equilibrium points induced by rotational and translation invariance (for a detailed discussion to this subtle point, see \cite[Chapter 5]{dorfler_thesis}).
A sufficient condition for this strong convergence to a stationary formation is guaranteed by the exponential convergence, which was proved above. To sum up, one has the following lemma on the convergence of the position system \eqref{position_system_compact} as a consequence of Theorem \ref{theorem_main_1}.
\begin{lemma} \label{lemma:fixed_final_position}
The event-triggered control law \eqref{position_system} and the event function \eqref{trigger_function} guarantee the convergence of $p(t)$ to a fixed point.
\end{lemma}
\begin{remark}
We remark that the above Theorem 1 (as well as the subsequent results in later sections) concerns a \emph{local} convergence. This is because the rigid formation shape control system is \emph{nonlinear} and typically exhibits \emph{multiple} equilibria, which include the ones corresponding to correct formation shapes and those that do not correspond to correct shapes. It has been shown in \cite{anderson2014counting} by using the tool of Morse theory that multiple equilibria, including incorrect equilibria, are a consequence of any formation shape control algorithm which evolves in a steepest descent direction of a smooth cost function that is invariant under translations and rotations. A recent paper \cite{zhiyong_CDC15} proves the instability of a set of degenerate equilibria that live in a lower dimensional space. However, the stability property for more general equilibrium points is still unknown. It is in fact considered as a very challenging open problem to obtain an almost global convergence result for general rigid formations, except for some special formation shapes such as 2-D triangular formation shape, or 2-D rectangular shape, or 3-D tetrahedral shape (see the review in \cite{oh2012survey, park2018distance}). We note that local convergence is still valuable in practice, if one assumes that initial shapes are close to the target ones (which is a very common assumption in most rigidity-based formation control works; see e.g., \cite{oh2012survey, krick2009stabilisation, dorfler2010geometric, ramazani2017rigidity, sun2014finite, sun2016exponential, Raik_SIAM}).
\end{remark}
\subsection{Exclusion of Zeno behavior}
In this section, we will analyze the exclusion of possible Zeno triggering behavior of the event-based formation control system \eqref{position_system}.
The following presents a formal definition of Zeno triggering (which is also termed \emph{Zeno execution} in the hybrid system study \cite{ames2006stability}).
\begin{definition} \label{def:zeno-triggering}
For agent $i$, a triggering is \emph{Zeno} if
\begin{align}
\lim_{h \rightarrow \infty} t_h^i = \sum_{h=0}^{\infty} (t_{h+1}^i - t_h^i) = t_{\infty}^i
\end{align}
for some finite $t_{\infty}^i$ (termed the \emph{Zeno time}).
\end{definition}
Generally speaking, Zeno-triggering of an event controller means that it triggers an infinite number of events in a finite time period, which is an undesirable triggering behavior.
Therefore, it is important to exclude the possibility of Zeno behavior in an event-based system.
In the following we will show that the event-triggered system \eqref{position_system} does not exhibit Zeno behavior.
Note that the triggering function \eqref{trigger_function} involves the evolution of the term $R(t)^T e(t)$, whose derivative is calculated as
\begin{align}
\frac{\text{d} (R(t)^T e(t))}{\text{d}t} = & \dot R(t)^T e(t) + R(t)^T \dot e(t) \nonumber \\
= & \bar H^T \dot Z(t) e(t) \nonumber \\
& -2 R(t)^T R(t) (R(t)^T e(t) +\delta(t)) \nonumber \\
\end{align}
According to the construction of the vector $\delta(t)$ in \eqref{eq:definition_delta}, there also holds $\dot \delta(t) = - \frac{\text{d} (R(t)^T e(t))}{\text{d}t}$.
Before presenting the proof, we first show a useful bound.
\begin{lemma} \label{lemma:bound_RTe}
The following bound holds:
\begin{align} \label{eq:bound_RTe}
\|\bar H^T \dot Z(t) e(t)\| &\leq \sqrt{d} \| \bar H^T \| \|\bar H \| \|e(t)\| \|\dot p(t)\| \nonumber \\
&\leq \sqrt{d} \| \bar H^T \| \|\bar H \| \|e(0)\| \|R(t)^T e(t) +\delta(t)\| \nonumber \\
\end{align}
\end{lemma}
\begin{proof}
We first show a trick to bound the term $\| \dot Z(t) e(t)\|$ by deriving an alternative expression for $\dot Z(t) e(t)$:
\begin{small}
\begin{align}
\dot Z(t) e(t) &= \text{diag}\{\dot z_1(t), \dot z_2(t), \cdots, \dot z_m(t)\} e(t) \nonumber \\
&= \left[
\begin{array}{c}
e_1(t) \dot z_1(t) \\
e_2(t) \dot z_2(t) \\
\vdots \\
e_m(t) \dot z_m(t) \\
\end{array}
\right] \nonumber \\
& = \left( \left[
\begin{array}{cccc}
e_1(t) & 0 & \cdots & 0 \\
0 & e_2(t) & \cdots & 0 \\
\vdots & \vdots & \ddots & \vdots \\
0 & 0 & \cdots & e_m(t)
\end{array}
\right] \otimes I_d \right)
\left[
\begin{array}{c}
\dot z_1(t) \\
\dot z_2(t) \\
\vdots \\
\dot z_m(t) \\
\end{array}
\right] \nonumber \\
& = : \left(E(t) \otimes I_d \right) \dot z(t) \nonumber \\
\end{align}
\end{small}
where $E(t)$ is defined as a diagonal matrix in the form $E(t) = \text{diag}\{e_1(t), e_2(t), \cdots, e_m(t)\}$.
Note that $z(t) = \bar H p(t)$ and thus $\dot z(t) = \bar H \dot p(t)$. Then one has
\begin{align}
\| \bar H^T \dot Z(t) e(t)\| &= \| \bar H^T \left(E(t) \otimes I_d \right) \dot z(t)\| \nonumber \\
&\leq \| \bar H^T \| \|\left(E(t) \otimes I_d \right)\| \|\bar H \dot p(t)\| \nonumber \\
&\leq \| \bar H^T \| \|\bar H \| \|\left(E(t) \otimes I_d \right)\|_F \|\dot p(t)\| \nonumber \\
&\leq \sqrt{d} \| \bar H^T \| \|\bar H \| \|e(t)\| \|R(t)^T e(t) +\delta(t)\|
\end{align}
where we have used the following facts
\begin{align}
&\|E(t) \| \leq \|E(t) \|_F \nonumber \\
& \|\left(E(t) \otimes I_d \right)\|_F = \sqrt{d}\|E(t) \|_F \nonumber \\
& \|E(t)\|_F = \|e(t)\| \nonumber
\end{align}
The first inequality in \eqref{eq:bound_RTe} is thus proved.
The second inequality in \eqref{eq:bound_RTe} is due to the fact that $\|e(t)\| \leq \|e(0)\|, \forall t>0$ shown in \eqref{eq:exponential_e}.
\end{proof}
We now show that the Zeno triggering does not occur in the formation control system \eqref{position_system} with the triggering function \eqref{trigger_function} by proving a positive lower bound on the inter-event time interval.
\begin{theorem}
The inter-event time interval $\{t_{h+1} - t_{h}\}$ is lower bounded by a positive value $\tau$
\begin{equation}
\tau = \frac{\gamma}{\alpha(1+\gamma)} >0
\end{equation}
where
\begin{align} \label{eq:alpha}
\alpha &= \sqrt{d} \| \bar H^T \| \|\bar H \| \|e(0)\| + \sqrt{2} \bar \lambda_{\text{max}}(R^TR(e)) >0 \nonumber \\
\end{align}
in which $\bar \lambda_{\text{max}}$ denotes the largest eigenvalue of $R^TR(e)$ when $e(p)$ is in the set $\mathcal{B} (\rho)$ (i.e. $\bar \lambda_{\text{max}} = \mathop {\text{max} }\limits_{e \in \mathcal{B} (\rho)} \lambda (R^TR(e)) >0$), and
$\gamma$ is the triggering parameter designed in \eqref{trigger_function} which satisfies $\gamma \in (0,1)$. Thus, Zeno triggering will not occur for the rigid formation control system \eqref{position_system} with the triggering function \eqref{trigger_function}.
\end{theorem}
\begin{proof}
We show that the growth of $\|\delta\|$ from 0 to the triggering threshold value $\gamma \|R^T e\|$ needs to take a positive time interval. To show this, the relative growth rate on $\|\delta(t)\|/ \|R(t)^T e(t)\|$ is considered. The following proof is inspired by the one used in \cite{tabuada2007event}. In the following derivation, we omit the argument of time $t$ but it should be clear that each state variable and vector is considered as a function of $t$.
\begin{small}
\begin{align}
\frac{\text{d}}{\text{d}t} \frac{\|\delta\|}{\| R^T e\|}
\leq & \left (1+ \frac{\|\delta\|} {\| R^T e \|} \right) \frac{ \|\dot R^T e + R^T \dot e\|}{\|R^T e\|} \nonumber \\
= &\left (1+ \frac{\|\delta\|} {\| R^T e \|} \right) \frac{ \|\bar H^T \dot Z e + R^T \dot e\|}{\|R^T e\|} \nonumber \\
\leq &\left (1+ \frac{\|\delta\|} {\| R^T e \|} \right) \nonumber \\
& \left ( \frac{\sqrt{d} \| \bar H^T \| \|\bar H \| \|e\| \|\dot p\| + \|2R^T R(R^T e +\delta)\|}{\|R^T e\|} \right) \nonumber \\
& \text{(appealing to Lemma \ref{lemma:bound_RTe})} \nonumber \\
\leq &\left (1+ \frac{\|\delta\|} {\| R^T e \|} \right) \nonumber \\
&\left ( (\sqrt{d} \| \bar H^T \| \|\bar H \| \|e(0)\| + \|2R^T R\|) \left (1 +\frac{\|\delta)\|}{\|R^T e\|}\right) \right) \nonumber \\
\leq & \alpha\left (1+ \frac{\|\delta\|} {\| R^T e \|} \right)^2
\end{align}
\end{small}
where $\alpha$ is defined in \eqref{eq:alpha}. Note that $\bar \lambda_{\text{max}}$ always exists and is finite (i.e. upper bounded) because the set $\mathcal{B} (\rho)$ is a compact set with respect to $e$ and the eigenvalues of a matrix are continuous functions of the matrix elements. Thus, $\alpha$ defined in \eqref{eq:alpha} exists, which is positive and upper bounded. If we denote $\frac{\|\delta\|}{\| R^T e\|}$ by $y$ we have the estimate $\dot y(t) \leq \alpha(1+y(t))^2$. By the comparison principle there holds $y(t) \leq \phi (t, \phi_0)$ where $\phi (t, \phi_0)$ is the solution of $\dot \phi = \alpha(1+ \phi)^2$ with initial condition $\phi(0, \phi_0) = \phi_0$.
Solving the differential equation for $\phi$ in the time interval $t \in [t_h, t_{h+1})$ yields $\phi(\tau, 0) = \frac{\tau \alpha}{1- \tau \alpha}$.
The inter-execution time interval is thus bounded by the time it takes for $\phi$ to evolve from 0 to $\gamma$. Solving the above equation, one obtains a positive lower bound for the inter-event time interval $\tau = \frac{\gamma}{\alpha(1+\gamma)}$. Thus, Zeno behavior is excluded for the formation control system \eqref{position_system}.
The proof is completed.
\end{proof}
\begin{remark} We review several event-triggered formation strategies reported in the literature and highlight the advantages of the event-triggered approach proposed in this section. In \cite{sun2015event}, the triggering function is based on the information of the distance error $e$ only, which cannot guarantee a pure piecewise-constant update of the formation control input. The event function designed in \cite{Liu2015event} is based on the information of the relative position $z$, while the event function designed \cite{CCC_CHENFEI} is based on the absolute position $p$. It is noted that event functions and triggering conditions such as those in \cite{Liu2015event} and \cite{CCC_CHENFEI} are very complicated, which may limit their practical applications.
The event function \eqref{trigger_function} designed in this section involves the term $R^T e$, in which the information of the relative position $z$ (involved in the entries of the rigidity matrix $R$) and of the distance error $e$ has been included.
Such an event triggering function greatly reduces the controller complexity while at the same time also maintains the discrete-time update nature of the control input.
\end{remark}
\section{Event-based controller design: distributed case} \label{sec:distributed}
\subsection{Distributed event controller design}
In this section we will further show how to design a distributed event-triggered formation controller in the sense that each agent can use only local measurements in terms of relative positions with respect to its neighbors to determine the next triggering time and control update value. Denote the event time for each agent $i$ as $t_0^i, t_1^i, \cdots, t_h^i, \cdots$. The dynamical system for agent $i$ to achieve the desired inter-agent distances is now rewritten as
\begin{align}\label{position_system_distributed_controller}
\dot p_i(t) &= u_i(t) = u_i(t_h^i), \forall t \in [t_h^i, t_{h+1}^i)
\end{align}
and we aim to design a distributed event function with feasible triggering condition such that the control input for agent $i$ is updated at its own event times $t_0^i, t_1^i, \cdots, t_h^i, \cdots$ based on local information. \footnote{ Again, Filippov solutions \cite{cortes2008discontinuous} are envisaged for the differential equation \eqref{position_system_distributed_controller} with switching controls at every event updating instant. }
We consider the same Lyapunov function candidate as the one in Section \ref{sec:centralized}, but calculate the derivative as follows:
\begin{align} \label{derivative_lya_distributed}
\dot V(t) = & \frac{1}{2} e(t)^T \dot e(t) = -e(t)^T R(t) (R(t)^T e(t) + \delta(t)) \nonumber \\
= & -e(t)^T R(t)R(t)^T e(t) - e^T R(t) \delta(t) \nonumber \\
\leq & -\|R(t)^T e(t)\|^2 + \|e(t)^T R(t) \delta(t) \| \nonumber \\
\leq &- \sum_{i=1}^n \|\{R(t)^T e(t)\}_i\|^2 + \sum_{i=1}^n \|\{R(t)^T e(t)\}_i\| \| \delta_i(t) \| \nonumber \\
\end{align}
where $\{R(t)^T e(t)\}_i \in \mathbb{R}^d$ is a vector block taken from the $(di-d+1)$th to the $(di)$th entries of the vector $R(t)^T e(t)$, and $\delta_i(t)$ is a vector block taken from the $(di-d+1)$th to the $(di)$th entries of the vector $\delta(t)$. According to the definition of the rigidity matrix in \eqref{row_R}, it is obvious that $\{R(t)^T e(t)\}_i$ only involves local information of agent $i$ in terms of relative position vectors $z_{k_{ij}}$ and distance errors $e_{k_{ij}}$ with $j \in \mathcal{N}_i$. Based on this, the control input for agent $i$ is designed as
\begin{align}\label{position_system_distributed}
\dot p_i(t) & = u_i(t_h^i) = \sum_{j \in \mathcal{N}_i} (p_j(t_h^i) - p_i(t_h^i)) e_k(t_h^i)) \nonumber \\
& = \{R(t_h^i)^T e(t_h^i)\}_i\,\,\,\forall t \in [t_h^i, t_{h+1}^i)
\end{align}
Note that there holds
\begin{align} \label{define_delta_i}
\delta_i(t) = \{R(t_h^i)^T e(t_h^i)\}_i - \{R(t)^T e(t)\}_i
\end{align}
and we can restate \eqref{position_system_distributed} as $\dot p_i(t) = - \{R(t)^T e(t)\}_i - \delta_i(t), t \in [t_h^i, t_{h+1}^i)$.
By using the inequality $\|\{R(t)^T e(t)\}_i\| \| \delta(t)_i \| \leq \frac{1}{2a_i} \| \delta(t)_i \|^2 + \frac{a_i}{2} \|\{R(t)^T e(t)\}_i\|^2$ with $a_i \in (0,1)$, the above inequality \eqref{derivative_lya_distributed} on $\dot V$ can be further developed as
\begin{align}
\dot V(t) \leq & - \sum_{i=1}^n \|\{R(t)^T e(t)\}_i\|^2 \nonumber \\
& + \sum_{i=1}^n \frac{a_i}{2} \|\{R(t)^T e(t)\}_i\|^2 + \sum_{i=1}^n \frac{1}{2a_i} \| \delta_i(t) \|^2 \nonumber \\
= & -\sum_{i=1}^n \frac{2-a_i}{2}\|\{R(t)^T e(t)\}_i\|^2 + \sum_{i=1}^n \frac{1}{2a_i} \| \delta_i(t) \|^2 \nonumber
\end{align}
If we enforce the norm of $\delta_i(t)$ to satisfy
\begin{equation} \label{distributed_trigger2}
\frac{1}{2a_i} \| \delta_i(t) \|^2 \leq \gamma_i \frac{2-a_i}{2}\|\{R(t)^T e(t)\}_i\|^2
\end{equation}
with $\gamma_i \in (0,1)$, we can guarantee
\begin{align} \label{derivative_lya_distributed_3}
\dot V(t) \leq \sum_{i=1}^n (\gamma_i -1) \frac{2-a_i}{2}\|\{R(t)^T e(t)\}_i\|^2
\end{align}
This implies that one can design a local triggering function for agent $i$ as
\begin{equation} \label{distributed_trigger_local_function}
f_i(t) : = \| \delta_i(t) \|^2 - \gamma_i a_i (2-a_i) \|\{R(t)^T e(t)\}_i\|^2
\end{equation}
and the event time $t_h^i$ for agent $i$ is defined to satisfy $f_i( t_h^i ) = 0$ for $h = 0,1,2, \cdots$. For the time interval $t \in [t_h^i, t_{h+1}^i)$, the control input is chosen as $u_i(t) = u_i(t_h^i)$ until the next event for agent $i$ is triggered. Furthermore, every time an event is triggered for agent $i$, the local event vector $\delta_i$ will be reset to zero. Note that the condition $a_i \in (0,1)$ will also be justified in later analysis in Lemma \ref{lemma:feasibility}.
The convergence result with the distributed event-based formation controller and triggering function is summarized as follows.
\begin{theorem} \label{theorem:distributed_exponential}
Suppose that the target formation is infinitesimally and minimally rigid and the initial formation shape is close to the target one. By using the above controller \eqref{position_system_distributed} and the distributed event function \eqref{distributed_trigger_local_function}, all the agents will reach the desired formation shape locally exponentially fast.
\end{theorem}
\begin{proof}
The analysis is similar to Theorem \ref{theorem_main_1} and we omit several steps here. Based on the derivation in Eqs. \eqref{derivative_lya_distributed}-\eqref{distributed_trigger_local_function}, one can conclude that
\begin{align} \label{eq:exponential_e_distributed}
\|e(t)\| \leq \text{exp}(- \kappa t) \|e(0)\|
\end{align}
with the exponential rate no less than $\kappa = 2 \zeta_{\text{min}} \bar \lambda_{\text{min}}$ where $\zeta_{\text{min}} = \text{min}_{i} (1- \gamma_i ) \frac{2-a_i}{2}$.
\end{proof}
The exponential convergence of $e(t)$ implies that the above local event-triggered controller \eqref{position_system_distributed} also guarantees the convergence of $p$ to a fixed point, by which one can conclude a similar result to the one in Lemma \ref{lemma:fixed_final_position}.
For the formation system with the distributed event-based controller, an analogous result to Lemma \ref{lemma:local_coordinate} on coordinate frame requirement is as follows.
\begin{lemma}
To implement the distributed formation controller \eqref{position_system_distributed}, each agent can use its own local coordinate frame to measure the relative positions to its neighbors and a global coordinate frame is not required. Furthermore, to detect the distributed event condition \eqref{distributed_trigger2}, a local coordinate frame is sufficient which is not required to be aligned with the global coordinate frame.
\end{lemma}
\begin{proof}
The proof of the first statement on the distributed controller \eqref{position_system_distributed} follows similar steps as in \cite[Lemma 4]{sun2014finite} and is omitted here. We then prove the second statement on the event condition \eqref{distributed_trigger2}. Suppose agent $i$'s position in a global coordinate frame is measured as $p_i^g$, while $p_i^i$ and $p_j^i$ stand for agent $i$ and its neighboring agent $j$'s positions measured by agent $i$'s local coordinate frame. Clearly, there exist a rotation matrix $\mathcal{Q}_i \in \mathbb{R}^{d \times d}$ and a translation vector $\vartheta_i \in \mathbb{R}^{d}$, such that $p_j^i = \mathcal{Q}_i p_j^g + \vartheta_i$. We also denote the relative position between agent $i$ and agent $j$ as $z_{k_{ij}}^i$ measured by agent $i$'s local coordinate frame, and $z_{k_{ij}}^g$ measured by the global coordinate frame. Obviously there holds $z_{k_{ij}}^i = p_j^i - p_i^i = \mathcal{Q}_i ( p_j^g - p_i^g) = \mathcal{Q}_i z_{k_{ij}}^g$ and thus $\|z_{k_{ij}}^i\| = \|z_{k_{ij}}^g\|$. Also notice that the event condition \eqref{distributed_trigger2} involves the terms $\delta_i$ and $\{R(t)^T e(t)\}_i$ which are functions of the relative position vector $z$, and thus event detection using \eqref{distributed_trigger_local_function} remains unchanged regardless of what coordinate frames are used. Since $\mathcal{Q}_i$ and $\vartheta_i$ are chosen arbitrarily, the above analysis concludes that the detection of the local event condition \eqref{distributed_trigger_local_function} is independent of a global coordinate basis, which implies that agent $i$'s local coordinate frame is sufficient to implement \eqref{distributed_trigger2}.
\end{proof}
The above lemma indicates that the distributed event-based controller \eqref{position_system_distributed} and distributed event function \eqref{distributed_trigger_local_function} still guarantee the $SE(N)$ invariance property and enable a convenient implementation for the proposed formation control system without coordinate alignment for each individual agent.
Differently to Lemma \ref{lemma_fixed_centroid}, we show that the distributed event-based controller proposed in this section cannot guarantee a fixed formation centroid.
\begin{lemma}
The position of the formation centroid is not guaranteed to be fixed when the distributed event-based controller \eqref{position_system_distributed} and event function \eqref{distributed_trigger_local_function} are applied.
\end{lemma}
\begin{proof}
The dynamics for the formation centroid can be derived as
\begin{align} \nonumber
\dot {\bar p}(t) &= \frac{1}{n}(\mathbf{1}_n \otimes I_d)^T \dot p(t)
\end{align}
However, due to the \emph{asymmetric} update of each agent's control input by using the local event function \eqref{distributed_trigger_local_function} to determine a local triggering time, one cannot decompose the vector $\dot p(t)$ into terms involving $\bar H$ and a single distance error vector as in \eqref{eq:formation_centroid_fixed}. Thus $\dot {\bar p}(t)$ is not guaranteed to be zero and there exist motions for the formation centroid when the distributed event-based controller \eqref{position_system_distributed} is applied.
\end{proof}
\begin{remark}
We note a key property of the distributed event-based controller \eqref{position_system_distributed} and \eqref{distributed_trigger_local_function} proposed in this section. It is obvious from \eqref{position_system_distributed} and \eqref{distributed_trigger_local_function} that each agent $i$ updates its own control input by using only local information in terms of relative positions of its neighbors (which can be measured by agent $i$'s local coordinate system), and is not affected by the control input updates from its neighbors. Thus, such local event-triggered approach does not require any communication between any two agents.
\end{remark}
\subsection{Triggering behavior analysis}
This subsection aims to analyze some properties of the distributed event-triggered control strategy proposed above. Generally speaking, singular triggering means no more triggering exists after a feasible triggering event, and continuous triggering means that events are triggered continuously. For the definitions of singular triggering and continuous triggering, we refer the reader to \cite{fan2013distributed}. The following lemma shows the triggering feasibility with the local and distributed event-based controller \eqref{position_system_distributed} by excluding these two cases.
\begin{lemma} \label{lemma:feasibility}
(Triggering feasibility) Consider the distributed formation system with the distributed event-based controller \eqref{position_system_distributed} and the distributed event function \eqref{distributed_trigger_local_function}. If there exists $t_h^i$ such that $\{R(t_h^i)^T e(t_h^i)\}_i \neq 0$, then
\begin{itemize}
\item (No singular triggering) agent $i$ will not exhibit singular triggering for all $t>t_h^i$.
\item (No continuous triggering) agent $i$ will not exhibit continuous triggering for all $t>t_h^i$.
\end{itemize}
\end{lemma}
\begin{proof}
The proof is inspired by \cite{fan2013distributed}. First note that due to $a_i \in (0,1)$, there holds $a_i(2-a_i) \in (0,1)$ and because $\gamma_i \in (0,1)$, there further holds $\gamma_i a_i(2-a_i) \in (0,1)$. For notational convenience, define
\begin{align} \label{eq:varrho}
\varrho_i: = \gamma_i a_i(2-a_i)
\end{align}
From \eqref{define_delta_i} and \eqref{distributed_trigger2}, for $t \in [t_h^i, t_{h+1}^i)$ one has
\begin{align}
\underline{\chi}_i := \frac{\|\{R(t_h^i)^T e(t_h^i)\}_i\|}{1+\sqrt{\varrho_i}} & \leq \|\{R(t)^T e(t)\}_i\| \nonumber \\
& \leq \frac{\|\{R(t_h^i)^T e(t_h^i)\}_i\|}{1-\sqrt{\varrho_i}} =: \overline{\chi}_i
\end{align}
We first prove the statement on non-singular triggering. According to the definition of the event-triggering function \eqref{distributed_trigger_local_function}, local events for agent $i$ can only occur either when $\|\{R(t)^T e(t)\}_i\|$ equals $\underline{\chi}_i$ or when $\|\{R(t)^T e(t)\}_i\|$ equals $\overline{\chi}_i$. Note that $\|\{R(t)^T e(t)\}_i\|^2 \leq \|\{R(t)^T e(t)\}\|^2 \leq \bar \lambda_{\text{max}}(R(t)^TR(t)) \|e(t)\|^2$, where $\bar \lambda_{\text{max}}$ is the largest eigenvalue of $R(t)^TR(t)$ which is bounded for any $e \in \mathcal{B}(\rho)$. Also note that $\|e(t)\|^2$ decays exponentially fast to zero as proved in Theorem 3. This implies that $\|\{R(t)^T e(t)\}_i\|$ will eventually decrease to $\underline{\chi}_i$. By assuming that $\{R(t_h^i)^T e(t_h^i)\}_i \neq 0$, the next event time $t_{h+1}^i$ for agent $i$ always exists with $\{R(t_{h+1}^i)^T e(t_{h+1}^i)\}_i \neq 0$.
The second statement can be proved by using similar arguments to those above, and by observing that $\{R(t)^T e(t)\}_i$ evolves continuously and a local event is triggered if and only if \eqref{distributed_trigger_local_function} is satisfied.
\end{proof}
In the following we will further discuss the possibility of the Zeno behavior in the distributed event-based formation system \eqref{position_system_distributed}.
\begin{theorem} \label{theorem:no_zeno1}
(Exclusion of Zeno triggering) Consider the distributed formation system with the distributed event-based controller \eqref{position_system_distributed} and the distributed event function \eqref{distributed_trigger_local_function}.
\begin{itemize}
\item At least one agent does not exhibit Zeno triggering behavior.
\item In addition, if there exists $\epsilon >0$ such that $\|\{R(t)^T e(t)\}_i\|^2 \geq \epsilon \|e(t)\|^2$ for all $i =1,2, \cdots, n$ and $t \geq 0$, then there exists a common positive lower bound for any inter-event time interval for each agent. In this case, no agent will exhibit Zeno triggering behavior.
\end{itemize}
\end{theorem}
\begin{proof}
Note that $\| \delta_i(t) \|^2 \leq \| \delta(t) \|^2$ for any $i$. In addition, there exists an agent $i_*$ such that $\|\{R(t)^T e(t)\}_{i_*}\|^2 \geq \frac{1}{m} \|\{R(t)^T e(t)\}\|^2$.
Then one has
\begin{align}
\frac{\| \delta_{i_*}(t) \|}{\|\{R(t)^T e(t)\}_{i_*}\|} \leq \sqrt{m} \frac{\| \delta(t) \|}{\|\{R(t)^T e(t)\}\|}
\end{align}
By recalling the proof in Theorem 2, we can conclude that the inter-event interval for agent $i_*$ is bounded from below by a time $\tau_{i_*}$ that satisfies
\begin{align}
\sqrt{m} \frac{\tau_{i_*} \alpha}{1- \tau_{i_*} \alpha} = \sqrt{\gamma_{i_*} a_{i_*}(2-a_{i_*})}
\end{align}
So that $\tau_{i_*} = \frac{\sqrt{\gamma_{i_*} a_{i_*}(2-a_{i_*})}}{ \alpha (\sqrt{m}+\sqrt{\gamma_{i_*} a_{i_*}(2-a_{i_*})})} >0$. The first statement is proved.
We then prove the second statement. Denote $\bar \lambda_{\text{max}}$ as the maximum of $\lambda_{\text{max}} (R^T R(e))$ for all $e \in \mathcal{B}(\rho)$. Since $\mathcal{B}(\rho)$ is a compact set, $\bar \lambda_{\text{max}}$ exists and is bounded. Then there holds $\|\{R(t)^T e(t)\}\|^2 \leq \bar \lambda_{\text{max}} \|e(t)\|^2$. One can further show
\begin{align}
\|\{R(t)^T e(t)\}_i\|^2 \geq \epsilon \|e(t)\|^2 \geq \frac{\epsilon}{\bar \lambda_{\text{max}}} \|\{R(t)^T e(t)\}\|^2
\end{align}
By following a similar argument to that above and using the analysis in the proof of Theorem 2, a lower bound on the inter-event interval $\bar \tau_i$ for each agent can be calculated as
\begin{align}
\bar \tau_i = \frac{\sqrt{\varrho_i}}{ \alpha \left(\sqrt{\frac{ \bar \lambda_{\text{max}}}{\epsilon}}+\sqrt{\varrho_i}\right)} >0, \,\,i = 1,2, \cdots, n
\end{align}
The proof is completed.
\end{proof}
\begin{remark}
The first part of Theorem \ref{theorem:no_zeno1} is motivated by \cite[Theorem 4]{dimarogonas2012distributed}, which guarantees the exclusion of Zeno behavior for at least one agent. To improve the result for all the agents, we propose a condition in the second part of Theorem \ref{theorem:no_zeno1}.
The above results in Theorem \ref{theorem:no_zeno1} on the distributed event-based controller are more conservative than the centralized case. The condition on the existence of $\epsilon >0$ essentially guarantees that $\|\{R(t)^T e(t)\}_i\|$ cannot be zero at any finite time, and will be zero if and only if $t = \infty$. By a similar analysis from event-based multi-agent consensus dynamics in \cite{SUN2018264}, one can show that if $\|\{R(t)^T e(\hat t)\}_i\| = 0$ at some finite time instant $\hat t$, then agent $i$ will exhibit a Zeno triggering and the time $\hat t$ is a Zeno time for agent $i$.
However, we have performed many simulations with different rigid formation shapes and observed that in most cases $\|\{R(t)^T e(t)\}_i\|$ is non-zero. We conjecture that this may be due to the infinitesimal rigidity of the formation shape. In the next subsection however, we will provide a simple modification of the distributed controller to remove the condition on $\epsilon$.
\end{remark}
\subsection{A modified distributed event function}
The event function \eqref{distributed_trigger_local_function} for agent $i$ involves the comparison of two terms, i.e. $\| \delta_i(t) \|^2$ and $\gamma_i a_i (2-a_i) \|\{R(t)^T e(t)\}_i\|^2$. As noted above, the existence of $\epsilon >0$ can guarantee $\|\{R(t)^T e(t)\}_i\| \neq 0$ for any finite time $t$. To remove this condition in Theorem \ref{theorem:no_zeno1}, and motivated by \cite{sun2018event}, we propose the following modified event function by including an exponential decay term:
\begin{align} \label{distributed_modified_event}
f_i(t) : = \| \delta_i(t) \|^2 & - \gamma_i a_i (2-a_i) \|\{R(t)^T e(t)\}_i\|^2 \nonumber \\
& - 2a_i v_i \text{exp}(-\theta_i t)
\end{align}
where $v_i>0, \theta_i>0$ are parameters that can be adjusted in the design to control the formation convergence speed. Note that $v_i \text{exp}(-\theta_i t)$ is always positive and converges to zero when $t \rightarrow \infty$. Thus, even if $\{R(t)^T e(t)\}_i$ exhibits a crossing-zero scenario at some finite time instant, the addition of this decay term guarantees a positive threshold value in the event function which avoids the case of comparing $\| \delta_i(t) \|^2$ to a zero threshold.
The main result in this subsection is to show that the above modified event function ensures Zeno-free triggering for all agents, and also drives the formation shape to reach the target one.
\begin{theorem}
By using the proposed distributed event-based formation controller \eqref{position_system_distributed} and the modified distributed event function \eqref{distributed_modified_event}, all the agents will reach the desired formation shape locally exponentially fast and no agent will exhibit Zeno-triggering behavior.
\end{theorem}
\begin{proof}
We consider the same Lyapunov function as used in Theorem 1 and Theorem 3 and follow similar steps as above. The triggering condition from the modified event function \eqref{distributed_modified_event} yields
\begin{align} \label{derivative_lya_distributed_modified}
\dot V(t) \leq \sum_{i=1}^n (\gamma_i -1) \frac{2-a_i}{2}\|\{R(t)^T e(t)\}_i\|^2 + v_i \text{exp}(-\theta_i t)
\end{align}
which follows that
\begin{align}
\dot V(t) \leq - 4\zeta_{\text{min}} \bar \lambda_{\text{min}} V(t) + \sum_{i=1}^n v_i \text{exp}(-\theta_i t)
\end{align}
where $\zeta_{\text{min}}$ is defined as the same to the notation in Theorem 3 (i.e. $\zeta_{\text{min}} = \text{min}_{i} (1- \gamma_i ) \frac{2-a_i}{2}$). For notational convenience, we define $\kappa = 2 \zeta_{\text{min}} \bar \lambda_{\text{min}}$ (also the same to Theorem 3).
By the well-known comparison principle \cite[Chapter 3.4]{khalil1996nonlinear}, it further follows that
\begin{align}
V(t) \leq \,\, & \text{exp}(- 2 \kappa t) V(0) \nonumber \\
& + \sum_{i=1}^n \frac{v_i}{2 \kappa - \theta_i} (\text{exp}(-\theta_i t) - \text{exp}(-2 \kappa t))
\end{align}
which implies that $V(t) \rightarrow 0$ as $t \rightarrow \infty$, or equivalently, $\|e(t)\| \rightarrow 0$, as $t \rightarrow \infty$.
In the following analysis showing exclusion of Zeno behavior we let $t \in [t_h^i, t_{h+1}^i)$.
We first show a sufficient condition to guarantee $f_i(t) \leq 0$ when $f_i(t)$ is defined in \eqref{distributed_modified_event}. Note that $f_i(t) \leq 0$ can be equivalently stated as
\begin{align} \label{eq:inequality_event_condition}
&(\varrho_i +1 ) \| \delta_i(t) \|^2 \nonumber \\
&\leq \varrho_i ( \| \delta_i(t) \|^2 + \|\{R(t)^T e(t)\}_i\|^2) + 2a_i v_i \text{exp}(-\theta_i t)
\end{align}
where $\varrho_i$ is defined in \eqref{eq:varrho}. Note that
\begin{align}
\|\{R(t_h^i)^T e(t_h^i)\}_i\|^2 = &\| \delta_i(t) + \{R(t)^T e(t)\}_i\|^2 \nonumber \\
\leq & 2 (\| \delta_i(t) \|^2 + \|\{R(t)^T e(t)\}_i\|^2)
\end{align}
Thus, a sufficient condition to guarantee the above inequality \eqref{eq:inequality_event_condition} (and the inequality $f_i(t) \leq 0$) is
\begin{align} \label{eq:sufficient_condition_event}
\| \delta_i(t) \|^2 \leq \frac{\varrho_i}{(2\varrho_i +2 )} \|\{R(t_h^i)^T e(t_h^i)\}_i\|^2
+ \frac{2a_i v_i}{\varrho_i +1} \text{exp}(-\theta_i t)
\end{align}
Note that from \eqref{eq:definition_delta} there holds $\dot \delta_i = - \frac{\text{d}}{\text{d}t} \{R(t)^T e(t)\}_i$. It follows that
\begin{small}
\begin{align}
\frac{\text{d}}{\text{d}t} \|\delta_i(t)\| & \leq \frac{\|\delta_i(t)^T\|}{\|\delta_i(t)\|} \|\dot \delta_i(t)\| \nonumber \\
& = \|\frac{\text{d}}{\text{d}t} \{R(t)^T e(t)\}_i \| \nonumber \\
& = \|\sum_{j \in \mathcal{N}_i} (\dot p_j(t) - \dot p_i(t)) e_k(t) + \sum_{j \in \mathcal{N}_i} ( p_j(t) - p_i(t)) \dot e_k(t)\| \nonumber \\
& = \|\sum_{j \in \mathcal{N}_i} (e_{k_{ij}}(t) \otimes I_d + 2 z_{k_{ij}}(t) z_{k_{ij}}(t)^T) (\dot p_j(t) - \dot p_i(t)) \| \nonumber \\
& = \|\sum_{j \in \mathcal{N}_i} Q_{ij}(t) (\{R(t_{h'}^j)^T e(t_{h'}^j)\}_j - \{R(t_h^i)^T e(t_h^i)\}_i) \| \nonumber \\
& \leq \sum_{j \in \mathcal{N}_i} \|Q_{ij}(t) \| \|(\{R(t_{h'}^j)^T e(t_{h'}^j)\}_j - \{R(t_h^i)^T e(t_h^i)\}_i) \| \nonumber \\
& := \alpha_i
\end{align}
\end{small}
where $Q_{ij}(t) : = e_{k_{ij}}(t) \otimes I_d + 2 z_{k_{ij}}(t) z_{k_{ij}}(t)^T$, and $t_{h'}^j = \text{arg max}_{h} \{t_h^j | t_h^j \leq t, j \in \mathcal{N}_i \}$. By a straightforward argument similar to Lemma \ref{lemma:feasibility}, it can be shown that agent $i$ will not exhibit singular
triggering, which indicates $\alpha_i$ cannot be zero for all time intervals. Also note that $\alpha_i$ is upper bounded by a positive constant which implies that $\frac{\text{d}}{\text{d}t} \|\delta_i(t)\|$ is upper bounded. From the sufficient condition given in \eqref{eq:sufficient_condition_event} which guarantees the event triggering condition $f_i(t) \leq 0$ shown in \eqref{distributed_modified_event}, the next inter-event interval for agent $i$ is lower bounded by the solution $\tau_{h}^i$ of the following equation
\begin{small}
\begin{align} \label{eq:Zeno_solution}
\tau_{h}^i \alpha_i = \sqrt{\frac{\varrho_i}{(2\varrho_i +2 )} \|\{R(t_h^i)^T e(t_h^i)\}_i\|^2
+ \frac{2a_i v_i}{\varrho_i +1} \text{exp}(-\theta_i (t_h^i + \tau_{h}^i))}
\end{align}
\end{small}
We note the solution $\tau_{h}^i$ to \eqref{eq:Zeno_solution} always exists and is positive. Thus, no agents will exhibit Zeno-triggering behavior with the modified event function \eqref{distributed_modified_event}.
\end{proof}
\begin{remark}
In the modified event function \eqref{distributed_modified_event}, a positive and exponential decay term $v_i \text{exp}(-\theta_i t)$ is included which guarantees that, even if $\{R(t)^T e(t)\}_i$ becomes zero at some finite time, the inter-event time interval at any finite time is positive and thus Zeno triggering is excluded. A more general strategy for designing a Zeno-free event function is to include a positive $\mathcal{L}^p$ signal in the event function \eqref{distributed_modified_event}. By following a similar analysis to \cite{sun2018event}, one can show that, if the term $v_i \text{exp}(-\theta_i t)$ in \eqref{distributed_modified_event} is replaced by a general positive $\mathcal{L}^p$ signal, the local convergence of the event-based formation control system \eqref{position_system_distributed} with Zeno-free triggering for all agents still holds.
However, a general $\mathcal{L}^p$ signal in \eqref{distributed_modified_event} may only guarantee an asymptotic convergence rather than an exponential convergence of the overall formation system \eqref{position_system_distributed}.
\end{remark}
\section{Simulation results} \label{sec:simulations}
In this section we provide three sets of simulations to show the behavior of certain formations with a centralized event-based controller and a distributed event-based controller, respectively. Consider a double tetrahedron formation in $\mathbb{R}^3$, with the desired distances for each edge being $2$. The initial conditions for each agent are chosen as $p_1(0) = [0,-1.0,0.5]^T$, $p_2(0) = [1.8,1.6,-0.1]^T$, $p_3(0) = [-0.2,1.8,0.05]^T$, $p_4(0) = [1.2,1.9,1.7]^T$ and $p_5(0) = [-1.0,-1.5,-1.2]^T$, so that the initial formation is close to the target one. The parameter $\gamma$ in the trigger function is set as $\gamma = 0.6$. Figs.~2-4 illustrate formation convergence and event performance with a centralized event triggering function. The trajectories of each agent, together with the initial shape and final shape are depicted in Fig. 2. The trajectories of each distance error are depicted in Fig. 3, which shows an exponential convergence to the origin. Fig. 4 shows the triggering time instant and the evolution of the norm of the vector $\delta$ in the triggering function \eqref{trigger_function}, which is obviously bounded below by $\gamma \|R(t)^T e(t)\|$ as required by \eqref{delta_norm}.
\begin{figure}
\centering
\includegraphics[width=75mm]{3d_centralized.pdf}
\caption{Simulation on stabilization control of a double tetrahedron formation in 3-D space with centralized event controller. The initial and final positions are denoted by circles and squares, respectively. The initial formation is denoted by dashed lines, and the final formation is denoted by red solid lines. The black star denotes the formation centroid, which is stationary. }
\label{shape_new}
\label{fig:env}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=60mm]{distance_error_3d_centralized.eps}
\caption{Exponential convergence of the distance errors with centralized event controller. }
\label{distance_error}
\label{fig:env}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=70mm]{trigger_error_3d_centralized.eps}
\caption{Performance of the centralized event-based controller.
Top: evolution of $\|\delta\|$ and $\|\delta\|_{\max} = \gamma \|R(t)^T e(t)\|$. Bottom: event triggering instants.}
\label{shape_new}
\label{fig:env}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=75mm]{3d_decentralized.pdf}
\caption{Simulation on stabilization control of a double tetrahedron formation in 3-D space with distributed event controller. The initial and final positions are denoted by circles and squares, respectively. The initial formation is denoted by dashed lines, and the final formation is denoted by red solid lines. The black star denotes the formation centroid, which is \emph{not} stationary. }
\end{figure}
\begin{figure*}[t]
\centering
\includegraphics[width=130mm]{Simu_distributed.eps}
\caption{Controller performance of the distributed event-based formation system \eqref{position_system_distributed} with distributed event function \eqref{distributed_trigger_local_function}. Left: Event triggering instants for each agent. Right: Exponential convergence of the distance errors with distributed event controller. }
\end{figure*}
We then perform another simulation on stabilizing the same formation shape by applying the proposed distributed event-based controller \eqref{position_system_distributed} and distributed event function \eqref{distributed_trigger_local_function}. Agents' initial positions are set the same as for the simulation with the centralized event controller. The parameters $\gamma_{i}, i=1,2,\ldots,5$ are set as $0.8$ and $a_{i}, i=1,2,\ldots,5$ are set as $0.6$. The trajectories of each agent, together with the initial shape and final shape are depicted in Fig. 5. The event times for each agent and the exponential convergence of each distance error are depicted in Fig. 6. Note that no $\|\{R(t)^T e(t)\}_i\|$ crosses zero values at any finite time and Zeno-triggering is excluded. Furthermore, the distance error system shown in Fig. 6 also demonstrates almost the same convergence property as shown in Fig. 3.
Lastly, we show simulations with the same formation shape by using the modified event triggering function \eqref{distributed_modified_event}. The exponential decay term is chosen as $v_i \text{exp}(-\theta_i t) = \text{exp}(-10 t)$ with $v_i = 1$ and $\theta_i =10$ for each agent. Fig.~7 shows event-triggering times for each agent as well as the convergence of each distance error. As can be observed from Fig. 7, Zeno-triggering is strictly excluded with the modified event function \eqref{distributed_modified_event}, while the convergence of the distance error system behaves almost the same to Fig. 3 and Fig.~6. It should be noted that in comparison with the controller performance and simulation examples discussed in \cite{sun2015event, Liu2015event, CCC_CHENFEI}, the proposed event-based rigid formation controllers in this paper demonstrate equal or even better performance, while complicated controllers and unnecessary assumptions in \cite{sun2015event, Liu2015event, CCC_CHENFEI} are avoided.
\begin{figure*}
\centering
\includegraphics[width=130mm]{Simu_exp_bound.eps}
\caption{Controller performance of the distributed event-based formation system \eqref{position_system_distributed} (event function \eqref{distributed_modified_event} with an exponential decay term). Left: Event triggering instants for each agent. Right: Exponential convergence of the distance errors with distributed event controller. }
\end{figure*}
\section{Conclusions} \label{sec:conclusions}
In this paper we have discussed in detail the design of feasible event-based controllers to stabilize rigid formation shapes. A centralized event-based formation control is proposed first, which guarantees the exponential convergence of distance errors and also excludes the existence of Zeno triggering. Due to a careful design of the triggering error and event function, the controllers are much simpler and require much less computation/measurement resources, compared with the results reported in \cite{CCC_CHENFEI, sun2015event, Liu2015event }. We then further propose a distributed event-based controller such that each agent can trigger a local event to update its control input based on only local measurement. The event feasibility and triggering behavior have been discussed in detail, which also guarantees Zeno-free behavior for the event-based formation system and exponential convergence of the distance error system. A modified distributed event function is proposed, by which the Zeno triggering is strictly excluded for each individual agent. A future topic is to explore possible extensions of the current results on single-integrator models to the double-integrator rigid formation system \cite{TAC_COMBINED} with event-based control strategy to enable velocity consensus and rigid flocking behavior.
\section*{Acknowledgment}
This work was supported by the National Science Foundation
of China under Grants 61761136005, 61703130 and 61673026, and also supported by the Australian Research Council's Discovery Project DP-160104500 and DP-190100887.
\section{Introduction}
\IEEEPARstart{F}{ormation} control of networked multi-agent systems has
received considerable attention in recent years due to its
extensive applications in many areas including both civil and military fields.
One problem of extensive interest is \emph{formation shape
control}, i.e. designing controllers to achieve or maintain a geometrical shape for the formation \cite{oh2012survey}. By using graph rigidity theory, the formation
shape can be achieved by controlling a certain set of inter-agent
distances \cite{anderson2008rigid, krick2009stabilisation} and there is no requirement on a global coordinate system having to be known to all the agents. This is in contrast to the linear \emph{consensus-based} formation control approach, in which the target formation is defined by a certain set of relative positions and a global coordinate system is required for all the agents to implement the consensus-based formation control law (see detailed comparisons in \cite{oh2012survey}). Note that such a coordinate alignment condition is a rather strict requirement, which is undesirable for implementing formation controllers in e.g. a GPS-denied environment. Even if one assumes that such coordinate alignment is satisfied for all agents, slight coordinate misalignment, perhaps arising from sensor biases, can lead to a failure of formation control \cite{meng2016formation, meng20183}. Motivated by all these considerations, in this paper we focus on rigidity-based formation control.
There have been rich works on controller design and stability analysis of rigid formation control (see e.g. \cite{krick2009stabilisation, dorfler2010geometric, oh2014distance, anderson2014counting} and the review in \cite{oh2012survey}), most of which assume that the control input is updated in a continuous manner. The main objective of this paper is to provide alternative controllers to stabilize rigid formation shapes based on an event-triggered approach. This kind of controller design is attractive for real-world robots/vehicles equipped with \emph{digital} sensors or microprocessors \cite{astrom2008event, heemels2012introduction}. Furthermore, by using an event-triggered mechanism to update the controller input, instead of using a continuous updating strategy as discussed in e.g. \cite{krick2009stabilisation, dorfler2010geometric, oh2014distance, anderson2014counting}, the formation system can save resources in processors and thus can reduce much of the computation/actuation burden for each agent. Due to these favourable properties, event-based control has been studied extensively in recent years for linear and nonlinear systems \cite{sun2018event, ZhongkuiTNNLS, zhang2018cooperative, Zhongkui2018TAC}, and especially for networked control systems \cite{seyboth2012event, Duan2018, qin2018leader, jiang2018synchronization}. Examples of successful applications of the event-based control strategy on distributed control systems and networked control systems have been reported in e.g. \cite{Qingchen2018, zhao2018edge, duan2018event}.
We refer the readers to the recent survey papers \cite{ge2018survey, zhang2017overview, PENG2018113, nowzari2017event} which provide comprehensive and excellent reviews on event-based control for networked coordination and multi-agent systems.
Event-based control strategies in multi-agent formation systems have recently attracted increasing attention in the control community. Some recent attempts at applying event-triggered schemes in stabilizing multi-agent formations are reported in e.g., \cite{li2018event, ge2017distributed, viel2017distributed, yi2016formation}. However, these papers \cite{li2018event, ge2017distributed, viel2017distributed, yi2016formation} have focused on the event-triggered consensus-based formation control approach, in which the proposed event-based formation control schemes cannot be applied to stabilization control of rigid formation shapes.
We note that event-based rigid formation control has been discussed briefly as an example of team-triggered network coordination in \cite{Cortes_team_triggered}. However, no thorough results have been reported in the literature to achieve cooperative rigid formation control with feasible and simple event-based solutions. This paper is a first contribution to advance the event-based control strategy to the design and implementation of rigid formation control systems.
Some preliminary results have been presented in conference contributions \cite{sun2015event} and \cite{Liu2015event}. Compared to \cite{sun2015event} and \cite{Liu2015event}, this paper proposes new control methodologies to design event-based controllers as well as event-triggering functions. The event controller presented in \cite{sun2015event} is a preliminary one, which only updates parts of the control input and the control is not necessarily piecewise constant. This limitation is removed in the control design in this paper. Also, the complicated controllers in \cite{Liu2015event} have been simplified. Moreover, and centrally to the novelty of the paper, we will focus on the design of \emph{distributed }controllers based on novel event-triggering functions to achieve the cooperative formation task, while the event controllers in both \cite{sun2015event} and \cite{Liu2015event} are centralized. We prove that Zeno behavior is excluded in the distributed event-based formation control system by proving a positive lower bound of the inter-event triggering time. We also notice that a decentralized event-triggered control was recently proposed in \cite{CCC_CHENFEI} to achieve rigid formation tracking control. The triggering strategy in \cite{CCC_CHENFEI} requires each agent to update the control input both at its own triggering time and its neighbors' triggering times, which increases the communication burden within the network. Furthermore, the triggering condition discussed in \cite{CCC_CHENFEI} adopts the position information in the event function design, which results in very complicated control functions and may limit their practical applications.
In this paper, we will provide a thorough study of rigid formation stabilization control with cooperative event-based approaches. To be specific, we will propose two feasible event-based control schemes (a centralized triggering scheme and a distributed triggering scheme) that aim to stabilize a general rigid formation shape. In this paper, by a careful design of the triggering condition and event function,
the aforementioned communication requirements and controller complexity in e.g., \cite{sun2015event, CCC_CHENFEI, Liu2015event} are avoided.
For all cases, the triggering condition, event function and triggering behavior are discussed in detail.
One of the key results in the controller performance analysis with both centralized and distributed event-based controllers is an exponential stability of the rigid formation system. The exponential stability of the formation control system has important consequences relating to \emph{robustness issues} in undirected rigid formations, as discussed in the recent papers \cite{SMA14TACsub, sun2017rigid}.
The rest of this paper is organized as follows. In Section \ref{sec:pre}, preliminary concepts on graph theory and rigidity theory are introduced. In Section \ref{sec:centralized}, we propose a centralized event-based formation controller and discuss the convergence property and the exclusion of the Zeno behavior. Section \ref{sec:distributed} builds on the centralized scheme of Section \ref{sec:centralized} to develop a distributed event-based controller design, and presents detailed analysis of the triggering behavior and its feasibility. In Section \ref{sec:simulations}, some simulations are provided to demonstrate the controller performance. Finally, Section \ref{sec:conclusions} concludes this paper.
\section{Preliminaries} \label{sec:pre}
\subsection{Notations}
The notations used in this paper are fairly
standard. $\mathbb{R}^n$ denotes the $n$-dimensional Euclidean space. $\mathbb{R}^{m\times n}$
denotes the set of $m\times n$ real matrices. A matrix or vector transpose is denoted by a superscript $T$. The rank, image and null space of a matrix $M$ are denoted by $rank(M)$, $Im(M)$ and $ker(M)$, respectively. The notation $\|M\|$ denotes the induced 2-norm of a matrix $M$ or the 2-norm of a vector $M$, and $\|M\|_F$ denotes the Frobenius norm for a matrix $M$. Note that there holds $\|M\| \leq \|M\|_F$ for any matrix $M$ (see \cite[Chapter 5]{horn2012matrix}).
We use $\text{diag}\{x\}$ to denote a diagonal matrix with the vector $x$ on its diagonal, and $span\{v_1, v_2, \cdots, v_k\}$ to denote the subspace spanned by a set of vectors $v_1, v_2, \cdots, v_k$. The symbol $I_n$ denotes the $n \times n$ identity matrix, and $\mathbf{1}_n$ denotes an $n$-tuple column vector of all ones. The notation $\otimes$ represents the Kronecker product.
\subsection{Basic concepts on graph theory}
Consider an undirected graph with $m$ edges and $n$ vertices, denoted by $\mathcal{G} =( \mathcal{V}, \mathcal{E})$ with vertex set $\mathcal{V} = \{1,2,\cdots, n\}$ and edge set $\mathcal{E} \subset \mathcal{V} \times \mathcal{V}$. The neighbor set $\mathcal{N}_i$ of node $i$ is defined as $\mathcal{N}_i: = \{j \in \mathcal{V}: (i,j) \in \mathcal{E}\}$.
The matrix relating the nodes to the edges is called the incidence matrix $H = \{h_{ij}\} \in \mathbb{R}^{m \times n}$, whose entries are defined as (with arbitrary edge orientations for the \emph{undirected} formations considered here)
\begin{equation}
h_{ij} = \left\{
\begin{array}{cc}
1, &\text{ the } i\text{-th edge sinks at node }j \\ \nonumber
-1, &\text{ the } i\text{-th edge leaves node }j \\ \nonumber
0, & \text{otherwise} \\
\end{array}
\right.
\end{equation}
An important matrix representation of a graph $\mathcal{G}$ is the Laplacian matrix $L(\mathcal{G})$, which is defined as $L(\mathcal{G}) = H^TH$. For a connected undirected graph, one has $rank(L) = n-1$ and $ker(L) = ker(H) = span\{\mathbf{1}_n\}$. Note that for the rigid formation modelled by an \emph{undirected} graph as considered in this paper, the orientation of each edge for writing the incidence matrix can be defined arbitrarily; the graph Laplacian matrix $L(\mathcal{G})$ for the undirected graph is always the same regardless of what edge orientations are chosen (i.e., is orientation-independent) and the stability analysis remains unchanged.
\subsection{Basic concepts on rigidity theory}
Let $p_i \in \mathbb{R}^d$ where $d = \{2,3\}$ denote a point that is assigned to $i \in \mathcal{V}$. The stacked vector $p=[p_1^T, \,
p_2^T, \cdots, \, p_n^T]^T \in \mathbb{R}^{dn}$ represents the realization of $\mathcal{G}$ in $\mathbb{R}^d$. The pair $(\mathcal{G}, p)$ is said to be a framework of $\mathcal{G}$ in $\mathbb{R}^d$. By introducing the matrix $\bar H: = H\otimes I_d \in \mathbb{R}^{dm \times dn}$, one can construct the relative position vector as an image of $\bar H$ from the position vector $p$:
\begin{equation}
z = \bar H p \label{z_equation}
\end{equation}
where $z=[z_1^T, \,
z_2^T, \cdots, \, z_m^T]^T \in \mathbb{R}^{dm}$, with $z_k \in \mathbb{R}^d$ being the relative position vector for the vertex pair defined by the $k$-th edge.
Using the same ordering of the edge set $\mathcal{E}$ as in the definition of $H$, the rigidity function $r_{\mathcal{G}}(p): \mathbb{R}^{dn} \rightarrow \mathbb{R}^m$ associated with the framework $(\mathcal{G}, p)$ is given as:
\begin{equation}
r_{\mathcal{G}}(p) = \frac{1}{2} \left[\cdots, \|p_i-p_j\|^2, \cdots \right]^T, \,\,\, (i,j) \in \mathcal{E}
\end{equation}
where the $k$-th component in $r_{\mathcal{G}}(p)$, $\|p_i-p_j\|^2$, corresponds to the squared length of the relative position vector $z_k$ which connects the vertices $i$ and $j$.
The rigidity of frameworks is then defined as follows.
\begin{definition} (see \cite{asimow1979rigidity}) A framework $(\mathcal{G}, p)$ is rigid in $\mathbb{R}^d$ if there exists a neighborhood $\mathbb{U}$ of $p$ such that $r_{\mathcal{G}}^{-1}(r_{\mathcal{G}}(p))\cap \mathbb{U} = r_{\mathcal{K}}^{-1}(r_{\mathcal{K}}(p))\cap \mathbb{U}$ where $\mathcal{K}$ is the complete graph with the same vertices as $\mathcal{G}$.
\end{definition}
In the following, the set of all frameworks $(\mathcal{G}, p)$ which satisfies the distance constraints is referred to as the set of \emph{target formations}. Let $d_{k_{ij}}$ denote the desired distance in the target formation which links agents $i$ and $j$. We further define \begin{align}
e_{k_{ij}} = \|p_i - p_j\|^2 - (d_{k_{ij}})^2
\end{align}
to denote the squared distance error for edge $k$. Note that we will also use $e_k$ and $d_k$ occasionally for notational convenience if no confusion is expected. Define the distance square error vector $e = [e_1, \, e_2, \, \cdots, e_m]^T$.
One useful tool to characterize the rigidity property of a framework is the rigidity matrix $R \in \mathbb{R}^{m \times dn}$, which is defined as
\begin{equation}
R(p) = \frac{\partial r_{\mathcal{G}}(p) } {\partial p} \label{R_matrix}
\end{equation}
It is not difficult to see that each row of the rigidity matrix $R$ takes the following form
\begin{equation} \label{row_R}
[\mathbf{0}_{1 \times d}, \cdots, (p_i-p_j)^T, \cdots,\mathbf{0}_{1 \times d}, \cdots, (p_j-p_i)^T, \cdots, \mathbf{0}_{1 \times d}]
\end{equation}
Each edge gives rise to a row of $R$, and, if an edge links vertices $i$ and $j$, then the nonzero
entries of the corresponding row of $R$ are in the columns from $di - (d-1)$ to $di$ and from $dj - (d-1)$ to $dj$.
The equation \eqref{z_equation} shows that the relative position vector lies in the image of $\bar H$. Thus one can redefine the rigidity function, $g_{\mathcal{G}}(z): Im(\bar H) \rightarrow \mathbb{R}^m$ as $g_{\mathcal{G}}(z) = \frac{1}{2}\left[\|z_1\|^2, \|z_2\|^2, \cdots, \|z_m\|^2 \right]^T$. From \eqref{z_equation} and \eqref{R_matrix}, one can obtain the following simple form for the rigidity matrix
\begin{eqnarray}
R(p) = \frac{\partial r_{\mathcal{G}}(p)}{\partial p} = \frac{\partial g_{\mathcal{G}}(z)}{\partial z} \frac{\partial z} {\partial p} = Z^T \bar H \label{rigidity_matrix}
\end{eqnarray}
where $Z = \textrm{diag} \{z_1,\,z_2,\cdots,\,z_m\}$.
The rigidity matrix will be used to determine the infinitesimal rigidity of the framework, as shown in the following definition. \\
\begin{definition} (see \cite{hendrickson1992conditions}) A framework $(\mathcal{G}, p)$ is infinitesimally rigid in the $d$-dimensional space if
\begin{equation}
rank(R(p)) = dn-d(d+1)/2
\end{equation}
\end{definition}
Specifically, if the framework is infinitesimally rigid in $\mathbb{R}^2$ (resp. $\mathbb{R}^3$) and has exactly $2n-3$ (resp. $3n-6$) edges, then it is called a minimally and infinitesimally rigid framework. Fig. 1 shows several examples on rigid and nonrigid formations.
In this paper we focus on the stabilization problem of minimally and infinitesimally rigid formations. {\footnote{With some complexity of calculation, the results
extend to non-minimally rigid formations (see \cite{SMA14TACsub, sun2016exponential}).}}
From the definition of infinitesimal rigidity, one can easily prove the following lemma:
\begin{lemma} \label{L_RP}
If the framework $(\mathcal{G}, p)$ is minimally and infinitesimally rigid in the $d$-dimensional space, then the matrix $R(p)R(p)^T$ is positive definite.
\end{lemma}
Another useful observation shows that there exists a smooth function which maps the distance set of a minimally rigid framework to the distance set of its corresponding framework modeled by a \emph{complete} graph.
\begin{lemma}\label{L_Smooth}
Let $r_{\mathcal{G}}(q)$ be the rigidity function for a given infinitesimally minimally rigid framework $(\mathcal{G}, q)$ with agents' position vector $q$. Further let $\bar r_{\bar {\mathcal{G}}}(q)$ denote the rigidity function for an associated framework $(\bar {\mathcal{G}}, q)$, in which the vertex set remains the same as $(\mathcal{G}, q)$ but the underlying graph is a complete one (i.e. there exist $n(n-1)/2$ edges which link any vertex pairs). Then there exists a continuously differentiable function $\pi: r_{\mathcal{G}}(q) \rightarrow \mathbb{R}^{n(n-1)/2}$ for which $\bar r_{\bar {\mathcal{G}}}(q) = \pi(r_{\mathcal{G}}(q))$ holds locally.
\end{lemma}
Lemma \ref{L_Smooth} indicates that all the edge distances in the framework $(\bar {\mathcal{G}}, q)$ modeled by a complete graph can be expressed \textit{locally} in terms of the edge distances of a corresponding minimally infinitesimally rigid framework $(\mathcal{G}, q)$ via some smooth functions.
The proof of the
above Lemma is omitted here and can be found in \cite{SMA14TACsub}.
We emphasize that Lemma~\ref{L_Smooth} is important for later analysis of a distance error system (a definition of the term will be given in Section \ref{subsec:central_design}). Lemma~\ref{L_Smooth} (together with Lemma \ref{L_smooth1} given later) will enable us to obtain a self-contained distance error system so that a Lyapunov argument can be applied for convergence analysis.
\subsection{Problem statement}
The rigid formation control problem is formulated as follows.
\begin{problem*} Consider a group of $n$ agents in $d$-dimensional space modeled by single integrators
\begin{equation}
\dot p_i = u_i, \,\,\,\, i = 1,2,\cdots, n \label{single_in}
\end{equation} Design a \emph{distributed} control $u_i \in \mathbb{R}^n$ for each agent $i$ in terms of $p_i-p_j$, $j \in \mathcal{N}_i$ with \emph{event-based} control update such that $||p_i-p_j||$ converges to the desired distance $d_{k_{ij}}$ which forms a minimally and infinitesimally rigid formation.
\end{problem*}
In this paper, we will aim to propose two feasible event-based control strategies (a centralized triggering approach and a distributed triggering approach) to solve this formation control problem.
\begin{figure}
\centering
\includegraphics[width=80mm]{Rigid_example2.eps}
\caption{Examples on rigid and nonrigid formations. (a) non-rigid formation (a deformed formation with dashed lines is shown); (b) minimally rigid formation; (c) rigid but non-minimally rigid formation. }
\label{shape_new}
\label{fig:env}
\end{figure}
\section{Event-based controller design: Centralized case} \label{sec:centralized}
This section focuses on the design of feasible event-based formation controllers, by assuming that a centralized processor is available for collecting the global information and broadcasting the triggering signal to all the agents such that their control inputs can be updated. The results in this section extend the event-based formation control reported in \cite{sun2015event} by proposing an alternative approach for the event function design, which also simplifies the event-based controllers proposed in \cite{Liu2015event, CCC_CHENFEI}. Furthermore, the novel idea used for designing a simpler event function in this section will be useful for designing a feasible distributed version of an event-based formation control system, which will be reported in the next section.
\subsection{Centralized event controller design} \label{subsec:central_design}
We propose the following general form of event-based formation control system
\begin{align}\label{position_system}
\dot p_i(t) &= u_i(t) = u_i(t_h) \\ \nonumber
&= \sum_{j \in \mathcal{N}_i} (p_j(t_h) - p_i(t_h)) e_k(t_h)
\end{align}
for $t \in [t_h, t_{h+1})$, where $h = 0,1,2, \cdots$ and $t_h$ is the $h$-th triggering time for updating new information in the controller. \footnote{ The differential equation \eqref{position_system} that models the event-based formation control system involves switching controls at every event updating instant, for which we understand its solution in the sense of Filippov \cite{cortes2008discontinuous}. } The control law is an obvious variant of the standard law for non-event-based formation shape control \cite{krick2009stabilisation, sun2016exponential}. Evidently, the control input takes piecewise constant values in each time interval. In this section, we allow the switching times $t_h$ to be determined by a central controller. In a compact form, the above position system can be written as
\begin{equation} \label{position_system_compact}
\dot p(t) = - R(p(t_h))^T e(t_h)
\end{equation}
Denote a vector $\delta_i(t)$ as
\begin{align}
\delta_i(t) = & -\sum_{j \in \mathcal{N}_i} (p_j(t_h) - p_i(t_h)) e_k(t_h) \nonumber \\
& + \sum_{j \in \mathcal{N}_i} (p_j(t) - p_i(t)) e_k(t)
\end{align}
for $t \in [t_h, t_{h+1})$. Then the formation control system $\eqref{position_system}$ can be equivalently stated as
\begin{align}\label{position_system_new}
\dot p_i(t) = u_i(t_h) = \sum_{j \in \mathcal{N}_i} (p_j(t) - p_i(t)) e_k(t) - \delta_i(t)
\end{align}
Define a vector $\delta(t) = [\delta_1(t)^T, \delta_2(t)^T, \cdots, \delta_n(t)^T]^T \in \mathbb{R}^{dn}$. Then there holds
\begin{align}\label{eq:definition_delta}
\delta(t) = R(t_h)^T e(t_h) - R(t)^T e(t)
\end{align}
which enables one to rewrite the compact form of the position system as
\begin{equation} \label{eq:new_position_system}
\dot p(t) = - R(t)^T e(t) - \delta(t)
\end{equation}
To deal with the position system with the event-triggered controller \eqref{position_system}, we instead analyze the distance error system. By noting that $\dot{e}(t)=2R(t)\dot{p}(t)$, the distance error system with the event-triggered controller \eqref{position_system} can be derived as
\begin{align} \label{error_system}
\dot e(t) &= 2R(t) \dot p(t) \nonumber \\
&= -2R(t) R(p(t_h))^T e(t_h))\,\,\, \forall t \in [t_h, t_{h+1})
\end{align}
Note that all the entries of $R(t)$ and $e(t)$ contain the real-time values of $p(t)$, and all the entries $R(p(t_h))$ and $e(t_h)$ contain the piecewise-constant values $p(t_h)$ during the time interval $[t_h, t_{h+1})$.
The new form of the position system \eqref{eq:new_position_system} also implies that the compact form of the distance error system can be written as
\begin{equation} \label{error_system2}
\dot e(t) = -2R(t) (R(t)^T e(t) + \delta(t))
\end{equation}
Consider the function $V = \frac{1}{4}\sum_{k=1}^m e_k^2$ as a Lyapunov-like function candidate for \eqref{error_system2}. Similarly to the analysis in \cite{sun2015event}, we define a sub-level set $\mathcal{B}(\rho)= \{e: V(e) \leq \rho\}$ for some suitably small $\rho$, such that when $e \in \mathcal{B}(\rho)$ the formation is infinitesimally minimally rigid and $R(p(t))R(p(t))^T$ is positive definite.
Before giving the main proof, we record the following key result on the entries of the matrix $R(p(t))R(p(t))^T$.
\begin{lemma}\label{L_smooth1}
When the formation shape is close to the desired one such that the distance error $e$ is in the set $\mathcal{B}(\rho)$, the entries of the matrix $R(p(t))R(p(t))^T$ are continuously differentiable functions of $e$.
\end{lemma}
This lemma enables one to discuss the \emph{self-contained} distance error system \eqref{error_system2} and thus a Lyapunov argument can be applied to show the convergence of the distance errors. The proof of Lemma \ref{L_smooth1} can be found in \cite{SMA14TACsub} or \cite{sun2014finite} and will not be presented here. From Lemma \ref{L_smooth1}, one can show that
\begin{align} \label{derivative_lya2}
\dot V(t) &= \frac{1}{2} e(t)^T \dot e(t) = -e(t)^T R(t) (R(t)^T e(t) + \delta(t)) \nonumber \\
&= -e(t)^T R(t)R(t)^T e(t) - e(t)^T R(t) \delta(t) \nonumber \\
& \leq -\|R(t)^T e(t)\|^2 + \|e(t)^T R(t)\| \| \delta(t) \|
\end{align}
If we enforce the norm of $\delta(t)$ to satisfy
\begin{equation} \label{delta_norm}
\|\delta(t)\| \leq \gamma \|R(t)^T e(t)\|
\end{equation}
and choose the parameter $\gamma$ to satisfy $0< \gamma <1$, then we can guarantee that
\begin{equation} \label{eq:Derivative_Lya}
\dot V(t) \leq (\gamma -1) \|R(t)^T e(t)\|^2 <0
\end{equation}
This indicates that events are triggered when
\begin{equation} \label{trigger_function}
f := \|\delta(t)\| - \gamma \|R(t)^T e(t)\| = 0
\end{equation}
The event time $t_h$ is defined to satisfy $f(t_h) = 0$ for $h = 0,1,2, \cdots$. For the time interval $t \in [t_h, t_{h+1})$, the control input is chosen as $u(t) = u(t_h)$ until the next event is triggered. Furthermore, every time when an event is triggered, the event vector $\delta$ will be reset to zero.
We also show two key properties of the formation control system \eqref{position_system} with the above event function \eqref{trigger_function}.
\begin{lemma} \label{lemma_fixed_centroid}
The formation centroid remains constant under the control of \eqref{position_system} with the event function \eqref{trigger_function}.
\end{lemma}
\begin{proof}
Denote by $\bar p(t) \in \mathbb{R}^d$ the center of the mass of the formation, i.e., $\bar p(t) = \frac{1}{n} \sum_{i=1}^n p_i(t) = \frac{1}{n}(\mathbf{1}_n \otimes I_d)^T p(t)$.
One can show
\begin{align} \label{eq:formation_centroid_fixed}
\dot {\bar p}(t) &= \frac{1}{n}(\mathbf{1}_n \otimes I_d)^T \dot p(t) \nonumber \\
& = -\frac{1}{n}(\mathbf{1}_n \otimes I_d)^T R(p(t_h))^T e(t_h) \nonumber \\
&= -\frac{1}{n}\left( Z(t_h)^T \bar H (\mathbf{1}_n \otimes I_d) \right)^T e(t_h)
\end{align}
Note that $ker(H) = span\{\mathbf{1}_n\}$ and therefore $ker(\bar H) = span\{\mathbf{1}_n \otimes I_d\}$. Thus $\dot {\bar p}(t) = 0$, which indicates that the formation centroid remains constant.
\end{proof}
The following lemma concerns the coordinate frame requirement and enables each agent to use its local coordinate frame to implement the control law, which is favourable for networked formation control systems in e.g. GPS denied environments.
\begin{lemma} \label{lemma:local_coordinate}
To implement the controller \eqref{position_system} with the event-based control update condition in \eqref{trigger_function}, each agent can use its own local coordinate frame which does not need to be aligned with a global coordinate frame.
\end{lemma}
The proof for the above lemma is omitted here, as it follows similar steps as in \cite[Lemma 4]{sun2014finite}. Note that Lemma \ref{lemma:local_coordinate} implies the event-based formation system \eqref{position_system} guarantees the $SE(N)$ invariance of the controller, which is a nice property to enable convenient implementation for networked control systems without coordinate alignment for each individual agent \cite{SE_N_INVARIANCE}.
We now arrive at the following main result of this section.
\begin{theorem} \label{theorem_main_1}
Suppose the target formation is infinitesimally and minimally rigid and the initial formation shape is close to the target one. By using the above controller \eqref{position_system} and the event-triggering function \eqref{trigger_function}, all the agents will reach the desired formation shape locally exponentially fast.
\end{theorem}
\begin{proof}
The above analysis relating to Eq. \eqref{derivative_lya2}-\eqref{trigger_function} establishes boundedness of $e(t)$ since $\dot V$ is nonpositive. Now we show the exponential convergence of $e(t)$ to zero will occur from a ball around the origin, which is equivalent to the desired formation shape being reached
exponentially fast. According to Lemma \ref{L_RP}, let $\bar \lambda_{\text{min}}$ denote the smallest eigenvalue of $M(e) :=R(p)R(p)^T$ when $e(p)$ is in the set $\mathcal{B} (\rho) $ (i.e. $\bar \lambda_{\text{min}} = \mathop {\min }\limits_{e \in \mathcal{B}(\rho)} \lambda (M(e)) >0$). Note that $\bar \lambda_{\text{min}}$ exists because the set $\mathcal{B} (\rho)$ is a compact set with respect to $e$ and the eigenvalues of a matrix are continuous functions of the matrix elements. By recalling \eqref{eq:Derivative_Lya}, there further holds
\begin{align}
\dot V(t) \leq (\gamma - 1) \bar \lambda_{\text{min}} \| e(t)\|^2
\end{align}
Thus one concludes
\begin{align} \label{eq:exponential_e}
\|e(t)\| \leq \text{exp}({- \kappa t}) \|e(0)\|
\end{align}
with the exponential decaying rate no less than $\kappa = 2(1- \gamma) \bar \lambda_{\text{min}}$.
\end{proof}
Note that the convergence of the inter-agent distance error of itself does not directly guarantee the convergence of agents' positions $p(t)$ to some fixed points, even though it does guarantee convergence to a correct formation shape. This is because that the desired equilibrium corresponding to the correct rigid shape is not a single point, but is a set of equilibrium points induced by rotational and translation invariance (for a detailed discussion to this subtle point, see \cite[Chapter 5]{dorfler_thesis}).
A sufficient condition for this strong convergence to a stationary formation is guaranteed by the exponential convergence, which was proved above. To sum up, one has the following lemma on the convergence of the position system \eqref{position_system_compact} as a consequence of Theorem \ref{theorem_main_1}.
\begin{lemma} \label{lemma:fixed_final_position}
The event-triggered control law \eqref{position_system} and the event function \eqref{trigger_function} guarantee the convergence of $p(t)$ to a fixed point.
\end{lemma}
\begin{remark}
We remark that the above Theorem 1 (as well as the subsequent results in later sections) concerns a \emph{local} convergence. This is because the rigid formation shape control system is \emph{nonlinear} and typically exhibits \emph{multiple} equilibria, which include the ones corresponding to correct formation shapes and those that do not correspond to correct shapes. It has been shown in \cite{anderson2014counting} by using the tool of Morse theory that multiple equilibria, including incorrect equilibria, are a consequence of any formation shape control algorithm which evolves in a steepest descent direction of a smooth cost function that is invariant under translations and rotations. A recent paper \cite{zhiyong_CDC15} proves the instability of a set of degenerate equilibria that live in a lower dimensional space. However, the stability property for more general equilibrium points is still unknown. It is in fact considered as a very challenging open problem to obtain an almost global convergence result for general rigid formations, except for some special formation shapes such as 2-D triangular formation shape, or 2-D rectangular shape, or 3-D tetrahedral shape (see the review in \cite{oh2012survey, park2018distance}). We note that local convergence is still valuable in practice, if one assumes that initial shapes are close to the target ones (which is a very common assumption in most rigidity-based formation control works; see e.g., \cite{oh2012survey, krick2009stabilisation, dorfler2010geometric, ramazani2017rigidity, sun2014finite, sun2016exponential, Raik_SIAM}).
\end{remark}
\subsection{Exclusion of Zeno behavior}
In this section, we will analyze the exclusion of possible Zeno triggering behavior of the event-based formation control system \eqref{position_system}.
The following presents a formal definition of Zeno triggering (which is also termed \emph{Zeno execution} in the hybrid system study \cite{ames2006stability}).
\begin{definition} \label{def:zeno-triggering}
For agent $i$, a triggering is \emph{Zeno} if
\begin{align}
\lim_{h \rightarrow \infty} t_h^i = \sum_{h=0}^{\infty} (t_{h+1}^i - t_h^i) = t_{\infty}^i
\end{align}
for some finite $t_{\infty}^i$ (termed the \emph{Zeno time}).
\end{definition}
Generally speaking, Zeno-triggering of an event controller means that it triggers an infinite number of events in a finite time period, which is an undesirable triggering behavior.
Therefore, it is important to exclude the possibility of Zeno behavior in an event-based system.
In the following we will show that the event-triggered system \eqref{position_system} does not exhibit Zeno behavior.
Note that the triggering function \eqref{trigger_function} involves the evolution of the term $R(t)^T e(t)$, whose derivative is calculated as
\begin{align}
\frac{\text{d} (R(t)^T e(t))}{\text{d}t} = & \dot R(t)^T e(t) + R(t)^T \dot e(t) \nonumber \\
= & \bar H^T \dot Z(t) e(t) \nonumber \\
& -2 R(t)^T R(t) (R(t)^T e(t) +\delta(t)) \nonumber \\
\end{align}
According to the construction of the vector $\delta(t)$ in \eqref{eq:definition_delta}, there also holds $\dot \delta(t) = - \frac{\text{d} (R(t)^T e(t))}{\text{d}t}$.
Before presenting the proof, we first show a useful bound.
\begin{lemma} \label{lemma:bound_RTe}
The following bound holds:
\begin{align} \label{eq:bound_RTe}
\|\bar H^T \dot Z(t) e(t)\| &\leq \sqrt{d} \| \bar H^T \| \|\bar H \| \|e(t)\| \|\dot p(t)\| \nonumber \\
&\leq \sqrt{d} \| \bar H^T \| \|\bar H \| \|e(0)\| \|R(t)^T e(t) +\delta(t)\| \nonumber \\
\end{align}
\end{lemma}
\begin{proof}
We first show a trick to bound the term $\| \dot Z(t) e(t)\|$ by deriving an alternative expression for $\dot Z(t) e(t)$:
\begin{small}
\begin{align}
\dot Z(t) e(t) &= \text{diag}\{\dot z_1(t), \dot z_2(t), \cdots, \dot z_m(t)\} e(t) \nonumber \\
&= \left[
\begin{array}{c}
e_1(t) \dot z_1(t) \\
e_2(t) \dot z_2(t) \\
\vdots \\
e_m(t) \dot z_m(t) \\
\end{array}
\right] \nonumber \\
& = \left( \left[
\begin{array}{cccc}
e_1(t) & 0 & \cdots & 0 \\
0 & e_2(t) & \cdots & 0 \\
\vdots & \vdots & \ddots & \vdots \\
0 & 0 & \cdots & e_m(t)
\end{array}
\right] \otimes I_d \right)
\left[
\begin{array}{c}
\dot z_1(t) \\
\dot z_2(t) \\
\vdots \\
\dot z_m(t) \\
\end{array}
\right] \nonumber \\
& = : \left(E(t) \otimes I_d \right) \dot z(t) \nonumber \\
\end{align}
\end{small}
where $E(t)$ is defined as a diagonal matrix in the form $E(t) = \text{diag}\{e_1(t), e_2(t), \cdots, e_m(t)\}$.
Note that $z(t) = \bar H p(t)$ and thus $\dot z(t) = \bar H \dot p(t)$. Then one has
\begin{align}
\| \bar H^T \dot Z(t) e(t)\| &= \| \bar H^T \left(E(t) \otimes I_d \right) \dot z(t)\| \nonumber \\
&\leq \| \bar H^T \| \|\left(E(t) \otimes I_d \right)\| \|\bar H \dot p(t)\| \nonumber \\
&\leq \| \bar H^T \| \|\bar H \| \|\left(E(t) \otimes I_d \right)\|_F \|\dot p(t)\| \nonumber \\
&\leq \sqrt{d} \| \bar H^T \| \|\bar H \| \|e(t)\| \|R(t)^T e(t) +\delta(t)\|
\end{align}
where we have used the following facts
\begin{align}
&\|E(t) \| \leq \|E(t) \|_F \nonumber \\
& \|\left(E(t) \otimes I_d \right)\|_F = \sqrt{d}\|E(t) \|_F \nonumber \\
& \|E(t)\|_F = \|e(t)\| \nonumber
\end{align}
The first inequality in \eqref{eq:bound_RTe} is thus proved.
The second inequality in \eqref{eq:bound_RTe} is due to the fact that $\|e(t)\| \leq \|e(0)\|, \forall t>0$ shown in \eqref{eq:exponential_e}.
\end{proof}
We now show that the Zeno triggering does not occur in the formation control system \eqref{position_system} with the triggering function \eqref{trigger_function} by proving a positive lower bound on the inter-event time interval.
\begin{theorem}
The inter-event time interval $\{t_{h+1} - t_{h}\}$ is lower bounded by a positive value $\tau$
\begin{equation}
\tau = \frac{\gamma}{\alpha(1+\gamma)} >0
\end{equation}
where
\begin{align} \label{eq:alpha}
\alpha &= \sqrt{d} \| \bar H^T \| \|\bar H \| \|e(0)\| + \sqrt{2} \bar \lambda_{\text{max}}(R^TR(e)) >0 \nonumber \\
\end{align}
in which $\bar \lambda_{\text{max}}$ denotes the largest eigenvalue of $R^TR(e)$ when $e(p)$ is in the set $\mathcal{B} (\rho)$ (i.e. $\bar \lambda_{\text{max}} = \mathop {\text{max} }\limits_{e \in \mathcal{B} (\rho)} \lambda (R^TR(e)) >0$), and
$\gamma$ is the triggering parameter designed in \eqref{trigger_function} which satisfies $\gamma \in (0,1)$. Thus, Zeno triggering will not occur for the rigid formation control system \eqref{position_system} with the triggering function \eqref{trigger_function}.
\end{theorem}
\begin{proof}
We show that the growth of $\|\delta\|$ from 0 to the triggering threshold value $\gamma \|R^T e\|$ needs to take a positive time interval. To show this, the relative growth rate on $\|\delta(t)\|/ \|R(t)^T e(t)\|$ is considered. The following proof is inspired by the one used in \cite{tabuada2007event}. In the following derivation, we omit the argument of time $t$ but it should be clear that each state variable and vector is considered as a function of $t$.
\begin{small}
\begin{align}
\frac{\text{d}}{\text{d}t} \frac{\|\delta\|}{\| R^T e\|}
\leq & \left (1+ \frac{\|\delta\|} {\| R^T e \|} \right) \frac{ \|\dot R^T e + R^T \dot e\|}{\|R^T e\|} \nonumber \\
= &\left (1+ \frac{\|\delta\|} {\| R^T e \|} \right) \frac{ \|\bar H^T \dot Z e + R^T \dot e\|}{\|R^T e\|} \nonumber \\
\leq &\left (1+ \frac{\|\delta\|} {\| R^T e \|} \right) \nonumber \\
& \left ( \frac{\sqrt{d} \| \bar H^T \| \|\bar H \| \|e\| \|\dot p\| + \|2R^T R(R^T e +\delta)\|}{\|R^T e\|} \right) \nonumber \\
& \text{(appealing to Lemma \ref{lemma:bound_RTe})} \nonumber \\
\leq &\left (1+ \frac{\|\delta\|} {\| R^T e \|} \right) \nonumber \\
&\left ( (\sqrt{d} \| \bar H^T \| \|\bar H \| \|e(0)\| + \|2R^T R\|) \left (1 +\frac{\|\delta)\|}{\|R^T e\|}\right) \right) \nonumber \\
\leq & \alpha\left (1+ \frac{\|\delta\|} {\| R^T e \|} \right)^2
\end{align}
\end{small}
where $\alpha$ is defined in \eqref{eq:alpha}. Note that $\bar \lambda_{\text{max}}$ always exists and is finite (i.e. upper bounded) because the set $\mathcal{B} (\rho)$ is a compact set with respect to $e$ and the eigenvalues of a matrix are continuous functions of the matrix elements. Thus, $\alpha$ defined in \eqref{eq:alpha} exists, which is positive and upper bounded. If we denote $\frac{\|\delta\|}{\| R^T e\|}$ by $y$ we have the estimate $\dot y(t) \leq \alpha(1+y(t))^2$. By the comparison principle there holds $y(t) \leq \phi (t, \phi_0)$ where $\phi (t, \phi_0)$ is the solution of $\dot \phi = \alpha(1+ \phi)^2$ with initial condition $\phi(0, \phi_0) = \phi_0$.
Solving the differential equation for $\phi$ in the time interval $t \in [t_h, t_{h+1})$ yields $\phi(\tau, 0) = \frac{\tau \alpha}{1- \tau \alpha}$.
The inter-execution time interval is thus bounded by the time it takes for $\phi$ to evolve from 0 to $\gamma$. Solving the above equation, one obtains a positive lower bound for the inter-event time interval $\tau = \frac{\gamma}{\alpha(1+\gamma)}$. Thus, Zeno behavior is excluded for the formation control system \eqref{position_system}.
The proof is completed.
\end{proof}
\begin{remark} We review several event-triggered formation strategies reported in the literature and highlight the advantages of the event-triggered approach proposed in this section. In \cite{sun2015event}, the triggering function is based on the information of the distance error $e$ only, which cannot guarantee a pure piecewise-constant update of the formation control input. The event function designed in \cite{Liu2015event} is based on the information of the relative position $z$, while the event function designed \cite{CCC_CHENFEI} is based on the absolute position $p$. It is noted that event functions and triggering conditions such as those in \cite{Liu2015event} and \cite{CCC_CHENFEI} are very complicated, which may limit their practical applications.
The event function \eqref{trigger_function} designed in this section involves the term $R^T e$, in which the information of the relative position $z$ (involved in the entries of the rigidity matrix $R$) and of the distance error $e$ has been included.
Such an event triggering function greatly reduces the controller complexity while at the same time also maintains the discrete-time update nature of the control input.
\end{remark}
\section{Event-based controller design: distributed case} \label{sec:distributed}
\subsection{Distributed event controller design}
In this section we will further show how to design a distributed event-triggered formation controller in the sense that each agent can use only local measurements in terms of relative positions with respect to its neighbors to determine the next triggering time and control update value. Denote the event time for each agent $i$ as $t_0^i, t_1^i, \cdots, t_h^i, \cdots$. The dynamical system for agent $i$ to achieve the desired inter-agent distances is now rewritten as
\begin{align}\label{position_system_distributed_controller}
\dot p_i(t) &= u_i(t) = u_i(t_h^i), \forall t \in [t_h^i, t_{h+1}^i)
\end{align}
and we aim to design a distributed event function with feasible triggering condition such that the control input for agent $i$ is updated at its own event times $t_0^i, t_1^i, \cdots, t_h^i, \cdots$ based on local information. \footnote{ Again, Filippov solutions \cite{cortes2008discontinuous} are envisaged for the differential equation \eqref{position_system_distributed_controller} with switching controls at every event updating instant. }
We consider the same Lyapunov function candidate as the one in Section \ref{sec:centralized}, but calculate the derivative as follows:
\begin{align} \label{derivative_lya_distributed}
\dot V(t) = & \frac{1}{2} e(t)^T \dot e(t) = -e(t)^T R(t) (R(t)^T e(t) + \delta(t)) \nonumber \\
= & -e(t)^T R(t)R(t)^T e(t) - e^T R(t) \delta(t) \nonumber \\
\leq & -\|R(t)^T e(t)\|^2 + \|e(t)^T R(t) \delta(t) \| \nonumber \\
\leq &- \sum_{i=1}^n \|\{R(t)^T e(t)\}_i\|^2 + \sum_{i=1}^n \|\{R(t)^T e(t)\}_i\| \| \delta_i(t) \| \nonumber \\
\end{align}
where $\{R(t)^T e(t)\}_i \in \mathbb{R}^d$ is a vector block taken from the $(di-d+1)$th to the $(di)$th entries of the vector $R(t)^T e(t)$, and $\delta_i(t)$ is a vector block taken from the $(di-d+1)$th to the $(di)$th entries of the vector $\delta(t)$. According to the definition of the rigidity matrix in \eqref{row_R}, it is obvious that $\{R(t)^T e(t)\}_i$ only involves local information of agent $i$ in terms of relative position vectors $z_{k_{ij}}$ and distance errors $e_{k_{ij}}$ with $j \in \mathcal{N}_i$. Based on this, the control input for agent $i$ is designed as
\begin{align}\label{position_system_distributed}
\dot p_i(t) & = u_i(t_h^i) = \sum_{j \in \mathcal{N}_i} (p_j(t_h^i) - p_i(t_h^i)) e_k(t_h^i)) \nonumber \\
& = \{R(t_h^i)^T e(t_h^i)\}_i\,\,\,\forall t \in [t_h^i, t_{h+1}^i)
\end{align}
Note that there holds
\begin{align} \label{define_delta_i}
\delta_i(t) = \{R(t_h^i)^T e(t_h^i)\}_i - \{R(t)^T e(t)\}_i
\end{align}
and we can restate \eqref{position_system_distributed} as $\dot p_i(t) = - \{R(t)^T e(t)\}_i - \delta_i(t), t \in [t_h^i, t_{h+1}^i)$.
By using the inequality $\|\{R(t)^T e(t)\}_i\| \| \delta(t)_i \| \leq \frac{1}{2a_i} \| \delta(t)_i \|^2 + \frac{a_i}{2} \|\{R(t)^T e(t)\}_i\|^2$ with $a_i \in (0,1)$, the above inequality \eqref{derivative_lya_distributed} on $\dot V$ can be further developed as
\begin{align}
\dot V(t) \leq & - \sum_{i=1}^n \|\{R(t)^T e(t)\}_i\|^2 \nonumber \\
& + \sum_{i=1}^n \frac{a_i}{2} \|\{R(t)^T e(t)\}_i\|^2 + \sum_{i=1}^n \frac{1}{2a_i} \| \delta_i(t) \|^2 \nonumber \\
= & -\sum_{i=1}^n \frac{2-a_i}{2}\|\{R(t)^T e(t)\}_i\|^2 + \sum_{i=1}^n \frac{1}{2a_i} \| \delta_i(t) \|^2 \nonumber
\end{align}
If we enforce the norm of $\delta_i(t)$ to satisfy
\begin{equation} \label{distributed_trigger2}
\frac{1}{2a_i} \| \delta_i(t) \|^2 \leq \gamma_i \frac{2-a_i}{2}\|\{R(t)^T e(t)\}_i\|^2
\end{equation}
with $\gamma_i \in (0,1)$, we can guarantee
\begin{align} \label{derivative_lya_distributed_3}
\dot V(t) \leq \sum_{i=1}^n (\gamma_i -1) \frac{2-a_i}{2}\|\{R(t)^T e(t)\}_i\|^2
\end{align}
This implies that one can design a local triggering function for agent $i$ as
\begin{equation} \label{distributed_trigger_local_function}
f_i(t) : = \| \delta_i(t) \|^2 - \gamma_i a_i (2-a_i) \|\{R(t)^T e(t)\}_i\|^2
\end{equation}
and the event time $t_h^i$ for agent $i$ is defined to satisfy $f_i( t_h^i ) = 0$ for $h = 0,1,2, \cdots$. For the time interval $t \in [t_h^i, t_{h+1}^i)$, the control input is chosen as $u_i(t) = u_i(t_h^i)$ until the next event for agent $i$ is triggered. Furthermore, every time an event is triggered for agent $i$, the local event vector $\delta_i$ will be reset to zero. Note that the condition $a_i \in (0,1)$ will also be justified in later analysis in Lemma \ref{lemma:feasibility}.
The convergence result with the distributed event-based formation controller and triggering function is summarized as follows.
\begin{theorem} \label{theorem:distributed_exponential}
Suppose that the target formation is infinitesimally and minimally rigid and the initial formation shape is close to the target one. By using the above controller \eqref{position_system_distributed} and the distributed event function \eqref{distributed_trigger_local_function}, all the agents will reach the desired formation shape locally exponentially fast.
\end{theorem}
\begin{proof}
The analysis is similar to Theorem \ref{theorem_main_1} and we omit several steps here. Based on the derivation in Eqs. \eqref{derivative_lya_distributed}-\eqref{distributed_trigger_local_function}, one can conclude that
\begin{align} \label{eq:exponential_e_distributed}
\|e(t)\| \leq \text{exp}(- \kappa t) \|e(0)\|
\end{align}
with the exponential rate no less than $\kappa = 2 \zeta_{\text{min}} \bar \lambda_{\text{min}}$ where $\zeta_{\text{min}} = \text{min}_{i} (1- \gamma_i ) \frac{2-a_i}{2}$.
\end{proof}
The exponential convergence of $e(t)$ implies that the above local event-triggered controller \eqref{position_system_distributed} also guarantees the convergence of $p$ to a fixed point, by which one can conclude a similar result to the one in Lemma \ref{lemma:fixed_final_position}.
For the formation system with the distributed event-based controller, an analogous result to Lemma \ref{lemma:local_coordinate} on coordinate frame requirement is as follows.
\begin{lemma}
To implement the distributed formation controller \eqref{position_system_distributed}, each agent can use its own local coordinate frame to measure the relative positions to its neighbors and a global coordinate frame is not required. Furthermore, to detect the distributed event condition \eqref{distributed_trigger2}, a local coordinate frame is sufficient which is not required to be aligned with the global coordinate frame.
\end{lemma}
\begin{proof}
The proof of the first statement on the distributed controller \eqref{position_system_distributed} follows similar steps as in \cite[Lemma 4]{sun2014finite} and is omitted here. We then prove the second statement on the event condition \eqref{distributed_trigger2}. Suppose agent $i$'s position in a global coordinate frame is measured as $p_i^g$, while $p_i^i$ and $p_j^i$ stand for agent $i$ and its neighboring agent $j$'s positions measured by agent $i$'s local coordinate frame. Clearly, there exist a rotation matrix $\mathcal{Q}_i \in \mathbb{R}^{d \times d}$ and a translation vector $\vartheta_i \in \mathbb{R}^{d}$, such that $p_j^i = \mathcal{Q}_i p_j^g + \vartheta_i$. We also denote the relative position between agent $i$ and agent $j$ as $z_{k_{ij}}^i$ measured by agent $i$'s local coordinate frame, and $z_{k_{ij}}^g$ measured by the global coordinate frame. Obviously there holds $z_{k_{ij}}^i = p_j^i - p_i^i = \mathcal{Q}_i ( p_j^g - p_i^g) = \mathcal{Q}_i z_{k_{ij}}^g$ and thus $\|z_{k_{ij}}^i\| = \|z_{k_{ij}}^g\|$. Also notice that the event condition \eqref{distributed_trigger2} involves the terms $\delta_i$ and $\{R(t)^T e(t)\}_i$ which are functions of the relative position vector $z$, and thus event detection using \eqref{distributed_trigger_local_function} remains unchanged regardless of what coordinate frames are used. Since $\mathcal{Q}_i$ and $\vartheta_i$ are chosen arbitrarily, the above analysis concludes that the detection of the local event condition \eqref{distributed_trigger_local_function} is independent of a global coordinate basis, which implies that agent $i$'s local coordinate frame is sufficient to implement \eqref{distributed_trigger2}.
\end{proof}
The above lemma indicates that the distributed event-based controller \eqref{position_system_distributed} and distributed event function \eqref{distributed_trigger_local_function} still guarantee the $SE(N)$ invariance property and enable a convenient implementation for the proposed formation control system without coordinate alignment for each individual agent.
Differently to Lemma \ref{lemma_fixed_centroid}, we show that the distributed event-based controller proposed in this section cannot guarantee a fixed formation centroid.
\begin{lemma}
The position of the formation centroid is not guaranteed to be fixed when the distributed event-based controller \eqref{position_system_distributed} and event function \eqref{distributed_trigger_local_function} are applied.
\end{lemma}
\begin{proof}
The dynamics for the formation centroid can be derived as
\begin{align} \nonumber
\dot {\bar p}(t) &= \frac{1}{n}(\mathbf{1}_n \otimes I_d)^T \dot p(t)
\end{align}
However, due to the \emph{asymmetric} update of each agent's control input by using the local event function \eqref{distributed_trigger_local_function} to determine a local triggering time, one cannot decompose the vector $\dot p(t)$ into terms involving $\bar H$ and a single distance error vector as in \eqref{eq:formation_centroid_fixed}. Thus $\dot {\bar p}(t)$ is not guaranteed to be zero and there exist motions for the formation centroid when the distributed event-based controller \eqref{position_system_distributed} is applied.
\end{proof}
\begin{remark}
We note a key property of the distributed event-based controller \eqref{position_system_distributed} and \eqref{distributed_trigger_local_function} proposed in this section. It is obvious from \eqref{position_system_distributed} and \eqref{distributed_trigger_local_function} that each agent $i$ updates its own control input by using only local information in terms of relative positions of its neighbors (which can be measured by agent $i$'s local coordinate system), and is not affected by the control input updates from its neighbors. Thus, such local event-triggered approach does not require any communication between any two agents.
\end{remark}
\subsection{Triggering behavior analysis}
This subsection aims to analyze some properties of the distributed event-triggered control strategy proposed above. Generally speaking, singular triggering means no more triggering exists after a feasible triggering event, and continuous triggering means that events are triggered continuously. For the definitions of singular triggering and continuous triggering, we refer the reader to \cite{fan2013distributed}. The following lemma shows the triggering feasibility with the local and distributed event-based controller \eqref{position_system_distributed} by excluding these two cases.
\begin{lemma} \label{lemma:feasibility}
(Triggering feasibility) Consider the distributed formation system with the distributed event-based controller \eqref{position_system_distributed} and the distributed event function \eqref{distributed_trigger_local_function}. If there exists $t_h^i$ such that $\{R(t_h^i)^T e(t_h^i)\}_i \neq 0$, then
\begin{itemize}
\item (No singular triggering) agent $i$ will not exhibit singular triggering for all $t>t_h^i$.
\item (No continuous triggering) agent $i$ will not exhibit continuous triggering for all $t>t_h^i$.
\end{itemize}
\end{lemma}
\begin{proof}
The proof is inspired by \cite{fan2013distributed}. First note that due to $a_i \in (0,1)$, there holds $a_i(2-a_i) \in (0,1)$ and because $\gamma_i \in (0,1)$, there further holds $\gamma_i a_i(2-a_i) \in (0,1)$. For notational convenience, define
\begin{align} \label{eq:varrho}
\varrho_i: = \gamma_i a_i(2-a_i)
\end{align}
From \eqref{define_delta_i} and \eqref{distributed_trigger2}, for $t \in [t_h^i, t_{h+1}^i)$ one has
\begin{align}
\underline{\chi}_i := \frac{\|\{R(t_h^i)^T e(t_h^i)\}_i\|}{1+\sqrt{\varrho_i}} & \leq \|\{R(t)^T e(t)\}_i\| \nonumber \\
& \leq \frac{\|\{R(t_h^i)^T e(t_h^i)\}_i\|}{1-\sqrt{\varrho_i}} =: \overline{\chi}_i
\end{align}
We first prove the statement on non-singular triggering. According to the definition of the event-triggering function \eqref{distributed_trigger_local_function}, local events for agent $i$ can only occur either when $\|\{R(t)^T e(t)\}_i\|$ equals $\underline{\chi}_i$ or when $\|\{R(t)^T e(t)\}_i\|$ equals $\overline{\chi}_i$. Note that $\|\{R(t)^T e(t)\}_i\|^2 \leq \|\{R(t)^T e(t)\}\|^2 \leq \bar \lambda_{\text{max}}(R(t)^TR(t)) \|e(t)\|^2$, where $\bar \lambda_{\text{max}}$ is the largest eigenvalue of $R(t)^TR(t)$ which is bounded for any $e \in \mathcal{B}(\rho)$. Also note that $\|e(t)\|^2$ decays exponentially fast to zero as proved in Theorem 3. This implies that $\|\{R(t)^T e(t)\}_i\|$ will eventually decrease to $\underline{\chi}_i$. By assuming that $\{R(t_h^i)^T e(t_h^i)\}_i \neq 0$, the next event time $t_{h+1}^i$ for agent $i$ always exists with $\{R(t_{h+1}^i)^T e(t_{h+1}^i)\}_i \neq 0$.
The second statement can be proved by using similar arguments to those above, and by observing that $\{R(t)^T e(t)\}_i$ evolves continuously and a local event is triggered if and only if \eqref{distributed_trigger_local_function} is satisfied.
\end{proof}
In the following we will further discuss the possibility of the Zeno behavior in the distributed event-based formation system \eqref{position_system_distributed}.
\begin{theorem} \label{theorem:no_zeno1}
(Exclusion of Zeno triggering) Consider the distributed formation system with the distributed event-based controller \eqref{position_system_distributed} and the distributed event function \eqref{distributed_trigger_local_function}.
\begin{itemize}
\item At least one agent does not exhibit Zeno triggering behavior.
\item In addition, if there exists $\epsilon >0$ such that $\|\{R(t)^T e(t)\}_i\|^2 \geq \epsilon \|e(t)\|^2$ for all $i =1,2, \cdots, n$ and $t \geq 0$, then there exists a common positive lower bound for any inter-event time interval for each agent. In this case, no agent will exhibit Zeno triggering behavior.
\end{itemize}
\end{theorem}
\begin{proof}
Note that $\| \delta_i(t) \|^2 \leq \| \delta(t) \|^2$ for any $i$. In addition, there exists an agent $i_*$ such that $\|\{R(t)^T e(t)\}_{i_*}\|^2 \geq \frac{1}{m} \|\{R(t)^T e(t)\}\|^2$.
Then one has
\begin{align}
\frac{\| \delta_{i_*}(t) \|}{\|\{R(t)^T e(t)\}_{i_*}\|} \leq \sqrt{m} \frac{\| \delta(t) \|}{\|\{R(t)^T e(t)\}\|}
\end{align}
By recalling the proof in Theorem 2, we can conclude that the inter-event interval for agent $i_*$ is bounded from below by a time $\tau_{i_*}$ that satisfies
\begin{align}
\sqrt{m} \frac{\tau_{i_*} \alpha}{1- \tau_{i_*} \alpha} = \sqrt{\gamma_{i_*} a_{i_*}(2-a_{i_*})}
\end{align}
So that $\tau_{i_*} = \frac{\sqrt{\gamma_{i_*} a_{i_*}(2-a_{i_*})}}{ \alpha (\sqrt{m}+\sqrt{\gamma_{i_*} a_{i_*}(2-a_{i_*})})} >0$. The first statement is proved.
We then prove the second statement. Denote $\bar \lambda_{\text{max}}$ as the maximum of $\lambda_{\text{max}} (R^T R(e))$ for all $e \in \mathcal{B}(\rho)$. Since $\mathcal{B}(\rho)$ is a compact set, $\bar \lambda_{\text{max}}$ exists and is bounded. Then there holds $\|\{R(t)^T e(t)\}\|^2 \leq \bar \lambda_{\text{max}} \|e(t)\|^2$. One can further show
\begin{align}
\|\{R(t)^T e(t)\}_i\|^2 \geq \epsilon \|e(t)\|^2 \geq \frac{\epsilon}{\bar \lambda_{\text{max}}} \|\{R(t)^T e(t)\}\|^2
\end{align}
By following a similar argument to that above and using the analysis in the proof of Theorem 2, a lower bound on the inter-event interval $\bar \tau_i$ for each agent can be calculated as
\begin{align}
\bar \tau_i = \frac{\sqrt{\varrho_i}}{ \alpha \left(\sqrt{\frac{ \bar \lambda_{\text{max}}}{\epsilon}}+\sqrt{\varrho_i}\right)} >0, \,\,i = 1,2, \cdots, n
\end{align}
The proof is completed.
\end{proof}
\begin{remark}
The first part of Theorem \ref{theorem:no_zeno1} is motivated by \cite[Theorem 4]{dimarogonas2012distributed}, which guarantees the exclusion of Zeno behavior for at least one agent. To improve the result for all the agents, we propose a condition in the second part of Theorem \ref{theorem:no_zeno1}.
The above results in Theorem \ref{theorem:no_zeno1} on the distributed event-based controller are more conservative than the centralized case. The condition on the existence of $\epsilon >0$ essentially guarantees that $\|\{R(t)^T e(t)\}_i\|$ cannot be zero at any finite time, and will be zero if and only if $t = \infty$. By a similar analysis from event-based multi-agent consensus dynamics in \cite{SUN2018264}, one can show that if $\|\{R(t)^T e(\hat t)\}_i\| = 0$ at some finite time instant $\hat t$, then agent $i$ will exhibit a Zeno triggering and the time $\hat t$ is a Zeno time for agent $i$.
However, we have performed many simulations with different rigid formation shapes and observed that in most cases $\|\{R(t)^T e(t)\}_i\|$ is non-zero. We conjecture that this may be due to the infinitesimal rigidity of the formation shape. In the next subsection however, we will provide a simple modification of the distributed controller to remove the condition on $\epsilon$.
\end{remark}
\subsection{A modified distributed event function}
The event function \eqref{distributed_trigger_local_function} for agent $i$ involves the comparison of two terms, i.e. $\| \delta_i(t) \|^2$ and $\gamma_i a_i (2-a_i) \|\{R(t)^T e(t)\}_i\|^2$. As noted above, the existence of $\epsilon >0$ can guarantee $\|\{R(t)^T e(t)\}_i\| \neq 0$ for any finite time $t$. To remove this condition in Theorem \ref{theorem:no_zeno1}, and motivated by \cite{sun2018event}, we propose the following modified event function by including an exponential decay term:
\begin{align} \label{distributed_modified_event}
f_i(t) : = \| \delta_i(t) \|^2 & - \gamma_i a_i (2-a_i) \|\{R(t)^T e(t)\}_i\|^2 \nonumber \\
& - 2a_i v_i \text{exp}(-\theta_i t)
\end{align}
where $v_i>0, \theta_i>0$ are parameters that can be adjusted in the design to control the formation convergence speed. Note that $v_i \text{exp}(-\theta_i t)$ is always positive and converges to zero when $t \rightarrow \infty$. Thus, even if $\{R(t)^T e(t)\}_i$ exhibits a crossing-zero scenario at some finite time instant, the addition of this decay term guarantees a positive threshold value in the event function which avoids the case of comparing $\| \delta_i(t) \|^2$ to a zero threshold.
The main result in this subsection is to show that the above modified event function ensures Zeno-free triggering for all agents, and also drives the formation shape to reach the target one.
\begin{theorem}
By using the proposed distributed event-based formation controller \eqref{position_system_distributed} and the modified distributed event function \eqref{distributed_modified_event}, all the agents will reach the desired formation shape locally exponentially fast and no agent will exhibit Zeno-triggering behavior.
\end{theorem}
\begin{proof}
We consider the same Lyapunov function as used in Theorem 1 and Theorem 3 and follow similar steps as above. The triggering condition from the modified event function \eqref{distributed_modified_event} yields
\begin{align} \label{derivative_lya_distributed_modified}
\dot V(t) \leq \sum_{i=1}^n (\gamma_i -1) \frac{2-a_i}{2}\|\{R(t)^T e(t)\}_i\|^2 + v_i \text{exp}(-\theta_i t)
\end{align}
which follows that
\begin{align}
\dot V(t) \leq - 4\zeta_{\text{min}} \bar \lambda_{\text{min}} V(t) + \sum_{i=1}^n v_i \text{exp}(-\theta_i t)
\end{align}
where $\zeta_{\text{min}}$ is defined as the same to the notation in Theorem 3 (i.e. $\zeta_{\text{min}} = \text{min}_{i} (1- \gamma_i ) \frac{2-a_i}{2}$). For notational convenience, we define $\kappa = 2 \zeta_{\text{min}} \bar \lambda_{\text{min}}$ (also the same to Theorem 3).
By the well-known comparison principle \cite[Chapter 3.4]{khalil1996nonlinear}, it further follows that
\begin{align}
V(t) \leq \,\, & \text{exp}(- 2 \kappa t) V(0) \nonumber \\
& + \sum_{i=1}^n \frac{v_i}{2 \kappa - \theta_i} (\text{exp}(-\theta_i t) - \text{exp}(-2 \kappa t))
\end{align}
which implies that $V(t) \rightarrow 0$ as $t \rightarrow \infty$, or equivalently, $\|e(t)\| \rightarrow 0$, as $t \rightarrow \infty$.
In the following analysis showing exclusion of Zeno behavior we let $t \in [t_h^i, t_{h+1}^i)$.
We first show a sufficient condition to guarantee $f_i(t) \leq 0$ when $f_i(t)$ is defined in \eqref{distributed_modified_event}. Note that $f_i(t) \leq 0$ can be equivalently stated as
\begin{align} \label{eq:inequality_event_condition}
&(\varrho_i +1 ) \| \delta_i(t) \|^2 \nonumber \\
&\leq \varrho_i ( \| \delta_i(t) \|^2 + \|\{R(t)^T e(t)\}_i\|^2) + 2a_i v_i \text{exp}(-\theta_i t)
\end{align}
where $\varrho_i$ is defined in \eqref{eq:varrho}. Note that
\begin{align}
\|\{R(t_h^i)^T e(t_h^i)\}_i\|^2 = &\| \delta_i(t) + \{R(t)^T e(t)\}_i\|^2 \nonumber \\
\leq & 2 (\| \delta_i(t) \|^2 + \|\{R(t)^T e(t)\}_i\|^2)
\end{align}
Thus, a sufficient condition to guarantee the above inequality \eqref{eq:inequality_event_condition} (and the inequality $f_i(t) \leq 0$) is
\begin{align} \label{eq:sufficient_condition_event}
\| \delta_i(t) \|^2 \leq \frac{\varrho_i}{(2\varrho_i +2 )} \|\{R(t_h^i)^T e(t_h^i)\}_i\|^2
+ \frac{2a_i v_i}{\varrho_i +1} \text{exp}(-\theta_i t)
\end{align}
Note that from \eqref{eq:definition_delta} there holds $\dot \delta_i = - \frac{\text{d}}{\text{d}t} \{R(t)^T e(t)\}_i$. It follows that
\begin{small}
\begin{align}
\frac{\text{d}}{\text{d}t} \|\delta_i(t)\| & \leq \frac{\|\delta_i(t)^T\|}{\|\delta_i(t)\|} \|\dot \delta_i(t)\| \nonumber \\
& = \|\frac{\text{d}}{\text{d}t} \{R(t)^T e(t)\}_i \| \nonumber \\
& = \|\sum_{j \in \mathcal{N}_i} (\dot p_j(t) - \dot p_i(t)) e_k(t) + \sum_{j \in \mathcal{N}_i} ( p_j(t) - p_i(t)) \dot e_k(t)\| \nonumber \\
& = \|\sum_{j \in \mathcal{N}_i} (e_{k_{ij}}(t) \otimes I_d + 2 z_{k_{ij}}(t) z_{k_{ij}}(t)^T) (\dot p_j(t) - \dot p_i(t)) \| \nonumber \\
& = \|\sum_{j \in \mathcal{N}_i} Q_{ij}(t) (\{R(t_{h'}^j)^T e(t_{h'}^j)\}_j - \{R(t_h^i)^T e(t_h^i)\}_i) \| \nonumber \\
& \leq \sum_{j \in \mathcal{N}_i} \|Q_{ij}(t) \| \|(\{R(t_{h'}^j)^T e(t_{h'}^j)\}_j - \{R(t_h^i)^T e(t_h^i)\}_i) \| \nonumber \\
& := \alpha_i
\end{align}
\end{small}
where $Q_{ij}(t) : = e_{k_{ij}}(t) \otimes I_d + 2 z_{k_{ij}}(t) z_{k_{ij}}(t)^T$, and $t_{h'}^j = \text{arg max}_{h} \{t_h^j | t_h^j \leq t, j \in \mathcal{N}_i \}$. By a straightforward argument similar to Lemma \ref{lemma:feasibility}, it can be shown that agent $i$ will not exhibit singular
triggering, which indicates $\alpha_i$ cannot be zero for all time intervals. Also note that $\alpha_i$ is upper bounded by a positive constant which implies that $\frac{\text{d}}{\text{d}t} \|\delta_i(t)\|$ is upper bounded. From the sufficient condition given in \eqref{eq:sufficient_condition_event} which guarantees the event triggering condition $f_i(t) \leq 0$ shown in \eqref{distributed_modified_event}, the next inter-event interval for agent $i$ is lower bounded by the solution $\tau_{h}^i$ of the following equation
\begin{small}
\begin{align} \label{eq:Zeno_solution}
\tau_{h}^i \alpha_i = \sqrt{\frac{\varrho_i}{(2\varrho_i +2 )} \|\{R(t_h^i)^T e(t_h^i)\}_i\|^2
+ \frac{2a_i v_i}{\varrho_i +1} \text{exp}(-\theta_i (t_h^i + \tau_{h}^i))}
\end{align}
\end{small}
We note the solution $\tau_{h}^i$ to \eqref{eq:Zeno_solution} always exists and is positive. Thus, no agents will exhibit Zeno-triggering behavior with the modified event function \eqref{distributed_modified_event}.
\end{proof}
\begin{remark}
In the modified event function \eqref{distributed_modified_event}, a positive and exponential decay term $v_i \text{exp}(-\theta_i t)$ is included which guarantees that, even if $\{R(t)^T e(t)\}_i$ becomes zero at some finite time, the inter-event time interval at any finite time is positive and thus Zeno triggering is excluded. A more general strategy for designing a Zeno-free event function is to include a positive $\mathcal{L}^p$ signal in the event function \eqref{distributed_modified_event}. By following a similar analysis to \cite{sun2018event}, one can show that, if the term $v_i \text{exp}(-\theta_i t)$ in \eqref{distributed_modified_event} is replaced by a general positive $\mathcal{L}^p$ signal, the local convergence of the event-based formation control system \eqref{position_system_distributed} with Zeno-free triggering for all agents still holds.
However, a general $\mathcal{L}^p$ signal in \eqref{distributed_modified_event} may only guarantee an asymptotic convergence rather than an exponential convergence of the overall formation system \eqref{position_system_distributed}.
\end{remark}
\section{Simulation results} \label{sec:simulations}
In this section we provide three sets of simulations to show the behavior of certain formations with a centralized event-based controller and a distributed event-based controller, respectively. Consider a double tetrahedron formation in $\mathbb{R}^3$, with the desired distances for each edge being $2$. The initial conditions for each agent are chosen as $p_1(0) = [0,-1.0,0.5]^T$, $p_2(0) = [1.8,1.6,-0.1]^T$, $p_3(0) = [-0.2,1.8,0.05]^T$, $p_4(0) = [1.2,1.9,1.7]^T$ and $p_5(0) = [-1.0,-1.5,-1.2]^T$, so that the initial formation is close to the target one. The parameter $\gamma$ in the trigger function is set as $\gamma = 0.6$. Figs.~2-4 illustrate formation convergence and event performance with a centralized event triggering function. The trajectories of each agent, together with the initial shape and final shape are depicted in Fig. 2. The trajectories of each distance error are depicted in Fig. 3, which shows an exponential convergence to the origin. Fig. 4 shows the triggering time instant and the evolution of the norm of the vector $\delta$ in the triggering function \eqref{trigger_function}, which is obviously bounded below by $\gamma \|R(t)^T e(t)\|$ as required by \eqref{delta_norm}.
\begin{figure}
\centering
\includegraphics[width=75mm]{3d_centralized.pdf}
\caption{Simulation on stabilization control of a double tetrahedron formation in 3-D space with centralized event controller. The initial and final positions are denoted by circles and squares, respectively. The initial formation is denoted by dashed lines, and the final formation is denoted by red solid lines. The black star denotes the formation centroid, which is stationary. }
\label{shape_new}
\label{fig:env}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=60mm]{distance_error_3d_centralized.eps}
\caption{Exponential convergence of the distance errors with centralized event controller. }
\label{distance_error}
\label{fig:env}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=70mm]{trigger_error_3d_centralized.eps}
\caption{Performance of the centralized event-based controller.
Top: evolution of $\|\delta\|$ and $\|\delta\|_{\max} = \gamma \|R(t)^T e(t)\|$. Bottom: event triggering instants.}
\label{shape_new}
\label{fig:env}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=75mm]{3d_decentralized.pdf}
\caption{Simulation on stabilization control of a double tetrahedron formation in 3-D space with distributed event controller. The initial and final positions are denoted by circles and squares, respectively. The initial formation is denoted by dashed lines, and the final formation is denoted by red solid lines. The black star denotes the formation centroid, which is \emph{not} stationary. }
\end{figure}
\begin{figure*}[t]
\centering
\includegraphics[width=130mm]{Simu_distributed.eps}
\caption{Controller performance of the distributed event-based formation system \eqref{position_system_distributed} with distributed event function \eqref{distributed_trigger_local_function}. Left: Event triggering instants for each agent. Right: Exponential convergence of the distance errors with distributed event controller. }
\end{figure*}
We then perform another simulation on stabilizing the same formation shape by applying the proposed distributed event-based controller \eqref{position_system_distributed} and distributed event function \eqref{distributed_trigger_local_function}. Agents' initial positions are set the same as for the simulation with the centralized event controller. The parameters $\gamma_{i}, i=1,2,\ldots,5$ are set as $0.8$ and $a_{i}, i=1,2,\ldots,5$ are set as $0.6$. The trajectories of each agent, together with the initial shape and final shape are depicted in Fig. 5. The event times for each agent and the exponential convergence of each distance error are depicted in Fig. 6. Note that no $\|\{R(t)^T e(t)\}_i\|$ crosses zero values at any finite time and Zeno-triggering is excluded. Furthermore, the distance error system shown in Fig. 6 also demonstrates almost the same convergence property as shown in Fig. 3.
Lastly, we show simulations with the same formation shape by using the modified event triggering function \eqref{distributed_modified_event}. The exponential decay term is chosen as $v_i \text{exp}(-\theta_i t) = \text{exp}(-10 t)$ with $v_i = 1$ and $\theta_i =10$ for each agent. Fig.~7 shows event-triggering times for each agent as well as the convergence of each distance error. As can be observed from Fig. 7, Zeno-triggering is strictly excluded with the modified event function \eqref{distributed_modified_event}, while the convergence of the distance error system behaves almost the same to Fig. 3 and Fig.~6. It should be noted that in comparison with the controller performance and simulation examples discussed in \cite{sun2015event, Liu2015event, CCC_CHENFEI}, the proposed event-based rigid formation controllers in this paper demonstrate equal or even better performance, while complicated controllers and unnecessary assumptions in \cite{sun2015event, Liu2015event, CCC_CHENFEI} are avoided.
\begin{figure*}
\centering
\includegraphics[width=130mm]{Simu_exp_bound.eps}
\caption{Controller performance of the distributed event-based formation system \eqref{position_system_distributed} (event function \eqref{distributed_modified_event} with an exponential decay term). Left: Event triggering instants for each agent. Right: Exponential convergence of the distance errors with distributed event controller. }
\end{figure*}
\section{Conclusions} \label{sec:conclusions}
In this paper we have discussed in detail the design of feasible event-based controllers to stabilize rigid formation shapes. A centralized event-based formation control is proposed first, which guarantees the exponential convergence of distance errors and also excludes the existence of Zeno triggering. Due to a careful design of the triggering error and event function, the controllers are much simpler and require much less computation/measurement resources, compared with the results reported in \cite{CCC_CHENFEI, sun2015event, Liu2015event }. We then further propose a distributed event-based controller such that each agent can trigger a local event to update its control input based on only local measurement. The event feasibility and triggering behavior have been discussed in detail, which also guarantees Zeno-free behavior for the event-based formation system and exponential convergence of the distance error system. A modified distributed event function is proposed, by which the Zeno triggering is strictly excluded for each individual agent. A future topic is to explore possible extensions of the current results on single-integrator models to the double-integrator rigid formation system \cite{TAC_COMBINED} with event-based control strategy to enable velocity consensus and rigid flocking behavior.
\section*{Acknowledgment}
This work was supported by the National Science Foundation
of China under Grants 61761136005, 61703130 and 61673026, and also supported by the Australian Research Council's Discovery Project DP-160104500 and DP-190100887.
| {'timestamp': '2019-01-14T02:21:17', 'yymm': '1901', 'arxiv_id': '1901.03656', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03656'} | arxiv |
\section{Introduction}\label{intro}
We encounter multi-source or multi-modality data frequently in many real data applications. For example, the Alzheimer's Disease Neuroimaging Initiative (ADNI) data involve multi-site longitudinal observational data from elderly individuals with normal cognition (NC), mild cognitive impairment (MCI), or Alzheimer's Disease (AD) [\citealp{mueller2005ways}, \citealp{mueller2005alzheimer}]. The ADNI data contain multi-source measurements: magnetic resonance imaging (MRI), florbetapir-fluorine-$18$ (AV-$45$) positron emission tomography (PET) imaging, fludeoxyglucose F $18$ (FDG) PET imaging, biosamples, gene expression, and demographic information. Such multi-source data are also common for electronic medical record (EMR) systems adopted by most health care and medical facilities nowadays, which contain diverse-source patient information, e.g., demographics, medication status, laboratory tests, medical imaging and text notes.
However, blocks of variable information could be completely missing as there might be no need or it might be infeasible to collect certain sources of information given other known variables. E.g., patients might be either too healthy or too ill. For EMR systems, it could be due to lack of information exchange or common practice between different medical facilities \citep{madden2016missing}.
Block missing variables cause a large fraction of subjects with certain sources missing, which could lead to biased parameter estimation and inconsistent feature selection.
Therefore, it is important to fully integrate data from all complementary sources to improve model prediction and variable selection.
The most common approach for handling missing data is to perform complete-case analysis which removes observations with missing values and only utilizes the complete cases. However, the complete-case method produces biased estimates when the missing is not completely at random. The inverse probability weighting method [\citealp{horvitz1952generalization}] is able to reduce this bias under missing at random mechanism via re-weighting the complete observations [\citealp{seaman2013review}, \citealp{sun2018inverse}]; nevertheless, incomplete observations are still not fully utilized. In real applications, such as the ADNI data, removing incomplete cases could incur a great loss of information since complete cases only account for a small fraction of the data. Alternatively, likelihood-based methods [\citealp{garcia2010variable}, \citealp{ibrahim1999missing}, \citealp{chen2014penalized}] can incorporate all observations. However, this relies on specifying a known distribution which might not be available, and could be computationally intractable if the number of missing variables is large.
Imputation [\citealp{wan2015variable}, \citealp{liu2016variable}] is another widely-used approach to handle missing data. For example, [\citealp{cai2016structured}] propose a structured matrix completion (SMC) method through singular value decomposition to recover a missing block under a low rank approximation assumption. However, the SMC imputes only one missing block at a time. [\citealp{gao2017high}] is capable of imputing all missing values through matrix completion and then apply the adaptive Lasso [\citealp{huang2008adaptive}, \citealp{zou2006adaptive}] to select variables. However, this approach does not guarantee estimation consistency. Alternatively, multiple imputation [\citealp{rubin2004multiple}] (MI) is applicable for conducting variable selection, e.g., [\citealp{chen2013variable}] propose a multiple imputation-least absolute shrinkage and selection operator (MI-LASSO), and adopt the group Lasso [\citealp{yuan2006model}] to detect nonzero covariates. Furthermore, [\citealp{wood2008should}] and [\citealp{wan2015variable}] select variables on combined multiple imputed data. In addition, MI can be combined with bootstrapping techniques [\citealp{heymans2007variable}, \citealp{liu2016variable}, \citealp{long2015variable}]. However, these imputation methods are not effective for block-wise missing data.
Recently, several methods have been developed to target block-wise missing data. E.g., [\citealp{yuan2012multi}] propose an incomplete multi-source feature learning (iMSF) method, which models different missing patterns separately and minimizes a combined loss function. In addition, [\citealp{xiang2014bi}] introduce an incomplete source-feature selection (iSFS) model, utilizing shared parameters across all missing patterns and imposing different weights on different data sources. However, the iSFS is unable to provide coefficient estimation for all samples due to the different weighting strategy. Alternatively, the direct sparse regression procedure using covariance from multi-modality data (DISCOM) [\citealp{yu2019optimal}] estimates the covariance matrices among predictors and between the response and predictors.
However, the DISCOM only considers missing completely at random, which could be restrictive for missing not completely at random data
The single regression imputation (SI) method [\citealp{baraldi2010introduction}, \citealp{zhang2016missing}, \citealp{10.1007/978-3-319-25751-8_1}, \citealp{fleet2016initial}, \citealp{saunders2006imputing}] is another popular approach which predicts missing values through regression using observed variables as predictors.
Suppose that the subjects from multi-source data are divided into groups according to their missing patterns.
For a group with a given missing block, the SI estimates association between missing variables and observed variables within the group based on complete observations. However, in practice, the complete observations might only account for a small fraction of the entire data.
To integrate information from the multi-source observed data we propose a Multiple Block-wise Imputation (MBI) approach, incorporating not only the SI based on complete observations but also imputations from incomplete observations. The additional imputations in MBI involve fewer observed variables within a given missing group, but are able to integrate more observations from multiple groups than the SI. Thus, the MBI can improve estimation and model selection especially when the missing rate is high. In addition, the proposed method aggregates more groups with different missing patterns to impute missing variables, which does not rely on the missing completely at random assumption, and is capable of handling missing at random data.
Furthermore, we propose a new multiple block-wise imputation model selection method. Specifically, we propose to construct estimating equations based on all possible missing patterns and imputations, and integrate them through the generalized methods of moments (GMM) [\citealp{hansen1982large}].
In theory, we show that the proposed method has estimation and model selection consistency under both fixed-dimensional and high-dimensional settings. Moreover, our estimator is asymptotically more efficient than the SI estimator. Numerical studies and the ADNI data application also confirm that the proposed method outperforms existing variable selection methods for block-wise missing data in missing completely at random, missing at random, and informative missing scenarios.
In general, our work has the following major advantages. First, we are able to integrate the multiple block-wise imputations of all missing pattern groups to improve estimation efficiency and model selection consistency. Second, the proposed method is capable of handling block-wise missing data which might not contain any complete observations, while most traditional methods, including the matrix completion [\citealp{cai2016structured}], require partial subjects to have fully completed observations.
The remainder of the paper is organized as follows. Section \ref{Section2} introduces the background and framework for the block-wise missing problem. In Section \ref{Section3}, we propose the MBI approach incorporating all missing patterns. In Section \ref{Algorithm}, the implementation and algorithm are illustrated.
In Section \ref{SectionTheory}, we establish the theoretical properties of the proposed method. Sections \ref{SectionSim} and \ref{Real} provide numerical studies through simulations and the ADNI data application.
\section{Background and Motivation}\label{Section2}
In this section, we introduce the framework for the block-wise missing problem.
Let $\bm{y} = (y_1, \dots, y_n)^T$ be the response variable, and $\bm{X}=(X_{ij})$ be the $N\times p$ design matrix. Suppose that all the samples are drawn independently from a random vector $\bm{\mathcal{X}}=(X_1, X_2, \dots, X_p)$, whose covariance matrix $\bm{C}=(c_{ij})$ is positive definite. Then, for any $1\le i \le N$ and $1\le j \le p$, $X_{ij}$ represents the $i$-the sample of the $j$-th covariate. Suppose that all the covariates in $\bm{X}$ are from $S$ sources.
Figure \ref{missingpattern} illustrates a setting with three sources.
We divide samples $\bm{X}$ into $R$ disjoint groups based on the missing patterns across all sources, where $\bm{x}_i$, the $i$-th row of $\bm{X}$, is in the $r$-th group if $ i \in \mathcal{H}(r)$, and $\mathcal{H}(r)$ is an index set of samples. For any $1\le r\le R$, let $a(r)$ and $m(r)$ be the index sets of the observed covariates and missing covariates corresponding to the $r$-th group, respectively, and obviously, $\bigcup\limits_{r=1}^{R}a(r)=\{1,\dots,p\}$.
Then, $\bm{\mathcal{X}}_{a(r)}$ and $\bm{\mathcal{X}}_{m(r)}$ represent observed variables and missing variables in the $r$-th group, respectively. In addition, let $\mathcal{G}(r)$ be the index set of the groups where missing variables $\bm{\mathcal{X}}_{m(r)}$ and variables in at least one of the other sources are observed. If there are no missing values in the $r$-th group, let $\mathcal{G}(r)=\{r\}$, a completely observed dataset. We assume that $\mathcal{G}(r)$ is nonempty containing $M_r=|\mathcal{G}(r)|$ elements for $1\le r\le R$. Note that this assumption does not imply that the data must contain complete observations, since $\mathcal{G}(r)$ could contain a group which is not a complete case group but contains observed values of variables $\bm{\mathcal{X}}_{m(r)}$ and of partial variables in $\bm{\mathcal{X}}_{a(r)}$.
For illustration, the design matrix on the left of Figure \ref{missingpattern} consists of $3$ sources which are partitioned into $5$ missing pattern groups, where each white area represents a missing block and the colored ones represent observed blocks in different groups. For example, $\mathcal{H}(2)$ refers to samples in Group $2$ and $\bm{\mathcal{X}}_{m(2)}$ refers to missing covariates in Group $2$. Since Groups $1$, $3$ and $4$ contain observed values of $\bm{\mathcal{X}}_{m(2)}$ and covariates in Source $2$ or $3$, $\mathcal{G}(2)=\{1,3,4\}$ and $M_2=3$. If we remove Group $1$ (the complete case group) and Group $5$,
the $\mathcal{G}(2)$ is still non-empty, which is also true for $\mathcal{G}(3)$ and $\mathcal{G}(4)$.
We consider the following linear model
\begin{equation}\label{Lmodel}
\bm{y}=\bm{X}\bm{\beta}^0 + \bm{\varepsilon},
\end{equation}
where $\bm{\beta}^0=(\beta_1^0, \dots, \beta_p^0)^T$ is the true coefficient vector corresponding to all covariates and $\bm{\varepsilon}\sim N(\bm{0}, \sigma_{\varepsilon}^2\bm{I}_N)$ represents an error term independent of $\bm{X}$.
We assume that the model is sparse; that is, most of the true coefficients are zero.
Let $A_1=\{j : \beta_j^0\ne0\}$ and $A_2=\{j : \beta_j^0=0\}$ be index sets corresponding to relevant and irrelevant covariates, respectively. We also let $q=|A_1|$ be the total number of relevant covariates. In the supplementary material, we provide a table of all notations for convenience.
\begin{figure}
\labellist
\hair 2pt
\small
\pinlabel {Source 1} at 27 352
\pinlabel {Source 2} at 90 352
\pinlabel {Source 3} at 170 352
\pinlabel {Group 1} at -35 315
\pinlabel {Group 2} at -35 267
\pinlabel {Group 3} at -35 215
\pinlabel {Group 4} at -35 158
\pinlabel {Group 5} at -35 107
\pinlabel
$\xleftarrow{\makebox[1.0cm]{}}\mathcal{X}_{a(2)}\xrightarrow{\makebox[0.45cm]{}}$ at 60 267
\pinlabel $\xleftarrow{\makebox[0.27cm]{}}\mathcal{X}_{m(2)}\xrightarrow{\makebox[0.3cm]{}}$ at 165 267
\pinlabel$\xleftarrow{\makebox[0.97cm]{}}\mathcal{X}_{J(2,1)}\xrightarrow{\makebox[0.05cm]{}}$ at 346 368
\pinlabel$\hat{\bm{X}}_{m(2)}^{(1)}$ at 447 368
\pinlabel $\mathcal{X}_{J(2,3)}$ at 313 253
\pinlabel$\hat{\bm{X}}_{m(2)}^{(3)}$ at 447 253
\pinlabel $\mathcal{X}_{J(2,4)}$ at 375 83
\pinlabel$\hat{\bm{X}}_{m(2)}^{(4)}$ at 447 83
\endlabellist
\centering
\includegraphics[scale=0.7]{block7}
\caption{Left: Missing patterns for block-wise missing data. Each white area represents a missing block, while the colored ones represent observed blocks from different missing patterns. Right: Multiple block-wise imputations for the missing block in Group $2$.}\label{missingpattern}
\end{figure}
The likelihood-based approaches [\citealp{garcia2010variable}] typically formulate likelihood based on completely observed variables. However, it is likely that no covariate is completely observed under the block-wise missing structure. Alternatively, [\citealp{yuan2012multi}] construct a model for each missing pattern separately and use observed variables within each missing pattern as predictors. For instance, for Group $2$ in Figure \ref{missingpattern}, the above method treats the covariates in Sources $1$ and $2$ as predictors and ignores information from Source $3$. However, Source $3$ covariates could be incorporated as well, since they are relevant to the response variable.
Traditional imputation methods [\citealp{zhang2016missing}, \citealp{10.1007/978-3-319-25751-8_1}, \citealp{fleet2016initial}] impute missing values in Group $2$ based on the associations between missing and observed variables obtained from complete observations in Group $1$, while
samples in Groups $3$ and $4$ are not utilized. However, Groups $3$ and $4$, also containing values from Source $3$, can provide additional information in imputing missing variables $\bm{\mathcal{X}}_{m(r)}$ through correlations with other covariates.
This is especially useful when completely observed subjects are scarce. In the following section, we propose a new imputation approach to fully utilize information not only from the group with complete cases but also from other groups.
\section{Method} \label{Section3}
\subsection{ Multiple Block-wise Imputation}\label{MBI}
In this subsection, we propose a multiple block-wise imputation approach which can utilize more observed information from incomplete case groups than traditional imputation methods.
Specifically, for a given Group $r$ with missing values of $\bm{\mathcal{X}}_{m(r)}$,
each of the $\mathcal{G}(r)$ groups contains observed values corresponding to missing $\bm{\mathcal{X}}_{m(r)}$, and also observed values corresponding to a subset of observed $\bm{\mathcal{X}}_{a(r)}$. Therefore, we can predict missing values in the $r$-th group with $M_r=|\mathcal{G}(r)|$ ways to borrow information from all the groups in $\mathcal{G}(r)$, instead of using a complete case group only.
More specifically, for each $k \in \mathcal{G}(r)$, let $J(r,k)=a(r)\cap a(k)$ be an index set of covariates which are observed in Groups $r$ and $k$. For each $j \in m(r)$, we estimate $E(X_j|\bm{\mathcal{X}}_{J(r,k)})$ utilizing all the groups containing observed values of both $X_j$ and $\bm{\mathcal{X}}_{J(r,k)}$, and then impute missing values for $X_j$ in the $r$-th group using association information in the conditional expectation. Let $\hat{\bm{X}}_{m(r)}^{(k)}$ represent the imputation for all missing values in Group $r$. The proposed multiple imputations approach is referred to as Multiple Block-wise Imputation (MBI). We illustrate the MBI with an example in Figure \ref{missingpattern}. For Group $2$,
covariates observed in both Group $2$ and a group in $\mathcal{G}(2)=\{1,3,4\}$ are indexed by $J(2,1)=B_1\cup B_2$, $J(2,3)=B_1$, and $J(2,4)=B_2$, respectively, where $B_k$ is an index set of covariates from Source $k$ for $k=1,2,3$.
The traditional imputation methods, such as the SI, only utilize observed values in Group $2$ and Group $1$ to impute the missing values in Group $2$, namely $\hat{\bm{X}}_{m(2)}^{(1)}$, as shown on the top right of Figure \ref{missingpattern}. In contrast, the proposed method can incorporate more information from Groups $3$ and $4$ in addition to Groups $1$ and $2$, and impute the missing values in Group $2$ using three different blocks of observed variables. Namely, we estimate $E(\bm{\mathcal{X}}_{B_3} | \bm{\mathcal{X}}_{B_1\cup B_2})$, $E(\bm{\mathcal{X}}_{B_3} | \bm{\mathcal{X}}_{B_1})$ and $E(\bm{\mathcal{X}}_{B_3} | \bm{\mathcal{X}}_{B_2})$ based on Group $1$, Groups $1$ and $3$, and Groups $1$ and $4$, respectively. We then impute the missing values via the above three estimated conditional expectations and the observed information in Group $2$.
Compared with the SI, the proposed MBI incorporates additional imputed values $\hat{\bm{X}}_{m(2)}^{(3)}$ and $\hat{\bm{X}}_{m(2)}^{(4)}$ via $E(\bm{\mathcal{X}}_{B_3} | \bm{\mathcal{X}}_{B_1})$ and $E(\bm{\mathcal{X}}_{B_3} | \bm{\mathcal{X}}_{B_2})$, where the estimation involves more observed samples than the SI approach.
In particular, when estimating conditional expectation for the imputations, we aggregate subjects from different missing pattern groups,
which can diminish the influence of specific missing patterns of covariates
\vspace{-3mm}
\subsection{Integration of MBI}
In this subsection, we propose to integrate information from all available sources and multiple block-wise imputations.
Specifically, we construct estimating functions for each group according to its missing pattern. For a given Group $r$ containing missing values and $k\in\mathcal{G}(r)$, since missing $\bm{\mathcal{X}}_{m(r)}$ are estimated through $E(\bm{\mathcal{X}}_{m(r)} | \bm{\mathcal{X}}_{J(r,k)})$ which is a projection onto $\bm{\mathcal{X}}_{J(r,k)}$,
the covariates $\bm{\mathcal{X}}_{J(r,k)}$ are uncorrelated with residuals of the projection $\bm{\mathcal{X}}_{m(r)} - E(\bm{\mathcal{X}}_{m(r)} | \bm{\mathcal{X}}_{J(r,k)})$.
Therefore, for each $j \in J(r,k)$,
\begin{eqnarray*}\label{CEequality1}
&&E\left[ X_{j} \left\{y-\bm{\mathcal{X}}_{a(r)}\bm{\beta}^0_{a(r)} - E(\bm{\mathcal{X}}_{m(r)} | \bm{\mathcal{X}}_{J(r,k)})\bm{\beta}^0_{m(r)}\right\}\right] \notag\\
&=&E\left(X_j \ \varepsilon\right)+E\left[ X_{j} \left\{\bm{\mathcal{X}}_{m(r)} - E(\bm{\mathcal{X}}_{m(r)} | \bm{\mathcal{X}}_{J(r,k)})\right\}\right]\bm{\beta}^0_{m(r)}=0,
\end{eqnarray*}
where
$\bm{\beta}^0_{a(r)}$ and $\bm{\beta}^0_{m(r)}$ denote the true coefficients of $\bm{\mathcal{X}}_{a(r)}$ and $\bm{\mathcal{X}}_{m(r)}$, respectively.
In addition, for any $j \in m(r)$, since $E(X_{j}|\bm{\mathcal{X}}_{J(r,k)})$ is a function of $\bm{\mathcal{X}}_{J(r,k)}$,
\begin{eqnarray*}\label{CEequality2}
&&E\left[ E(X_{j}|\bm{\mathcal{X}}_{J(r,k)}) \left\{y-\bm{\mathcal{X}}_{a(r)}\bm{\beta}^0_{a(r)} - E(\bm{\mathcal{X}}_{m(r)} | \bm{\mathcal{X}}_{J(r,k)})\bm{\beta}^0_{m(r)}\right\}\right] \notag\\
&=&E\left\{ E(X_{j}|\bm{\mathcal{X}}_{J(r,k)})\ \varepsilon\right\}+E\left[ E(X_{j}|\bm{\mathcal{X}}_{J(r,k)}) \left\{\bm{\mathcal{X}}_{m(r)} - E(\bm{\mathcal{X}}_{m(r)} | \bm{\mathcal{X}}_{J(r,k)})\right\}\right]\bm{\beta}^0_{m(r)}=0.
\end{eqnarray*}
Note that $J(r,k) \cup m(r)=\left\{a(r)\cap a(k)\right\} \cup m(r)=a(k)$ since $m(r)\subset a(k)$ for $k \in \mathcal{G}(r)$.
Thus, we construct estimating functions corresponding to observed covariates in the $k$-th group using imputed values $\hat{\bm{X}}_{m(r)}^{(k)}$.
In general, for each $ i \in \mathcal{H}(r)$, let $\bm{x}_i^{(k)}=(X_{i1}^{(k)}, \dots, X_{ip}^{(k)})$ be the $i$-th imputed sample based on Group $k$,
where $X_{ij}^{(k)} = X_{ij}$ if the $j$-th covariate is observed in the sample $\bm{x}_i$, otherwise $X_{ij}^{(k)}$ is an imputed value of $X_{ij}$ in $\hat{\bm{X}}_{m(r)}^{(k)}$.
The estimating functions for the imputed samples $\bm{x}_i^{(k)}$ in Group $r$ are
\begin{eqnarray*}
\bm{g}_i^{(r , k)} (\bm{\beta})=
\frac{\partial \mu_i^{(k)} (\bm{\beta})}{\partial \bm{\beta}_{a(k)}}
\left\{y_i-\mu_i^{(k)} (\bm{\beta})\right\} = \left\{\bm{z}_i^{(k)}\right\}^T \left\{y_i-\mu_i^{(k)} (\bm{\beta})\right\} \ \ \ \ \text{ for } i\in \mathcal{H}(r),
\end{eqnarray*}
where
$\bm{z}_i^{(k)}$ is a sub-vector of $\bm{x}_i^{(k)}$ consisting of $X_{ij}^{(k)}$ for $j\in a(k)$,
$\partial \mu_i^{(k)} /\partial \bm{\beta}_{a(k)}$ is the derivative of $\mu_i^{(k)} (\bm{\beta}) = \bm{x}_i^{(k)} \bm{\beta}$ with respect to $\bm{\beta}_{a(k)}$, and $\bm{\beta}_{a(k)}$ is the coefficient vector corresponding to $\bm{\mathcal{X}}_{a(k)}$.
To integrate information from all available missing patterns and imputations, we propose an aggregated vector of estimating functions:
\vspace{-3mm}
\begin{equation}\label{AllEF}
\vspace{-3mm}
\bm{g}(\bm{\beta})=(\{\bm{g}^{(1)} (\bm{\beta})\}^T,\dots, \{\bm{g}^{(R)} (\bm{\beta})\}^T)^T,
\end{equation}
where
\vspace{-3mm}
\begin{equation*}
\vspace{-3mm}
\bm{g}^{(r)}=\frac{1}{n_r}\sum_{i\in\mathcal{H}(r)}\bm{g}_i^{(r)} (\bm{\beta}),
\end{equation*}
$n_r$ is the number of samples from the $r$-th group, and $\bm{g}_i^{(r)} (\bm{\beta})$ is a vector consisting of $\bm{g}_i^{(r, k)} (\bm{\beta})$ for $k\in\mathcal{G}(r)$.
If the $r$-th group only has complete observations, then $\mathcal{G}(r)=\{r\}$, $M_r=1$ and
\vspace{-3mm}
\begin{equation*}
\vspace{-3mm}
\bm{g}_i^{(r)}(\bm{\beta})=\bm{g}_i^{(r, r)}(\bm{\beta})= \bm{x}_{i}^T \left\{y_i-\bm{x}_i\bm{\beta}
\right\} \ \ \ \ \ \ \ \ \ \text{ for } i\in \mathcal{H}(r).
\end{equation*}
Note that the total number of equations exceeds the number of coefficient parameters, and estimating functions from groups with fewer missing variables or more accurate imputations tend to have smaller variance.
To combine all the estimating functions in $\bm{g}(\bm{\beta})$,
we estimate coefficients $\bm{\beta}$ through the penalized generalized method of moments \citep{caner2009lasso} which minimizes
\vspace{-3mm}
\begin{equation}\label{nonsingular}
\vspace{-3mm}
f(\bm{\beta})=\{\bm{g}(\bm{\beta})\}^T\bm{W}(\bm{\beta})^{-1}\bm{g}(\bm{\beta})+\sum\limits_{j=1}^{p} p_{\lambda}(|\beta_j|),
\end{equation}
where
\vspace{-3mm}
\begin{equation*}
\vspace{-3mm}
\bm{W}(\bm{\beta})=diag\left\{\frac{1}{n_1}\sum_{i\in\mathcal{H}(1)}\bm{g}_i^{(1)}(\bm{\beta})\{\bm{g}_i^{(1)}(\bm{\beta})\}^T, \dots, \frac{1}{n_R}\sum_{i\in\mathcal{H}(R)}\bm{g}_i^{(R)}(\bm{\beta})\{\bm{g}_i^{(R)}(\bm{\beta})\}^T \right\}
\end{equation*}
is the sample covariance matrix of $\bm{g}(\bm{\beta})$, and $p_{\lambda}(\cdot)$
is a penalty function with tuning parameter $\lambda$.
In this paper, we choose the SCAD penalty due to its oracle properties \citep{fan2001variable}. The sample covariance matrix $\bm{W}(\bm{\beta})$ is a block diagonal matrix since estimating functions are formulated based on different missing patterns.
However, $\bm{W}(\bm{\beta})$ could be singular or close to singular due to overlapping information in imputations, or due to a large number of estimating functions compared to a relatively small sample size. For example, as illustrated in Figure \ref{missingpattern}, the observed values of Source $1$ covariates in Group $2$ are utilized in the estimation of both $\hat{\bm{X}}_{m(2)}^{(1)}$ and $\hat{\bm{X}}_{m(2)}^{(3)}$.
\vspace{-3mm}
\subsection{Solving the singularity issue of estimating equations}
To solve the singularity issue of estimating equations, we reduce the dimension of $\bm{g}^{(r)}$ for $r=1,\dots,R$,
through combining informative estimating equations, e.g., utilizing the first several largest principle components (PCs) [\citealp{wold1987principal}, \citealp{cho2015efficient}]. Specifically, we divide the estimating functions in $\bm{g}^{(r)}$ into two parts $\bm{g}_{(1)}^{(r)}$ and $\bm{g}_{(2)}^{(r)}$, where $\bm{g}_{(1)}^{(r)}$ consists of the functions with the imputation based on complete observations, and $\bm{g}_{(2)}^{(r)}$ contains the remaining estimating functions in $\bm{g}^{(r)}$. We proceed to extract informative principle components from $\bm{g}_{(1)}^{(r)}$ and $\bm{g}_{(2)}^{(r)}$ separately.
Let Group $1$ be the complete case group, and $\bm{W}_{11}^{(r)}$ and $\bm{W}_{22}^{(r)}$ be the sample covariance matrices of $\bm{g}_{(1)}^{(r)}$ and $\bm{g}_{(2)}^{(r)}$, respectively. If the dimension of $\bm{g}_{(1)}^{(r)}$ is too large such that $\bm{W}_{11}^{(r)}$ is singular or close to singular, we extract the first $t_1$ principle components $\bm{h}^{(r)}=\bm{U}_1^{(r)}\bm{g}_{(1)}^{(r)}$ from $\bm{g}_{(1)}^{(r)}$, where $\bm{U}_1^{(r)}$ contains $t_1$ eigenvectors of $\bm{W}_{11}^{(r)}$ corresponding to the largest $t_1$ nonzero eigenvalues, and $t_1$ can be selected to retain sufficient information. If $\bm{W}_{11}^{(r)}$ is neither singular nor close to singular, we retain all the estimating functions in $\bm{g}_{(1)}^{(r)}$, and let $\bm{U}_1^{(r)}$ be an identity matrix, that is, $\bm{h}^{(r)}=\bm{g}_{(1)}^{(r)}$.
We orthogonalize $\bm{g}_{(2)}^{(r)}$ against the $\bm{h}^{(r)}$ to store additional information beyond $\bm{h}^{(r)}$, where $\bar{\bm{g}}_{(2)}^{(r)}=\bm{g}_{(2)}^{(r)}-\bm{V}_{21}^{(r)}\{\bm{V}_{11}^{(r)}\}^{-1}\bm{h}^{(r)}$ consists of orthogonalized estimating functions, $\bm{V}_{11}^{(r)}=\bm{U}_1^{(r)} \bm{W}_{11}^{(r)} \{\bm{U}_1^{(r)}\}^T$,
and $\bm{V}_{21}^{(r)}$ is the sample covariance matrix between $\bm{g}_{(2)}^{(r)}$ and $\bm{h}^{(r)}$. Similarly, if the sample covariance of $\bar{\bm{g}}_{(2)}^{(r)}$ is singular or close to singular, we select the first $t_2$ principle components $\bm{U}_2^{(r)}\bar{\bm{g}}_{(2)}^{(r)}$ from the orthogonalized $\bar{\bm{g}}_{(2)}^{(r)}$, where $\bm{U}_2^{(r)}$ contains $t_2$ eigenvectors of the sample covariance matrix of $\bar{\bm{g}}_{(2)}^{(r)}$ corresponding to the largest $t_2$ nonzero eigenvalues.
Otherwise, we retain all the $\bar{\bm{g}}_{(2)}^{(r)}$, and let $\bm{U}_2^{(r)}$ be an identity matrix.
Let
\begin{equation*}
\bm{U}^{(r)}= \begin{pmatrix}\bm{U}_1^{(r)}&\bm{0}\\-\bm{U}_2^{(r)}\bm{V}_{21}^{(r)}\{\bm{V}_{11}^{(r)}\}^{-1}\bm{U}_1^{(r)}\ & \bm{U}_2^{(r)}\end{pmatrix}.
\end{equation*}
If there is no complete case group or $M_r=1$, then either $\bm{g}_{(1)}^{(r)}$ or $\bm{g}_{(2)}^{(r)}$ is null, and $\bm{U}^{(r)}$ is either $\bm{U}_2^{(r)}$ or $\bm{U}_1^{(r)}$.
Thus, $\bm{U}^{(r)}\bm{g}^{(r)}$ contains all the essential information from the estimating functions of the $r$-th group, while solving the singularity issue of the sample covariance matrix. The numbers of principle components $t_1$ and $t_2$ can be tuned through the Bayesian information type of criterion proposed by \citep{cho2015efficient} to capture sufficient information from the estimating functions in (\ref{AllEF}). Consequently, the proposed estimator $\hat{\bm{\beta}}$ is obtained via minimizing
\vspace{-3mm}
\begin{equation}\label{FinalObject}
\vspace{-3mm}
f^*(\bm{\beta})=(\bm{Ug})^T(\bm{UW}\bm{U}^T)^{-1}\bm{Ug}+\sum\limits_{j=1}^{p} p_{\lambda}(|\beta_j|),
\end{equation}
where $\bm{U}=diag\{\bm{U}^{(1)}, \dots, \bm{U}^{(R)}\}$. In the following section, we also provide an algorithm and implementation strategy of the proposed method.
\vspace{-3mm}
\section{Implementation}\label{Algorithm}
In this section, we provide the detailed algorithm for the proposed method.
The conditional expectations of missing covariates in MBI can be estimated via linear regression models, generalized linear models (GLM) or non-parametric models.
In this paper, we utilize the GLM \citep{10.2307/2344614} to accommodate not only continuous covariates but also discrete covariates.
Specifically, for each group $1\le r\le R$, $j\in m(r)$, and $k\in\mathcal{G}(r)$, we adopt the GLM to predict $E(X_j|\bm{\mathcal{X}}_{J(r,k)})$ if groups containing observed values of both $X_j$ and $\bm{\mathcal{X}}_{J(r,k)}$ have a larger sample size than the number of observed variables $|J(r,k)|$, or adopt the $L_1$-regularized GLM \citep{friedman2010regularization} otherwise.
To obtain the $L_1$-regularized GLM estimator, we apply the ``glmnet'' package (\resizebox{31ex}{1.4ex}{\href{https://cran.r-project.org/web/packages/glmnet/index.html}{\ttfamily https://cran.r-project.org/web}} \resizebox{28ex}{1.4ex}{\href{https://cran.r-project.org/web/packages/glmnet/index.html}{\ttfamily packages/glmnet/index.html}}) in R. The imputed values in MBI are then computed based on the estimated conditional expectation.
To consistently handle singular or non-singular $\bm{W}$\hspace{-0.5mm}, we use $f^*(\bm{\beta})$ in (\ref{FinalObject}) instead of $f(\bm{\beta})$ in (\ref{nonsingular}) as our objective function for all $\bm{W}$\hspace{-0.5mm}. For the sample covariance matrix $\bm{W}^{(r)}$ of $\bm{g}^{(r)}$ from Group $r$, we select the numbers of principle components $t_1$ and $t_2$ corresponding to $\bm{\Omega}$, which is $\bm{W}^{(r)}_{11}$ or $\bm{W}^{(r)}_{22}-\bm{V}^{(r)}_{21}\{\bm{V}^{(r)}_{11}\}^{-1}\{\bm{V}^{(r)}_{21}\}^T$, through minimizing the BIC-type of criterion \citep{cho2015efficient}
\begin{equation}\label{PC}
\Psi(t) = \frac{\text{tr}\{\bm{\Omega}-\widetilde{\bm{\Omega}}(t)\}}{\text{tr}\{\bm{\Omega}\}} + t\frac{\log (n_r d)}{n_r d},
\end{equation}
where
$d$ is the dimension of $\bm{\Omega}$. Here, the
$\widetilde{\bm{\Omega}}(t)=\sum_{j=1}^{t}\lambda_j\bm{v}_j\bm{v}_j^T$ is an approximation of $\bm{\Omega}$ based on the $t$ largest eigenvectors, where $\lambda_j$ is the $j$-th largest eigenvalue of $\bm{\Omega}$, and $\bm{v}_j$ is the eigenvector of $\bm{\Omega}$ corresponding to $\lambda_j$. Since
$\text{tr}\{\bm{\Omega}-\widetilde{\bm{\Omega}}(t)\}=\sum_{j=t+1}^{d}\lambda_j$, the minimizer of $\Psi(t)$ is indeed the number of eigenvalues which are larger than $\text{tr}\{\bm{\Omega}\} \log (n_r d)/(n_r d)$.
\begin{figure}
\labellist
\pinlabel
$f^*(\bm{\beta})$ at 5 450
\pinlabel $\beta_{2}$ at 170 85
\pinlabel $\beta_{1}$ at 630 75
\endlabellist
\centering
\includegraphics[scale=0.5]{plot_function2}
\caption{The objective function $f^*(\bm{\beta})$.}\label{objective}
\end{figure}
\begin{table}[htbp]\centering
\begin{tabular}{c}
\hline
\textbf{Algorithm 1} \\
\hline
\parbox{14.5cm}{
\begin{enumerate}
\item Obtain initial values $\bm{\beta}^{(0)}$ based on complete observations. Set tolerance $\epsilon$, and the tuning parameters $\lambda$ and $a$.
\item Estimate $\hat{\bm{X}}^{(j)}_{m(r)}$ via the GLM or $L_1$-regularized GLM depending on the sample size for each $r=1, \dots, R$ and $j\in\mathcal{G}(r)$.
\item At the $k$-th iteration, given $\bm{\beta}^{(k-1)}$ and $\bm{s}_{k-1}$ from the ($k-1$)-th iteration:
\begin{enumerate}
\item Select the number of principle components using (\ref{PC}) if $\bm{W}^{(r)}$ is singular for $r=1,\dots, R$.
\item Calculate the conjugate direction $\bm{s}_k$ using (\ref{direction}).
\item Calculate the step size $\alpha_k$ using (\ref{step}).
\item Update $\bm{\beta}^{(k)}=\bm{\beta}^{(k-1)}+\alpha_k \bm{s}_k$.
\end{enumerate}
\item Iterate Step 3 until the convergence criterion is satisfied, e.g., $\underset{1\le j \le p}{\max}\{|\beta_j^{(k)}-\beta_j^{(k-1)}|\}<\epsilon$.
\end{enumerate}}\\
\hline
\end{tabular}
\end{table}
We plot an example of the objective function $f^*(\bm{\beta})$ in Figure \ref{objective} to illustrate the objective function $f^*(\bm{\beta})$ near true coefficients. In this example, there are three sources and four groups with $p_1=p_2=p_3=20$ and $n_1=n_2=n_3=n_4=1000$, where each source contains one relevant predictor with a signal strength of $1$ and the missing patterns are the same as in Groups $1$--$4$ in Figure \ref{missingpattern}. The true coefficients of $\beta_1$ and $\beta_{2}$ are $1$ and $0$, respectively. Figure \ref{objective} shows that $f^*(\bm{\beta})$ has a unique minimizer around the true coefficients.
To obtain the minimizer, we propose to iteratively decrease $f^*(\bm{\beta})$ via the nonlinear conjugate gradient algorithm \citep{dai1999nonlinear} which converges quadratically \citep{cohen1972rate} without requiring the second derivative of the objective function. At the $k$-th iteration, the conjugate direction is
\vspace{-3mm}
\begin{equation}\label{direction}
\vspace{-3mm}
\bm{s}_k=-\nabla f^*(\bm{\beta}^{(k-1)})+\gamma_{k-1}\bm{s}_{k-1},
\end{equation}
where $\nabla f^*(\bm{\beta}^{(k-1)})$
is the gradient of $f^*(\bm{\beta})$ at $\bm{\beta}=\bm{\beta}^{(k-1)}$,
\begin{equation*}
\gamma_{k-1}= - \frac{\left\{\nabla f^*(\bm{\beta}^{(k-1)})\right\}^T\nabla f^*(\bm{\beta}^{(k-1)})}{\bm{s}_{k-1}^T \left\{\nabla f^*(\bm{\beta}^{(k-2)})-\nabla f^*(\bm{\beta}^{(k-1)})\right\}},
\end{equation*}
and $\bm{s}_1=-\nabla f^*(\bm{\beta}^{(0)})$. Here, the initial values $\bm{\beta}^{(0)}$ are obtained by performing the Lasso method \citep{tibshirani1996regression} on complete observations, and the gradient is numerically calculated via central differences.
We determine the step size in the conjugate direction $\bm{s}_k$ through a line search:
\vspace{-3mm}
\begin{equation}\label{step}
\vspace{-3mm}
\alpha_k=\underset{\alpha}{\text{argmin}} f^*(\bm{\beta}^{(k-1)}+\alpha \bm{s}_k).
\end{equation}
We summarize the whole procedure for the implementation of the proposed method in Algorithm 1. Note that estimation of MBI is carried out in Step 2, and the nonlinear conjugate gradient method is performed in Step 3.
To select the tuning parameter $\lambda$ in the penalty function $p_{\lambda} (\cdot)$, we propose a BIC-type criterion (MBI-BIC) as follows:
\vspace{-3mm}
\begin{equation}\label{MBI-BIC}
\vspace{-3mm}
\text{MBI-BIC}_{\lambda}=N\cdot\log\left\{RSS(\hat{\bm{\beta}}_{\lambda})/N\right\}+df_{\lambda}\cdot\log (N),
\end{equation}
where $\hat{\bm{\beta}}_{\lambda}$ is the proposed estimator for a given $\lambda$, $df_{\lambda}$ is the number of non-zero estimated coefficients in $\hat{\bm{\beta}}_{\lambda}$, and $RSS(\hat{\bm{\beta}}_{\lambda})=\sum_{r=1}^{R} RSS_r(\hat{\bm{\beta}}_{\lambda})$ is the residual sum of squares from all the missing pattern groups with the $r$-th grou
\vspace{-3mm}
\begin{equation*}
\vspace{-3mm}
RSS_r(\hat{\bm{\beta}}_{\lambda})= \frac{1}{M_r} \sum_{j\in\mathcal{G}(r)} \sum_{i\in\mathcal{H}(r)}\left\{y_i-\mu_i^{(j)}(\hat{\bm{\beta}}_{\lambda})\right\}^2.
\end{equation*}
Here we tune $\lambda$ via the BIC-type criterion instead of $RSS(\hat{\bm{\beta}}_{\lambda})$ to reduce the complexity of model and avoid over-fitting. Compared with the traditional Bayesian information criterion (BIC) \citep{schwarz1978estimating}, the proposed MBI-BIC incorporates additional information from incomplete observations via the MBI.
We select the optimal tuning parameter $\lambda$ corresponding to the lowest MBI-BIC.
\vspace{-3mm}
\section{Theory} \label{SectionTheory}
In this section, we provide the theoretical foundation of the proposed method under regularity conditions. In particular, we establish estimation consistency, selection consistency, and asymptotic normality of the proposed estimator. We also show that the proposed MBI leads to more efficient estimation than a single imputation method. Throughout this section, we assume that sources of covariates for each subject are missing completely at random (MCAR) or missing at random (MAR). Let $\xi_i$ be the random group label for the $i$-th subject, that is, $\xi_i=r$ if and only if the subject $i$ is in Group $r$. The MCAR or MAR assumption implies that $\xi_i$ is independent of all covariates or only depends on observed covariates. In addition, we assume that $\xi_i$ for $1\le i \le N$ are independently and identically distributed.
\vspace{-3mm}
\subsection{Asymptotic properties for fixed $p$ and $q$}
In this subsection, we assume that $p$ and $q$ are both fixed as $N\to\infty$.
Let $\bm{G}(\bm{\beta})=(\bm{g}_1(\bm{\beta}), \dots, \linebreak \bm{g}_N(\bm{\beta}))^T$ be the estimating functions from $N$ samples, where $\bm{g}_i(\bm{\beta})=(\bm{g}_i^{(1)}(\bm{\beta})^T, \dots, \bm{g}_i^{(R)}(\bm{\beta})^T)^T$ is a column vector consisting of the $i$-th sample of all available estimating functions with $\bm{g}_i^{(r)}(\bm{\beta})=\bm{0}$ if $i\notin \mathcal{H}(r)$ for $1\le r\le R$.
We require the following regularity conditions:
\begin{condition}\label{C1}
For any $1\le r \le R$, $k\in \mathcal{G}(r)$, $l \in m(r)$, and $j \in a(k)$, there exists a sequence $\zeta_N$
such that $1/\zeta_N=O(1)$, $\zeta_N=o(\sqrt{N})$,
\begin{equation}\label{imputeCondition1}
\frac{1}{N}\sum\limits_{i=1}^N I(\xi_i=r) \hat{Z}_{ij}\left\{E(X_{il}|\bm{X}_{i J(r,k)})-\hat{E}(X_{l}|\bm{X}_{i J(r,k)})\right\}=O_p\left(\frac{\zeta_N}{\sqrt{N}}\right),
\end{equation}
\begin{equation}\label{imputeCondition2}
\frac{1}{\sqrt{N}}\sum\limits_{i =1}^N I(\xi_i=r) \bar{\varepsilon}_i \left\{E(X_{il}|\bm{X}_{iJ(r,k)})-\hat{E}(X_{l}|\bm{X}_{iJ(r,k)})\right\}=O_p\left(\frac{\zeta_N}{\sqrt{N}}\right),
\end{equation}
and
$$E(X_j^4)<\infty, E(X_l^4)<\infty, E(\varepsilon^4)<\infty, E\left\{\hat{E}(X_{l}|\bm{\mathcal{X}}_{J(r,k)})\right\}^4<\infty,$$
where $I(\cdot)$ is an indicator function, $\bm{X}_{i J(r,k)}$ is a vector consisting of samples $X_{iv}$ for all $v\in J(r,k)$, and $\hat{E}(X_{l}|\bm{X}_{i J(r,k)})$ is an estimator of $E(X_{l}|\bm{\mathcal{X}}_{J(r,k)}=\bm{X}_{i J(r,k)})$.
$\hat{Z}_{ij}=\hat{E}(\bm{X}_j|\bm{X}_{i J(r,k)})$ if $j\in m(r)$ and $\hat{Z}_{ij}=X_{ij}$ otherwise,
and $\bar{\varepsilon}_i = \varepsilon_i + \{\bm{X}_{im(r)}-E(\bm{X}_{m(r)}|\bm{X}_{i J(r,k)})\} \bm{\beta}_{m(r)}^0$.
\end{condition}
\begin{condition}\label{C2}
For any $1\le r \le R$, with a sufficiently large $n$,
\begin{equation*}
P(\text{Columns of}\ \bm{G}^{(r)}(\bm{\beta}^0)\ \text{are linearly dependent} \text{ when } \bm{\beta}^0_{m(r)}\neq\bm{0})=0,
\end{equation*}
where $\bm{G}^{(r)}(\bm{\beta})=(\bm{g}_1^{(r)}(\bm{\beta}),\dots,\bm{g}_N^{(r)}(\bm{\beta}))^T$ is a submatrix of $\bm{G}(\bm{\beta})$ with columns representing estimating functions of the $r$-th group.
\end{condition}
\begin{condition}\label{C4}
For each $1\le j \le q$, there exists $1\le r\le R$ such that $j\in a(r)\cap \{\cup_{k\in \mathcal{G}(r)} a(k)\}$.
\end{condition}
\begin{condition}\label{C5}
There exists a covariance matrix $\bm{V}_1$ such that
$\bm{G}^*_0(\bm{\beta}^0)^T\bm{1}/\sqrt{N}\overset{d}{\to}N(\bm{0}, \bm{V}_1)$, where $\bm{G}_0^*(\bm{\beta})=\bm{G(\bm{\beta})\{\bm{U}(\bm{\beta}^0)\}^T}$ is the sample matrix for transformed estimating functions which are linearly independent at $\bm{\beta}=\bm{\beta}^0$.
\end{condition}
Note that, equations (\ref{imputeCondition1}) and (\ref{imputeCondition2}) in Condition \ref{C1} are satisfied if the consistency of a coefficient estimator for $\bm{\mathcal{X}}_{J(r,m)}$ holds under a linear model in predicting $X_l$, which can be obtained through the least squares or GLM \citep{fahrmeir1985consistency} estimator under MCAR or MAR mechanisms.
Moreover, Condition \ref{C1} requires the existence of the fourth moments of covariates and the error term. Condition \ref{C2} holds when the block-wise imputations based on different missing pattern groups are distinct with probability $1$.
Condition \ref{C4} is satisfied when the block-wise missing data contain complete cases, while for data with no complete cases, it requires that each relevant covariate is observed from at least one group and utilized in the MBI to predict missing values.
Since $\bm{G}(\bm{\beta})$ incorporates predicted conditional expectations, Condition \ref{C5} requires asymptotic normality of coefficient estimators for predicting missing covariates, and thus can be satisfied when the least squares estimator is used under the linear regression model and the missing mechanism is either MCAR or MAR. When there are no missing values, Condition \ref{C5} automatically holds.
To simplify expression of the following theorem, we define some notations. Let $\bm{\beta}_{A_1}$ and $\bm{\beta}_{A_2}$ be vectors of $\beta_j$ for $j\in A_1$ or $j\in A_2$, respectively.
In addition, we let $\hat{\bm{V}}_2=\nabla_{A_1} (\bm{1}^T\bm{G}^*_0/N)(\bm{\beta}^0)$ be the first derivative of $\bm{1}^T\bm{G}^*_0/N$ with respect to $\bm{\beta}_{A_1}$, and $\bm{V}= (\bm{V}_2 \bm{V}_1^{-1} \bm{V}_2^T)^{-1}$, where
$\bm{V}_2$ is expectation of $\hat{\bm{V}}_2$.
\begin{thm}\label{T1}
Under Conditions \ref{C1}--\ref{C4}, if $\lambda_N \to 0$ and $\lambda_N\sqrt{N}/\zeta_N \to \infty$ as $N\to \infty$, then there exists a local minimizer $\hat{\bm{\beta}}$ of $f^*(\bm{\beta})$ such that the following properties hold:
(i) Estimation consistency: $\|\hat{\bm{\beta}}-\bm{\beta}^0\|_2=O_p(N^{-1/2}\zeta_N)$.
(ii) Sparsity recovery: $P(\hat{\bm{\beta}}_{A_2}=\bm{0})\to 1$ as $N\to \infty$.
(iii) Asymptotic normality: If Conditions \ref{C5} hold, then $ \sqrt{N} (\hat{\bm{\beta}}_{A_1}-\bm{\beta}^0_{A_1}) \overset{d}{\to} N(\bm{0}, \bm{V})$.
\end{thm}
Theorem \ref{T1} states that the proposed estimator is almost root-$n$ consistent and selects
the true model with probability approaching $1$. The convergence of the proposed estimator $\hat{\bm{\beta}}$ depends on the accuracy of predictions for the conditional expectations of missing covariates, since the proposed approach is based on imputation of the missing covariates. Thus, the $\zeta_N$ in (i) comes from the level of prediction accuracy assumed in Condition \ref{C1}. Note that if $\zeta_N$ is a constant, then the proposed estimator is root-$n$ consistent by Theorem \ref{T1}. In addition, the estimator of nonzero coefficients $\hat{\bm{\beta}}_{A_1}$ is asymptotically normal under Condition \ref{C5}. The empirical covariance matrix of $\hat{\bm{\beta}}_{A_1}$ is $\hat{\bm{V}}=(\hat{\bm{V}}_2 \hat{\bm{V}}_1^{-1} \hat{\bm{V}}_2^T)^{-1}$, where $\hat{\bm{V}}_1=\{\bm{G}^*_0(\bm{\beta}^0)\}^T\bm{G}^*_0(\bm{\beta}^0)/N$.
If only a single regression imputation based on complete observations is utilized, the sample estimating functions are $\bm{G}_{(1)}(\bm{\beta})=\bm{G}(\bm{\beta})\{\bm{U}_{(1)}\}^T$, where $\bm{U}_{(1)}$ selects estimating functions corresponding to the single imputation. Then, the empirical covariance matrix of the estimator induced by $\bm{G}_{(1)}(\bm{\beta})$ is $\hat{\bm{V}}^{(1)}$, where $\hat{\bm{V}}^{(1)}$, $\hat{\bm{V}}^{(1)}_1$, and $\hat{\bm{V}}^{(1)}_2$, are similarly defined as $\hat{\bm{V}}$, $\hat{\bm{V}}_1$, and $\hat{\bm{V}}_2$, respectively, except that $\bm{G}_0^*(\bm{\beta}^0)$ is replaced by $\bm{G}_{(1)}(\bm{\beta}^0)$.
In the following proposition, we show that utilizing the MBI improves the empirical efficiency of the parameter estimation with a smaller asymptotic variance
compared with a single imputation approach.
\begin{prop}\label{P1}
Under the conditions in Theorem \ref{T1}, $\hat{\bm{V}}^{(1)}-\hat{\bm{V}}$ is positive semi-definite.
\end{prop}
Proposition \ref{P1} indicates that the proposed estimator with MBI gains efficiency through incorporating additional information from incomplete case groups.
In the following, we will establish consistency of the proposed estimator for diverging $p$ and $q$.
\vspace{-3mm}
\subsection{Consistency for diverging $p$ and $q$}
In this subsection, we consider cases when $p$ and $q$ increase as $N$ increases, that is, $p=p_N$ and $q=q_N$. We assume that the number of sources does not diverge as $N$ goes to infinity.
Let
$\bm{H}(\bm{\beta}) = \left( \{\bm{1}^T \partial_1 \bm{G}(\bm{\beta})/N\}^T,\dots, \{\bm{1}^T \partial_p \bm{G}(\bm{\beta})/N\}^T\right)^T$, $\bm{H}_{A_1}(\bm{\beta})$ and $\bm{H}_{A_2}(\bm{\beta})$ be sub-matrices of $\bm{H}(\bm{\beta})$ consisting of rows
corresponding to covariates indexed by $A_1$ and $A_2$, respectively, where $\partial_j \bm{G}(\bm{\beta})$ denotes the first derivative of $\bm{G}(\bm{\beta})$ with respect to $\beta_j$ for $1\le j\le p$.
We also let $\widehat{\bm{W}}(\bm{\beta})=\{\bm{U}(\bm{\beta}^0)\}^T\{\bm{W}^*_0(\bm{\beta})\}^{-1} \bm{U}(\bm{\beta}^0)$ be an estimator of the weighting matrix for all estimating functions,
$\widetilde{\bm{W}}(\bm{\beta}) = \bm{H}_{A_1}(\bm{\beta}) \widehat{\bm{W}}(\bm{\beta})\{\bm{H}_{A_1}(\bm{\beta})\}^T$, and
$\mathcal{B}_0=\{\bm{\beta} : \|\bm{\beta}-\bm{\beta}^0\|_{\infty}\le N^{-\kappa_0}\zeta_N\}$ be a neighborhood of $\bm{\beta}_0$ for some constant $\kappa_0$, where $\bm{W}^*_0(\bm{\beta})= \bm{G}^*_0(\bm{\beta})^T \bm{G}^*_0(\bm{\beta})/N$ and $\zeta_N$ is a sequence such that $1/\zeta_N=O(1)$ and $\zeta_N=o(\log N)$. Denote the minimum signal by $\beta_{\min}=\underset{j\in A_1}{\min}|\beta^0_j|$, and the smallest eigenvalue of a matrix by $\lambda_{\min}(\cdot)$. For simplicity, we write w.p.a.$1$ as shorthand for ``with probability approaching one.''
Since the dimensions of $\bm{G}$ and $\bm{\beta}$ diverge as $N$ grows, we require the following regularity conditions.
\begin{condition}\label{C6}
For $\bm{\beta}\in\mathcal{B}_0$, and some
positive constants $\kappa_4$ and $\kappa_3 < \min\{\kappa'_1/2-\kappa_0/2, \kappa'_1/4-\kappa_2/4\}$,
$\underset{i,j\in A_1}{\max} \|\{\partial_i \bm{G}(\bm{\beta})\}^T \partial_j \bm{G}(\bm{\beta})/N\|_{\infty}=O_p(N^{\kappa_3})$,
$ \underset{1\le j\le p_N}{\max}
\|\{\partial_j \bm{G}(\bm{\beta})\}^T \bm{G}(\bm{\beta})/N\|_{\infty} = O_p(N^{\kappa_3})$,
$\| \widehat{\bm{W}}(\bm{\beta}) \|_{\infty}= O_p(N^{\kappa_3})$,
$\|\bm{H}(\bm{\beta})\|_{\infty}= O_p(N^{\kappa_3})$, $\lambda_{\min}(\widetilde{\bm{W}}(\bm{\beta}))> \kappa_4$ w.p.a.$1$,
where $\kappa'_1=\kappa_1-1/6$, $\kappa_1\in(1/6, 1/2]$ and $\kappa_0, \kappa_2\in(0,\kappa'_1]$ are constants
\end{condition}
Condition \ref{C6} controls the norms of matrices related to the estimating function matrix $\bm{G}$ for $\bm{\beta}$ in a neighborhood of true coefficients, which is similar to the conditions in \citep[Theorem B.1 and Theorem B.2]{fan2014endogeneity}.
In particular, the condition assumes a lower bound for eigenvalues of $\widetilde{\bm{W}}$ to ensure a strict local minimizer of the objective function $f^*(\bm{\beta})$.
Let $\bm{T}_N (\bm{\beta})=\nabla^2_{21}L_N(\bm{\beta}) \{\nabla^2_{11}L_N(\bm{\beta})\}^{-1}$, where $L_N(\bm{\beta})$ is the first term in (\ref{FinalObject}) with $\bm{U}=\bm{U}(\bm{\beta}^0)$. Here, $\nabla^2_{21}L_N(\bm{\beta})$ is a sub-matrix of the Hessian matrix of $L_N(\bm{\beta})$ with rows and columns indexed by $A_2$ and $A_1$, respectively, while $\nabla^2_{11}L_N(\bm{\beta})$ is defined similarly
with rows and columns both indexed by $A_1$.
\begin{condition}\label{penalty}
For some constant $\tau_1>\kappa_0+\kappa_2$, $p'_{\lambda_N}(\beta_{\min}/2)=O(N^{-\tau_1})$, $\lambda_N^{-1}=O(N^{\eta_2})$, and $\lambda_N^{-1} \|\bm{T}_N (\bm{\beta})\|_{\infty} \le \min \{\eta_1/p'_{\lambda_N}(\beta_{\min}/2), O_p(N^{\eta_2}) \}$, where $\eta_1\in (0,1)$ and $\eta_2\in (0,\kappa'_1-2\kappa_3)$ are constants.
\end{condition}
Condition \ref{penalty} is standard for the SCAD penalty \citep{fan2011nonconcave}, where $p'_{\lambda_N}(\beta_{\min}/2)=O(N^{-\tau_1})$ can be satisfied as long as $\beta_{\min}$ is large enough, since $p'_{\lambda_N}(\cdot)$ is decreasing. The requirement for $\bm{T}_N(\bm{\beta})$ is similar to the irrepresentable condition of the SCAD penalty under high-dimensionality \citep{fan2011nonconcave}, but is derived for the loss function based on estimating equations instead of the least squares loss.
Specifically, when there are no missing values and $L_N (\bm{\beta})$ is the least-square loss function, then $\nabla^2_{21}L_N(\bm{\beta})$ is the sample covariance matrix between the irrelevant and relevant covariates, $\nabla^2_{11}L_N(\bm{\beta})$ is the sample covariance matrix among relevant covariates, and thus the condition on $\bm{T}_N(\bm{\beta})$ is exactly the same as the irrepresentable condition.
\begin{condition}\label{C7}
There exists a constant $\tau_2> \kappa_1-1/6$
such that
for $\bm{\beta}\in\mathcal{B}_0$, $1\le r\le R$, $k\in \mathcal{G}(r)$,
\begin{equation}\label{ExpectationEstimator}
\sum_{j\in a(k)}\left|\frac{1}{N}\sum\limits_{i=1}^N I(\xi_i=r) \hat{Z}_{ij}\left\{E(\bm{X}_{im(r)}|\bm{X}_{i J(r,k)})-\hat{E}(\bm{X}_{m(r)}|\bm{X}_{i J(r,k)})\right\} \bm{\beta}_{m(r)} \right| = O_p\left(\frac{\zeta_N}{N^{\tau_2}}\right),
\end{equation}
\vspace{-15mm}
\begin{equation}\label{ExpectationEstimator2}
\sum_{l\in m(r)}\left|\frac{1}{N}\sum\limits_{i=1}^N I(\xi_i=r) \bar{\varepsilon}_i
\left\{E(X_{il}|\bm{X}_{i J(r,k)})-\hat{E}(\bm{X}_{l}|\bm{X}_{i J(r,k)})\right\}
\right| = O_p\left(\frac{\zeta_N}{N^{\tau_2}}\right),
\end{equation}
where
$\hat{Z}_{ij}=\hat{E}(\bm{X}_j|\bm{X}_{i J(r,k)})$ if $j\in m(r)$ and $\hat{Z}_{ij}=X_{ij}$ otherwise,
and $\bar{\varepsilon}_i = \varepsilon_i + \{\bm{X}_{im(r)}-E(\bm{X}_{m(r)}|\bm{X}_{i J(r,k)})\} \bm{\beta}_{m(r)}$. We also assume that $X_j$ and $E(X_l|\bm{X}_{J(r, k)})$ are sub-Gaussian distributed for $1\le j \le p$, $l\in m(r)$, $1\le r \le R$, and $k \in \mathcal{G}(r)$. In addition, $\max\limits_{1\le r \le R} |m(r)|=o(N^{1/6})$ and $\max\limits_{1\le r \le R} \|\bm{\beta}_{m(r)}\|_{\infty}=O(\zeta_N)$.
\end{condition}
Condition \ref{C7} is analogous to Condition \ref{C1}. Similar to equations (\ref{imputeCondition1}) and (\ref{imputeCondition2}), equations (\ref{ExpectationEstimator}) and (\ref{ExpectationEstimator2}) can be obtained through the Lasso \citep{zhang2008sparsity} or SCAD \citep{fan2011nonconcave} under linear regression models and the MCAR or MAR mechanisms in predicting missing covariates, assuming that the magnitude of true coefficients and the numbers of missing covariates across groups do not diverge too fast as $N\to \infty$. We also assume that the covariates in Condition \ref{C7} are sub-Gaussian, since we allow the dimension of covariates $p_N$ to increase exponentially in the following theorem.
\begin{thm}[Consistency under high-dimensionality]\label{HighConsistency}
Under Conditions \ref{C2} and \ref{C6}--\ref{C7}, if $\log p_N=O(N^{1-2\kappa_1})$, $q_N=O(N^{\kappa_2})$ and $\beta_{\min}> N^{-\kappa_0}\log N$,
then there exists a strict local minimizer $\hat{\bm{\beta}}$ of $f^*(\bm{\beta})$ in (\ref{FinalObject}) such that the following properties hold:
(i) Estimation consistency:
$\|\hat{\bm{\beta}}-\bm{\beta}^0\|_{\infty}=O_p(N^{-\kappa_0}\zeta_N)$.
(ii) Sparsity recovery: $P(\hat{\bm{\beta}}_{A_2}=\bm{0})\to 1$ as $N\to\infty$.
\end{thm}
Theorem \ref{HighConsistency} states that when the number of covariates grows exponentially, the proposed method still processes estimation consistency and recovers sparsity accurately under regularity conditions. That is, the proposed estimator selects the true model with probability tending to $1$. We provide the proofs of Theorems \ref{T1}--\ref{HighConsistency} and Proposition \ref{P1} in the supplementary material.
\vspace{-3mm}
\section{Simulation study}\label{SectionSim}
In this section, we provide simulation studies to compare the proposed method with existing model selection approaches for handling block-wise missing data, including complete case analysis with the SCAD penalty (CC-SCAD), the single imputation with SCAD penalty (SI-SCAD), the iSFS, the DISCOM, and the DISCOM with Huber's M-estimate (DISCOM-Huber). The simulation results show that the proposed method achieves higher model selection accuracy than other competing methods through fully utilizing information from incomplete samples. We simulate data from a linear model (\ref{Lmodel}) using $50$ replications, where $\bm{\varepsilon}\sim N(\bm{0}, \bm{I}_N)$ and each row of $\bm{X}$ is independent and identically distributed from a normal distribution with mean $\bm{0}$ and an exchangeable covariance matrix determined by a variance parameter $\sigma^2=1$ and a covariance parameter $\rho$.
We also carry out simulations with binary covariates or an unstructured correlation matrix. The simulation results for the unstructured correlation matrix are provided in the supplementary material.
The proposed method is implemented based on Algorithm 1. The imputation in SI-SCAD is estimated in a similar fashion but only based on the complete case group. The minimization problem in CC-SCAD and SI-SCAD is solved through the coordinate descent algorithm. We utilize the Matlab codes in
\resizebox{47ex}{1.4ex}{\href{https://github.com/coderxiang/MachLearnScripts}{\ttfamily https://github.com/coderxiang/MachLearnScripts}} to calculate the iSFS estimator. The implementation of DISCOM and DISCOM-Huber is provide by \citep{yu2019optimal}. In addition, we tune the parameter $\lambda$ for the CC-SCAD, SI-SCAD, and iSFS via BIC. Following \citep{yu2019optimal}, the $\lambda$ in DISCOM and DISCOM-Huber is tuned by a validation set which consists of $n_v$ random samples from the complete observations. For the methods with the SCAD penalty, we choose $a=3.7$ \citep{fan2001variable}.
We calculate the false negative rate (FNR) representing the proportion of unselected relevant covariates and the false positive rate (FPR) representing the proportion of selected irrelevant covariates as follows:
\vspace{-3mm}
\[
\frac{\sum_{j=1}^{p} I(\hat{\beta}_j = 0, \beta_j^0 \neq 0)}{\sum_{j=1}^{p} I(\beta_j^0 \neq 0)}\ \ \text{ and }\ \ \frac{\sum_{j=1}^{p} I(\hat{\beta}_j \neq 0, \beta_j^0 = 0)}{\sum_{j=1}^{p} I(\beta_j^0 = 0)}.
\vspace{-3mm}
\]
We say that a method has better model selection performance if the overall false negative plus false positive rate (FNR$+$FPR) is smaller. We compare all the methods under the following five settings where the relevant predictors in Source $k$ share the same signal strength $\beta_{sk}$ for $k=1,\dots, S$. In the first two settings, we assume missing at random and missing completely at random, respectively, while we assume informative missing in the third and fourth settings. In addition, we consider data with no complete observations in the last setting. Under each setting, we also provide the computational time (in seconds) of each method with a given tuning parameter.
\noindent\textbf{Setting $\bm{1}$:} Let $N=700$, $p=40$, $q=14$, $R=4$, $S=4$, $n_1=30$, $n_2=n_3=220$, $n_4=230$, $n_v=10$, $p_1=p_2=p_3=12$, $p_4=4$, $(\beta_{s1}, \beta_{s2}, \beta_{s3}, \beta_{s4}) = (5, 6, 7, 8)$, and $\rho=0.4 \text{ or } 0.7$. Each of the first three sources contains four relevant covariates, and the last source contains two relevant covariates.
Samples are sequentially randomly assigned into the complete case group with probabilities proportional to $\exp(-a_i)$ for $1\le i \le N$, where $a_i=10(X_{i37}+\dots+X_{i40})$ and $X_{i37},\dots,X_{i40}$ are the four covariates from Source $4$ for the $i$-th sample. Otherwise, they are uniformly assigned to the other three groups, where Sources $1$--$3$ have the same missing structure as the three sources in Groups $2$--$4$ in Figure \ref{missingpattern}, and Source $4$ covariates are all observed. This assignment ensures that samples with higher $a_i$ are less likely to be assigned to Group $1$ of the complete cases.
Since $a_i$ depends on Source $4$ covariates which are observed across all the missing patterns, samples in Setting $1$ are missing at random. The proposed method outperforms other competing methods for different correlations even with a high missing rate ($95.7\%$) as we are able to extract more information from incomplete samples. Table \ref{S1} shows that the overall FNR$+$FPR of the proposed method is the lowest among all methods. For example, when $\rho=0.7$, the FNR$+$FPR of the proposed method is $0.481$, which is only $66.5\%$, $56.7\%$, $62.5\%$, $63.5\%$, and $51.5\%$ of the FNR$+$FPR of CC-SCAD, SI-SCAD, DISCOM, DISCOM-Huber, and iSFS, respectively. Note that the FNR$+$FPR of iSFS is the same for different $\rho$ since the iSFS always selects Source $4$ covariates. This is possibly due to the larger weight of Source $4$ when applying the iSFS approach, as covariates of Source $4$ are observed in all samples.
Moreover, we provide the values of the two terms in MBI-BIC$_{\lambda}$ in equation (\ref{MBI-BIC}) for $20$ increasing values of $\lambda$ in Table 10
in the supplementary material.
Although the values of the RSS term are much higher than the values of the second term $df_{\lambda}\cdot \log (N)$, the changes of the RSS term across different $\lambda$'s are comparable to the changes of the second term, which indicates that the second term is able to determine the tuning of $\lambda$ and thus can prevent overfitting. We also illustrate this with Figure 3
in the supplementary material, where the red vertical line marks the smallest MBI-BIC$_{\lambda}$. Since the smallest MBI-BIC$_{\lambda}$ and the smallest first term do not correspond to the same value of $\lambda$, the second term is effective in preventing overfitting. Note that the first term $N\cdot\log\left\{RSS(\hat{\bm{\beta}}_{\lambda})/N\right\}$ in MBI-BIC$_{\lambda}$ is not strictly increasing as $\lambda$ increases. This is possibly due to that the first term in the proposed objective function (\ref{FinalObject}) is not strictly increasing of the RSS.
We investigate the performance of the proposed method under high-dimensional situations in the following Setting $2$.
\noindent\textbf{Setting $\bm{2}$:} Let $N=500$, $p=1000$, $q=20$, $R=4$, $S=3$, $n_1=180$, $n_2=120$, $n_3=n_4=100$, $n_v=50$, $p_1=75$, $p_2=100$, $p_3=825$, $(\beta_{s1}, \beta_{s2}, \beta_{s3}) = (6, 5, 4)$, and $\rho=0.5\ \text{or } 0.8$. Sources $1$, $2$, and $3$ contain $6$, $6$, and $8$ relevant covariates, respectively.
All the samples are uniformly assigned to the four groups, which have the same missing structure as Groups $1$--$4$ in Figure \ref{missingpattern}.
The proposed method is more powerful in variable selection than other methods under the high-dimensional situations, as its FNR$+$FPR is the smallest among all the methods, as indicated in Table \ref{S2}. In particular, the proposed method performs especially effectively when correlations among covariates are as strong as $0.8$, with FNR$+$FPR $=0.048$, much smaller than any FNR$+$FPR of other methods. This is possibly because the strong correlations improve imputations in MBI, which compensate the negative effect of highly correlated covariates on variable selection under high-dimensional settings [\citealp{zhao2006model}, \citealp{fan2011nonconcave}].
\noindent\textbf{Setting $\bm{3}$:} We consider the missing not at random. Let $N=250$, $p=60$, $q=15$, $R=4$, $S=3$, $n_1=n_2=45$, $n_3=n_4=80$, $n_v=10$, $p_1=p_2=p_3=20$, $(\beta_{s1}, \beta_{s2}, \beta_{s3}) = (2.5, 3, 3.5)$, and $\rho=0.4, 0.6, \text{or } 0.8$. Each source contains five relevant covariates. Here, missing group assignment of the samples is the same as in Setting $1$, except that there is no Source $4$ and $a_i=3(X_{i1}+\dots+X_{i5}+y_i)$, where $X_{i1},\dots,X_{i5}$ are the $i$-th sample of the five relevant covariates from Source $1$.
In Setting $3$, the probability of a missing sample depends on missing covariates and the response variable, which leads to informative missingness and biased imputation based on the complete group in SI-SCAD. In contrast, the proposed method, incorporating additional imputed values through aggregating different missing patterns, is able to reduce the selection bias caused by missingness. For example, when $\rho=0.6$, the FNR$+$FPR of the proposed method is $0.402$, less than those of other methods.
Note that the FNRs of DISCOM and DISCOM-Huber are small since these two methods tend to over-select variables, consequently producing large FPRs. On the other hand, the CC-SCAD tends to select fewer variables due to insufficient numbers of complete observations, which leads to small FPR and large FNR.
In the following Setting $4$, we consider binary covariates. We first simulate data from a multivariate normal distribution with correlation $\rho$ similarly as in previous settings, and then transform each covariate $X_j$ in Source $1$ to $\sign(X_j)$.
\noindent\textbf{Setting $\bm{4}$:} Let $N=700$, $p=60$, $q=15$, $R=4$, $S=3$, $n_1=45$, $n_2=n_3=265$, $n_4=125$, $n_v=20$, $p_1=p_2=p_3=20$, $(\beta_{s1}, \beta_{s2}, \beta_{s3}) = (7,8,10 )$, and $\rho=0.4 \text{ or } 0.7$. Sources $1$, $2$, and $3$ contain $2$, $6$, and $7$ relevant covariates, respectively. Missing group assignment of the samples is the same as that in Setting $3$, except that $a_i=10y_i$ for $1\le i \le N$.
In addition to FNR and FPR, we also calculate the mean-squared-error (MSE) of the estimators. Table \ref{S6} shows that the proposed method has the smallest FNR$+$FPR and MSE among all the methods under Setting $4$, indicating that the proposed method performs better than other competing methods in both variable selection and coefficient estimation under the situations with binary covariates. Note that although the CC-SCAD does not perform well in estimation due to informative missing, it is still able to select variables more accurately than all other methods except the proposed method, especially for relatively small $\rho$. Moreover, the DISCOM and DISCOM-Huber perform the worst in this setting, possibly because the DISCOM methods are based on covariances.
\noindent\textbf{Setting $\bm{5}$:} We follow similarly as in Setting $3$, except that there is no complete case group and $R=3$. Let $N=300$, $n_1=n_2=n_3=100$, $(\beta_{s1}, \beta_{s2}, \beta_{s3}) = (0.8, 1, 1.5)$, $\rho=0.5, 0.6, 0.7, \text{or } 0.8$. All the samples are uniformly assigned to the three missing groups.
\begin{table}\centering
\begin{tabular}{*{5}{c}|*{4}{c}}
\hline
&\multicolumn{4}{c|}{$\rho=0.4$} &\multicolumn{4}{c}{$\rho=0.7$} \\
\cline{2-9}
\raisebox{1.5ex}[0pt]{Method}
&FNR &FPR &\textbf{FNR+FPR} & Time &FNR &FPR &\textbf{FNR+FPR} & Time \\
\hline
\textbf{Proposed method} &0.128 & 0.408 & 0.536 &12.086 &0.116 & 0.365 & 0.481 &8.781 \\
CC-SCAD &0.493 & 0.131 & 0.624 &0.016 &0.621 & 0.103 & 0.723 &0.026 \\
SI-SCAD &0.357 & 0.427 & 0.784 &0.004 &0.385 & 0.464 & 0.849 &0.073 \\
DISCOM &0.000 & 0.859 & 0.859 &0.031 &0.000 & 0.770 & 0.770 &0.034 \\
DISCOM-Huber &0.000 & 0.854 & 0.854 &0.051 &0.000 & 0.758 & 0.758 &0.055 \\
iSFS &0.857 &0.077 &0.934 &0.426 &0.857 &0.077 &0.934 &0.614 \\
\hline
\end{tabular
\caption{FNR, FPR, and FNR$+$FPR under Setting $1$. ``Time'' represents the computational time (in seconds) of each method for one simulation with a given tuning parameter.}\label{S1}
\end{table}
\begin{table}[H]\centering
\resizebox{\textwidth}{!}{
\begin{tabular}{*{5}{c}|*{4}{c}}
\hline
&\multicolumn{4}{c|}{$\rho=0.5$} &\multicolumn{4}{c}{$\rho=0.8$} \\
\cline{2-9}
\raisebox{1.5ex}[0pt]{Method}
&FNR &FPR &\textbf{FNR+FPR} & Time &FNR &FPR &\textbf{FNR+FPR} & Time \\
\hline
\textbf{Proposed method} &0.033 &0.001 &0.034 & $9.033\times10^3$ &0.042 &0.006 &0.048 &$9.724\times10^3$ \\
CC-SCAD &0.187 &0.017 &0.204 &0.859 &0.655 &0.013 &0.668 & 2.012 \\
SI-SCAD &0.390 &0.008 &0.398 &0.488 &0.480 &0.038 &0.518 & 1.152 \\
DISCOM &0.006 &0.367 &0.373 &74.800 &0.023 &0.487 &0.510 &110.900 \\
DISCOM-Huber &0.033 &0.317 &0.350 &103.600 &0.117 &0.373 &0.491 &143.500 \\
iSFS &0.537 &0.074 &0.611 &16.350 &0.496 &0.096 &0.592 &19.674 \\
\hline
\end{tabular}}
\caption{FNR, FPR, and FNR$+$FPR under Setting $2$. ``Time'' represents the computational time (in seconds) of each method for one simulation with a given tuning parameter.}\label{S2}
\vspace{-3mm}
\end{table}
\begin{table}[H]\centering
\resizebox{\textwidth}{!}{
\begin{tabular}{*{5}{c}|*{4}{c}|*{4}{c}}
\hline
&\multicolumn{4}{c|}{$\rho=0.4$} &\multicolumn{4}{c|}{$\rho=0.6$} &\multicolumn{4}{c}{$\rho=0.8$}\\
\cline{2-13}
\raisebox{1.5ex}[0pt]{Method}
&FNR &FPR &\textbf{FNR+FPR} & Time &FNR &FPR &\textbf{FNR+FPR} & Time &FNR &FPR &\textbf{FNR+FPR} & Time\\
\hline
\textbf{Proposed} &0.096 &0.298 &0.394
&9.831 &0.105 &0.297 &0.402
&8.324 &0.123 &0.294 &0.417 &4.445\\
CC-SCAD &0.351 &0.090 &0.440
&0.023 &0.461 &0.082 &0.543
&0.053 &0.613 &0.070 &0.683 &0.182\\
SI-SCAD &0.492 &0.308 &0.800
&0.206 &0.455 &0.288 &0.743
&0.123 &0.492 &0.280 &0.772 &0.118\\
DISCOM &0.000 &0.541 &0.541
&0.043 &0.001 &0.541 &0.542
&0.041 &0.015 &0.465 &0.480 &0.052\\
DISCOM-H &0.009 &0.509 &0.518
&0.092 &0.069 &0.472 &0.541
&0.094 &0.196 &0.380 &0.576 &0.094\\
iSFS &0.425 &0.289 &0.714
&0.320 &0.440 &0.304 &0.744
&0.506 &0.479 &0.285 &0.764 &0.871 \\
\hline
\end{tabular}}
\caption{FNR, FPR, and FNR$+$FPR under Setting $3$. ``Proposed'' stands for the proposed method. ``DISCOM-H'' stands for the DISCOM-Huber method.}\label{S3}
\vspace{-3mm}
\end{table}
\begin{table}[H]\centering
\resizebox{\textwidth}{!}{
\begin{tabular}{*{6}{c}|*{5}{c}}
\hline
&\multicolumn{5}{c|}{$\rho=0.4$} &\multicolumn{5}{c}{$\rho=0.7$}\\
\cline{2-11}
\raisebox{1.5ex}[0pt]{Method}
&FNR &FPR &\textbf{FNR$+$FPR} &MSE & Time &FNR &FPR &\textbf{FNR$+$FPR} &MSE&Time\\
\hline
\textbf{Proposed method} &0.024 &0.160 &0.184 &1.570 &14.662 &0.052 &0.151 &0.203 &2.449 & 17.772 \\
CC-SCAD &0.368 &0.096 &0.464 &16.409
&0.033 &0.588 &0.056 &0.644 &33.813 & 0.037 \\
SI-SCAD &0.264 &0.454 &0.718 &15.291
&0.196 &0.319 &0.451 &0.770 &18.715 & 0.181\\
DISCOM &0.000 &0.726 &0.726 &2.560
&0.052 &0.000 &0.703 &0.703 &3.909 & 0.052 \\
DISCOM-Huber &0.000 &0.916 &0.916 &39.614
&0.115 &0.005 &0.872 &0.877 &47.117 & 0.087\\
iSFS &0.215 &0.331 &0.545 &9.758
&0.499 &0.184 &0.420 &0.604 &11.932 &0.650 \\
\hline
\end{tabular}
}
\caption{FNR, FPR, FNR$+$FPR, and MSE under Setting $4$.}\label{S6}
\end{table}
\begin{table}[H]\centering
\resizebox{\textwidth}{!}{
\begin{tabular}{*{3}{c}|*{2}{c}|*{2}{c}|*{2}{c}|*{2}{c}}
\hline
&\multicolumn{2}{c|}{FNR} &\multicolumn{2}{c|}{FPR} &\multicolumn{2}{c|}{\textbf{FNR+FPR}} &\multicolumn{2}{c|}{MSE}&\multicolumn{2}{c}{Time}\\
\cline{2-11}
\raisebox{1.5ex}[0pt]{$\rho$}
&\textbf{Proposed} &iSFS &\textbf{Proposed} &iSFS &\textbf{Proposed} &iSFS &\textbf{Proposed} &iSFS &\textbf{Proposed} &iSFS \\
\hline
0.5 &0.267 &0.395 &0.233 &0.380 &0.500 &0.774 &0.258 &0.255 &8.849 &0.154\\
0.6 &0.228 &0.405 &0.154 &0.380 &0.382 &0.785 &0.174 &0.262 &11.657 &0.180\\
0.7 &0.221 &0.428 &0.135 &0.377 &0.356 &0.805 &0.148 &0.296 &8.556 &0.200\\
0.8 &0.201 &0.435 &0.114 &0.370 &0.316 &0.804 &0.120 &0.326 &9.462 &0.302\\
\hline
\end{tabular}
}
\caption{FNR, FPR, FNR$+$FPR, and MSE under Setting $5$. ``Proposed'' stands for the proposed method.}\label{S4}
\vspace{-3mm}
\end{table}
The proposed method is capable of handling data with no complete observations. However, complete observations are required for CC-SCAD, SI-SCAD, DISCOM, and DISCOM-Huber. Thus, we only compare the proposed method with iSFS in this setting. The proposed method performs better than iSFS on both estimation and variable selection especially when the correlations among covariates are strong.
Table \ref{S4} shows that the FNR, FPR, and MSE of the proposed method are less than those of iSFS, respectively, in most situations.
Moreover, the FNR$+$FPR of the proposed method decreases as $\rho$ increases, indicating that incorporating correlation information among covariates plays an important role in imputation especially when there are no complete cases.
\begin{table}\centering
\resizebox{\textwidth}{!}{
\begin{tabular}{*{3}{c}|*{2}{c}|*{2}{c}|*{2}{c}}
\hline
&\multicolumn{2}{c|}{FNR} &\multicolumn{2}{c|}{FPR} &\multicolumn{2}{c|}{\textbf{FNR+FPR}} &\multicolumn{2}{c}{Time}\\
\cline{2-9}
\raisebox{1.5ex}[0pt]{$\rho$}
&Proposed &Proposed\_2 &Proposed &Proposed\_2 &Proposed &Proposed\_2 &Proposed &Proposed\_2 \\
\hline
0.4 & 0.030 & 0.031 & 0.272 & 0.270 & 0.301 & 0.301 & 17.115 & 13.836 \\
0.5 & 0.025 & 0.029 & 0.380 & 0.438 & 0.406 & 0.467 & 12.471 & 16.913\\
0.6 & 0.021 & 0.058 & 0.420 & 0.423 & 0.441 & 0.481 & 15.230 & 13.548\\
0.7 & 0.054 & 0.081 & 0.485 & 0.587 & 0.539 & 0.668 & 10.448 & 15.167\\
0.8 & 0.050 & 0.099 & 0.465 & 0.539 & 0.515 & 0.638 & 9.413 & 14.270\\
\hline
\end{tabular}
}
\caption{FNR, FPR, FNR$+$FPR, and MSE under Setting $6$. ``Proposed'' stands for the proposed method. ``Proposed\_2'' stands for the proposed method without using principle components for a non-singular $\bm{W}$\hspace{-0.5mm}.}\label{S_add}
\end{table}
In the following, we conduct additional simulations without using the principle components when $\bm{W}$ is non-singular. That is, we compare the estimators from solving equations (\ref{nonsingular}) and (\ref{FinalObject}), respectively.
\noindent\textbf{Setting $\bm{6}$:} We proceed similarly as in Setting $1$, except that $n_1=n_2=n_3=n_4=200$ and $(\beta_{s1}, \beta_{s2}, \beta_{s3}, \beta_{s4}) = (5, 6, 7, 8)$.
We summarize the results of Setting $\bm{6}$ in Table \ref{S_add}, where ``Proposed'' stands for the proposed method and ``Proposed\_2'' stands for the proposed method without using principle components for non-singular $\bm{W}$\hspace{-0.5mm}.
Note that these two approaches perform similarly in terms of FNR, FPR and FNR+FPR. In addition, the proposed method with principle components performs slightly better than that without the principle components for settings with a large correlation $\rho$. This is possibly due to the fact that $\bm{W}$ might be close to singular for a large $\rho$ even though it is non-singular.
\vspace{-3mm}
\section{Real data application}\label{Real}
In this section, we apply the proposed method to the Alzheimer's Disease Neuroimaging Initiative (ADNI) study \citep{mueller2005alzheimer} and compare it with existing approaches. A primary goal of this study is to identify biomarkers which can track the progression of Alzheimer's Disease (AD). Since the cognitive score from the Mini-Mental State Examination (MMSE) \citep{folstein1975mini} can measure cognitive impairment and is a diagnostic indicator of Alzheimer's disease \citep{tombaugh1992mini}, we treat the MMSE as the response variable, and intend to select biomarkers from three complementary data sources: MRI, PET, and gene expression.
Note that the sparsity assumption of the proposed method might not be suitable for raw imaging data or imaging data at small scales since images have to show some visible atrophy for AD. However, the sparsity assumption is still reasonable for region of interest (ROI) level data.
Thus, we apply the proposed method to the ROI level data in ADNI instead of the raw imaging data. For raw imaging data, the principal components analysis (PCA) related methods [\citealp{doi:10.1080/01621459.2016.1261710}, \citealp{guo2015spatially}, \citealp{shen2015spatially}] could be more applicable.
The MRI is segmented and analyzed in FreeSurfer by the Center for Imaging of Neurodegenerative Diseases at the University of California, San Francisco. Quantitative variables extracted from the MRI are volumes, average cortical thickness, standard deviation in cortical thickness, and surface areas of different ROIs.
Quantitative variables from the PET images are computed by the Jagust Lab at the University of California, Berkeley. The PET features represent standard uptake value ratios (SUVR) of different ROIs, where the SUVR is an indicator of metabolic activity of a specific region.
Gene expression variables are extracted form blood samples by Bristol-Myers Squibb laboratories, and represent expression levels at different gene probes.
The response variable MMSE may not be measured at the same day as the imaging data, as the examinations could be time-consuming. We utilize the ``visit code'' provided by the ADNI study to link the MMSE and image data, which ensures that the MMSE and imaging data are measured within the same month.
We mainly focus on the MMSE and quantitative variables from the MRI, PET, and gene expression in the second phase of the ADNI study (ADNI-2) at month $48$, where block-wise missingness emerges due to low-quality images, high cost of measurements, or patients' dropouts.
The aim of our real data analysis is to select biomarkers associated with the MMSE, which may be useful for the prediction of the MMSE or Alzheimer's disease in the future.
There are $267$ MRI features, $113$ PET features, and $49,386$ gene expression variables. To reduce the bias in MRI caused by differences of brain sizes,
we normalize the ROI volumes, surface areas and cortical thicknesses through dividing them by the whole brain volume, the total surface area, and the mean cortical thickness of each subject, respectively [\citealp{zhou2014significance}, \citealp{doi:10.1177/0962280217748675}].
We screen out $300$ features from the gene expression predictors through sure independence screening (SIS) \citep{fan2008sure}, and select subjects containing observations from at least two sources. For the SIS procedure, since there are missing values in the data, we calculate the marginal correlation between the MMSE response and each predictor using all available pairs of observations from them, and then select predictors with relatively higher marginal correlations according to the conventional SIS. In total, there are $680$ features and $212$ subjects in four groups with $69$ complete observations, that is, $p=680$, $N=212$, and $R=4$, where the four groups have the same missing pattern structure as Groups $1$--$4$ in Figure \ref{missingpattern}. As the missing rate of this dataset is about $68\%$, it is important to fully utilize incomplete observations, such as in the proposed method.
To compare the performance of the proposed method with existing methods, we randomly split the data into a test set and a training set $100$ times. Specifically, each test set consists of $43$ samples ($20$\% of all samples) randomly selected from the complete observations. The remaining $169$ samples ($80$\% of all samples) constitute the training set with $26$ complete observations, corresponding to a $85$\% missing rate of the training set.
For the DISCOM and DISCOM-Huber method, we generate a validation set consisting of $n_v=10$ random samples from the complete observations in the training set.
\begin{table}\centering
\resizebox{\textwidth}{!}{
\begin{tabular}{*{6}{c}|*{5}{c}}
\hline
&\multicolumn{5}{c|}{$85\%$ missing rate} &\multicolumn{5}{c}{$90\%$ missing rate}\\
\cline{2-11}
\raisebox{1.5ex}[0pt]{Method}
&NS &Mean &SD &\textbf{RI-RMSE}& Time&NS &Mean &SD &\textbf{RI-RMSE}& Time\\
\hline
\textbf{Proposed}
&41 &4.320 &0.577 &-- & $1.517\times10^3$ &39 &4.384 &0.403 &-- & $1.981\times10^3$\\
CC-SCAD &13 &5.472 &0.918 &21.1\% & 0.081 &9 &5.692 &1.038 &23.0\% & 0.040 \\
SI-SCAD &51 &5.548 &1.046 &22.1\% & 0.129 &50 &5.990 &0.896 &26.8\% & 0.117\\
DISCOM &392 &29.964 &4.123 &85.6\% & 7.587 &366 &29.824 &4.026 &85.3\% & 7.098\\
DISCOM-H &290 &29.978 &3.528 &85.6\% & 9.536 &258 &29.597 &3.393 &85.2\% & 9.012\\
iSFS &43 &18.058 &1.987 &76.1\% & 7.880 &44 &19.056 &2.113 &77.0\% & 6.220\\
\hline
\end{tabular}
}
\caption{The ``NS'' represents the mean number of selected variables. The ``Mean'' and ``SD'' represent mean and standard deviation of RMSE based on $100$ replications, respectively. The ``RI-RMSE'' for any method is the relative improvement of the proposed method over the competing method for the ADNI data. }\label{RD}
\vspace{-3mm}
\end{table}
We calculate the prediction root-mean-squared error (RMSE) $\sqrt{T^{-1}\sum_{i=1}^{T}(\hat{y}_i-y_i)^2}$ for each test set corresponding to each method, where $T$ is the number of observations in the test set, $y_i$ is the $i$-th true response value in the test set, and $\hat{y}_i$ is the corresponding fitted value using the model based on the training data. We also calculate the relative improvement (RI-RMSE) of the proposed method over other methods in terms of mean RMSE based on the $100$ replications. Specifically, the RI-RMSE of any given method is the ratio of the difference between the mean RMSE of the given method and the proposed method, to the mean RMSE of the given method. To investigate data with a higher missing rate, we also randomly partition all the samples into $25\%$ test and $75\%$ training sets with
$n_v=5$ for $100$ times, and calculate the corresponding RMSE and RI-RMSE in a similar fashion. With this partition, each training set contains $16$ complete observations corresponding to a $90$\% missing rate.
In general, the proposed method achieves higher variable selection and prediction accuracy than all other methods for the ADNI data due to incorporating correlation information from incomplete observations. Specifically, Table \ref{RD} shows that the mean RMSE of the proposed method is smaller than that of any other method under two missing rates, even though the proposed method selects fewer variables than most of the other methods, which implies that the proposed method selects variables more accurately. More precisely, the proposed method reduces the RMSE of any other method by more than $20\%$, according to the RI-RMSE. Moreover, the relative improvement is still substantial for the missing rate $90\%$, indicating that the proposed method is more effective than other methods even when the missing rate is quite high. In addition, the proposed method produces smaller standard deviation of the RMSE and thus is more stable than most other methods.
The CC-SCAD only selects $13$ or $9$ variables since there are only $26$ or $16$ complete observations for $80\%$ or $85\%$ training sets, respectively. The DISCOM and DISCOM-Huber select more variables than other methods,
which is consistent with the simulation findings in Section \ref{SectionSim}.
Table 9
in the supplementary material provides the first NS variables most frequently selected by each method based on the $100$ training sets with $85\%$ missing rate, where NS is the mean number of variables selected by the corresponding method.
The $41$ variables selected by the proposed method contain $29$, $2$, and $10$ biomarkers from the MRI, PET, and gene expression, respectively, most of which are also selected by other methods. In particular, the two PET biomarkers (``{\ttfamily RIGHT\_LATERAL\_VENTRICLE}'' and ``{\ttfamily RIGHT\_CHOROID\_PLEXUS}'') are also selected by the DISCOM, and DISCOM-Huber, which represent SUVRs of the right lateral ventricle and the right choroid plexus, respectively. Note that the lateral ventricle and choroid plexus are indeed related to the AD [\citealp{apostolova2012hippocampal},
\citealp{krzyzanowska2012pathological}].
In addition, the ``{\ttfamily ST29SV},'' ``{\ttfamily ST40TA},'' ``{\ttfamily ST60TS},'' and ``{\ttfamily 11723246\_s\_at}'' are not only selected by the proposed method, but also selected by the CC-SCAD, DISCOM, and DISCOM-Huber. The ``{\ttfamily ST29SV},'' ``{\ttfamily ST40TA},'' and ``{\ttfamily ST60TS}'' are MRI features and represent the volume of the left hippocampus, the average cortical thickness of the left middle temporal gyrus, and the standard deviation of cortical thickness of the left temporal pole, respectively, which are all associated with the presence of AD [\citealp{galton2001differing}, \citealp{apostolova2012hippocampal}, \citealp{convit2000atrophy}, \citealp{arnold1994neuropathologic}].
The ``{\ttfamily 11723246\_s\_at}'' from the gene expression source represents the secreted frizzled related protein 1 (SFRP1) gene, which is elevated in brains of individuals with AD [\citealp{esteve2019elevated}, \citealp{tang2020enhancing}].
Furthermore, the ``{\ttfamily ST43TA}'' and ``{\ttfamily ST119TS}'' from the MRI source are only selected by the proposed method, representing the average cortical thickness of the left paracentral lobule and the standard deviation of cortical thickness of the right temporal pole, respectively. Note that the left paracentral lobule and the right temporal pole are also associated with AD [\citealp{yang2019study}, \citealp{kumfor2016right}].
In summary, the proposed method produces smaller RMSE for prediction in test sets than other competing methods with fewer selected variables, indicating that our method achieves better performance in variable selection. Moreover, the biomarkers selected by the proposed method are indeed important and relevant to the response variable, which are also confirmed by medical studies.
\vspace{-3mm}
\section{Discussion}
In this paper, we propose the multiple block-wise imputation approach to solve the block-wise missing problem arising from multi-source data. The proposed method improves variable selection accuracy through incorporating more information about missing covariates from incomplete case groups.
The existing methods for missing data do not fully utilize the structure of block-wise missing data to impute missing values and select relevant covariates. In contrast, the proposed MBI estimates missing variables within a group based on other group information, including complete and incomplete subject groups as well,
where the complete subject group contains more observed variables, while incomplete groups incorporate more samples.
Moreover, when integrating all the block-wise imputations and missing patterns, the proposed method imposes more weight on estimating functions from groups with either fewer missing values or more accurate imputation.
We show that the proposed method outperforms existing competitive methods in numerical studies, even for informative missing. Specifically, the proposed method is more powerful in handling informative missing data since the MBI reduces selection bias through aggregating more samples across different missing pattern groups than a single regression imputation based on complete cases.
In addition, we establish the asymptotic normality, estimation and variable selection consistency for the proposed estimator. We also show that the proposed estimator is asymptotically more efficient than the estimator with a single imputation based on the complete case group.
Although the MBI creates multiple predictions for each missing value to account for uncertainty of imputation, the proposed method is quite different from multiple imputation [\citealp{rubin2004multiple}] which draws multiple imputed values from a distribution, and utilizes each completed dataset separately. It is possible that the proposed method can be combined with MI through drawing more imputed values from the conditional distribution of missing variables, instead of relying on conditional expectation. In general, the idea of the MBI is flexible and can also be utilized with other predictive models besides the GLM, e.g., machine learning techniques such as the classification and regression tree-based approach \citep{loh2016classification}. Moreover, we can allow the inverse probability weighting in the MBI to adjust for unequal sampling in the future
\vspace{-3mm}
\section*{Acknowledgments}
The authors thank the editor, the associate editor, and reviewers for providing thoughtful comments and suggestions. This work is supported by NSF grants DMS 1821198 and DMS 1613190.
{\setstretch{1.2} \footnotesize
\section{Introduction}\label{intro}
We encounter multi-source or multi-modality data frequently in many real data applications. For example, the Alzheimer's Disease Neuroimaging Initiative (ADNI) data involve multi-site longitudinal observational data from elderly individuals with normal cognition (NC), mild cognitive impairment (MCI), or Alzheimer's Disease (AD) [\citealp{mueller2005ways}, \citealp{mueller2005alzheimer}]. The ADNI data contain multi-source measurements: magnetic resonance imaging (MRI), florbetapir-fluorine-$18$ (AV-$45$) positron emission tomography (PET) imaging, fludeoxyglucose F $18$ (FDG) PET imaging, biosamples, gene expression, and demographic information. Such multi-source data are also common for electronic medical record (EMR) systems adopted by most health care and medical facilities nowadays, which contain diverse-source patient information, e.g., demographics, medication status, laboratory tests, medical imaging and text notes.
However, blocks of variable information could be completely missing as there might be no need or it might be infeasible to collect certain sources of information given other known variables. E.g., patients might be either too healthy or too ill. For EMR systems, it could be due to lack of information exchange or common practice between different medical facilities \citep{madden2016missing}.
Block missing variables cause a large fraction of subjects with certain sources missing, which could lead to biased parameter estimation and inconsistent feature selection.
Therefore, it is important to fully integrate data from all complementary sources to improve model prediction and variable selection.
The most common approach for handling missing data is to perform complete-case analysis which removes observations with missing values and only utilizes the complete cases. However, the complete-case method produces biased estimates when the missing is not completely at random. The inverse probability weighting method [\citealp{horvitz1952generalization}] is able to reduce this bias under missing at random mechanism via re-weighting the complete observations [\citealp{seaman2013review}, \citealp{sun2018inverse}]; nevertheless, incomplete observations are still not fully utilized. In real applications, such as the ADNI data, removing incomplete cases could incur a great loss of information since complete cases only account for a small fraction of the data. Alternatively, likelihood-based methods [\citealp{garcia2010variable}, \citealp{ibrahim1999missing}, \citealp{chen2014penalized}] can incorporate all observations. However, this relies on specifying a known distribution which might not be available, and could be computationally intractable if the number of missing variables is large.
Imputation [\citealp{wan2015variable}, \citealp{liu2016variable}] is another widely-used approach to handle missing data. For example, [\citealp{cai2016structured}] propose a structured matrix completion (SMC) method through singular value decomposition to recover a missing block under a low rank approximation assumption. However, the SMC imputes only one missing block at a time. [\citealp{gao2017high}] is capable of imputing all missing values through matrix completion and then apply the adaptive Lasso [\citealp{huang2008adaptive}, \citealp{zou2006adaptive}] to select variables. However, this approach does not guarantee estimation consistency. Alternatively, multiple imputation [\citealp{rubin2004multiple}] (MI) is applicable for conducting variable selection, e.g., [\citealp{chen2013variable}] propose a multiple imputation-least absolute shrinkage and selection operator (MI-LASSO), and adopt the group Lasso [\citealp{yuan2006model}] to detect nonzero covariates. Furthermore, [\citealp{wood2008should}] and [\citealp{wan2015variable}] select variables on combined multiple imputed data. In addition, MI can be combined with bootstrapping techniques [\citealp{heymans2007variable}, \citealp{liu2016variable}, \citealp{long2015variable}]. However, these imputation methods are not effective for block-wise missing data.
Recently, several methods have been developed to target block-wise missing data. E.g., [\citealp{yuan2012multi}] propose an incomplete multi-source feature learning (iMSF) method, which models different missing patterns separately and minimizes a combined loss function. In addition, [\citealp{xiang2014bi}] introduce an incomplete source-feature selection (iSFS) model, utilizing shared parameters across all missing patterns and imposing different weights on different data sources. However, the iSFS is unable to provide coefficient estimation for all samples due to the different weighting strategy. Alternatively, the direct sparse regression procedure using covariance from multi-modality data (DISCOM) [\citealp{yu2019optimal}] estimates the covariance matrices among predictors and between the response and predictors.
However, the DISCOM only considers missing completely at random, which could be restrictive for missing not completely at random data
The single regression imputation (SI) method [\citealp{baraldi2010introduction}, \citealp{zhang2016missing}, \citealp{10.1007/978-3-319-25751-8_1}, \citealp{fleet2016initial}, \citealp{saunders2006imputing}] is another popular approach which predicts missing values through regression using observed variables as predictors.
Suppose that the subjects from multi-source data are divided into groups according to their missing patterns.
For a group with a given missing block, the SI estimates association between missing variables and observed variables within the group based on complete observations. However, in practice, the complete observations might only account for a small fraction of the entire data.
To integrate information from the multi-source observed data we propose a Multiple Block-wise Imputation (MBI) approach, incorporating not only the SI based on complete observations but also imputations from incomplete observations. The additional imputations in MBI involve fewer observed variables within a given missing group, but are able to integrate more observations from multiple groups than the SI. Thus, the MBI can improve estimation and model selection especially when the missing rate is high. In addition, the proposed method aggregates more groups with different missing patterns to impute missing variables, which does not rely on the missing completely at random assumption, and is capable of handling missing at random data.
Furthermore, we propose a new multiple block-wise imputation model selection method. Specifically, we propose to construct estimating equations based on all possible missing patterns and imputations, and integrate them through the generalized methods of moments (GMM) [\citealp{hansen1982large}].
In theory, we show that the proposed method has estimation and model selection consistency under both fixed-dimensional and high-dimensional settings. Moreover, our estimator is asymptotically more efficient than the SI estimator. Numerical studies and the ADNI data application also confirm that the proposed method outperforms existing variable selection methods for block-wise missing data in missing completely at random, missing at random, and informative missing scenarios.
In general, our work has the following major advantages. First, we are able to integrate the multiple block-wise imputations of all missing pattern groups to improve estimation efficiency and model selection consistency. Second, the proposed method is capable of handling block-wise missing data which might not contain any complete observations, while most traditional methods, including the matrix completion [\citealp{cai2016structured}], require partial subjects to have fully completed observations.
The remainder of the paper is organized as follows. Section \ref{Section2} introduces the background and framework for the block-wise missing problem. In Section \ref{Section3}, we propose the MBI approach incorporating all missing patterns. In Section \ref{Algorithm}, the implementation and algorithm are illustrated.
In Section \ref{SectionTheory}, we establish the theoretical properties of the proposed method. Sections \ref{SectionSim} and \ref{Real} provide numerical studies through simulations and the ADNI data application.
\section{Background and Motivation}\label{Section2}
In this section, we introduce the framework for the block-wise missing problem.
Let $\bm{y} = (y_1, \dots, y_n)^T$ be the response variable, and $\bm{X}=(X_{ij})$ be the $N\times p$ design matrix. Suppose that all the samples are drawn independently from a random vector $\bm{\mathcal{X}}=(X_1, X_2, \dots, X_p)$, whose covariance matrix $\bm{C}=(c_{ij})$ is positive definite. Then, for any $1\le i \le N$ and $1\le j \le p$, $X_{ij}$ represents the $i$-the sample of the $j$-th covariate. Suppose that all the covariates in $\bm{X}$ are from $S$ sources.
Figure \ref{missingpattern} illustrates a setting with three sources.
We divide samples $\bm{X}$ into $R$ disjoint groups based on the missing patterns across all sources, where $\bm{x}_i$, the $i$-th row of $\bm{X}$, is in the $r$-th group if $ i \in \mathcal{H}(r)$, and $\mathcal{H}(r)$ is an index set of samples. For any $1\le r\le R$, let $a(r)$ and $m(r)$ be the index sets of the observed covariates and missing covariates corresponding to the $r$-th group, respectively, and obviously, $\bigcup\limits_{r=1}^{R}a(r)=\{1,\dots,p\}$.
Then, $\bm{\mathcal{X}}_{a(r)}$ and $\bm{\mathcal{X}}_{m(r)}$ represent observed variables and missing variables in the $r$-th group, respectively. In addition, let $\mathcal{G}(r)$ be the index set of the groups where missing variables $\bm{\mathcal{X}}_{m(r)}$ and variables in at least one of the other sources are observed. If there are no missing values in the $r$-th group, let $\mathcal{G}(r)=\{r\}$, a completely observed dataset. We assume that $\mathcal{G}(r)$ is nonempty containing $M_r=|\mathcal{G}(r)|$ elements for $1\le r\le R$. Note that this assumption does not imply that the data must contain complete observations, since $\mathcal{G}(r)$ could contain a group which is not a complete case group but contains observed values of variables $\bm{\mathcal{X}}_{m(r)}$ and of partial variables in $\bm{\mathcal{X}}_{a(r)}$.
For illustration, the design matrix on the left of Figure \ref{missingpattern} consists of $3$ sources which are partitioned into $5$ missing pattern groups, where each white area represents a missing block and the colored ones represent observed blocks in different groups. For example, $\mathcal{H}(2)$ refers to samples in Group $2$ and $\bm{\mathcal{X}}_{m(2)}$ refers to missing covariates in Group $2$. Since Groups $1$, $3$ and $4$ contain observed values of $\bm{\mathcal{X}}_{m(2)}$ and covariates in Source $2$ or $3$, $\mathcal{G}(2)=\{1,3,4\}$ and $M_2=3$. If we remove Group $1$ (the complete case group) and Group $5$,
the $\mathcal{G}(2)$ is still non-empty, which is also true for $\mathcal{G}(3)$ and $\mathcal{G}(4)$.
We consider the following linear model
\begin{equation}\label{Lmodel}
\bm{y}=\bm{X}\bm{\beta}^0 + \bm{\varepsilon},
\end{equation}
where $\bm{\beta}^0=(\beta_1^0, \dots, \beta_p^0)^T$ is the true coefficient vector corresponding to all covariates and $\bm{\varepsilon}\sim N(\bm{0}, \sigma_{\varepsilon}^2\bm{I}_N)$ represents an error term independent of $\bm{X}$.
We assume that the model is sparse; that is, most of the true coefficients are zero.
Let $A_1=\{j : \beta_j^0\ne0\}$ and $A_2=\{j : \beta_j^0=0\}$ be index sets corresponding to relevant and irrelevant covariates, respectively. We also let $q=|A_1|$ be the total number of relevant covariates. In the supplementary material, we provide a table of all notations for convenience.
\begin{figure}
\labellist
\hair 2pt
\small
\pinlabel {Source 1} at 27 352
\pinlabel {Source 2} at 90 352
\pinlabel {Source 3} at 170 352
\pinlabel {Group 1} at -35 315
\pinlabel {Group 2} at -35 267
\pinlabel {Group 3} at -35 215
\pinlabel {Group 4} at -35 158
\pinlabel {Group 5} at -35 107
\pinlabel
$\xleftarrow{\makebox[1.0cm]{}}\mathcal{X}_{a(2)}\xrightarrow{\makebox[0.45cm]{}}$ at 60 267
\pinlabel $\xleftarrow{\makebox[0.27cm]{}}\mathcal{X}_{m(2)}\xrightarrow{\makebox[0.3cm]{}}$ at 165 267
\pinlabel$\xleftarrow{\makebox[0.97cm]{}}\mathcal{X}_{J(2,1)}\xrightarrow{\makebox[0.05cm]{}}$ at 346 368
\pinlabel$\hat{\bm{X}}_{m(2)}^{(1)}$ at 447 368
\pinlabel $\mathcal{X}_{J(2,3)}$ at 313 253
\pinlabel$\hat{\bm{X}}_{m(2)}^{(3)}$ at 447 253
\pinlabel $\mathcal{X}_{J(2,4)}$ at 375 83
\pinlabel$\hat{\bm{X}}_{m(2)}^{(4)}$ at 447 83
\endlabellist
\centering
\includegraphics[scale=0.7]{block7}
\caption{Left: Missing patterns for block-wise missing data. Each white area represents a missing block, while the colored ones represent observed blocks from different missing patterns. Right: Multiple block-wise imputations for the missing block in Group $2$.}\label{missingpattern}
\end{figure}
The likelihood-based approaches [\citealp{garcia2010variable}] typically formulate likelihood based on completely observed variables. However, it is likely that no covariate is completely observed under the block-wise missing structure. Alternatively, [\citealp{yuan2012multi}] construct a model for each missing pattern separately and use observed variables within each missing pattern as predictors. For instance, for Group $2$ in Figure \ref{missingpattern}, the above method treats the covariates in Sources $1$ and $2$ as predictors and ignores information from Source $3$. However, Source $3$ covariates could be incorporated as well, since they are relevant to the response variable.
Traditional imputation methods [\citealp{zhang2016missing}, \citealp{10.1007/978-3-319-25751-8_1}, \citealp{fleet2016initial}] impute missing values in Group $2$ based on the associations between missing and observed variables obtained from complete observations in Group $1$, while
samples in Groups $3$ and $4$ are not utilized. However, Groups $3$ and $4$, also containing values from Source $3$, can provide additional information in imputing missing variables $\bm{\mathcal{X}}_{m(r)}$ through correlations with other covariates.
This is especially useful when completely observed subjects are scarce. In the following section, we propose a new imputation approach to fully utilize information not only from the group with complete cases but also from other groups.
\section{Method} \label{Section3}
\subsection{ Multiple Block-wise Imputation}\label{MBI}
In this subsection, we propose a multiple block-wise imputation approach which can utilize more observed information from incomplete case groups than traditional imputation methods.
Specifically, for a given Group $r$ with missing values of $\bm{\mathcal{X}}_{m(r)}$,
each of the $\mathcal{G}(r)$ groups contains observed values corresponding to missing $\bm{\mathcal{X}}_{m(r)}$, and also observed values corresponding to a subset of observed $\bm{\mathcal{X}}_{a(r)}$. Therefore, we can predict missing values in the $r$-th group with $M_r=|\mathcal{G}(r)|$ ways to borrow information from all the groups in $\mathcal{G}(r)$, instead of using a complete case group only.
More specifically, for each $k \in \mathcal{G}(r)$, let $J(r,k)=a(r)\cap a(k)$ be an index set of covariates which are observed in Groups $r$ and $k$. For each $j \in m(r)$, we estimate $E(X_j|\bm{\mathcal{X}}_{J(r,k)})$ utilizing all the groups containing observed values of both $X_j$ and $\bm{\mathcal{X}}_{J(r,k)}$, and then impute missing values for $X_j$ in the $r$-th group using association information in the conditional expectation. Let $\hat{\bm{X}}_{m(r)}^{(k)}$ represent the imputation for all missing values in Group $r$. The proposed multiple imputations approach is referred to as Multiple Block-wise Imputation (MBI). We illustrate the MBI with an example in Figure \ref{missingpattern}. For Group $2$,
covariates observed in both Group $2$ and a group in $\mathcal{G}(2)=\{1,3,4\}$ are indexed by $J(2,1)=B_1\cup B_2$, $J(2,3)=B_1$, and $J(2,4)=B_2$, respectively, where $B_k$ is an index set of covariates from Source $k$ for $k=1,2,3$.
The traditional imputation methods, such as the SI, only utilize observed values in Group $2$ and Group $1$ to impute the missing values in Group $2$, namely $\hat{\bm{X}}_{m(2)}^{(1)}$, as shown on the top right of Figure \ref{missingpattern}. In contrast, the proposed method can incorporate more information from Groups $3$ and $4$ in addition to Groups $1$ and $2$, and impute the missing values in Group $2$ using three different blocks of observed variables. Namely, we estimate $E(\bm{\mathcal{X}}_{B_3} | \bm{\mathcal{X}}_{B_1\cup B_2})$, $E(\bm{\mathcal{X}}_{B_3} | \bm{\mathcal{X}}_{B_1})$ and $E(\bm{\mathcal{X}}_{B_3} | \bm{\mathcal{X}}_{B_2})$ based on Group $1$, Groups $1$ and $3$, and Groups $1$ and $4$, respectively. We then impute the missing values via the above three estimated conditional expectations and the observed information in Group $2$.
Compared with the SI, the proposed MBI incorporates additional imputed values $\hat{\bm{X}}_{m(2)}^{(3)}$ and $\hat{\bm{X}}_{m(2)}^{(4)}$ via $E(\bm{\mathcal{X}}_{B_3} | \bm{\mathcal{X}}_{B_1})$ and $E(\bm{\mathcal{X}}_{B_3} | \bm{\mathcal{X}}_{B_2})$, where the estimation involves more observed samples than the SI approach.
In particular, when estimating conditional expectation for the imputations, we aggregate subjects from different missing pattern groups,
which can diminish the influence of specific missing patterns of covariates
\vspace{-3mm}
\subsection{Integration of MBI}
In this subsection, we propose to integrate information from all available sources and multiple block-wise imputations.
Specifically, we construct estimating functions for each group according to its missing pattern. For a given Group $r$ containing missing values and $k\in\mathcal{G}(r)$, since missing $\bm{\mathcal{X}}_{m(r)}$ are estimated through $E(\bm{\mathcal{X}}_{m(r)} | \bm{\mathcal{X}}_{J(r,k)})$ which is a projection onto $\bm{\mathcal{X}}_{J(r,k)}$,
the covariates $\bm{\mathcal{X}}_{J(r,k)}$ are uncorrelated with residuals of the projection $\bm{\mathcal{X}}_{m(r)} - E(\bm{\mathcal{X}}_{m(r)} | \bm{\mathcal{X}}_{J(r,k)})$.
Therefore, for each $j \in J(r,k)$,
\begin{eqnarray*}\label{CEequality1}
&&E\left[ X_{j} \left\{y-\bm{\mathcal{X}}_{a(r)}\bm{\beta}^0_{a(r)} - E(\bm{\mathcal{X}}_{m(r)} | \bm{\mathcal{X}}_{J(r,k)})\bm{\beta}^0_{m(r)}\right\}\right] \notag\\
&=&E\left(X_j \ \varepsilon\right)+E\left[ X_{j} \left\{\bm{\mathcal{X}}_{m(r)} - E(\bm{\mathcal{X}}_{m(r)} | \bm{\mathcal{X}}_{J(r,k)})\right\}\right]\bm{\beta}^0_{m(r)}=0,
\end{eqnarray*}
where
$\bm{\beta}^0_{a(r)}$ and $\bm{\beta}^0_{m(r)}$ denote the true coefficients of $\bm{\mathcal{X}}_{a(r)}$ and $\bm{\mathcal{X}}_{m(r)}$, respectively.
In addition, for any $j \in m(r)$, since $E(X_{j}|\bm{\mathcal{X}}_{J(r,k)})$ is a function of $\bm{\mathcal{X}}_{J(r,k)}$,
\begin{eqnarray*}\label{CEequality2}
&&E\left[ E(X_{j}|\bm{\mathcal{X}}_{J(r,k)}) \left\{y-\bm{\mathcal{X}}_{a(r)}\bm{\beta}^0_{a(r)} - E(\bm{\mathcal{X}}_{m(r)} | \bm{\mathcal{X}}_{J(r,k)})\bm{\beta}^0_{m(r)}\right\}\right] \notag\\
&=&E\left\{ E(X_{j}|\bm{\mathcal{X}}_{J(r,k)})\ \varepsilon\right\}+E\left[ E(X_{j}|\bm{\mathcal{X}}_{J(r,k)}) \left\{\bm{\mathcal{X}}_{m(r)} - E(\bm{\mathcal{X}}_{m(r)} | \bm{\mathcal{X}}_{J(r,k)})\right\}\right]\bm{\beta}^0_{m(r)}=0.
\end{eqnarray*}
Note that $J(r,k) \cup m(r)=\left\{a(r)\cap a(k)\right\} \cup m(r)=a(k)$ since $m(r)\subset a(k)$ for $k \in \mathcal{G}(r)$.
Thus, we construct estimating functions corresponding to observed covariates in the $k$-th group using imputed values $\hat{\bm{X}}_{m(r)}^{(k)}$.
In general, for each $ i \in \mathcal{H}(r)$, let $\bm{x}_i^{(k)}=(X_{i1}^{(k)}, \dots, X_{ip}^{(k)})$ be the $i$-th imputed sample based on Group $k$,
where $X_{ij}^{(k)} = X_{ij}$ if the $j$-th covariate is observed in the sample $\bm{x}_i$, otherwise $X_{ij}^{(k)}$ is an imputed value of $X_{ij}$ in $\hat{\bm{X}}_{m(r)}^{(k)}$.
The estimating functions for the imputed samples $\bm{x}_i^{(k)}$ in Group $r$ are
\begin{eqnarray*}
\bm{g}_i^{(r , k)} (\bm{\beta})=
\frac{\partial \mu_i^{(k)} (\bm{\beta})}{\partial \bm{\beta}_{a(k)}}
\left\{y_i-\mu_i^{(k)} (\bm{\beta})\right\} = \left\{\bm{z}_i^{(k)}\right\}^T \left\{y_i-\mu_i^{(k)} (\bm{\beta})\right\} \ \ \ \ \text{ for } i\in \mathcal{H}(r),
\end{eqnarray*}
where
$\bm{z}_i^{(k)}$ is a sub-vector of $\bm{x}_i^{(k)}$ consisting of $X_{ij}^{(k)}$ for $j\in a(k)$,
$\partial \mu_i^{(k)} /\partial \bm{\beta}_{a(k)}$ is the derivative of $\mu_i^{(k)} (\bm{\beta}) = \bm{x}_i^{(k)} \bm{\beta}$ with respect to $\bm{\beta}_{a(k)}$, and $\bm{\beta}_{a(k)}$ is the coefficient vector corresponding to $\bm{\mathcal{X}}_{a(k)}$.
To integrate information from all available missing patterns and imputations, we propose an aggregated vector of estimating functions:
\vspace{-3mm}
\begin{equation}\label{AllEF}
\vspace{-3mm}
\bm{g}(\bm{\beta})=(\{\bm{g}^{(1)} (\bm{\beta})\}^T,\dots, \{\bm{g}^{(R)} (\bm{\beta})\}^T)^T,
\end{equation}
where
\vspace{-3mm}
\begin{equation*}
\vspace{-3mm}
\bm{g}^{(r)}=\frac{1}{n_r}\sum_{i\in\mathcal{H}(r)}\bm{g}_i^{(r)} (\bm{\beta}),
\end{equation*}
$n_r$ is the number of samples from the $r$-th group, and $\bm{g}_i^{(r)} (\bm{\beta})$ is a vector consisting of $\bm{g}_i^{(r, k)} (\bm{\beta})$ for $k\in\mathcal{G}(r)$.
If the $r$-th group only has complete observations, then $\mathcal{G}(r)=\{r\}$, $M_r=1$ and
\vspace{-3mm}
\begin{equation*}
\vspace{-3mm}
\bm{g}_i^{(r)}(\bm{\beta})=\bm{g}_i^{(r, r)}(\bm{\beta})= \bm{x}_{i}^T \left\{y_i-\bm{x}_i\bm{\beta}
\right\} \ \ \ \ \ \ \ \ \ \text{ for } i\in \mathcal{H}(r).
\end{equation*}
Note that the total number of equations exceeds the number of coefficient parameters, and estimating functions from groups with fewer missing variables or more accurate imputations tend to have smaller variance.
To combine all the estimating functions in $\bm{g}(\bm{\beta})$,
we estimate coefficients $\bm{\beta}$ through the penalized generalized method of moments \citep{caner2009lasso} which minimizes
\vspace{-3mm}
\begin{equation}\label{nonsingular}
\vspace{-3mm}
f(\bm{\beta})=\{\bm{g}(\bm{\beta})\}^T\bm{W}(\bm{\beta})^{-1}\bm{g}(\bm{\beta})+\sum\limits_{j=1}^{p} p_{\lambda}(|\beta_j|),
\end{equation}
where
\vspace{-3mm}
\begin{equation*}
\vspace{-3mm}
\bm{W}(\bm{\beta})=diag\left\{\frac{1}{n_1}\sum_{i\in\mathcal{H}(1)}\bm{g}_i^{(1)}(\bm{\beta})\{\bm{g}_i^{(1)}(\bm{\beta})\}^T, \dots, \frac{1}{n_R}\sum_{i\in\mathcal{H}(R)}\bm{g}_i^{(R)}(\bm{\beta})\{\bm{g}_i^{(R)}(\bm{\beta})\}^T \right\}
\end{equation*}
is the sample covariance matrix of $\bm{g}(\bm{\beta})$, and $p_{\lambda}(\cdot)$
is a penalty function with tuning parameter $\lambda$.
In this paper, we choose the SCAD penalty due to its oracle properties \citep{fan2001variable}. The sample covariance matrix $\bm{W}(\bm{\beta})$ is a block diagonal matrix since estimating functions are formulated based on different missing patterns.
However, $\bm{W}(\bm{\beta})$ could be singular or close to singular due to overlapping information in imputations, or due to a large number of estimating functions compared to a relatively small sample size. For example, as illustrated in Figure \ref{missingpattern}, the observed values of Source $1$ covariates in Group $2$ are utilized in the estimation of both $\hat{\bm{X}}_{m(2)}^{(1)}$ and $\hat{\bm{X}}_{m(2)}^{(3)}$.
\vspace{-3mm}
\subsection{Solving the singularity issue of estimating equations}
To solve the singularity issue of estimating equations, we reduce the dimension of $\bm{g}^{(r)}$ for $r=1,\dots,R$,
through combining informative estimating equations, e.g., utilizing the first several largest principle components (PCs) [\citealp{wold1987principal}, \citealp{cho2015efficient}]. Specifically, we divide the estimating functions in $\bm{g}^{(r)}$ into two parts $\bm{g}_{(1)}^{(r)}$ and $\bm{g}_{(2)}^{(r)}$, where $\bm{g}_{(1)}^{(r)}$ consists of the functions with the imputation based on complete observations, and $\bm{g}_{(2)}^{(r)}$ contains the remaining estimating functions in $\bm{g}^{(r)}$. We proceed to extract informative principle components from $\bm{g}_{(1)}^{(r)}$ and $\bm{g}_{(2)}^{(r)}$ separately.
Let Group $1$ be the complete case group, and $\bm{W}_{11}^{(r)}$ and $\bm{W}_{22}^{(r)}$ be the sample covariance matrices of $\bm{g}_{(1)}^{(r)}$ and $\bm{g}_{(2)}^{(r)}$, respectively. If the dimension of $\bm{g}_{(1)}^{(r)}$ is too large such that $\bm{W}_{11}^{(r)}$ is singular or close to singular, we extract the first $t_1$ principle components $\bm{h}^{(r)}=\bm{U}_1^{(r)}\bm{g}_{(1)}^{(r)}$ from $\bm{g}_{(1)}^{(r)}$, where $\bm{U}_1^{(r)}$ contains $t_1$ eigenvectors of $\bm{W}_{11}^{(r)}$ corresponding to the largest $t_1$ nonzero eigenvalues, and $t_1$ can be selected to retain sufficient information. If $\bm{W}_{11}^{(r)}$ is neither singular nor close to singular, we retain all the estimating functions in $\bm{g}_{(1)}^{(r)}$, and let $\bm{U}_1^{(r)}$ be an identity matrix, that is, $\bm{h}^{(r)}=\bm{g}_{(1)}^{(r)}$.
We orthogonalize $\bm{g}_{(2)}^{(r)}$ against the $\bm{h}^{(r)}$ to store additional information beyond $\bm{h}^{(r)}$, where $\bar{\bm{g}}_{(2)}^{(r)}=\bm{g}_{(2)}^{(r)}-\bm{V}_{21}^{(r)}\{\bm{V}_{11}^{(r)}\}^{-1}\bm{h}^{(r)}$ consists of orthogonalized estimating functions, $\bm{V}_{11}^{(r)}=\bm{U}_1^{(r)} \bm{W}_{11}^{(r)} \{\bm{U}_1^{(r)}\}^T$,
and $\bm{V}_{21}^{(r)}$ is the sample covariance matrix between $\bm{g}_{(2)}^{(r)}$ and $\bm{h}^{(r)}$. Similarly, if the sample covariance of $\bar{\bm{g}}_{(2)}^{(r)}$ is singular or close to singular, we select the first $t_2$ principle components $\bm{U}_2^{(r)}\bar{\bm{g}}_{(2)}^{(r)}$ from the orthogonalized $\bar{\bm{g}}_{(2)}^{(r)}$, where $\bm{U}_2^{(r)}$ contains $t_2$ eigenvectors of the sample covariance matrix of $\bar{\bm{g}}_{(2)}^{(r)}$ corresponding to the largest $t_2$ nonzero eigenvalues.
Otherwise, we retain all the $\bar{\bm{g}}_{(2)}^{(r)}$, and let $\bm{U}_2^{(r)}$ be an identity matrix.
Let
\begin{equation*}
\bm{U}^{(r)}= \begin{pmatrix}\bm{U}_1^{(r)}&\bm{0}\\-\bm{U}_2^{(r)}\bm{V}_{21}^{(r)}\{\bm{V}_{11}^{(r)}\}^{-1}\bm{U}_1^{(r)}\ & \bm{U}_2^{(r)}\end{pmatrix}.
\end{equation*}
If there is no complete case group or $M_r=1$, then either $\bm{g}_{(1)}^{(r)}$ or $\bm{g}_{(2)}^{(r)}$ is null, and $\bm{U}^{(r)}$ is either $\bm{U}_2^{(r)}$ or $\bm{U}_1^{(r)}$.
Thus, $\bm{U}^{(r)}\bm{g}^{(r)}$ contains all the essential information from the estimating functions of the $r$-th group, while solving the singularity issue of the sample covariance matrix. The numbers of principle components $t_1$ and $t_2$ can be tuned through the Bayesian information type of criterion proposed by \citep{cho2015efficient} to capture sufficient information from the estimating functions in (\ref{AllEF}). Consequently, the proposed estimator $\hat{\bm{\beta}}$ is obtained via minimizing
\vspace{-3mm}
\begin{equation}\label{FinalObject}
\vspace{-3mm}
f^*(\bm{\beta})=(\bm{Ug})^T(\bm{UW}\bm{U}^T)^{-1}\bm{Ug}+\sum\limits_{j=1}^{p} p_{\lambda}(|\beta_j|),
\end{equation}
where $\bm{U}=diag\{\bm{U}^{(1)}, \dots, \bm{U}^{(R)}\}$. In the following section, we also provide an algorithm and implementation strategy of the proposed method.
\vspace{-3mm}
\section{Implementation}\label{Algorithm}
In this section, we provide the detailed algorithm for the proposed method.
The conditional expectations of missing covariates in MBI can be estimated via linear regression models, generalized linear models (GLM) or non-parametric models.
In this paper, we utilize the GLM \citep{10.2307/2344614} to accommodate not only continuous covariates but also discrete covariates.
Specifically, for each group $1\le r\le R$, $j\in m(r)$, and $k\in\mathcal{G}(r)$, we adopt the GLM to predict $E(X_j|\bm{\mathcal{X}}_{J(r,k)})$ if groups containing observed values of both $X_j$ and $\bm{\mathcal{X}}_{J(r,k)}$ have a larger sample size than the number of observed variables $|J(r,k)|$, or adopt the $L_1$-regularized GLM \citep{friedman2010regularization} otherwise.
To obtain the $L_1$-regularized GLM estimator, we apply the ``glmnet'' package (\resizebox{31ex}{1.4ex}{\href{https://cran.r-project.org/web/packages/glmnet/index.html}{\ttfamily https://cran.r-project.org/web}} \resizebox{28ex}{1.4ex}{\href{https://cran.r-project.org/web/packages/glmnet/index.html}{\ttfamily packages/glmnet/index.html}}) in R. The imputed values in MBI are then computed based on the estimated conditional expectation.
To consistently handle singular or non-singular $\bm{W}$\hspace{-0.5mm}, we use $f^*(\bm{\beta})$ in (\ref{FinalObject}) instead of $f(\bm{\beta})$ in (\ref{nonsingular}) as our objective function for all $\bm{W}$\hspace{-0.5mm}. For the sample covariance matrix $\bm{W}^{(r)}$ of $\bm{g}^{(r)}$ from Group $r$, we select the numbers of principle components $t_1$ and $t_2$ corresponding to $\bm{\Omega}$, which is $\bm{W}^{(r)}_{11}$ or $\bm{W}^{(r)}_{22}-\bm{V}^{(r)}_{21}\{\bm{V}^{(r)}_{11}\}^{-1}\{\bm{V}^{(r)}_{21}\}^T$, through minimizing the BIC-type of criterion \citep{cho2015efficient}
\begin{equation}\label{PC}
\Psi(t) = \frac{\text{tr}\{\bm{\Omega}-\widetilde{\bm{\Omega}}(t)\}}{\text{tr}\{\bm{\Omega}\}} + t\frac{\log (n_r d)}{n_r d},
\end{equation}
where
$d$ is the dimension of $\bm{\Omega}$. Here, the
$\widetilde{\bm{\Omega}}(t)=\sum_{j=1}^{t}\lambda_j\bm{v}_j\bm{v}_j^T$ is an approximation of $\bm{\Omega}$ based on the $t$ largest eigenvectors, where $\lambda_j$ is the $j$-th largest eigenvalue of $\bm{\Omega}$, and $\bm{v}_j$ is the eigenvector of $\bm{\Omega}$ corresponding to $\lambda_j$. Since
$\text{tr}\{\bm{\Omega}-\widetilde{\bm{\Omega}}(t)\}=\sum_{j=t+1}^{d}\lambda_j$, the minimizer of $\Psi(t)$ is indeed the number of eigenvalues which are larger than $\text{tr}\{\bm{\Omega}\} \log (n_r d)/(n_r d)$.
\begin{figure}
\labellist
\pinlabel
$f^*(\bm{\beta})$ at 5 450
\pinlabel $\beta_{2}$ at 170 85
\pinlabel $\beta_{1}$ at 630 75
\endlabellist
\centering
\includegraphics[scale=0.5]{plot_function2}
\caption{The objective function $f^*(\bm{\beta})$.}\label{objective}
\end{figure}
\begin{table}[htbp]\centering
\begin{tabular}{c}
\hline
\textbf{Algorithm 1} \\
\hline
\parbox{14.5cm}{
\begin{enumerate}
\item Obtain initial values $\bm{\beta}^{(0)}$ based on complete observations. Set tolerance $\epsilon$, and the tuning parameters $\lambda$ and $a$.
\item Estimate $\hat{\bm{X}}^{(j)}_{m(r)}$ via the GLM or $L_1$-regularized GLM depending on the sample size for each $r=1, \dots, R$ and $j\in\mathcal{G}(r)$.
\item At the $k$-th iteration, given $\bm{\beta}^{(k-1)}$ and $\bm{s}_{k-1}$ from the ($k-1$)-th iteration:
\begin{enumerate}
\item Select the number of principle components using (\ref{PC}) if $\bm{W}^{(r)}$ is singular for $r=1,\dots, R$.
\item Calculate the conjugate direction $\bm{s}_k$ using (\ref{direction}).
\item Calculate the step size $\alpha_k$ using (\ref{step}).
\item Update $\bm{\beta}^{(k)}=\bm{\beta}^{(k-1)}+\alpha_k \bm{s}_k$.
\end{enumerate}
\item Iterate Step 3 until the convergence criterion is satisfied, e.g., $\underset{1\le j \le p}{\max}\{|\beta_j^{(k)}-\beta_j^{(k-1)}|\}<\epsilon$.
\end{enumerate}}\\
\hline
\end{tabular}
\end{table}
We plot an example of the objective function $f^*(\bm{\beta})$ in Figure \ref{objective} to illustrate the objective function $f^*(\bm{\beta})$ near true coefficients. In this example, there are three sources and four groups with $p_1=p_2=p_3=20$ and $n_1=n_2=n_3=n_4=1000$, where each source contains one relevant predictor with a signal strength of $1$ and the missing patterns are the same as in Groups $1$--$4$ in Figure \ref{missingpattern}. The true coefficients of $\beta_1$ and $\beta_{2}$ are $1$ and $0$, respectively. Figure \ref{objective} shows that $f^*(\bm{\beta})$ has a unique minimizer around the true coefficients.
To obtain the minimizer, we propose to iteratively decrease $f^*(\bm{\beta})$ via the nonlinear conjugate gradient algorithm \citep{dai1999nonlinear} which converges quadratically \citep{cohen1972rate} without requiring the second derivative of the objective function. At the $k$-th iteration, the conjugate direction is
\vspace{-3mm}
\begin{equation}\label{direction}
\vspace{-3mm}
\bm{s}_k=-\nabla f^*(\bm{\beta}^{(k-1)})+\gamma_{k-1}\bm{s}_{k-1},
\end{equation}
where $\nabla f^*(\bm{\beta}^{(k-1)})$
is the gradient of $f^*(\bm{\beta})$ at $\bm{\beta}=\bm{\beta}^{(k-1)}$,
\begin{equation*}
\gamma_{k-1}= - \frac{\left\{\nabla f^*(\bm{\beta}^{(k-1)})\right\}^T\nabla f^*(\bm{\beta}^{(k-1)})}{\bm{s}_{k-1}^T \left\{\nabla f^*(\bm{\beta}^{(k-2)})-\nabla f^*(\bm{\beta}^{(k-1)})\right\}},
\end{equation*}
and $\bm{s}_1=-\nabla f^*(\bm{\beta}^{(0)})$. Here, the initial values $\bm{\beta}^{(0)}$ are obtained by performing the Lasso method \citep{tibshirani1996regression} on complete observations, and the gradient is numerically calculated via central differences.
We determine the step size in the conjugate direction $\bm{s}_k$ through a line search:
\vspace{-3mm}
\begin{equation}\label{step}
\vspace{-3mm}
\alpha_k=\underset{\alpha}{\text{argmin}} f^*(\bm{\beta}^{(k-1)}+\alpha \bm{s}_k).
\end{equation}
We summarize the whole procedure for the implementation of the proposed method in Algorithm 1. Note that estimation of MBI is carried out in Step 2, and the nonlinear conjugate gradient method is performed in Step 3.
To select the tuning parameter $\lambda$ in the penalty function $p_{\lambda} (\cdot)$, we propose a BIC-type criterion (MBI-BIC) as follows:
\vspace{-3mm}
\begin{equation}\label{MBI-BIC}
\vspace{-3mm}
\text{MBI-BIC}_{\lambda}=N\cdot\log\left\{RSS(\hat{\bm{\beta}}_{\lambda})/N\right\}+df_{\lambda}\cdot\log (N),
\end{equation}
where $\hat{\bm{\beta}}_{\lambda}$ is the proposed estimator for a given $\lambda$, $df_{\lambda}$ is the number of non-zero estimated coefficients in $\hat{\bm{\beta}}_{\lambda}$, and $RSS(\hat{\bm{\beta}}_{\lambda})=\sum_{r=1}^{R} RSS_r(\hat{\bm{\beta}}_{\lambda})$ is the residual sum of squares from all the missing pattern groups with the $r$-th grou
\vspace{-3mm}
\begin{equation*}
\vspace{-3mm}
RSS_r(\hat{\bm{\beta}}_{\lambda})= \frac{1}{M_r} \sum_{j\in\mathcal{G}(r)} \sum_{i\in\mathcal{H}(r)}\left\{y_i-\mu_i^{(j)}(\hat{\bm{\beta}}_{\lambda})\right\}^2.
\end{equation*}
Here we tune $\lambda$ via the BIC-type criterion instead of $RSS(\hat{\bm{\beta}}_{\lambda})$ to reduce the complexity of model and avoid over-fitting. Compared with the traditional Bayesian information criterion (BIC) \citep{schwarz1978estimating}, the proposed MBI-BIC incorporates additional information from incomplete observations via the MBI.
We select the optimal tuning parameter $\lambda$ corresponding to the lowest MBI-BIC.
\vspace{-3mm}
\section{Theory} \label{SectionTheory}
In this section, we provide the theoretical foundation of the proposed method under regularity conditions. In particular, we establish estimation consistency, selection consistency, and asymptotic normality of the proposed estimator. We also show that the proposed MBI leads to more efficient estimation than a single imputation method. Throughout this section, we assume that sources of covariates for each subject are missing completely at random (MCAR) or missing at random (MAR). Let $\xi_i$ be the random group label for the $i$-th subject, that is, $\xi_i=r$ if and only if the subject $i$ is in Group $r$. The MCAR or MAR assumption implies that $\xi_i$ is independent of all covariates or only depends on observed covariates. In addition, we assume that $\xi_i$ for $1\le i \le N$ are independently and identically distributed.
\vspace{-3mm}
\subsection{Asymptotic properties for fixed $p$ and $q$}
In this subsection, we assume that $p$ and $q$ are both fixed as $N\to\infty$.
Let $\bm{G}(\bm{\beta})=(\bm{g}_1(\bm{\beta}), \dots, \linebreak \bm{g}_N(\bm{\beta}))^T$ be the estimating functions from $N$ samples, where $\bm{g}_i(\bm{\beta})=(\bm{g}_i^{(1)}(\bm{\beta})^T, \dots, \bm{g}_i^{(R)}(\bm{\beta})^T)^T$ is a column vector consisting of the $i$-th sample of all available estimating functions with $\bm{g}_i^{(r)}(\bm{\beta})=\bm{0}$ if $i\notin \mathcal{H}(r)$ for $1\le r\le R$.
We require the following regularity conditions:
\begin{condition}\label{C1}
For any $1\le r \le R$, $k\in \mathcal{G}(r)$, $l \in m(r)$, and $j \in a(k)$, there exists a sequence $\zeta_N$
such that $1/\zeta_N=O(1)$, $\zeta_N=o(\sqrt{N})$,
\begin{equation}\label{imputeCondition1}
\frac{1}{N}\sum\limits_{i=1}^N I(\xi_i=r) \hat{Z}_{ij}\left\{E(X_{il}|\bm{X}_{i J(r,k)})-\hat{E}(X_{l}|\bm{X}_{i J(r,k)})\right\}=O_p\left(\frac{\zeta_N}{\sqrt{N}}\right),
\end{equation}
\begin{equation}\label{imputeCondition2}
\frac{1}{\sqrt{N}}\sum\limits_{i =1}^N I(\xi_i=r) \bar{\varepsilon}_i \left\{E(X_{il}|\bm{X}_{iJ(r,k)})-\hat{E}(X_{l}|\bm{X}_{iJ(r,k)})\right\}=O_p\left(\frac{\zeta_N}{\sqrt{N}}\right),
\end{equation}
and
$$E(X_j^4)<\infty, E(X_l^4)<\infty, E(\varepsilon^4)<\infty, E\left\{\hat{E}(X_{l}|\bm{\mathcal{X}}_{J(r,k)})\right\}^4<\infty,$$
where $I(\cdot)$ is an indicator function, $\bm{X}_{i J(r,k)}$ is a vector consisting of samples $X_{iv}$ for all $v\in J(r,k)$, and $\hat{E}(X_{l}|\bm{X}_{i J(r,k)})$ is an estimator of $E(X_{l}|\bm{\mathcal{X}}_{J(r,k)}=\bm{X}_{i J(r,k)})$.
$\hat{Z}_{ij}=\hat{E}(\bm{X}_j|\bm{X}_{i J(r,k)})$ if $j\in m(r)$ and $\hat{Z}_{ij}=X_{ij}$ otherwise,
and $\bar{\varepsilon}_i = \varepsilon_i + \{\bm{X}_{im(r)}-E(\bm{X}_{m(r)}|\bm{X}_{i J(r,k)})\} \bm{\beta}_{m(r)}^0$.
\end{condition}
\begin{condition}\label{C2}
For any $1\le r \le R$, with a sufficiently large $n$,
\begin{equation*}
P(\text{Columns of}\ \bm{G}^{(r)}(\bm{\beta}^0)\ \text{are linearly dependent} \text{ when } \bm{\beta}^0_{m(r)}\neq\bm{0})=0,
\end{equation*}
where $\bm{G}^{(r)}(\bm{\beta})=(\bm{g}_1^{(r)}(\bm{\beta}),\dots,\bm{g}_N^{(r)}(\bm{\beta}))^T$ is a submatrix of $\bm{G}(\bm{\beta})$ with columns representing estimating functions of the $r$-th group.
\end{condition}
\begin{condition}\label{C4}
For each $1\le j \le q$, there exists $1\le r\le R$ such that $j\in a(r)\cap \{\cup_{k\in \mathcal{G}(r)} a(k)\}$.
\end{condition}
\begin{condition}\label{C5}
There exists a covariance matrix $\bm{V}_1$ such that
$\bm{G}^*_0(\bm{\beta}^0)^T\bm{1}/\sqrt{N}\overset{d}{\to}N(\bm{0}, \bm{V}_1)$, where $\bm{G}_0^*(\bm{\beta})=\bm{G(\bm{\beta})\{\bm{U}(\bm{\beta}^0)\}^T}$ is the sample matrix for transformed estimating functions which are linearly independent at $\bm{\beta}=\bm{\beta}^0$.
\end{condition}
Note that, equations (\ref{imputeCondition1}) and (\ref{imputeCondition2}) in Condition \ref{C1} are satisfied if the consistency of a coefficient estimator for $\bm{\mathcal{X}}_{J(r,m)}$ holds under a linear model in predicting $X_l$, which can be obtained through the least squares or GLM \citep{fahrmeir1985consistency} estimator under MCAR or MAR mechanisms.
Moreover, Condition \ref{C1} requires the existence of the fourth moments of covariates and the error term. Condition \ref{C2} holds when the block-wise imputations based on different missing pattern groups are distinct with probability $1$.
Condition \ref{C4} is satisfied when the block-wise missing data contain complete cases, while for data with no complete cases, it requires that each relevant covariate is observed from at least one group and utilized in the MBI to predict missing values.
Since $\bm{G}(\bm{\beta})$ incorporates predicted conditional expectations, Condition \ref{C5} requires asymptotic normality of coefficient estimators for predicting missing covariates, and thus can be satisfied when the least squares estimator is used under the linear regression model and the missing mechanism is either MCAR or MAR. When there are no missing values, Condition \ref{C5} automatically holds.
To simplify expression of the following theorem, we define some notations. Let $\bm{\beta}_{A_1}$ and $\bm{\beta}_{A_2}$ be vectors of $\beta_j$ for $j\in A_1$ or $j\in A_2$, respectively.
In addition, we let $\hat{\bm{V}}_2=\nabla_{A_1} (\bm{1}^T\bm{G}^*_0/N)(\bm{\beta}^0)$ be the first derivative of $\bm{1}^T\bm{G}^*_0/N$ with respect to $\bm{\beta}_{A_1}$, and $\bm{V}= (\bm{V}_2 \bm{V}_1^{-1} \bm{V}_2^T)^{-1}$, where
$\bm{V}_2$ is expectation of $\hat{\bm{V}}_2$.
\begin{thm}\label{T1}
Under Conditions \ref{C1}--\ref{C4}, if $\lambda_N \to 0$ and $\lambda_N\sqrt{N}/\zeta_N \to \infty$ as $N\to \infty$, then there exists a local minimizer $\hat{\bm{\beta}}$ of $f^*(\bm{\beta})$ such that the following properties hold:
(i) Estimation consistency: $\|\hat{\bm{\beta}}-\bm{\beta}^0\|_2=O_p(N^{-1/2}\zeta_N)$.
(ii) Sparsity recovery: $P(\hat{\bm{\beta}}_{A_2}=\bm{0})\to 1$ as $N\to \infty$.
(iii) Asymptotic normality: If Conditions \ref{C5} hold, then $ \sqrt{N} (\hat{\bm{\beta}}_{A_1}-\bm{\beta}^0_{A_1}) \overset{d}{\to} N(\bm{0}, \bm{V})$.
\end{thm}
Theorem \ref{T1} states that the proposed estimator is almost root-$n$ consistent and selects
the true model with probability approaching $1$. The convergence of the proposed estimator $\hat{\bm{\beta}}$ depends on the accuracy of predictions for the conditional expectations of missing covariates, since the proposed approach is based on imputation of the missing covariates. Thus, the $\zeta_N$ in (i) comes from the level of prediction accuracy assumed in Condition \ref{C1}. Note that if $\zeta_N$ is a constant, then the proposed estimator is root-$n$ consistent by Theorem \ref{T1}. In addition, the estimator of nonzero coefficients $\hat{\bm{\beta}}_{A_1}$ is asymptotically normal under Condition \ref{C5}. The empirical covariance matrix of $\hat{\bm{\beta}}_{A_1}$ is $\hat{\bm{V}}=(\hat{\bm{V}}_2 \hat{\bm{V}}_1^{-1} \hat{\bm{V}}_2^T)^{-1}$, where $\hat{\bm{V}}_1=\{\bm{G}^*_0(\bm{\beta}^0)\}^T\bm{G}^*_0(\bm{\beta}^0)/N$.
If only a single regression imputation based on complete observations is utilized, the sample estimating functions are $\bm{G}_{(1)}(\bm{\beta})=\bm{G}(\bm{\beta})\{\bm{U}_{(1)}\}^T$, where $\bm{U}_{(1)}$ selects estimating functions corresponding to the single imputation. Then, the empirical covariance matrix of the estimator induced by $\bm{G}_{(1)}(\bm{\beta})$ is $\hat{\bm{V}}^{(1)}$, where $\hat{\bm{V}}^{(1)}$, $\hat{\bm{V}}^{(1)}_1$, and $\hat{\bm{V}}^{(1)}_2$, are similarly defined as $\hat{\bm{V}}$, $\hat{\bm{V}}_1$, and $\hat{\bm{V}}_2$, respectively, except that $\bm{G}_0^*(\bm{\beta}^0)$ is replaced by $\bm{G}_{(1)}(\bm{\beta}^0)$.
In the following proposition, we show that utilizing the MBI improves the empirical efficiency of the parameter estimation with a smaller asymptotic variance
compared with a single imputation approach.
\begin{prop}\label{P1}
Under the conditions in Theorem \ref{T1}, $\hat{\bm{V}}^{(1)}-\hat{\bm{V}}$ is positive semi-definite.
\end{prop}
Proposition \ref{P1} indicates that the proposed estimator with MBI gains efficiency through incorporating additional information from incomplete case groups.
In the following, we will establish consistency of the proposed estimator for diverging $p$ and $q$.
\vspace{-3mm}
\subsection{Consistency for diverging $p$ and $q$}
In this subsection, we consider cases when $p$ and $q$ increase as $N$ increases, that is, $p=p_N$ and $q=q_N$. We assume that the number of sources does not diverge as $N$ goes to infinity.
Let
$\bm{H}(\bm{\beta}) = \left( \{\bm{1}^T \partial_1 \bm{G}(\bm{\beta})/N\}^T,\dots, \{\bm{1}^T \partial_p \bm{G}(\bm{\beta})/N\}^T\right)^T$, $\bm{H}_{A_1}(\bm{\beta})$ and $\bm{H}_{A_2}(\bm{\beta})$ be sub-matrices of $\bm{H}(\bm{\beta})$ consisting of rows
corresponding to covariates indexed by $A_1$ and $A_2$, respectively, where $\partial_j \bm{G}(\bm{\beta})$ denotes the first derivative of $\bm{G}(\bm{\beta})$ with respect to $\beta_j$ for $1\le j\le p$.
We also let $\widehat{\bm{W}}(\bm{\beta})=\{\bm{U}(\bm{\beta}^0)\}^T\{\bm{W}^*_0(\bm{\beta})\}^{-1} \bm{U}(\bm{\beta}^0)$ be an estimator of the weighting matrix for all estimating functions,
$\widetilde{\bm{W}}(\bm{\beta}) = \bm{H}_{A_1}(\bm{\beta}) \widehat{\bm{W}}(\bm{\beta})\{\bm{H}_{A_1}(\bm{\beta})\}^T$, and
$\mathcal{B}_0=\{\bm{\beta} : \|\bm{\beta}-\bm{\beta}^0\|_{\infty}\le N^{-\kappa_0}\zeta_N\}$ be a neighborhood of $\bm{\beta}_0$ for some constant $\kappa_0$, where $\bm{W}^*_0(\bm{\beta})= \bm{G}^*_0(\bm{\beta})^T \bm{G}^*_0(\bm{\beta})/N$ and $\zeta_N$ is a sequence such that $1/\zeta_N=O(1)$ and $\zeta_N=o(\log N)$. Denote the minimum signal by $\beta_{\min}=\underset{j\in A_1}{\min}|\beta^0_j|$, and the smallest eigenvalue of a matrix by $\lambda_{\min}(\cdot)$. For simplicity, we write w.p.a.$1$ as shorthand for ``with probability approaching one.''
Since the dimensions of $\bm{G}$ and $\bm{\beta}$ diverge as $N$ grows, we require the following regularity conditions.
\begin{condition}\label{C6}
For $\bm{\beta}\in\mathcal{B}_0$, and some
positive constants $\kappa_4$ and $\kappa_3 < \min\{\kappa'_1/2-\kappa_0/2, \kappa'_1/4-\kappa_2/4\}$,
$\underset{i,j\in A_1}{\max} \|\{\partial_i \bm{G}(\bm{\beta})\}^T \partial_j \bm{G}(\bm{\beta})/N\|_{\infty}=O_p(N^{\kappa_3})$,
$ \underset{1\le j\le p_N}{\max}
\|\{\partial_j \bm{G}(\bm{\beta})\}^T \bm{G}(\bm{\beta})/N\|_{\infty} = O_p(N^{\kappa_3})$,
$\| \widehat{\bm{W}}(\bm{\beta}) \|_{\infty}= O_p(N^{\kappa_3})$,
$\|\bm{H}(\bm{\beta})\|_{\infty}= O_p(N^{\kappa_3})$, $\lambda_{\min}(\widetilde{\bm{W}}(\bm{\beta}))> \kappa_4$ w.p.a.$1$,
where $\kappa'_1=\kappa_1-1/6$, $\kappa_1\in(1/6, 1/2]$ and $\kappa_0, \kappa_2\in(0,\kappa'_1]$ are constants
\end{condition}
Condition \ref{C6} controls the norms of matrices related to the estimating function matrix $\bm{G}$ for $\bm{\beta}$ in a neighborhood of true coefficients, which is similar to the conditions in \citep[Theorem B.1 and Theorem B.2]{fan2014endogeneity}.
In particular, the condition assumes a lower bound for eigenvalues of $\widetilde{\bm{W}}$ to ensure a strict local minimizer of the objective function $f^*(\bm{\beta})$.
Let $\bm{T}_N (\bm{\beta})=\nabla^2_{21}L_N(\bm{\beta}) \{\nabla^2_{11}L_N(\bm{\beta})\}^{-1}$, where $L_N(\bm{\beta})$ is the first term in (\ref{FinalObject}) with $\bm{U}=\bm{U}(\bm{\beta}^0)$. Here, $\nabla^2_{21}L_N(\bm{\beta})$ is a sub-matrix of the Hessian matrix of $L_N(\bm{\beta})$ with rows and columns indexed by $A_2$ and $A_1$, respectively, while $\nabla^2_{11}L_N(\bm{\beta})$ is defined similarly
with rows and columns both indexed by $A_1$.
\begin{condition}\label{penalty}
For some constant $\tau_1>\kappa_0+\kappa_2$, $p'_{\lambda_N}(\beta_{\min}/2)=O(N^{-\tau_1})$, $\lambda_N^{-1}=O(N^{\eta_2})$, and $\lambda_N^{-1} \|\bm{T}_N (\bm{\beta})\|_{\infty} \le \min \{\eta_1/p'_{\lambda_N}(\beta_{\min}/2), O_p(N^{\eta_2}) \}$, where $\eta_1\in (0,1)$ and $\eta_2\in (0,\kappa'_1-2\kappa_3)$ are constants.
\end{condition}
Condition \ref{penalty} is standard for the SCAD penalty \citep{fan2011nonconcave}, where $p'_{\lambda_N}(\beta_{\min}/2)=O(N^{-\tau_1})$ can be satisfied as long as $\beta_{\min}$ is large enough, since $p'_{\lambda_N}(\cdot)$ is decreasing. The requirement for $\bm{T}_N(\bm{\beta})$ is similar to the irrepresentable condition of the SCAD penalty under high-dimensionality \citep{fan2011nonconcave}, but is derived for the loss function based on estimating equations instead of the least squares loss.
Specifically, when there are no missing values and $L_N (\bm{\beta})$ is the least-square loss function, then $\nabla^2_{21}L_N(\bm{\beta})$ is the sample covariance matrix between the irrelevant and relevant covariates, $\nabla^2_{11}L_N(\bm{\beta})$ is the sample covariance matrix among relevant covariates, and thus the condition on $\bm{T}_N(\bm{\beta})$ is exactly the same as the irrepresentable condition.
\begin{condition}\label{C7}
There exists a constant $\tau_2> \kappa_1-1/6$
such that
for $\bm{\beta}\in\mathcal{B}_0$, $1\le r\le R$, $k\in \mathcal{G}(r)$,
\begin{equation}\label{ExpectationEstimator}
\sum_{j\in a(k)}\left|\frac{1}{N}\sum\limits_{i=1}^N I(\xi_i=r) \hat{Z}_{ij}\left\{E(\bm{X}_{im(r)}|\bm{X}_{i J(r,k)})-\hat{E}(\bm{X}_{m(r)}|\bm{X}_{i J(r,k)})\right\} \bm{\beta}_{m(r)} \right| = O_p\left(\frac{\zeta_N}{N^{\tau_2}}\right),
\end{equation}
\vspace{-15mm}
\begin{equation}\label{ExpectationEstimator2}
\sum_{l\in m(r)}\left|\frac{1}{N}\sum\limits_{i=1}^N I(\xi_i=r) \bar{\varepsilon}_i
\left\{E(X_{il}|\bm{X}_{i J(r,k)})-\hat{E}(\bm{X}_{l}|\bm{X}_{i J(r,k)})\right\}
\right| = O_p\left(\frac{\zeta_N}{N^{\tau_2}}\right),
\end{equation}
where
$\hat{Z}_{ij}=\hat{E}(\bm{X}_j|\bm{X}_{i J(r,k)})$ if $j\in m(r)$ and $\hat{Z}_{ij}=X_{ij}$ otherwise,
and $\bar{\varepsilon}_i = \varepsilon_i + \{\bm{X}_{im(r)}-E(\bm{X}_{m(r)}|\bm{X}_{i J(r,k)})\} \bm{\beta}_{m(r)}$. We also assume that $X_j$ and $E(X_l|\bm{X}_{J(r, k)})$ are sub-Gaussian distributed for $1\le j \le p$, $l\in m(r)$, $1\le r \le R$, and $k \in \mathcal{G}(r)$. In addition, $\max\limits_{1\le r \le R} |m(r)|=o(N^{1/6})$ and $\max\limits_{1\le r \le R} \|\bm{\beta}_{m(r)}\|_{\infty}=O(\zeta_N)$.
\end{condition}
Condition \ref{C7} is analogous to Condition \ref{C1}. Similar to equations (\ref{imputeCondition1}) and (\ref{imputeCondition2}), equations (\ref{ExpectationEstimator}) and (\ref{ExpectationEstimator2}) can be obtained through the Lasso \citep{zhang2008sparsity} or SCAD \citep{fan2011nonconcave} under linear regression models and the MCAR or MAR mechanisms in predicting missing covariates, assuming that the magnitude of true coefficients and the numbers of missing covariates across groups do not diverge too fast as $N\to \infty$. We also assume that the covariates in Condition \ref{C7} are sub-Gaussian, since we allow the dimension of covariates $p_N$ to increase exponentially in the following theorem.
\begin{thm}[Consistency under high-dimensionality]\label{HighConsistency}
Under Conditions \ref{C2} and \ref{C6}--\ref{C7}, if $\log p_N=O(N^{1-2\kappa_1})$, $q_N=O(N^{\kappa_2})$ and $\beta_{\min}> N^{-\kappa_0}\log N$,
then there exists a strict local minimizer $\hat{\bm{\beta}}$ of $f^*(\bm{\beta})$ in (\ref{FinalObject}) such that the following properties hold:
(i) Estimation consistency:
$\|\hat{\bm{\beta}}-\bm{\beta}^0\|_{\infty}=O_p(N^{-\kappa_0}\zeta_N)$.
(ii) Sparsity recovery: $P(\hat{\bm{\beta}}_{A_2}=\bm{0})\to 1$ as $N\to\infty$.
\end{thm}
Theorem \ref{HighConsistency} states that when the number of covariates grows exponentially, the proposed method still processes estimation consistency and recovers sparsity accurately under regularity conditions. That is, the proposed estimator selects the true model with probability tending to $1$. We provide the proofs of Theorems \ref{T1}--\ref{HighConsistency} and Proposition \ref{P1} in the supplementary material.
\vspace{-3mm}
\section{Simulation study}\label{SectionSim}
In this section, we provide simulation studies to compare the proposed method with existing model selection approaches for handling block-wise missing data, including complete case analysis with the SCAD penalty (CC-SCAD), the single imputation with SCAD penalty (SI-SCAD), the iSFS, the DISCOM, and the DISCOM with Huber's M-estimate (DISCOM-Huber). The simulation results show that the proposed method achieves higher model selection accuracy than other competing methods through fully utilizing information from incomplete samples. We simulate data from a linear model (\ref{Lmodel}) using $50$ replications, where $\bm{\varepsilon}\sim N(\bm{0}, \bm{I}_N)$ and each row of $\bm{X}$ is independent and identically distributed from a normal distribution with mean $\bm{0}$ and an exchangeable covariance matrix determined by a variance parameter $\sigma^2=1$ and a covariance parameter $\rho$.
We also carry out simulations with binary covariates or an unstructured correlation matrix. The simulation results for the unstructured correlation matrix are provided in the supplementary material.
The proposed method is implemented based on Algorithm 1. The imputation in SI-SCAD is estimated in a similar fashion but only based on the complete case group. The minimization problem in CC-SCAD and SI-SCAD is solved through the coordinate descent algorithm. We utilize the Matlab codes in
\resizebox{47ex}{1.4ex}{\href{https://github.com/coderxiang/MachLearnScripts}{\ttfamily https://github.com/coderxiang/MachLearnScripts}} to calculate the iSFS estimator. The implementation of DISCOM and DISCOM-Huber is provide by \citep{yu2019optimal}. In addition, we tune the parameter $\lambda$ for the CC-SCAD, SI-SCAD, and iSFS via BIC. Following \citep{yu2019optimal}, the $\lambda$ in DISCOM and DISCOM-Huber is tuned by a validation set which consists of $n_v$ random samples from the complete observations. For the methods with the SCAD penalty, we choose $a=3.7$ \citep{fan2001variable}.
We calculate the false negative rate (FNR) representing the proportion of unselected relevant covariates and the false positive rate (FPR) representing the proportion of selected irrelevant covariates as follows:
\vspace{-3mm}
\[
\frac{\sum_{j=1}^{p} I(\hat{\beta}_j = 0, \beta_j^0 \neq 0)}{\sum_{j=1}^{p} I(\beta_j^0 \neq 0)}\ \ \text{ and }\ \ \frac{\sum_{j=1}^{p} I(\hat{\beta}_j \neq 0, \beta_j^0 = 0)}{\sum_{j=1}^{p} I(\beta_j^0 = 0)}.
\vspace{-3mm}
\]
We say that a method has better model selection performance if the overall false negative plus false positive rate (FNR$+$FPR) is smaller. We compare all the methods under the following five settings where the relevant predictors in Source $k$ share the same signal strength $\beta_{sk}$ for $k=1,\dots, S$. In the first two settings, we assume missing at random and missing completely at random, respectively, while we assume informative missing in the third and fourth settings. In addition, we consider data with no complete observations in the last setting. Under each setting, we also provide the computational time (in seconds) of each method with a given tuning parameter.
\noindent\textbf{Setting $\bm{1}$:} Let $N=700$, $p=40$, $q=14$, $R=4$, $S=4$, $n_1=30$, $n_2=n_3=220$, $n_4=230$, $n_v=10$, $p_1=p_2=p_3=12$, $p_4=4$, $(\beta_{s1}, \beta_{s2}, \beta_{s3}, \beta_{s4}) = (5, 6, 7, 8)$, and $\rho=0.4 \text{ or } 0.7$. Each of the first three sources contains four relevant covariates, and the last source contains two relevant covariates.
Samples are sequentially randomly assigned into the complete case group with probabilities proportional to $\exp(-a_i)$ for $1\le i \le N$, where $a_i=10(X_{i37}+\dots+X_{i40})$ and $X_{i37},\dots,X_{i40}$ are the four covariates from Source $4$ for the $i$-th sample. Otherwise, they are uniformly assigned to the other three groups, where Sources $1$--$3$ have the same missing structure as the three sources in Groups $2$--$4$ in Figure \ref{missingpattern}, and Source $4$ covariates are all observed. This assignment ensures that samples with higher $a_i$ are less likely to be assigned to Group $1$ of the complete cases.
Since $a_i$ depends on Source $4$ covariates which are observed across all the missing patterns, samples in Setting $1$ are missing at random. The proposed method outperforms other competing methods for different correlations even with a high missing rate ($95.7\%$) as we are able to extract more information from incomplete samples. Table \ref{S1} shows that the overall FNR$+$FPR of the proposed method is the lowest among all methods. For example, when $\rho=0.7$, the FNR$+$FPR of the proposed method is $0.481$, which is only $66.5\%$, $56.7\%$, $62.5\%$, $63.5\%$, and $51.5\%$ of the FNR$+$FPR of CC-SCAD, SI-SCAD, DISCOM, DISCOM-Huber, and iSFS, respectively. Note that the FNR$+$FPR of iSFS is the same for different $\rho$ since the iSFS always selects Source $4$ covariates. This is possibly due to the larger weight of Source $4$ when applying the iSFS approach, as covariates of Source $4$ are observed in all samples.
Moreover, we provide the values of the two terms in MBI-BIC$_{\lambda}$ in equation (\ref{MBI-BIC}) for $20$ increasing values of $\lambda$ in Table 10
in the supplementary material.
Although the values of the RSS term are much higher than the values of the second term $df_{\lambda}\cdot \log (N)$, the changes of the RSS term across different $\lambda$'s are comparable to the changes of the second term, which indicates that the second term is able to determine the tuning of $\lambda$ and thus can prevent overfitting. We also illustrate this with Figure 3
in the supplementary material, where the red vertical line marks the smallest MBI-BIC$_{\lambda}$. Since the smallest MBI-BIC$_{\lambda}$ and the smallest first term do not correspond to the same value of $\lambda$, the second term is effective in preventing overfitting. Note that the first term $N\cdot\log\left\{RSS(\hat{\bm{\beta}}_{\lambda})/N\right\}$ in MBI-BIC$_{\lambda}$ is not strictly increasing as $\lambda$ increases. This is possibly due to that the first term in the proposed objective function (\ref{FinalObject}) is not strictly increasing of the RSS.
We investigate the performance of the proposed method under high-dimensional situations in the following Setting $2$.
\noindent\textbf{Setting $\bm{2}$:} Let $N=500$, $p=1000$, $q=20$, $R=4$, $S=3$, $n_1=180$, $n_2=120$, $n_3=n_4=100$, $n_v=50$, $p_1=75$, $p_2=100$, $p_3=825$, $(\beta_{s1}, \beta_{s2}, \beta_{s3}) = (6, 5, 4)$, and $\rho=0.5\ \text{or } 0.8$. Sources $1$, $2$, and $3$ contain $6$, $6$, and $8$ relevant covariates, respectively.
All the samples are uniformly assigned to the four groups, which have the same missing structure as Groups $1$--$4$ in Figure \ref{missingpattern}.
The proposed method is more powerful in variable selection than other methods under the high-dimensional situations, as its FNR$+$FPR is the smallest among all the methods, as indicated in Table \ref{S2}. In particular, the proposed method performs especially effectively when correlations among covariates are as strong as $0.8$, with FNR$+$FPR $=0.048$, much smaller than any FNR$+$FPR of other methods. This is possibly because the strong correlations improve imputations in MBI, which compensate the negative effect of highly correlated covariates on variable selection under high-dimensional settings [\citealp{zhao2006model}, \citealp{fan2011nonconcave}].
\noindent\textbf{Setting $\bm{3}$:} We consider the missing not at random. Let $N=250$, $p=60$, $q=15$, $R=4$, $S=3$, $n_1=n_2=45$, $n_3=n_4=80$, $n_v=10$, $p_1=p_2=p_3=20$, $(\beta_{s1}, \beta_{s2}, \beta_{s3}) = (2.5, 3, 3.5)$, and $\rho=0.4, 0.6, \text{or } 0.8$. Each source contains five relevant covariates. Here, missing group assignment of the samples is the same as in Setting $1$, except that there is no Source $4$ and $a_i=3(X_{i1}+\dots+X_{i5}+y_i)$, where $X_{i1},\dots,X_{i5}$ are the $i$-th sample of the five relevant covariates from Source $1$.
In Setting $3$, the probability of a missing sample depends on missing covariates and the response variable, which leads to informative missingness and biased imputation based on the complete group in SI-SCAD. In contrast, the proposed method, incorporating additional imputed values through aggregating different missing patterns, is able to reduce the selection bias caused by missingness. For example, when $\rho=0.6$, the FNR$+$FPR of the proposed method is $0.402$, less than those of other methods.
Note that the FNRs of DISCOM and DISCOM-Huber are small since these two methods tend to over-select variables, consequently producing large FPRs. On the other hand, the CC-SCAD tends to select fewer variables due to insufficient numbers of complete observations, which leads to small FPR and large FNR.
In the following Setting $4$, we consider binary covariates. We first simulate data from a multivariate normal distribution with correlation $\rho$ similarly as in previous settings, and then transform each covariate $X_j$ in Source $1$ to $\sign(X_j)$.
\noindent\textbf{Setting $\bm{4}$:} Let $N=700$, $p=60$, $q=15$, $R=4$, $S=3$, $n_1=45$, $n_2=n_3=265$, $n_4=125$, $n_v=20$, $p_1=p_2=p_3=20$, $(\beta_{s1}, \beta_{s2}, \beta_{s3}) = (7,8,10 )$, and $\rho=0.4 \text{ or } 0.7$. Sources $1$, $2$, and $3$ contain $2$, $6$, and $7$ relevant covariates, respectively. Missing group assignment of the samples is the same as that in Setting $3$, except that $a_i=10y_i$ for $1\le i \le N$.
In addition to FNR and FPR, we also calculate the mean-squared-error (MSE) of the estimators. Table \ref{S6} shows that the proposed method has the smallest FNR$+$FPR and MSE among all the methods under Setting $4$, indicating that the proposed method performs better than other competing methods in both variable selection and coefficient estimation under the situations with binary covariates. Note that although the CC-SCAD does not perform well in estimation due to informative missing, it is still able to select variables more accurately than all other methods except the proposed method, especially for relatively small $\rho$. Moreover, the DISCOM and DISCOM-Huber perform the worst in this setting, possibly because the DISCOM methods are based on covariances.
\noindent\textbf{Setting $\bm{5}$:} We follow similarly as in Setting $3$, except that there is no complete case group and $R=3$. Let $N=300$, $n_1=n_2=n_3=100$, $(\beta_{s1}, \beta_{s2}, \beta_{s3}) = (0.8, 1, 1.5)$, $\rho=0.5, 0.6, 0.7, \text{or } 0.8$. All the samples are uniformly assigned to the three missing groups.
\begin{table}\centering
\begin{tabular}{*{5}{c}|*{4}{c}}
\hline
&\multicolumn{4}{c|}{$\rho=0.4$} &\multicolumn{4}{c}{$\rho=0.7$} \\
\cline{2-9}
\raisebox{1.5ex}[0pt]{Method}
&FNR &FPR &\textbf{FNR+FPR} & Time &FNR &FPR &\textbf{FNR+FPR} & Time \\
\hline
\textbf{Proposed method} &0.128 & 0.408 & 0.536 &12.086 &0.116 & 0.365 & 0.481 &8.781 \\
CC-SCAD &0.493 & 0.131 & 0.624 &0.016 &0.621 & 0.103 & 0.723 &0.026 \\
SI-SCAD &0.357 & 0.427 & 0.784 &0.004 &0.385 & 0.464 & 0.849 &0.073 \\
DISCOM &0.000 & 0.859 & 0.859 &0.031 &0.000 & 0.770 & 0.770 &0.034 \\
DISCOM-Huber &0.000 & 0.854 & 0.854 &0.051 &0.000 & 0.758 & 0.758 &0.055 \\
iSFS &0.857 &0.077 &0.934 &0.426 &0.857 &0.077 &0.934 &0.614 \\
\hline
\end{tabular
\caption{FNR, FPR, and FNR$+$FPR under Setting $1$. ``Time'' represents the computational time (in seconds) of each method for one simulation with a given tuning parameter.}\label{S1}
\end{table}
\begin{table}[H]\centering
\resizebox{\textwidth}{!}{
\begin{tabular}{*{5}{c}|*{4}{c}}
\hline
&\multicolumn{4}{c|}{$\rho=0.5$} &\multicolumn{4}{c}{$\rho=0.8$} \\
\cline{2-9}
\raisebox{1.5ex}[0pt]{Method}
&FNR &FPR &\textbf{FNR+FPR} & Time &FNR &FPR &\textbf{FNR+FPR} & Time \\
\hline
\textbf{Proposed method} &0.033 &0.001 &0.034 & $9.033\times10^3$ &0.042 &0.006 &0.048 &$9.724\times10^3$ \\
CC-SCAD &0.187 &0.017 &0.204 &0.859 &0.655 &0.013 &0.668 & 2.012 \\
SI-SCAD &0.390 &0.008 &0.398 &0.488 &0.480 &0.038 &0.518 & 1.152 \\
DISCOM &0.006 &0.367 &0.373 &74.800 &0.023 &0.487 &0.510 &110.900 \\
DISCOM-Huber &0.033 &0.317 &0.350 &103.600 &0.117 &0.373 &0.491 &143.500 \\
iSFS &0.537 &0.074 &0.611 &16.350 &0.496 &0.096 &0.592 &19.674 \\
\hline
\end{tabular}}
\caption{FNR, FPR, and FNR$+$FPR under Setting $2$. ``Time'' represents the computational time (in seconds) of each method for one simulation with a given tuning parameter.}\label{S2}
\vspace{-3mm}
\end{table}
\begin{table}[H]\centering
\resizebox{\textwidth}{!}{
\begin{tabular}{*{5}{c}|*{4}{c}|*{4}{c}}
\hline
&\multicolumn{4}{c|}{$\rho=0.4$} &\multicolumn{4}{c|}{$\rho=0.6$} &\multicolumn{4}{c}{$\rho=0.8$}\\
\cline{2-13}
\raisebox{1.5ex}[0pt]{Method}
&FNR &FPR &\textbf{FNR+FPR} & Time &FNR &FPR &\textbf{FNR+FPR} & Time &FNR &FPR &\textbf{FNR+FPR} & Time\\
\hline
\textbf{Proposed} &0.096 &0.298 &0.394
&9.831 &0.105 &0.297 &0.402
&8.324 &0.123 &0.294 &0.417 &4.445\\
CC-SCAD &0.351 &0.090 &0.440
&0.023 &0.461 &0.082 &0.543
&0.053 &0.613 &0.070 &0.683 &0.182\\
SI-SCAD &0.492 &0.308 &0.800
&0.206 &0.455 &0.288 &0.743
&0.123 &0.492 &0.280 &0.772 &0.118\\
DISCOM &0.000 &0.541 &0.541
&0.043 &0.001 &0.541 &0.542
&0.041 &0.015 &0.465 &0.480 &0.052\\
DISCOM-H &0.009 &0.509 &0.518
&0.092 &0.069 &0.472 &0.541
&0.094 &0.196 &0.380 &0.576 &0.094\\
iSFS &0.425 &0.289 &0.714
&0.320 &0.440 &0.304 &0.744
&0.506 &0.479 &0.285 &0.764 &0.871 \\
\hline
\end{tabular}}
\caption{FNR, FPR, and FNR$+$FPR under Setting $3$. ``Proposed'' stands for the proposed method. ``DISCOM-H'' stands for the DISCOM-Huber method.}\label{S3}
\vspace{-3mm}
\end{table}
\begin{table}[H]\centering
\resizebox{\textwidth}{!}{
\begin{tabular}{*{6}{c}|*{5}{c}}
\hline
&\multicolumn{5}{c|}{$\rho=0.4$} &\multicolumn{5}{c}{$\rho=0.7$}\\
\cline{2-11}
\raisebox{1.5ex}[0pt]{Method}
&FNR &FPR &\textbf{FNR$+$FPR} &MSE & Time &FNR &FPR &\textbf{FNR$+$FPR} &MSE&Time\\
\hline
\textbf{Proposed method} &0.024 &0.160 &0.184 &1.570 &14.662 &0.052 &0.151 &0.203 &2.449 & 17.772 \\
CC-SCAD &0.368 &0.096 &0.464 &16.409
&0.033 &0.588 &0.056 &0.644 &33.813 & 0.037 \\
SI-SCAD &0.264 &0.454 &0.718 &15.291
&0.196 &0.319 &0.451 &0.770 &18.715 & 0.181\\
DISCOM &0.000 &0.726 &0.726 &2.560
&0.052 &0.000 &0.703 &0.703 &3.909 & 0.052 \\
DISCOM-Huber &0.000 &0.916 &0.916 &39.614
&0.115 &0.005 &0.872 &0.877 &47.117 & 0.087\\
iSFS &0.215 &0.331 &0.545 &9.758
&0.499 &0.184 &0.420 &0.604 &11.932 &0.650 \\
\hline
\end{tabular}
}
\caption{FNR, FPR, FNR$+$FPR, and MSE under Setting $4$.}\label{S6}
\end{table}
\begin{table}[H]\centering
\resizebox{\textwidth}{!}{
\begin{tabular}{*{3}{c}|*{2}{c}|*{2}{c}|*{2}{c}|*{2}{c}}
\hline
&\multicolumn{2}{c|}{FNR} &\multicolumn{2}{c|}{FPR} &\multicolumn{2}{c|}{\textbf{FNR+FPR}} &\multicolumn{2}{c|}{MSE}&\multicolumn{2}{c}{Time}\\
\cline{2-11}
\raisebox{1.5ex}[0pt]{$\rho$}
&\textbf{Proposed} &iSFS &\textbf{Proposed} &iSFS &\textbf{Proposed} &iSFS &\textbf{Proposed} &iSFS &\textbf{Proposed} &iSFS \\
\hline
0.5 &0.267 &0.395 &0.233 &0.380 &0.500 &0.774 &0.258 &0.255 &8.849 &0.154\\
0.6 &0.228 &0.405 &0.154 &0.380 &0.382 &0.785 &0.174 &0.262 &11.657 &0.180\\
0.7 &0.221 &0.428 &0.135 &0.377 &0.356 &0.805 &0.148 &0.296 &8.556 &0.200\\
0.8 &0.201 &0.435 &0.114 &0.370 &0.316 &0.804 &0.120 &0.326 &9.462 &0.302\\
\hline
\end{tabular}
}
\caption{FNR, FPR, FNR$+$FPR, and MSE under Setting $5$. ``Proposed'' stands for the proposed method.}\label{S4}
\vspace{-3mm}
\end{table}
The proposed method is capable of handling data with no complete observations. However, complete observations are required for CC-SCAD, SI-SCAD, DISCOM, and DISCOM-Huber. Thus, we only compare the proposed method with iSFS in this setting. The proposed method performs better than iSFS on both estimation and variable selection especially when the correlations among covariates are strong.
Table \ref{S4} shows that the FNR, FPR, and MSE of the proposed method are less than those of iSFS, respectively, in most situations.
Moreover, the FNR$+$FPR of the proposed method decreases as $\rho$ increases, indicating that incorporating correlation information among covariates plays an important role in imputation especially when there are no complete cases.
\begin{table}\centering
\resizebox{\textwidth}{!}{
\begin{tabular}{*{3}{c}|*{2}{c}|*{2}{c}|*{2}{c}}
\hline
&\multicolumn{2}{c|}{FNR} &\multicolumn{2}{c|}{FPR} &\multicolumn{2}{c|}{\textbf{FNR+FPR}} &\multicolumn{2}{c}{Time}\\
\cline{2-9}
\raisebox{1.5ex}[0pt]{$\rho$}
&Proposed &Proposed\_2 &Proposed &Proposed\_2 &Proposed &Proposed\_2 &Proposed &Proposed\_2 \\
\hline
0.4 & 0.030 & 0.031 & 0.272 & 0.270 & 0.301 & 0.301 & 17.115 & 13.836 \\
0.5 & 0.025 & 0.029 & 0.380 & 0.438 & 0.406 & 0.467 & 12.471 & 16.913\\
0.6 & 0.021 & 0.058 & 0.420 & 0.423 & 0.441 & 0.481 & 15.230 & 13.548\\
0.7 & 0.054 & 0.081 & 0.485 & 0.587 & 0.539 & 0.668 & 10.448 & 15.167\\
0.8 & 0.050 & 0.099 & 0.465 & 0.539 & 0.515 & 0.638 & 9.413 & 14.270\\
\hline
\end{tabular}
}
\caption{FNR, FPR, FNR$+$FPR, and MSE under Setting $6$. ``Proposed'' stands for the proposed method. ``Proposed\_2'' stands for the proposed method without using principle components for a non-singular $\bm{W}$\hspace{-0.5mm}.}\label{S_add}
\end{table}
In the following, we conduct additional simulations without using the principle components when $\bm{W}$ is non-singular. That is, we compare the estimators from solving equations (\ref{nonsingular}) and (\ref{FinalObject}), respectively.
\noindent\textbf{Setting $\bm{6}$:} We proceed similarly as in Setting $1$, except that $n_1=n_2=n_3=n_4=200$ and $(\beta_{s1}, \beta_{s2}, \beta_{s3}, \beta_{s4}) = (5, 6, 7, 8)$.
We summarize the results of Setting $\bm{6}$ in Table \ref{S_add}, where ``Proposed'' stands for the proposed method and ``Proposed\_2'' stands for the proposed method without using principle components for non-singular $\bm{W}$\hspace{-0.5mm}.
Note that these two approaches perform similarly in terms of FNR, FPR and FNR+FPR. In addition, the proposed method with principle components performs slightly better than that without the principle components for settings with a large correlation $\rho$. This is possibly due to the fact that $\bm{W}$ might be close to singular for a large $\rho$ even though it is non-singular.
\vspace{-3mm}
\section{Real data application}\label{Real}
In this section, we apply the proposed method to the Alzheimer's Disease Neuroimaging Initiative (ADNI) study \citep{mueller2005alzheimer} and compare it with existing approaches. A primary goal of this study is to identify biomarkers which can track the progression of Alzheimer's Disease (AD). Since the cognitive score from the Mini-Mental State Examination (MMSE) \citep{folstein1975mini} can measure cognitive impairment and is a diagnostic indicator of Alzheimer's disease \citep{tombaugh1992mini}, we treat the MMSE as the response variable, and intend to select biomarkers from three complementary data sources: MRI, PET, and gene expression.
Note that the sparsity assumption of the proposed method might not be suitable for raw imaging data or imaging data at small scales since images have to show some visible atrophy for AD. However, the sparsity assumption is still reasonable for region of interest (ROI) level data.
Thus, we apply the proposed method to the ROI level data in ADNI instead of the raw imaging data. For raw imaging data, the principal components analysis (PCA) related methods [\citealp{doi:10.1080/01621459.2016.1261710}, \citealp{guo2015spatially}, \citealp{shen2015spatially}] could be more applicable.
The MRI is segmented and analyzed in FreeSurfer by the Center for Imaging of Neurodegenerative Diseases at the University of California, San Francisco. Quantitative variables extracted from the MRI are volumes, average cortical thickness, standard deviation in cortical thickness, and surface areas of different ROIs.
Quantitative variables from the PET images are computed by the Jagust Lab at the University of California, Berkeley. The PET features represent standard uptake value ratios (SUVR) of different ROIs, where the SUVR is an indicator of metabolic activity of a specific region.
Gene expression variables are extracted form blood samples by Bristol-Myers Squibb laboratories, and represent expression levels at different gene probes.
The response variable MMSE may not be measured at the same day as the imaging data, as the examinations could be time-consuming. We utilize the ``visit code'' provided by the ADNI study to link the MMSE and image data, which ensures that the MMSE and imaging data are measured within the same month.
We mainly focus on the MMSE and quantitative variables from the MRI, PET, and gene expression in the second phase of the ADNI study (ADNI-2) at month $48$, where block-wise missingness emerges due to low-quality images, high cost of measurements, or patients' dropouts.
The aim of our real data analysis is to select biomarkers associated with the MMSE, which may be useful for the prediction of the MMSE or Alzheimer's disease in the future.
There are $267$ MRI features, $113$ PET features, and $49,386$ gene expression variables. To reduce the bias in MRI caused by differences of brain sizes,
we normalize the ROI volumes, surface areas and cortical thicknesses through dividing them by the whole brain volume, the total surface area, and the mean cortical thickness of each subject, respectively [\citealp{zhou2014significance}, \citealp{doi:10.1177/0962280217748675}].
We screen out $300$ features from the gene expression predictors through sure independence screening (SIS) \citep{fan2008sure}, and select subjects containing observations from at least two sources. For the SIS procedure, since there are missing values in the data, we calculate the marginal correlation between the MMSE response and each predictor using all available pairs of observations from them, and then select predictors with relatively higher marginal correlations according to the conventional SIS. In total, there are $680$ features and $212$ subjects in four groups with $69$ complete observations, that is, $p=680$, $N=212$, and $R=4$, where the four groups have the same missing pattern structure as Groups $1$--$4$ in Figure \ref{missingpattern}. As the missing rate of this dataset is about $68\%$, it is important to fully utilize incomplete observations, such as in the proposed method.
To compare the performance of the proposed method with existing methods, we randomly split the data into a test set and a training set $100$ times. Specifically, each test set consists of $43$ samples ($20$\% of all samples) randomly selected from the complete observations. The remaining $169$ samples ($80$\% of all samples) constitute the training set with $26$ complete observations, corresponding to a $85$\% missing rate of the training set.
For the DISCOM and DISCOM-Huber method, we generate a validation set consisting of $n_v=10$ random samples from the complete observations in the training set.
\begin{table}\centering
\resizebox{\textwidth}{!}{
\begin{tabular}{*{6}{c}|*{5}{c}}
\hline
&\multicolumn{5}{c|}{$85\%$ missing rate} &\multicolumn{5}{c}{$90\%$ missing rate}\\
\cline{2-11}
\raisebox{1.5ex}[0pt]{Method}
&NS &Mean &SD &\textbf{RI-RMSE}& Time&NS &Mean &SD &\textbf{RI-RMSE}& Time\\
\hline
\textbf{Proposed}
&41 &4.320 &0.577 &-- & $1.517\times10^3$ &39 &4.384 &0.403 &-- & $1.981\times10^3$\\
CC-SCAD &13 &5.472 &0.918 &21.1\% & 0.081 &9 &5.692 &1.038 &23.0\% & 0.040 \\
SI-SCAD &51 &5.548 &1.046 &22.1\% & 0.129 &50 &5.990 &0.896 &26.8\% & 0.117\\
DISCOM &392 &29.964 &4.123 &85.6\% & 7.587 &366 &29.824 &4.026 &85.3\% & 7.098\\
DISCOM-H &290 &29.978 &3.528 &85.6\% & 9.536 &258 &29.597 &3.393 &85.2\% & 9.012\\
iSFS &43 &18.058 &1.987 &76.1\% & 7.880 &44 &19.056 &2.113 &77.0\% & 6.220\\
\hline
\end{tabular}
}
\caption{The ``NS'' represents the mean number of selected variables. The ``Mean'' and ``SD'' represent mean and standard deviation of RMSE based on $100$ replications, respectively. The ``RI-RMSE'' for any method is the relative improvement of the proposed method over the competing method for the ADNI data. }\label{RD}
\vspace{-3mm}
\end{table}
We calculate the prediction root-mean-squared error (RMSE) $\sqrt{T^{-1}\sum_{i=1}^{T}(\hat{y}_i-y_i)^2}$ for each test set corresponding to each method, where $T$ is the number of observations in the test set, $y_i$ is the $i$-th true response value in the test set, and $\hat{y}_i$ is the corresponding fitted value using the model based on the training data. We also calculate the relative improvement (RI-RMSE) of the proposed method over other methods in terms of mean RMSE based on the $100$ replications. Specifically, the RI-RMSE of any given method is the ratio of the difference between the mean RMSE of the given method and the proposed method, to the mean RMSE of the given method. To investigate data with a higher missing rate, we also randomly partition all the samples into $25\%$ test and $75\%$ training sets with
$n_v=5$ for $100$ times, and calculate the corresponding RMSE and RI-RMSE in a similar fashion. With this partition, each training set contains $16$ complete observations corresponding to a $90$\% missing rate.
In general, the proposed method achieves higher variable selection and prediction accuracy than all other methods for the ADNI data due to incorporating correlation information from incomplete observations. Specifically, Table \ref{RD} shows that the mean RMSE of the proposed method is smaller than that of any other method under two missing rates, even though the proposed method selects fewer variables than most of the other methods, which implies that the proposed method selects variables more accurately. More precisely, the proposed method reduces the RMSE of any other method by more than $20\%$, according to the RI-RMSE. Moreover, the relative improvement is still substantial for the missing rate $90\%$, indicating that the proposed method is more effective than other methods even when the missing rate is quite high. In addition, the proposed method produces smaller standard deviation of the RMSE and thus is more stable than most other methods.
The CC-SCAD only selects $13$ or $9$ variables since there are only $26$ or $16$ complete observations for $80\%$ or $85\%$ training sets, respectively. The DISCOM and DISCOM-Huber select more variables than other methods,
which is consistent with the simulation findings in Section \ref{SectionSim}.
Table 9
in the supplementary material provides the first NS variables most frequently selected by each method based on the $100$ training sets with $85\%$ missing rate, where NS is the mean number of variables selected by the corresponding method.
The $41$ variables selected by the proposed method contain $29$, $2$, and $10$ biomarkers from the MRI, PET, and gene expression, respectively, most of which are also selected by other methods. In particular, the two PET biomarkers (``{\ttfamily RIGHT\_LATERAL\_VENTRICLE}'' and ``{\ttfamily RIGHT\_CHOROID\_PLEXUS}'') are also selected by the DISCOM, and DISCOM-Huber, which represent SUVRs of the right lateral ventricle and the right choroid plexus, respectively. Note that the lateral ventricle and choroid plexus are indeed related to the AD [\citealp{apostolova2012hippocampal},
\citealp{krzyzanowska2012pathological}].
In addition, the ``{\ttfamily ST29SV},'' ``{\ttfamily ST40TA},'' ``{\ttfamily ST60TS},'' and ``{\ttfamily 11723246\_s\_at}'' are not only selected by the proposed method, but also selected by the CC-SCAD, DISCOM, and DISCOM-Huber. The ``{\ttfamily ST29SV},'' ``{\ttfamily ST40TA},'' and ``{\ttfamily ST60TS}'' are MRI features and represent the volume of the left hippocampus, the average cortical thickness of the left middle temporal gyrus, and the standard deviation of cortical thickness of the left temporal pole, respectively, which are all associated with the presence of AD [\citealp{galton2001differing}, \citealp{apostolova2012hippocampal}, \citealp{convit2000atrophy}, \citealp{arnold1994neuropathologic}].
The ``{\ttfamily 11723246\_s\_at}'' from the gene expression source represents the secreted frizzled related protein 1 (SFRP1) gene, which is elevated in brains of individuals with AD [\citealp{esteve2019elevated}, \citealp{tang2020enhancing}].
Furthermore, the ``{\ttfamily ST43TA}'' and ``{\ttfamily ST119TS}'' from the MRI source are only selected by the proposed method, representing the average cortical thickness of the left paracentral lobule and the standard deviation of cortical thickness of the right temporal pole, respectively. Note that the left paracentral lobule and the right temporal pole are also associated with AD [\citealp{yang2019study}, \citealp{kumfor2016right}].
In summary, the proposed method produces smaller RMSE for prediction in test sets than other competing methods with fewer selected variables, indicating that our method achieves better performance in variable selection. Moreover, the biomarkers selected by the proposed method are indeed important and relevant to the response variable, which are also confirmed by medical studies.
\vspace{-3mm}
\section{Discussion}
In this paper, we propose the multiple block-wise imputation approach to solve the block-wise missing problem arising from multi-source data. The proposed method improves variable selection accuracy through incorporating more information about missing covariates from incomplete case groups.
The existing methods for missing data do not fully utilize the structure of block-wise missing data to impute missing values and select relevant covariates. In contrast, the proposed MBI estimates missing variables within a group based on other group information, including complete and incomplete subject groups as well,
where the complete subject group contains more observed variables, while incomplete groups incorporate more samples.
Moreover, when integrating all the block-wise imputations and missing patterns, the proposed method imposes more weight on estimating functions from groups with either fewer missing values or more accurate imputation.
We show that the proposed method outperforms existing competitive methods in numerical studies, even for informative missing. Specifically, the proposed method is more powerful in handling informative missing data since the MBI reduces selection bias through aggregating more samples across different missing pattern groups than a single regression imputation based on complete cases.
In addition, we establish the asymptotic normality, estimation and variable selection consistency for the proposed estimator. We also show that the proposed estimator is asymptotically more efficient than the estimator with a single imputation based on the complete case group.
Although the MBI creates multiple predictions for each missing value to account for uncertainty of imputation, the proposed method is quite different from multiple imputation [\citealp{rubin2004multiple}] which draws multiple imputed values from a distribution, and utilizes each completed dataset separately. It is possible that the proposed method can be combined with MI through drawing more imputed values from the conditional distribution of missing variables, instead of relying on conditional expectation. In general, the idea of the MBI is flexible and can also be utilized with other predictive models besides the GLM, e.g., machine learning techniques such as the classification and regression tree-based approach \citep{loh2016classification}. Moreover, we can allow the inverse probability weighting in the MBI to adjust for unequal sampling in the future
\vspace{-3mm}
\section*{Acknowledgments}
The authors thank the editor, the associate editor, and reviewers for providing thoughtful comments and suggestions. This work is supported by NSF grants DMS 1821198 and DMS 1613190.
{\setstretch{1.2} \footnotesize
| {'timestamp': '2020-04-07T02:12:50', 'yymm': '1901', 'arxiv_id': '1901.03797', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03797'} | arxiv |
\section{Baselines and Feature Analysis}
\label{sec:baselines}
In this section, we extract several features following previous work~\cite{DBLP:conf/webdb/BhatiaM12, DBLP:conf/acl/DingCLZ08} and adopt different ML methods to build baseline models. In addition to reporting baseline performance, we also perform feature importance analysis to identify key factors in user intent prediction.
\subsection{Features}
\label{subsec:features}
\begin{table*}[ht]
\centering
\footnotesize
\caption{Features extracted for user intent prediction in information-seeking conversations.}
\label{tab:features}
\vspace{-0.3cm}
\begin{tabular}{ l l l l }
\toprule
Feature Name & Group & Description & Type \\
\midrule
Initial Utterance Similarity & Content & Cosine similarity between the utterance and the first utterance of the dialog & Real \\
Dialog Similarity & Content & Cosine similarity between the utterance and the entire dialog & Real \\
Question Mark & Content & Does the utterance contain a \textit{question mark} & Binary \\
Duplicate & Content & Does the utterance contain the keywords \textit{same}, \textit{similar} & Binary \\
5W1H & Content & Does the utterance contain the keywords \textit{what}, \textit{where}, \textit{when}, \textit{why}, \textit{who}, \textit{how} & One-hot vector \\ \hline
Absolute Position & Structural & Absolute position of an utterance in the dialog & Numerical \\
Normalized Position & Structural & Normalized position of an utterance in the dialog (AbsPos divided by \# utterances) & Real\\
Utterance Length & Structural & Total number of words in an utterance after stop words removal & Numerical \\
Utterance Length Unique & Structural & Unique number of words in an utterance after stop words removal & Numerical \\
Utterance Length Stemmed Unique & Structural & Unique number of words in an utterance after stop words removal and stemming & Numerical \\
Is Starter & Structural & Is the utterance made by the dialog starter & Binary\\ \hline
Thank & Sentiment & Does the utterance contain the keyword \textit{thank} & Binary \\
Exclamation Mark & Sentiment & Does the utterance contain an \textit{exclamation mark} & Binary \\
Feedback & Sentiment & Does the utterance contain the keyword \textit{did not}, \textit{does not} & Binary \\
Sentiment Scores & Sentiment & Sentiment scores of the utterance computed by VADER~\cite{DBLP:conf/icwsm/HuttoG14} (positive, neutral, and negative) & Real \\
Opinion Lexicon & Sentiment & Number of positive and negative words from an opinion lexicon & Numerical \\
\bottomrule
\end{tabular}
\end{table*}
We extract three groups of features to detect user intent in information-seeking conversations, including content, structural, and sentiment features. An overview of the features is provided in Table~\ref{tab:features}. Although MSDialog is derived from forum data, it is considered as a dialog dataset~\cite{Qu2018UserIntent}. Thus, we refrain from developing features that can only be extracted from the metadata of the forum, such as user authority level or answer votes, so that our method can be applicable to dialog systems. The features are designed to capture the content and sentiment characteristics of the utterances as well as the structural information of the dialogs.
\textbf{Content features}. We build a TF-IDF representation of utterances and compute the cosine similarity of the given utterance with the dialog initial utterance (which typically is the question that initiates the QA dialog), and the entire dialog. These features are meant to capture the relevance level of the given utterance to the dialog in a general way. In addition, the presence of question marks is a strong indicator that the current utterance contains a question. Moreover, we assume that 5W1H keywords (what, where, when, why, who, and how) can suggest the type of the question.
\textbf{Structural features}. The position of an utterance in a dialog can reveal crucial information about user intent. Intuitively, answers tend to be at even number positions in a dialog, while user feedback and follow up questions tend to be at odd number positions. In addition, we include the utterance length with and without duplication removal and stemming. We analyzed the data and found that utterances containing positive feedback are relatively short, while utterances containing questions or answers tend to be long as they typically contain details. Finally, if the given utterance is generated by the information seeker (dialog starter), it is more likely to contain user related questions or user feedback. The structural features not only provide individual characteristics for utterances, but also evaluate the utterances on a dialog level.
\textbf{Sentiment features}. We expect sentiment features to be useful in identifying user feedback and gratitude expressions. In information-seeking conversations, positive and negative sentiments do not necessarily determine the feedback type. However, we expect them to be correlated to some extent. We also include classic indicators of sentiment, such as the presence of ``thank'', ``does not/did not'' and exclamation marks. In addition, we use VADER~\cite{DBLP:conf/icwsm/HuttoG14} to compute the positive/negative/neutral sentiment scores. We also count the number of positive and negative words using an opinion lexicon~\cite{Liu:2005:OOA:1060745.1060797}.
\subsection{Methods and Evaluation Metrics}
\label{subsec:baseline-methods}
\subsubsection{Methods}
For each utterance, we extract a set of features as described in Section \ref{subsec:features}. To apply traditional ML methods with features to this task, we need to transform this multi-label classification problem to multi-class classification. Three transformation strategies are typically used: binary relevance, classifier chains, and label powerset. Binary relevance does not consider the label correlations and label powerset generates new labels for every label combination. So we choose classifier chains as the transformation strategy for traditional ML methods. This strategy performs binary classifications for each label and take predictions for previous labels as extra features. This transformation strategy is the best fit for our task as it considers the label dependency without explicitly generating new labels for every label combination. We adopt classic ML methods, including Naive Bayes classifier, SVM, random forest, and AdaBoost as baseline classifiers. In addition, we use ML-kNN, which supports multi-label classification by nature.
\subsubsection{Metrics}
Due to the nature of the intent prediction task, we adopt metrics suitable for multi-label classification problems.
\textbf{Accuracy} (Acc). It is known as the intersection over the union (IoU) in the multi-label classification settings. Accuracy is defined as the number of correctly predicted labels divided by the union of predicted and true labels for every utterance. For example, if the model predicts ``\textit{PA+CQ}'' for the given utterance while the ground truth is ``\textit{PA+IR}'', then the accuracy is $\frac{1}{3}$. The reported performance is the average metric over all utterances.
\textbf{Precision, recall and F1 score}. Precision is defined as the number of correctly predicted labels divided by predicted labels. Recall is defined as the number of correctly predicted labels divided by true labels. F1 is their harmonic mean. These metrics provide an overall performance evaluation for all utterances.
\subsection{Main Experiments and Results}
\label{subsec:baseline-exp}
\subsubsection{Experimental Setup}
\label{subsubsec:baseline-exp-setup}
We split the labeled subset of MSDialog into training, validation, and test sets. Table~\ref{tab:set-stats} gives the statistics of the three sets. We have to point out that although this dataset is not that large, the annotation cost for such fine-grained user intent in conversations is quite high (estimated around \$1,700 on MTurk according to~\cite{Qu2018UserIntent}). This dataset size is also larger than the data used in related work~\cite{DBLP:conf/webdb/BhatiaM12, Surendran2006Dialog}. The models are trained with scikit-multilearn\footnote{\url{http://scikit.ml/}} and scikit-learn\footnote{\url{http://scikit-learn.org/stable/}} on the training set. We tune the hyper-parameters on the validation set based on accuracy and report the performance on the test set.
\begin{table}[htbp]
\footnotesize
\centering
\caption{Statistics of training, validation, and testing sets}
\label{tab:set-stats}
\vspace{-0.3cm}
\begin{tabular}{@{}llll@{}}
\toprule
Item & Train & Val & Test \\ \midrule
\# Utterances & 8,064 & 986 & 970 \\
Min. \# Turns Per Dialog & 3 & 3 & 3 \\
Max. \# Turns Per Dialog & 10 & 10 & 10 \\
Avg. \# Turns Per Dialog & 4.58 & 4.48 & 4.43 \\
Avg. \# Words Per Utterance & 70.42 & 67.53 & 68.64 \\ \bottomrule
\end{tabular}
\end{table}
\subsubsection{Baseline Results}
\label{subsubsec:baselien-results}
The baseline results are presented in Table~\ref{tab:baseline-results}. Two ensemble methods, random forest and AdaBoost achieve the best overall performance of all baseline classifiers. AdaBoost achieves the best accuracy while random forest achieves the best F1\ignore{\jtcomment{check consistency of spelling ''F1'' or ''F-1''}} score. Surprisingly, ML-kNN performs relatively poorly despite its nature of an adapted algorithm for multi-label classification.
\begin{table}[htbp]
\footnotesize
\centering
\caption{Experiment results for baseline classifiers}
\label{tab:baseline-results}
\vspace{-0.3cm}
\begin{tabular}{@{}lllll@{}}
\toprule
Methods & Acc & Precision & Recall & F1 \\ \midrule
ML-kNN & 0.4715 & 0.6322 & 0.4471 & 0.5238 \\
NaiveBayes & 0.4870 & 0.5563 & 0.4988 & 0.5260 \\
SVM & 0.6342 & 0.7270 & 0.5847 & 0.6481 \\
RandForest & 0.6268 & \textbf{0.7657} & 0.5903 & \textbf{0.6667} \\
AdaBoost & \textbf{0.6399} & 0.7247 & \textbf{0.6030} & 0.6583 \\\bottomrule
\end{tabular}
\end{table}
\subsection{Additional Feature Importance Analysis}
\label{subsec:feature-importance}
\subsubsection{Feature Group Analysis}
\label{subsubsec:feature-group}
We use one of the best baseline classifiers, random forest, and different combinations of feature groups to analyze the feature importance on a group level. The hyper-parameters are set to the best ones tuned on all features .
For using a single feature group, structural features is the most important feature group as presented in Table~\ref{tab:feature-group}. Structural features and content features are significantly more important than sentiment features. We expect the sentiment features to capture the sentiment in user feedback but they might not be able to effectively discriminate other user intent. Structural features provide better performance than content features. We believe that this can be explained by the fact that hand-crafted content features cannot capture the complex user intent dynamics in human information-seeking conversations.
\begin{table}[htbp]
\footnotesize
\centering
\caption{Experiment results for different feature groups}
\label{tab:feature-group}
\vspace{-0.3cm}
\begin{tabular}{lllll}
\toprule
Group(s) & Acc & Precision & Recall & F1 \\ \midrule
Content & 0.5272 & 0.6097 & 0.4821 & 0.5384 \\
Structural & \textbf{0.5809} & \textbf{0.6871} & \textbf{0.5434} & \textbf{0.6068} \\
Sentiment & 0.3306 & 0.4087 & 0.3222 & 0.3603 \\ \hline
Con+Str & 0.6081 & 0.7393 & 0.5640 & 0.6399 \\
Con+Sen & 0.5577 & 0.6523 & 0.5179 & 0.5774 \\
Str+Sent & \textbf{0.6110} & \textbf{0.7569} & \textbf{0.5672} & \textbf{0.6485} \\ \hline
All & \textbf{0.6268} & \textbf{0.7657} & \textbf{0.5903} & \textbf{0.6667} \\ \bottomrule
\end{tabular}
\end{table}
For combinations of two feature groups, content+structural features and structural+sentiment features achieve comparable results. However, structural+sentiment features achieve slightly higher results on all metrics. The performance of using two groups of features is higher than using one of these two feature groups individually. Thus, combining structural features with another feature group boosts the performance of using structural features alone. Interestingly, content+sentiment features is unable to outperform the structural features alone. The results of using all features is the highest among all settings, confirming that all feature groups contribute to the performance of user intent prediction.
\subsubsection{Feature Importance Scores}
\label{subsubsec:feature-scores}
In the previous section, we evaluated the feature importance on a group level. In this section we focus on individual features to provide a more fine-grained analysis. We use random forest to output individual feature importance scores.\footnote{\url{https://scikit-learn.org/stable/auto_examples/ensemble/plot_forest_importances.html}} As described in Section~\ref{subsec:baseline-methods}, we used classifier chains to transform this multi-label classification problem. This method expands the feature space by including previous label predictions as new features for the current label prediction. This makes it not appropriate to evaluate original features. Thus, we use the Label Powerset method as the data transformation strategy for this section. The relative feature importance scores are presented in Table~\ref{tab:feature-importance}. This analysis can identify key factors in user intent prediction.
\begin{table}[htbp]
\footnotesize
\centering
\caption{Individual feature importance from a random forest classifier with relative importance scores. ``Str'', ``Con'', ``Sen'' refer to ``Structural'', ``Content'', ``Sentiment'' respectively.}
\vspace{-0.3cm}
\label{tab:feature-importance}
\begin{tabular}{llll|llll}
\toprule
Rank & Feature & Group & Impt & Rank & Feature & Group & Impt \\ \midrule
1 & AbsPos & Str & 1.0 & 13 & Lex(Pos) & Sen & 0.2814 \\
2 & InitSim & Con & 0.9745 & 14 & Lex(Neg) & Sen & 0.2337 \\
3 & NormPos & Str & 0.8684 & 15 & Thank & Sen & 0.1607 \\
4 & Starter & Str & 0.8677 & 16 & How & Con & 0.08074 \\
5 & DlgSim & Con & 0.6778 & 17 & Dup & Con & 0.06908 \\
6 & SenScr(Neu) & Sen & 0.6465 & 18 & What & Con & 0.06576 \\
7 & SenScr(Pos) & Sen & 0.5601 & 19 & ExMark & Sen & 0.06424 \\
8 & Len & Str & 0.5335 & 20 & When & Con & 0.05989 \\
9 & LenUni & Str & 0.4381 & 21 & Feedback & Sen & 0.02859 \\
10 & LenStem & Str & 0.4354 & 22 & Where & Con & 0.02356 \\
11 & SenScr(Neg) & Sen & 0.3495 & 23 & Why & Con & 0.0232 \\
12 & QuestMark & Con & 0.3003 & 24 & Who & Con & 0.01423 \\ \bottomrule
\end{tabular}
\end{table}
We summarize our observations as follows:
(1) Structural features including ``Absolute Position'', ``Normalized
Position'', ``Is Starter'' are ranked in the top-5 in terms of feature importance. Moreover, other structural features, such as various forms of utterance length are observed to be relatively informative in general. This confirms the results in Section~\ref{subsubsec:feature-group} that the structural feature group is the most important one.
(2) ``Initial Utterance Similarity'' and ``Dialog Similarity'' are content features that can be highly informative for identifying user intent. Both features are indicators of how closely the utterance connects with the information-seeking process. Other content features, such as ``5W1H'', however, contribute little to predicting user intent.
(3) Some sentiment features are relatively important in identifying user intent, such as positive and neutral sentiment scores. However, some other sentiment features contribute little to the task, such as the existence of exclamation marks and ``thank''.
(4) We observe that features ranked from the 15\textsuperscript{th} to the last one in Table~\ref{tab:feature-importance} are all ``keyword features''. These features are based on a simple rule that whether the given utterance contains pre-defined keywords. For example, the ``5W1H'' feature looks for ``what/where/when/why/who/how'' in the given utterance and the ``Feedback'' feature looks for ``did not/does not''. The major drawback of manual feature engineering is amplified in this task due to the complexity and diversity of human information-seeking conversations.
\section{Conclusions}
\label{sec:conclusion}
In this paper, we studied two approaches to predict user intent in information-seeking conversations. First we use different ML methods with a rich feature set, including the content, structural, and sentiment features. We perform thorough feature importance analysis on both group level and individual level, which shows that structural features contribute most in this prediction task. Given findings from feature analysis, we construct enhanced neural classifiers to incorporate context information for user intent prediction. The enhanced neural model without feature engineering outperforms the baseline models by a large margin. Our findings can provide insights in the important factors of user intent prediction in information-seeking conversations. Future work will consider other methods for user intent prediction. Utilizing the predicted user intent to rank or generate conversation responses in an information-seeking setting is also interesting to explore.
\section{Task Definition and Dataset}
\label{sec:task-and-data}
\subsection{Task Definition}
\label{subsec:task}
The research problem of user intent prediction in information-seeking conversations is defined as follows. The input of the system is an information-seeking dialog dataset $\mathcal{D} = \{(\mathcal{U}_i, \mathcal{Y}_i)\}_{i=1}^N$ and a set of user intent labels $ \mathcal{L} = \{l_1, l_2, \dots, l_c\} $. A dialog $ \mathcal{U}_i = \{u_i^1, u_i^2, \dots, u_i^{k}\} $ contains multiple turns of utterances. $u_i^{k}$ is the utterance at the $k$-th turn of the $i$-th dialog. $\mathcal{Y}_i$ consists of annotated user intent labels $ \{\mathbf{y}_i^1, \mathbf{y}_i^2, \dots, \mathbf{y}_{i}^k\} $, where $\mathbf{y}_i^k = \{y_i^{k(1)}, y_i^{k(2)}, \dots, y_i^{k(c)}\}$. Here $y_i^{k(m)}, \dots, y_i^{k(n)} = 1$ denotes that the utterance $u_i^{k}$ in dialog $\mathcal{U}_i$ is labeled with user intent \{$l_m, \dots, l_n $\}. Given an utterance $u_i^{k}$ and other utterances in dialog $\mathcal{U}_i$, the goal is to predict the user intent $\mathcal{Y}_i$ of this utterance. The challenge of this task lies in the complexity and diversity of human information-seeking conversations, where one utterance often expresses multiple user intent~\cite{Trippas:2018:IDS:3176349.3176387}.
\subsection{Dataset}
\label{subsec:data}
We use the MSDialog dataset that consists of technical support dialogs for Microsoft products.
The data was crawled from the well-moderated Microsoft Community forum\footnote{\url{https://answers.microsoft.com}} which contains high-quality technical support dialogs between users and agents.
The agents include Microsoft staff, community moderators, MVPs, or other experienced product users. Very rich structured data were collected with the dialogs, including the question popularity, answer vote, affiliation of information providers, etc. We choose this dataset because of its information-seeking nature and the well annotated user intent.
Although MSDialog has limitations such as a narrow subject domain and forum-style language, no other openly available dialog datasets with the same detailed annotation exist. We believe this should be a first step to predict user intent in an information-seeking setting.
The dataset contains two sets, a complete set that consists of all the crawled dialogs and a labeled subset that contains only dialogs with user intent annotation. A taxonomy of 12 labels presented in Table~\ref{tab:taxonomy} were developed in~\citet{Qu2018UserIntent} based on work by ~\citet{DBLP:conf/webdb/BhatiaM12} to characterize the user intent in information-seeking conversations. We also present the user intent distribution in Table~\ref{tab:taxonomy}. The complete set consists of 35,000 multi-turn QA dialogs in the technical support domain. Over 2,000 dialogs were selected for user intent annotation on MTurk with the following criteria: (1) With 3 to 10 turns. (2) With 2 to 4 participants. (3) With at least one correct answer selected by the community. (4) Falls into one of the categories of following major Microsoft products: Windows, Office, Bing, and Skype. The inter-rater agreement score was used to ensure the annotation quality. One utterance can be labeled with more than one user intent. A comparison of statistics between the complete set and the labeled subset is presented in Table~\ref{tab:compare-stats}.
\begin{table}[ht]
\centering
\footnotesize
\caption{User intent taxonomy and distribution in MSDialog}
\label{tab:taxonomy}
\vspace{-0.3cm}
\begin{tabular}{llll}
\toprule
\hspace{-0.08in} Code & \hspace{-0.1in} Label \hspace{-0.1in} & Description \hspace{-0.1in} \hspace{-0.1in} & \% \\ \hline
\hspace{-0.08in} OQ & \hspace{-0.18in} Original Question \hspace{-0.15in} & The first question from the user to initiate the dialog. \hspace{-0.15in} & 13 \\
\hspace{-0.08in} RQ & \hspace{-0.18in} Repeat Question \hspace{-0.15in} & Other users repeat a previous question. \hspace{-0.15in} & 3 \\
\hspace{-0.08in} CQ & \hspace{-0.18in} Clarifying Question \hspace{-0.15in} & User or agent asks for clarifications. \hspace{-0.15in} & 4 \\
\hspace{-0.08in} FD & \hspace{-0.18in} Further Details \hspace{-0.15in} & User or agent provides more details. \hspace{-0.15in} & 14 \\
\hspace{-0.08in} FQ & \hspace{-0.18in} Follow Up Question \hspace{-0.15in} & User asks for follow up questions about relevant issues. \hspace{-0.15in} & 5 \\
\hspace{-0.08in} IR & \hspace{-0.18in} Information Request \hspace{-0.15in} & Agent asks for information from users. \hspace{-0.15in} & 6 \\
\hspace{-0.08in} PA & \hspace{-0.18in} Potential Answer \hspace{-0.15in} & A potential answer or solution provided by agents. \hspace{-0.15in} & 22 \\
\hspace{-0.08in} PF & \hspace{-0.18in} Positive Feedback \hspace{-0.15in} & User provides positive feedback for working solutions. \hspace{-0.15in} & 6 \\
\hspace{-0.08in} NF & \hspace{-0.18in} Negative Feedback \hspace{-0.15in} & User provides negative feedback for useless solutions. \hspace{-0.15in} & 4 \\
\hspace{-0.08in} GG & \hspace{-0.18in} Greetings/Gratitude \hspace{-0.15in} & Greetings or expressing gratitude. \hspace{-0.15in} & 22 \\
\hspace{-0.08in} JK & \hspace{-0.18in} Junk \hspace{-0.15in} & No useful information in the utterance. \hspace{-0.15in} & 1 \\
\hspace{-0.08in} O & \hspace{-0.18in} Others \hspace{-0.15in} & Utterances cannot be categorized using other classes. \hspace{-0.15in} & 1 \\ \bottomrule
\end{tabular}
\end{table}
\begin{table}[ht]
\footnotesize
\centering
\caption{Statistics of MSDialog (complete \& labeled subset)}
\label{tab:compare-stats}
\vspace{-0.3cm}
\begin{tabular}{@{}lll@{}}
\toprule
Items & Complete set & Labeled subset \\ \midrule
\# Dialogs & 35,000 & 2,199 \\
\# Utterances & 300,000 & 10,020 \\
\# Words (in total) & 24,000,000 & 653,000 \\
Avg. \# Participants & 3.18 & 2.79 \\
Avg. \# Turns Per Dialog & 8.94 & 4.56 \\
Avg. \# Words Per Utterance & 75.91 & 65.16 \\
\bottomrule
\end{tabular}
\end{table}
In order to test the generalization performance of our findings, we use a small portion of UDC that is annotated with the same user intent types. This dataset also consists of multi-turn information-seeking conversations in a technical support domain between an information seeker and provider. However, UDC is generated from internet relay chat (IRC) and contains a significant amount of typos, Internet language, and abbreviations. In addition, UDC contains shorter utterances and more turns per dialog. This part of experiment is presented in Section~\ref{subsec:udc}.
\subsection{Data Preprocessing}
\label{subsec:data-transformation}
The purpose of this classification task is to identify and predict user intent so that CAs can process the information accordingly to satisfy the users' information needs. However, utterances which were labeled \textit{Greetings/Gratitude}, \textit{Junk}, and \textit{Others} do not contribute to the purpose of providing information about QA related user intent. Therefore, we remove occurrences of these labels. Note that we only remove these labels if there are more than one label of the given utterance. For example, if the annotation for the given utterance is \textit{GG+OQ}, we transform the annotation into \textit{OQ}. If the annotation is just \textit{GG}, no transformation is needed. This reduces the number of unique label combinations from 316 to 152.
In addition, some label combinations of user intent labels are quite rare in the data. As indicated in Figure~\ref{fig:label-dist}, the top frequent label combinations have hundreds of occurrences in the data (e.g. \textit{PA}, \textit{OQ}, \textit{PF}, \textit{FD+PA}, \textit{FD}), while the least frequent labels only have exactly one occurrence (e.g. \textit{CQ+FD+IR+RQ}, \textit{CQ+FD+FQ+PF}). These rare label combinations are very likely due to minor annotation errors or noise with MTurk. Annotation quality assurance was performed based on the dialog-level inter-rater agreement~\cite{Qu2018UserIntent} to keep the complete dialog intact and thus may result in minor noise on an utterance level. We also plot the cumulative distribution of label combinations for better illustration in Figure~\ref{fig:label-dist-incre}. The most frequent 32 label combinations constitute 90\% of total label combination occurrences as marked in the figure. All 12 user intent labels are individually present in these 32 most frequent combinations except for \textit{Others}. For the rest of the label combinations, we randomly sample one of the labels from each combination as the user intent label for the given utterance. For example, if the annotation for the given utterance is \textit{CQ+FD+IR+RQ}, we transform it into a single label by randomly sampling one of the four labels, such as \textit{CQ}. Therefore, the total number of label combinations in the data was reduced to 33 (including \textit{Others}).
We adopted this setting since these rare label combinations are very likely due to minor annotation errors.
In addition, it would be very difficult to learn a prediction model for these label combinations with few instances.
\begin{figure}[h!]
\begin{subfigure}[t]{.23\textwidth}
\centering
\includegraphics[width=.9\textwidth]{img/label_dist.pdf}
\caption{Label combination occurrence from the most frequent to the least frequent.}
\label{fig:label-dist}
\end{subfigure}\hfill
\begin{subfigure}[t]{.23\textwidth}
\centering
\includegraphics[width=.9\textwidth]{img/label_dist_incre.pdf}
\caption{Cumulative occurrence probability added from the most frequent to the least frequent. The marked point is $(32, 0.9)$.}
\label{fig:label-dist-incre}
\end{subfigure}
\vspace{-0.3cm}
\caption{Label combination distribution}
\end{figure}
For UDC, we observe a similar label combination distribution. So we preprocess the data in the same way. We have 34 label combinations for the UDC with 27 of them overlapping with MSDialog.
\section{Introduction}
\label{sec:intro}
Many companies have launched conversational assistants (CA) such as Amazon Echo, Google Home, Microsoft Cortana, etc. These devices allow users to issue voice commands to the CA for goal oriented tasks or to conduct simple question answering (QA) tasks, such as adding calendar events or asking for news.
This trend has led many researchers in the information retrieval (IR) and natural language processing (NLP) community to pay more attention to conversational search. For examples, SIGIR'18, ICTIR'17, and EMNLP'18 all have workshops\footnote{\url{https://sites.google.com/view/cair-ws/cair-2018}}\textsuperscript{,}\footnote{\url{http://sigir.org/ictir2017/sessions/search-oriented-conversational-ai-scai/}}\textsuperscript{,}\footnote{\url{https://scai.info/}} on conversational search.
\if0
However, most CAs are not yet capable of handling multi-turn information-seeking conversations, where users have multiple rounds of information exchange with CAs to retrieve answers. This kind of conversations can be best described as a joint effort between human users and CAs in an exploratory manner. Different from single-turn QA, conversational QA requires CAs to proactively ask or confirm before presenting an answer~\cite{DBLP:journals/corr/LiMCRW16a} and expect user feedback after presenting an answer. Despite the effort of all the major internet companies, iterative answer finding with CAs has not yet been achieved. A main reason is the failure to model the conversation bout the information need both before and after an answer has been given.
The key to the solution is to accurately detect and predict user intent in this interactive information-seeking process. Concretely, CAs would be capable to improve previous answers if it can correctly process critical information provided by the users, such as relevance judgment (feedback) and clarifications of the information need. Moreover, we expect CAs to request more information proactively when they are not confident to provide an answer.
\fi
However, most CAs are not yet capable of handling multi-turn information-seeking conversations, where users have multiple rounds of information exchange with CAs to retrieve or specify answers.
One reason is the difficulty to model the conversation about the information need both before and after an answer has been given. Thus an important step in modeling conversational interactions is to accurately detect and predict user intent in this interactive information-seeking process. More specifically, CAs should be capable of improving previous answers if they can correctly process critical information provided by the users, such as relevance judgments (feedback) and clarifications of the information need. Thus, CAs need to elicit more information proactively when they are not confident, before providing an answer~\cite{Trippas:2018:IDS:3176349.3176387}.
The Learn-IR workshop\footnote{\url{https://task-ir.github.io/wsdm2018-learnIR-workshop/}} at WSDM'18 highlighted the significant research need for user intent analysis and prediction in an interactive information-seeking process. To address this research demand, we conducted experiments on user intent prediction using the MSDialog~\cite{Qu2018UserIntent} data. This data collection consists of multi-turn information-seeking dialogs in the technical support domain. The dialogs are typically initiated by an information seeker who asks technical issues about Microsoft products, such as ``How do I downgrade from Windows 10 to Windows 7?''. This kind of question is non-factoid and often requires multiple rounds of conversational interactions. The answers are provided by Microsoft staff and other experienced product users such as ``Microsoft Most Valuable Professionals'' (MVPs).
These human agents (information providers) also explicitly ask for feedback on their provided answers and thus keep the users engaged. The MSDialog data is annotated with a set of 12 \textit{user intent types}~\cite{DBLP:conf/webdb/BhatiaM12, Qu2018UserIntent}. There are different definitions of ``user intent'' in our field. In this paper, user intent refers to a taxonomy of utterances in information-seeking conversations (Table~\ref{tab:taxonomy}). Each utterance of the MSDialog was annotated with the user intent types using Amazon Mechanical Turk (MTurk)\footnote{\url{https://www.mturk.com/}}. MSDialog provides a high-quality resource to show how information-seeking conversations are structured between humans. In addition to MSDialog, we also used a portion of Ubuntu Dialog Corpus (UDC)~\cite{Lowe2015The} which was annotated with the same user intent types in~\cite{Qu2018UserIntent} to further validate our findings.
The purposes of user intent prediction are threefold. First, it is necessary for CAs to accurately identify user intent in information-seeking conversations. Only in this way can CAs process the information accordingly and use it to provide answers and adjust previous answers. Similar to customer service over phones, routing user questions to different sub-modules in a conversational retrieval system is only possible if the user intent is correctly identified. Second, the CAs need to learn and imitate the behavior of human agents.
By identifying user intent in information-seeking conversations, we expect the CA to learn the use of different intent and when to issue requests for more information or details spontaneously. Finally, user intent prediction models can be used to automatically annotate more dialog utterances for data analysis and other tasks such as conversational answer finding.
Previous work typically focused on dialog act classification for open-domain conversations~\cite{Stolcke2000Dialogue, LiuEMNLP17, Khanpour2016DialogueAC}. In human-computer chitchat, the goal of the CA is to generate responses that are as realistic as possible with the primary purpose of entertaining. In contrast to chatting, users initiate information-seeking conversations for specific information needs. Human behaviors in chatting and information-seeking conversations can be very different due to the fundamentally distinct purposes. In addition, the Dialog State Tracking Challenges (DSTC)\footnote{\url{https://www.microsoft.com/en-us/research/event/dialog-state-tracking-challenge/}} focus on goal oriented conversations. These tasks are typically tackled with slot filling~\cite{Zhang:2016:JMI:3060832.3061040, DBLP:conf/aaai/YanDCZZL17}. In information-seeking conversations, slot filling is not suitable because of the diversity of information needs. User intent analysis and prediction are needed for an information-seeking setting.
We conduct experiments using two different approaches to predict user intent in information-seeking conversations. Firstly, we extract rich features to capture the content, structural, and sentiment
characteristics of utterances and learn models with traditional machine learning (ML) methods. Secondly, we use the implicit representation learning in neural architectures to predict user intent without feature engineering. We then incorporate context information into neural models for enhanced performance.
\if0
Our contributions can be summarized as follows:
\textbf{(1) We created a conversation dataset called \textit{MSDialog}.} It consists of multi-turn information-seeking dialogs in the technical support domain. We also annotated utterance level user intent in conversations with MTurk. We will release this data with annotated user intent labels to the research community.
\textbf{(2) We identified the key factors in user intent prediction.} We designed and extracted rich features to predict user intent in information-seeking conversations. These features can be classified into three groups: content, structural, and sentiment. We performed in-depth feature importance analysis on both group level and individual level.
\textbf{(3) We designed enhanced neural classifiers to predict user intent without explicit feature engineering.} We conducted experiments with several variations of neural models with different incorporated information. We proved that neural models can achieve comparable performances without feature engineering. Moreover, neural models achieved statistically significant improvements over traditional methods after incorporating context information.
\fi
Our contributions can be summarized as follows. (1) We extract rich features including feature groups related to content, structures, and sentiment to predict user intent in information-seeking conversations. We perform an in-depth feature importance analysis on both group and individual level to identify the key factors in this task. (2) We design several variations of neural classifiers to predict user intent without explicit feature engineering. We show that neural models can achieve comparable performance compared to feature engineering based methods. Moreover, neural models achieve statistically significant improvements over traditional methods after incorporating context information. (3) Our experiments show that the trained model achieves good generalization performance on another open benchmark information-seeking conversation dataset (UDC). The code of the implemented user intent prediction models will be released to the research community.\footnote{\url{https://github.com/prdwb/UserIntentPrediction}}
The rest of our paper is organized as follows. In Section~\ref{sec:relatedwork}, we present related work regarding utterance type classification, conversational search, and multi-turn question answering. In Section~\ref{sec:task-and-data}, we formulate the research question of user intent prediction in information-seeking conversations. We also describe the data creation and annotating process. In Section~\ref{sec:baselines}, we extract rich features and learn traditional ML models for user intent prediction. We also perform feature importance analysis in this section. In Section~\ref{sec:neural-models}, we introduce various enhanced neural classifiers for user intent prediction. Section~\ref{sec:conclusion} presents the conclusion and future work.
\section{Enhanced Neural Classifiers}
\label{sec:neural-models}
We expected the content of an utterance to be a good indicator of user intent types compared to other features. \ignore{\lycomment{This is an overclaim. How about structure features like the ``Absolute Position'' ? You can say ``the content and sequential information of utterances is important for user intent type prediction''. or ''to the best of our knowledge...''} }However, as shown in Section~\ref{subsec:feature-importance}, the hand-crafted content features are unable to capture the complex characteristics of human information-seeking conversations. Thus, in this section we adopt neural architectures to automatically learn representations of utterances without feature engineering.
\subsection{Our Approach}
\label{subsec:our-approach}
\subsubsection{Base Models}
\label{subsubsec:cnn}
Given the previous success in modeling text sequences using CNN and bidirectional LSTM (BiLSTM)~\cite{GRAVES2005602}, we choose these two architectures as our base models. Although utterances are grouped as dialogs, the base models consider utterances independently.
Given an utterance $u_i^{k} = \{w_1, w_2, \dots, w_m\}$ (the $k$-th utterance in the $i$-th dialog) that contains $m$ tokens, we first transform the sequence of tokens into a sequence of token indices $\bm{S} = \{s_1, s_2, \dots, s_m\}$. Then we pad the sequence $\bm{S}$ to a fixed length $n$ (the max sequence length).
Both CNN and BiLSTM start with an embedding layer initiated with pre-trained word embeddings. Preliminary experiments indicated that using MSDialog (complete set) to train word embeddings is more effective than using GloVe~\cite{pennington2014glove} in terms of final model performance. The embedding layer maps each token in the utterances to a word embedding vector with a dimension of $d$.
We focus on the CNN model following previous work~\cite{DBLP:conf/emnlp/Kim14} here, because it achieves better performance in our experiments. After the embedding layer, filters with the shape $(f, d)$ are applied to a window of $f$ words. $f$ is also referred to as the filter size. Concretely, a convolution operation is denoted as
\begin{footnotesize}
\begin{equation}\label{eqn:conv}
\begin{aligned}
c_i = \sigma(\mathbf{w} \cdot \mathbf{e}_{i:i+f-1} + b)
\end{aligned}
\end{equation}
\end{footnotesize}
Where $c_i$ is the feature generated by the $i$-th filter with weights $\mathbf{w}$ and bias $b$. This filter is applied to an embedding matrix, which is the concatenation from the $i$-th to the $(i+f-1)$-th embedding vectors. An non-linearity function (ReLU) is also applied. This operation is applied to every possible window of words and generates a feature map $\mathbf{c} = \{c_1, c_2, \dots, c_{n-f+1}\}$. More filters are applied to extract features of the utterance content. Max pooling are applied to select the most salient feature of a window of $f'$ features by taking the maximum value $\hat{c_i} = max\{\mathbf{c}_{i:i+f'-1}\}$. $f'$ denotes the max pooling kernel size. A dropout layer is applied after the pooling layer for regularization.
After the last convolutional layer, we perform global max pooling by taking the maximum value $\hat{c} = max\{\mathbf{c}\}$ for the feature map $\mathbf{c}$ at this step. This operation reduces the dimension of the tensor to one. This tensor is further transformed to an output tensor of shape $(1, l)$, where $l$ is the number of user intent labels (12 for our task). Sigmoid activation is applied to each value of the output tensor to squash the value to a confidence level between 0 and 1. A threshold is chosen to determine whether the given label present in the final prediction. If the model is not confident of predicting any label, the label of the highest confidence level is the prediction. We tuned the threshold with the validation data.
\subsubsection{Incorporate Context Information}
\label{subsubsec:cnn-context}
As shown in the previous work~\cite{Qu2018UserIntent}, user intent follows clear flow patterns in information-seeking conversations. The user intent of a given utterance is closely related to the utterances around it, which compose the \textit{context} for the given utterance. Incorporating context information into neural models is easier compared to that for traditional ML methods shown in Section~\ref{sec:baselines}. We consider two ways as follows.
\textbf{Direct Expansion}. The most straightforward way to incorporate context information is to expand the given utterance with its context. Concretely, the expanded utterance for $u_i^k$ is $\hat{u}_i^k = u_i^{k-1} \oplus u_i^{k} \oplus u_i^{k+1} $, where $\oplus$ is the concatenate operator. $\hat{u}_i^k$ is considered as the given utterance in base models.
\textbf{Context Representation}. Given an expanded utterance $\hat{u}_i^k$ as input, the neural architecture first segments it into three original utterances of $u_i^{k - 1}$, $u_i^{k}$, and $u_i^{k + 1}$. We apply convolution operations and max pooling to the utterances separately as shown in Figure~\ref{fig:cnn-context-rep}. After global pooling following the last convolutional layer, the three one-dimensional tensors are concatenated for final predictions. This approach extracts features from the given utterance and its context separately. Thus, we are able to learn the importance of the given utterance and its context by tuning context-specific hyper-parameters, such as the number of filters for context utterances.
\begin{figure}[ht]
\begin{subfigure}[t]{.281\textwidth}
\centering
\includegraphics[width=.99\textwidth]{img/CNN-Context-Rep_crop.pdf}
\vspace{-0.14in}
\caption{CNN-Context-Rep}
\label{fig:cnn-context-rep}
\end{subfigure}\hfill
\begin{subfigure}[t]{.189\textwidth}
\centering
\includegraphics[width=.99\textwidth]{img/CNN-Feature_crop.pdf}
\vspace{-0.14in}
\caption{CNN-Feature}
\label{fig:cnn-feature}
\end{subfigure}
\vspace{-0.3cm}
\caption{Architectures for enhanced neural classifiers. Components marked orange are extra information incorporated into the base CNN model (black). The utterance in bold is the current utterance. Predicted labels are marked blue.}
\end{figure}
\subsubsection{Incorporate Extra Features}
\label{subsubsec:cnn-feature}
We found many useful features for user intent prediction such as structural features in the feature importance analysis in Section~\ref{subsec:feature-importance}.
However, nearly half of the features can not be exploited by only looking at a single utterance. For example, normalized/absolute utterance position and utterance similarity with the dialog/initial utterance cannot be captured without a holistic view over the entire dialog. Some of the uncaptured features are highly informative. This motivates us to incorporate hand-crafted features into the neural architectures. As shown in Figure~\ref{fig:cnn-feature}, all hand-crafted features described in Section~\ref{subsec:features} are incorporated into neural architectures at the last dense layer. The feature vector is concatenated with the neural representation of the utterance before making final predictions.
Finally, we combine two base models with various extra components to produce several systems for comparison as follows:
\begin{itemize}[leftmargin=*]
\item \textbf{CNN}. The base CNN model that consists of three convolutional layers with the same filter size.
\item \textbf{CNN-Feature}. The CNN model that incorporates extra hand-crafted features at the last layer.
\item \textbf{CNN-Context}. The CNN model that incorporates context information with direct expansion.
\item \textbf{CNN-Context-Rep}. The CNN model that incorporates context information with context representation.
\item \textbf{BiLSTM}. The BiLSTM model that represents the given utterance both in the ordinary order and the reverse order.
\item \textbf{BiLSTM-Context}. The BiLSTM model that incorporates context information with direct expansion.
\end{itemize}
\subsection{Experiments and Evaluation}
\label{subsec:exp}
\subsubsection{Neural Baselines}
\label{subsubsec:neural-baselines}
In addition to the base model of \textbf{BiLSTM} and \textbf{CNN}, we further introduce two commonly used neural models for text classification as baselines. For both new baselines, we modify the models to generate multi-label predictions.
\textbf{CNN-MFS}. The CNN model with multiple filter sizes as described by~\citet{DBLP:conf/emnlp/Kim14} is a pioneer model to apply neural networks to text classification. This model uses different filter sizes of 3, 4, and 5 to generate feature maps of different window sizes.
\textbf{Char-CNN}. \citet{DBLP:conf/nips/ZhangZL15} introduced a character-level CNN for text classification. There are two variants of the model, a large one and a small one, depending on the numbers of convolutional filters and dense layer units. We report the performance on the small model as it achieves better results in our task.
\subsubsection{Experimental Setup}
\label{subsubsec:exp-setup}
We use the same data and metrics as in baseline experiments in Section~\ref{sec:baselines}. All models are implemented with TensorFlow\footnote{\url{https://www.tensorflow.org/}} and Keras\footnote{\url{https://keras.io/}}. Hyper-parameters are tuned with the validation data. We found that setting (convolutional filters, dropout rate, dense layer units, max sequence length, convolutional filters for context, and dense layer units for context) to (1024, 0.6, 256, 800, 128, 128) respectively turned out to be the best setting for our best performing model CNN-Conext-Rep. The convolutional filter size and pooling size are set to (3, 3). All models are trained with a NVIDIA Titan X GPU using Adam~\cite{DBLP:journals/corr/KingmaB14}. The initial learning rate is 0.001. The parameters of Adam, $\beta_1$ and $\beta_2$ are 0.9 and 0.999 respectively. The batch size is 128. For the word embedding layer, we trained word embeddings with Gensim\footnote{\url{https://radimrehurek.com/gensim/}} with CBOW model using MSDialog (complete set). The dimension of word embedding is 100. Word vectors are set to trainable.
\subsubsection{Evaluation Results}
\label{subsubsec:evaluation-results}
We select the two strongest feature based classifiers from Section~\ref{sec:baselines} as feature based baselines in addition to neural baselines. They are random forest with the best F1 score and AdaBoost with the best accuracy. The performance comparison of models is presented in Table~\ref{tab:neural-results}.
\begin{table}[ht]
\centering
\footnotesize
\caption{Results comparison. The significance test can only be performed on accuracy. In a multi-label classification setting, accuracy gives a score for each individual sample, while other metrics evaluate the performance over all samples. $\ddagger$ means statistically significant difference over the best baseline with $p < 10^{-4}$ measured by the Student's paired t-test.}
\label{tab:neural-results}
\vspace{-0.3cm}
\begin{tabular}{@{}llllll@{}}
\toprule
Method Types & Methods & Accuracy & Precision & Recall & F1 \\ \midrule
\multirow{2}{*}{\begin{tabular}[c]{@{}l@{}}Feature based \\ Baselines\end{tabular}} & Random Forest & 0.6268 & \textbf{0.7657} & 0.5903 & \textbf{0.6667} \\
& AdaBoost & \textbf{0.6399} & 0.7247 & \textbf{0.6030} & 0.6583 \\ \midrule
\multirow{4}{*}{\begin{tabular}[c]{@{}l@{}}Neural \\ Baselines\end{tabular}} & BiLSTM & 0.5515 & 0.6284 & 0.5274 & 0.5735 \\
& CNN & \textbf{0.6364} & 0.7152 & \textbf{0.6054} & \textbf{0.6558} \\
& CNN-MFS & 0.6342 & \textbf{0.7308} & 0.5919 & 0.6541 \\
& Char-CNN & 0.5419 & 0.6350 & 0.4940 & 0.5557 \\ \midrule
\multirow{4}{*}{\begin{tabular}[c]{@{}l@{}}Neural\\ Classifiers\end{tabular}} & BiLSTM-Context & 0.6006 & 0.6951 & 0.5640 & 0.6227 \\
& CNN-Feature & 0.6509 & 0.7619 & 0.6110 & 0.6781 \\
& CNN-Context & 0.6555 & 0.7577 & 0.6070 & 0.6740 \\
& CNN-Context-Rep & \textbf{0.6885}$^\ddagger$ & \textbf{0.7883} & \textbf{0.6516} & \textbf{0.7134} \\ \bottomrule
\end{tabular}
\end{table}
The base CNN model without feature engineering achieves similar results with the strongest feature based baselines. The performance of the base CNN model is better than the base BiLSTM model. CNN-MFS takes advantage of different filter sizes and also achieves comparable results. Char-CNN, however, performs poorly in this task. Char-CNN does not use pre-trained word embeddings because it learns features from a character-level which would require much more training data.
BiLSTM performs poorly in this task. Even though BiLSTM-Context has a major improvement over BiLSTM, it has inferior results compared to the base CNN model. Compared to non-factoid question answering or chatting, utterances in information-seeking conversations tend to be longer. BiLSTM(-Context) tries to model a holistic sequence dependency and thus performs poorly on handling these long utterances.
The best result of the feature based baselines is slightly higher than neural baselines. This can be accounted for by the lack of information in neural models. Even though we assume that most of the content and sentiment features can be learned by neural models, the neural models have no access to most of the structural features. Thus, we incorporate all the features to neural models to produce CNN-Feature model. This model outperforms all baseline classifiers. This confirms that incorporating dialog-level information can be beneficial to predicting user intent.
Both CNN-Context and CNN-Context-Rep outperform baseline models and CNN-Feature without explicit feature engineering. These results demonstrate the effectiveness of the implicit feature learning of neural architectures. CNN-Context-Rep performs better than CNN-Context. This indicates that incorporating high-level features of context information learned by neural architectures is better than directly capturing the raw context information. In a multi-label classification setting, accuracy produces a score for each individual sample, while precision/recall/F1 evaluate the performance over all samples. Thus, accuracy is the only metric that is suitable for significance tests. Our best model, CNN-Context-Rep achieves statistically significant improvement over the best baseline with $p < 10^{-4}$ measured by the Student's paired t-test.
\subsection{Generalization on Ubuntu Dialogs}
\label{subsec:udc}
\if0
We also annotated 200 dialogs from Ubuntu Dialog Corpus (UDC)~\cite{Lowe2015The}. MSDialog and UDC share a lot of similarities. Both datasets are derived from technical support domain. They both consist of multi-turn information-seeking conversations. They are also different in many ways. UDC is generated from internet relay chat (IRC) and thus contains a significant amount of typos, internet language, and abbreviations. In addition, Ubuntu dialogs have shorter utterances and more turns. We merged consecutive utterances from the same user as a single utterance to try to match the utterance length in MSDialog. Given their similarities and differences, we would like to know whether the model trained on MSDialog data can generalize well on Ubuntu dialogs.
The sampled UDC data contains 159 dialogs with 3,185 utterances. They were annotated under the exact same settings of MSDialog. We also perform the same data preprocessing steps as mentioned in Section~\ref{subsec:data-transformation}. Concretely, after removing \textit{GG}, \textit{JK}, and \textit{O}, we select the most frequent 32 label combinations from the remaining 95 label combinations. They cover 94\% of total label combination occurrences. For the rest of the label combination, we randomly sample one of the labels from the combination as the user intent label for the given utterance. After preprocessing, we have 34 label combinations for Ubuntu dialogs. 27 of them overlap with MSDialog.
\fi
In this section, we would like to evaluate the generalization performances of different methods on other data in addition to MSDialog. We train different models on MSDialog and test them on the Ubuntu Dialog Corpus (UDC). We select the two best performing feature based classifiers (random forest and AdaBoost) and the best neural model (CNN-Context-Rep) to test the generalization performance. Although the number of annotated Ubuntu dialogs is limited, it is sufficient to demonstrate the predicting performance. We split the annotated UDC data into validation and test sets with an equal size. We train the model on MSDialog data only and tune the hyper-parameters on the UDC validation set. The performance on the UDC test set is presented in Table~\ref{tab:udc-results}.
\begin{table}[ht]
\footnotesize
\centering
\caption{Testing performance on UDC of different models trained with MSDialog. The significance test can only be performed on accuracy. $\ddagger$ means statistically significant difference over both strongest feature based baselines with $p < 0.01$ measured by the Student's paired t-test.}
\label{tab:udc-results}
\vspace{-0.3cm}
\begin{tabular}{lllll}
\toprule
Methods & Accuracy & Precision & Recall & F1 \\ \midrule
Random Forest & 0.4405 & \textbf{0.6781} & 0.4077 & 0.5092 \\
AdaBoost & 0.4430 & 0.5913 & 0.4187 & 0.4902 \\
CNN-Context-Rep & \textbf{0.4708}$^\ddagger$ & 0.5647 & \textbf{0.5129} & \textbf{0.5375} \\ \bottomrule
\end{tabular}
\end{table}
The generalization results on UDC are not as good as MSDialog. Although MSDialog and UDC both consist of multi-turn information-seeking dialogs from the technical support domain, the drastically different language style adds difficulty for model generalization and transferring. In this challenging setting, CNN-Context-Rep still achieves statistically significant improvement over both baselines in terms of accuracy with $p < 0.01$ measured by the Student's paired t-test.
\subsection{Hyper-parameter Sensitivity Analysis}
We further analyze the impact of two hyper-parameters on CNN-Context-Rep: the number of convolutional filters for the given utterance and the max sequence length. The choices for number of convolutional filters are (64, 128, 256, 512, 1024). We tune the max sequence length in (50, 100, 200, \dots, 1000). As presented in Figure~\ref{fig:tune}, the performance gradually increases as the number of filters increases. The best performance is at 1,024 filters. This confirms our expectation that more convolutional filters can extract richer features and thus produce better results. In addition, the performance fluctuates as the max sequence length increases. Performance with larger ($\geqslant800$) max sequence length are better in general.
\subsection{Case Study}
Table 10 gives examples of the predictions that different systems fail to make. In the first utterance, the agent asks for the user's iOS version before providing a potential answer, which is a very common pattern of agents' responses. Our CNN-Context-Rep is able to identify the \textit{Information Request} in the utterance while AdaBoost cannot. In the second utterance, both models fail to predict the \textit{Negative Feedback}. This might be due to the fact that the feedback is not explicitly expressed. In addition, it could be relevant that the number of feedback utterances in the training data is relatively limited compared to questions and answers, which makes it more difficult to predict positive/negative feedback.
\begin{table}[ht]
\footnotesize
\centering
\caption{Two utterances with their ground-truth and predicted user intent labels. Bold font indicates mispredicted content or labels. ``Ours'' refers to CNN-Context-Rep.}
\label{tab:case-study}
\vspace{-0.3cm}
\begin{tabular}{llll}
\toprule
\multicolumn{4}{l}{\begin{tabular}[c]{@{}l@{}}Hello. Welcome to Skype Community! \textbf{Please provide us the iOS version of} \\ \textbf{your iPad}. The required iOS version for iPad is iOS 8 or higher and for the new \\Skype on iOS requires iOS 9 or higher. For more information, click here. Hope \\ this helps. Let me know if you need further assistance. Thank you!\end{tabular}} \\ \hline
\multicolumn{1}{l|}{Ground truth: \textbf{IR}, PA} & \multicolumn{1}{l|}{Ours: \textbf{IR}, PA} & \multicolumn{1}{l|}{AdaBoost: PA} & Actor: agent \\ \hline\hline
\multicolumn{4}{l}{\begin{tabular}[c]{@{}l@{}}After modified the Windows entry, value of regedit, \textbf{the error also happened}. \\ When I use C++ for creating another new Microsoft::Office::Interop::PowerPoint::\\Application instance, the COMException is throwed.\end{tabular}} \\ \hline
\multicolumn{1}{l|}{Ground truth: FD, \textbf{NF}} & \multicolumn{1}{l|}{Ours: FD} & \multicolumn{1}{l|}{AdaBoost: FD} & Actor: user \\ \hline\bottomrule
\end{tabular}
\end{table}
\section{Related Work}
\label{sec:relatedwork}
Our work is closely related to utterance classification, conversational search, and multi-turn question answering.
\if0
\textbf{Utterance type classification}. Utterance type classification as well as text classification has been widely studied in both natural language processing (NLP) and IR communities. \citet{Stolcke2000Dialogue} performed dialog acts classification with a statistical approach on SwitchBoard corpus~\cite{Godfrey1997Switchboard}, which consists of human-human chit chats conversations. While \citet{Olney:2003:UCA:1118894.1118895} classified students' utterances in an intelligent tutoring system (AutoTutor~\cite{Graesser2001AutoTutor}) with cascaded finite
state transducers.
\citet{Surendran2006Dialog} conducted dialog acts tagging on the HCRC MapTask corpus~\cite{Thompson1993The} with a combined method with SVM and Hidden Markov Model.
Recently, \citet{DBLP:conf/webdb/BhatiaM12, bhatia2014summarizing} focused on forum post classification for applications in information extraction and summarizing. Recent advancement in deep learning has made it possible to use neural architectures for text classification. Related research is conducted on both word level~\cite{DBLP:journals/corr/KingmaB14, DBLP:conf/aaai/LaiXLZ15} and character-level~\cite{DBLP:conf/nips/ZhangZL15, DBLP:conf/eacl/SchwenkBCL17}. Specifically, such methods are applied to intent determination in medical dialog systems~\cite{DBLP:conf/iva/DattaBOWB16}. In addition to utterance classification based solely on text, extensive research has been done with special interests in speech transcription. These work studied the impact of speech recognition quality~\cite{Homma2016} and how to perform classification without speech transcription~\cite{speech-utterance-classification, Wang2006}.
\fi
\textbf{Utterance Classification}. Utterance classification is well studied in the NLP and IR domain. Many different classification techniques such as
statistical approaches~\cite{Stolcke2000Dialogue}, SVM, or Hidden Markov Models~\cite{Surendran2006Dialog}
have been used for different applications including
human-human chatting~\cite{Stolcke2000Dialogue},
student's utterance~\cite{Olney:2003:UCA:1118894.1118895}, or forum post classifications~\cite{DBLP:conf/webdb/BhatiaM12}.
However, recent advances in deep learning allow us to use neural architectures for utterance classification both on the word~\cite{DBLP:conf/emnlp/Kim14} and character level~\cite{DBLP:conf/nips/ZhangZL15}.
These new deep learning techniques have been applied in medical dialog systems~\cite{DBLP:conf/iva/DattaBOWB16}. In this paper, we focus on user intent prediction in information-seeking conversations. This specific utterance classification task presents unique challenges because of the complexity and diversity of human information-seeking conversations.
\ignore{\jtcomment{This section may need to be revised and differently structured. I'll try to come back to this later to help rewrite it. How are DA related to user intent?}}
\textbf{Conversational Search}. Searching via conversational interactions with IR systems is an increasingly popular research topic in both industry and academia~\cite{Zhang2018Rec, Shiga2017modelling, Croft:1987:IRN:35053.35054}.
\citet{Oddy1977Information} introduced man-machine IR through dialogs without explicitly formulating queries. \citet{belkin1995merit} modeled the human-computer interaction in information-seeking as dialogs. Moreover, information-seeking via conversations is especially important in exploratory search~\cite{Marchionini:2006:ESF:1121949.1121979, DBLP:series/synthesis/2009White}, where users are unfamiliar with the domain they are searching and would rely on effective interactions with retrieval systems. More recently, \citet{Radlinski:2017:TFC:3020165.3020183} identified key properties in conversational IR systems. \citet{Trippas:2018:IDS:3176349.3176387} conducted lab-based observational studies on conversational search and identified that it is more interactive than traditional search and new information-seeking models are needed. In our work, we focus on an essential study in conversational search, which is to predict user intent in this information-seeking setting. Our findings can help build conversational search systems that can provide enhanced searching experience using predicted user intent.
\textbf{Multi-turn Question Answering}. Early research on multi-turn question answering dates back to AutoTutor~\cite{Graesser2001AutoTutor}, which can simulate human tutors to assist college students to learn computer science. Recent work has focused on single turn QA on factoid questions~\cite{Yin2015Neural} and other open-domain questions (e.g. WikiQA~\cite{Yang2015WikiQA}). The Ubuntu Dialog Corpus~\cite{Lowe2015The} and MSDialog~\cite{Qu2018UserIntent} provide large scale multi-turn QA dialogs in the technical support domain. \citet{DBLP:conf/acl/WuWXZL17} and \citet{Yang2018RespRank} used these datasets to perform conversation response ranking for non-factoid questions. Our work focuses on a specific research need for multi-turn QA in the information-seeking setting. The performance of multi-turn QA could be improved if the user intent is correctly identified.
\section{Additional Figure}
We include an additional figure to illustrate our findings from above. Figure~\ref{fig:tune} shows the results of the hyper-parameter sensitivity analysis.
\begin{figure}[ht]
\centering
\begin{subfigure}[b]{0.24\textwidth}
\includegraphics[width=\textwidth]{img/filter_new.pdf}
\label{fig:nb_filter}
\end{subfigure}
\hspace{-0.1in}
\begin{subfigure}[b]{0.24\textwidth}
\includegraphics[width=\textwidth]{img/max_len_new.pdf}
\label{fig:max_len}
\end{subfigure}
\vspace{-1cm}
\caption{Performance of CNN-Context-Rep with different number of convolutional filters and max sequence length.}
\label{fig:tune}
\end{figure}
\end{document}
| {'timestamp': '2019-01-14T02:09:33', 'yymm': '1901', 'arxiv_id': '1901.03489', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03489'} | arxiv |
\section{Background} \label{background}
In the following, we briefly introduce the setting of LQR in \S\ref{slqr} and imitation learning in \S\ref{silirl}. To unify the notation of LQR and more general reinforcement learning, we stick to the notion of cost function instead of reward function throughout the rest of this paper.
\subsection{Linear Quadratic Regulator}\label{slqr}
In reinforcement learning, we consider a Markov decision process $\{{\mathcal{X}},\cU,c,T,\mathbb{D}_0\}$, where an agent interacts with the environment in the following manner. At the $t$-th time step, the agent selects an action $u_t\in\cU$ based on its current state $x_t\in{\mathcal{X}}$, and the environment responds with the cost $c_t=c(x_t,u_t)$ and the next state $x_{t+1}\in{\mathcal{X}}$, which follows the transition dynamics $T$. Our goal is to find a policy $u_t=\pi_t(x_t)$ that minimizes the expected cumulative cost. In the setting of LQR, we consider ${\mathcal{X}}={\mathbb{R}}^{d}$ and $\cU={\mathbb{R}}^{k}$. The dynamics and cost function take the form
\#
x_{t+1}=Ax_t+Bu_t,\quad c(x_t,u_t)=x_t^\top Q x_t + u_t^\top R u_t,\notag
\#
where $A\in{\mathbb{R}}^{d\times d}$, $B\in{\mathbb{R}}^{d\times k}$, $Q\in{\mathbb{R}}^{d\times d}$, and $R\in{\mathbb{R}}^{k\times k}$ with $Q, R\succ 0$. The problem of minimizing the expected cumulative cost is then formulated as the optimization problem
\#
\minimize_{\pi_t}~ & {\mathbb E}{ \bigl [{\textstyle\sum_{t=0}^{\infty}} x_t^\top Q x_t + u_t^\top R u_t \bigr ]} \label{objini}\\
\text{subject to} ~ & x_{t+1}=Ax_t+Bu_t,~u_t=\pi_t(x_t),~x_0 \sim \mathbb{D}_0, \notag
\#
where $\mathbb{D}_0$ is a given initial distribution. Here we consider the infinite-horizon setting with a stochastic initial state $x_0\sim\mathbb{D}_0$. In this setting, the optimal policy $\pi_t$ is known to be static and takes the form of linear feedback $\pi_t(x_t)=-Kx_t$, where $K\in{\mathbb{R}}^{k\times d}$ does not depend on $t$ \citep{anderson2007optimal}. Throughout the rest of this paper, we also refer to $K$ as policy and drop the subscript $t$ in $\pi_t$. To ensure the expected cumulative cost is finite, we require the spectral radius of $(A-BK)$ to be less than one, which ensures that the dynamical system
\#\label{eq:trans_dyna_x}
x_{t+1}=Ax_t+Bu_t = (A-BK) x_t
\#
is stable. For a given policy $K$, we denote by $C(K;Q,R)$ the expected cumulative cost in \eqref{objini}. For notational simplicity, we define
\#\label{Sigmadef}
\Sigma_{K}={\mathbb E}\bigl[{\textstyle\sum_{t=0}^{\infty}} x_t x_t^\top\,|\,\pi_t(x_t)=-Kx_t \bigr],\quad\Sigma_0={\mathbb E}[x_0 x_0^\top].
\#
By \eqref{Sigmadef}, we have the following equivalent form of $C(K;Q,R)$
\#\label{inner2}
C(K;Q,R)
={\text{Tr}}(\Sigma_K Q)+{\text{Tr}}(K\Sigma_{K}K^\top R)
=\langle\Sigma_K ,Q\rangle+\langle K\Sigma_{K}K^\top, R\rangle,
\#
where $\langle\cdot,\cdot\rangle$ denotes the matrix inner product. Also, throughout the rest of this paper, we assume that the initial distribution $\mathbb{D}_0$ satisfies $\sigma_{\text{min}}(\Sigma_0)>0$. See \cite{recht2018tour} for a thorough review of reinforcement learning in the setting of LQR.
\subsection{Imitation Learning}\label{silirl}
In imitation learning, we parameterize the cost function of interest by $c(x_t,u_t;\theta)$, where $\theta$ denotes the unknown cost parameter. In the setting of LQR, we have $\theta = (Q,R)$. We observe expert trajectories in the form of $\{(x_t,u_t,c_t)\}^{\infty}_{t=0}$, which are induced by the expert policy $\pi_{\text{E}}$. As a unifying framework of inverse reinforcement learning, GAIL \citep{ho2016generative} casts max-entropy inverse reinforcement learning \citep{ziebart2008maximum} and its extensions as the following minimax optimization problem
\# \label{bgobj}
&\max_{\theta} \min_{\pi} \Bigl\{{\mathbb E}\bigl[{\textstyle\sum_{t=0}^{\infty}}c_t(x_t,u_t;\theta)\,|\,u_t = \pi(x_t)\bigr]-H(\pi)\notag\\&\qquad\qquad\qquad\qquad-{\mathbb E}\bigl[{\textstyle\sum_{t=0}^{\infty}}c_t(x_t,u_t;\theta)\,|\,u_t = \pi_{\text{E}}(x_t)\bigr]-\psi(\theta)\Bigr\},
\#
where for ease of presentation, we restrict to deterministic policies in the form of $u_t = \pi(x_t)$. Here $H(\pi)$ denotes the causal entropy of the dynamical system $\{x_t\}_{t=0}^\infty$ induced by $\pi$, which takes value zero in our setting of LQR, since the transition dynamics in \eqref{eq:trans_dyna_x} is deterministic conditioning on $x_t$. Meanwhile, $\psi(\theta)$ is a regularizer on the cost parameter.
The minimax optimization formulation in \eqref{bgobj} mirrors the training of GAN \citep{goodfellow2014generative}, which seeks to find a generator of distribution that recovers a target distribution. In the training of GAN, the generator and discriminator are trained simultaneously, in the manner that the discriminator maximizes the discrepancy between the generated and target distributions, while the generator minimizes such a discrepancy. Analogously, in imitation learning, the policy $\pi$ of interest acts as the generator of trajectories, while the expert trajectories act as the target distribution. Meanwhile, the cost parameter $\theta$ of interest acts as the discriminator, which differentiates between the trajectories generated by $\pi$ and $\pi_{\text{E}}$. Intuitively, maximizing over the cost parameter $\theta$ amounts to assigning high costs to the state-action pairs visited more by $\pi$ than $\pi_{\text{E}}$. Minimizing over $\pi$ aims at making such an adversarial assignment of cost impossible, which amounts to making the visitation distributions of $\pi$ and $\pi_{\text{E}}$ indistinguishable.
\section{Introduction}
Imitation learning is a paradigm that learns from expert demonstration to perform a task. The most straightforward approach of imitation learning is behavioral cloning \citep{Pom91}, which learns from expert trajectories to predict the expert action at any state. Despite its simplicity, behavioral cloning ignores the accumulation of prediction error over time. Consequently, although the learned policy closely resembles the expert policy at a given point in time, their trajectories may diverge in the long term.
To remedy the issue of error accumulation, inverse reinforcement learning \citep{russell1998learning, ng2000algorithms, abbeel2004apprenticeship, ratliff2006maximum, ziebart2008maximum, ho2016generative} jointly learns a reward function and the corresponding optimal policy, such that the expected cumulative reward of the learned policy closely resembles that of the expert policy. In particular, as a unifying framework of inverse reinforcement learning, generative adversarial imitation learning (GAIL) \citep{ho2016generative} casts most existing approaches as iterative methods that alternate between (i) minimizing the discrepancy in expected cumulative reward between the expert policy and the policy of interest and (ii) maximizing such a discrepancy over the reward function of interest. Such a minimax optimization formulation of inverse reinforcement learning mirrors the training of generative adversarial networks (GAN), which alternates between updating the generator and discriminator, respectively.
Despite its prevalence, inverse reinforcement learning, especially GAIL, is notoriously unstable in practice. More specifically, most inverse reinforcement learning approaches involve (partially) solving a reinforcement learning problem in an inner loop, which is often unstable, especially when the intermediate reward function obtained from the outer loop is ill-behaved. This is particularly the case for GAIL, which, for the sake of computational efficiency, alternates between policy optimization and reward function optimization without fully solving each of them. Moreover, such instability is exacerbated when the policy and reward function are both parameterized by deep neural networks. In this regard, the training of GAIL is generally more unstable than that of GAN, since policy optimization in deep reinforcement learning is often more challenging than training a standalone deep neural network.
In this paper, we take a first step towards theoretically understanding and algorithmically taming the instability in imitation learning. In particular, under a minimax optimization framework, we for the first time establish the global convergence of GAIL under a fundamental setting known as linear quadratic regulators (LQR). Such a setting of LQR is studied in a line of recent works \citep{bradtke1993reinforcement, fazel2018global, tu2017least, tu2018gap, dean2018regret, dean2018safely, simchowitz2018learning, dean2017sample, hardt2018gradient} as a lens for theoretically understanding more general settings in reinforcement learning. See \cite{recht2018tour} for a thorough review. In imitation learning, particularly GAIL, the setting of LQR captures four critical challenges of more general settings:
\begin{enumerate}
\item[(i)] the minimax optimization formulation,
\item[(ii)] the lack of convex-concave geometry,
\item [(iii)] the alternating update of policy and reward function, and
\item[(iv)] the instability of the dynamical system induced by the intermediate policy and reward function (which differs from the aforementioned algorithmic instability).
\end{enumerate}
Under such a fundamental setting, we establish a global sublinear rate of convergence towards a saddle point of the minimax optimization problem, which is guaranteed to be unique and recovers the globally optimal policy and reward function. Moreover, we establish a local linear rate of convergence, which, combined with the global sublinear rate of convergence, implies a global Q-linear rate of convergence. A byproduct of our theory is the stability of all the dynamical systems induced by the intermediate policies and reward functions along the solution path, which addresses the key challenge in (iv) and plays a vital role in our analysis. At the core of our analysis is a new potential function tailored towards non-convex-concave minimax optimization with alternating update, which is of independent interest. To ensure the decay of potential function, we rely on the aforementioned stability of intermediate dynamical systems along the solution path. To achieve such stability, we unveil an intriguing ``self-enforcing'' stabilizing mechanism, that is, with a proper configuration of stepsizes, the solution path approaches the critical threshold that separates stable and unstable regimes at a slower rate as it gets closer to such a threshold. In other words, such a threshold forms an implicit barrier, which ensures the stability of the intermediate dynamical systems along the solution path without any explicit regularization.
Our work extends the recent line of works on reinforcement learning under the setting of LQR \citep{bradtke1993reinforcement, recht2018tour, fazel2018global, tu2017least, tu2018gap, dean2018regret, dean2018safely, simchowitz2018learning, dean2017sample, hardt2018gradient} to imitation learning. In particular, our analysis relies on several geometric lemmas established in \cite{fazel2018global}, which are listed in \S\ref{sec:aux} for completeness. However, unlike policy optimization in reinforcement learning, which involves solving a minimization problem where the objective function itself serves as a good potential function, imitation learning involves solving a minimax optimization problem, which requires incorporating the gradient into the potential function. In particular, the stability argument developed in \cite{fazel2018global}, which is based on the monotonicity of objective functions along the solution path, is no longer applicable, as minimax optimization alternatively decreases and increases the objective function at each iteration. In a broader context, our work takes a first step towards extending the recent line of works on nonconvex optimization, e.g.,
\cite{
baldi1989neural, du2018power, wang2014optimal, wang2014nonconvex, zhao2015nonconvex, ge2015escaping, ge2017no, ge2017learning, anandkumar2014tensor, bandeira2016low, li2016online, li2016symmetry, hajinezhad2016nestt, bhojanapalli2016global, sun2015complete, sun2018geometric}, to non-convex-concave minimax optimization \citep{, du2018linear, sanjabi2018solving, rafi2018noncon, lin2018solving, dai2017learning, dai2018boosting, dai2018sbeed, lu2019understand} with alternating update, which is prevalent in reinforcement learning, imitation learning, and generative adversarial learning, and poses significantly more challenges.
In the rest of this paper, \S\ref{background} introduces imitation learning, the setting of LQR, and the generative adversarial learning framework. In \S\ref{algo}, we introduce the minimax optimization formulation and the gradient algorithm. In \S\ref{analysis} and \S\ref{proof}, we present the theoretical results and sketch the proof. We defer the detailed proof to \S\ref{appp1}-\S\ref{sec:aux} of the appendix.
\vskip4pt
\noindent
\textbf{Notation.}
We denote by $\|\cdot\|$ the spectral norm and $\|\cdot\|_{{\text{F}}}$ the Frobenius norm of a matrix. For vectors, we denote by $\|\cdot\|_2$ the Euclidean norm. In this paper, we write parameters in the matrix form, and correspondingly, all the Lipschitz conditions are defined in the Frobenius norm.
\section{Algorithm} \label{algo}
In the sequel, we first introduce the minimax formulation of generative adversarial imitation learning in \S\ref{formu}, then we present the gradient algorithm in \S\ref{algos}.
\subsection{Minimax Formulation}\label{formu}
We consider the minimax optimization formulation of the imitation learning problem,
\# \label{obj}
\min_{K\in{\mathcal{K}}}\,\max_{\theta\in\Theta}\,
m(K,\theta),\quad\text{where}~~m(K,\theta)=C(K;\theta)-C(K_{\text{E}};\theta)-\psi(\theta).
\#
Here we denote by $\theta=(Q,R)$ the cost parameter, where $Q\in{\mathbb{R}}^{d\times d}$ and $R\in{\mathbb{R}}^{k\times k}$ are both positive definite matrices, and $\Theta$ is the feasible set of cost parameters. We assume $\Theta$ is convex and there exist positive constants $\alpha_Q$, $\alpha_R$, $\beta_Q$, and $\beta_R$ such that for any $(Q,R) \in \Theta$, it holds that
\#\label{eq:walpha}
\alpha_Q I \preceq Q \preceq \beta_Q I,\quad \alpha_R I \preceq R \preceq \beta_R I.
\#
Also, ${\mathcal{K}}$ consists of all stabilizing policies, such that $\rho(A-BK)<1$ for all $K\in{\mathcal{K}}$, where $\rho$ is the spectral radius defined as the largest complex norm of the eigenvalues of a matrix. The expert policy is defined as $K_{\text{E}}=\argmin_K C(K;\tilde{\theta})$ for an unknown cost parameter $\tilde{\theta}\in\Theta$. However, note that $\tilde{\theta}$ is not necessarily the unique cost parameter such that $K_{\text{E}}$ is optimal. Hence, our goal is to find one of such cost parameters $\theta^*$ that $K_{\text{E}}$ is optimal. The term $\psi(\cdot)$ is the regularizer on the cost parameter, which is set to be $\gamma$-strongly convex and $\nu$-smooth.
To understand the minimax optimization problem in \eqref{obj}, we first consider the simplest case with $\psi(\theta)\equiv0$. A saddle point $(K^*,\theta^*)$ of the objective function in \eqref{obj}, defined by
\#\label{sddf}
m(K^*,\theta^*)=\min_K m(K,\theta^*)=\max_\theta m(K^*,\theta),
\#
has the following desired properties.
First, we have that the optimal policy $K^*$ recovers the expert policy $K_{\text{E}}$. By the optimality condition in \eqref{sddf}, we have
\#\label{sddf2}
C(K^*;\tilde{\theta})-C(K_{\text{E}};\tilde{\theta})=m(K^*;\tilde{\theta})\le m(K^*;\theta^*)= C(K^*;\theta^*)-C(K_{\text{E}};\theta^*)\le0,
\#
where the first inequality follows from the optimality of $\theta^*$ and the second inequality follows from the optimality of $K^*$. Since the optimal solution to the policy optimization problem $\min_{K} C(K;\tilde{\theta})$ is unique (as proved in \S\ref{proof}), we obtain from \eqref{sddf2} that $K^*=K_\text{E}$. Second, $K_\text{E}$ is an optimal policy with respect to the cost parameter $\theta^*$, since by $K^*=K_{\text{E}}$ and the optimality condition $K^*=\argmin_K C(K;\theta^*)$, we have $K_\text{E}=\argmin_K C(K;\theta^*)$. In this sense, the saddle point $(K^*;\theta^*)$ of \eqref{obj} recovers a desired cost parameter and the corresponding optimal policy.
Although $\psi(\cdot)\equiv0$ brings us desired properties of the saddle point, there are several reasons we can not simply discard this regularizer. The first reason is that a strongly convex regularizer improves the geometry of the problem and makes the saddle point of \eqref{obj} unique, which eliminates the ambiguity in learning the desired cost parameter. Second, the regularizer draws connection to the existing optimization formulations of GAN. For example, as shown in \cite{ho2016generative}, with a specific choice of $\psi(\cdot)$, \eqref{obj} reduces to the classical optimization formulation of GAN \citep{goodfellow2014generative}, which minimizes the Jensen-Shannon divergence bewteen the generator and target distributions.
\subsection{Gradient Algorithm} \label{algos}
To solve the minimax optimization problem in \eqref{obj}, we consider the alternating gradient updating scheme,
\#
K_{i+1}&\leftarrow K_{i}-\eta\cdot \nabla_{K} m(K_i,\theta_i)=K_{i}-\eta\cdot \nabla_{K} C(K_i;\theta_i), \label{pg} \\
\theta_{i+1}&\leftarrow\Pi_{\Theta}\Bigl[\theta_i
+\lambda\cdot\bigl(\nabla_Qm(K_{i+1},\theta_{i}),\nabla_Rm(K_{i+1},\theta_{i})\bigr)
\Bigr] \label{cg}.
\#
Here $\Pi_{\Theta}[\cdot]$ is the projection operator onto the convex set $\Theta$, which ensures that each iterate $\theta_i$ stays within $\Theta$.
There are several ways to obatin the gradient in \eqref{pg} without knowing the dynamics $X_{t+1}=Ax_t+Bu_t$ but based on the trajectory $\{(x_t,u_t,c_t)\}_{t=0}^{\infty}$. One example is the deterministic policy gradient algorithm \citep{silver2014deterministic}. In specific, the gradient of the cost function is obtained through the limit
\$
\lim_{\sigma\downarrow0}{\mathbb E}\bigl[\nabla_{K}\pi_{K,\sigma}(u\,|\,x)\cdot Q^{\pi_{K,\sigma}}(x,u)\bigr],
\$
where $\pi_{K,\sigma}(u\,|\,x)$ is a stochastic policy that takes the form $u\,|\,x\sim{\mathcal{N}}(-Kx,\sigma^2I)$. Here $Q^{\pi_{K,\sigma}}(x,u)$ is the action-value function associated with the policy $\pi_{K,\sigma}(u\,|\,x)$, defined as the expected total cost of the policy $\pi_{K,\sigma}(u\,|\,x)$ starting at state $x$ and action $u$, which can be estimated based on the trajectory $\{(x_t,u_t,c_t)\}_{t=0}^{\infty}$. An alternative approach is the evolutionary strategy \citep{salimans2017evolution}, which uses zeroth-order information to approximate $\nabla_KC(K;\theta)$ with a random perturbation,
\$
{\mathbb E}_{\text{vec}(\varepsilon)\sim{\mathcal{N}}(0,\sigma^2 I)}
\bigl[
C(K_i+\varepsilon;\theta_i)\cdot\varepsilon
\bigr]\big/\sigma^2,
\$
where $\varepsilon\in{\mathbb{R}}^{k\times d}$ is a random matrix in ${\mathbb{R}}^{k\times d}$ with a sufficiently small variance $\sigma^2$.
To obtain the gradient in \eqref{cg}, we have
\#
\nabla_Qm(K_{i+1};\theta_i)&=\Sigma_{K_{i+1}}-\Sigma_{K_{\text{E}}} - \nabla_Q \psi(Q_i,R_i),\label{eq:w8}\\
\nabla_Rm(K_{i+1};\theta_i)&=K_{i+1}\Sigma_{K_{i+1}}K_{i+1}^\top-K_{\text{E}}\Sigma_{K_{\text{E}}}K_{\text{E}}^\top - \nabla_R \psi(Q_i,R_i).\label{eq:w9}
\#
Here $\Sigma_K={\mathbb E}[\sum_{t=0}^\infty x_tx_t^\top]$ with $\{x_t\}_{t=0}^{\infty}$ generated by policy $K$, which can be estimated based on the trajectory $\{(x_t,u_t,c_t)\}_{t=0}^{\infty}$.
\section{Main Results} \label{analysis}
In this section, we present the convergence analysis of the gradient algorithm in \eqref{pg} and \eqref{cg}. We first prove that the solution path $\{K_i\}_{i\ge0}$ are guaranteed to be stabilizing and then establish the global convergence. For notational simplicity, we define the following constants,
\# \label{nota1}
\alpha=\min\{\alpha_Q, \alpha_R\},\quad
\sigma_{\theta}=\sup_{(Q,R)\in\Theta}\bigl(\|Q\|^2_{{\text{F}}}+\|R\|^2_{{\text{F}}}\bigr)^{1/2},\quad
\mu=\sigma_{\text{min}}(\Sigma_0)>0,\#
where $\alpha_Q$ and $\alpha_R$ are defined in \eqref{eq:walpha}, and $\Sigma_0 = \EE[x_0 x_0^\top]$. Also, we define
\#
M&=\beta_Q\cdot{\text{Tr}}(\Sigma_{K_0})+\beta_R\cdot{\text{Tr}}(K_0\Sigma_{K_0}{K_0}^\top), \label{nota2}\\
F&=\max\Big\{
\|\Sigma_{K_\text{E}}\|_{{\text{F}}}+\sup_{(Q,R)\in\Theta}\|\nabla_Q\psi(Q,R)\|_{{\text{F}}}, \|K_{\text{E}}\Sigma_{K_\text{E}}K_{\text{E}}^\top\|_{{\text{F}}}+
\sup_{(Q,R)\in\Theta}\|\nabla_R\psi(Q,R)\|_{{\text{F}}} \Bigr \}, \label{nota3}
\#
which play a key role in upper bounding the cost function $C(K; \theta)$.
\subsection{Stability Guarantee}
A minimum requirement in reinforcement learning is to obtain a stabilizing policy such that the dynamical system does not tend to infinity. Throughout this paper, we employ a notion of uniform stability, which states that there exists a constant $S$ such that $\|\Sigma_{K_i}\|\le S$ for all $i$. Moreover, the uniform stability also allows us to establish the smoothness of $m(K,\theta)$, which is discussed in \S\ref{lipsec}.
Recall that we assume $Q$ and $R$ are positive definite. Therefore, the uniform stability is implied by the boundedness of the cost function $C(K_i;\theta_i)$, since we have
\# \label{ineqs}
\alpha_Q\cdot\|\Sigma_{K_i}\|\le \alpha_Q\cdot{\text{Tr}}(\Sigma_{K_i})\le \langle \Sigma_{K_i},Q_i \rangle \le C(K_i;\theta_i),
\#
where the second inequality follows from the properties of trace and the assumption $Q\succeq\alpha_QI$ in \eqref{eq:walpha}. However, it remains difficult to show that the cost function $C(K_i;\theta_i)$ is upper bounded. Although the update of policy in \eqref{pg} decreases the cost function $C(K_i;\theta_i)$, the update of cost parameter increases $m(K_i;\theta_i)$, which possibly increases the cost function $C(K_i;\theta_i)$. To this end, we choose suitable stepsizes as in the next condition to ensure the boundedness of the cost function.
\begin{cond}\label{con:1}
For the update of policy and cost parameter in \eqref{pg} and \eqref{cg}, let
\$
\eta \le \min \Biggl\{& \frac{\alpha_Q^{3} \mu^{5/2}(\alpha F+2M)^{-7/2} }
{16
\kappa_1^{1/2} \kappa_2\cdot \|B\| },
\frac{\alpha_Q}{32 \kappa_1 (\alpha F+2M)},
\frac{2M}{\alpha_Q\alpha_R\mu^2}
\Biggr\},\quad
\lambda/\eta \le \frac{\alpha_Q\alpha_R\alpha^2\mu^2}{2M(\alpha F+2M)}.
\$
Here $\alpha$, $\mu$, $F$, and $M$ are defined in \eqref{nota1}, \eqref{nota2}, and \eqref{nota3}. The constants $\kappa_1$ and $\kappa_2$ are defined as
\#\label{eq:wa9}
\kappa_1=\beta_R+(\alpha F+2M) \cdot \|B\|^2/\mu,\quad
\kappa_2=1+
(\mu\alpha_Q)^{-1/2} (\alpha F+2M)^{1/2}.
\#
\end{cond}
The next lemma shows that the solution path $\{K_i\}_{i\ge0}$ is uniformly stabilizing, and meanwhile, along the solution path, the cost function $C(K_i;\theta_i)$ and $\|K_i\|^2$ are both upper bounded.
\begin{lemma}\label{lm:bc}
Under Condition \ref{con:1}, we have
\
C(K_i;\theta_i)\le \alpha F+2M,\quad\|K_i\|^2\le(\alpha F+2M)/(\alpha_R \mu), \quad\|\Sigma_{K_i}\|\le (\alpha F+2M)/\alpha_Q
\$
for all $i\ge0$.
\end{lemma}
\begin{proof}
See \S\ref{appp1} for a detailed proof.
\end{proof}
\subsection{Global Convergence}
Before showing the gradient algorithm converges to the saddle point $(K^*,\theta^*)$ of \eqref{obj}, we establish its uniqueness. We define the proximal gradient of the objective function $m(K,\theta)$ in \eqref{obj} as
\# \label{proxg}
L(K,\theta) =
\Bigl(
\nabla_K m(K,\theta),~
\theta - \Pi_{\Theta}\bigr[\theta-\nabla_{\theta} m(K,\theta)\bigr]
\Bigr).
\#
Then a proximal stationary point is defined by $L(K,\theta)=0$.
\begin{lemma} [Uniqueness of Saddle Point]\label{usp}
There exists a unique proximal stationary point, denoted as $(K^*,\theta^*)$, of the objective function $m(K,\theta)$ in \eqref{obj}, which is also its unique saddle point.
\end{lemma}
\begin{proof}
See \S\ref{pusp} for a detailed proof.
\end{proof}
To analyze the convergence of the gradient algorithm, we first need to establish the Lipschitz continuity and smoothness of $m(K,\theta)$. However, the cost function $C(K;\theta)$ becomes steep as the policy $K$ is close to unstabilizing. Therefore, we do not have such desired Lipschitz continuity and smoothness of $\Sigma_K$ and $K\Sigma_KK^\top$ with respect to $K$. However, given $\|\Sigma_K\|$ is upper bounded as in Lemma \ref{lm:bc}, we obtain such desired properties in the following lemma.
For notational simplicity, we slightly abuse the notation and rewrite $\theta$ as a block diagonal matrix and correspondingly define $V(K)$,
\# \label{innerform}
\theta=
\left(\begin{matrix}
Q &0 \\
0&R
\end{matrix}\right)\in{\mathbb{R}}^{(d+k)\times(d+k)},\quad
V(K)=
\left(\begin{matrix}
\Sigma_{K} &0\\
0 & K\Sigma_{K}K^\top
\end{matrix}\right)\in{\mathbb{R}}^{(d+k)\times(d+k)}.
\#
Then the objective function takes the form
\#\label{svform}
m(K,\theta)=\bigl\langle V(K),\theta \bigr\rangle-\bigl\langle V(K_{\text{E}}),\theta \bigr\rangle-\psi(\theta).
\#
\begin{lemma}\label{lm:lip1}
We assume that the initial policy $K_0$ of the gradient algorithm is stabilizing. Under Condition \ref{con:1}, there exists a compact set ${\mathcal{K}}^\dagger\subsetneqq{\mathcal{K}}$ such that $K_i \in {\mathcal{K}}^\dagger$ for all $i\ge0$. Also, there exist constants $\tau_{V}$ and $\nu_V$ such that the matrix-valued function $V(K)$ defined in \eqref{innerform}
is $\tau_{V}$-Lipschitz continuous and $\nu_V$-smooth over ${\mathcal{K}}^\dagger$. That is, for any $K_1,K_2 \in {\mathcal{K}}^\dagger$ and $j,\ell\in[d+k]$, we have
\$
\|V(K_1)-V(K_2)\|_{{\text{F}}}\le \tau_{V}\cdot\|K_1-K_2\|_{{\text{F}}},\quad
\|\nabla V_{j,\ell}(K_1)-\nabla V_{j,\ell}(K_2)\|_{{\text{F}}} \le \nu_V/(d+k) \cdot\|K_1-K_2\|_{{\text{F}}}.
\$
\end{lemma}
\begin{proof}
See \S\ref{lipsec} for a detailed proof.
\end{proof}
Note that the cost parameter $(Q,R)$ is only identifiable up to a multiplicative constant. Recall that we assume $\alpha_QI\preceq Q\preceq\beta_QI$ and $\alpha_RI\preceq R\preceq\beta_RI$. In the sequel, we establish the sublinear rate of convergence with a proper choice of $\alpha_Q$, $\alpha_R$, $\beta_Q$, and $\beta_R$, which is characterized by the following condition.
\begin{cond} \label{cond:cptb}
We assume that $\alpha_Q$, $\alpha_R$, $\beta_Q$, and $\beta_R$ satisfy
\# \label{cond:cptbineq}
\alpha_Q\alpha_R\alpha^2\gamma\geq 14\sigma_{\theta}\nu_V M(\alpha F+2M),
\#
where $F$, $M$, and $\sigma_\theta$ are defined in \eqref{nota1}, \eqref{nota2} and \eqref{nota3}, and $\nu_V$ is defined in Lemma \ref{lm:lip1}.
\end{cond}
The following condition, together with Condition \ref{con:1}, specifies the required stepsizes to establish the global convergence of the gradient algorithm.
\begin{cond}\label{con100}
For the stepsizes $\eta$ and $\lambda$ in \eqref{pg} and \eqref{cg}, let
\$
\eta\le\min\biggl\{\frac{1}{100\tau_{V}},\frac{1}{2\sigma_\theta \nu_V}\biggr\},\quad
\lambda\le\min\biggl\{ \frac{1}{100(\tau_{V}+\nu)},\frac{3\nu_V\sigma_\theta}{100\tau_{V}^2},\frac{\gamma}{100\nu^2} \biggr \},\quad
\eta/\lambda < \frac{\gamma}{7\nu_V\sigma_{\theta}} .
\$
\end{cond}
In the following, we establish the global convergence of the gradient algorithm. Recall that as defined in \eqref{proxg}, $L(K,\theta)$ is the proximal gradient of the objective function $m(K,\theta)$ defined in \eqref{obj}.
\begin{theorem}\label{mainthm}
Under Conditions \ref{con:1}, \ref{cond:cptb}, and \ref{con100}, we have $\lim_{i\rightarrow\infty}\|L(K_i,\theta_i)\|_{{\text{F}}}=0$,
which implies that $\{(K_i,\theta_i)\}_{i=0}^\infty$ converges to the unique saddle point $(K^*,\theta^*)$ of $m(K,\theta)$. To characterize the rate of convergence, we define $\Gamma(\varepsilon)$ as the smallest iteration index that $\|L(K_i,\theta_i)\|_{{\text{F}}}^2$ is below an error $\varepsilon>0$,
\#\label{Gammadefi}
\Gamma(\varepsilon)= \min \bigl\{i\,|\,\| L(K_i,\theta_i)\|_{{\text{F}}}^2\le\varepsilon \bigr\}.
\#
Then there exists a constant $\zeta$, which depends on $K_0$, $\theta_0$, $\eta$, and $\lambda$ (as specified in \eqref{zetadef}), such that $\Gamma(\varepsilon)\le \zeta/\varepsilon$ for any $\varepsilon$.
\end{theorem}
\begin{proof}
See \S\ref{lipsec} for a detailed proof.
\end{proof}
To understand Condition \ref{cond:cptb}, we consider a simple case where the regularizer $\psi(\cdot)$ is the squared penalty centered at some point $(\bar{Q},\bar{R})\in\Theta$, that is,
\$
\psi(Q,R)=\gamma \cdot \bigl(\|Q-\bar{Q}\|_{{\text{F}}}^2+\|R-\bar{R}\|_{{\text{F}}}^2\bigr).
\$
Then we have $\|\nabla\psi(Q,R)\|_{{\text{F}}}\le2\gamma\omega$, where $\omega=\sup_{\theta,\theta'\in\Theta}\|\theta-\theta'\|_{{\text{F}}}$. Also, by \eqref{nota3} we have
\# \label{scse3}
F\le\max\bigl\{
\|\Sigma_{K_\text{E}}\|_{{\text{F}}}, \|K_{\text{E}}\Sigma_{K_\text{E}}K_{\text{E}}^\top\|_{{\text{F}}}\bigr\}+2\gamma\omega.
\#
Let $\max\{\beta_Q,\beta_R\}/\alpha\le \iota$ for some constant $\iota$. By \eqref{nota2} we have
\# \label{scse2}
M\le\iota\alpha\cdot\bigl({\text{Tr}}(\Sigma_{K_0})+{\text{Tr}}(K_0\Sigma_{K_0}{K_0}^\top)\bigr).
\#
By \eqref{scse2} and Lemma \ref{lm:bc}, we obatin
\#
\|\Sigma_{K_i}\|&\le (\alpha F+2M)/\alpha_Q\le F+2\iota\cdot\bigl({\text{Tr}}(\Sigma_{K_0})+{\text{Tr}}(K_0\Sigma_{K_0}{K_0}^\top)\bigr),\label{scse}\\
\|K_i\|^2&\le(\alpha F+2M)/(\alpha_R \mu)\le \Bigl(F+2\iota\cdot\bigl({\text{Tr}}(\Sigma_{K_0})+{\text{Tr}}(K_0\Sigma_{K_0}{K_0}^\top)\bigr)\Bigr)\Big/\mu \label{scse6}
\#
for all $i\ge0$. In \S\ref{lipsec} we further prove that $\nu_V$ is determined by the uniform upper bound of $\|\Sigma_{K_i}\|$ and $\|K_i\|$ along the solution path, which is established in Lemma \ref{lm:bc}. Hence, by \eqref{scse} and \eqref{scse6} we have that $\nu_V$ is independent of $\alpha$. Meanwhile, by \eqref{scse3} and \eqref{scse2} we have
\$
14\sigma_{\theta} M(\alpha F+2M)=O(\alpha^3).
\$
Thus, for a sufficiently large $\alpha$, we have
\$
\alpha_Q\alpha_R\alpha^2\gamma \ge \alpha^4\gamma\ge 14\sigma_{\theta}\nu_V M(\alpha F+2M),
\$
which leads to Condition \ref{cond:cptb}.
Condition \ref{cond:cptb} plays a key role in establishing the convergence. On the one hand, to ensure the boundedness of the cost function $C(K_i;\theta_i)$, we require an upper bound of $\lambda/\eta$ in Condition \ref{con:1}. On the other hand, to ensure the convergence of the gradient algorithm, we require an upper bound of $\eta/\lambda$ in Condtion \ref{con100}. Condition \ref{cond:cptb} ensures such two requirements on stepsizes are compatible.
\subsection{Q-Linear Convergence}
In this section, we establish the Q-linear convergence of the gradient algorithm in \eqref{pg} and \eqref{cg}. Recall that the optimal policy takes the form $K^*=(B^\top PB+R)^{-1}B^\top PA$, where $P$ is the positive definite solution to the discrete-time algebraic Riccati equation \citep{anderson2007optimal},
\# \label{ip}
f(P,Q,R)=P-A^{\top}PA-Q+A^\top PB(B^\top PB+R)^{-1} B^\top PA=0.
\#
We denote by $P^*(Q,R)$ the corresponding implicit matrix-valued function defined by \eqref{ip}. Also, we define $Y\in{\mathbb{R}}^{d^2\times d^2}$ as
\$
Y_{(i-1) d+j,(k-1) d+\ell}=\frac{\partial f_{i,j}}{\partial P_{k,\ell}}\bigl(P^*(Q^*,R^*),Q^*,R^*\bigr),
\$
for $i,j,k,\ell\in[d]$. We assume the following regularity condition on $f$.
\begin{cond} \label{con:2}
The unique stationary point of cost parameter $(Q^*,R^*)$ is an interior point of $\Theta$.
Also, we assume that $\det(Y)\neq 0$.
\end{cond}
We define $K^*(\theta)$ as the unique optimal policy corresponding to the cost parameter $\theta$ and denote by $m^*(\theta)$ the corresponding value of the objective function $m(K,\theta)$ defined in \eqref{obj}, that is,
\#\label{kstar}
K^*(\theta)=\argmin_{K\in{\mathcal{K}}}C(K;\theta),\quad m^*(\theta)=m\bigl(K^*(\theta), \theta\bigr).
\#
The following two lemmas characterize the local properties of the functions $K^*(\theta)$ and $m^*(\theta)$ in a neighborhood of the saddle point $(K^*,\theta^*)$ of $m(K,\theta)$.
\begin{lemma}\label{qclm}
Under Condition \ref{con:2}, there exist constants $\tau_{K^*}$ and $\nu_{K^*}$, and a neighborhood ${\mathcal{B}}_K$ of $\theta^*$, such that $K^*(\theta)$ is $\tau_{K^*}$-Lipschitz continuous and $\nu_{K^*}$-smooth with respect to $\theta\in{\mathcal{B}}_K$.
\end{lemma}
\begin{proof}
See \S\ref{pqclm} for a detailed proof.
\end{proof}
\begin{lemma}\label{lm:lip3}
Under Condition \ref{con:2}, there exist a constant $\nu_{m^*}$ and a neighborhood ${\mathcal{B}}_{m^*}$ of $\theta^*$ such that $m^*(\theta)$ is $\gamma$-strongly concave and $\nu_{m^*}$-smooth with respect to $\theta\in{\mathcal{B}}_{m^*}$.
\end{lemma}
\begin{proof}
See \S\ref{plm:lip3} for a detailed proof.
\end{proof}
To establish the Q-linear convergence, we need an additional condition, which upper bounds the stepsizes $\eta$ and $\lambda$.
\begin{cond} \label{con:w686}
For the stepsizes $\eta$ and $\lambda$ in \eqref{pg} and \eqref{cg}, let
\$
\eta\le 2/(\alpha_R\mu+\nu_{K^*}),\quad
\lambda\le 2/(\gamma+\nu_{m^*}).
\$
\end{cond}
We define the following potential function
\#\label{eq:wz1}
Z_{i}=\| \theta_{i}-\theta^* \|_{{\text{F}}}+a\cdot\|K_{i}-K^*(\theta_{i})\|_{{\text{F}}},
\# where $a=\gamma/(3\tau_{K^*} \nu_{m^*})$. Note that $\lim_{i\rightarrow\infty}Z_i=0$ implies that $\{(K_i,\theta_i)\}_{i=0}^\infty$ converges to $(K^*,\theta^*)$, since we have $K^*(\theta^*)=K^*$. Also, we define
\# \label{qdef}
\upsilon=\max\bigl\{
1-\lambda \gamma + a\cdot \lambda \nu_{m^*} \tau_{K^*}, (1- \eta\alpha_R \mu) \cdot ( 1+ \lambda \tau_{V}/a +
\lambda \tau_{V} \tau_{K^*} )
\bigr\}.
\#
The following theorem establishes the Q-linear convergence of the gradient algorithm.
\begin{theorem}{\label{thm:lr}}
Under Conditions \ref{con:1}, \ref{cond:cptb}, \ref{con100}, \ref{con:2}, and \ref{con:w686}, we have $\upsilon\in(0,1)$ in \eqref{qdef}. There exists an iteration index $N>0$ such that $Z_{i+1}\le \upsilon\cdot Z_i$ for all $i>N$.
\end{theorem}
\begin{proof}
See \S\ref{qlsketch} for a detailed proof.
\end{proof}
\section{Proof Sketch} \label{proof}
In this section, we sketch the proof of the main results in \S\ref{analysis}.
\subsection{Proof of Stability Guarantee}
To prove Lemma \ref{lm:bc}, we lay out two auxiliary lemmas that characterize the geometry of the cost function $C(K;\theta)$ with respect to $K$. The first lemma characterizes the stationary point of policy optimization. The second lemma shows that $C(K;\theta)$ is gradient dominated with respect to $K$.
\begin{lemma} \label{lm:stp}
If $\nabla_K C(K;\theta)=0$, then $K$ is the unique optimal policy corresponding to the cost parameter $\theta$.
\end{lemma}
\begin{proof}
See \S\ref{plm:stp} for a detailed proof.
\end{proof}
\begin{lemma}[Corollary 5 in \cite{fazel2018global}]{\label{lm:gd}}
The cost function $C(K;\theta)$ is gradient dominated with respect to $K$, that is,
\$
C(K;\theta) - C(K^*(\theta);\theta) \leq \mu_C \cdot \|\nabla_K C(K;\theta)\|^2_{{\text{F}}},
\$
where $\mu_C=\|\Sigma_{K^*(\theta)}\|/(\mu^2\sigma_{\min}(R))$ and $K^*(\theta)$ is defined in \eqref{kstar}.
\end{lemma}
\begin{proof}
See \cite{fazel2018global} for a detailed proof.
\end{proof}
Lemma \ref{lm:gd} allows us to upper bound the increment of the cost function at each iteration in \eqref{pg} and \eqref{cg} by choosing a sufficiently small $\lambda$ relative to $\eta$. In fact, we construct a threshold such that when $C(K_{i};\theta_i)$ is close to such a threshold, an upper bound of the increment $C(K_{i+1};\theta_{i+1})-C(K_{i};\theta_i)$ goes to zero. Thus, $C(K_{i};\theta_i)$ is upper bounded by such a threshold. See \S\ref{appp1} for a detailed proof.
\subsection{Proof of Global Convergence} \label{lipsec}
To prove Theorem \ref{mainthm}, we first establish the Lipschitz continuity and smoothness of $m(K,\theta)$ in $K$ within a restricted domain $K^\dagger$ as in Lemma \ref{lm:lip1}. Recall that $V(K)$ is defined in \eqref{innerform} and $m(K,\theta)$ takes the form in \eqref{svform}. Since the matrix-valued function $\Sigma_{K}$ plays a key role in $V(K)$, in the sequel we characterize the smoothness of $\Sigma_{K}$ with respect to $K$ within a restricted set.
\begin{lemma}\label{lm:lip}
For any constant $S>0$, there exist constants $\tau_{\Sigma}$ and $\nu_{\Sigma}$ depending on $S$ such that
\$\|\Sigma_{K}-\Sigma_{K'}\|_{{\text{F}}} \le \tau_{\Sigma} \cdot \|K-K'\|_{{\text{F}}},\quad
\|\nabla_K(\Sigma_{K})_{j, \ell}-\nabla_K(\Sigma_{K'})_{j, \ell}\|_{{\text{F}}} \le \nu_{\Sigma}/d \cdot \|K-K'\|_{{\text{F}}}\$
for any $K,K' \in \{K\in{\mathbb{R}}^{k\times d} \,|\,\|\Sigma_K\|\le S\}$ and $j, \ell \in [d]$.
\end{lemma}
\begin{proof}
See \S\ref{plm:lip} for a detailed proof.
\end{proof}
Based on Lemmas \ref{lm:lip} and \ref{lm:bc}, we now prove Lemma \ref{lm:lip1}.
\begin{proof}
Let the set $K^{\dagger}$ in Lemma \ref{lm:lip1} be
\$
{\mathcal{K}}^\dagger=\bigl\{K\in{\mathbb{R}}^{k\times d} \,|\, \|\Sigma_K\|\le (\alpha F+2M)/\alpha_Q \bigr\}.
\$
Then by Lemma \ref{lm:bc}, we have
\$
\|\Sigma_{K_i}\| \le C(K_i;\theta_i)/\alpha_Q \le \alpha (F+2M)/\alpha_Q
\$
for all $i\ge0$, which implies $K_i\in{\mathcal{K}}^\dagger$ for all $i\ge0$. By Lemma \ref{lm:lip}, we obtain the Lipschitz continuity and smoothness of $\Sigma_{K}$ over ${\mathcal{K}}^\dagger$. Furthermore, by the definition of $V(K)$ in \eqref{innerform} and the boundedness of $K_i$ established in Lemma \ref{lm:bc}, $V(K)$ is also Lipschitz continuous and smooth over ${\mathcal{K}}^\dagger$. Thus, we conclude the proof of Lemma \ref{lm:lip1}.
\end{proof}
Based on Lemma \ref{lm:lip1}, we prove the global convergence in Theorem \ref{mainthm}. To this end, we construct a potential function that decays monotonically along the solution path, which takes the form
\#\label{potdef}
P_i=
m(K_i,\theta_i)+s\cdot \bigl((1+\eta \nu_V \sigma_{\theta})/2\cdot\|K_{i+1}-K_{i}\|_{{\text{F}}}^2
+(\eta/\lambda-\eta\gamma + \eta\lambda \nu^2 )/2\cdot
\|\theta_{i+1}-\theta_i\|_{{\text{F}}}^2\bigr)
\#
for some constant $s>0$, which is specified in the next lemma. Meanwhile, we define three constants $\phi_1$, $\phi_2$, and $\phi_3$ as
\#
\phi_1&=1/(2\eta)-\tau_{V}/2-s\cdot (\eta\lambda \tau_{V}^2+3\eta \nu_V \sigma_{\theta}),\label{eq:w1}\\
\phi_2&=s\cdot (\eta\gamma-\eta\lambda \nu^2)/2-
(1/\lambda+\tau_{V}+\nu)/2,\label{eq:w2}\\
\phi_3&=s \cdot (\eta\gamma-\eta\lambda \nu^2)/2-
(1/\lambda+\nu)/2 \label{eq:w3}.
\#
The following lemma characterizes the decrement of the potential function defined in \eqref{potdef} at each iteration.
\begin{lemma} \label{lm:dpf}
Under Conditions \ref{con:1}, \ref{cond:cptb}, and \ref{con100}, we have
\# \label{potd}
P_{i+1}-P_i \le -\phi_1\cdot\|K_{i+1}-K_i\|_{{\text{F}}}^2 -\phi_2 \cdot\|\theta_{i+1}-\theta_i\|_{{\text{F}}}^2 -\phi_3\cdot\|\theta_i-\theta_{i-1}\|_{{\text{F}}}^2.
\#
Moreover, we have $\phi_1,\phi_2,\phi_3>0$ for $s=12/(13\eta^2\nu_V\sigma_\theta)$.
\end{lemma}
\begin{proof}
See \S\ref{appp2} for a detailed proof.
\end{proof}
Based on Lemma \ref{lm:dpf}, we now prove Theorem \ref{mainthm}.
\begin{proof}
By the definitions of $P_i$ and $m(K,\theta)$ in \eqref{potdef} and \eqref{obj}, we have $P_i\ge\underline{P}$ for all $i\ge0$, where $\underline{P}$ is
\$
\underline{P}=\inf_{\theta\in\Theta}\bigl\{ -C(K_{\text{E}};\theta)-\psi(\theta)\bigr\} > -\infty.
\$
Here we use the fact $C(K;\theta)\ge0$ for any $K\in{\mathcal{K}}$ and $\theta\in\Theta$. Let $\phi=1/\min\{\phi_1,\phi_2\}$, where $\phi_1$ and $\phi_2$ are defined in \eqref{eq:w1} and \eqref{eq:w2}. By rearranging the terms in \eqref{potd}, we obtain
\$
\sum_{i=0}^{\infty} \|K_{i+1}-K_i\|_{{\text{F}}}^2+\|\theta_{i+1}-\theta_i\|_{{\text{F}}}^2 \le \sum_{i=0}^{\infty} \phi \cdot (P_{i}-P_{i+1})\le \phi\cdot (P_0-\underline{P})< \infty.
\$
By \eqref{pg} and \eqref{cg}, we have
\$
\sum_{i=0}^{\infty} \| L(K_i,\theta_i) \|_{{\text{F}}}^2 \le
\sum_{i=0}^{\infty} \phi'\cdot \bigl( \|K_{i+1}-K_i\|_{{\text{F}}}^2+\|\theta_{i+1}-\theta_i\|_{{\text{F}}}^2\bigr) \le \phi' \phi\cdot (P_0-\underline{P})< \infty,
\$
where $\phi'=\max\{1, 1/\eta^2, 1/\lambda^2 \}$, which implies that $\{\| L(K_i,\theta_i) \|_{{\text{F}}}\}_{i=0}^\infty$ converges to zero. Also, let
\#\label{zetadef}
\zeta=\phi' \phi \cdot (P_0-\underline{P}).
\#
For any $\varepsilon>0$, by the definition of $\Gamma(\varepsilon)$ in \eqref{Gammadefi}, we have
\$
\varepsilon\cdot \Gamma(\varepsilon)\le\sum_{i=0}^{\Gamma(\varepsilon)}\| L(K_i,\theta_i) \|_{{\text{F}}}^2 \le \phi' \phi \cdot (P_0-\underline{P})=\zeta,
\$
which implies $\Gamma(\varepsilon)\le \zeta/\varepsilon$. Hence, we conclude the proof of Lemma \ref{mainthm}.
\end{proof}
\subsection{Proof of Q-Linear Convergence}\label{qlsketch}
Theorem \ref{mainthm} states that $\{(K_i,\theta_i)\}_{i=0}^\infty$ converges to the unique saddle point $(K^*,\theta^*)$ starting from any stabilizing initial policy$(K_0,\theta_0)$. To establish the Q-linear rate of convergence in Theorem \ref{thm:lr}, we first prove that the cost function $C(K;\theta)$ is locally strongly convex over a neighborhood of the optimal policy $K^*(\theta)$ in the following lemma. Recall that $K^*(\theta)$ is defined in \eqref{kstar}.
\begin{lemma}\label{lm:ksc}
For any cost parameter $\theta\in\Theta$, its corresponding optimal policy $K^*(\theta)$ has a neighborhood ${\mathcal{K}}^*_{\theta}$ such that $C(K;\theta)$ is $(\alpha_R \mu)$-strongly convex with respect to $K\in{\mathcal{K}}^*_{\theta}$.
\end{lemma}
\begin{proof}
See \S\ref{plm:ksc} for a detailed proof.
\end{proof}
With Lemmas \ref{qclm}, \ref{lm:lip3}, and \ref{lm:ksc}, we establish Theorem \ref{thm:lr} based on the local strongly convex-concave property of $m(K,\theta)$ defined in \eqref{obj}. See \S\ref{aplr} for a detailed proof.
\bibliographystyle{ims}
| {'timestamp': '2019-01-14T02:21:49', 'yymm': '1901', 'arxiv_id': '1901.03674', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03674'} | arxiv |
\section{Introduction}\label{sec_introduction}
Mobile communication providing freedom from a tethered connection has led to an era of personalized world where users use network infrastructure at their will and comfort. With increasing usage of mobile applications for online transactions, the need of having strong security system to protect important information is increasing. In comparison to cryptographic techniques, physical layer security appears as a less-complex cost-effective solution \cite{amitav_TCST_2014}. For providing secure communication to {\color{black} all} users, physical layer security has recently gathered much interest in cooperative communication \cite{Bassily_SPM_2013}.
The concept of information theoretic security was introduced in a landmark paper by Wyner \cite{Wyner1975}, where the author proved {\color{black} the} feasibility of sending a message reliably to a destination, keeping it secret from an eavesdropper. Physical layer security utilizes {\color{black} the} inherent independence of subcarriers in an orthogonal frequency division multiple access (OFDMA) system. It has been investigated recently for OFDMA-based broadcast and cooperative communication for next generation communication systems, such as, fourth-generation (4G) LTE and {\color{black} fifth-generation} (5G) systems. {\color{black}An exhaustive survey on recent cooperative relaying and jamming strategies for physical layer security has been provided in \cite{Jameel_CST_2018}.} Below, we survey the related works on secure OFDMA systems.
\subsection{Prior Art}
\subsubsection{Resource Allocation without Subcarrier Pairing}
In physical layer security, the system models are {\color{black} generally classified in two broad categories -} one having external eavesdropper which is an entity external to the network \cite{LLai_TIT_2008, Jeong_TSP_2011, Jindal_CL_2015, Deng_TIFS_2015, Hmwang_TC_2015, Derrick_TWC_2011, HMWang_TVT_2015}, and the other having untrusted users which are actually legitimate users of the system, {\color{black} who} have lost mutual trust and consider each other as {\color{black} an} eavesdropper \cite{Jorswieck2008,Xiaowei_TIFS_2011,RSaini_CL_2016}.
Untrusted users is a far more hostile condition in comparison to external eavesdropper, {\color{black} where} each user contends for a subcarrier against rest of the users (behaving as eavesdroppers), which results in {\color{black} a} relatively complex resource allocation problem and lesser secure rate \cite{rsaini_TIFS_2016}.
{\em External Eavesdropper:}
In cooperative secure communication, several relaying strategies were proposed in \cite{LLai_TIT_2008}. In a {\color{black} decode and forward} (DF) relayed single source destination pair communication with direct link availability, and in presence of an external eavesdropper, power allocation was solved in \cite{Jeong_TSP_2011}. In a similar setup, resource allocation for an amplify and forward (AF) relayed cooperative communication was presented in \cite{Jindal_CL_2015}. Utility of a helper node as a relay or a jammer in a similar four-node setup was discussed in \cite{Deng_TIFS_2015} for ergodic secrecy rate maximization. In a four-node setup with a trusted DF relay, outage constrained secrecy throughput maximization was investigated in \cite{Hmwang_TC_2015} considering system power budget and unavailability of direct path. With imperfect channel state information (CSI) at a multi-antenna source, resource allocation problem in a DF relay-assisted system in presence of a multi-antenna eavesdropper was considered in \cite{Derrick_TWC_2011}. The work in {\color{black}\cite{Abedi_TWC_2016} considered sum secure rate maximization for a multiple DF relay assisted secure communication system, constrained by limited feedback, in presence of multiple eavesdroppers.} Joint beamforming, jamming, and power allocation problem was considered in \cite{HMWang_TVT_2015} for a single source-destination pair communication assisted by multiple AF relays in presence of an external eavesdropper. {\color{black}A robust resource allocation framework to handle an active full-duplex eavesdropper has been considered in \cite{Abedi_TWC_2017} assuming a full-duplex receiver. With the availability of direct path, but without any information about eavesdropper's CSI, \cite{Poursajadi_TVT_2018} considered the problem of security as well as reliability in presence of multiple relays. Recently, \cite{Zhang_JSAC_2018} investigated subcarrier and power allocation in an AF relay assisted secure non-orthogonal multiple access (NOMA) communication system.}
{\em Untrusted users:}
Considering a broadcast OFDMA based secure communication system with two untrusted users, subcarrier and power allocation problem was investigated in \cite{Jorswieck2008}. The authors in \cite{Xiaowei_TIFS_2011} considered resource allocation problem for two classes of users: one having secure rate demands, and the other having best effort traffic. In {\color{black} \cite{rsaini_TIFS_2016}, the authors considered sum rate maximization and max-min fairness optimization problems in a jammer assisted secure communication system with untrusted users.} Another important dimension to this field involves {\color{black} the} usage of helper nodes to improve secrecy performance of the communication system. In this direction, sum rate maximization and sum power minimization were presented in \cite{RSaini_CL_2016} for a DF relay-assisted system. With direct link availability in a DF relayed system, optimal transmission mode selection was investigated in \cite{RSaini_CL_2017}.
\subsubsection{Resource Allocation with Subcarrier Pairing}
Subcarriers on different hops in a cooperative communication system are independent. Mapping of subcarriers on two hops for performance optimization, is known as subcarrier pairing (SCP) \cite{Herdin_ICC_2006}. A few recent works that have explored SCP are discussed below.
{\em Non-secure OFDMA:} The authors in \cite{Hottinen_SPAWC_2007} proved that ordered pairing (OP) is optimal for an AF relayed network having no direct link. Subcarrier pairing in a non-secure OFDMA system with both AF and DF relay was presented in \cite{YLI_CL_2009}. Joint subcarrier pairing and power allocation in a DF relayed communication for both joint and individual power budget constraints were studied in \cite{HSU_TSP_2011}. Joint resource allocation for two-way AF relay-assisted multiuser networks was investigated in \cite{Guftar_TC_2011}.
{\em Secure OFDMA:}
Joint resource allocation problem involving subcarrier allocation, source power allocation and subcarrier pairing was studied in \cite{CCAI_WCSP_2015} for an AF relayed secure communication system considering equal power allocation at relay. Energy-efficient resource allocation problem in a multi-user multi-relay scenario with an external eavesdropper was studied in \cite{ZChang_ICC_2016}. Joint resource allocation for secure OFDMA two-way relaying with {\color{black} an} external eavesdropper and multiple source-destination pairs was discussed in \cite{Zhang_TII_2016}.
\subsection{Research Gap and Motivation}
{\color{black}Even though secure cooperative communication has been extensively studied with external eavesdroppers, not many works have considered systems with untrusted users. \emph{To the best of our knowledge, AF relay assisted secure OFDMA communication system with untrusted users has not been investigated yet}. We consider an AF relay assisted system for its inherent simplicity in terms of design, implementation cost, easier maintenance and less stringent signal processing requirements. Since, the rate definitions in AF and DF relayed communication systems are different, these are to be investigated separately. Further, observing that the SCP investigated for an external eavesdropper is not usable for untrusted users, we investigate SCP for both AF and DF relayed system with untrusted users. \emph{We also believe that, joint resource allocation involving subcarrier allocation, power allocation, and subcarrier pairing has not been investigated for untrusted users.}}
Lastly, it is also worth noting that the prior works considering SCP in secure OFDMA have solved the problem in dual domain \cite{CCAI_WCSP_2015, ZChang_ICC_2016, Zhang_TII_2016}. Their dual decomposition based iterative solutions suffer from duality gap error which vanishes only with very large number of subcarriers. In contrast, we investigate the problem in \emph{primal domain} itself, and thus, the solution obtained does not suffer from duality gap. \textit{In particular, a near-global-optimal joint resource allocation is proposed using an equivalent transformation {\color{black}for subcarrier allocation}, tight approximation {\color{black}for subcarrier pairing}, and generalized convexity principles {\color{black}for joint power allocation} \cite{Baz}; its quality has been both analytically described in Sections \ref{sec_sca_pa_af} and \ref{sec_opt_scp}, and numerically validated in Section \ref{sec_results}.}
\subsection{Contribution and Scope of Work}
The key contributions are summarized as follows:
\begin{enumerate}[label=(\alph*)]
\item {\color{black} We investigate a novel joint resource allocation problem for maximizing sum secure rate in both AF and DF relay-assisted secure OFDMA with untrusted users, and individual power budgets on source and relay. The practical constraints leads to a non-linear, non-convex optimization problem having exponential complexity with number of subcarriers, which belongs to the class of NP hard problems.}
\item Combinatorial aspect of subcarrier allocation is solved optimally. Joint power allocation with individual power budgets is proved to be generalized convex, and solved optimally through {\color{black} Karush-Kuhn-Tucker} (KKT) conditions. Thereafter, the combinatorial issue of subcarrier pairing is solved near-optimally such that {\color{black} the} proposed SCP tends to be globally-optimal as signal-to-noise ratio (SNR) increases.
\item {\color{black} SCP as a novel system design concept, i.e., channel gain tailoring, and the spectral and energy efficiency improvements through optimal SCP as a steady step towards green communication are corroborated via extensive numerical results. Their efficacy is further strengthened by comparing the proposed schemes against the benchmarks.}
\end{enumerate}
\begin{figure}[!t]
\centering
\epsfig{file=./source_relay_untrusted_users_scp.eps,width=3in}\vspace{-0.5mm}
\caption{System model describing the SCP $(n,o)$ between $\mathcal{S}-\mathcal{R}$ and $\mathcal{R}-\mathcal{U}$ links for different users.}
\label{fig:system_model}
\end{figure}
A preliminary version of this work was recently presented in \cite{GCW17_SCP}.
Secure cooperative communication with untrusted users is a practical scenario. Communication to secondary users in presence of primary users in a cognitive radio networks, and communication to sensor nodes by using one of the nodes as trusted relay in presence of nodes from other vendors in an {\color{black} internet of things} (IoT) based system are some of the {\color{black} example} scenarios with untrusted users, envisioned for advanced communication systems, such as 4G-LTE and 5G.
The concepts of \textit{global-optimal subcarrier allocation, generalized convexity based power allocation, and channel gain tailoring based near optimal SCP}, as developed in this work, can be extended to secure communication systems with multiple relays/antennas, for investigating other quality of service (QoS) aware utilities, such as ergodic/outage capacity.
\subsection{Paper Organization}
The system model and secure sum rate maximization problem are presented in Section \ref{sec_system_model}. The subcarrier and power allocation in AF and DF relay-assisted systems are considered in Section \ref{sec_sca_pa_af}. Optimal subcarrier pairing is discussed in Section \ref{sec_opt_scp}, and results are described in Section \ref{sec_results}. Concluding remarks are presented in Section \ref{sec_conclusion}.
\newcolumntype{C}{>{\centering\arraybackslash}p{3em}}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash}p{#1}}
\begin{table}[!htb]
\caption{Definitions of acronyms used}\label{acronym}
\centering
{\scriptsize
\begin{tabular}{|L{1.2cm} |L{3.3cm}| L{1.1cm}| L{3cm}| L{1.1cm}| L{4.1cm}|}
\hline
Acronym & Definition & Acronym & Definition & Acronym & Definition \\
\hline
OFDMA & Orthogonal division multiple access & KKT & Karush-Kuhn-Tucker condition & MINLP & Mixed integer non linear programming \\
\hline
DF & Decode and forward & AF & Amplify and forward & 4G & Fourth generation \\
\hline
LTE & Long term evolution & SNR & Signal to noise ratio & IoT & Internet of things\\
\hline
QoS & Quality of service & SCP & Subcarrier pairing & CSI & Channel state information \\
\hline
opt-SCP & Optimal SCP & OP & Ordered pairing & def-SCP & default SCP\\
\hline
OPA & Optimal power allocation & EPA & Equal power allocation & NOMA & Non-orthogonal multiple access\\
\hline
\end{tabular}
}
\end{table}
\section{System Model and Problem Formulation}\label{sec_system_model}
The downlink of a trusted relay assisted half duplex cooperative communication system with $N$ subcarriers and $M$ untrusted users $\mathcal{U}_m$ (cf. Fig. \ref{fig:system_model}) is considered. Relay $\mathcal{R}$ and source $\mathcal{S}$ have individual power budgets, which is more practical due to their geographically-separated locations. Secure communication with untrusted users is a practical scenario, with external eavesdropper's case being a simple extension. In this hostile environment, users {\color{black} have} lost mutual trust, and request communication from $\mathcal{S}$ {\color{black} assuming} other users as eavesdroppers.
All nodes are {\color{black} assumed to be} equipped with single antenna \cite{Jeong_TSP_2011, Jindal_CL_2015}. Due to deep fading, users are not directly reachable to source \cite{Hmwang_TC_2015, HMWang_TVT_2015, Derrick_TWC_2011, RSaini_CL_2016}. To communication with users, $\mathcal{S}$ has to communicate through $\mathcal{R}$. All subcarriers over source to relay $\mathcal{S}-\mathcal{R}$ link, and relay to users $\mathcal{R}-\mathcal{U}$ link are considered to face quasi-static Rayleigh fading. Since all users are legitimate in the system, perfect CSI of all the links is available at source using conventional channel estimation and feedback mechanisms \cite{Jeong_TSP_2011, Jindal_CL_2015, RSaini_CL_2016, Jorswieck2008, Xiaowei_TIFS_2011}.
\begin{remark}
Resource allocation which includes subcarrier allocation, power allocation, and subcarrier pairing can be performed at $\mathcal{S}$ as well as $\mathcal{R}$. Assuming $\mathcal{S}$ to be a controlling node, $\mathcal{S}$ completes resource allocation before transmission of a frame, through cooperation from $\mathcal{R}$.
\end{remark}
\subsection{Joint Resource Allocation Problem}
A system with $M$ untrusted users is equivalent to a multiple eavesdropper scenario where each user has to contend against {\color{black}rest of the} $M-1$ potential eavesdroppers over each subcarrier. The strongest eavesdropper with maximum SNR is hereafter referred to as \textit{equivalent eavesdropper} $\mathcal{U}_e$. Secure rate $R_{s_{n}}^m$ of user $\mathcal{U}_m$ over subcarrier $n$ is given as \cite{RSaini_CL_2016, Jorswieck2008, Xiaowei_TIFS_2011}:
\begin{eqnarray}\label{secure_rate_definition}
R_{s_{n}}^m = [R_{n}^m- R_{n}^e]^+,
\end{eqnarray}
where $R_{n}^i$ is the rate of the $i$th user over subcarrier $n$. $R_{n}^e$ is the rate of the equivalent eavesdropper $\mathcal{U}_e$ defined as $R_{n}^e = \max\limits_{k\in \{1,2,\cdots, M\} \setminus m} R_{n}^k$~ \cite{Jorswieck2008,Xiaowei_TIFS_2011,RSaini_CL_2016}. $R_{n}^i$ depends on the channel gains of {\color{black}the} $\mathcal{S}-\mathcal{R}$ and $\mathcal{R}-\mathcal{U}$ links, and source and relay powers, $P_{n}^s$ and $P_{n}^r$. Exact rate definition depends on the mode of operation of the relay, e.g. AF or DF (cf. \eqref{sec_rate_af_def_1} and \eqref{sec_rate_df_def_1}).
Sum secure rate maximization problem with individual power budgets can be stated as:
\begin{align}\label{opt_prob_rate_max_scp_base}
& \mathcal{P}0\!: \underset{P_{n,o}^s, P_{n,o}^r, \pi_{n,o}^m} {\text{maximize}} \left[ R_s = \sum_{m=1}^M \sum_{n=1}^N \sum_{o=1}^N \pi_{n,o}^m R_{s_{n,o}}^m \right]\!\!,\;\;\text{subject to:}\nonumber \\
&C_{0,1}: \sum_{m=1}^M\sum_{n=1}^N \pi_{n,o}^m \leq 1 \text{ } \forall o, ~ C_{0,2}: \sum_{m=1}^M\sum_{o=1}^N \pi_{n,o}^m \leq 1 \text{ } \forall n, ~ C_{0,3}: \sum_{n=1}^N P_{n}^s \leq P_S,\nonumber \\
& C_{0,4}: \sum_{n=1}^N P_{n}^r \leq P_R, \qquad\quad C_{0,5}: \pi_{n,o}^m \in \{0,1\} \text{ } \forall m, n, o, C_{0,6}: P_{n}^s\ge 0, P_{n}^r\ge 0 \text{ } \forall n
\end{align}
where $P_S$ and $P_R$, respectively, are the power budgets of $\mathcal{S}$ and $\mathcal{R}$. $\pi_{n,o}^m$ {\color{black}jointly} indicates subcarrier allocation and subcarrier pairing. $\pi_{n,o}^m=1$, if pair $(n,o)$ is allotted to user $\mathcal{U}_m$; else $\pi_{n,o}^m=0$. $C_{0,1}$ and $C_{0,2}$ ensures that one subcarrier on $\mathcal{S}-\mathcal{R}$ link can be attached with only one subcarrier on $\mathcal{R}-\mathcal{U}$ link. $C_{0,3}$ and $C_{0,4}$ are respective power budget constraints. $C_{0,5}$ shows the binary nature of allocation, and $C_{0,6}$ indicates power variables' non-negativity.
The joint resource allocation problem {\color{black}involving} subcarrier allocation, subcarrier pairing and power allocation is a combinatorial problem due to the binary {\color{black}nature of} subcarrier allocation and subcarrier pairing variables. With $P_{n,o}^r$ and $P_{n,o}^s$ as real variables, and $\pi_{n,o}^m$ as binary variables, there are $N(M+2)$ variables per subcarrier in the mixed integer non-linear programming (MINLP) problem $\mathcal{P}0$. {\color{black}Optimization problem $\mathcal{P}0$ having exponential complexity with number of subcarriers, belongs to the class of NP hard problems \cite{Y_F_LIU_TSP_2014}. Though globally optimal solution of this problem is the best upper bound on system performance, finding globally optimal solution may not be feasible in polynomial time.}
In order to handle the combinatorial non-convex joint optimization problem $\mathcal{P}0$, we decouple it into three parts by using an equivalent transformation (for global optimal subcarrier allocation), a tight approximation (for near-global-optimal SCP), and the generalized convexity principles (for global-optimal power allocation).
In particular, we first solve one of the combinatorial aspect by presenting the global optimal subcarrier allocation policy. Then, the {\color{black}other} combinatorial aspect is dealt by obtaining the optimal SCP policy using a tight approximation. Lastly, the global-optimal power allocation for a given subcarrier allocation, and SCP is obtained by utilizing the generalized convexity principles \cite{Baz}. Next, we present the key insights and reasoning behind this proposed joint resource allocation {\color{black}strategy}.
\subsection{Solution Methodology}
Since there is no direct ($\mathcal{S}-\mathcal{U}$) link availability, the subcarrier allocation has to be completed over the $\mathcal{R}-\mathcal{U}$ link only. The subcarrier pairing policy matches subcarriers over $\mathcal{S}-\mathcal{R}$ and $\mathcal{R}-\mathcal{U}$ links, which are independent. Thus, in our adopted system model with untrusted users, subcarrier allocation and subcarrier paring are \textit{independent}, which can be \textit{equivalently} decoupled as separate problems. Further, since the same power is received by the user as well as the eavesdropper over a subcarrier, subcarrier allocation which ensures positive secure rate, is also independent of the power allocation policy \cite{RSaini_CL_2016}. \textit{Hence, we summarize that the optimal subcarrier allocation is an independent decision, which can be done without compromising the joint optimality of the solution to the problem $\mathcal{P}0$.}
Next, we highlight that the other two allocations, {\color{black}namely}, subcarrier pairing, and power allocation are \textit{not independent}, as discussed later in Section \ref{sec_opt_scp}. So, to present an efficient solution methodology, we first assume that SCP is known, and we wish to jointly optimize subcarrier allocation and power allocation variables. In this context, in Section \ref{sec_sca_pa_af} we prove that for a known SCP, source and relay power allocation along with subcarrier allocation can be jointly solved \textit{global-optimally}.
Then later in Section \ref{sec_opt_scp}, we present a \textit{tight asymptotic approximation} for optimal SCP utilizing its independence from underlying power allocation in the high SNR regime.
This near-optimal SCP is utilized in the joint subcarrier and power allocation problem $\mathcal{P}1$ defined in Section \ref{sec_opt_scp}. Even after this relaxation in the SCP policy which is based on a tight approximation for effective channel gains to make SCP and power allocation independent of each other, later via Fig. \ref{fig:insight_c_df_af_2u3c} in Section \ref{proposed_optimal_vs_bruteforce} we numerically validate that the proposed joint solution matches closely with the global-optimal one as obtained after applying brute force over all possible SCP combinations.
\section{Joint Subcarrier and Power Allocation}\label{sec_sca_pa_af}
Observing that subcarrier pairing and power allocation are dependent, where as subcarrier allocation is independent of both of them, we consider joint subcarrier allocation and power allocation for a known subcarrier pairing.
Thus, we consider default subcarrier pairing where subcarrier $n$ on $\mathcal{S}-\mathcal{R}$ link is paired with subcarrier $n$ on $\mathcal{R}-\mathcal{U}$ link.
The secure sum rate maximization problem with this subcarrier pairing is given by
\begin{align}\label{opt_prob_rate_max}
& \mathcal{P}1: \underset{P_{n}^s, P_{n}^r, \pi_{n}^m,\,\forall n,m} {\text{maximize}} \left[ R_s = \sum_{m=1}^M \sum_{n=1}^N \pi_{n}^m R_{s_{n}}^m \right],\qquad\text{subject to:} \nonumber \\
&C_{1,1}: \sum_{m=1}^M \pi_{n}^m \leq 1 \text{ } \forall n, ~ C_{1,2}: \pi_{n}^m \in \{0,1\} \text{ } \forall m, n,
~C_{1,3}: \sum_{n=1}^N P_{n}^s \leq P_S, \nonumber \\& C_{1,4}: \sum_{n=1}^N P_{n}^r \leq P_R,
\quad ~C_{1,5}: P_{n}^s\ge 0, P_{n}^r\ge 0 \text{ } \forall n,
\end{align}
where $\pi_{n}^m$ is a subcarrier allocation variable. $C_{1,1}$ and $C_{1,2}$ are subcarrier allocation constraints. $C_{1,3}$ and $C_{1,4}$ are individual power budget constraints, and $C_{1,5}$ are power variables' non-negativity constraints. $\mathcal{P}1$ is a MINLP having $M+2$ variables per subcarrier, i.e., $\pi_{n}^m$ as $M$ binary variables, and $P_{n}^r$ and $P_{n}^s$ as real variables. First, we find the optimal subcarrier allocation policy for an AF relayed system after investigating the conditions for achieving positive secure rate over a subcarrier in Section \ref{sec_secure_rate}. Next, by observing the nature of secure rate with respect to source and relay powers in Section \ref{nature_secure_rate}, generalized convexity of the joint power allocation for a given optimal subcarrier allocation and SCP is proved, and the global-optimal power allocation is thus, obtained by solving the KKT conditions in Section \ref{conexity_and_solution_af}. For the sake of completeness, this section closes with a brief summary of the key results on {\color{black}the} optimal subcarrier and power allocations for a DF relayed system \cite{RSaini_CL_2016} in Section \ref{sec_sca_pa_df}. Details of the proposed SCP, and it's independence from the optimal power allocation as obtained using a tight approximation are presented in Section~\ref{sec_opt_scp}.
%
\subsection{Optimal Subcarrier Allocation Policy for AF relay}\label{sec_secure_rate}
In general, subcarrier allocation means allocating $N$ subcarriers among $M$ users. Since there is no direct link, subcarrier allocation has to be done at $\mathcal{R}$ for the subcarriers over the $\mathcal{R}-\mathcal{U}$ link. In {\color{black}an} AF relayed system, $R_{n}^m$ rate of user $\mathcal{U}_m$ over subcarrier $n$ is given as \cite{Jindal_CL_2015}:
\begin{eqnarray}\label{af_rate_definition}
R_{n}^m = \frac{1}{2} \log_2 \left \{ 1 + \frac{P_{n}^s\gamma_n^{sr}P_{n}^r\gamma_n^{rm}}{\sigma^2\left(\sigma^2 + P_{n}^s\gamma_n^{sr} + P_{n}^r\gamma_n^{rm}\right)} \right \},
\end{eqnarray}
where $\gamma_n^{sr}$ and $\gamma_n^{rm}$ are respective channel gains on $\mathcal{S}-\mathcal{R}$ and $\mathcal{R}-\mathcal{U}$ links over subcarrier $n$, $\sigma^2$ is additive white Gaussian noise (AWGN) variance. From \eqref{secure_rate_definition}, secure rate positivity condition can be stated as $R_{n}^m > R_{n}^e$. Using \eqref{af_rate_definition} along with monotonicity of $\log(\cdot)$ function:
\begin{eqnarray}
\frac{P_{n}^s\gamma_n^{sr}P_{n}^r\gamma_n^{rm}}{\sigma^2 + P_{n}^s\gamma_n^{sr} + P_{n}^r\gamma_n^{rm}} > \frac{P_{n}^s\gamma_n^{sr}P_{n}^r\gamma_n^{re}}{\sigma^2 + P_{n}^s\gamma_n^{sr} + P_{n}^r\gamma_n^{re}}.
\end{eqnarray}
After simplifications, feasibility condition for positive secure rate over a subcarrier $n$ is given by $\gamma_n^{rm}>\gamma_n^{re}$. This condition leads to {\color{black}the} optimal subcarrier allocation policy, i.e., allocate a subcarrier to the user having the maximum channel gain. Mathematically,
\begin{eqnarray}\label{subcarrier_alloc_relay}
\pi_{n}^m=
\begin{cases}
1 & \text{if $\gamma_{n}^{rm} > \max\limits_{o \in \{1,2,\cdots, M\} \setminus m} \gamma_{n}^{ro}$}\\
0 & \text{otherwise.}
\end{cases}
\end{eqnarray}
\begin{remark}
Condition \eqref{subcarrier_alloc_relay} is necessary and sufficient for positive secure rate over a subcarrier in {\color{black}a} trusted AF relay-assisted OFDMA system with untrusted users. Any other allocation except \eqref{subcarrier_alloc_relay} will lead to zero secure rate. It is also worth noting that subcarrier allocation policy for {\color{black}an} AF relay system is the same as that for {\color{black}a} secure DF relayed system \cite[eq. (5)]{RSaini_CL_2016}.
\end{remark}
\begin{remark}
The user having the next best channel gain is the equivalent eavesdropper $\mathcal{U}_e$. Since there is always a user having maximum gain over a subcarrier $n$, each subcarrier is allocated to some user. Thus, \emph{`no communication'} scenario does not arise in untrusted users.
\end{remark}
To obtain optimal power allocation, first we discuss the unique characteristics of the secure rate, and then prove that the joint power allocation is a generalized convex problem.
\subsection{Nature of Secure Rate in Source and AF Relay Powers}\label{nature_secure_rate}
After subcarrier allocation using \eqref{subcarrier_alloc_relay}, the secure rate $R_{s_n}^m$ of user $\mathcal{U}_m$ over subcarrier $n$ as defined in \eqref{af_rate_definition}, can be restated as:
\begin{align}\label{sec_rate_af_def_1}
&R_{s_n}^m = \frac{1}{2} \log_2 \left \{ 1 + \frac{P_{n}^s\gamma_n^{sr}P_{n}^r\gamma_n^{rm}}{\sigma^2(\sigma^2 + P_{n}^s\gamma_n^{sr} + P_{n}^r\gamma_n^{rm})} \right \} - \frac{1}{2} \log_2 \left \{ 1 + \frac{P_{n}^s\gamma_n^{sr}P_{n}^r\gamma_n^{re}}{\sigma^2(\sigma^2 + P_{n}^s\gamma_n^{sr} + P_{n}^r\gamma_n^{re})} \right \}
\end{align}
On applying further simplifications to \eqref{sec_rate_af_def_1}, we obtain:
\begin{eqnarray}\label{simplified_secure_rate}
R_{s_n}^m = \frac{1}{2} \log_2 \left[ \frac{(\sigma^2+P_{n}^r\gamma_n^{rm})(\sigma^2 + P_{n}^s\gamma_n^{sr} + P_{n}^r\gamma_n^{re})}{(\sigma^2+P_{n}^r\gamma_n^{re})(\sigma^2 + P_{n}^s\gamma_n^{sr} + P_{n}^r\gamma_n^{rm})} \right].
\end{eqnarray}
The following proposition outlines the nature of $R_{s_n}^m$ with {\color{black}the} power allocations $P_{n}^s$ and $P_{n}^r$.
\begin{proposition}\label{AF_secure_rate_nature}
The secure rate $R_{s_n}^m$ of user $\mathcal{U}_m$ over a subcarrier $n$ in {\color{black}an} AF relay-assisted secure communication system is a concave function of $P_{n}^s$, and a pseudoconcave function \cite{Baz} of $P_{n}^r$ achieving a unique maxima.
\end{proposition}
\begin{proof}
Let us denote the operand of the logarithm function in \eqref{simplified_secure_rate} as $\mathcal{O}_n^m$, i.e.,
\begin{eqnarray}
\mathcal{O}_n^m = \frac{(\sigma^2+P_{n}^r\gamma_n^{rm})(\sigma^2 + P_{n}^s\gamma_n^{sr} + P_{n}^r\gamma_n^{re})}{(\sigma^2+P_{n}^r\gamma_n^{re})(\sigma^2 + P_{n}^s\gamma_n^{sr} + P_{n}^r\gamma_n^{rm})}.
\end{eqnarray}
The first order derivative of $\mathcal{O}_n^m$ {\color{black}with respect to} (w.r.t.) $P_n^s$ is given as:
\begin{eqnarray}\label{rate_derivative_psn}
\frac{\partial \mathcal{O}_n^m}{ \partial P_n^s} = \left(\frac{\sigma^2 + P_{n}^r\gamma_n^{rm}}{\sigma^2 + P_{n}^r\gamma_n^{re}} \right) \frac{P_n^r \gamma_n^{sr} (\gamma_n^{rm}-\gamma_n^{re})}{(\sigma^2 + P_{n}^s\gamma_n^{sr} + P_{n}^r\gamma_n^{rm})^2}.
\end{eqnarray}
Since $\gamma_n^{rm}>\gamma_n^{re}$, derivative is always positive. Further, the second order derivative of $\mathcal{O}_n^m$ is always negative (cf. \eqref{eq:Prf1}). Thus, $\mathcal{O}_n^m$ is concave increasing in $P_n^s$. Since $\log(\cdot)$ is a concave increasing function, $R_{s_n}^m$ is concave in $P_n^s$ \cite{Bookboyd}.
To prove that secure rate is a pseudoconcave function of $P_n^r$, we prove that $R_{s_n}^m$ is unimodal with respect to $P_n^r$. The first order derivative of $\mathcal{O}_n^m$ with respect to $P_n^r$ is:
\begin{align}\label{rate_derivative_prn}
\frac{\partial \mathcal{O}_n^m}{ \partial P_n^r} = \frac{\gamma_n^{sr} P_n^s (\gamma_n^{rm}-\gamma_n^{re}) \left(\sigma^4+\gamma_n^{sr}P_n^s\sigma^2-\gamma_n^{rm}\gamma_n^{re}(P_n^r)^2 \right)}{(\gamma_n^{re}P_n^r + \sigma^2)^2(\gamma_n^{rm} P_n^r + \gamma_n^{sr} P_n^s + \sigma^2)^2}.
\end{align}
From \eqref{rate_derivative_prn}, we note that there exists an optimal relay power $P_{n}^{r^*}$ achieving the maximum value of $\mathcal{O}_n^m$. $P_{n}^{r^*} $ obtained by finding critical point of $\mathcal{O}_n^m$ with respect to $P_n^r$, is defined as:
\begin{eqnarray}\label{optimal_prn_for_psn}
P_{n}^{r^*} \triangleq \sqrt{\frac{(\sigma^4+P_{n}^s\gamma_n^{sr}\sigma^2)}{\gamma_n^{rm}\gamma_n^{re}}}.
\end{eqnarray}
Since $\log(\cdot)$ is a monotonic increasing function, pseudoconcavity of $\mathcal{O}_n^m$ with respect to $P_{n}^{r}$ is retained for $R_{s_n}^m$ also. Thus, secure rate is a pseudoconcave function of $P_{n}^{r}$, with an optimal $P_{n}^{r^*}$ achieving maximum secure rate over $n$.
\end{proof}
We next obtain the global-optimal power allocation in an AF-relayed secure OFDMA.
\subsection{Generalized Convexity and Power Allocation in AF relay}\label{conexity_and_solution_af}
After subcarrier allocation, combinatorial aspect of $\mathcal{P}1$ is solved. Joint source and relay power allocation problem for {\color{black}the} AF relay-assisted secure OFDMA system can be stated as:
\begin{align}\label{opt_prob_rate_max_power_allocation}
&\mathcal{P}2: \underset{P_{n}^s, P_{n}^r} {\text{max}}\sum_{n=1}^N \frac{1}{2} \log_2 \left[ \frac{(\sigma^2+P_{n}^r\gamma_n^{rm})(\sigma^2+ P_{n}^s\gamma_n^{sr} + P_{n}^r\gamma_n^{re})}{(\sigma^2+P_{n}^r\gamma_n^{re})(\sigma^2+ P_{n}^s\gamma_n^{sr} + P_{n}^r\gamma_n^{rm})} \right] \nonumber \\
&\text{subject to: } C_{2,1}: \sum_{n=1}^N P_{n}^s \leq P_S, \quad C_{2,2}: \sum_{n=1}^N P_{n}^r \leq P_R, \quad C_{2,3}: P_{n}^s\ge 0, P_{n}^r\ge 0 \text{ } \forall n.
\end{align}
The Lagrangian of the problem $\mathcal{P}2$ can be stated as:
\begin{align}\label{lagrange_opt_prob_rate_max_power_allocation}
&\mathcal{L}_2 = \sum_{n=1}^N \frac{1}{2} \log_2 \left[ \frac{(\sigma^2+P_{n}^r\gamma_n^{rm})(\sigma^2 + P_{n}^s\gamma_n^{sr} + P_{n}^r\gamma_n^{re})}{(\sigma^2+P_{n}^r\gamma_n^{re})(\sigma^2 + P_{n}^s\gamma_n^{sr} + P_{n}^r\gamma_n^{rm})} \right] -\lambda \left( \sum_{n=1}^N P_{n}^s - P_S \right) - \mu \left( \sum_{n=1}^N P_{n}^r - P_R \right).
\end{align}
Equating first order derivative of the Lagrangian w.r.t. $P_n^s$ to zero, we get:
\begin{eqnarray}\label{lagrange_derivative_with_psn}
\lambda = \frac{1}{2} \frac{P_n^r \gamma_n^{sr} (\gamma_n^{rm}-\gamma_n^{re})}{(\sigma^2 + P_{n}^s\gamma_n^{sr} + P_{n}^r\gamma_n^{rm})(\sigma^2 + P_{n}^s\gamma_n^{sr} + P_{n}^r\gamma_n^{re})}.
\end{eqnarray}
Likewise, equating first order derivative of Lagrangian w.r.t. $P_n^r$ to zero, we get:
\begin{align}\label{lagrange_derivative_with_prn}
&\mu = \frac{1}{2} \frac{P_n^s \gamma_n^{sr} (\gamma_n^{rm}-\gamma_n^{re})}{(\sigma^2 + P_{n}^s\gamma_n^{sr} + P_{n}^r\gamma_n^{rm})(\sigma^2 + P_{n}^s\gamma_n^{sr} + P_{n}^r\gamma_n^{re})} \nonumber \\
& \qquad \qquad . \frac{\left(\sigma^4+\gamma_n^{sr}P_n^s\sigma^2-\gamma_n^{rm}\gamma_n^{re}(P_n^r)^2 \right)}{(\sigma^2 + P_{n}^r\gamma_n^{rm})(\sigma^2 + P_{n}^r\gamma_n^{re})}
\end{align}
Now
we have an important result describing the utilization of source and relay power budgets.
\begin{proposition}\label{Af_relay_PS_PR_budget}
In {\color{black}an} AF relay-assisted secure OFDMA system, source power budget is fully utilized. Relay power budget may not be fully utilized, with the allocation such that $P_n^r \leq P_n^{r^*}$.
\end{proposition}
\begin{proof}
From \eqref{lagrange_derivative_with_psn} it can be noted that $\lambda=0$ results in $P_n^r = 0$. Since there is no direct connectivity between source and users, $P_n^r = 0$ means `no communication'. Thus, $\lambda>0$, which means that the source power budget constraint will always be active, i.e., $ \sum_{n=1}^N P_{n}^s = P_S $. Hence, the source power budget will be fully utilized.
From \eqref{lagrange_derivative_with_prn} we note that $\mu=0$ results in either $P_n^s = 0$, or $\gamma_n^{rm}\gamma_n^{re}(P_n^r)^2 = \sigma^4+\gamma_n^{sr}P_n^s\sigma^2$. The first condition is a `no communication' scenario, and the second condition indicates optimal relay power allocation (cf. \eqref{optimal_prn_for_psn}) on all subcarriers. Neglecting the possibility of `no communication', $\mu=0$ results in optimal relay power allocation $P_n^r=P_n^{r^*}$ on all subcarriers. $\mu=0$ indicates that the relay power constraint is inactive, i.e., $\sum_{n=1}^N P_{n}^r < P_R$, which means there is enough relay power budget to allow optimal power allocation on each subcarrier. On the other hand $\mu>0$ indicates $\sum_{n=1}^N P_{n}^r = P_R$, which results in $\gamma_n^{rm}\gamma_n^{re}(P_n^r)^2 < \sigma^4+\gamma_n^{sr}P_n^s\sigma^2$ (cf. \eqref{lagrange_derivative_with_prn}), i.e., $P_n^r<P_n^{r^*}$. Thus, relay power allocation is either $P_n^r=P_n^{r^*}$ or $P_n^r<P_n^{r^*}$ depending on the relay power budget $P_R$. These conditions also corroborates the concavity and pseudoconcavity of secure rate with $P_n^s$ and $P_n^r$, respectively, given in Proposition \ref{AF_secure_rate_nature}.
\end{proof}
Theorem \ref{Concavity_Theorem} below describes that power allocation $\mathcal{P}2$ is a generalized convex problem.
\begin{theorem}\label{Concavity_Theorem}
In {\color{black}an} AF relayed communication system, joint power allocation is generalized convex in $P_{n}^s$ and $P_{n}^r$ under practical scenarios, and has global optimal solution $P_{n}^{s^*}, P_{n}^{r^*}$.
\end{theorem}
\begin{proof}
See \ref{app1}.
\end{proof}
As $\mathcal{P}2$ is a generalized convex optimization problem, its global optimal solution is obtained by solving the KKT conditions. In order to find out {\color{black}the} joint optimal solution $(P_{n}^{s^*}, P_{n}^{r^*})$, first order derivative equations \eqref{lagrange_derivative_with_psn} and \eqref{lagrange_derivative_with_prn} which represent subgradient conditions are to be solved along with the complimentary slackness conditions $\lambda \left( \sum_{n=1}^N P_{n}^s - P_S \right) = 0$, and $\mu \left( \sum_{n=1}^N P_{n}^r - P_R \right) = 0$. Observing \eqref{lagrange_derivative_with_psn} and \eqref{lagrange_derivative_with_prn}, we note that the two conditions are tightly interconnected such that it is not possible to obtain closed form analytical solution for $P_{n}^s$ and $P_{n}^r$. However, the optimal solution can be found by a two-dimensional search for optimal $\lambda$ and $\mu$, using either subgradient method or any convex problem solver.
\subsection{Subcarrier and Power Allocation in DF Relay}\label{sec_sca_pa_df}
For a DF relayed secure cooperative communication system, the resource allocation problem involving subcarrier and power allocation is presented in \cite{RSaini_CL_2016}. The concepts and key contributions have been described in the following subsection. The secure rate in {\color{black}a} DF relayed system over a subcarrier $n$ is
\begin{equation}\label{sec_rate_df_def_1}
R_{s_{n}}^m = \frac{1}{2} \left\{ \min{ (R_{n}^{sr}, R_{n}^{rm} ) } - R_{n}^{re} \right\}^+.
\end{equation}
where $R_{n}^{sr}$ and $R_{n}^{rm}$ respectively denote the rates of $\mathcal{S}-\mathcal{R}$ and $\mathcal{R}-\mathcal{U}_m$ link.
In a DF relayed system, rates $R_{n}^{sr}$ and $R_{n}^{rm}$ are given by
$\log_2 \left( 1+ \frac{P_{n}^s\gamma_{n}^{sr}}{\sigma^2}\right)$ and
$\log_2 \left( 1+ \frac{P_{n}^r\gamma_{n}^{rm}}{\sigma^2}\right)$,
respectively.
Optimal subcarrier allocation for DF relayed system \cite[eq. (5)]{RSaini_CL_2016} is the same as that of {\color{black}an} AF relayed system \eqref{subcarrier_alloc_relay}.
The optimization problem for sum secure rate maximization with individual power budgets constraints is given as \cite{RSaini_CL_2016}:
\noindent \begin{align}\label{opt_prob_rate_max_simplified_obj}
& \mathcal{P}3: \underset{P_{n}^s, P_{n}^r, t_n,\,\forall n} {\text{maximize}} \left[ \widehat{R_{s}} \triangleq \sum_{n=1}^N \frac{1}{2} \left \{ \log_2 \left( \frac{1+ t_n} {1+ \frac{P_{n}^r \gamma_{n}^{re}}{\sigma^2}} \right) \right \} \right], ~~\text{subject to: } \nonumber \\
& C_{3,1}: t_n \leq \frac{P_{n}^s\gamma_{n}^{sr}}{\sigma^2} \text{ } \forall n, \quad C_{3,2}: t_n \leq \frac{P_{n}^r\gamma_{n}^{rm}}{\sigma^2} \text{ } \forall n, \qquad C_{3,3}: \sum_{n=1}^N P_{n}^s \leq P_S,\nonumber \\
& C_{3,4}: \sum_{n=1}^N P_{n}^r \leq P_R, \qquad C_{3,5}: P_{n}^r \gamma_{n}^{re} \le P_{n}^s \gamma_{n}^{sr} \text{ } \forall n
\quad ~C_{3,6}: P_{n}^s\ge 0, P_{n}^r\ge 0 \text{ } \forall n
\end{align}
$C_{3,1}$ and $C_{3,2}$ are from the definition of $min$ function. $C_{3,3}$ and $C_{3,4}$ are power budget constraints. $C_{3,5}$ comes from secure rate positivity constraints, and $C_{3,6}$ captures power budget constraints. Theorem 1 in \cite{RSaini_CL_2016} states that, for energy-efficient optimal power allocation over each subcarrier $t_n = \frac{P_{n}^s \gamma_{n}^{sr}}{\sigma^2} = \frac{P_{n}^r \gamma_{n}^{rm}}{\sigma^2}$. Now, the power allocation problem gets simplified as:
\begin{align}\label{opt_prob_rate_max_simplified_obj2}
& \mathcal{P}4: \underset{P_{n}^r,\,\forall n} {\text{maximize}} \left[ \sum_{n=1}^N \frac{1}{2} \left \{ \log_2 \left( \frac{\sigma^2+ P_{n}^r \gamma_{n}^{rm}} {\sigma^2+ P_{n}^r \gamma_{n}^{re}} \right) \right \} \right] \nonumber \\
&\text{subject to: } C_{4,1}: \sum_{n=1}^N \frac{P_{n}^r \gamma_{n}^{rm}}{\gamma_{n}^{sr}} \leq P_S, \quad C_{4,2}: \sum_{n=1}^N P_{n}^r \leq P_R, \quad C_{4,3}: P_{n}^r\ge 0 \text{ } \forall n.
\end{align}
As noted in \cite{RSaini_CL_2016}, $\mathcal{P}4$ belongs to the class of generalized convex problems. KKT conditions can be used to find the optimal solution of $\mathcal{P}4$. The Lagrangian of the problem is:
\begin{align}\label{lagrange_rate_maximization}
&\mathcal{L}_4 = \sum_{n=1}^N \frac{1}{2} \left \{ \log_2 \left( \frac{\sigma^2+ P_{n}^r \gamma_{n}^{rm}} {\sigma^2+ P_{n}^r \gamma_{n}^{re}} \right) \right \} - \lambda \left( \sum_{n=1}^N \frac{P_{n}^r \gamma_{n}^{rm}}{\gamma_{n}^{sr}} - P_S \right) - \mu \left( \sum_{n=1}^N P_{n}^r - P_R \right).
\end{align}
Setting the first {\color{black}order} derivative of $\mathcal{L}_4$ w.r.t. $P_{n}^r$ to zero, we obtain:
\begin{eqnarray}\label{power_allocation_df_analytical}
\frac{\sigma^2 \left(\gamma_{n}^{rm}-\gamma_{n}^{re}\right)} {2\left(\sigma^2 + P_{n}^r\gamma_{n}^{rm}\right) \left(\sigma^2 + P_{n}^r\gamma_{n}^{re} \right)} = \mu + \lambda \left( \frac{\gamma_{n}^{rm}}{\gamma_{n}^{sr}} \right) \text{ } \forall n.
\end{eqnarray}
Optimal $P_{n}^r$ is obtained as a single positive real root of \eqref{power_allocation_df_analytical}, and $P_{n}^s$ is obtained using $P_{n}^s \gamma_{n}^{sr} = P_{n}^r \gamma_{n}^{rm}$. After obtaining the joint optimal subcarrier allocation and power allocation policies for both AF and DF relayed systems, we next consider the optimal subcarrier pairing policy and its utility in improving the sum secure rate further.
\section{Optimal Subcarrier Pairing as Effective Channel Gain Tailoring}\label{sec_opt_scp}
The concept of {\color{black}pairing} subcarrier $n$ on $\mathcal{S}-\mathcal{R}$ link with any of the subcarrier $o$ on $\mathcal{R}-\mathcal{U}$ link is referred as subcarrier pairing (SCP). This introduces another degree of freedom, resulting in improved system performance. This performance gain is achieved at the cost of combinatorial aspect added because of SCP, which makes {\color{black}the} joint resource allocation problem more complex. In fact, an $N$ subcarrier based two hop cooperative system has $N!$ possible SCP combinations.
This section presents a near optimal subcarrier pairing scheme designed specifically for secure OFDMA based communication system. An optimal SCP is supposed to match subcarriers on two hops for maximizing the secure rate over each subcarrier. The scheme of pairing sorted gains on $\mathcal{S}-\mathcal{R}$ link with the gains on $\mathcal{R}-\mathcal{U}$ link, proposed for non-secure OFDMA \cite{Hottinen_SPAWC_2007}, and hereafter referred as 'ordered pairing' (OP) is not suitable for secure systems as secure rate definition involves gains of the main user {\color{black}as well as} the eavesdropper. Observing that finding effective channel gain analytically, in a secure OFDMA system, is non-trivial, effective channel gain is obtained in high SNR region. Note that even if water filling schemes for secure OFDMA and normal OFDMA are different, like normal water filling, secure water filling provides more power to the subcarrier with larger effective channel gain.
SCP can help in improving either {\color{black}the} spectral efficiency, or {\color{black}the} energy efficiency, or both. First, we discuss SCP for a DF relayed system in Section \ref{scp_df} because in this case SCP helps in improving either spectral efficiency or energy efficiency. We discuss SCP for {\color{black}an} AF relayed communication system in Section \ref{scp_af}, where it improves the spectral efficiency. A brief comparison of resource allocation schemes for {\color{black}both} AF and DF relayed communication systems is presented in Section \ref{comparison_af_df}, and complexity analysis is presented in section \ref{complexity_analysis}.
\begin{remark}
The term effective channel gain, over a subcarrier pair $(n,o)$, is used to refer to the end to end channel gain involving the channel gains of both $\mathcal{S}-\mathcal{R}$ and $\mathcal{R}-\mathcal{U}$ links.
\end{remark}
\begin{remark} Using conventional definitions of efficiency, improvement in efficiency implies saving of the input resource for achieving a fixed output utility. Thus, improvement in energy efficiency means using lesser power for realizing a given rate, and improvement in spectral efficiency implies higher secure rate for the same power budget.
\end{remark}
\subsection{Optimal SCP for DF Relay System}\label{scp_df}
In order to estimate the benefits of SCP, we need to investigate the possibility of improvement in the system secure rate performance after optimal power allocation. Next, we discuss all power allocation cases in a DF relayed system. From \eqref{power_allocation_df_analytical}, note that depending on relay and source power budgets, there could be three scenarios: (a) $\lambda=0$, $\mu>0$; (b) $\lambda>0$, $\mu=0$; (c) $\lambda>0$, $\mu>0$. In the following we discuss each of these cases in detail.
\subsubsection{Case (a): $\lambda=0$, $\mu>0$}
The source power budget constraint is inactive since $\lambda=0$. $\mu>0$ implies that relay power $P_R$ gets used completely and is bottleneck. In this case, we have following observation.
\begin{proposition}\label{prop_df_pr_budget}
In a DF relay assisted secure communication system, the maximum secure rate is controlled by relay power budget $P_R$ when there is enough source power budget $P_S$. In this case, SCP assumes an important role of improving energy efficiency, and helps in achieving secure rate bound by using lesser transmit power.
\end{proposition}
\begin{proof}
Using $\lambda=0$ in \eqref{power_allocation_df_analytical}, after simplification we get
\begin{eqnarray}\label{power_allocation_df_analytical_case_a}
\frac{\sigma^2(\gamma_{o}^{rm}-\gamma_{o}^{re})} {2\left(\sigma^2 + P_{o}^r\gamma_{o}^{rm}\right) \left(\sigma^2 + P_{o}^r\gamma_{o}^{re} \right)} = \mu, \text{ } \forall o.
\end{eqnarray}
\eqref{power_allocation_df_analytical_case_a} leads to a quadratic in $P_o^r$, and the optimal solution is the positive real root of the quadratic. $\mu$ is obtained such that $\sum_{o=1}^N P_{o}^r = P_R$. Note that, $P_o^r$ depends on $P_R$ and not on $P_S$. Thus, achievable maximum rate on each subcarrier, and thereby possible maximum sum secure rate depends on $P_R$. Next, we show that this upper bound on secure rate is dependent on available source power and utilization of optimal SCP.
SCP has a limited role in this case because maximum rate is controlled by the $\mathcal{R}-\mathcal{U}$ link. Here SCP can help in achieving the secure rate upper bound but not beyond, thus limited role in spectral efficiency. While SCP has key role in terms of energy efficiency. Through optimal power allocation in DF system, i.e., $P_{n}^s\gamma_{n}^{sr}=P_{o}^r\gamma_{o}^{rm}$ the same SNR is ensured on subcarrier $n$ over $\mathcal{S}-\mathcal{R}$ link and subcarrier $o$ over $\mathcal{R}-\mathcal{U}$ link. Thus, a subcarrier having high $\gamma_{n}^{sr}$ on $\mathcal{S}-\mathcal{R}$ link should be matched with a subcarrier having high $P_{o}^r\gamma_{o}^{rm}$ on $\mathcal{R}-\mathcal{U}$ link, otherwise less source power will be left for the remaining subcarriers. If SCP is not optimally done then source power budget will get bottlenecked, and the achievable rate will be lower. Thus, SCP helps in better spectral efficiency by obtaining the rate upper bound.
Let us discuss the role of SCP in improving energy efficiency through an example. Let there be two subcarriers on $\mathcal{S}-\mathcal{R}$ link with gains such that $\gamma_{1}^{sr}>\gamma_{2}^{sr}$. Over $\mathcal{R}-\mathcal{U}$ link, let the power allocation on these two subcarriers be such that $P_{1}^r\gamma_{1}^{rm}>P_{2}^r\gamma_{2}^{rm}$. Let us consider two pairing scenarios. In first, subcarrier-1 on $\mathcal{S}-\mathcal{R}$ link gets paired with subcarrier-1 on $\mathcal{R}-\mathcal{U}$ link, and in second, subcarrier-1 on $\mathcal{S}-\mathcal{R}$ link gets paired with subcarrier-2 on $\mathcal{R}-\mathcal{U}$ link. Sum source power requirements for the two scenarios are:
\begin{eqnarray}\label{power_req_df_case_a_2u2c}
P_{S_1} = \frac{P_{1}^r\gamma_{1}^{rm}}{\gamma_{1}^{sr}}+\frac{P_{2}^r\gamma_{2}^{rm}}{\gamma_{2}^{sr}}; P_{S_2} = \frac{P_{1}^r\gamma_{1}^{rm}}{\gamma_{2}^{sr}}+\frac{P_{2}^r\gamma_{2}^{rm}}{\gamma_{1}^{sr}}.
\end{eqnarray}
Using \eqref{power_req_df_case_a_2u2c}, $P_{S_{\Delta}} = P_{S_1} - P_{S_2}$, can be simplified as:
\begin{equation}
P_{S_{\Delta}} = (P_{2}^r\gamma_{2}^{rm}-P_{1}^r\gamma_{1}^{rm})\left( \frac{\gamma_{1}^{sr}-\gamma_{2}^{sr}}{\gamma_{1}^{sr}\gamma_{2}^{sr}} \right) < 0
\end{equation}
Note that the source power requirement in second scheme is more. Thus, the scheme which matches a higher $\gamma_{n}^{sr}$ subcarrier with a subcarrier having higher $P_{o}^r\gamma_{o}^{rm}$ is energy-efficient.
\end{proof}
\begin{remark}\label{rm_scp_df_case1}
For a bottle-necked $P_R$ budget case, optimal SCP matches the sorted $\gamma_{n}^{sr}$ on $\mathcal{S}-\mathcal{R}$ link and $P_{o}^r\gamma_{o}^{rm}$ on $\mathcal{R}-\mathcal{U}$ link, one by one. This schemes requires lesser source power, and hence energy efficiency gets improved
\end{remark}
\subsubsection{Case (b): $\lambda>0$, $\mu=0$}
$\lambda>0$ implies that source power budget $P_S$ gets fully utilized and is the bottleneck. Relay power budget constraint is inactive. Placing $P_{o}^r$ as $P_{n}^s\gamma_{n}^{sr}/\gamma_{o}^{rm}$ and $\mu=0$, \eqref{power_allocation_df_analytical} is simplified:
\begin{eqnarray}\label{power_allocation_df_analytical_case_b}
\frac{\sigma^2(\gamma_{n}^{sr}-\gamma_{n}^{sr'})} {2\left(\sigma^2 + P_{n}^s\gamma_{n}^{sr}\right) \left(\sigma^2 + P_{n}^s\gamma_{n}^{sr'} \right)} = \lambda, \text{ } \forall n
\end{eqnarray}
where $\gamma_{n}^{sr'} \triangleq \frac{\gamma_{n}^{sr}\gamma_{o}^{re}}{\gamma_{o}^{rm}}$. Note the similarity of this equation with \eqref{power_allocation_df_analytical_case_a}. Optimal $P_{n}^s$ is the positive real root of the quadratic equation obtained from \eqref{power_allocation_df_analytical_case_b}. $\lambda$ is obtained such that $\sum_{n=1}^N P_{n}^s = P_S$. Note that $P_{n}^s$ depends on $\gamma_{n}^{sr'}$ which imbibes SCP.
$\gamma_{n}^{sr'}$ depends on which subcarrier $n$ on $\mathcal{S}-\mathcal{R}$ link is paired with which one $o$ on $\mathcal{R}-\mathcal{U}$ link. SCP need to match $\gamma_{n}^{sr}$ with $\gamma_{o}^{rm}$ and $\gamma_{o}^{re}$ for sum rate maximization. Thus, SCP maximizes the achievable sum rate, and improves spectral efficiency. This observation is summarized as follows.
\begin{proposition}\label{prop_df_ps_budget}
In a DF relayed secure communication system with high $P_R$, necessary condition to achieve higher secure rate is to match a subcarrier $n$ having higher $\gamma_{n}^{sr}$ on $\mathcal{S}-\mathcal{R}$ link with a subcarrier $o$ having higher $\gamma_{o}^{rm}/\gamma_{o}^{re}$ on $\mathcal{R}-\mathcal{U}$ link.
\end{proposition}
\begin{proof}
To maximize sum secure rate, power should be allocated in such a way that a subcarrier with higher effective channel gain is allocated higher power. Note that finding effective channel gain $\Gamma_{(n,o)}^{d}$ over a subcarrier pair $(n,o)$ in DF relay system is non-trivial in the general case (cf. \eqref{power_allocation_df_analytical_case_b}). In the high SNR region, \eqref{power_allocation_df_analytical_case_b} gets simplified as
\begin{eqnarray}
\frac{\sigma^2(\gamma_{n}^{sr}-\gamma_{n}^{sr'})} {2(P_{n}^s)^2\gamma_{n}^{sr}\gamma_{n}^{sr'}} = \lambda \text{ } \forall n.
\end{eqnarray}
Thus, the effective channel gain under high SNR scenario reduces to
\begin{eqnarray}
\Gamma_{(n,o)}^{d} = \frac{\gamma_{n}^{sr}-\gamma_{n}^{sr'}}{\gamma_{n}^{sr}\gamma_{n}^{sr'}} = \frac{\gamma_{o}^{rm}-\gamma_{o}^{re}}{\gamma_{n}^{sr}\gamma_{o}^{re}} = \frac{1}{\gamma_{n}^{sr}} \left( \frac{\gamma_{o}^{rm}}{\gamma_{o}^{re}}-1 \right).
\end{eqnarray}
$\Gamma_{(n,o)}^{d}$ includes channel gains of both the links i.e., $\gamma_n^{sr}$ on $\mathcal{S}-\mathcal{R}$ link, and $\gamma_o^{rm}$ and $\gamma_o^{re}$ on $\mathcal{R}-\mathcal{U}$ link. SCP should be efficiently used to match gains of $\mathcal{S}-\mathcal{R}$ and $\mathcal{R}-\mathcal{U}$ links to find optimal effective channel gains.
To find optimal SCP in this scenario, let us discuss a simple case of two subcarriers such that $\gamma_{1}^{sr}>\gamma_{2}^{sr}$. To achieve more rate on subcarrier-1, we should have $\Gamma_{1}^{d}>\Gamma_{2}^{d}$ such that $P_{1}^s>P_{2}^s$. With reference to channel gains there exists only two possibilities either $\frac{\gamma_{1}^{rm}}{\gamma_{1}^{re}} \leq \frac{\gamma_{2}^{rm}}{\gamma_{2}^{re}}$ or $\frac{\gamma_{1}^{rm}}{\gamma_{1}^{re}} > \frac{\gamma_{2}^{rm}}{\gamma_{2}^{re}}$. In the first we have $\frac{\gamma_{1}^{rm}}{\gamma_{1}^{re}}-1 \leq \frac{\gamma_{2}^{rm}}{\gamma_{2}^{re}} -1$, hence $\gamma_{2}^{sr}\left( \frac{\gamma_{1}^{rm}}{\gamma_{1}^{re}}-1 \right) \leq \gamma_{1}^{sr}\left(\frac{\gamma_{2}^{rm}}{\gamma_{2}^{re}} -1\right)$ $\implies$ $\Gamma_{1}^{d} \leq \Gamma_{2}^{d}$. Thus, the only feasible case is $\frac{\gamma_{1}^{rm}}{\gamma_{1}^{re}} > \frac{\gamma_{2}^{rm}}{\gamma_{2}^{re}}$. To ensure, subcarrier with higher effective channel gain is allocated higher power, higher $\gamma_{n}^{sr}$ should be paired with higher $\frac{\gamma_{o}^{rm}}{\gamma_{o}^{re}}$.
\end{proof}
For $\lambda>0$, $\mu=0$, necessary condition for optimal SCP are presented by Proposition \ref{prop_df_ps_budget}. Next, it is proved that this pairing scheme is the sufficient condition to improve overall system performance. We present this observation through following theorem. This theorem conceptualizes SCP as \emph{channel gain tailoring} compared to conventional subcarrier mapping.
\begin{theorem}\label{theorem_df_scp_channel_tailoring}
For efficient secure communication, ideal SCP should tailor channel gains such that all subcarriers have same effective channel gain. Practically, optimal SCP wishes to reduce the variance of effective channel gains.
\end{theorem}
\begin{proof}
See \ref{app2}.
\end{proof}
The optimal SCP strategy is to tailor the channel gains such that effective channel gains are equal, which leads to equal power allocation, and hence equal rate over all the subcarriers. This may not be feasible as the channels gains are discrete quantities. Hence, a feasible solution is to minimize the variance between the tailored channel gains.
\begin{remark}
The optimal SCP in this case, where $P_S$ budget is fully utilized, is to sort $\gamma_{n}^{sr}$ on $\mathcal{S}-\mathcal{R}$ link and $\frac{\gamma_{o}^{rm}}{\gamma_{o}^{re}}$ on $\mathcal{R}-\mathcal{U}$ link, and match one by one.
\end{remark}
\begin{corollary}
When $P_R$ budget is bottleneck (case (a)), the channel gain tailoring reduces to the SCP strategy of matching $\gamma_{n}^{sr}$ on $\mathcal{S}-\mathcal{R}$ link with $P_{o}^r\gamma_{o}^{rm}$ on $\mathcal{R}-\mathcal{U}$ (cf. remark \ref{rm_scp_df_case1}).
\end{corollary}
\subsubsection{Case (c): $\lambda>0$, $\mu>0$}
$\lambda>0$ and $\mu>0$ is a not a common case, channel gains should be such that $P_n^s\gamma_{n}^{sr} = P_o^r\gamma_{o}^{rm}$ is {\color{black}satisfied} on each subcarrier. Further, both power budgets are tight, i.e., $\sum_{n=1}^N P_{n}^s = P_S$ and $\sum_{o=1}^N P_{o}^r = P_R$. We know that achievable sum secure rate is bounded by $P_R$ (cf. Proposition \ref{prop_df_pr_budget}). Note that optimal SCP matching a higher $\gamma_{n}^{sr}$ with higher $P_o^r\gamma_{o}^{rm}$ is energy-efficient as indicated in the proof of the proposition. The source power budget requirement will be more than the optimal value if optimal SCP is not followed. Then, $P_S$ will {\color{black}become} the effective bottleneck {\color{black}and} the achievable sum secure rate will be lower compared to the upper bound decided by secure water filling on $\mathcal{R}-\mathcal{U}$ link.
\emph{To summarize, in {\color{black}a} DF relayed system optimal SCP is conditioned on power budgets $P_S$ and $P_R$. Firstly, relay power allocation is done assuming relay power budget $P_R$ is the bottleneck. Subcarriers over $\mathcal{S}-\mathcal{R}$ link sorted according to $\gamma_{n}^{sr}$ are matched with subcarriers over $\mathcal{R}-\mathcal{U}$ link sorted according to $P_o^r\gamma_{o}^{rm}$. $P_n^s$ is obtained using \cite[Theorem 1]{RSaini_CL_2016}. If $\sum_{n=1}^N P_{n}^s \leq P_S$, then this SCP and power allocation are optimal. Otherwise (if $\sum_{n=1}^N P_{n}^s > P_S$), the actual bottleneck is source power budget $P_S$ and not $P_R$. Now, subcarriers over $\mathcal{S}-\mathcal{R}$ link sorted according to $\gamma_{n}^{sr}$ are paired with subcarriers over $\mathcal{R}-\mathcal{U}$ link sorted according to $\gamma_{o}^{rm}/\gamma_{o}^{re}$. Source power allocation is achieved by using secure water filling on the $\mathcal{S}-\mathcal{R}$ link.}
\subsection{Optimal SCP for AF Relay System}\label{scp_af}
In {\color{black}an} AF relay, secure rate is concave increasing function of source power, and has pseudoconcave nature with relay power (cf. Proposition \ref{AF_secure_rate_nature}). Since optimal relay power $P_o^{r^*}$ is dependent on source power $P_n^s$ (cf. \eqref{optimal_prn_for_psn}), optimal power allocation has to be solved jointly at the source. Power allocation in {\color{black}an} AF relay system is not decomposable as in {\color{black}a} DF relay case, and power allocation cannot be obtained analytically in terms of independent equation of $P_n^s$ and $P_o^r$, due to inter-dependent source and relay power equations (cf. \eqref{lagrange_derivative_with_psn} and \eqref{lagrange_derivative_with_prn}). Thus, finding equivalent channel gain in {\color{black}an} AF relay is more difficult compared to DF case.
In high SNR regime, \eqref{lagrange_derivative_with_psn} is simplified, and an asymptotic effective channel gain can be estimated. In high SNR scenario, relay uses optimal power over each subcarrier, i.e., $P_o^r = P_o^{r^*}$, such that $\sigma^2(\sigma^2+P_n^s\gamma_n^{sr}) = (P_o^r)^2\gamma_o^{rm}\gamma_o^{re}$. This leads to $\mu=0$. From \eqref{lagrange_derivative_with_psn} we get:
\begin{align}\label{effective_channel_gian_AF}
&\lambda \approx \frac{1}{2} \frac{P_o^r \gamma_n^{sr} (\gamma_o^{rm}-\gamma_o^{re})}{P_{o}^r\gamma_o^{rm} \left( 1 + \frac{P_{o}^r\gamma_o^{re}}{\sigma^2} \right) P_{o}^r\gamma_o^{re} \left(1 + \frac{P_{o}^r\gamma_o^{rm}}{\sigma^2} \right) } \approx \frac{1}{2} \frac{\sigma^4 P_o^r \gamma_n^{sr} (\gamma_o^{rm}-\gamma_o^{re})}{\left( (P_{o}^r)^2\gamma_o^{rm} \gamma_o^{re} \right)^2} \approx \frac{1}{2} \frac{\sigma^2(\gamma_o^{rm}-\gamma_o^{re})} {\sqrt{\sigma^2 (P_{n}^s)^3 \gamma_n^{sr}\gamma_o^{rm} \gamma_o^{re}}}.
\end{align}
From \eqref{effective_channel_gian_AF} we note {\color{black}that}, the effective channel gain over subcarrier pair $(n,o)$ in {\color{black}an} AF case can be specified as $\Gamma_{(n,o)}^{a} = \frac{\gamma_{o}^{rm}-\gamma_{o}^{re}}{\sqrt{\gamma_n^{sr}\gamma_o^{rm} \gamma_o^{re}}}$. A subcarrier with higher effective channel gain is assigned higher source power, and hence it achieves a higher secure rate. As shown in the proof of Proposition \ref{prop_df_ps_budget}, if $\gamma_1^{sr}>\gamma_2^{sr}$ then, to have $P_1^s>P_2^s$ we need to have $\frac{\gamma_{1}^{rm}-\gamma_{1}^{re}}{\sqrt{\gamma_1^{rm} \gamma_1^{re}}}>\frac{\gamma_{2}^{rm}-\gamma_{2}^{re}}{\sqrt{\gamma_2^{rm} \gamma_2^{re}}}$. Thus, a higher $\gamma_n^{sr}$ should be matched with higher $\frac{\gamma_{o}^{rm}-\gamma_{o}^{re}}{\sqrt{\gamma_o^{rm} \gamma_o^{re}}}$ to maximize sum secure rate.
\begin{remark}
Note that the observation in Theorem \ref{theorem_df_scp_channel_tailoring} is valid for any power allocation strategy that assigns more power over a subcarrier with more channel gain. Since AF power allocation also provides more $P_n^s$ to a subcarrier with higher effective channel gain $\Gamma_{(n,o)}^{a}$, the optimal SCP tries to minimize the variance of the tailored effective channel gains.
\end{remark}
\emph{In a nutshell, the asymptotically optimal SCP policy for {\color{black}an} AF relay is to match the sorted $\gamma_n^{sr}$ on $\mathcal{S}-\mathcal{R}$ link with the sorted $\frac{\gamma_{o}^{rm}-\gamma_{o}^{re}}{\sqrt{\gamma_o^{rm} \gamma_o^{re}}}$ ratios on the $\mathcal{R}-\mathcal{U}$ link.} Further, even though the optimal SCP has been investigated under high SNR assumption, its validity at low SNR has been proved through numerical results in section \ref{proposed_optimal_vs_bruteforce}.
\subsection{Comparison between AF and DF Schemes}\label{comparison_af_df}
Here we conduct a brief comparison study between the AF and DF relayed systems.
\subsubsection{Subcarrier Allocation}
For both AF and DF relayed system, subcarrier allocation strategy is to allocate a subcarrier to a user having maximum gain over the $\mathcal{R}-\mathcal{U}$ link.
\subsubsection{Power Allocation}
In DF relay, secure rate is increasing in source as well as relay power. Thus, optimum value is achieved at the boundary condition decided by either source or relay power budget. If there is enough $P_S$, and $P_R$ is constrained, the power allocation is solved at the relay through secure water filling on $\mathcal{R}-\mathcal{U}$ link. If instead $P_S$ is bottleneck, power allocation is obtained by secure water filling on $\mathcal{S}-\mathcal{R}$ link.
In {\color{black}an} AF relayed system, secure rate is concave increasing in source power, and it is a pseudoconcave function \cite{Baz} of relay power. Source power budget is always fully utilized, while relay power budget may not be fully used. If $\sum_{n=1}^N P_{n}^{r^*} > P_R$, i.e., relay power budget is bottleneck, then secure rate is lower than the achievable rate with sufficient $P_R$.
\subsubsection{Subcarrier Pairing}
In {\color{black}a} DF relay-assisted system, depending on the source and relay power budgets, SCP can improve either energy efficiency or spectral efficiency of the system. In contrast, in {\color{black}an} AF relay-assisted system SCP is always helpful in improving spectral efficiency of the system.
\subsubsection{Sum Secure Rate Upper Bound}
In {\color{black}a} DF relayed system, if $P_R$ is bottleneck, upper bound on sum rate is controlled by secure water filling on $\mathcal{R}-\mathcal{U}$ link. Instead, if $P_S$ is bottleneck then, the bound is decided by secure water filling on $\mathcal{S}-\mathcal{R}$ link.
In {\color{black}an} AF relayed system, sum rate upper bound is obtained when there is enough relay power to complete optimal allocation i.e., $\sum_{n=1}^N P_{n}^{r^*} \leq P_R$. Otherwise, the sum rate achieved is lesser than the upper bound.
\subsection{Algorithm Complexity}\label{complexity_analysis}
{\color{black}Since the secure rate is concave increasing in source and relay powers in a DF relay case, and concave increasing in source power and pseudo-concave in relay power for an AF relay case, the optimal solution is guaranteed, due to inheret nature of the secure rate definitions \cite{Baz}. Thus, the algorithm achieving optimal solution is bound to converge.}
In {\color{black}a} DF relay case subcarrier allocation is a search on $M$ channel gains on $\mathcal{R}-\mathcal{U}$ link, power allocation is a one-dimensional (1D) search in either $\lambda$ or $\mu$, and SCP is matching of sorted channel gains. Through decoupling, we have been able to remove the complexity of subcarrier allocation and SCP. Thus, overall complexity of the resource allocation is dominated by complexity of the power allocation which is a 1D search having complexity $\mathcal{O}(N\log N)$ \cite{W_Yu_TCOM_2006}.
%
In {\color{black}an} AF relay case, after replacing $P_n^s$ from \eqref{lagrange_derivative_with_psn} into \eqref{lagrange_derivative_with_prn}, we get $N$ equations. These along with the complimentary slackness conditions leads to a system of $(N+2)$ equations in $(N+2)$ unknowns $(P_n^r, \lambda, \mu)$.
In a special case when, there is enough relay power budget to allow optimal relay power allocation $(P_n^r=P_n^{r^*})$ over each subcarrier, the power allocation is simply a 1D search for optimal $\lambda$, having the complexity as $\mathcal{O}(N\log N)$.
\begin{figure*}[!t]
\begin{minipage}{.5\textwidth}
\centering
\epsfig{file=./insight_a_af_2u2c,width=2.5in}
\caption{Maximum sum secure rate, achieved at $P_n^{r^*}$.}
\label{fig:insight_a_2u2c_af}
\end{minipage}
\begin{minipage}{.5\textwidth}
\centering
\epsfig{file=./insight_b_df_2u2c_12,width=3.2in}\vspace{-1mm}
\caption{Insight on role of SCP in DF relayed system.}
\label{fig:insiht_b_scp_role_df}
\end{minipage}
\end{figure*}
\section{Results and Discussion}\label{sec_results}
The performance of our proposed resource allocation schemes for both AF and DF relayed systems have been presented in this section. By default, downlink of an OFDMA based communication system with $N=64$ subcarriers is assumed. All subcarriers are assumed to bear frequency flat slow fading. The channel parameters remains constant for a frame duration but changes randomly in the next frame. AWGN noise variance is taken as $\sigma^2=0$ dB. Path loss exponent is assumed to be $3$. $\mathcal{S}$ and $\mathcal{R}$ are, respectively, situated at $(0,0)$ and $(1,0)$. By default $M=8$ untrusted users are considered. Users are randomly placed inside a unit length square which has center at $(2,0)$ {\color{black}as described in Table \ref{sim_param}}. Overall performance is presented in the form of average sum secure rate which is calculated in bits per OFDM symbol per subcarrier (denoted by bits/symb/subcarrier in the figures) averaged over random channel realizations.
First, we present proof of concepts through an exhaustive study over a two-user system in Section \ref{results_insights}. We study DF and AF relayed systems, respectively in Sections \ref{results_df} and \ref{results_af}.
Comparison of the proposed schemes with benchmark schemes is discussed in Section \ref{results_comparison}.
\newcolumntype{C}{>{\centering\arraybackslash}p{3em}}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash}p{#1}}
\begin{table}[!htb]
\caption{System simulation parameters}\label{sim_param}
\centering
{\scriptsize
\begin{tabular}{|L{3cm} |L{1cm}| L{4cm}| L{3cm}| L{1cm}| L{1cm}|}
\hline
System parameter & Symbol & value & System parameter & Symbol & value\\
\hline
Number of users & M & 8 & Number of subcarriers & N & 64\\
\hline
AWGN variance & $\sigma^2$ & 0 dB & Path loss exponent & $\alpha$ & 3\\
\hline
Source location & & \{0,0\} & Relay location & & \{1,0\}\\
\hline
Users location & & Unit square centered at \{2,0\} & & & \\
\hline
\end{tabular}
}
\end{table}
\subsection{Insights in a two-User Secure OFDMA System}\label{results_insights}
Through this section we provide insights on nontrivial concepts proposed in this work by considering a small, two-user system. These insights help the reader to appreciate usefulness and optimality of the proposed solutions. First we consider relevance of the optimal relay power allocation $P_n^{r^*}$ for AF relayed system, and then the dual role of SCP in a DF system is considered. Next, we show that the proposed SCP based on effective channel gains is as good as finding an exact SCP based on brute force algorithm having exponential complexity. Finally, we present numerical results to corroborate our claim that optimal SCP, denoted as `opt SCP', minimizes the variance of {\color{black}the} effective channel gains.
\subsubsection{Role of $P_n^{r^*}$ in AF Relay Case}
In order to emphasize the utility of allocating optimal relay power allocation $P_n^{r^*}$, we consider a two-user two-subcarrier system where $P_{1}^s$ is varied from $0$ to $P_S$, and $P_{2}^s = P_S-P_{1}^s$ with $P_S=1$. Corresponding $P_1^{r^*}$ and $P_2^{r^*}$ are obtained using \eqref{optimal_prn_for_psn}. For a small positive $\delta$, we compare the following relay power allocations in Fig. \ref{fig:insight_a_2u2c_af}:
\begin{itemize}
\item Scheme `$--$': with $P_1^{r} = P_1^{r^*} - \delta$, $P_2^{r} = P_2^{r^*} - \delta$
\item Scheme `$-+$': with $P_1^{r} = P_1^{r^*} - \delta$, $P_2^{r} = P_2^{r^*} + \delta$
\item Scheme `$+-$': with $P_1^{r} = P_1^{r^*} + \delta$, $P_2^{r} = P_2^{r^*} - \delta$
\item Scheme `$++$': with $P_1^{r} = P_1^{r^*} + \delta$, $P_2^{r} = P_2^{r^*} + \delta$
\item Scheme `$opt$': with $P_1^{r} = P_1^{r^*}$, $P_2^{r} = P_2^{r^*}$
\end{itemize}
We note that, `$--$' performs worst, as the relay power allocated over both the subcarriers is less than the optimal; `$-+$' and `$+-$' are complimentary schemes having crossover; `$++$' is better than all above, as it has more power on both the subcarriers; while `$opt$' is the best as it allocates optimal relay power. \emph{Thus, allocating optimal power (neither higher nor lower than $P_n^{r^*}$) over each subcarrier is the best strategy for sum rate maximization. }
\subsubsection{Role of SCP in DF Relay Case}
In this subsection, we present the comparison of proposed `opt SCP' with default SCP, denoted by `def SCP', which pairs $n$th subcarrier over $\mathcal{S}-\mathcal{R}$ link with $n$th subcarrier on $\mathcal{R}-\mathcal{U}$ link. We wish to emphasize the roles of SCP in a DF relayed system through a simple two-user two-subcarrier system. Observing Fig. \ref{fig:insiht_b_scp_role_df}, it can be noted that if $P_S$ is high, and $P_R$ is bottleneck, `opt SCP' supports in energy efficiency. Thus, both schemes have same rate. When $P_S$ is bottleneck, and $P_R$ is high, `opt SCP' plays main role in maximizing sum rate.
Fig. \ref{fig:insiht_b_scp_role_df}(a) presents sum secure rate performance with $P_S$. For low $P_S$ `opt SCP' plays important role, and improves the sum rate. The gain in sum rate is small at lower $P_R$, whereas it is large at higher $P_R$. For higher $P_S$, it is $P_R$ which is the bottleneck. It can be noted that, at lower $P_R$ `opt SCP' does not perform well as sum rate curves for `def SCP' and `opt SCP' converge very early compared to higher $P_R$ scenario. Fig. \ref{fig:insiht_b_scp_role_df}(b) captures sum rate performance with relay power $P_R$. For lower $P_S$, `opt SCP' plays a key role in improving sum rate. \emph{Thus, `opt SCP' depicts important role when $P_S$ is comparatively smaller than $P_R$.}
\begin{figure}[!t]
\centering
\epsfig{file=./insight_c_df_af_2u3c_new.eps,width=3.2in}\vspace{-1mm}
\caption{Validation of the proposed `opt SCP'.}
\label{fig:insight_c_df_af_2u3c}\vspace{-2mm}
\end{figure}
\subsubsection{Exact versus Asymptotically Optimal SCP}\label{proposed_optimal_vs_bruteforce}
In Fig. \ref{fig:insight_c_df_af_2u3c}, we compare the best SCP obtained after exhaustive search on all possible combinations with our proposed SCP {\color{black}which is} based on effective channel gains {\color{black}derived in high SNR region}. Instead of a two-user two-subcarrier system which has just two SCP combinations, we consider a two-user three-subcarrier system having $N!=6$ SCP combinations.
The `brute force' scheme chooses the best pairing combination that results in maximum secure rate (among 6 possible combinations) after optimal power allocation. We compare its performance with our proposed `opt SCP', at $P_R/\sigma^2=6$ dB. Note that, secure rate with `opt SCP' is very close to that of `brute force' scheme, and the gap reduces with increasing source power $P_S$.
\emph{Thus, `opt SCP', which performs as good as `brute force' (exhaustive search), is a computationally efficient solution {\color{black}having} reduced complexity by an order of $N!$.}
\subsubsection{Subcarrier Pairing as Channel Gain Tailoring}
In this subsection, we validate our claim that optimal SCP tailors channel gains so as to minimize variance of the effective channel gains. A two-user three-subcarrier system {\color{black}with a DF relay} is considered. There are in total $N!=3!=6$ possible pairing combinations. In Fig. \ref{fig:insight_d_2u3c}(a), effective channel gains of all six subcarriers have been presented. Variance of effective gains and sum rate (at $P_S/\sigma^2 = P_R/\sigma^2 = 15$ dB) are presented in text boxes above each combination. Note that the SCP combination showing minimum gain variance has maximum secure rate. Similar behavior is observed for an AF relay-assisted two-user three-subcarrier systems' performance plotted in Fig. \ref{fig:insight_d_2u3c}(b). \emph{In summary, the combination having least effective channel gain variance has the highest secure rate. Thus, `opt SCP' attempts to map subcarriers so as to achieve effective channel gains having minimum variance.}
\begin{figure}[!t]
\centering
\subfigure[]
{\includegraphics[width=2.8in]{./insight_d_df_2u3c.eps} }
\subfigure[]
{\includegraphics[width=2.8in]{./insight_d_af_2u3c.eps} }
\caption{Effective channel gains for different SCP combinations: (a) DF relay system; (b) AF system. `r'
and `v' respectively denote the sum rate and the variance of effective channel gains for each SCP combination.}
\label{fig:insight_d_2u3c}
\end{figure}
\subsection{Performance of a DF Relayed System}\label{results_df}
The performance of a DF relay-assisted secure communications is limited by either $P_S$ or $P_R$. If $P_R$ is the bottleneck then secure rate as provided by `def SCP' cannot be improved by `opt SCP', whereas if $P_S$ is bottleneck then `opt SCP' plays significant role. In order to highlight the efficacy of `opt SCP' we present sum secure rate with $P_S$ and $P_R$ separately.
\begin{figure*}[!t]
\begin{minipage}{.48\textwidth}
\centering
\epsfig{file=./sum_rate_df_pr.eps,width=3.2in}
\caption{Variation of sum secure rate versus $P_R$ for different values of $P_S$ in a DF relay-assisted system.}
\label{fig:sum_rate_max_with_pr_df}
\end{minipage}\quad
\begin{minipage}{.48\textwidth}
\centering
\epsfig{file=./sum_rate_df_ps.eps,width=3.2in}
\caption{Variation of sum secure rate versus $P_S$ for different values of $P_R$ in a DF relay-assisted system.}
\label{fig:sum_rate_max_with_ps_df}
\end{minipage}
\end{figure*}
\begin{figure*}[!t]
\begin{minipage}{.48\textwidth}
\centering
\epsfig{file=./sum_rate_af_pr.eps,width=3.2in}
\caption{Variation of sum secure rate versus $P_R$ for different values of $P_S$ in an AF relay-assisted system.}
\label{fig:sum_rate_max_with_pr_af}
\end{minipage} \quad
\begin{minipage}{.48\textwidth}
\centering
\epsfig{file=./sum_rate_af_ps.eps,width=3.2in}
\caption{Variation of sum secure rate versus $P_S$ for different values of $P_R$ in an AF relay-assisted system.}
\label{fig:sum_rate_max_with_ps_af}
\end{minipage}
\end{figure*}
\begin{figure}[!t]
\centering
\subfigure[]
{\includegraphics[width=3in]{./compare_epa_opa_df.eps} }
\subfigure[]
{\includegraphics[width=3in]{./compare_epa_opa_af.eps} } \vspace{-2mm}
\caption{Performance comparison for (a) DF relay and (b) AF relay with different $(P_R,P_S)$.}
\label{fig:sum_rate_comparison_epa}
\end{figure}
In Fig. \ref{fig:sum_rate_max_with_pr_df}, we present the sum rate performance with $P_R/\sigma^2$ for three distinct values of $P_S/\sigma^2$ as $6$ dB, $18$ dB, and $\infty$. $P_S/\sigma^2 = \infty$ is chosen to provide a numerical proof to our proposition that, for a limited $P_R$ `opt SCP' plays a secondary role in improving energy efficiency. When $P_S$ is low, then initially $P_R$ may be the bottleneck but gradually it is $P_S$ which becomes the bottleneck. Thus at low $P_S$, with varying $P_R$ we observe the change of role by `opt SCP', from energy efficiency to spectrum efficiency, and the associated sum rate improvement. For high $P_S$, this role changes quite late, as initially $P_R$ is bottleneck and `opt SCP' is in complimentary role. It emerges in deciding role when $P_S$ becomes bottleneck.
Fig. \ref{fig:sum_rate_max_with_ps_df} shows the variation of sum rate with $P_S/\sigma^2$. Three different values of $P_R/\sigma^2$ are taken: $6$ dB, $18$ dB, and $\infty$. At a lower $P_R$, with increasing $P_S$, the role of `opt SCP' diminishes from spectral efficiency to mere energy efficiency, which can be observed from narrowing gap between the performance curves of `def SCP' and `opt SCP'. At high $P_R$, `opt SCP' continues to offer improved overall sum secure rate of the system, and it can be observed by the significant gap between the performance curves of `def SCP' and `opt SCP'.
\subsection{Performance of an AF Relayed System}\label{results_af}
In this section the performance of {\color{black}an} AF relay-assisted system is considered. The secure rate is concave increasing with source power while pseudoconcave with relay power. In order, to show the existence of optimal relay power, we show that the secure rate gets saturated with increasing relay power. The performance with relay power budget is plotted in Fig. \ref{fig:sum_rate_max_with_pr_af}.
The sum rate performance is plotted for two values of source power budget $P_S/\sigma^2=6$ dB and $P_S/\sigma^2=18$ dB. For a lower $P_S$, the optimal relay powers $P_n^{r^*}$ are small. With increasing $P_R$, if there is sufficient $P_R$ to ensure optimal relay power allocation over each subcarrier, the secure rate saturates with $P_R$. At a higher $P_S$, due to higher optimal relay powers $P_n^{r^*}$, the secure rate saturates at a relatively larger $P_R$.
In Fig. \ref{fig:sum_rate_max_with_ps_af}, we present the performance with varying $P_S/\sigma^2$. Here possible values of $P_R/\sigma^2$ are taken as $6$ dB, $18$ dB, and $\infty$ to capture the sum secure rate upper bound that can be achieved by the system. A lower $P_R$ keeps the sum rate bounded as optimal relay power $P_n^{r^*}$ is not available on each subcarrier. With increasing $P_S$, the required $P_n^{r^*}$ keep increasing, thus the secure rate does not improve much. At higher $P_R$, initially with lower $P_S$ each subcarrier can be allocated optimal relay power so the secure rate improves faster, but later as $P_S$ increases, the secure rate increases slowly as optimal $P_n^{r^*}$ cannot be allocated. Significant performance gain can be observed due to `opt SCP' at higher $P_R$.
\subsection{Comparison with Benchmark Scheme}\label{results_comparison}
Comparison of presented optimal power allocation (OPA) has been done with equal power allocation (EPA) for `def SCP' and `opt SCP'. To emphasize the benefit of `opt SCP', which is designed for cooperative secure systems, its comparison with `ordered pairing' (OP) \cite{Hottinen_SPAWC_2007} has also been presented. Both EPA and OPA follows optimal subcarrier allocation. This comparison intends to emphasize the performance gain obtained by OPA and `opt SCP'. EPA uses equal power on both $\mathcal{S}-\mathcal{R}$ and $\mathcal{R}-\mathcal{U}$ links. EPA with `opt SCP' is used to mark the efficacy of `opt SCP' in comparison to `def SCP'. Comparison is done at four combinations of $(P_R/\sigma^2,P_S/\sigma^2)$ budgets, namely $(6,6)$ dB, $(6,18)$ dB, $(18,6)$ dB, and $(18,18)$ dB. Sum rate performance for DF and AF systems are plotted in Figs. \ref{fig:sum_rate_comparison_epa}(a) and \ref{fig:sum_rate_comparison_epa}(b), respectively.
Performance comparison for a DF relayed system is presented in Fig. \ref{fig:sum_rate_comparison_epa}(a). Note that for $(P_R/\sigma^2,P_S/\sigma^2) = (6,18)$ dB, `opt SCP' has no significant role, and the gain is minimal. This is because of the limited $P_R$ and in turn bounded achievable rate. `opt SCP' has no scope to improve secure rate further. For this reason OP performs as good as `opt SCP'. For $(P_R/\sigma^2,P_S/\sigma^2) = (18,6)$ dB, EPA gives zero sum rate (for both `def SCP' and `opt SCP'). Since $P_S$ budget is less, it results in $\mathcal{S}-\mathcal{R}$ link to be bottleneck over all subcarriers, forcing all subcarriers' rate to be zero. Note that joint optimal allocation with OPA and `opt SCP' results in around six times secure rate at $(P_R/\sigma^2,P_S/\sigma^2)=(18,18)$ dB.
Observing Fig. \ref{fig:sum_rate_comparison_epa}(b) for performance comparison in an AF relayed system, it can be noted that `opt SCP' always plays significant role irrespective of source/relay power budgets. `Opt SCP' offers about 65\% rate improvement compared to optimal power allocation with `def SCP' for $(P_R/\sigma^2,P_S/\sigma^2) = (6,6)$ dB. Even at high SNR such as $(P_R/\sigma^2,P_S/\sigma^2) = (18,18)$ dB, around 20\% rate improvement is observed in OPA with `opt SCP' over OPA with `def SCP'. OPA with `opt SCP' leads to five times higher secure rate compared to EPA with `def SCP' at $(P_R/\sigma^2,P_S/\sigma^2) = (18,18)$ dB. Further, proposed `opt SCP' shows 10\% and 150\% rate improvement, respectively, for DF and AF relayed system, compared to ordered pairing (OP) for OPA at $(P_R/\sigma^2,P_S/\sigma^2) = (18,18)$ dB. \emph{These results corroborate importance of the proposed `opt SCP' for maximizing sum secure rate in AF and DF relayed systems.}
\section{Concluding Remarks}\label{sec_conclusion}
In this paper, joint resource allocation for cooperative secure communication system with untrusted users has been considered. The optimization problem involves subcarrier allocation, power allocation and subcarrier pairing for both AF and DF relayed systems. After presenting optimal subcarrier allocation policy for AF relay, we have proved that the sum secure rate is concave with source power and pseudoconcave with relay power, and shown that the joint power allocation is a generalized convex problem which can be solved optimally using KKT conditions. SCP has been presented as a novel concept of channel gain tailoring that maximizes sum rate performance. Thus, SCP can be treated as a technique to match subcarriers such that variance between effective channel gains is minimized.
The significant role of optimal SCP in either spectral or energy efficiency improvement has been presented through analytical insights. In a DF relayed system the sum rate is shown to be controlled by power budget of either source or relay. Depending on the situation, optimal SCP helps in either improving spectral or energy efficiency. In an AF relay system, optimal SCP plays a crucial role in improving the overall spectral efficiency of the system. We have presented extensive simulation results for a smaller user-subcarrier system to emphasize key concepts. Joint resource allocation scheme is found to give about five and four times improvement compared to EPA with `deft SCP' for respectively, DF and AF relayed system.
| {'timestamp': '2019-01-14T02:20:30', 'yymm': '1901', 'arxiv_id': '1901.03637', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03637'} | arxiv |
\subsection{0pt}{4pt plus 4pt minus 2pt}{4pt plus 2pt minus 2pt}
\DeclareMathOperator*{\argmin}{arg\,min}
\DeclareMathOperator*{\argmax}{arg\,max}
\title{Supplementary Material}
\date{}
\begin{document}
\belowdisplayskip=12pt plus 3pt minus 9pt
\belowdisplayshortskip=7pt plus 3pt minus 4pt
\includepdf[pages=-]{final_manuscript.pdf}
\maketitle
\definecolor{blue3}{HTML}{86B7FC}
\definecolor{blue1}{HTML}{B5F1FF}
\definecolor{blue2}{HTML}{E0F9FF}
\def\perp\!\!\!\perp{\perp\!\!\!\perp}
\newcommand{.}{.}
\section{Simulations - Error in Estimated Trajectories and DPS}
\begin{figure}[H]
\begin{picture}(230,180)
\put(0,0){\includegraphics[width=0.45\textwidth]{./dpsError_trajCent.png}}
\put(30,160){\textbf{\huge{A}}}
\end{picture}
\begin{picture}(230,180)
\put(0,0){\includegraphics[width=0.45\textwidth]{./thetaError_trajCent.png}}
\put(30,160){\textbf{\huge{B}}}
\end{picture}
\begin{picture}(230,180)
\put(0,0){\includegraphics[width=0.45\textwidth]{./dpsError_nrSubj.png}}
\put(30,160){\textbf{\huge{C}}}
\end{picture}
\begin{picture}(230,180)
\put(0,0){\includegraphics[width=0.45\textwidth]{./thetaError_nrSubj.png}}
\put(30,160){\textbf{\huge{D}}}
\end{picture}
\caption{Error in DPS scores (A) and trajectory estimation (B) for Scenario 2 in simulation experiments. (C-D) The same error scores for Scenario 3. We notice that as the problem becomes more difficult, the errors in the DIVE estimated parameters increase. Errors were measured as sum of squared differences (SSD) between the true parameters and estimated parameters. For the trajectories, the SSD was calculated only based on the sigmoid centres, due to different scaling of the other sigmoidal parameters.}
\end{figure}
\section{Comparison between DIVE and other models}
\subsection{Motivation}
We were also interested to compare the performance of DIVE with other disease progression models. In particular, we were interested to test whether:
\begin{itemize}
\item Modelling dynamic clusters on the brain surface improves subject staging and biomarker prediction
\item Modelling subject-specific stages with a linear transformation (the $\alpha_i$ and $\beta_i$ terms) improves biomarker prediction
\end{itemize}
\subsection{Experiment design}
We compared the performance of our model to two simplified models:
\begin{itemize}
\item ROI-based model: groups vertices according to an a-priori defined ROI atlas. This model is equivalent to the model by Jedynak et al., Neuroimage, 2012 and is a special case of our model, where the latent variables $z_{lk}$ are fixed instead of being marginalised as in equation 6.
\item No-staging model: This is a model that doesn't perform any time-shift of patients along the disease progression timeline. It fixes $\alpha_i=1$, $\beta_i=0$ for every subject, which means that the disease progression score of every subject is age.
\end{itemize}
We performed this comparison using 10-fold cross-validation. For each subject in the test set, we computed their DPS score and correlated all the DPS values with the same four cognitive tests used previously. We also tested how well the models can predict the future vertex-wise measurements as follows: for every subject i in the test set, we used their first two scans to estimate $\alpha_i=1$, $\beta_i=0$ and then used the rest of the scans to compute the prediction error. For one vertex location on the cortical surface, the prediction error was computed as the root mean squared error (RMSE) between its predicted measure and the actual measure. This was then averaged across all subjects and visits.
\subsection{Results}
Table \ref{tab1} shows the results of the model comparison, on ADNI MRI dataset. Each row represents one model tested, while each column represents a different performance measure: correlations with four different cognitive tests and accuracy in the prediction of future vertexwise measurements. In each entry, we give the mean and standard deviation of the correlation coefficients or RMSE across the 10 cross-validation folds.
\begin{table}[H]
\centering
\begin{footnotesize}
\begin{tabular}{c | c c c c | c}
Model & CDRSOB ($\rho$) & ADAS13 ($\rho$) & MMSE ($\rho$) & RAVLT ($\rho$) & Prediction (RMSE)\\
\hline
DIVE & 0.37 +/- 0.09 & 0.37 +/- 0.10 & 0.36 +/- 0.11 & 0.32 +/- 0.12 & 1.021 +/- 0.008 \\
ROI-based model & 0.36 +/- 0.10 & 0.35 +/- 0.11 & 0.34 +/- 0.13 & 0.30 +/- 0.13 & 1.019 +/- 0.010 \\
No-staging model & *0.09 +/- 0.06 & *0.03 +/- 0.09 & *0.05 +/- 0.06 & *0.02 +/- 0.06 & *1.062 +/- 0.024 \\
\end{tabular}
\end{footnotesize}
\caption{Comparison of our model with two more simplistic models on the ADNI MRI dataset. For each of the three models, we show the correlation of the disease progression scores (DPS) with respect to several cognitive tests: CDRSOB, ADAS13, MMSE and RAVLT. The correlation numbers represent the mean correlation across the 10 cross-validation folds. }
\label{tab1}
\end{table}
\section{Validation of subject parameters against APOE}
\newcommand{.}{.}
\begin{figure}[H]
\includegraphics[width=\textwidth]{./subjParamsAPOEvalid.pdf}
\caption{Subject-specific parameters (left: time shift parameters $\beta$, middle: progression speed $\alpha$ and right: DPS scores at baseline visit) for APOE4-positive and negative individuals. APOE4 positive subjects have significantly higher time-shifts, progression speeds and overall DPS scores than APOE4-negative individuals.}
\end{figure}
\newcommand{M}{M}
\section{Derivation of the Generalised EM algorithm}
We seek to calculate $M^{(u)} = \argmax_{M} \mathbb{E}_{Z|V,M^{(u-1)}} \left[log\ p(V,Z|M)\right] + log\ p(M)$ where $M^{(u)} = (\alpha^{(u)}, \beta^{(u)}, \theta^{(u)}, \sigma^{(u)}, \lambda^{(u)})$ are the set of model parameters at iteration $u$ of the EM algorithm, and $Z = (Z_1, \dots, Z_L)$ is the set of discrete latent variables, where $Z_l$ represents the cluster that voxel $l$ was assigned to, so $Z_l \in {1, \dots, K}$. While $Z_l$ (with capital letter) is a random variable, we will also use the notation $z_l$ (small letter) to represent the value that the random variable $Z_l$ was instantiated to. Finally, $p(M^{(u)})$ is a prior on these parameters that is chosen by the user. Expanding the expected value, we get:
\begin{equation}
\label{eq:EM1}
M^{(u)} = \argmax_{M} \sum_{z1,\dots, z_L}^K p(Z = (z_1, ..., z_L) | V, M^{(u-1)}) \left[log\ p(V,Z|M)\right] + log\ p(M)
\end{equation}
The E-step involves computing $p\left(Z = (z_1, ..., z_L)| V, M^{(u-1)}\right)$, while the M-step comprises of solving the above equation.
\subsection{E-step}
In this step we need to estimate $p(Z | V, M^{(u-1)})$. For notational simplificy we will drop the $(u-1)$ superscript from $M$
\begin{equation}
p(Z | V, M) = \frac{1}{C} p(V, Z | M) = \prod_l^L \left[ \prod_{(i,j) \in I} N(V_l^{ij} | f(\alpha_i t_{ij} + \beta_i | \theta_{Z_l}), \sigma_{Z_l}) \prod_{l_2 \in N_l} \Psi (Z_{l}, Z_{l_2}) \right]
\end{equation}
where $N_l$ is the set of neighbours of vertex $l$. However, this doesn't directly factorise over the vertices $l$ due to the MRF terms $\Psi (Z_{l}, Z_{l_2})$. It is however necessary to find a form that factorises over the vertices, otherwise we won't be able to represent in memory the joint distribution over all $Z$ variables. If we make the approximation $p(Z | V, M) \approx \prod_l^L p(V_l|Z_l, M)$ then we loose out all the MRF terms and the model won't account for spatial correlation. We instead do a first-degree approximation by conditioning on the values of $Z_{N_l}^{(u-1)}$, the labels of nearby vertices from the previous iteration. The approximation is thus:
\begin{equation}
\label{eq:e_approx}
p(Z | V, M) \approx \prod_l^L \mathbb{E}_{Z_{N_l}^{(u-1)}|V_l, M} \left[ p(Z_l|V_l, M, Z_{N_l}^{(u-1)}) \right]
\end{equation}
This form allows us to factorise over all the vertices to get $p(Z_l | V_l, M)$:
\begin{equation}
p(Z_l | V_l, M) \approx \frac{1}{C} \sum_{Z_{N_l}^{(u-1)}} p(V_l|Z_l, M) p(Z_l|Z_{N_l}^{(u-1)}) p(Z_{N_l}^{(u-1)}|V_l, M)
\end{equation}
where $C$ is a normalistion constant that can be dropped. We can now further factorise $p(Z_l|Z_{N_l}^{(u-1)}) \approx \prod_{m \in \{1, ..., N_l\}} p(Z_l | M, Z_{N_l(m)}^{(u-1)} = z_{N_l(m)})$ and apply a similar factorisation to the prior $p(Z_{N_l}^{(u-1)}|V_l, M) $, resulting in:
\begin{equation}
p(Z_l | V_l, M) \approx \frac{1}{C} p(V_l|Z_l, M) \sum_{z_{N_l(1)}, .., z_{N_l(|N_l|)}}\ \ \ \prod_{m \in \{1, ..., N_l\}} p(Z_l | Z_{N_l(m)}^{(u-1)} = z_{N_l(m)}) p(Z_{N_l(m)}^{(u-1)} = z_{N_l(m)}|V_l, M)
\end{equation}
Factorising the summation over $z_{N_l}$'s we get:
\begin{equation}
p(Z_l | V_l, M) = p(V_l| Z_l, M) \prod_{l_2 \in N_l} \sum_{z_{l_2}} p(Z_l | Z_{l_2}^{(u-1)} = z_{l_2}) p(Z_{l_2}^{(u-1)} = z_{l_2}|V_l, M)
\end{equation}
Replacing $z_{l_2}$ with $k_2$ we get:
\begin{equation}
p(Z_l | V_l, M) = p(V_l| Z_l, M) \prod_{l_2 \in N_l} \sum_{k_2} p(Z_l | Z_{l_2}^{(u-1)} = k_2) p(Z_{l_2}^{(u-1)} = k_2|V_l, M)
\end{equation}
We shall also denote $z_{lk} = p(Z_l | V_l, M)$. Further simplifications result in:
\begin{equation}
z_{lk}^{(u)} \propto \left[ \prod_{i,j \in I} N(V_l^{ij} | f(\alpha_i t_{ij} + \beta_i ; \theta_k), \sigma_k) \right] \left[ \prod_{l_2 \in N_l} \sum_{k_2 = 1}^K z_{l_2k_2}^{(u-1)}\ \Psi (Z_{l} = k, Z_{l_2} = k_2) \right]
\end{equation}
\small
\begin{equation}
log\ z_{lk}^{(u)} \propto \left[ \sum_{i,j \in I} -\frac{log\ (2 \pi \sigma_k^2)}{2} - \frac{1}{2\sigma_k^2}(V_l^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k))^2 \right] + \left[\sum_{l_2 \in N_l} log \sum_{k_2 = 1}^K z_{l_2k_2}^{(u-1)} (\delta_{k_2 k}\ exp(\lambda) + (1 - \delta_{k_2 k})\ exp(-\lambda^2)) \right]
\end{equation}
\normalsize
We further define the data-fit term $D_{lk}$ as follows:
\begin{equation}
\label{eq:e-step_Dlk}
D_{lk} = -\frac{log\ (2 \pi \sigma_k^2) |I|}{2} - \sum_{i,j \in I} \frac{1}{2\sigma_k^2}(V_l^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k))^2
\end{equation}
This results in:
\small
\begin{equation}
log\ z_{lk}^{(u)} \propto D_{lk} + \left[\sum_{l_2 \in N_l} log \sum_{k_2 = 1}^K z_{l_2k_2}^{(u-1)} (\delta_{k_2 k}\ (exp(\lambda) - exp(-\lambda^2)) + exp(-\lambda^2)) \right]
\end{equation}
\normalsize
Finally, we simplify the sum over $k_2$ to get the update equation for $z_{lk}$:
\begin{equation}
\label{eq:e-step}
\begin{split}
log\ z_{lk}^{(u)} \propto D_{lk}+ \left[ \sum_{l_2 \in N_l} log\ \left[ exp(-\lambda^2) + z_{l_2k}^{(u-1)} (exp(\lambda) - exp(-\lambda^2)) \right] \right]
\end{split}
\end{equation}
In practice, we cannot naively compute the exponential term $z_{lk} = exp(log(z_{lk}))$ due to precision loss. However, we go around this by recomputing the exponentiation and normalisation of $z_{lk}$ simultaneously. Denoting $x(k) = log\ z_{lk}$, for $k \in [1 \dots K]$, we get:
\begin{equation}
z_{lk} = \frac{e^{x(k)}}{e^{x(1)}+e^{x(2)} + \dots + e^{x(K)}} = \frac{1}{e^{x(1)-x(k)} +e^{x(2)-x(k)} + \dots + e^{x(K)-x(k)}}
\end{equation}
\subsection{M-step}
The M-step itself does not have a closed-form analytical solution. We choose to solve it by successive refinements of the cluster trajectory parameters and the subject time shifts.
\subsubsection{Optimising trajectory parameters}
\textbf{Trajectory shape - $\theta$}\\
Taking equation \ref{eq:EM1} and fixing the subject time-shifts $\alpha$, $\beta$ and measurement noise $\sigma$, we can find its maximum with respect to $\theta$ only. More precisely, we want:
\begin{equation}
\theta = \argmax_{\theta} \sum_{z1,\dots, z_L}^K p(Z = (z_1, ..., z_L) | V, M^{(u-1)}) \left[ log\ p(V,Z|M) \right] + log\ p(\theta)
\end{equation}
We observe that for each cluster the individual $\theta_k$'s are conditionally independent, i.e. $\theta_k \perp\!\!\!\perp \theta_m | \{Z, \alpha, \beta, \sigma$\} $\forall k,m$. We also assume that the prior factorizes for each $\theta_k$: $\log p(\theta) = \prod_k^K \log p(\theta_k)$. This allows us to optimise each $\theta_k$ independently:
\begin{equation}
\theta_k = \argmax_{\theta_k} \sum_{z1,\dots, z_L}^K p(Z = (z_1, ..., z_L) | V, M^{(u-1)}) \left[ log\ p(V,Z|M) \right] + log\ p(\theta_k)
\end{equation}
Replacing the full data log-likelihood, we get:
\begin{equation}
\theta_k = \argmax_{\theta_k} \sum_{z1,\dots, z_L}^K p(Z = (z_1, ..., z_L) | V, M^{(u-1)})\ log \left[ \prod_{l=1}^L \prod_{(i,j) \in I} N(V_l^{ij} | f(\alpha_i t_{ij} + \beta_i ; \theta_{z_l}), \sigma_{z_l}) \right] + log\ p(\theta_k)
\end{equation}
Note that we didn't include the MRF clique terms, since they are not a function of $\theta_k$. We propagate the logarithm inside the products:
\begin{equation}
\theta_k = \argmax_{\theta_k} \sum_{z1,\dots, z_L}^K p(Z = (z_1, ..., z_L) | V, M^{(u-1)}) \sum_{l=1}^L \sum_{(i,j) \in I} log\ N(V_l^{ij} | f(\alpha_i t_{ij} + \beta_i ; \theta_{z_l}), \sigma_{z_l}) + log\ p(\theta_k)
\end{equation}
\begin{sloppypar}
We next assume that $Z_l$, the hidden cluster assignment for vertex $l$, is conditionally independent of the other vertex assignments $Z_m$, $\forall m \neq l$ (See E-step approximation from Eq. \ref{eq:e_approx}). This independence assumption induces the following factorization: ${p(Z = (z_1, ..., z_L) | V, M^{(u-1)}) = \prod_l^L p(Z_l = z_l | V, M^{(u-1)})}$. Propagating this product inside the sum over the vertices, we get:
\end{sloppypar}
\begin{equation}
\label{eq:SupTheta5}
\theta_k = \argmax_{\theta_k} \sum_{l=1}^L \sum_{z_l = 1}^K p(Z_l = z_l | V, M^{(u-1)}) \sum_{(i,j) \in I} log\ N(V_l^{ij} | f(\alpha_i t_{ij} + \beta_i ; \theta_{z_l}), \sigma_{z_l}) + log\ p(\theta_k)
\end{equation}
The terms which don't contain $\theta_k$ dissapear:
\begin{equation}
\theta_k = \argmax_{\theta_k} \sum_{l=1}^L p(Z_l = k | V, M^{(u-1)}) \sum_{(i,j) \in I} log\ N(V_l^{ij} | f(\alpha_i t_{ij} + \beta_i ; \theta_k), \sigma_k) + log\ p(\theta_k)
\end{equation}
We further expand the gaussian noise model:
\begin{equation}
\theta_k = \argmax_{\theta_k} \sum_{l=1}^L p(Z_l = k | V, M^{(u-1)}) \sum_{(i,j) \in I} \left[ log\ (2 \pi \sigma_k)^{-1/2} - \frac{1}{2\sigma_k^2}(V_l^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k))^2 \right] + log\ p(\theta_k)
\end{equation}
Constants dissapear due to the $\argmax$ and we get the final update equation for $\theta_k$:
\begin{equation}
\theta_k = \argmax_{\theta_k} \sum_{l=1}^L p(Z_l = k | V, M^{(u-1)}) \sum_{(i,j) \in I} \left[ - \frac{1}{2\sigma_k^2}(V_l^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k))^2 \right] + log\ p(\theta_k)
\end{equation}
\textbf{Measurement noise - $\sigma$}\\
We first assume a uniform prior on the $\sigma$ parameters to simplify derivations. Using a similar approach as with $\theta$, after propagating the product inside the logarithm and removing the terms which don't contain $\sigma_k$, we get:
\begin{equation}
\sigma_k = \argmax_{\sigma_k} \sum_{l=1}^L p(Z_l = k | V, M^{(u-1)}) \sum_{(i,j) \in I} log\ N(V_l^{ij} | f(\alpha_i t_{ij} + \beta_i ; \theta_k), \sigma_k)
\end{equation}
Note that, just as for $\theta$ above, the MRF clique terms were not included because they are not a function of $\sigma_k$. Expanding the noise model we get:
\begin{equation}
\sigma_k = \argmax_{\sigma_k} \sum_{l=1}^L p(Z_l = k | V, M^{(u-1)}) \sum_{(i,j) \in I} \left[ log\ (2 \pi \sigma_k^2)^{-1/2} - \frac{1}{2\sigma_k^2}(V_l^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k))^2 \right]
\end{equation}
The maximum of a function $l(\sigma_k)$ can be computed by taking the derivative of the function $l$ and setting it to zero. This is under the assumption that $l$ is differentiable, which it is but we won't prove it here. This gives:
\begin{equation}
\frac{\delta l(\sigma_k|.)}{\delta \sigma_k} = \sum_{l=1}^L p(Z_l = k | V, M^{(u-1)}) \sum_{(i,j) \in I} \frac{\delta}{\delta \sigma_k} \left[ log\ (2 \pi \sigma_k^2)^{-1/2} - \frac{1}{2\sigma_k^2}(V_l^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k))^2 \right]
\end{equation}
Propagating the differential operator further inside the sums we get:
\begin{equation}
\frac{\delta l(\sigma_k|.)}{\delta \sigma_k} = \sum_{l=1}^L p(Z_l = k | V, M^{(u-1)}) \sum_{(i,j) \in I} \left[ -\frac{\delta}{\delta \sigma_k} \frac{log\ \sigma_k^2}{2} - \frac{\delta}{\delta \sigma_k} \frac{1}{2\sigma_k^2}(V_l^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k))^2 \right]
\end{equation}
We next perform several small manipulations to reach a more suitable form of the derivative and then set it to be equal to zero:
\begin{equation}
\frac{\delta l(\sigma_k|.)}{\delta \sigma_k} = \sum_{l=1}^L p(Z_l = k | V, M^{(u-1)}) \sum_{(i,j) \in I} \left[ - \frac{1}{\sigma_k} - \frac{-2}{2\sigma_k^3}(V_l^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k))^2 \right]
\end{equation}
\begin{equation}
\frac{\delta l(\sigma_k|.)}{\delta \sigma_k} = \sum_{l=1}^L p(Z_l = k | V, M^{(u-1)}) \sum_{(i,j) \in I} \left[ - \frac{\sigma_k^2}{\sigma_k^3} + \frac{1}{\sigma_k^3}(V_l^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k))^2 \right]
\end{equation}
\begin{equation}
\frac{\delta l(\sigma_k|.)}{\delta \sigma_k} = \sum_{l=1}^L p(Z_l = k | V, M^{(u-1)}) \sum_{(i,j) \in I} \left[ - \sigma_k^2 + (V_l^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k))^2 \right] = 0
\end{equation}
Finally, we solve for $\sigma_k$ and get its update equation:
\begin{equation}
\label{eq:SupThetaFinal}
\sigma_k^2 = \frac{1}{|I|} \sum_{l=1}^L p(Z_l = k | V, M^{(u-1)}) \sum_{(i,j) \in I} (V_l^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k))^2
\end{equation}
\subsubsection{Estimating subject time shifts - $\alpha$, $\beta$}
For estimating $\alpha$, $\beta$, we adopt a similar strategy as in the case of $\theta$, up to Eq. \ref{eq:SupTheta5}. This gives us the following problem:
\begin{equation}
\alpha_i, \beta_i = \argmax_{\alpha_i, \beta_i} \sum_{l=1}^L \sum_{k = 1}^K p(Z_l = k | V, M^{(u-1)}) \sum_{(i',j) \in I} log\ N(V_l^{i'j} | f(\alpha_{i'} t_{i'j} + \beta_{i'} ; \theta_{k}), \sigma_{k}) + log\ p(\alpha_i, \beta_i)
\end{equation}
The terms $\alpha_{i'}, \beta_{i'}$ for other subjects $i' \neq i$ dissappear:
\begin{equation}
\alpha_i, \beta_i = \argmax_{\alpha_i, \beta_i} \sum_{l=1}^L \sum_{k = 1}^K p(Z_l = k | V, M^{(u-1)}) \sum_{j \in I_i} log\ N(V_l^{ij} | f(\alpha_{i} t_{ij} + \beta_{i} ; \theta_{k}), \sigma_{k}) + log\ p(\alpha_i, \beta_i)
\end{equation}
Expanding the gaussian noise model we get:
\begin{equation}
\alpha_i, \beta_i = \argmax_{\alpha_i, \beta_i} \sum_{l=1}^L \sum_{k = 1}^K p(Z_l = k | V, M^{(u-1)}) \sum_{j \in I_i} \left[ log\ (2 \pi \sigma_k^2)^{-1/2} - \frac{1}{2\sigma_k^2}(V_l^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k))^2 \right] + log\ p(\alpha_i, \beta_i)
\end{equation}
After removing constant terms we end up with the final update equation for $\alpha_i$, $\beta_i$:
\begin{equation}
\alpha_i, \beta_i = \argmin_{\alpha_i, \beta_i} \left[ \sum_{l=1}^L \sum_{k=1}^K p(Z_l = k | V, M^{(u-1)}) \frac{1}{2\sigma_k^2} \sum_{j \in I_i} (V_l^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k))^2\right] - log\ p(\alpha_i, \beta_i)
\end{equation}
\subsubsection{Estimating MRF clique term - $\lambda$}
We optimise $\lambda$ using the following formula:
$$\lambda^{(u)} = \argmax_{\lambda} E_{p(Z|V, M^{(u-1)}, \lambda, Z^{(u-1)})}[log\ p(V,Z|M^{(u-1)})] $$
Note that $p(Z|V, M^{(u-1)}, \lambda, Z^{(u-1)})$ is a function of $\lambda$, so for each lambda we estimate $z_{lk}$ through approximate inference. We do this because otherwise the optimisation of $\lambda$ will only take into account the clique terms and completely exclude the data terms. We further simplify the objective function for lambda as follows:
\small
$$\lambda^{(u)} = \argmax_{\lambda} \sum_{z1,\dots, z_L}^K p(Z = (z_1, ..., z_L) | V, M^{(u-1)}, \lambda, Z^{(u-1)})\ log \left[ \prod_{l=1}^L \prod_{(i,j) \in I} N(V_l^{ij} | f(\alpha_i t_{ij} + \beta_i ; \theta_{z_l}), \sigma_{z_l}) \prod_{l = 1}^{L}\prod_{l_2 \in N_l} \Psi (z_{l}, z_{l_2}) \right] $$
\normalsize
We take the logarithm:
$$\lambda^{(u)} = \argmax_{\lambda} \sum_{z1,\dots, z_L}^K p(Z = (z_1, ..., z_L) | V, M^{(u-1)}, \lambda, Z^{(u-1)})\ \left[ \sum_{l=1}^L \sum_{(i,j) \in I} log\ N(V_l^{ij} | ..) + \sum_{l = 1}^{L}\sum_{l_2 \in N_l} log\ \Psi (z_{l}, z_{l_2}) \right] $$
Let us denote $z_{lk} = p(Z_l = k | V, M^{(u-1)}, \lambda, Z^{(u-1)})$. Assuming independence between the latent variables $Z_l$ we get:
\begin{multline}
\lambda = \argmax_{\lambda} \sum_{l=1}^L \sum_{k=1}^K z_{lk}\ \left[ \sum_{(i,j) \in I} log\ N(V_l^{ij} | ..) \right] + \sum_{l = 1}^{L} \sum_{k=1}^K z_{lk} \sum_{l_2 \in N_l} \sum_{k_2 = 1}^K z_{l_2k}\ log\ \Psi (Z_{l} = k, Z_{l_2} = k_2)
\end{multline}
However, we now want to make $z_{lk}$ a function of $\lambda$ as previously mentioned, so $z_{lk}=\zeta_{lk}(\lambda)$, for some function $\zeta_{lk}$. More precisely, using the E-step update from Eq. \ref{eq:e-step} we define for each vertex $l$ and cluster $k$ a function $\zeta_{lk}(\lambda)$ as follows:
$$\zeta_{lk}(\lambda) = exp \left( D_{lk} + \sum_{l_2 \in N_l} log\ \left[ exp(-\lambda^2) + z_{l_2k}^{(u-1)} (exp(\lambda) - exp(-\lambda^2)) \right] \right)$$
where $D_{lk}$ is as defined in Eq \ref{eq:e-step_Dlk}. We then replace $z_{lk}$ with $\zeta_{lk}(\lambda)$ and introduce the chosen MRF clique model to get:
$$ \lambda^{(u)} = \argmax_{\lambda}\ \sum_{l=1}^L \sum_{k=1}^K \zeta_{lk}(\lambda) D_{lk} + \sum_{l = 1}^{L} \sum_{k}^K \sum_{l_2 \in N_l} \sum_{k_2 = 1}^K \zeta_{lk}(\lambda) \zeta_{l_2k}(\lambda)\ \left[ \delta_{kk_2} \lambda + (1-\delta_{kk_2}) (-\lambda^2)\right] $$
We separate the cliques that have matching clusters to the ones that don't:
$$ \lambda^{(u)} = \argmax_{\lambda}\ \sum_{l=1}^L \sum_{k=1}^K \zeta_{lk}(\lambda) D_{lk} + \sum_{l = 1}^{L} \sum_{l_2 \in N_l} \sum_{k}^K \left[ \zeta_{lk}(\lambda) \zeta_{l_2k}(\lambda)\ \lambda + \sum_{k2 \neq k} \zeta_{lk}(\lambda) \zeta_{l_2k}(\lambda) (-\lambda^2)\right] $$
We also factorise the clique terms:
$$ \lambda^{(u)} = \argmax_{\lambda}\ \sum_{l=1}^L \sum_{k=1}^K \zeta_{lk}(\lambda) D_{lk} + \lambda \sum_{l = 1}^{L} \sum_{l_2 \in N_l} \sum_{k}^K \zeta_{lk}(\lambda) \zeta_{l_2k}(\lambda)\ + (-\lambda^2) \sum_{l = 1}^{L} \sum_{l_2 \in N_l} \sum_{k}^K \zeta_{lk}(\lambda) (1- \zeta_{l_2k}(\lambda)) $$
Finally, we simplify to get the objective function for $\lambda$.
\begin{equation}
\lambda^{(u)} = \argmax_{\lambda}\ \sum_{l=1}^L \sum_{k=1}^K \zeta_{lk}(\lambda) \left[ D_{lk} \ + \lambda \sum_{l_2 \in N_l} \zeta_{l_2 k}(\lambda)\ -\lambda^2 \sum_{l_2 \in N_l} (1- \zeta_{l_2 k}(\lambda)) \right]
\end{equation}
For implementation speed-up, data-fit terms $D_{lk}$ can be pre-computed.
\section{Fast DIVE Implementation - Proof of Equivalence}
Fitting DIVE can be computationally prohibitive, especially given that the number of vertices/voxels can be very high, e.g. more than 160,000 in our datasets. We derived a fast implementtion of DIVE, which is based on the idea that for each subject we compute a weighted mean of the vertices within a particular cluster, and then compare that mean with the corresponding trajectory value. This is in contrast with comparing the value at each vertex with the corresponding trajectory of its cluster. In the next few sections, we will present the mathematical formulation of the fast implementation for parameters [$\theta$, $\alpha$, $\beta$]. Parameter $\sigma$ already has a closed-form update, while parameter $\lambda$ has a more complex update procedure for which this fast implementation doesn't work. For each parameter, we will also provide proofs of equivalence.
\subsection{Trajectory parameters - $\theta$}
\subsubsection{Fast implementation}
The fast implementation for $\theta$ implies that, instead of optimising Eq. \ref{eq:SupThetaFinal} we optimise the following problem:
\begin{equation}
\label{eq:supThetaFast1}
\theta_k = \argmin_{\theta_k} \sum_{(i,j) \in I} (<V^{ij}>_{\hat{Z}_k} - f(\alpha_i t_{ij} + \beta_i ; \theta_k))^2
\end{equation}
where $<V^{ij}>_{\hat{Z}_k}$ is the mean value of the vertices belonging to cluster $k$. Mathematically, we define $\hat{Z}_k = [z_{1k}\gamma_k,\ z_{2k}\gamma_k,\ \dots,\ z_{Lk}\gamma_k ]$ where $\gamma_k = (\sum_{l=1}^L z_{lk})^{-1}$ is the normalisation constant. Moreover, we have that ${<V^{ij}>_{\hat{Z}_k} = \sum_{l=1}^L z_{lk} \gamma_k V^{ij}}$. We take the derivative of the likelihood function $l_{fast}$ of the fast implementation (Eq. \ref{eq:supThetaFast1}) with respect to $\theta_k$ and perform several simplifications:
\begin{equation}
\frac{\delta l_{fast}(\theta_k|.)}{\delta \theta_k} = \frac{\delta}{\delta \theta_k} \sum_{(i,j) \in I} \left( \sum_{l=1}^L z_{lk} \gamma_k V^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k) \right)^2
\end{equation}
\begin{equation}
\frac{\delta l_{fast}(\theta_k|.)}{\delta \theta_k} = \sum_{(i,j) \in I} 2 \left( \left( \sum_{l=1}^L \gamma_k z_{lk} V^{ij} \right) - f(\alpha_i t_{ij} + \beta_i ; \theta_k) \right) \frac{-\delta f(.)}{\delta \theta_k}
\end{equation}
using the fact that $\sum_{l=1}^L \gamma_k z_{lk} = 1$ we get:
\begin{equation}
\frac{\delta l_{fast}(\theta_k|.)}{\delta \theta_k} = \sum_{(i,j) \in I} 2 \left( \sum_{l=1}^L \gamma_k z_{lk} \left( V^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k) \right) \right) \frac{-\delta f(.)}{\delta \theta_k}
\end{equation}
\begin{equation}
\frac{\delta l_{fast}(\theta_k|.)}{\delta \theta_k} = 2 \gamma_k \sum_{(i,j) \in I} \frac{-\delta f(.)}{\delta \theta_k} \left( \sum_{l=1}^L z_{lk} \left( V^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k) \right) \right)
\end{equation}
By setting the derivative to zero, the optimal $\theta$ is thus a solution of the following equation:
\begin{equation}
\label{eq:supThetaFast2}
\sum_{(i,j) \in I} \frac{-\delta f(.)}{\delta \theta_k} \left( \sum_{l=1}^L z_{lk} \left( V^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k) \right) \right) = 0
\end{equation}
\subsubsection{Slow implementation}
We will prove that if theta is a solution of the slow implementation, it is also a solution of Eq. \ref{eq:supThetaFast2}, which will prove that the fast implementation is equivalent. The slow implementation is finding $\theta$ from the following equation:
\begin{equation}
\theta_k = \argmin_{\theta_k} \sum_{l=1}^L z_{lk} \sum_{(i,j) \in I} (V_l^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k))^2
\end{equation}
Taking the derivative of the function above ($l_{slow}$) with respect to $\theta_k$ we get:
\begin{equation}
\frac{\delta l_{slow}(\theta_k|.)}{\delta \theta_k} = \sum_{l=1}^L z_{lk} \sum_{(i,j) \in I} 2 (V_l^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k)) \left(-\frac{\delta f(.)}{\delta \theta_k} \right) = 0
\end{equation}
After swapping terms around and using distributivity we get:
\begin{equation}
\sum_{(i,j) \in I} \left(-\frac{\delta f(.)}{\delta \theta_k} \right) \sum_{l=1}^L z_{lk} (V_l^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k)) = 0
\end{equation}
This is the same optimisation problem as in Eq. \ref{eq:supThetaFast2}, which proves that the two formulations are equivalent with respect to $\theta$.
\subsection{Noise parameter - $\sigma$}
The noise parameter $\sigma$ can actually be computed in a closed-form solution for the original slow model implementation, so there is no benefit in implementing the fast update for $\sigma$. Moreover, the $\sigma$ in the fast implementation computed the standard deviation in the \emph{mean value} of the vertices within a certain cluster, and not the deviation withing the \emph{actual value} of the vertices.
\subsection{Subjects-specific time shifts - $\alpha$, $\beta$}
\subsubsection{Fast implementation}
The equivalent fast formulation for the subject-specific time shifts is similar to the one for the trajectory parameters. It should be noted however that we need to weight the sums corresponding to each cluster by $\gamma_{k}^{-1}$. This gives the following equation for the fast formulation:
\begin{equation}
\alpha_i, \beta_i = \argmin_{\alpha_i, \beta_i} \sum_{k=1}^K \gamma_k^{-1} \frac{1}{2\sigma_k^2} \sum_{j \in I_i} (<V_l^{ij}>_{\hat{Z}_k} - f(\alpha_i t_{ij} + \beta_i ; \theta_k))^2 = 0
\end{equation}
In order to prove that this is equivalent to the slow version, we need to take the derivative of the likelihood function ($l_{fast}$) from the above equation with respect to $\alpha_i$, $\beta_i$ and set it to zero:
\begin{equation}
\frac{\delta l_{fast}(\alpha_i, \beta_i|.)}{\delta \alpha_i, \beta_i} = \frac{\delta}{\delta \alpha_i, \beta_i} \sum_{k=1}^K \gamma_k^{-1} \frac{1}{2\sigma_k^2} \sum_{j \in I_i} (<V_l^{ij}>_{\hat{Z}_k} - f(\alpha_i t_{ij} + \beta_i ; \theta_k))^2 = 0
\end{equation}
We expand the average across the vertices and slide the derivative operator inside the sums:
\begin{equation}
\sum_{k=1}^K \gamma_k^{-1} \frac{1}{2\sigma_k^2} \sum_{j \in I_i} 2 \left( \sum_{l=1}^L \gamma_k z_{lk} V_l^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k) \right) \frac{-\delta f(.)}{\delta \alpha_i, \beta_i}
\end{equation}
Since $ \sum_{l=1}^L \gamma_k z_{lk} = 1$ we get:
\begin{equation}
2 \sum_{k=1}^K \gamma_k^{-1} \frac{1}{2\sigma_k^2} \sum_{j \in I_i} \frac{-\delta f(.)}{\delta \alpha_i, \beta_i} \left( \sum_{l=1}^L \gamma_k z_{lk} (V_l^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k)) \right)
\end{equation}
Removing the factor 2 and sliding $\gamma_k$:
\begin{equation}
\sum_{k=1}^K \gamma_k^{-1} \gamma_k \frac{1}{2\sigma_k^2} \sum_{j \in I_i} \frac{-\delta f(.)}{\delta \alpha_i, \beta_i} \left( \sum_{l=1}^L z_{lk} (V_l^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k)) \right)
\end{equation}
Further sliding $\sum_{l=1}^L z_{lk}$ to the left we get the final optimisation problem:
\begin{equation}
\label{eq:supAlphaFast2}
\sum_{k=1}^K \frac{1}{2\sigma_k^2} \sum_{l=1}^L z_{lk} \sum_{j \in I_i} \frac{- \delta f(.)}{\delta \alpha_i, \beta_i} (V_l^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k))
\end{equation}
\subsubsection{Slow implementation}
In a similar way to the trajectory parameters, we want to prove that solving the problem from Eq. \ref{eq:supAlphaFast2} (fast implementation) is the same as solving the original slow implementation problem, which is defined as:
\begin{equation}
\alpha_i, \beta_i = \argmin_{\alpha_i, \beta_i} \sum_{l=1}^L \sum_{k=1}^K z_{lk} \frac{1}{2\sigma_k^2} \sum_{j \in I_i} (V_l^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k))^2
\end{equation}
Taking the derivative of the function above with respect to $\alpha_i, \beta_i$, we get:
\begin{equation}
\frac{\delta l_{slow}(\alpha_i, \beta_i|.)}{\delta \alpha_i, \beta_i} = \sum_{k=1}^K \frac{1}{2\sigma_k^2} \sum_{l=1}^L z_{lk} \sum_{j \in I_i} \frac{- \delta f(.)}{\delta \alpha_i, \beta_i} (V_l^{ij} - f(\alpha_i t_{ij} + \beta_i ; \theta_k))
\end{equation}
This is the same problem as the fast implementation one from Eq. \ref{eq:supAlphaFast2}, thus the fast model is equivalent to the slow model with respect to $\alpha$, $\beta$.
\end{document}
| {'timestamp': '2019-01-14T02:14:02', 'yymm': '1901', 'arxiv_id': '1901.03553', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03553'} | arxiv |
\section{#1}}}
\newcommand{\tempsubsec}[1] {\note{\subsection{#1}}}
\newcommand{\todobox}[1] {\framebox[1.05\width]{\color{red}{#1}}}
\newcommand{\varf} {\mathsf{F}}
\newcommand{\sol}[1]{sol(#1)}
\begin{document}
\begin{abstract}
\input{abstract}
\end{abstract}
\maketitle
\section{Introduction}
\label{sec:intoduction}
\input{introduction}
\section{Preliminaries}
\label{sec:preliminaries}
\input{prelim}
\section{Rewriting linear programs}
\label{sec:weight-corr}
\input{weightings_correspondence}
\section{Connecting edge-weightings and tuple-weightings}
\label{sec:proofs}
\input{proof.tex}
\section{Consequences and extension of the result}
\label{sec:proj}
\input{proj}
\section{Conclusion}
\label{sec:conclusion}
\input{conclusion}
\paragraph{Acknowledgment}
\input{acknowledgement}
\subsection{A tractable algorithm for DWC}
\begin{theorem}
\label{thm:fr-tractable} Given a {\ddcircuit} $\circuit$, one can compute
$\dwc(\solcircuit{})$ in time polynomial in the size of $\circuit$.
\end{theorem}
We define a linear program $\clp{\circuit}$ on the edges of $\circuit$ which we claim to be
equivalent to $\nlp{\solcircuit{}}$. We assume wlog that the root $r$ of $\circuit$ has a single
ingoing edge which we call the \emph{output edge} $\rootedge$.
\begin{definition}[$\clp{\circuit}$]
max $\rootedge$
s.t.
$\bigwedge\limits_{u \in \uplus-gates{\circuit}}$
\end{definition}
Observe that given a circuit $\circuit$, $\clp{\circuit}$ is linear in the size of $\circuit$
and that it is straightforward to generate it in linear time. We thus propose the following
tractable algorithm to compute $\dwc(\solcircuit{})$.
\begin{lstlisting}[]
Function ComputeDWC(circuit)
LP := GenerateLP(circuit)
DWC := SolveLP(LP)
Return DWC
EndFunction
\end{lstlisting}
As a corollary of Theorem~\ref{thm:fr-tractable} and Theorem~\ref{thm:cq-to-fr},
we get that for every $k \in \mathbb{N}$, computing $\dwc(Q(\db))$ is tractable
for the class of all conjunctive queries of fractional hypertree width $k$.
\reviewer{4}{Please state the exact complexity of solving the LP DWC over a factorized database. Ideally, please give the combined complexity.}
We do not give complexity bounds in Theorem~\ref{thm:fr-tractable} as we will
see that it mainly depends on a call to an external linear program solver. Our
algorithm roughly works as follows: we show in Section~\ref{sec:weight-corr}
that any weighting on the tuples of $\solcircuit{}$ can be naturally represented as a
weighting of the edges of $\circuit$. We then show in
Section~\ref{sec:applications} how to use this correspondence to rewrite $\nlptext$
into an equivalent polynomial size linear program on the edges of $\circuit$
that we can then solve by calling an external linear program solver.
\subsection{Motivating example}
\label{sec:example}
\input{example}
\subsection{Contribution of this paper}
\label{sec:contrib}
In this paper, we generalize the technique seen in the previous example to
reduce the size of a linear program whose variables are the answer set of a
conjunctive query. More precisely, we give a generic approach to exploit the
structure of conjunctive queries in order to generate equivalent linear programs
of size polynomial in the size of the database which may be smaller than the
size of the answer set. As deciding whether a conjunctive query has at least
one solution is already $\mathsf{NP}$-complete, it is very unlikely that this approach
is always possible. Hence, we based our approach on the framework of factorized
databases of Olteanu and Z\'{a}vodn\'{y}~\cite{olteanu2012factorised}. A
factorized database is a data structure that allows to represent a table in a
factorized way that can be much smaller than the original table. More precisely,
a factorized representation of a table may be seen as a circuit whose inputs are
tables with one column and performing only Cartesian products and disjoint
unions that we will refer to as {\ddcircuit}s in this paper. Our central
theorem, Theorem~\ref{th:weightingCorrespondence}, shows that a given weighting
of a table represented by a {\ddcircuit} can be canonically represented as a
weighting of the edges of the circuit. This connection gives us a direct way of
rewriting a linear program whose variables are the tuples of a table represented
by a {\ddcircuit} into a linear program whose variables are the edges of the
circuit having the same optimal value.
Several classes of conjunctive queries are known to admit polynomial size
{\ddcircuit}s, the most notorious one being conjunctive queries with bounded
fractional hypertree width~\cite{olteanu_size_2015}. Fractional hypertree
width~\cite{gottlob2016hypertree,gottlob_hypertree_2002} is a parameter
generalizing acyclicity of the hypergraph of a conjunctive
query~\cite{Yannakakis}. Intuitively, it measures how the relations and the
variables of a conjunctive query interact with each other. Various aggregation
problems are tractable on such queries such as counting the number of
answers~\cite{pichler_tractable_2013} or enumerating them with small
delay~\cite{deep2019ranked,bagan2007acyclic}. Most of these problems are solved
by dynamic programming algorithms working in a bottom-up fashion on a tree
shaped decomposition of the query. While one could use this dynamic programming
approach to solve our problem as well, it makes the algorithm harder to
describe. We thus choose to present our results on {\ddcircuit}s directly. In
this setting, given a {\ddcircuit} and a linear program on its answer set, the
rewriting of the linear program is straightforward, even if the correction of
the algorithm is more complicated to establish.
\subsection{Related work}
\label{sec:related}
Factorized databases have already been used to solve complex problems on the
answers of conjunctive queries. They have been used by Schleich et
al.~\cite{schleich2016learning} to perform linear regression on data represented
as a factorized databases more efficiently than by first enumerating the
complete answer set. Fink et al.~\cite{fink2012aggregation} have also used
factorized databases to compute the probability distribution of query results in
the framework of probabilistic databases. To the best of our knowledge, our
result is the first to use this framework to solve optimization problems more
efficiently.
Better integration of optimization problems directly into DBMS has however
already been considered. Cadoli and Mancini~\cite{cadoli07} introduced an
extension of \texttt{SQL} called \texttt{ConSQL} that allows to select optimal
solutions to constraint problems directly in \texttt{SQL}-like queries.
\v{S}ik{\v{s}}nys and Pedersen introduced \texttt{SolveDB} in~\cite{vsikvsnys16}
which is also an extension of \texttt{SQL} that allows to solve optimization
problems directly in the querying language thus simplifying the usual
workflow of feeding an \texttt{AMPL} programs with data extracted from a
database.
Both work mainly focus on designing the language and procedures to
answer query in a very general setting. Though this is a very important and
interesting question, we do not focus much on the language part in this work but
more on the optimization part of solving linear programs.
The need to solve linear programs on answer sets of conjunctive queries has
already appeared in the data mining community, especially for the problem of
estimating the frequency of a pattern in a data graph. In this setting, the
problem is to evaluate the frequency of a subgraph, the pattern, in a larger
graph. A naive way of evaluating this frequency is to use the number of
occurrences of the pattern as a frequency measure. Using this value as a
frequency measure, is problematic since different occurrences of a pattern may
overlap, and as such they share some kind of dependencies that is relevant from
a statistical point of view. More importantly, due to the overlaps, this measure
fails to be anti-monotone, meaning that a subpattern may be counter-intuitively
matched less frequently than the pattern itself. Therefore, the finding of
better anti-monotonic frequency measures -- also known as {\em support measures}
-- has received a lot of attention in the data mining
community~\cite{bringmann08,calders11,fiedler07}. A first idea is to count the
maximal number of non-overlapping patterns~\cite{vanetik02}. However, finding
such a maximal subset of patterns essentially boils down to finding a maximal
independent set in a graph, a notorious NP-complete problem~\cite{garey02}. The
$s$-measure, an alternative approach proposed by Wang et
al.~\cite{wang_efficiently_2013}, consists in counting the number of occurrences
with respect to a weighting of the occurrences taking dependencies into account.
The weighting proposed by the authors is defined via a linear program whose
variables are the occurrences of the pattern. Seeing the problem of finding all
occurrences of a pattern in a graph as a conjunctive query on a database whose
only relation is the edges of the graph, our result directly applies to the
problem of computing the $s$-measure and allows to compute it in polynomial time
if the treewidth of the pattern is bounded.
Binary and Mixed-Integer programs (which are closely related to linear programs) have also
appeared in the database community as ways to work with possible worlds. In
\cite{kolaitis_efficient_2013} the authors use binary programming to answer queries on
inconsistent databases. In this work a binary programs concisely encodes the possible
repairs of the database and is used to eliminate potential answers until a consistent answer
(or the absence thereof) is found. In \cite{tiresias} the authors use Mixed-Integer Programming
to answer how-to queries expressed in the "Tiresias Query Language" (TiQL) which is based on datalog.
There a Mixed-Integer Program is generated from the TiQL query and database. The MIP is then
optimized using the structure of the database before being fed to an external solver which is
similar in spirit to the goal of this paper.
\paragraph{Organization of the paper.}
The paper is organized as follows. Section~\ref{sec:preliminaries} introduces
the notions and definitions that are necessary to precisely state our main
result. In particular, this section contains the definition of the fragments of
linear programs on tables we use in this paper. Section~\ref{sec:weight-corr}
presents our main technical tool to solve the general problem by relating
weights given on the rows of a table and on the edges of the circuit
representing it in a factorized manner and explains how a linear program whose
variables are the elements of a relation defined by a circuit can be rewritten
as a linear program whose variables are the edges of the circuit and thus be
solved in polynomial time in the size of the circuit. The correction of our
algorithm is presented in Section~\ref{sec:proofs}. Section~\ref{sec:proj}
exposes some consequences of our results: we mention corollaries to prove the
tractability of bounded fractional hypertreewidth quantifier-free conjunctive
queries. We also present a simple method to handle existential quantification.
Finally, we give suggestions for future work in the conclusion.
\subsection{General notations}
We denote by $\mathbb{R}$ the set of real numbers and by $\mathbb{R}_+$ the set of non-negative
real numbers. For any positive natural number $n$, we denote by $[n]$ the set
$\{1,\dots,n\}$. For two sets $Y$ and $Z$, we denote by $Y^Z$ the set of (total)
functions from $Z$ to $Y$. A finite function
$R=\{(z_1,y_1),\ldots,(z_n,y_n)\}$ where all $z_i$ are pairwise distinct is
denoted by $[z_1/y_1,\ldots,z_n/y_n]$. In the case $n=1$ we
will simply write $z_1/y_1$ instead of $[z_1/y_1]$. Given a function $f \in Y^Z$ and $Z' \subseteq Z$, we
denote by $\projt{f}{Z'}$ the projection of $f$ on $Z'$, that is,
$\projt{f}{Z'} \in Y^{Z'}$ and for every $z \in Z'$,
$\projt{f}{Z'}(z)=f(z)$
A directed graph is a pair $G=(V,E)$ with $E\subseteq V\times V$.
Given a directed graph $G$ we write $\nodes{G}=V$ for the set of
nodes and $\edges{G}=E$ for the set of edges. For any $u\in V$,
we denote by $\ingoing{u}$ (resp. $\outgoing{u}$) the set of
ingoing (resp. outgoing) edges of $u$.
Let $\varx$ be a finite set of \emph{attributes} and $\dom$ be a finite domain.
A \emph{(database) tuple with attributes in $\varx$ and domain $\dom$} is a
function $\tau:\varx\to \dom$ mapping attributes to database elements. A
\emph{(database) relation} with attributes $\varx$ and domain
$\dom$ is a set of such tuples, that is, a subset of $\dom^\varx$.
\subsection{Linear programs}
\label{sec:lp}
Linear programs form a wide class of (convex) optimization problems which are
known to be tractable. The first polynomial time algorithm for solving this
problem is the ellipsoid algorithm~\cite{khachiyan1979}. Other more efficient
algorithms have been proposed later~\cite{karmarkar, lee} and there exist many
tools using these techniques together with heuristics to solve this problem in
practice such as {lp\_solve\footnote{\url{http://lpsolve.sourceforge.net/}}} or
{glpk\footnote{\url{https://www.gnu.org/software/glpk/}}}. In this paper, we
will use these tools as black boxes and will only use the fact that finding
optimal solutions of linear programs can be done in polynomial time.
Given a finite set of variables $X$, a \emph{linear form} $\phi$ on $X$ is given
as a set of reals $\mu(x)$ for every $x \in X$. Given an assignment $a : X
\rightarrow \mathbb{R}$ of the variables of $X$, $\phi(a)$ is defined as $\sum_{x \in X}
\mu(x)a(x)$. Through the paper, we denote linear forms as polynomials as
follows:
\[\mu_1 X_1 + \dots + \mu_n X_n. \]
A \emph{linear constraint} $C=(\phi,s,c)$ on variables $X$ is given as a linear
form $\phi$ on $X$, a binary relation $s \in \{\leq, =, \geq, <, >\}$
and a real $c \in \mathbb{R}$. Given an assignment $a : X \rightarrow \mathbb{R}$ of the
variables of $X$, $C$ is satisfied by $a$ if $s(\phi(a), c)$. Through the
paper, we denote linear constraints by adapting the notation of linear programs:
\[\mu_1 X_1 + \dots + \mu_n X_n \leq c. \]
A \emph{linear program} $L=(X, \phi, \mathcal{C})$ on variables $X$ is given as a
linear form $\phi$ called the \emph{objective function} and a set of linear
constraints $\mathcal{C}$ on variables $X$. We write $L$ as:
$$
\begin{gathered}
\text{max } \phi \text{ subject to } \mathcal{C}
\end{gathered}
$$
The \emph{feasible region} of $L$, denoted by $\sol{L}$, is the set of assignments
$a : X \rightarrow \mathbb{R}$ such that for every $C \in \mathcal{C}$, $a$ satisfies $C$. We will often refer to
an assignment in the feasible region as a \emph{solution} to the linear program.
An \emph{optimal solution} of $L$ is a solution $a$ in the feasible region that
maximizes the objective function of $L$, i.e. for all $a' \in \sol{L}$, $\phi(a)
\geq \phi(a')$. The \emph{optimal value} of $L$ is defined as $\phi(a)$ where
$a$ is some optimal solution of $L$.
The \emph{size} of $L$ is defined to be $|X| \cdot |\mathcal{C}|$. Observe that the
size of an encoding of a linear program may be bigger than our definition of
size as we will have to store the coefficient. In this paper, we present a
succinct rewriting of a class of linear program that does not change the
coefficients, so we do not need to be too precise on the way they are encoded.
In order to simplify the presentation of the results, we will not take this
encoding into account.
\subsection{Linear programs on relations}
\label{sec:lpt}
In this paper, we are interested in a class of linear programs whose variables
are the elements of a finite relation. To manipulate this kind of programs, we
need a definition of linear programs parametrized by a relation. We introduce in
this section the notion of \emph{Common Attribute Sum Linear Programs},
abbreviated as {CAS-LP}s. A {CAS-LP} $L=(\mathsf{X}, \dom, \phi, \mathcal{C})$ on
attributes $\mathsf{X}$ and domain $\dom$ is given as a linear form $\phi$ called
the \emph{objective function} and a set of linear constraints, both on variables
$S(\mathsf{X}, \dom) := \{S_{x,d}\}_{x \in \mathsf{X}, d \in \dom}$, called the
{CAS variable}s.
From a strictly formal point of view, a {CAS-LP} is just a linear program on
variables $S(\mathsf{X},\dom)$. However, we are not interested in the optimal
solutions of this linear program but in the solution of a linear program that is
obtained from a {CAS-LP} and a relation $R \subseteq \dom^\mathsf{X}$.
Given a {CAS-LP} $L$ on attributes $\mathsf{X}$, domain $\dom$ and given a
relation $R \subseteq \dom^\mathsf{X}$, a solution of $L$ on $R$ is an assignment
$\om: R \rightarrow \mathbb{R}_+$ such that the extension of $\om$ on variables
$S_{x,d}$ defined as $\om(S_{x,d}) := \xdtuplesum{x}{d}{R}$ is a solution of
$L$. An \emph{optimal solution} of $L$ on $R$ is a solution of $L$ on $R$ that
maximizes the objective function of $L$. The \emph{optimal value} of $L$ on $R$
is the value of the objective function on an \emph{optimal solution}.
Alternatively, we could see a solution of $L$ on $R$ as the solution of the
\emph{ground linear programs} $L(R)$ on variables $\{\tau \mid \tau \in R \}$
obtained by replacing the variable $S_{x,d}$ by $\sum\limits_{\substack{\tau \in
R \\ \tau(x)=d}} \tau$ in $L$ and by adding the constraints $\tau \geq 0$
for every $\tau \in R$. This gives a first naive algorithm to find the optimal
solution of $L$ on $R$: one can compute $L(R)$ explicitly and solve it using an
external solver.
When $R$ is given as the relation defined by a conjunctive query on a database
however, the relation may be much bigger than the size of the database which
results in a huge ground linear program. The goal of this paper is to study how
one can compute the optimal value of such ground linear programs in time
polynomial in the size of the database and not in the size of the resulting
relation.
Fig.~\ref{fig:lpsxd} gives a {CAS-LP} $L$ corresponding to the example of
Section~\ref{sec:example}. Indeed, if $R$ is the relation corresponding to the
answer set of query $Q$ of Section~\ref{sec:example}, then $L(R)$ exactly
corresponds to the linear program of Fig.~\ref{fig:lpex}.
\begin{figure}
\begin{align*}
\text{maximize } & \sum\limits_{v \in pname} \sxd{p}{v} \\
\text{subject to }
& \forall v \in \domain{rname},
\sxd{r}{v} \leq 100 \\
& \forall v \in \domain{dname},
\sxd{d}{v} \leq 100 \\
\end{align*}
\caption{Research projects example as a CAS-LP}
\label{fig:lpsxd}
\end{figure}
Actually, computing this optimal value for conjunctive query is $\mathsf{NP}$-hard:
\begin{proposition}
The problem of deciding whether the optimal value of $L(Q(\db))$ is non-zero
given a quantifier-free conjunctive query $Q$, a database $\db$ and a {CAS-LP}
$L$ is $\mathsf{NP}$-hard.
\end{proposition}
\begin{proof}
Let $Q$ be a quantifier-free conjunctive query and $x$ an attribute of $Q$ on
domain $\dom$. Let $L$ be the {CAS-LP} defined as:
\begin{align*}
\text{maximize } & \sum\limits_{d \in \dom} \sxd{x}{d}.
\end{align*}
It is not hard to see that, given a database $\db$, the optimal value of
$L(Q(\db))$ is non-zero if and only if $Q(\db) \neq \emptyset$. Since deciding,
given $Q$ and $\db$, whether $Q(\db) \neq \emptyset$ is an $\mathsf{NP}$-complete
problem~\cite{chandra77}, the statement of the proposition follows.
\end{proof}
\subsection{{\ddCircuit}s}
\label{sec:cq}
To solve ground linear programs efficiently, we will work on factorized
representations of relations. We use a generalization of the framework of
factorized databases introduced by Olteanu et al.~\cite{olteanu2012factorised}.
Our factorized representations are defined similarly with only a subset of the
syntactic restrictions (we do not need $f$-representation or
$d$-representations) on the circuits since our algorithm does not need all of
them to work.
A {\em $\{\cup,\times\}$-circuit} on attributes $\varx$ and domain $\dom$ is a
directed acyclic graph $\circuit$ with edges directed from the leaves to a
single root $r$ called the output of $\circuit$ and whose nodes, called
\emph{gates}, are labeled as follows:
\begin{itemize}
\item internal gates are labeled by either $\times$ or $\cup$,
\item inputs, \emph{i.e.} nodes of in-degree $0$, are labeled by
atomic database relations of the form $x/d$ for an attribute
$x$ and an element $d \in \dom$. \footnote{Observe that every possible input
relation could be easily simulated with this restricted input using
$\times$ and $\cup$. For example, the relation $\{[x/1, y/1, z/1], [x/0,
y/0, z/0] \}$ can be rewritten as $(x/1 \times y/1 \times z/1) \cup (x/0
\times y/0 \times z/0)$.}
\end{itemize}
Figure~\ref{fig:circuit} pictures a $\{\cup, \times\}$-circuit on attributes
$\{x,y,z\}$ and domain $\{0,1\}$.
\begin{figure}
\centering
\begin{minipage}{.3\textwidth}
\includegraphics[width=4cm]{figures/circuit_example.pdf}
\end{minipage}%
\begin{minipage}{.1\textwidth}
\begin{tabular}{|c|c|c|}\hline
$x$ & $y$ & $z$ \\ \hline\hline
$1$ & $1$ & $0$ \\ \hline
$1$ & $0$ & $1$ \\ \hline
$0$ & $1$ & $1$ \\ \hline
$0$ & $1$ & $0$ \\ \hline
$1$ & $1$ & $1$ \\ \hline
\end{tabular}
\end{minipage}
\caption{Example of a $\{\cup,\times\}$-circuit representing the
database relation on the right. This circuit is also a \ddcircuit.}
\label{fig:circuit}
\end{figure}
We denote by $\var{\circuit}$ the attributes appearing in the database
relations of the input nodes of
$\circuit$.
We define the \emph{size} of $\circuit$ as the number of edges in the
underlying graph of $\circuit$. We denote it by $|C|$.
Given a gate $u$ of $\circuit$, we denote by $\circuit_u$ the
subcircuit of $\circuit$ rooted in $u$ (in which
dangling edges from above are removed). We denote by
{$\andsym$-gate}s$(\circuit)$ the set of all the {$\andsym$-gate}s
and by $\cup$-gate{}s$(\circuit)$ the set of all
$\cup$-gate{}s of $\circuit$.
We impose that any $\{\cup, \times\}$-circuit must
satisfy the following restrictions.
\begin{itemize}
\item If $u$ is a $\cup$-gate with children $u_1,\dots,u_k$, we impose that
$\var{\circuit_{u_1}} = \dots = \var{\circuit_{u_k}}$.
\item If $u$ is a $\times$-gate with children $u_1, \dots, u_k$, we impose
that $\var{\circuit_{u_i}} \cap \var{\circuit_{u_j}} = \emptyset$ for every $i
< j \leq k$. Observe that it implies that $\circuit_{u_i}$ and
$\circuit_{u_j}$ are disjoint graphs since otherwise they would share an input
and, thus, an attribute of the relation of this input node.
\end{itemize}
Due to these restrictions, any gate $u$ of a $\{\cup,
\times\}$-circuit $C$ specifies a database relation $\solcircuit{u}$
that we define inductively as follows. If $u$ is an input then $\solcircuit{u}$ is the
relation labelling $u$. If $u$ is a $\times$-gate with children $u_1, \dots,
u_k$, $\solcircuit{{u}}$ is defined as $\solcircuit{u_1} \times \dots \times
\solcircuit{u_k}$. If $u$ is a $\cup$-gate with children $u_1, \dots, u_k$,
$\solcircuit{{u}}$ is defined as $\solcircuit{u_1} \cup \dots \cup
\solcircuit{u_k}$. We define $\solcircuit{}=\solcircuit{r}$ where $r$ is the output of the
circuit.
The way we have currently defined circuits is not yet enough to allow for
efficient aggregation. Given a $\{\cup,\times\}$-circuit $\circuit$ and an
$\cup$-gate $u$ of $\circuit$ with children $u_1,\dots,u_k$, we say that $u$ is
\emph{disjoint} if $\solcircuit{{u_i}} \cap \solcircuit{{u_j}} = \emptyset$ for
every $i < j \leq k$.
In our figures and proofs, we will use the symbol $\uplus$ to indicate
that a union is disjoint. A {\ddcircuit} is a $\{\cup,\times\}$-circuit in
which every $\cup$-gate is a $\orsym$-gate{}.
Observe that given a {\ddcircuit}
$\circuit$, one can compute the cardinality of its relation $|\solcircuit{}|$ in time linear in the size of
$\circuit$ by a simple inductive algorithm that adds the sizes of the children
of a $\uplus$-gate and multiply the sizes of the children of the $\times$-gates.
Disjointness is a semantic condition and it is $\mathsf{coNP}$-hard to check the
disjointness of a gate given a \udcircuit. In practice however, algorithms
producing {\ddcircuit} ensure the disjointess of all $\cup$-gates during the construction of the
circuit, usually by using $\cup$-gates of the form: $\biguplus_{d \in D}
(\{x/d\} \times C_d)$, so that the different values $d$ assigned to $x$
ensure disjointness.
\begin{theorem}{\cite[Theorem 7.1]{olteanu_size_2015}}
\label{thm:cq-to-fr} Given a quantifier free conjunctive query $Q$, a
hypertree decomposition $T$ of $Q$ of fractional hypertreewidth $k$ and a
database $\db$, one can construct a \ddcircuit $\circuit$ of size at most $|Q|
\cdot |\db|^k$ whose attributes are the variables of $Q$ such that $Q(\db) =
\solcircuit{}$ in time $O(\log(|\db|)\cdot |\db|^k)$.
\end{theorem}
For the special case of quantifier free acyclic conjunctive query the
theorem follows from a variant of Yanakakis' algorithm.
We refer the reader to~\cite{gottlob2016hypertree} for the definition of
fractional hypertreewidth as we will not work with this notion directly in this
paper but only with {\ddcircuit}s, using Theorem~\ref{thm:cq-to-fr} to bridge
both notions.
\subsection{Effective reconstruction of solutions}
As it is illustrated in the motivating example of the introduction, one may not
only be interested in the optimal value of a {CAS-LP} but also on finding an
optimal solution. As the size of a factorized relation may be too big, it may
not be tractable to output the entire optimal solution. However, the
construction used in the proof of Theorem~\ref{th:weightingCorrespondence} to go
from an edge-weighting to a tuple-weighting is effective in the sense that given
an edge-weighting $W$ of a {\ddcircuit} $C$ and $\tau \in \solcircuit{}$, one
can compute $\om(\tau)$ in time polynomial in $|C|$ (where $\om$ is the
tuple-weighting inducing $W$ given by Theorem~\ref{th:weightingCorrespondence}).
It is indeed enough to compute the partial tuple weightings $\omega_e$ presented
in Section~\ref{sec:edges-tuples} in a bottom-up induction on $\circuit$.
\subsection{Tractability for conjunctive queries}
By connecting Theorem~\ref{th:rewritecaslp} and Theorem~\ref{thm:cq-to-fr}, we
directly get the tractability of solving bounded fractional hypertree width
quantifier free conjunctive queries:
\begin{corollary}
\label{cor:rewritecaslp_cq} Given a {CAS-LP} $L$, a quantifier-free
conjunctive query $Q$, a hypertree decomposition of $Q$ of fractional
hypertreewidth $k$ and a database $\db$, one can compute the optimal value of
$L(Q(\db))$ in polynomial time.
\end{corollary}
The exact complexity of Corollary~\ref{cor:rewritecaslp_cq} depends on the
runtime of the linear program solver that is used that also highly depends on
the structure of the linear program. We do not know whether we could directly
solve the linear program on the circuit without calling the solver and have
better complexity bounds.
The complexity also depends on the fact that we are given a good hypertree
decomposition in the input. Computing the best decomposition for fractional
hypertree width is known to be an $\mathsf{NP}$-hard problem~\cite{fischl2018general}
but it can be approximated in polynomial time to a cubic factor~\cite{marx10}
which is enough if one is interested only in theoretical tractability. In
practice however, our algorithm would perform the best when the circuit is
small, be it computed from hypertree decompositions or other techniques.
Our result does not directly apply to quantified conjunctive queries. Indeed,
existentially or universally projecting variables in a {\ddcircuit} may lead to
an exponential blow-up of its size or the disjointness of unions may be lost.
However, for existential quantification, we do not need to actually project the
variables in the circuit to compute the optimal value. Given a relation $R$ on
attribute $\varx$ and $Z \subseteq \varx$, we denote by $\exists Z. R =
\{\tau|_{\varx \setminus Z} \mid \tau \in R\}$. We have the following:
\begin{theorem}
\label{th:caslpproj}
Let $L$ be a {CAS-LP} on attributes $\varx \setminus Z$ and domain $\dom$. Let
$R$ be a relation on attributes $\varx$ and domain $\dom$. $L(R)$ and
$L(\exists Z.R)$ have the same optimal value.
\end{theorem}
\begin{proof}
We show how one can transform a solution of $L(R)$ into a solution of
$L(\exists Z.R)$ with the same value and vice-versa.
We introduce the notation for $\tau' \in \exists Z.R$:
\[\mathit{Ext}(\tau') = \{\tau'' : Z \rightarrow \dom \mid \tau'\times\tau'' \in R\}.\]
Let $\om : R \rightarrow \mathbb{R}_+$ be a solution of $L(R)$. Given $\tau' \in
\exists Z.R$, we define $\om'(\tau') := \sum_{\tau'' \in \mathit{Ext}(\tau')}
\om(\tau' \cdot \tau'')$. It is easy to see that $\om'$ is a solution of $L(\exists Z.R)$
since $\om'(S_{x,d}) = \om(S_{x,d})$ for every $x \in \varx \setminus Z$ and
$d \in \dom$.
Similarly, if $\om' : \exists Z. R \rightarrow \mathbb{R}_+$ is a solution of
$L(\exists Z. R)$, we define for $\tau \in R$, $\om(\tau) := {\om'(\tau')
\over \#\mathit{Ext}(\tau')}$ where $\tau' = \tau|_{\varx \setminus Z}$. Again, it
is easy to see that $\om(S_{x,d}) = \om'(S_{x,d})$ which concludes the proof.
\end{proof}
Theorem~\ref{th:caslpproj} implies that one can still solve {CAS-LP}s on
relations given as existential projection of a {\ddcircuit}. In other words, if
a conjunctive query $Q$ is of the form $\exists Z. Q'$ and $Q'$ has bounded
fractional hypertree width, then we can still solve {CAS-LP}s on $Q(\db)$ for a
given database $\db$ in polynomial time by transforming $Q'$ into a {\ddcircuit}
and solving the {CAS-LP} on it directly.
\subsection{Proof-trees}
\label{sec:proof-trees}
From now on, to simplify the proofs, we assume wlog that every internal gate of
a {\ddcircuit} has fan-in two. It is easy to see that, by associativity,
$\times$-gates and $\uplus$-gates of fan-in $k>2$ can be rewritten with $k-1$
similar gates which is a polynomial size transformation of the circuit. We also
assume that for every $x \in \var{\circuit}$ and $d \in D$, we have at most one
input labeled with $x/d$. This can be easily achieved by merging all such
inputs.
Let $\circuit$ be a {\ddcircuit} and let $\tau \in \solcircuit{}$. The
\emph{proof-tree} of $\tau$, denoted $\prooftree{\circuit}{\tau}$, is a
subcircuit of $\circuit$ participating to the computation of $\tau$. More
formally, $\prooftree{\circuit}{\tau}$ is defined inductively by starting from
the output as follows: the output of $\circuit$ is in
$\prooftree{\circuit}{\tau}$. Now if $u$ is a gate in
$\prooftree{\circuit}{\tau}$ and $v$ is a child of $u$, then we add $v$ in
$\prooftree{\circuit}{\tau}$ if and only if $\proj{C_v} \in \solcircuit{v}$. A
proof-tree is depicted in red in Figure~\ref{fig:prooftree_example}.
\begin{figure}
\centering
\includegraphics[width=4cm]{figures/prooftree_example.pdf}
\caption{Proof-tree of the tuple $[x/1, y/1, z/1]$}
\label{fig:prooftree_example}
\end{figure}
\begin{proposition}
\label{prop:prooftreeUnique}
Given a \ddcircuit{} $\circuit$ and $\tau \in \solcircuit{}$,
$\somept := \prooftree{\circuit}{\tau}$, the following holds:
\begin{itemize}
\item every $\times$-gate of {$\somept$} has all its
children in $\somept$,
\item every $\uplus$-gate of $\somept$ has exactly one of
its children in $\somept$,
\item $\somept$ is connected and every gate of $\somept$ has out-degree at
most $1$ in $\somept$,
\item for any $x \in \var{\circuit}$, $\somept$ contains exactly one input
labeled with $x/\tau(x)$.
\end{itemize}
\end{proposition}
\begin{proof}
\label{prf:prooftreeUnique}
By induction, it is clear that for every gate $u$ of $\somept$, $\proj{C_u}
\in \solcircuit{u}$. Thus, if $u$ is a $\uplus$-gate of $\somept$, as $u$ is
disjoint, exactly one of it child $v$ has $\proj{C_u} \in \solcircuit{u}$.
If $u$ is a $\times$-gate with children $u_1,u_2$, then by definition,
$\proj{C_u} \in \solcircuit{u}$ if and only if $\proj{C_{u_1}} \in
\solcircuit{u_1}$ and $\proj{C_{u_2}} \in \solcircuit{u_2}$. Thus both $u_1$
and $u_2$ are in $\somept$.
It is clear from definition that $\somept$ is connected since $\somept$ is
constructed by inductively adding children of gates that are already in
$\somept$. Now assume that $\somept$ has a gate $u$ of out-degree greater
than $1$ in $\somept$. Let $u_1,u_2$ be two of its parents and let $v$ be
their least common ancestor in $\somept$. By definition, $v$ has in-degree
$2$, this it is necessarily a $\times$-gates with children $v_1,v_2$. Thus
$u$ is both in $\circuit_{v_1}$ and $\circuit_{v_2}$, which is impossible
since they are disjoint subcircuits.
Finally, let $x \in \var{\circuit}$. Observe that if $\somept$ has an input
labeled $u$ with $x/d$ then $d = \tau(x)$ since $\proj{C_u} \in
\solcircuit{u}$. Thus, if $\somept$ contains two inputs $v_1$ and $v_2$ on
attribute $x$, they are both labeled with $x/\tau(x)$ and are thus the same
input.
\end{proof}
A proof-tree may be seen as the only witness that a tuple belongs to $\solcircuit{}$.
We define the relation induced by an edge $e$
as the set of tuples of $\solcircuit{}$ such that their proof-tree contains
the edge $e$, that is $\soledge{e} := \{ \tau \in \solcircuit{} \mid e \in
\prooftree{\circuit}{\tau} \}$.
In the following we show some fundamental properties of proof-trees that we will
use to prove the correctness of our algorithm. For the rest of this section, we
fix a {\ddcircuit} $\circuit$ on attributes $\varx$ and domain $\dom$.
\begin{proposition}
\label{prop:outgoingDisjoint}
Let $u$ be a gate of $\circuit$ and $e_1, e_2$ $\in \outgoing{u}$
with $e_1 \neq e_2$.
Then $\soledge{e_1} \cap \soledge{e_2} = \emptyset$.
\end{proposition}
\begin{proof}
Assume that $\tau \in \soledge{e_1}$ and $\tau \in \soledge{e_2}$ for $e_1,e_2
\in \outgoing{u}$ with $e_1 \neq e_2$. By definition, it means that both $e_1$ and $e_2$ are in
$\prooftree{\circuit}{\tau}$ which is a contradiction as
$\prooftree{\circuit}{\tau}$ has out-degree $1$ by
Proposition~\ref{prop:prooftreeUnique}.
\end{proof}
\begin{proposition}
\label{prop:prooftreeInput}
Let $x \in \varx$ and $d \in \dom$ and let $u_{x/d}$ be the input of $\circuit$
labeled with $x/d$.
\[ \tupleset{x}{d} = \biguplus\limits_{e \in \outgoing{u_{x/d}}} \soledge{e}. \]
\end{proposition}
\begin{proof}
Let $x \in \var{\circuit}$ and $d \in \dom$. Let $\tau \in \tupleset{x}{d}$.
By Proposition \ref{prop:prooftreeUnique}, $u_{x/d}$ belongs to
$\prooftree{\circuit}{\tau}$ so there is at least one $e \in
\outgoing{u_{x/d}}$ that belongs to $\prooftree{\circuit}{\tau}$. Similarly, if
$\tau \in \soledge{e}$ for some $e \in \outgoing{u_{x/d}}$ then $u_{x/d}$ is also in
$\prooftree{\circuit}{\tau}$, and then $\tau(x)=d$. This proves the equality.
The disjointness of the union directly follows from
Proposition~\ref{prop:outgoingDisjoint}.
\end{proof}
Next we show that the disjoint union of the relations induced by each ingoing
edge of a $\orsym$-gate{} is equal to the disjoint union of the relations induced by
each outgoing edge of this gate.
\begin{proposition}
\label{prop:prooftreeOr}
Let $u$ be an internal $\orsym$-gate{} of $\circuit$, \\
\[\disjointsolunion{i}{\ingoing{u}}{\circuit} = \disjointsolunion{o}{\outgoing{u}}{\circuit}.\]
\end{proposition}
\begin{proof}
Let $S_u := \{\tau \mid u \in \prooftree{\circuit}{\tau} \}$ and $\tau \in
S_u$. It is clear from Proposition~\ref{prop:prooftreeUnique} that a proof
tree contains $u$ if and only if it contains at least an edge of $\ingoing{u}$
and at least an edge of $\outgoing{u}$. Thus, both unions are equal to $S_u$.
The disjointness of the first union directly follows from the second item
of Proposition~\ref{prop:prooftreeUnique} and the disjointness of the
second union from Proposition~\ref{prop:outgoingDisjoint}.
\end{proof}
Finally we show that the disjoint union of the relations induced by the outgoing edges of
a $\andsym$-gate{} is equal to the relation induced by each ingoing edge of this gate.
\begin{proposition}
\label{prop:prooftreeAnd}
Let $u$ be an internal $\andsym$-gate{} of $\circuit$,
\[\forall i \in \ingoing{u} : \soledge{i} =
\disjointsolunion{o}{\outgoing{u}}{\circuit} \]
\end{proposition}
\begin{proof}
Let $S_u := \{\tau \mid u \in \prooftree{\circuit}{\tau} \}$. By
Proposition~\ref{prop:prooftreeUnique}, it is clear that if $u$ is in a proof
tree $\somept$, then every edge of $\ingoing{u}$ is also in $\somept$ and
exactly one edge of $\outgoing{u}$ is in $\somept$. Thus, both sets in the
statement are equal to $S_u$. The disjointness of the union follows directly
from Proposition~\ref{prop:outgoingDisjoint}.
\end{proof}
\subsection{Theorem statement}
\label{sec:th-statement}
Given a tuple-weighting $\om$ of a {\ddcircuit} $\circuit$, it naturally induces
an edge-weighting $W$ defined for every $e \in \edges{C}$ as $W(e) := \sum_{\tau \in
\soledge{e}} \om(e)$. We call $W$ the \emph{edge-weighting induced by $\om$}.
\begin{theorem}
\label{th:weightingCorrespondence}
Given a {\ddcircuit} $\circuit$.
\begin{enumerate}[(a)]
\item\label{it:omtoW} For every tuple-weighting $\om$ of $\circuit$, the
edge-weighting $\W$ induced by $\om$ is sound.
\item\label{it:Wtoom} Given a sound edge-weighting $\W$ of $\circuit$, there exists a
tuple-weighting $\om$ of $\circuit$ such that $W$ is the edge-weighting
induced by $\om$.
\end{enumerate}
\end{theorem}
We will provide the proof for this theorem in the following sections.
Observe that if if an edge-weighting $\W$ is induced by a tuple-weighting $\om$ then
\begin{align*}
\xdtuplesum{x}{d}{\solcircuit{}}
= \sum\limits_{e \in \outgoing{x/d}} \sum\limits_{\tau \in \soledge{e}} \val{\om}{\tau}
= \sum\limits_{e \in \outgoing{x/d}} \val{\W}{e}
\end{align*}
so $\W$ is also compatible with $\om$.
Thus Theorem~\ref{th:weightingCorrespondence} is indeed a generalization of
Theorem~\ref{th:weightingCompatibility}.
\subsection{Proof of Theorem~\ref{th:weightingCorrespondence}~\ref{it:omtoW}}
\label{sec:tuples-edges}
This section is dedicated to the proof of Theorem~\ref{th:weightingCorrespondence}~\ref{it:omtoW},
namely that, given a {\ddcircuit} $\circuit$ and a tuple-weighting $\om$ of $\circuit$,
the edge-weighting $\W$ of $\circuit$ induced by $\om$ defined as $\val{\W}{e} := \sum_{\tau \in
\soledge{e}} \om(\tau)$ is sound.
We will see that the soundness of $\W$ follows naturally from the properties of
proof-trees of the previous section.
We prove that $\W$ is sound by checking the case of $\orsym$-gate{s} and $\andsym$-gate{s} separately.
\begin{itemize}
\item We first have to show that for every $\orsym$-gate{} $u$ of $\circuit$, it
holds that $\sum_{e \in \outgoing{u}} \W(e) = \sum_{e \in \ingoing{u}}
\W(e)$. This is a consequence of Proposition~\ref{prop:prooftreeOr}. Let
$u$ be a $\orsym$-gate{} of $\circuit$.
\begin{align*}
\sum_{e \in \outgoing{u}} \W(e) & = \sum_{e \in \outgoing{u}} \sum_{\tau \in \soledge{e}} \om(\tau) \proofnote{by definition of $\W$}\\
& = \sum_{\tau \in R} \om(\tau) \proofnote{where $R = \biguplus_{e \in \outgoing{u}} \soledge{e}$}
\end{align*}
The disjointness of the union in $R$ has been proven in Proposition
\ref{prop:prooftreeOr}, which also states that $R = \biguplus_{e \in
\ingoing{u}} \soledge{e}$. Thus, the last term in the sum can be
rewritten as
\begin{align*}
\sum_{\tau \in R} \om(\tau) & = \sum_{e \in \ingoing{u}} \sum_{\tau \in \soledge{e}} \om(\tau)\\
& = \sum_{e \in \ingoing{u}} \W(e) \proofnote{by definition of $\W$}
\end{align*}
\item We now show that for every $\andsym$-gate{} $u$ of $\circuit$ and for
every edge $i \in \ingoing{u}$ going in $u$, it holds that $\sum_{e \in
\outgoing{u}} \W(e) = \W(i)$. Let $u$ be a $\andsym$-gate{} and $i \in
\ingoing{u}$. The proof is very similar to the previous case but is now
a consequence of Proposition~\ref{prop:prooftreeAnd}. As before, we have
$\sum_{e \in \outgoing{u}} \W(e) = \sum_{\tau \in R} \om(\tau)$ where $R
= \biguplus_{e \in \outgoing{u}} \soledge{e}$. The disjointness of the
union in $R$ has been proven in Proposition \ref{prop:prooftreeAnd},
which also implies that $R = \soledge{i}$. Thus, we have:
\begin{align*}
\sum_{e \in \outgoing{u}} \W(e) & = \sum_{\tau \in \soledge{i}} \om(\tau)\\
& = \W(i) \proofnote{by definition of $\W$}
\end{align*}
\end{itemize}
\subsection{Proof of Theorem~\ref{th:weightingCorrespondence}~\ref{it:Wtoom}}
\label{sec:edges-tuples}
This section is dedicated to the proof of Theorem~\ref{th:weightingCorrespondence}~\ref{it:Wtoom},
namely that, given a circuit $\W$ and a sound edge-weighting $\W$ of $\circuit$,
there exists a tuple-weighting $\om$ of $\circuit$ such that, for every edge $e$ of $\circuit$,
$\sum_{\tau \in \soledge{e}} \om(\tau) = \val{\W}{e}$.
In this section, we fix a {\ddcircuit} $\circuit$ and a sound edge-weighting
$\W$ of its edges.
We assume wlog that the root $r$ of $\circuit$ has a single ingoing edge which we call the \emph{output edge} $\rootedge$.
We construct $\om$ by induction. For every edge $e =
\edge{u}{v}$ of $\circuit$, we inductively construct a tuple weighting $\om[e]$
of $\solcircuit{u}$. We will then choose $\om = \om[o_r]$
and show that this tuple-weighting verifies $\sum_{\tau \in
\soledge{e}} \om(\tau) = \val{\W}{e}$ for every edge $e$ of $\circuit$.
For $e = \edge{u}{v}$, we define $\om[e] : \solcircuit{u} \rightarrow \mathbb{R}_+$
inductively as follows:
\begin{itemize}
\item \textbf{Case 1}: $u$ is an input labeled with $x/d$ then $\solcircuit{u}$ contains only
the tuple $x/d$. We define $\om[e](x/d) := W(e)$.
\item \textbf{Case 2}: $u$ is a $\orsym$-gate{} with children $u_1, u_2$. Let $e_1 =
\edge{u_1}{u}$ and $e_2 = \edge{u_2}{u}$. In this case, given $\tau \in
\solcircuit{u}$, we have by definition that $\tau \in \solcircuit{u_1}$ or
$\tau \in \solcircuit{u_2}$. Assume wlog that $\tau \in \solcircuit{u_1}$. If
$\sum_{f \in \outgoing{u}} W(f) \neq 0$, we define: $\om[e](\tau) := W(e)
{\om[e_1](\tau) \over W(e_1)+W(e_2)}$. Observe that since $\W$ is sound,
$W(e_1)+W(e_2) = \sum_{f \in \outgoing{u}} W(f) \neq 0$. Otherwise
$\om[e](\tau) := 0$.
\item \textbf{Case 3}: $u$ is a $\andsym$-gate{} with children $u_1, u_2$. Let $e_1 =
\edge{u_1}{u}$ and $e_2 = \edge{u_2}{u}$. In this case, given $\tau \in
\solcircuit{u}$, we have by definition that $\tau = \tau_1 \times \tau_2$ with
$\tau_1 \in \solcircuit{u_1}$ and $\tau_2 \in \solcircuit{u_2}$. If $W(e_1)
\neq 0$ and $W(e_2) \neq 0$, we define: $\om[e](\tau) := W(e) {\om[e_1](\tau_1)
\over W(e_1)}{\om[e_2](\tau_2) \over W(e_2)}$. Otherwise $\om[e](\tau) := 0$.
\end{itemize}
We begin our proof by showing that as we construct each $\om[e]$ through a
bottom-up induction there is a relation between $\val{\W}{e}$ and $\om[e]$ which
resembles the property we aim to prove in this section.
\begin{lemma}
\label{lem:WToOmUpward}
For every gate $u$ of $\circuit$ and $e = \edge{u}{v} \in \edges{\circuit}$,
\[\val{\W}{e} = \sum_{\tau \in \solcircuit{u}} \om[e](\tau). \]
\end{lemma}
\begin{proof}
Let $e=\edge{u}{v}$ be an edge of $\circuit$. Observe that when $\sum_{o \in
\outgoing{u}} \W(o) = 0$, then $\W(e)=0$ since $e \in \outgoing{u}$ and $\W$
has positive value. Moreover, by definition of $\om[e]$, for every $\tau \in
\solcircuit{u}$, $\om[e](\tau) = 0$. In particular, $\sum_{\tau \in
\solcircuit{u}} \om[e](\tau) = 0 = \W(e)$. In this case then, the lemma
holds.
In the rest of the proof, we now assume that $\sum_{o \in \outgoing{u}}
\W(o) \neq 0$. We show the lemma by induction on the nodes of $\circuit$ from the
leaves to the root.
\textbf{Base case}: $u$ is a leaf labelled with $x/d$. Let $e$ be an outgoing
edge of $u$. Observe that $\solcircuit{u}$ contains a single tuple $x/d$ and
that, by definition of $\om[e]$, $\val{\W}{e} = \om[e](x/d) = \sum_{\tau \in
\solcircuit{u}} \om[e](\tau)$.
\textbf{Inductive case}: Now let $u$ be an internal gate of $\circuit$ with
children $u_1,u_2$ and let $e_1 = \edge{u_1}{u}$ and $e_2 = \edge{u_2}{u}$, as
depicted in Figure~\ref{fig:inductivestep}.
\begin{figure}[H]
\centering
\includegraphics[width=2cm]{figures/Wom_node.pdf}
\caption{Inductive step notations.}
\label{fig:inductivestep}
\end{figure}
\textbf{Case 1}: Assume that $u$ is a $\orsym$-gate{}. Let
$W=W(e_1)+W(e_2)$. Since $u$ is disjoint, given $\tau \in \solcircuit{u}$,
either $\tau \in \solcircuit{u_1}$ or $\tau \in \solcircuit{u_2}$ but not
both. It follows:
\begin{align*}
\sum_{\tau \in \solcircuit{u}} \om[e](\tau) & = \sum_{\tau \in \solcircuit{u_1}} \om[e](\tau) + \sum_{\tau \in \solcircuit{u_2}} \om[e](\tau) \\
& = \sum_{\tau \in \solcircuit{u_1}}{W(e) \over W} \om[e_1](\tau_1) + \sum_{\tau \in \solcircuit{u_2}} {W(e) \over W}\om[e_2](\tau_2)
\end{align*}
by definition of $\om[e]$. Observe that by induction we have $W(e_1)
= \sum_{\tau \in \solcircuit{u_1}}\om[e_1](\tau_1)$ and $W(e_2) =
\sum_{\tau \in \solcircuit{u_2}}\om[e_2](\tau_2)$. Thus, by taking
the constants out and using this identity, it follows:
\begin{align*}
\sum_{\tau \in \solcircuit{u}} \om[e](\tau) & = {W(e) \over W} \sum_{\tau \in \solcircuit{u_1}}\om[e_1](\tau_1)+ {W(e) \over W} \sum_{\tau \in \solcircuit{u_2}}\om[e_2](\tau_2) \\
& = {W(e) \over W}W(e_1)+{W(e) \over W}W(e_2) \\
& = W(e) {W(e_1) + W(e_2) \over W} \\
& = W(e).
\end{align*}
\textbf{Case 2}: Assume that $u$ is a $\andsym$-gate{}.
Applying the definition of $\om[e]$, we get:
\begin{align*}
\sum_{\tau \in \solcircuit{u}} \om[e](\tau) & = \sum_{\tau \in \solcircuit{u}} W(e){\om[e_1](\projt{\tau}{\var{C_{u_1}}}) \over \val{\W}{e_1}}{\om[e_2](\projt{\tau}{\var{C_{u_2}}}) \over \val{ \W}{e_2}}
\end{align*}
Remember that by definition of {\ddcircuit}s, $\solcircuit{u} =
\solcircuit{u_1} \times \solcircuit{u_2}$. That is, $\tau \in
\solcircuit{u}$ if and only if $\tau_1 :=
\projt{\tau}{\var{C_{u_1}}} \in \solcircuit{u_1}$ and $\tau_2 :=
\projt{\tau}{\var{C_{u_2}}} \in \solcircuit{u_2}$. Thus, we can
rewrite the last sum as:
\begin{align*}
\sum_{\tau \in \solcircuit{u}} \om[e](\tau) & = \sum_{\tau_1 \in \solcircuit{u_1}}\sum_{\tau_2 \in \solcircuit{u_2}} W(e){\om[e_1](\tau_1) \over W(e_1)}{\om[e_2](\tau_2) \over W(e_2)}
\end{align*}
By taking the constant $W(e)$ out of the sum and observing that the
sum is now separated into two independent terms, we have:
\begin{align*}
\sum_{\tau \in \solcircuit{u}} \om[e](\tau) & = W(e)\sum_{\tau_1 \in \solcircuit{u_1}} {\om[e_1](\tau_1) \over W(e_1)}\sum_{\tau_2 \in \solcircuit{u_2}} {\om[e_2](\tau_2) \over W(e_2)}
\end{align*}
By induction, $W(e_i) = \sum_{\tau \in
\solcircuit{u_i}}\om[e_i](\tau_i)$ for $i=1,2$. Hence both sums of
the last term are equal to $1$, which means that $$\sum_{\tau \in
\solcircuit{u}} \om[e](\tau) = W(e).$$
\end{proof}
We choose $\om = \om[o_r]$ where $o_r$ is the output edge.
Lemma~\ref{lem:WToOmUpward} is however not enough to prove
Theorem~\ref{th:weightingCorrespondence} as it only gives the equality $W(e) =
\sum_{\tau \in \soledge{e}} \om(\tau)$ for $e = o_r$. Fortunately we can show
that it holds for every edge $e$ of the circuit. We actually prove a stronger
property, that $\om[e]$ is, in some sense, a projection of $\om$.
Given an edge $e = \edge{u}{v}$ of $\circuit$ and $\tau' \in \solcircuit{u}$, we
denote by $\solproj{e}{\tau'}$ the set of tuples $\tau$ of $\soledge{e}$ such
that $\projt{\tau}{\var{C_u}} = \tau'$. We prove the following:
\begin{lemma}
\label{lem:WToOmDownward}
For every $e = \edge{u}{v} \in \edges{\circuit}$, for every $\tau' \in \solcircuit{u}$,
\[\om[e](\tau') = \sum_{\tau \in \solproj{e}{\tau'}} \om(\tau).\]
\end{lemma}
\begin{proof}
The proof is by top-down induction on $\circuit$.
\textbf{Base case}: We prove the result for $e = \rootedge = \edge{u}{v}$. Let
$\tau' \in \solcircuit{u}$. Because $u$ is the output gate, we have
$\var{\circuit_u} = \var{\circuit}$ and hence $\solproj{e}{\tau'} =
\{\tau'\}$. Recall that $\om = \om[{o_r}]$ by definition. In other words, $\om[e](\tau') =
\om(\tau') = \sum_{\tau \in \solproj{e}{\tau'}} \om(\tau)$.
\textbf{Inductive case}: Now let $e=\edge{u}{v}$ be an internal edge of
$\circuit$. Let $o_1,\dots,o_n$ be the outgoing edges of $v$, $u'$ be the only
sibling of $u$ and let $e'=\edge{u'}{v}$. See Figure~\ref{fig:inductive_step2}
for a schema of these notations. We fix $\tau' \in \solcircuit{u}$ and prove
the desired equality.
\begin{figure}[H]
\centering
\includegraphics[width=2cm]{figures/Wom_edge.pdf}
\caption{Notations for the inductive step.}
\label{fig:inductive_step2}
\end{figure}
\textbf{Case 1}: $v$ is a $\orsym$-gate{}. In this case, $\tau' \in
\solcircuit{v}$. We claim that
\[\solproj{e}{\tau'} = \biguplus_{o \in \outgoing{v}} \solproj{o}{\tau'}.\]
For left-to-right inclusion, let $\tau \in \solproj{e}{\tau'}$. By
definition, its proof tree $\prooftree{\circuit}{\tau}$ contains $e$. Since
$\prooftree{\circuit}{\tau}$ is connected by
Proposition~\ref{prop:prooftreeUnique}, $\prooftree{\circuit}{\tau}$ has to
contain one edge of $\outgoing{v}$. The disjointness of
the right-side union is a direct consequence of
Proposition~\ref{prop:outgoingDisjoint}. For the right-to-left inclusion,
fix $o \in \outgoing{v}$ and let $\tau \in \solproj{o}{\tau'}$. By
definition, its proof tree $\prooftree{\circuit}{\tau}$ contains $o$, thus
it also contains the vertex $v$. Now recall that $\projt{\tau}{\var{C_u}} =
\tau' \in \solcircuit{u}$. Thus, by definition of proof trees, $u$ is also
in $\prooftree{\circuit}{\tau}$. In other words, $\tau \in
\solproj{e}{\tau'}$. Using this equality, we have:
\begin{align*}
\sum_{\tau \in \solproj{e}{\tau'}} \om(\tau) & = \sum_{o \in \outgoing{v}} \sum_{\tau \in \solproj{o}{\tau'}} \om(\tau)\\
&= \sum_{o \in \outgoing{v}} \om[o](\tau'). \label{eq:test}
\end{align*}
Since, by induction, we have that for every $o \in \outgoing{v}$,
$\om[o](\tau')=\sum_{\tau \in \solproj{o}{\tau'}} \om(\tau)$.
Assume first that $\sum_{o \in \outgoing{v}} W(o) = 0$. In this case, by
definition, for every $o$, $\om[o](\tau') = 0$. Since $W$ is sound however,
we also have $W(e) = 0$, which implies by Lemma~\ref{lem:WToOmUpward}, that
$\om[e](\tau')=0$ as well. In this case, $\sum_{\tau \in \solproj{e}{\tau'}}
\om(\tau) = 0 = \om[e](\tau')$ which is the induction hypothesis.
Now assume that $\sum_{o \in \outgoing{v}} W(o) \neq 0$. We can thus apply the
definition of $\om[o](\tau') = {W(o) \over W(e)+W(e')} \om[e](\tau')$ in the
last sum. It gives
\begin{align*}
\sum_{o \in \outgoing{v}} \om[o](\tau') &= \sum_{o \in \outgoing{v}}{W(o) \over W(e)+W(e')} \om[e](\tau') \\
& = \om[e](\tau') {1\over W(e)+W(e')}\sum_{o \in \outgoing{v}}{W(o)} \\
& = \om[e](\tau')
\end{align*}
where the last equality follows from the fact that $\W$ is sound and thus
the ratio is $1$.
\textbf{Case 2}: $v$ is a $\andsym$-gate{}. Similarly as before, we have:
\[\solproj{e}{\tau'} = \biguplus_{\tau'' \in \solcircuit{u'}}\biguplus_{o \in \outgoing{v}} \solproj{o}{\tau'
\times \tau''}.\]
For left-to-right inclusion, let $\tau \in \solproj{e}{\tau'}$. By
definition, its proof tree $\prooftree{\circuit}{\tau}$ contains $e$. Since
$\prooftree{\circuit}{\tau}$ is connected by
Proposition~\ref{prop:prooftreeUnique}, $\prooftree{\circuit}{\tau}$ has to
contain one edge $o$ of $\outgoing{v}$. Thus, $\tau \in \solproj{o}{\tau'
\times \projt{\tau}{\var{C_{u'}}}}$.
The disjointness of the right-side union is a direct consequence of
Proposition~\ref{prop:outgoingDisjoint}. For the right-to-left inclusion,
fix $o \in \outgoing{v}$ and $\tau'' \in \solcircuit{u'}$. Let $\tau \in
\solproj{o}{\tau' \times \tau''}$. By definition, its proof tree
$\prooftree{\circuit}{\tau}$ contains $o$, thus it also contains the vertex
$v$ and by definition of proof trees, $u$ is also in
$\prooftree{\circuit}{\tau}$. And since $\projt{\tau}{\var{C_u}} = \tau'$,
$\tau \in \solproj{e}{\tau'}$. Using this equality, we have:
\begin{align*}
\sum_{\tau \in \solproj{e}{\tau'}} \om(\tau) & = \sum_{o \in \outgoing{v}} \sum_{\tau'' \in \solcircuit{u'}} \sum_{\tau \in \solproj{o}{\tau' \times \tau''}} \om(\tau)\\
&= \sum_{o \in \outgoing{v}} \sum_{\tau'' \in \solcircuit{u'}} \om[o](\tau' \times \tau'').
\end{align*}
Since, by induction, we have that for every $o \in \outgoing{v}$,
$\om[o](\tau' \times \tau'')=\sum_{\tau \in \solproj{o}{\tau' \times \tau''}} \om(\tau)$.
Assume first that $\sum_{o \in \outgoing{v}} W(o) = 0$. In this case, by
definition, for every $o$ and $\tau''$, $\om[o](\tau' \times \tau'') = 0$.
Since $W$ is sound however, we also have $W(e) = 0$, which implies by
Lemma~\ref{lem:WToOmUpward}, that $\om[e](\tau')=0$ as well. In this case,
$\sum_{\tau \in \solproj{e}{\tau'}} \om(\tau) = 0 = \om[e](\tau')$ wich is
the induction hypothesis.
Now assume that $\sum_{o \in \outgoing{v}} W(o) \neq 0$. We can thus apply
the definition of $\om[o](\tau' \times \tau'') = W(o) {\om[e](\tau') \over
W(e)}{\om[e'](\tau'') \over W(e')}$ in the last sum. It gives
\begin{align*}
& \sum_{o \in \outgoing{v}} \sum_{\tau'' \in \solcircuit{u'}} \om[o](\tau' \times \tau'') \\
& = \sum_{o \in \outgoing{v}} \sum_{\tau'' \in \solcircuit{u'}} W(o) {\om[e](\tau') \over
W(e)}{\om[e'](\tau'') \over W(e')} \\
& = {\om[e](\tau')\over W(e)} \big(\sum_{o \in \outgoing{v}} W(o)\big) {\sum_{\tau'' \in \solcircuit{u'}} \om[e'](\tau'') \over W(e')}
\end{align*}
Since $W$ is sound, $\sum_{o \in \outgoing{v}} W(o)=W(e)$. Moreover, by
Lemma~\ref{lem:WToOmUpward}, $\sum_{\tau'' \in \solcircuit{u'}}
\om[e'](\tau'')=W(e')$. Thus, the last sum equals to $\om[e](\tau')$ which
concludes the proof.
\end{proof}
Theorem~\ref{th:weightingCorrespondence}~\ref{it:Wtoom} is now an easy
consequence of Lemma~\ref{lem:WToOmUpward} and Lemma~\ref{lem:WToOmDownward}:
\begin{align*}
W(e) & = \sum_{\tau' \in \solcircuit{u}} \om[e](\tau') \proofnote{by Lemma~\ref{lem:WToOmUpward}}\\
& = \sum_{\tau' \in \solcircuit{u}} \sum_{\tau \in \solproj{e}{\tau'}} \om(\tau)\proofnote{by Lemma~\ref{lem:WToOmDownward}}\\
& = \sum_{\tau \in \soledge{e}} \om(\tau) \proofnote{since $\soledge{e} = \biguplus_{\tau' \in
\solcircuit{u}} \solproj{e}{\tau'}$}.
\end{align*}
Indeed, $\soledge{e} = \biguplus_{\tau' \in \solcircuit{u}} \solproj{e}{\tau'}$.
For the left-to-right inclusion, if $\tau \in \soledge{e}$ then by definition,
$\tau' = \projt{\tau}{\var{C_u}} \in \solcircuit{u}$ and thus $\tau \in
\solproj{e}{\tau'}$. The other inclusion follows by definition since
$\solproj{e}{\tau'} \subseteq \soledge{e}$ for every $\tau' \in \solcircuit{u}$.
\subsection{Construction of the smaller linear program}
\label{sec:smalllp}
We start by presenting the construction of the new linear program of
Theorem~\ref{th:rewritecaslp}. We fix $L$ a {CAS-LP} with $m$ constraints and
$C$ a \ddcircuit, both on attributes $X$ and domain $D$. We construct a linear
program $L'$ having the same optimal value as $L(\solcircuit{})$. The variables
of $L'$ are the edges of $\circuit$. $L'$ has a first set of constraints that we
call the \emph{soundness constraints} that are the following. For every edge $e$
of $\circuit$, we have a constraint $e \geq 0$ and for every gate $u$ of $C$,
\begin{itemize}
\item if $u$ is a $\orsym$-gate{} that is not the output of the circuit then we have
the constraint : $\sum_{i \in \ingoing{u}} i = \sum_{o \in \outgoing{u}} o$,
\item if $u$ is a $\andsym$-gate{} then let $i_1, \dots, i_k$ be the ingoing edges of
$u$ in an arbitrary order. We have the constraint $i_p = i_{p+1}$ for $1 \leq
p < k$. If $u$ is not the output of the circuit, we also have the constraint
$i_1 = \sum_{o \in \outgoing{u}} o$.
\end{itemize}
Observe that there are at most $3|C|$ soundness constraints in $L'$. Now, we add
a constraint $c'$ for each constraint $c$ of $L$ that is obtained as follows: we
replace every occurrence of $S_{x,d}$ in $c$ by $\sum_{e \in \outgoing{x/d}} e$
for every $x \in X$ and $d \in D$ where $\outgoing{x/d}$ denotes the set of
edges of $C$ going out of an input labeled by $x/d$. The objective function of
$L'$ is obtained by applying the same replacement of $S_{x,d}$ variables in the
objective function of $L$.
The number of variables of $L'$ is $|C|$ and that it has $m+3|C|$ constraints so
it has the required size. It is also clear that one can easily construct $L'$
from $L$ and $C$ in polynomial time: it is indeed sufficient to visit each gate
of the circuit to generate the soundness constraints and then to replace each
occurrences of $S_{x,d}$ by the appropriate sum.
It turns out that the optimal values of $L'$ and of $L(\solcircuit{})$ coincide.
To prove this however, we have to understand the structure of {\ddcircuit}
better and the rest of the paper is dedicated to prove the correction of our
construction.
\subsection{Correctness of the construction}
A solution of $L(\solcircuit{})$ can be seen as a weighting of the tuples $\tau
\in \solcircuit{}$. Similarly, a solution of $L'$ can be seen as a weighting of
the edges of $\circuit$. We will show strong connections between both weightings
that will allow us to prove that $L(\solcircuit{})$ and $L'$ have the same optimal
value.
Let $\circuit$ be a \ddcircuit. A \emph{tuple-weighting} $\om$ of $\circuit$ is
defined as a variable assignment of $\solcircuit{}$, e.g. $\om \in
\tweightings$. An \emph{edge-weighting} $\W$ of $\circuit$ is similarly defined
as a variable assignment of $\edges{\circuit}$, e.g. $\W \in \eweightings$.
Throughout the paper, we will always use the symbol $\om$ for tuple-weightings
and $\W$ for edge-weightings.
\begin{definition}
An edge-weighting $\W$ is \emph{sound} if for every gate $u$ of $\circuit$ we have:
\begin{itemize}
\item if $u$ is a $\orsym$-gate{} that is not the output of the circuit then
$\sum_{i \in \ingoing{u}} W(i) = \sum_{o \in \outgoing{u}} W(o)$,
\item if $u$ is a $\andsym$-gate{} then $\forall i,i' \in \ingoing{u}$:
$\val{\W}{i} = \val{\W}{i'}$. If $u$ is not the output of the circuit,
we also have $W(i) = \sum_{o \in \outgoing{u}} W(o)$.
\end{itemize}
\end{definition}
Given a tuple-weighting $\om$ and a tuple-weighting $\W$ we say that $\W$ is
compatible with $\om$ iff $\forall x \in X, \forall d \in \dom
\xdtuplesum{x}{d}{\solcircuit{}} = \sum\limits_{e \in \outgoing{x/d}} \val{\W}{e}$.
The correctness of our construction directly follows from the next theorem whose
proof is delayed to Section~\ref{sec:proofs}, connecting tuple-weightings with
sound edge-weightings.
\begin{theorem}
\label{th:weightingCompatibility}
Given a {\ddcircuit} $\circuit$.
\begin{enumerate}[(a)]
\item For every tuple-weighting $\om$ of $\circuit$, there exists a sound
edge-weighting $\W$ such that $\W$ is compatible with $\om$.
\item Given a sound edge-weighting $\W$ of $\circuit$, there exists a
tuple-weighting $\om$ of $\circuit$ such that $W$ is compatible with $\om$.
\end{enumerate}
\end{theorem}
We now explain how one can use Theorem~\ref{th:weightingCompatibility} to prove
the correctness of our transformation.
Let $\om: \solcircuit{} \rightarrow \mathbb{R}_+$ be a tuple-weighting that is a
solution of $L(\solcircuit{})$. Let $\W : \edges{\circuit} \rightarrow \mathbb{R}_+$ be
the sound edge-weighting compatible with $\om$ that is given by
Theorem~\ref{th:weightingCompatibility}. We claim that $W$ is a solution of
$L'$. First, $W$ satisfies all the soundness constraints of $L'$ since $W$ is
sound. Moreover, since $W$ is compatible with $\tau$, $\forall x \in X, \forall
d \in \dom \xdtuplesum{x}{d}{\solcircuit{}} = \sum\limits_{e \in \outgoing{x/d}}
\val{\W}{e}$. But this is the value of $\om(S_{x,d})$, which means that $W$ is a
solution of $L'$. It tells us that the optimal value of $L'$ is bigger than the
optimal value of $L$.
Now let $\W : \edges{\circuit} \rightarrow \mathbb{R}_+$ be an edge-weighting of
$\circuit$ that is a solution of $L'$ and let $\om$ be a tuple-weighting
compatible with $W$. We show that $\om$ is a solution of $L(\solcircuit{})$.
Indeed, by definition, $L'$ is obtained by replacing $S_{x,d}$ with
$\sum\limits_{e \in \outgoing{x/d}} e$. Since $\om$ is compatible with $\W$, we
also have $\forall x \in X, \forall d \in \dom \xdtuplesum{x}{d}{\solcircuit{}}
= \sum\limits_{e \in \outgoing{x/d}} \val{\W}{e}$. But this is $\om(S_{x,d})$ by
definition, which means that $\om$ is a solution of $L(\solcircuit{})$. Thus the
optimal value of $L(\solcircuit{})$ is bigger than the optimal value of $L'$.
Hence, $L(\solcircuit{})$ and $L'$ have the same optimal value.
The rest of this paper is dedicated to the proof of
Theorem~\ref{th:weightingCompatibility}.
| {'timestamp': '2019-07-22T02:10:34', 'yymm': '1901', 'arxiv_id': '1901.03633', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03633'} | arxiv |
\section{Introduction}
Portrait segmentation has been widely applied in many practical scenes such as mobile phone photography, video surveillance and
image preprocess of face identification. Compared with other semantic segmentation tasks, portrait segmentation has higher requirement for
both accuracy and speed. However, this task has not been well studied in previous works. PFCN+ \cite{shen2016automatic} uses prior information
to enhance segmentation performance, BSN \cite{du2017boundary} designs a boundary kernel to emphasize the importance of boundary area. These methods
get high mean IoU on PFCN+ \cite{shen2016automatic} dataset, but they are extremely time consuming because they use large backbones. What's more,
their segmentation results lack detail information such as threads of hairs and clothe boundary details. Although automatic image matting models such as \cite{shen2016deep}
\cite{zhu2017fast} are able to obtain fine details, but preparing high-quality alpha matte is much more complicated and time-consuming than annotate segmentation
targets. In this paper, we propose an novel method that can generate high-accuracy portrait segmentation result with real-time speed.
\par In recent years, many deep learning based semantic segmentation models like\cite{chen2018deeplab}\cite{zhao2017pyramid}\cite{zhang2018exfuse}\cite{yu2018learning} have reached state-of-the-art performance. However, when it comes to portrait segmentation, none of these works produces fine boundary. The problem of losing fine boundary details is mainly caused by two reasons.
\par Firstly, performance of deep learning based method is quite
dependent on the quality of training data. While segmentation targets are usually annotated manually by polygons or produced by KNN-matting \cite{chen2013knn}. Therefore, it is almost impossible to annotate fine details such as hairs. Supervise.ly dataset is currently the largest and finest human segmentation dataset, some examples are presented as Fig. \ref{fig_sup}. It shows that although Supervise.ly is the finest dataset, annotations are still coarse on boundary areas. Coarse annotation causes inaccurate supervision, which makes it hard for neural network to learn a accurate feature representation.
\par Secondly, Although previous portrait segmentation methods\cite{shen2016automatic}\cite{du2017boundary} have proposed some useful pre-process methods or loss functions, they still use traditional semantic segmentation models like FCN\cite{long2015fully}, Deeplab\cite{chen2018deeplab} and PSPnet\cite{zhao2017pyramid} as their baseline. The problem is that the output size of those models is usually 1/4 or 1/8 of input image size, thus it is impossible to preserve as much detail information as input image. U-Net\cite{ronneberger2015u} fuses more low-level information but it is oriented for small sized medical images, it is hard to train on high-resolution portrait images on account of its huge parameter number.
Although traditional semantic segmentation models achieves state-of-the-art performance on Pascal VOC\cite{everingham2010pascal}, COCO Stuff\cite{caesar2016coco} and CitySpace\cite{cordts2016cityscapes} datasets, they are not suitable for portrait segmentation. Traditional segmentation task aims at handling issues of intra-class consistency and the inter-class distinction among various object classes in complicated scenes. While portrait segmentation is a two-class task which requires fine details and fast speed. Hence,
portrait segmentation should be considered as an independent task and some novel strategies should be proposed.
\begin{figure}[htbp]
\centering
\subfigure{
\begin{minipage}[t]{0.33\linewidth}
\centering
\includegraphics[width=1in]{imgs/sup_anno/2.png}
\end{minipage}%
}%
\subfigure{
\begin{minipage}[t]{0.33\linewidth}
\centering
\includegraphics[width=1in]{imgs/sup_anno/3.png}
\end{minipage}
}%
\subfigure{
\begin{minipage}[t]{0.33\linewidth}
\centering
\includegraphics[width=1in]{imgs/sup_anno/4.png}
\end{minipage}
}%
\centering
\caption{ Polygon Annotations of Supervise.ly }
\label{fig_sup}
\end{figure}
\begin{figure}[htbp]
\centering
\subfigure[Image]{
\begin{minipage}[t]{0.33\linewidth}
\centering
\includegraphics[width=1in]{imgs/img_r/00087.png}
\includegraphics[width=1in]{imgs/img_r/00215.png}
\includegraphics[width=1in]{imgs/img_r/00243.png}
\end{minipage}%
}%
\subfigure[Our Result]{
\begin{minipage}[t]{0.33\linewidth}
\centering
\includegraphics[width=1in]{imgs/sub/00087.png}
\includegraphics[width=1in]{imgs/sub/00215.png}
\includegraphics[width=1in]{imgs/sub/00243.png}
\end{minipage}
}%
\subfigure[Annotation(KNN)]{
\begin{minipage}[t]{0.33\linewidth}
\centering
\includegraphics[width=1in]{imgs/gt_r/00087.png}
\includegraphics[width=1in]{imgs/gt_r/00215.png}
\includegraphics[width=1in]{imgs/gt_r/00243.png}
\end{minipage}%
}%
\centering
\caption{ Details of our outputs}
\label{fig_finer}
\end{figure}
\par In this paper, we propose a specialized portrait segmentation solution by designing BANet. BANet is an efficient network with only 0.62MB parameters,
it achieves 43 fps on $512 \times 512$ images with high-quality results which are finer than annotations. Some examples are presented
in Fig\ref{fig_finer} . Our experiments show that BANet generates better results than previous portrait segmentation models and real-time segmentation models
on PFCN+ dataset.
\section{Related Work}
\noindent \textbf{Portrait Segmentation Networks}: PFCN+\cite{shen2016automatic} provides a benchmark for the task of
portrait segmentation. It calculates firstly an average mask from training dataset, then aligns the average mask
to each input images to provide prior information. However, the process of alignment requires facial feature points.
So, this method needs an additional landmark detection model, which makes the whole process slow and redundant. BSN\cite{du2017boundary}
proposes a boundary-sensitive kernel to take semantic boundary as a third class and it applies many training tricks such
as multi-scale training and multi-task learning. However, it still lacks fine details and the inference speed is very slow.\\
\noindent \textbf{Image Matting Networks}: Image matting has been applied for portrait image process for a long time. Traditional
matting algorithms \cite{chuang2001bayesian} \cite{levin2008closed} \cite{chen2013knn} \cite{sun2004poisson} require a user defined trimap which
limits their applications in automatic image process. Some works \cite{shen2016deep} \cite{chen2018semantic} have proposed to generate trimap by using deep leaning models,
but they still take trimap generation and detail refinement as two separated stages. In matting tasks, trimap helps to locate regions of interest for alpha-matte.
Inspired by the function of trimap in matting tasks, we propose a boundary attention
mechanism to help our BANet focus on boundary areas. Different from previous matting models, we use a two-branch architecture. Our attention map is generated by high-level
semantic branch, and it is used to guide mining low-level features.
DIM\cite{xu2017deep} designs a compositional loss which has been proved to be effective in many
matting tasks, but it is time-consuming to prepare large amount of fore-ground, back-ground images and high-quality alpha matte. \cite{Levinshtein2017RealtimeDH} presents a
gradient-coinstency loss which is able to correct gradient direction on prediction edges, but it is not able to extract richer details. Motivated by that, we propose refine loss to obtain richer detail features on boundary area by using image gradient.\\
\noindent \textbf{High Speed Segmentation Networks}: ENet \cite{paszke2016enet} is the first semantic segmentation network that achieves real-time performance. It adopts
ResNet \cite{he2016deep} bottleneck structure and reduces channel number in order of acceleration, but ENet loses too much accuracy as a tradeoff. ICNet\cite{zhao2017icnet} proposes a multi-stream architecture. Three
streams extract features from images of different resolution, and then those features are fused by a cascade feature fusion unit. BiSeNet \cite{yu2018bisenet} uses a two-stream framework to extract context information and spatial information independently. Then it uses a feature fusion module to combine features of two streams. Inspired by their ideas of separate semantic branch and spatial branch, we design a two-stream architecture. Different from previous works, our two branches are not completely separated. In our framework, low-level branch is guided by high-level branch via a boundary attention map.\\
\noindent \textbf{Attention Mechanism}: Attention mechanism makes high-level information to guide low-level feature extraction. SEnet \cite{hu2017squeeze} applies channel
attention on image recognition tasks and achieves the state-of-the-art. ExFuse \cite{zhang2018exfuse} proposes a Semantic Embedding mechanism to use high-level feature to guide
low-level feature. DFN \cite{yu2018learning} learns a global feature as attention to revise the process of feature extraction. In PFCN+ \cite{shen2016automatic}, shape channel can be viewed as a kind of spatial-wise attention, aligned mean mask forces model to focus on portrait area.
\begin{figure*}[htbp]
\centering
\includegraphics[scale=0.38]{./imgs/pipeline.png}
\caption{Pipeline of Boundary-Aware Network has three parts. Semantic branch extracts high-level semantic features and produces boundary attention map.
Boundary feature mining branch extracts low-level details. Fusion Part fuses high level features and low-level features by a Feature Fusion Module(c).
In semantic branch, ResNet bottleneck structure(b) is used as basic convolutional block.
}
\label{fig_framework}
\end{figure*}
\section{Our Method}
\par \noindent In the task of portrait segmentation, no-boundary area needs a large receptive field to make prediction with global context information, while
boundary area needs small receptive field to focus on local feature contrast. Hence these two areas need to be treated independently. In this paper, we propose
a boundary attention mechanism and a weighted loss function to deal with boundary area and no-boundary area separately.
\par Pipeline of our method is demonstrated as Fig.\ref{fig_framework}. Firstly, color image passes through semantic branch to get
1/4 size high-level semantic features. Secondly, the output of semantic branch is projected into a one-channel feature map and upsampled to full size
as boundary attention map. This boundary attention map is supervised by boundary attention loss (BA loss). Then, in boundary feature mining branch, we concatenate input
image with the boundary attention map in order to mining low-level features more goal-directed. Lastly, the fusion part fuses high-level semantic features and
low-level details to produce fine segmentation results. The final output is supervised by two losses, segmentation loss controls the whole process of
portrait segmentation and refine loss refines boundary details.
\subsection{ Network Architecture }
\par \noindent \textbf{Semantic Branch}: The objective of semantic
branch is getting a reliable feature representation. This feature representation is dominated by high-level semantic information. At same time, we hope it can contain some spatial information. In the task of portrait segmentation, portrait often occupies a
large part of image. Hence, large receptive field is required. Semantic branch is a symmetrical fully convolutional structure that follows FCN-4s structure, we utilize multiple downsampling layers to enlarge the receptive field step by step. As is shown in Fig.\ref{fig_framework},
input image passes through a sequence of convolution layers to get a high-level 1/32 feature map.
Then, bilinear interpolation is applied to upsample small scale feature maps. We combine features of 1/16,1/8 and 1/4 scale step
by step by elementwise addition.
In order to save computation, we use ResNet bottleneck structure as our basic convolutional block, and we fix the max number of channel
as 64. The output of semantic branch is a 1/4 size feature map. This feature map has a robust semantic representation because it has large receptive field and it involves
4s level spatial information. More detail information is restorated in Boundary Feature Mining Branch.\\
\par \noindent \textbf{Boundary Feature Mining Branch}: The output of semantic branch is projected to one channel by $1\times1$ conv filter, then it is interpolated to
full size as boundary attention map. BA loss guides this attention map to locate boundary area. Target of boundary area can be generated without manual annotation. As given
in Fig.\ref{fig_BA}.
Firstly,
we use canny edge detector \cite{canny1986computational} to extract semantic edges on portrait annotation. Considering portrait area varies a lot in different images, it is not
reasonable to dilate each edge to the same width. So, we dilate the edge of different image with different kernel size as follows:
\begin{equation}
K_{dilation} = \frac{ S_{portrait}}{S_{portrait} + S_{background}} * W \label{eq:ratio}
\end{equation}
where W is an empirical value representing the canonical width boundary. In our experiment, we set W = 50.
\par BA loss is a binary cross-entropy loss, but we don't want our boundary attention map to be binarized because spatial-wise unsmoothness may cause numerical
unstability.
Hence, we soften the output of boundary attention map with a Sigmoid function:
\begin{equation}
S(x) = \frac{1}{1 + e^{-\frac{x}{T}}} \label{eq:sigmoid}
\end{equation}
where T is a temperature which produces a softer probability distribution.
\par Lastly, input image and attention map are concatenated together as a 4-channel image. This 4-channel image passes through a convolution layer
to extract detail information. Different from other multi-stream network architecture that handles each stream independently, our low-level features are guided by high-level features.\\
\par \noindent \textbf{Fusion Part}: Features of semantic branch and boundary feature mining branch are different in level of feature representation. Therefore, we
can't simplely combine them by element-wise addition nor channel-wise concatenation. In Fusion Part, we follow BiSeNet\cite{yu2018bisenet}. Given two features of different
levels, we first concatenate them together then we pass them into a sequence of $3\times3$ convolution, batch normalization and ReLU function. Next, we ulitize global pooling
to calculate a weight vector. This vetor helps feature re-weight and feature selection. Fig.\ref{fig_framework} (b) shows details of Feature Fusion Module.
\begin{figure}[htbp]
\centering
\subfigure[Portrait Annotation]{
\begin{minipage}[t]{0.33\linewidth}
\centering
\includegraphics[width=1in]{imgs/gt_r/00049.png}
\includegraphics[width=1in]{imgs/gt_r/00047.png}
\end{minipage}%
}%
\subfigure[Boundary Target]{
\begin{minipage}[t]{0.33\linewidth}
\centering
\includegraphics[width=1in]{imgs/trimap_r/00049.png}
\includegraphics[width=1in]{imgs/trimap_r/00047.png}
\end{minipage}%
}%
\subfigure[Boundary Attention]{
\begin{minipage}[t]{0.33\linewidth}
\centering
\includegraphics[width=1in]{imgs/trimap/00049.png}
\includegraphics[width=1in]{imgs/trimap/00047.png}
\end{minipage}
}%
\centering
\caption{ Boundary Attention }
\label{fig_BA}
\end{figure}
\subsection{ Loss Function }
\noindent Our loss function contains three parts as given in Equation \ref{eq:loss}. Where $ L_{seg}$ guides our segmentation
results, $ L_{bound}$ supervises boundary attention map, and $ L_{refine}$ refines boundary details.\\
\noindent \textbf{Segmentation Loss}: Considering the output of portrait segmentation is a one-channel confidence map, binary cross entropy loss is applied as Equation \ref{eq:seg loss}.
where $y_p^s $ represents prediction result of segmentation and $y_t^s$ stands for segmentation target.
\begin{equation}
L_{seg} = -[y_{t}^s \cdot log(y_{p}^s ) + (1- y_{t}^s) \cdot log(1-y_{p}^s) )] \label{eq:seg loss}
\end{equation}
\noindent \textbf{Boundary Attention Loss}: Loss function is the same for the boundary attention map, where $y_p^b $ means prediction of boundary area.
Boundary loss helps our network locate boundary area. At same time, it can be viewed as an intermediate supervision. Extraction of semantic boundary forces
the network to learn a feature with strong inter-class distinction ability.
\begin{equation}
L_{bound} = -[y_{t}^b \cdot log(y_{p}^b ) + (1- y_{t}^b) \cdot log(1-y_{p}^b ) )] \label{eq:bound loss}
\end{equation}
\noindent \textbf{Refine Loss} : Refine loss is composed by two parts: $L_{cos}$ and $L_{mag}$. The first part $L_{cos}$ uses cosine distance to
supervise the gradient direction of segmentation confidence map, $L_{mag}$ brings a constrain on gradient
magnitude to inforce the network produce clear and sharp results.
\par Let $m_{img}$ be the magnitude of gradient of an image, normalized vector $\overrightarrow \nu_{img} = ( g_{img}^x, g_{img}^y)$ denotes
the direction of gradient of this image. The output of BAnet is a one-channel confidence map of portrait/background dense
classification. Accordingly, we use $m_{pred}$ and $\overrightarrow \nu_{pred}$ to represent magnitude and direction of gradient for the
output confidence map.
\par Inspired by \cite{Levinshtein2017RealtimeDH}, a loss measuring the consistency between image gradient and network output
is introduced. Our $L_{cos}$ can be formulated as Equation \ref{eq:cos loss}.
\begin{equation}
\begin{aligned}
L_{cos} &= (1 - | \overrightarrow \nu_{img} \cdot \overrightarrow \nu_{pred} |) \cdot m_{pred} \\
& = (1- |g_{img}^x \cdot g_{pred}^x + g_{img}^y \cdot g_{pred}^y |) \cdot m_{pred} \label{eq:cos loss}
\end{aligned}
\end{equation}
\par While $L_{cos}$ can only deal with cases with simple background. When background is confusing, $L_{cos}$ tends to cause
blurry prediction boundaries. Different from \cite{Levinshtein2017RealtimeDH}, we add a constrain for gradient magnitude as
Equation \ref{eq:mag loss} to force our network to make clear and sharp decision in boundary area. where $\lambda$
is a factor that balances distributional differences between image and output confidence map. In our experiment, $\lambda = 1.5$.
$L_{mag}$ enables BANet to amplify local contrast when the color of foreground is very similar to background.
\begin{equation}{}
L_{mag} = max( \lambda m_{img} - m_{pred}, 0 ) \label{eq:mag loss}
\end{equation}
\par While boundary areas need rich low-level features to obtain detail information, areas far from boundaries
are mainly guided by high-level semantic features, too much low-level features will disturb the segmentation result.
Therefore, we should combine low-level features selectively. Matting models \cite{xu2017deep} \cite{chen2018semantic}
treat boundary areas and no-boundary areas separately in different stages and then compose two prediction results. Instead of that,
BANet has an end-to-end architecture, we use a weighted loss function to distinct boundary area and no-boundary area. As shown in Equation \ref{eq: refine loss }
refine loss is only applied in boundary area, where $\mathbb M_{bound}$
is a mask which equals 1 only in boundary area. We set $\gamma_1 = \gamma_2 = 0.5 $ in our experiment.
\begin{equation}
L_{refine} = \left(\gamma_1 L_{cos} + \gamma_2 L_{mag}\right) \cdot \mathbb M_{bound} \label{eq: refine loss }
\end{equation}
\noindent \textbf{Total Loss} : Total loss is formulated as a weighted sum of segmentation loss, boundary attention loss and
refine loss. Experiments shows $\alpha = 0.6, \beta = 0.3, \gamma = 0.1 $ makes good performance.
\begin{equation}
L = \alpha L_{seg} + \beta L_{bound} + \gamma L_{refine} \label{eq:loss}
\end{equation}
\subsection{Gradient Calculation}
$L_{refine}$ needs to calculate image gradient, we design a Gradient Calculation Layer(GCL) to compute image gradient on GPU.
Sobel operator \cite{sobel1972camera} is used as convolutional filter in GCL.
\begin{equation}
G_x=
\left[ \begin{array}{ccc}
+1 & 0 & -1\\
+2 & 0 & -2\\
+1 & 0 & -1
\end{array}
\right ] * I,
G_y=
\left[ \begin{array}{ccc}
+1 & +2 & +1\\
0 & 0 & 0\\
-1 & -2 & -1
\end{array}
\right ] * I
\end{equation}
where * denotes convolution operation. Gradient magnitude M and gradient vector $\overrightarrow{\nu}$ are computed as follows:
\begin{equation}
M = \sqrt{G_x^2 + G_y^2 }
\end{equation}
\begin{equation}
\overrightarrow{\nu} = \left( \frac{G_x}{M} \frac{G_y}{M} \right)
\end{equation}
Considering original image and prediction result have different distribution, before passed through GCL, input is normalized as:
\begin{equation}
I_{norm} = \frac{I - I_{min}}{ I_{max} - I_{min}}
\end{equation}
Gradient of original image and output confidence map is presented in Fig.\ref{fig_gadient}.
\begin{figure}[htbp]
\centering
\subfigure[Image]{
\begin{minipage}[t]{0.25\linewidth}
\centering
\includegraphics[width=0.8in]{imgs/gradient/00275.png}
\end{minipage}%
}%
\subfigure[$M_{img}$]{
\begin{minipage}[t]{0.25\linewidth}
\centering
\includegraphics[width=0.8in]{imgs/gradient/Boundary.png}
\end{minipage}%
}%
\subfigure[Prediction]{
\begin{minipage}[t]{0.25\linewidth}
\centering
\includegraphics[width=0.8in]{imgs/gradient/00275_pre.png}
\end{minipage}
}%
\subfigure[$M_{pred}$]{
\begin{minipage}[t]{0.25\linewidth}
\centering
\includegraphics[width=0.8in]{imgs/gradient/Boundary_pre.png}
\end{minipage}
}%
\centering
\caption{ Gradient Calculation }
\label{fig_gadient}
\end{figure}
\section{Experiment Details}
\par \noindent \textbf{Dataset:} PFCN+ \cite{shen2016automatic} dataset contains 1700 KNN annotated portrait images. 1400 images for training
and 300 images for test. Supervise.ly contains more than 4000 polygon annotated human segmentation images, but those images are blended by portrait,
full-body-shot and multi-person photo. We utilize Supervise.ly dataset to pretrain our model in order to get a better initialization, and then we fine-tune
our model on PFCN+ training set, we use PFCN+ test set for evaluation.\\
\par \noindent \textbf{Data Augmentation:} Online augmentation is implemented during the process of loading data, so that
every training sample is unique. Random rotation in range of [-45\ensuremath{^{\circ}} ,45\ensuremath{^{\circ}} ], random flip, random lightness of range
[0.7,1.3] are used in order to improve our network’s ability of generalization.\\
\par \noindent \textbf{Training Strategy:} Considering that $L_{refine}$ is only applied on boundary area, it needs a proper boundary attention map to
help locating boundary. Therefore, we firstly pretrain BANet without $L_{refine}$ on Supervise.ly dataset for 40000 iterations to get a good boundary initialization. Then we fine-tune BANet on PFCN+ dataset with $L_{refine}$ for another 40000 iterations.
\par Supervise.ly dataset and PFCN+ dataset have different data distribution. What's more, we add $L_{refine}$ during the process of fine-tuning. Hence, it is not
appropriate to give a big learning rate at the beginning of fine-tuning. We utilize warming-up learning rate which gives the network a suitable weight initialization before applying big learning rate, thus the network can converge to a better point. Curves of warming-up learning rate can be viewed in Fig.\ref{fig_warmup}
\par Stochastic gradient descent (SGD) optimizer is used to train our model. L2-regularization is applied to all
learnable parameters in order to prevent overfitting. Other hyper parameters for training follows Table.\ref{tabel_hyper}. \\
\begin{table}
\centering
\begin{threeparttable}
\begin{tabular}{|c|c|}
\hline
Hyper Parameter & Value \\
\hline\hline
Batch Size & 16 \\
Weight Decay & $ 10^{-4}$ \\
Momentum & 0.9 \\
Max Learning Rate & 0.1 \\
Training Iteration & 4 000 \\
\hline
\end{tabular}
\end{threeparttable}
\caption{ Hyper Parameter
}
\label{tabel_hyper}
\end{table}
\begin{figure}[htbp]
\centering
\includegraphics[scale=0.5]{./imgs/lr.png}
\caption{Warming up learning rate
}
\label{fig_warmup}
\end{figure}
\par \noindent \textbf{Comparison Experiments:} Series of comparison experiments are implemented on some real-time
segmentation networks and portrait segmentation networks. For control variates, the same training strategy and
hyper parameters are used for all the models. Firstly, these models are pretrained on Supervise.ly dataset, then they
get fine-tuned on PFCN+ dataset. Experiment result is demonstrated in Table.\ref{tabel_result}. Mean IoU is measured as criterion of segmentation accuracy.
Inference speed is measured on a single GTX 1080 Ti with input size $512 \times 512 $. Parameter number evaluates the feasibility of implementing these models
on edge devices such as mobile phone.
\par In order to prove our BANet performs better than other portrait segmentation networks with the same order of parameter number, we have also implemented a larger version of BANet with 512 channels, called BANet-512. BANet-64 means the version of BANet with 64 channels.\\
\par \noindent \textbf{Result Analysis:} As shown in Fig.\ref{fig_comparison}. Confidence maps of BiSeNet and EDAnet have vague boundaries, they lack low-level information because they are upsampled
directly by bilinear interpolation. PFCN+ has a better semantic representation with the help of prior information provided by shape channel. U-Net get a better boundary
because it combines much low-level information. However, U-Net and PFCN+ are still not able to extract fine details like hairs. With the help of boundary attention map
and refine loss, BANet-64 is able to produce high-quality results with fine details. In some cases, BANet produces segmentation results which are finer than KNN-annotations.
Considering mean IoU measures the similarity between output and annotation, even though PFCN+ and U-Net get a higher mean IoU than BANet-64, we can't conclude BANet-64 is less
accurate than them. While with same order of parameter number, BANet-512 surpasses the other models.
\par What's more, PFCN+ has more than 130 MB parameters while our BANet-64 has only 0.62 MB parameters, which makes it possible to be implemented on mobile phone. As for inference speed, BANet-64 achieves 43 FPS on $512 \times 512$ images and 115 FPS on $256 \times 256$ images, so it can be applied in real-time image processing.
\begin{table}
\centering
\begin{threeparttable}
\begin{tabular}{|l|c|c|c|}
\hline
model & mIoU (\%) & speed(fps) & parameter(MB) \\
\hline\hline
ENet\cite{paszke2016enet} & 88.24 & 46 & 0.35 \\
BiSeNet \cite{yu2018bisenet} & 93.91 & 59 & 27.01 \\
EDAnet\cite{lo2018efficient} & 94.90 & 71 & 0.68 \\
U-Net\cite{ronneberger2015u} & 95.88 & 37 & 13.40 \\
PFCN+\cite{shen2016automatic} & 95.92 & 8 & 134.27 \\
\hline
BANet-64 &95.80& 43 & 0.62 \\
BANet-512 &96.13& 29 & 12.75 \\
\hline
\end{tabular}
\end{threeparttable}
\caption{Comparison results: All experiments are implemented on Pytorch\cite{paszke2017automatic} framework with input images of size
$512 \times 512$ . Inference speed is measured on a single GTX 1080 Ti.
}
\label{tabel_result}
\end{table}
\begin{figure*}[htbp]
\centering
\subfigure[Image]{
\begin{minipage}[t]{0.14\linewidth}
\centering
\includegraphics[width=\textwidth]{imgs/img_r/00003.png}
\includegraphics[width=\textwidth]{imgs/img_r/00052.png}
\includegraphics[width=\textwidth]{imgs/img_r/00274.png}
\includegraphics[width=\textwidth]{imgs/img_r/00293.png}
\includegraphics[width=\textwidth]{imgs/img_r/00261.png}
\includegraphics[width=\textwidth]{imgs/img_r/00249.png}
\end{minipage}%
}%
\subfigure[BiSeNet \cite{yu2018bisenet}]{
\begin{minipage}[t]{0.14\linewidth}
\centering
\includegraphics[width=\textwidth]{imgs/Bisenet/00003.png}
\includegraphics[width=\textwidth]{imgs/Bisenet/00052.png}
\includegraphics[width=\textwidth]{imgs/Bisenet/00274.png}
\includegraphics[width=\textwidth]{imgs/Bisenet/00293.png}
\includegraphics[width=\textwidth]{imgs/Bisenet/00261.png}
\includegraphics[width=\textwidth]{imgs/Bisenet/00249.png}
\end{minipage}%
}%
\subfigure[EDAnet \cite{lo2018efficient}]{
\begin{minipage}[t]{0.14\linewidth}
\centering
\includegraphics[width=\textwidth]{imgs/EDAnet/00003.png}
\includegraphics[width=\textwidth]{imgs/EDAnet/00052.png}
\includegraphics[width=\textwidth]{imgs/EDAnet/00274.png}
\includegraphics[width=\textwidth]{imgs/EDAnet/00293.png}
\includegraphics[width=\textwidth]{imgs/EDAnet/00261.png}
\includegraphics[width=\textwidth]{imgs/EDAnet/00249.png}
\end{minipage}%
}%
\subfigure[PFCN+ \cite{shen2016automatic}]{
\begin{minipage}[t]{0.14\linewidth}
\centering
\includegraphics[width=\textwidth]{imgs/PFCN/00003.png}
\includegraphics[width=\textwidth]{imgs/PFCN/00052.png}
\includegraphics[width=\textwidth]{imgs/PFCN/00274.png}
\includegraphics[width=\textwidth]{imgs/PFCN/00293.png}
\includegraphics[width=\textwidth]{imgs/PFCN/00261.png}
\includegraphics[width=\textwidth]{imgs/PFCN/00249.png}
\end{minipage}%
}%
\subfigure[U-Net \cite{ronneberger2015u}]{
\begin{minipage}[t]{0.14\linewidth}
\centering
\includegraphics[width=\textwidth]{imgs/Unet/00003.png}
\includegraphics[width=\textwidth]{imgs/Unet/00052.png}
\includegraphics[width=\textwidth]{imgs/Unet/00274.png}
\includegraphics[width=\textwidth]{imgs/Unet/00293.png}
\includegraphics[width=\textwidth]{imgs/Unet/00261.png}
\includegraphics[width=\textwidth]{imgs/Unet/00249.png}
\end{minipage}%
}%
\subfigure[BANet-64]{
\begin{minipage}[t]{0.14\linewidth}
\centering
\includegraphics[width=\textwidth]{imgs/ours_r/00003.png}
\includegraphics[width=\textwidth]{imgs/ours_r/00052.png}
\includegraphics[width=\textwidth]{imgs/ours_r/00274.png}
\includegraphics[width=\textwidth]{imgs/ours_r/00293.png}
\includegraphics[width=\textwidth]{imgs/BAnet_ms_matte/00261.png}
\includegraphics[width=\textwidth]{imgs/BAnet_ms_matte/00249.png}
\end{minipage}%
}%
\subfigure[Annotation(KNN)]{
\begin{minipage}[t]{0.14\linewidth}
\centering
\includegraphics[width=\textwidth]{imgs/gt_r/00003.png}
\includegraphics[width=\textwidth]{imgs/gt_r/00052.png}
\includegraphics[width=\textwidth]{imgs/gt_r/00274.png}
\includegraphics[width=\textwidth]{imgs/gt_r/00293.png}
\includegraphics[width=\textwidth]{imgs/gt_r/00261.png}
\includegraphics[width=\textwidth]{imgs/gt_r/00249.png}
\end{minipage}%
}%
\centering
\caption{ Comparison results. Traditional Real-time segmentation models like BiSeNet and EDAnet have a huge gap to our work in the task of portrait segmentation.
PFCN+ and U-Net have a higher mean IoU than our result but they have obviously coarser boundaries. Mean IoU of our result is limited by target quality.}
\label{fig_comparison}
\end{figure*}
\begin{figure}[htbp]
\centering
\subfigure[Image]{
\begin{minipage}[t]{0.25\linewidth}
\centering
\includegraphics[width=0.8in]{imgs/img_r/00282.png}
\includegraphics[width=0.8in]{imgs/img_r/00033.png}
\includegraphics[width=0.8in]{imgs/img_r/00245.png}
\end{minipage}%
}%
\subfigure[$Ours^1$]{
\begin{minipage}[t]{0.25\linewidth}
\centering
\includegraphics[width=0.8in]{imgs/BAnet_base_model/00282.png}{}
\includegraphics[width=0.8in]{imgs/BAnet_base_model/00033.png}
\includegraphics[width=0.8in] {imgs/BAnet_base_model/00245.png}
\end{minipage}%
}%
\subfigure[$Ours^2$]{
\begin{minipage}[t]{0.25\linewidth}
\centering
\includegraphics[width=0.8in]{imgs/BAnet_ms/00282.png}
\includegraphics[width=0.8in]{imgs/BAnet_ms/00033.png}
\includegraphics[width=0.8in]{imgs/BAnet_ms/00245.png}
\end{minipage}
}%
\subfigure[$Ours^3$]{
\begin{minipage}[t]{0.25\linewidth}
\centering
\includegraphics[width=0.8in]{imgs/ours_r/00282.png}
\includegraphics[width=0.8in]{imgs/ours_r/00033.png}
\includegraphics[width=0.8in]{imgs/ours_r/00245.png}
\end{minipage}
}%
\centering
\caption{ Ablation Study shows boundary attention map brings a better semantic prepresentation and refine loss
brings finer boundaies. }
\label{fig_BANet}
\end{figure}
\begin{table}
\centering
\begin{threeparttable}
\begin{tabular}{|l|c|c|c|}
\hline
model &Boundary Attention & Refine Loss & mIoU \\
\hline\hline
Ours\tnote {1} & & & 94.90 \\
Ours\tnote {2} & \checkmark & & 95.20 \\
Ours\tnote {3} & \checkmark & \checkmark& 95.80 \\
\hline
\end{tabular}
\begin{tablenotes}
\footnotesize
\item[1] : BANet-64 base model
\item[2] : BANet-64 base model + boundary attention
\item[3] : BANet-64 base model + boundary attention + refine loss\\
\end{tablenotes}
\end{threeparttable}
\caption{ Ablation Study}
\label{ablation}
\end{table}
\section{Ablation Study}
We have also verified the effectiveness of each part in BANet by implementing three versions. $Ours^1$ represents BANet
base model. In this version, we remove BA loss, refine loss and the little branch of boundary attention map. In boundary feature mining branch, instead of concatenating input image and boundary attention map, we extract low-level features directly on original images.
$Ours^2$ means BANet with boundary attention map. $Ours^3$ stands for BANet with boundary attention map
and refine loss.
Table \ref{ablation} shows that boundary attention map and refine loss brings 0.3\% and 0.6\% improvements respectively. Fig.\ref{fig_BANet} illustrates
that boundary attention map brings a better semantic representation and refine loss makes striking enhancement on boundary quality. BANet base model involves low-level feature
maps, so it has strong expression ability for details. However, too much low-level feature in no-boundary area may disturb high-level feature representation. Boundary
attention map helps BANet focus on boundary area and extract low-level feature selectively. Refine loss enables BANet breaks the limitation of annotation quality to get finer
segmentation result.
\section{Applications}
Our model can be used in mobile applications for real-time selfie processing. We could directly use the output confidence map of BANet as a soft mask for background changing and image beautification. Compared with other algorithm, our model is able to extract finer features with faster speed and less parameters. Some examples are given in Fig.\ref{fig_matte}.
\begin{figure}[htbp]
\centering
\subfigure{
\begin{minipage}[t]{0.33\linewidth}
\centering
\includegraphics[width=1in]{imgs/matte/00280.png}
\includegraphics[width=1in]{imgs/matte/00107.png}
\includegraphics[width=1in]{imgs/matte/00272.png}
\end{minipage}%
}%
\subfigure{
\begin{minipage}[t]{0.33\linewidth}
\centering
\includegraphics[width=1in]{imgs/matte/00114.png}
\includegraphics[width=1in]{imgs/matte/00271.png}
\includegraphics[width=1in]{imgs/matte/00069.png}
\end{minipage}%
}%
\subfigure{
\begin{minipage}[t]{0.33\linewidth}
\centering
\includegraphics[width=1in]{imgs/matte/00263.png}
\includegraphics[width=1in]{imgs/matte/00291.png}
\includegraphics[width=1in]{imgs/matte/00270.png}
\end{minipage}
}%
\centering
\caption{ Application on background changing }
\label{fig_matte}
\end{figure}
\section{Conclusion and Limitations}
In this paper, we propose a Boundary-Aware Network for fast and high-accuracy portrait segmentation. BANet is the first segmentation network that learns to produce results
with high-quality boundaries which are finer than annotations. What's more, light network architecture and high inference speed make it feasible to utilize this model in many
practical applications.
\par As for limitations, in order to make BANet lighter and faster, we have removed too much channels in semantic branch. As a tradeoff, our model's ability of feature representation is limited. So, BANet has difficulty in learning more complicated cases such as multi-person shot and single person portrait with occlusion.
\par At present, BANet is trained on only 1400 portrait images, it is far from enough if we want to utilize this model on practical applications. In future works, we will annotate more segmentation targets and we will change backgrounds of existing images to get more training data. With the support of a large training dataset, we will try to
apply BANet on mobile phone.
{\small
\bibliographystyle{ieee}
\section{Introduction}
Portrait segmentation has been widely applied in many practical scenes such as mobile phone photography, video surveillance and
image preprocess of face identification. Compared with other semantic segmentation tasks, portrait segmentation has higher requirement for
both accuracy and speed. However, this task has not been well studied in previous works. PFCN+ \cite{shen2016automatic} uses prior information
to enhance segmentation performance, BSN \cite{du2017boundary} designs a boundary kernel to emphasize the importance of boundary area. These methods
get high mean IoU on PFCN+ \cite{shen2016automatic} dataset, but they are extremely time consuming because they use large backbones. What's more,
their segmentation results lack detail information such as threads of hairs and clothe boundary details. Although automatic image matting models such as \cite{shen2016deep}
\cite{zhu2017fast} are able to obtain fine details, but preparing high-quality alpha matte is much more complicated and time-consuming than annotate segmentation
targets. In this paper, we propose an novel method that can generate high-accuracy portrait segmentation result with real-time speed.
\par In recent years, many deep learning based semantic segmentation models like\cite{chen2018deeplab}\cite{zhao2017pyramid}\cite{zhang2018exfuse}\cite{yu2018learning} have reached state-of-the-art performance. However, when it comes to portrait segmentation, none of these works produces fine boundary. The problem of losing fine boundary details is mainly caused by two reasons.
\par Firstly, performance of deep learning based method is quite
dependent on the quality of training data. While segmentation targets are usually annotated manually by polygons or produced by KNN-matting \cite{chen2013knn}. Therefore, it is almost impossible to annotate fine details such as hairs. Supervise.ly dataset is currently the largest and finest human segmentation dataset, some examples are presented as Fig. \ref{fig_sup}. It shows that although Supervise.ly is the finest dataset, annotations are still coarse on boundary areas. Coarse annotation causes inaccurate supervision, which makes it hard for neural network to learn a accurate feature representation.
\par Secondly, Although previous portrait segmentation methods\cite{shen2016automatic}\cite{du2017boundary} have proposed some useful pre-process methods or loss functions, they still use traditional semantic segmentation models like FCN\cite{long2015fully}, Deeplab\cite{chen2018deeplab} and PSPnet\cite{zhao2017pyramid} as their baseline. The problem is that the output size of those models is usually 1/4 or 1/8 of input image size, thus it is impossible to preserve as much detail information as input image. U-Net\cite{ronneberger2015u} fuses more low-level information but it is oriented for small sized medical images, it is hard to train on high-resolution portrait images on account of its huge parameter number.
Although traditional semantic segmentation models achieves state-of-the-art performance on Pascal VOC\cite{everingham2010pascal}, COCO Stuff\cite{caesar2016coco} and CitySpace\cite{cordts2016cityscapes} datasets, they are not suitable for portrait segmentation. Traditional segmentation task aims at handling issues of intra-class consistency and the inter-class distinction among various object classes in complicated scenes. While portrait segmentation is a two-class task which requires fine details and fast speed. Hence,
portrait segmentation should be considered as an independent task and some novel strategies should be proposed.
\begin{figure}[htbp]
\centering
\subfigure{
\begin{minipage}[t]{0.33\linewidth}
\centering
\includegraphics[width=1in]{imgs/sup_anno/2.png}
\end{minipage}%
}%
\subfigure{
\begin{minipage}[t]{0.33\linewidth}
\centering
\includegraphics[width=1in]{imgs/sup_anno/3.png}
\end{minipage}
}%
\subfigure{
\begin{minipage}[t]{0.33\linewidth}
\centering
\includegraphics[width=1in]{imgs/sup_anno/4.png}
\end{minipage}
}%
\centering
\caption{ Polygon Annotations of Supervise.ly }
\label{fig_sup}
\end{figure}
\begin{figure}[htbp]
\centering
\subfigure[Image]{
\begin{minipage}[t]{0.33\linewidth}
\centering
\includegraphics[width=1in]{imgs/img_r/00087.png}
\includegraphics[width=1in]{imgs/img_r/00215.png}
\includegraphics[width=1in]{imgs/img_r/00243.png}
\end{minipage}%
}%
\subfigure[Our Result]{
\begin{minipage}[t]{0.33\linewidth}
\centering
\includegraphics[width=1in]{imgs/sub/00087.png}
\includegraphics[width=1in]{imgs/sub/00215.png}
\includegraphics[width=1in]{imgs/sub/00243.png}
\end{minipage}
}%
\subfigure[Annotation(KNN)]{
\begin{minipage}[t]{0.33\linewidth}
\centering
\includegraphics[width=1in]{imgs/gt_r/00087.png}
\includegraphics[width=1in]{imgs/gt_r/00215.png}
\includegraphics[width=1in]{imgs/gt_r/00243.png}
\end{minipage}%
}%
\centering
\caption{ Details of our outputs}
\label{fig_finer}
\end{figure}
\par In this paper, we propose a specialized portrait segmentation solution by designing BANet. BANet is an efficient network with only 0.62MB parameters,
it achieves 43 fps on $512 \times 512$ images with high-quality results which are finer than annotations. Some examples are presented
in Fig\ref{fig_finer} . Our experiments show that BANet generates better results than previous portrait segmentation models and real-time segmentation models
on PFCN+ dataset.
\section{Related Work}
\noindent \textbf{Portrait Segmentation Networks}: PFCN+\cite{shen2016automatic} provides a benchmark for the task of
portrait segmentation. It calculates firstly an average mask from training dataset, then aligns the average mask
to each input images to provide prior information. However, the process of alignment requires facial feature points.
So, this method needs an additional landmark detection model, which makes the whole process slow and redundant. BSN\cite{du2017boundary}
proposes a boundary-sensitive kernel to take semantic boundary as a third class and it applies many training tricks such
as multi-scale training and multi-task learning. However, it still lacks fine details and the inference speed is very slow.\\
\noindent \textbf{Image Matting Networks}: Image matting has been applied for portrait image process for a long time. Traditional
matting algorithms \cite{chuang2001bayesian} \cite{levin2008closed} \cite{chen2013knn} \cite{sun2004poisson} require a user defined trimap which
limits their applications in automatic image process. Some works \cite{shen2016deep} \cite{chen2018semantic} have proposed to generate trimap by using deep leaning models,
but they still take trimap generation and detail refinement as two separated stages. In matting tasks, trimap helps to locate regions of interest for alpha-matte.
Inspired by the function of trimap in matting tasks, we propose a boundary attention
mechanism to help our BANet focus on boundary areas. Different from previous matting models, we use a two-branch architecture. Our attention map is generated by high-level
semantic branch, and it is used to guide mining low-level features.
DIM\cite{xu2017deep} designs a compositional loss which has been proved to be effective in many
matting tasks, but it is time-consuming to prepare large amount of fore-ground, back-ground images and high-quality alpha matte. \cite{Levinshtein2017RealtimeDH} presents a
gradient-coinstency loss which is able to correct gradient direction on prediction edges, but it is not able to extract richer details. Motivated by that, we propose refine loss to obtain richer detail features on boundary area by using image gradient.\\
\noindent \textbf{High Speed Segmentation Networks}: ENet \cite{paszke2016enet} is the first semantic segmentation network that achieves real-time performance. It adopts
ResNet \cite{he2016deep} bottleneck structure and reduces channel number in order of acceleration, but ENet loses too much accuracy as a tradeoff. ICNet\cite{zhao2017icnet} proposes a multi-stream architecture. Three
streams extract features from images of different resolution, and then those features are fused by a cascade feature fusion unit. BiSeNet \cite{yu2018bisenet} uses a two-stream framework to extract context information and spatial information independently. Then it uses a feature fusion module to combine features of two streams. Inspired by their ideas of separate semantic branch and spatial branch, we design a two-stream architecture. Different from previous works, our two branches are not completely separated. In our framework, low-level branch is guided by high-level branch via a boundary attention map.\\
\noindent \textbf{Attention Mechanism}: Attention mechanism makes high-level information to guide low-level feature extraction. SEnet \cite{hu2017squeeze} applies channel
attention on image recognition tasks and achieves the state-of-the-art. ExFuse \cite{zhang2018exfuse} proposes a Semantic Embedding mechanism to use high-level feature to guide
low-level feature. DFN \cite{yu2018learning} learns a global feature as attention to revise the process of feature extraction. In PFCN+ \cite{shen2016automatic}, shape channel can be viewed as a kind of spatial-wise attention, aligned mean mask forces model to focus on portrait area.
\begin{figure*}[htbp]
\centering
\includegraphics[scale=0.38]{./imgs/pipeline.png}
\caption{Pipeline of Boundary-Aware Network has three parts. Semantic branch extracts high-level semantic features and produces boundary attention map.
Boundary feature mining branch extracts low-level details. Fusion Part fuses high level features and low-level features by a Feature Fusion Module(c).
In semantic branch, ResNet bottleneck structure(b) is used as basic convolutional block.
}
\label{fig_framework}
\end{figure*}
\section{Our Method}
\par \noindent In the task of portrait segmentation, no-boundary area needs a large receptive field to make prediction with global context information, while
boundary area needs small receptive field to focus on local feature contrast. Hence these two areas need to be treated independently. In this paper, we propose
a boundary attention mechanism and a weighted loss function to deal with boundary area and no-boundary area separately.
\par Pipeline of our method is demonstrated as Fig.\ref{fig_framework}. Firstly, color image passes through semantic branch to get
1/4 size high-level semantic features. Secondly, the output of semantic branch is projected into a one-channel feature map and upsampled to full size
as boundary attention map. This boundary attention map is supervised by boundary attention loss (BA loss). Then, in boundary feature mining branch, we concatenate input
image with the boundary attention map in order to mining low-level features more goal-directed. Lastly, the fusion part fuses high-level semantic features and
low-level details to produce fine segmentation results. The final output is supervised by two losses, segmentation loss controls the whole process of
portrait segmentation and refine loss refines boundary details.
\subsection{ Network Architecture }
\par \noindent \textbf{Semantic Branch}: The objective of semantic
branch is getting a reliable feature representation. This feature representation is dominated by high-level semantic information. At same time, we hope it can contain some spatial information. In the task of portrait segmentation, portrait often occupies a
large part of image. Hence, large receptive field is required. Semantic branch is a symmetrical fully convolutional structure that follows FCN-4s structure, we utilize multiple downsampling layers to enlarge the receptive field step by step. As is shown in Fig.\ref{fig_framework},
input image passes through a sequence of convolution layers to get a high-level 1/32 feature map.
Then, bilinear interpolation is applied to upsample small scale feature maps. We combine features of 1/16,1/8 and 1/4 scale step
by step by elementwise addition.
In order to save computation, we use ResNet bottleneck structure as our basic convolutional block, and we fix the max number of channel
as 64. The output of semantic branch is a 1/4 size feature map. This feature map has a robust semantic representation because it has large receptive field and it involves
4s level spatial information. More detail information is restorated in Boundary Feature Mining Branch.\\
\par \noindent \textbf{Boundary Feature Mining Branch}: The output of semantic branch is projected to one channel by $1\times1$ conv filter, then it is interpolated to
full size as boundary attention map. BA loss guides this attention map to locate boundary area. Target of boundary area can be generated without manual annotation. As given
in Fig.\ref{fig_BA}.
Firstly,
we use canny edge detector \cite{canny1986computational} to extract semantic edges on portrait annotation. Considering portrait area varies a lot in different images, it is not
reasonable to dilate each edge to the same width. So, we dilate the edge of different image with different kernel size as follows:
\begin{equation}
K_{dilation} = \frac{ S_{portrait}}{S_{portrait} + S_{background}} * W \label{eq:ratio}
\end{equation}
where W is an empirical value representing the canonical width boundary. In our experiment, we set W = 50.
\par BA loss is a binary cross-entropy loss, but we don't want our boundary attention map to be binarized because spatial-wise unsmoothness may cause numerical
unstability.
Hence, we soften the output of boundary attention map with a Sigmoid function:
\begin{equation}
S(x) = \frac{1}{1 + e^{-\frac{x}{T}}} \label{eq:sigmoid}
\end{equation}
where T is a temperature which produces a softer probability distribution.
\par Lastly, input image and attention map are concatenated together as a 4-channel image. This 4-channel image passes through a convolution layer
to extract detail information. Different from other multi-stream network architecture that handles each stream independently, our low-level features are guided by high-level features.\\
\par \noindent \textbf{Fusion Part}: Features of semantic branch and boundary feature mining branch are different in level of feature representation. Therefore, we
can't simplely combine them by element-wise addition nor channel-wise concatenation. In Fusion Part, we follow BiSeNet\cite{yu2018bisenet}. Given two features of different
levels, we first concatenate them together then we pass them into a sequence of $3\times3$ convolution, batch normalization and ReLU function. Next, we ulitize global pooling
to calculate a weight vector. This vetor helps feature re-weight and feature selection. Fig.\ref{fig_framework} (b) shows details of Feature Fusion Module.
\begin{figure}[htbp]
\centering
\subfigure[Portrait Annotation]{
\begin{minipage}[t]{0.33\linewidth}
\centering
\includegraphics[width=1in]{imgs/gt_r/00049.png}
\includegraphics[width=1in]{imgs/gt_r/00047.png}
\end{minipage}%
}%
\subfigure[Boundary Target]{
\begin{minipage}[t]{0.33\linewidth}
\centering
\includegraphics[width=1in]{imgs/trimap_r/00049.png}
\includegraphics[width=1in]{imgs/trimap_r/00047.png}
\end{minipage}%
}%
\subfigure[Boundary Attention]{
\begin{minipage}[t]{0.33\linewidth}
\centering
\includegraphics[width=1in]{imgs/trimap/00049.png}
\includegraphics[width=1in]{imgs/trimap/00047.png}
\end{minipage}
}%
\centering
\caption{ Boundary Attention }
\label{fig_BA}
\end{figure}
\subsection{ Loss Function }
\noindent Our loss function contains three parts as given in Equation \ref{eq:loss}. Where $ L_{seg}$ guides our segmentation
results, $ L_{bound}$ supervises boundary attention map, and $ L_{refine}$ refines boundary details.\\
\noindent \textbf{Segmentation Loss}: Considering the output of portrait segmentation is a one-channel confidence map, binary cross entropy loss is applied as Equation \ref{eq:seg loss}.
where $y_p^s $ represents prediction result of segmentation and $y_t^s$ stands for segmentation target.
\begin{equation}
L_{seg} = -[y_{t}^s \cdot log(y_{p}^s ) + (1- y_{t}^s) \cdot log(1-y_{p}^s) )] \label{eq:seg loss}
\end{equation}
\noindent \textbf{Boundary Attention Loss}: Loss function is the same for the boundary attention map, where $y_p^b $ means prediction of boundary area.
Boundary loss helps our network locate boundary area. At same time, it can be viewed as an intermediate supervision. Extraction of semantic boundary forces
the network to learn a feature with strong inter-class distinction ability.
\begin{equation}
L_{bound} = -[y_{t}^b \cdot log(y_{p}^b ) + (1- y_{t}^b) \cdot log(1-y_{p}^b ) )] \label{eq:bound loss}
\end{equation}
\noindent \textbf{Refine Loss} : Refine loss is composed by two parts: $L_{cos}$ and $L_{mag}$. The first part $L_{cos}$ uses cosine distance to
supervise the gradient direction of segmentation confidence map, $L_{mag}$ brings a constrain on gradient
magnitude to inforce the network produce clear and sharp results.
\par Let $m_{img}$ be the magnitude of gradient of an image, normalized vector $\overrightarrow \nu_{img} = ( g_{img}^x, g_{img}^y)$ denotes
the direction of gradient of this image. The output of BAnet is a one-channel confidence map of portrait/background dense
classification. Accordingly, we use $m_{pred}$ and $\overrightarrow \nu_{pred}$ to represent magnitude and direction of gradient for the
output confidence map.
\par Inspired by \cite{Levinshtein2017RealtimeDH}, a loss measuring the consistency between image gradient and network output
is introduced. Our $L_{cos}$ can be formulated as Equation \ref{eq:cos loss}.
\begin{equation}
\begin{aligned}
L_{cos} &= (1 - | \overrightarrow \nu_{img} \cdot \overrightarrow \nu_{pred} |) \cdot m_{pred} \\
& = (1- |g_{img}^x \cdot g_{pred}^x + g_{img}^y \cdot g_{pred}^y |) \cdot m_{pred} \label{eq:cos loss}
\end{aligned}
\end{equation}
\par While $L_{cos}$ can only deal with cases with simple background. When background is confusing, $L_{cos}$ tends to cause
blurry prediction boundaries. Different from \cite{Levinshtein2017RealtimeDH}, we add a constrain for gradient magnitude as
Equation \ref{eq:mag loss} to force our network to make clear and sharp decision in boundary area. where $\lambda$
is a factor that balances distributional differences between image and output confidence map. In our experiment, $\lambda = 1.5$.
$L_{mag}$ enables BANet to amplify local contrast when the color of foreground is very similar to background.
\begin{equation}{}
L_{mag} = max( \lambda m_{img} - m_{pred}, 0 ) \label{eq:mag loss}
\end{equation}
\par While boundary areas need rich low-level features to obtain detail information, areas far from boundaries
are mainly guided by high-level semantic features, too much low-level features will disturb the segmentation result.
Therefore, we should combine low-level features selectively. Matting models \cite{xu2017deep} \cite{chen2018semantic}
treat boundary areas and no-boundary areas separately in different stages and then compose two prediction results. Instead of that,
BANet has an end-to-end architecture, we use a weighted loss function to distinct boundary area and no-boundary area. As shown in Equation \ref{eq: refine loss }
refine loss is only applied in boundary area, where $\mathbb M_{bound}$
is a mask which equals 1 only in boundary area. We set $\gamma_1 = \gamma_2 = 0.5 $ in our experiment.
\begin{equation}
L_{refine} = \left(\gamma_1 L_{cos} + \gamma_2 L_{mag}\right) \cdot \mathbb M_{bound} \label{eq: refine loss }
\end{equation}
\noindent \textbf{Total Loss} : Total loss is formulated as a weighted sum of segmentation loss, boundary attention loss and
refine loss. Experiments shows $\alpha = 0.6, \beta = 0.3, \gamma = 0.1 $ makes good performance.
\begin{equation}
L = \alpha L_{seg} + \beta L_{bound} + \gamma L_{refine} \label{eq:loss}
\end{equation}
\subsection{Gradient Calculation}
$L_{refine}$ needs to calculate image gradient, we design a Gradient Calculation Layer(GCL) to compute image gradient on GPU.
Sobel operator \cite{sobel1972camera} is used as convolutional filter in GCL.
\begin{equation}
G_x=
\left[ \begin{array}{ccc}
+1 & 0 & -1\\
+2 & 0 & -2\\
+1 & 0 & -1
\end{array}
\right ] * I,
G_y=
\left[ \begin{array}{ccc}
+1 & +2 & +1\\
0 & 0 & 0\\
-1 & -2 & -1
\end{array}
\right ] * I
\end{equation}
where * denotes convolution operation. Gradient magnitude M and gradient vector $\overrightarrow{\nu}$ are computed as follows:
\begin{equation}
M = \sqrt{G_x^2 + G_y^2 }
\end{equation}
\begin{equation}
\overrightarrow{\nu} = \left( \frac{G_x}{M} \frac{G_y}{M} \right)
\end{equation}
Considering original image and prediction result have different distribution, before passed through GCL, input is normalized as:
\begin{equation}
I_{norm} = \frac{I - I_{min}}{ I_{max} - I_{min}}
\end{equation}
Gradient of original image and output confidence map is presented in Fig.\ref{fig_gadient}.
\begin{figure}[htbp]
\centering
\subfigure[Image]{
\begin{minipage}[t]{0.25\linewidth}
\centering
\includegraphics[width=0.8in]{imgs/gradient/00275.png}
\end{minipage}%
}%
\subfigure[$M_{img}$]{
\begin{minipage}[t]{0.25\linewidth}
\centering
\includegraphics[width=0.8in]{imgs/gradient/Boundary.png}
\end{minipage}%
}%
\subfigure[Prediction]{
\begin{minipage}[t]{0.25\linewidth}
\centering
\includegraphics[width=0.8in]{imgs/gradient/00275_pre.png}
\end{minipage}
}%
\subfigure[$M_{pred}$]{
\begin{minipage}[t]{0.25\linewidth}
\centering
\includegraphics[width=0.8in]{imgs/gradient/Boundary_pre.png}
\end{minipage}
}%
\centering
\caption{ Gradient Calculation }
\label{fig_gadient}
\end{figure}
\section{Experiment Details}
\par \noindent \textbf{Dataset:} PFCN+ \cite{shen2016automatic} dataset contains 1700 KNN annotated portrait images. 1400 images for training
and 300 images for test. Supervise.ly contains more than 4000 polygon annotated human segmentation images, but those images are blended by portrait,
full-body-shot and multi-person photo. We utilize Supervise.ly dataset to pretrain our model in order to get a better initialization, and then we fine-tune
our model on PFCN+ training set, we use PFCN+ test set for evaluation.\\
\par \noindent \textbf{Data Augmentation:} Online augmentation is implemented during the process of loading data, so that
every training sample is unique. Random rotation in range of [-45\ensuremath{^{\circ}} ,45\ensuremath{^{\circ}} ], random flip, random lightness of range
[0.7,1.3] are used in order to improve our network’s ability of generalization.\\
\par \noindent \textbf{Training Strategy:} Considering that $L_{refine}$ is only applied on boundary area, it needs a proper boundary attention map to
help locating boundary. Therefore, we firstly pretrain BANet without $L_{refine}$ on Supervise.ly dataset for 40000 iterations to get a good boundary initialization. Then we fine-tune BANet on PFCN+ dataset with $L_{refine}$ for another 40000 iterations.
\par Supervise.ly dataset and PFCN+ dataset have different data distribution. What's more, we add $L_{refine}$ during the process of fine-tuning. Hence, it is not
appropriate to give a big learning rate at the beginning of fine-tuning. We utilize warming-up learning rate which gives the network a suitable weight initialization before applying big learning rate, thus the network can converge to a better point. Curves of warming-up learning rate can be viewed in Fig.\ref{fig_warmup}
\par Stochastic gradient descent (SGD) optimizer is used to train our model. L2-regularization is applied to all
learnable parameters in order to prevent overfitting. Other hyper parameters for training follows Table.\ref{tabel_hyper}. \\
\begin{table}
\centering
\begin{threeparttable}
\begin{tabular}{|c|c|}
\hline
Hyper Parameter & Value \\
\hline\hline
Batch Size & 16 \\
Weight Decay & $ 10^{-4}$ \\
Momentum & 0.9 \\
Max Learning Rate & 0.1 \\
Training Iteration & 4 000 \\
\hline
\end{tabular}
\end{threeparttable}
\caption{ Hyper Parameter
}
\label{tabel_hyper}
\end{table}
\begin{figure}[htbp]
\centering
\includegraphics[scale=0.5]{./imgs/lr.png}
\caption{Warming up learning rate
}
\label{fig_warmup}
\end{figure}
\par \noindent \textbf{Comparison Experiments:} Series of comparison experiments are implemented on some real-time
segmentation networks and portrait segmentation networks. For control variates, the same training strategy and
hyper parameters are used for all the models. Firstly, these models are pretrained on Supervise.ly dataset, then they
get fine-tuned on PFCN+ dataset. Experiment result is demonstrated in Table.\ref{tabel_result}. Mean IoU is measured as criterion of segmentation accuracy.
Inference speed is measured on a single GTX 1080 Ti with input size $512 \times 512 $. Parameter number evaluates the feasibility of implementing these models
on edge devices such as mobile phone.
\par In order to prove our BANet performs better than other portrait segmentation networks with the same order of parameter number, we have also implemented a larger version of BANet with 512 channels, called BANet-512. BANet-64 means the version of BANet with 64 channels.\\
\par \noindent \textbf{Result Analysis:} As shown in Fig.\ref{fig_comparison}. Confidence maps of BiSeNet and EDAnet have vague boundaries, they lack low-level information because they are upsampled
directly by bilinear interpolation. PFCN+ has a better semantic representation with the help of prior information provided by shape channel. U-Net get a better boundary
because it combines much low-level information. However, U-Net and PFCN+ are still not able to extract fine details like hairs. With the help of boundary attention map
and refine loss, BANet-64 is able to produce high-quality results with fine details. In some cases, BANet produces segmentation results which are finer than KNN-annotations.
Considering mean IoU measures the similarity between output and annotation, even though PFCN+ and U-Net get a higher mean IoU than BANet-64, we can't conclude BANet-64 is less
accurate than them. While with same order of parameter number, BANet-512 surpasses the other models.
\par What's more, PFCN+ has more than 130 MB parameters while our BANet-64 has only 0.62 MB parameters, which makes it possible to be implemented on mobile phone. As for inference speed, BANet-64 achieves 43 FPS on $512 \times 512$ images and 115 FPS on $256 \times 256$ images, so it can be applied in real-time image processing.
\begin{table}
\centering
\begin{threeparttable}
\begin{tabular}{|l|c|c|c|}
\hline
model & mIoU (\%) & speed(fps) & parameter(MB) \\
\hline\hline
ENet\cite{paszke2016enet} & 88.24 & 46 & 0.35 \\
BiSeNet \cite{yu2018bisenet} & 93.91 & 59 & 27.01 \\
EDAnet\cite{lo2018efficient} & 94.90 & 71 & 0.68 \\
U-Net\cite{ronneberger2015u} & 95.88 & 37 & 13.40 \\
PFCN+\cite{shen2016automatic} & 95.92 & 8 & 134.27 \\
\hline
BANet-64 &95.80& 43 & 0.62 \\
BANet-512 &96.13& 29 & 12.75 \\
\hline
\end{tabular}
\end{threeparttable}
\caption{Comparison results: All experiments are implemented on Pytorch\cite{paszke2017automatic} framework with input images of size
$512 \times 512$ . Inference speed is measured on a single GTX 1080 Ti.
}
\label{tabel_result}
\end{table}
\begin{figure*}[htbp]
\centering
\subfigure[Image]{
\begin{minipage}[t]{0.14\linewidth}
\centering
\includegraphics[width=\textwidth]{imgs/img_r/00003.png}
\includegraphics[width=\textwidth]{imgs/img_r/00052.png}
\includegraphics[width=\textwidth]{imgs/img_r/00274.png}
\includegraphics[width=\textwidth]{imgs/img_r/00293.png}
\includegraphics[width=\textwidth]{imgs/img_r/00261.png}
\includegraphics[width=\textwidth]{imgs/img_r/00249.png}
\end{minipage}%
}%
\subfigure[BiSeNet \cite{yu2018bisenet}]{
\begin{minipage}[t]{0.14\linewidth}
\centering
\includegraphics[width=\textwidth]{imgs/Bisenet/00003.png}
\includegraphics[width=\textwidth]{imgs/Bisenet/00052.png}
\includegraphics[width=\textwidth]{imgs/Bisenet/00274.png}
\includegraphics[width=\textwidth]{imgs/Bisenet/00293.png}
\includegraphics[width=\textwidth]{imgs/Bisenet/00261.png}
\includegraphics[width=\textwidth]{imgs/Bisenet/00249.png}
\end{minipage}%
}%
\subfigure[EDAnet \cite{lo2018efficient}]{
\begin{minipage}[t]{0.14\linewidth}
\centering
\includegraphics[width=\textwidth]{imgs/EDAnet/00003.png}
\includegraphics[width=\textwidth]{imgs/EDAnet/00052.png}
\includegraphics[width=\textwidth]{imgs/EDAnet/00274.png}
\includegraphics[width=\textwidth]{imgs/EDAnet/00293.png}
\includegraphics[width=\textwidth]{imgs/EDAnet/00261.png}
\includegraphics[width=\textwidth]{imgs/EDAnet/00249.png}
\end{minipage}%
}%
\subfigure[PFCN+ \cite{shen2016automatic}]{
\begin{minipage}[t]{0.14\linewidth}
\centering
\includegraphics[width=\textwidth]{imgs/PFCN/00003.png}
\includegraphics[width=\textwidth]{imgs/PFCN/00052.png}
\includegraphics[width=\textwidth]{imgs/PFCN/00274.png}
\includegraphics[width=\textwidth]{imgs/PFCN/00293.png}
\includegraphics[width=\textwidth]{imgs/PFCN/00261.png}
\includegraphics[width=\textwidth]{imgs/PFCN/00249.png}
\end{minipage}%
}%
\subfigure[U-Net \cite{ronneberger2015u}]{
\begin{minipage}[t]{0.14\linewidth}
\centering
\includegraphics[width=\textwidth]{imgs/Unet/00003.png}
\includegraphics[width=\textwidth]{imgs/Unet/00052.png}
\includegraphics[width=\textwidth]{imgs/Unet/00274.png}
\includegraphics[width=\textwidth]{imgs/Unet/00293.png}
\includegraphics[width=\textwidth]{imgs/Unet/00261.png}
\includegraphics[width=\textwidth]{imgs/Unet/00249.png}
\end{minipage}%
}%
\subfigure[BANet-64]{
\begin{minipage}[t]{0.14\linewidth}
\centering
\includegraphics[width=\textwidth]{imgs/ours_r/00003.png}
\includegraphics[width=\textwidth]{imgs/ours_r/00052.png}
\includegraphics[width=\textwidth]{imgs/ours_r/00274.png}
\includegraphics[width=\textwidth]{imgs/ours_r/00293.png}
\includegraphics[width=\textwidth]{imgs/BAnet_ms_matte/00261.png}
\includegraphics[width=\textwidth]{imgs/BAnet_ms_matte/00249.png}
\end{minipage}%
}%
\subfigure[Annotation(KNN)]{
\begin{minipage}[t]{0.14\linewidth}
\centering
\includegraphics[width=\textwidth]{imgs/gt_r/00003.png}
\includegraphics[width=\textwidth]{imgs/gt_r/00052.png}
\includegraphics[width=\textwidth]{imgs/gt_r/00274.png}
\includegraphics[width=\textwidth]{imgs/gt_r/00293.png}
\includegraphics[width=\textwidth]{imgs/gt_r/00261.png}
\includegraphics[width=\textwidth]{imgs/gt_r/00249.png}
\end{minipage}%
}%
\centering
\caption{ Comparison results. Traditional Real-time segmentation models like BiSeNet and EDAnet have a huge gap to our work in the task of portrait segmentation.
PFCN+ and U-Net have a higher mean IoU than our result but they have obviously coarser boundaries. Mean IoU of our result is limited by target quality.}
\label{fig_comparison}
\end{figure*}
\begin{figure}[htbp]
\centering
\subfigure[Image]{
\begin{minipage}[t]{0.25\linewidth}
\centering
\includegraphics[width=0.8in]{imgs/img_r/00282.png}
\includegraphics[width=0.8in]{imgs/img_r/00033.png}
\includegraphics[width=0.8in]{imgs/img_r/00245.png}
\end{minipage}%
}%
\subfigure[$Ours^1$]{
\begin{minipage}[t]{0.25\linewidth}
\centering
\includegraphics[width=0.8in]{imgs/BAnet_base_model/00282.png}{}
\includegraphics[width=0.8in]{imgs/BAnet_base_model/00033.png}
\includegraphics[width=0.8in] {imgs/BAnet_base_model/00245.png}
\end{minipage}%
}%
\subfigure[$Ours^2$]{
\begin{minipage}[t]{0.25\linewidth}
\centering
\includegraphics[width=0.8in]{imgs/BAnet_ms/00282.png}
\includegraphics[width=0.8in]{imgs/BAnet_ms/00033.png}
\includegraphics[width=0.8in]{imgs/BAnet_ms/00245.png}
\end{minipage}
}%
\subfigure[$Ours^3$]{
\begin{minipage}[t]{0.25\linewidth}
\centering
\includegraphics[width=0.8in]{imgs/ours_r/00282.png}
\includegraphics[width=0.8in]{imgs/ours_r/00033.png}
\includegraphics[width=0.8in]{imgs/ours_r/00245.png}
\end{minipage}
}%
\centering
\caption{ Ablation Study shows boundary attention map brings a better semantic prepresentation and refine loss
brings finer boundaies. }
\label{fig_BANet}
\end{figure}
\begin{table}
\centering
\begin{threeparttable}
\begin{tabular}{|l|c|c|c|}
\hline
model &Boundary Attention & Refine Loss & mIoU \\
\hline\hline
Ours\tnote {1} & & & 94.90 \\
Ours\tnote {2} & \checkmark & & 95.20 \\
Ours\tnote {3} & \checkmark & \checkmark& 95.80 \\
\hline
\end{tabular}
\begin{tablenotes}
\footnotesize
\item[1] : BANet-64 base model
\item[2] : BANet-64 base model + boundary attention
\item[3] : BANet-64 base model + boundary attention + refine loss\\
\end{tablenotes}
\end{threeparttable}
\caption{ Ablation Study}
\label{ablation}
\end{table}
\section{Ablation Study}
We have also verified the effectiveness of each part in BANet by implementing three versions. $Ours^1$ represents BANet
base model. In this version, we remove BA loss, refine loss and the little branch of boundary attention map. In boundary feature mining branch, instead of concatenating input image and boundary attention map, we extract low-level features directly on original images.
$Ours^2$ means BANet with boundary attention map. $Ours^3$ stands for BANet with boundary attention map
and refine loss.
Table \ref{ablation} shows that boundary attention map and refine loss brings 0.3\% and 0.6\% improvements respectively. Fig.\ref{fig_BANet} illustrates
that boundary attention map brings a better semantic representation and refine loss makes striking enhancement on boundary quality. BANet base model involves low-level feature
maps, so it has strong expression ability for details. However, too much low-level feature in no-boundary area may disturb high-level feature representation. Boundary
attention map helps BANet focus on boundary area and extract low-level feature selectively. Refine loss enables BANet breaks the limitation of annotation quality to get finer
segmentation result.
\section{Applications}
Our model can be used in mobile applications for real-time selfie processing. We could directly use the output confidence map of BANet as a soft mask for background changing and image beautification. Compared with other algorithm, our model is able to extract finer features with faster speed and less parameters. Some examples are given in Fig.\ref{fig_matte}.
\begin{figure}[htbp]
\centering
\subfigure{
\begin{minipage}[t]{0.33\linewidth}
\centering
\includegraphics[width=1in]{imgs/matte/00280.png}
\includegraphics[width=1in]{imgs/matte/00107.png}
\includegraphics[width=1in]{imgs/matte/00272.png}
\end{minipage}%
}%
\subfigure{
\begin{minipage}[t]{0.33\linewidth}
\centering
\includegraphics[width=1in]{imgs/matte/00114.png}
\includegraphics[width=1in]{imgs/matte/00271.png}
\includegraphics[width=1in]{imgs/matte/00069.png}
\end{minipage}%
}%
\subfigure{
\begin{minipage}[t]{0.33\linewidth}
\centering
\includegraphics[width=1in]{imgs/matte/00263.png}
\includegraphics[width=1in]{imgs/matte/00291.png}
\includegraphics[width=1in]{imgs/matte/00270.png}
\end{minipage}
}%
\centering
\caption{ Application on background changing }
\label{fig_matte}
\end{figure}
\section{Conclusion and Limitations}
In this paper, we propose a Boundary-Aware Network for fast and high-accuracy portrait segmentation. BANet is the first segmentation network that learns to produce results
with high-quality boundaries which are finer than annotations. What's more, light network architecture and high inference speed make it feasible to utilize this model in many
practical applications.
\par As for limitations, in order to make BANet lighter and faster, we have removed too much channels in semantic branch. As a tradeoff, our model's ability of feature representation is limited. So, BANet has difficulty in learning more complicated cases such as multi-person shot and single person portrait with occlusion.
\par At present, BANet is trained on only 1400 portrait images, it is far from enough if we want to utilize this model on practical applications. In future works, we will annotate more segmentation targets and we will change backgrounds of existing images to get more training data. With the support of a large training dataset, we will try to
apply BANet on mobile phone.
{\small
\bibliographystyle{ieee}
| {'timestamp': '2019-01-15T02:05:24', 'yymm': '1901', 'arxiv_id': '1901.03814', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03814'} | arxiv |
\section{Introduction}
\label{sec_introduction}
Rapid deployment of wireless communication systems has always been engraved with the issue of security of the transmitted data.
The basic reason is the broadcast nature of transmission which makes the signals vulnerable to tapping by malicious users \cite{amitav_TCST_2014}.
Security of the transmitted signal is generally considered as a responsibility of the higher layers which employ cryptographic techniques. This strategy relies on the basic assumption that the enciphering system is unbreakable by the malicious users \cite{Shiu_WC_2011}.
With growing computing capabilities, such measures prove to be insufficient and it has
motivated the research community to explore security at the physical layer.
Physical layer security finds its basis from independence of the wireless communication channels and has a low implementation complexity \cite{Bloch_book_2011}.
This added layer of security is considered as the strictest kind of security, not requiring even any kind of key exchange \cite{amitav_TCST_2014, Shiu_WC_2011}.
Orthogonal frequency division multiple access (OFDMA) is a potential physical layer technology for the next generation access networks such as WiMAX, LTE, and beyond. Hence, the study of physical layer security in OFDMA has gained considerable attention in recent years \cite{Haohao_ICC_2013, Karachontzitis_TIFS_2015,Derrick_TVT_2012, Derrick_TWC_2011, Munnujahan_ICC_2013, Wang_eurasip_2013, Jorswieck2008, Xiaowei_TIFS_2011, Jorswieck_SAC_2013}.
The subcarrier allocation and power optimization in multi-node secure OFDMA system has been studied in two cases: in one scenario transmitter assumes all users to be trusted and there exists an external eavesdropper which tries to decode the data of trusted users \cite{Haohao_ICC_2013, Karachontzitis_TIFS_2015, Derrick_TVT_2012, Derrick_TWC_2011, Munnujahan_ICC_2013}, while in another scenario there is a mutual distrust among the users and a particular user may demand the source to transmit its data considering all other users as the potential eavesdroppers \cite{Xiaowei_TIFS_2011, Jorswieck2008, Jorswieck_SAC_2013}.
In \emph{trusted users case}, the authors in \cite{Karachontzitis_TIFS_2015} considered maximizing the minimum of weighted sum secure rate of all the users. They proposed a complex MILP based solution and less complex suboptimal schemes. However, the issue of resource scarcity of a user that is very near to the eavesdropper was not highlighted.
Maximization of energy efficiency with multi-antenna source, eavesdropper, and single antenna users was studied in \cite{Derrick_TVT_2012} with bounds on per-user tolerable secrecy outage probability.
The average secrecy outage capacity maximization in the same setup with a multi-antenna Decode and Forward relay was studied in \cite{Derrick_TWC_2011}.
The authors in \cite{Derrick_TWC_2015} studied secure rate maximization under fixed quality of service (QoS) constraints for secure communication among multiple source-destination pairs in the presence of multi-antenna external eavesdropper, with the help of multiple single antenna Amplify and Forward (AF) relays.
An extension of the above proposed schemes to multiple eavesdroppers case may be straight forward, but with untrusted users the problems present an interesting challenge with multiple unexplored facets.
Looking at another domain of untrust, subcarrier assignment and power allocation problem was studied in \cite{Wang_eurasip_2013} in an AF untrusted relay aided secure communication among multiple source-destination pairs.
In an effort to tackle the \emph{untrusted users}, the authors in \cite{Jorswieck2008} proposed to allocate a subcarrier to its best gain user in a two-user OFDMA system and presented the optimal power allocation.
The scheme can be trivially extended to more than two users for sum rate maximization.
In a scenario having heterogeneous demand of resources by users, the authors in \cite{Xiaowei_TIFS_2011} proposed a joint subcarrier and power allocation policy for two classes of users: secure users demanding a fixed secure rate and normal users which are served with best effort traffic.
In the cognitive radio domain, secure communication over a single carrier, between multi-antenna secondary transmitter and a fixed user considering other secondary and primary users as eavesdroppers was studied in \cite{Derrick_TVT_2015}.
Similarly, precoder design to maximize the sum secrecy rate to achieve confidential broadcast to users with multiple antennas was studied in \cite{Yang_TC_2014, Geraci_TC_2012}.
The authors in \cite{Jorswieck_SAC_2013} solved the resource allocation problem among multiple source-destination pairs in a relay-aided scenario with untrusted users.
However, in secure OFDMA fair resource distribution among untrusted users poses new challenges which have not yet been investigated.
\subsection{Motivation}
The study in \cite{Xiaowei_TIFS_2011} raised the feasibility issue of resource allocation problem because of the channel conditions, i.e., some users may not achieve the required secure rate due to tapping by untrusted users. This motivates us to investigate if the secure rate over a subcarrier could be any how improved.
The strategy proposed in \cite{Munnujahan_ICC_2013} utilizes interference to improve the secure rate of a user. But this scheme cannot be used in multi-user untrusted scenario because it relies on a strong assumption that the jammer affects the eavesdropper only.
It was shown in \cite{SGOEL_TWC_2008} that, for single user multi-antenna system, secrecy rate can be improved by a multi-antenna source by jointly transmitting message in the range space and interference in the null space of the main channel. Since this solution is difficult to apply for single antenna systems, the authors in \cite{XTANG_TIT_2011} showed the possibility of achieving a positive rate even when eavesdropper's channel is stronger compared to main channel by using jamming power control only.
The studies in \cite{Munnujahan_ICC_2013, SGOEL_TWC_2008, XTANG_TIT_2011} are based on single user system. The implications of utilizing interference in multi-user scenario are yet to be investigated.
With regard to fair resource allocation without the help of interference, the strategy proposed in \cite{Karachontzitis_TIFS_2015}, which balances the secure rate among users, can limit the maximum achievable rate of the system because of a poor user facing strong eavesdropping by other users. This leads to system resource wastage.
Effectively utilizing jammer power control in multiple untrusted user scenario for sum rate maximization or fair resource allocation raises challenges which to the best of our knowledge has not yet been investigated in the literature.
In this paper, we intend to explore the role of the jammer power in alleviating the following issues which plague single antenna secure OFDMA system with $M$ untrusted users:
\begin{itemize}
\item Secure rate achievable by the users can be very low as compared to the single external eavesdropper case, because now there are $M-1$ wiretappers instead of one;
\item A large number of users can starve for subcarriers, because a group of users with very good channel gains may prohibit secure communication to the other users.
\end{itemize}
Assuming the jammer to be a node affecting all the users, we intend to use the jammer power for individual and independent jamming over the subcarriers.
The resource allocation problem in presence of jammer is a complex Mixed Integer Non Linear Programming (MINLP) problem belonging to the class of NP-hard \cite{Di_Yuan_TVT_2013,Y_F_LIU_TSP_2014}.
Due to the requirement of decision on subcarrier allocation at the source as well as to use jammer power over a subcarrier, the problem exhibits combinatorial nature having exponential complexity with number of subcarriers \cite{MTAO_TWC_2008}.
Hence, instead of attempting a global optimal solution, we study the resource allocation problem to improve either the sum secure rate or the overall system fairness.
While extending our preliminary work in \cite{ravikant_ICC_2015}, where we presented two suboptimal solutions based on sequential source and jammer power allocation,
we conduct a deeper study on the behavior of secure rate with jammer power and
solve the joint source and jammer power optimization problem.
For max-min fair resource allocation, two novel methodologies of jammer power utilization are introduced.
We also present the asymptotic analysis of the algorithms with $P_S \to \infty$ and $P_J \to \infty$, and discuss the computational complexity of all the proposed schemes under both the usages of jammer.
\subsection{Contribution}
Our contributions can be summarized as answers to the following two questions:
(1) \emph{How to improve sum secure rate in OFDMA systems with untrusted users?}
To address this question, we consider the possibility of using jammer power over a subcarrier to improve the secure rate beyond what can be achieved by source power only.
The features of the proposed solution are as follows:
\begin{itemize}
\item We obtain the constraints of secure rate improvement over a subcarrier and show that the secure rate in this constrained domain is a quasi-concave function of jammer power, thereby offering a unique maxima.
\item The jammer aided approach introduces a new challenge - referred as SNR reordering in the rest of the paper - which makes the problem combinatorial even after subcarrier allocation and jammer utilization decision.
We introduce the concept of constrained-jamming by developing jammer power bounds to handle this challenge.
\item For the known subcarrier allocation and jammer decision, the joint source and jammer power allocation problem is solved optimally using \emph{primal decomposition (PD)}\cite{sboyd_decomposition} and \emph{alternating optimization (AO)}\cite{sboyd_alternating} techniques.
\item We analyze the complexity of the proposed algorithm and show its convergence in finite steps.
\item We also propose less complex solution which allows a trade-off between performance and complexity.
\item Asymptotically optimal solution is derived to assess optimality of the proposed scheme.
\end{itemize}
(2) \emph{How to remove subcarrier scarcity and have fair distribution?}
In secure OFDMA with untrusted users and in absence of jammer, the best gain user over a subcarrier is the strongest eavesdropper for all other users. Thus, a subcarrier should normally be given to its best gain user, which may cause some users to starve for channel resources.
To attain a better fairness, we propose to take away a subcarrier from its best gain user and allocate it to another user with poor channel gain with the help of jammer.
The features of the proposed solution are:
\begin{itemize}
\item Secure rate over the snatched subcarrier is positive when the jammer power is above a certain threshold and attains a maximum value at an optimal jammer power.
\item The conventional max-min fairness algorithm cannot be employed in secure OFDMA because a user with poor channel gains over all the subcarriers may force the algorithm into a deadlock. The proposed max-min fair scheme offers a graceful exit with such users.
\item Two variants of max-min fairness algorithms are proposed where the jammer power can be utilized either by preserving it for possible snatching over each subcarrier, or by allocating it based on the demand of snatching user.
\item The power allocation is done by PD and AO process while the issue of signal to noise ratio (SNR) reordering is handled similarly as in sum rate maximization case.
\item Low complexity solutions have been presented for both the variants of max-min fairness algorithms.
\item We obtain an asymptotic upper bound of the fairness achievable by our proposed scheme.
\end{itemize}
The remainder of the paper is organized as follows: The system model is introduced in Section \ref{sec:model}. The sum secure rate maximization problem is studied in Section \ref{sec_sum_rate_imp}, followed by fair resource allocation study in Section \ref{sec_max_min_fairness}. Asymptotic analysis has been presented in Section \ref{sec_asymp_anlysis}. Simulation results are discussed in Section \ref{sec_results}. Section \ref{sec_conclusion} concludes the paper.
\section{System model}\label{sec:model}
We consider the downlink of an OFDMA system with a single source (base station), a friendly jammer, $M$ untrusted mobile users (MUs) which are randomly distributed in the cell coverage area, and $N$ subcarriers. The jammer, which is considered as another node in the network (e.g., in LTE-Advanced it could be an idle relay node), is controlled by the source to help improve the overall system performance.
Jammer is assumed to be capable of collecting channel state information (CSI) in the uplink and sending jamming signal which is unknown to users on the downlink.
Since all users request secure communication with the source, they share their CSI with the source as well as the jammer.
In the present study we assume the jammer to be located randomly in the cell area.
Source-to-MUs and jammer-to-MUs channels are considered to experience slow and frequency-flat fading, such that the channel parameters remain constant over a frame duration but vary randomly from one frame to another.
Perfect CSI of source-to-MU and jammer-to-MU channel pairs for all the MUs is assumed to be available at source \cite{Haohao_ICC_2013, Xiaowei_TIFS_2011, Derrick_TVT_2012, Derrick_TWC_2011, Karachontzitis_TIFS_2015, Munnujahan_ICC_2013, Wang_eurasip_2013, Jorswieck2008}.
Source utilizes this information for subcarrier allocation, and source and jammer power allocation.
We consider that a subcarrier is exclusively allocated to one user only, which has been proved to be optimal for sum secure rate maximization \cite{Jorswieck2008}.
\begin{figure}[!htb]
\centering
\epsfig{file=figure1.pdf, height=1.2in}
\caption{System model}
\label{fig:system_model}
\end{figure}
The secure OFDMA system with $M$ untrusted users is a multiple eavesdropper scenario, where for each main user there exist $(M-1)$ eavesdroppers.
Out of these $(M-1)$ eavesdroppers, the strongest one is considered as the equivalent eavesdropper (hereafter referred as eavesdropper).
The secure rate of the main user over a subcarrier is defined as the non-negative capacity difference between the main user and the eavesdropper. Let $h_{i,n}$ be the source to $i$th user channel coefficient and $g_{i,n}$ be the jammer to $i$th user channel coefficient over subcarrier $n$ as shown in Fig. \ref{fig:system_model}. Then, the secure rate of user $m$ on $n$th subcarrier is given as \cite{Jorswieck2008, Xiaowei_TIFS_2011}:
\begin{align}\label{secure_rate_definition}
R_{m,n} & = \left[ \log_2 \left( 1+\frac{P_{s_n}|h_{m,n}|^2}{\sigma^2 + \pi_{j_n} P_{j_n} |g_{m,n}|^2 } \right) \right. \nonumber \\
& \hspace{-0.12in} - \left. \max\limits_{e \in \{1,2,\cdots M\} \setminus m} \log_2 \left( 1+\frac{P_{s_n} |h_{e,n}|^2}{\sigma^2+ \pi_{j_n} P_{j_n} |g_{e,n}|^2 } \right) \right]^+
\end{align}
where $(x)^+=\max(x,0)$, $\sigma^2$ is the AWGN noise variance, $P_{s_n}$ and $P_{j_n}$ are respectively source and jammer powers over subcarrier $n$. $\pi_{j_n} \in \{0, 1\}$ is an indicator of absence or presence of jammer power on subcarrier $n$ such that $\pi_{j_n}=0 \implies P_{j_n}=0$, and $e$ is the eavesdropper. The non-linearity of secure rate in source and jammer powers along with the $\max$ operator complicate the optimal resource allocation which will be discussed in the Section \ref{sec_sum_rate_imp} and \ref{sec_max_min_fairness}.
\emph{Example:}
Let us consider a symbolic 3 user 5 subcarrier OFDMA system, with the respective channel gains $|h_{m,n}|$ and $|g_{m,n}|$ given in Tables \ref{src_gain} and \ref{jammer_gain}. This system will be used to illustrate the key concepts developed further in the paper. \hspace{0.2in}\textbf{$\Box$}
\section{Resource allocation for sum secure rate maximization}
\label{sec_sum_rate_imp}
In this section we discuss the joint source and jammer resource optimization problem for weighted sum secure rate maximization. The problem can be stated as:
\begin{align}\label{opt_prob_jra_rate_max}
& \underset{P_{s_n}, P_{j_n}, \pi_{m,n}, \pi_{j_n}} {\text{maximize}} \sum_{m=1}^M \sum_{n=1}^N \ w_m \pi_{m,n} R_{m,n} \nonumber \\
& \text{subject to} \nonumber \\
&C_{1,1}: \sum_{n=1}^N P_{s_n} \leq P_S, \qquad \quad C_{1,2}: \sum_{n=1}^N P_{j_n} \leq P_J, \nonumber \\
&C_{1,3}: \pi_{j_n} \in \{0,1\} \text{ } \forall n, \qquad C_{1,4}: \pi_{m,n} \in \{0,1\} \text{ } \forall m, n,\nonumber \\
&C_{1,5}: \sum_{m=1}^M \pi_{m,n} \leq 1 \text{ } \forall n, \quad C_{1,6}:P_{s_n}\ge 0, P_{j_n}\ge 0 \text{ } \forall n
\end{align}
where $\pi_{m,n}$ is a binary allocation variable to indicate whether subcarrier $n$ is given to user $m$ or not, $w_m$ is the priority weight allocated by the higher layers to user $m$, and
$P_S$ and $P_J$ are source and jammer power budgets, respectively.
$C_{1,1}$ and $C_{1,2}$ are budget constraints, $C_{1,3}$ is jammer allocation constraint, $C_{1,4}$ and $C_{1,5}$ are subcarrier allocation constraints, and $C_{1,6}$ denotes source and jammer power boundary constraints.
The optimization problem in (\ref{opt_prob_jra_rate_max}) has total four variables per subcarrier: $\pi_{j_n}$, $\pi_{m,n}$ as binary variables; and $P_{s_n}$ and $P_{j_n}$ as continuous variables.
Since the problem is a non-convex combinatorial problem belonging to the class of NP-hard, there is no polynomial time optimal solution possible \cite{Di_Yuan_TVT_2013,Y_F_LIU_TSP_2014}. We tackle the problem by breaking it in parts and attempt to find a near-optimal solution, which approaches asymptotically optimal solution (discussed in Section \ref{sec_asymp_anlysis}) as $P_S$ and $P_J$ increases.
For this, first we perform subcarrier allocation without considering the jammer.
Next we distinguish those subcarriers over which jammer can improve the secure rate,
and finally we complete the joint power allocation.
\newcolumntype{C}{>{\centering\arraybackslash}p{3em}}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash}p{#1}}
\begin{table}[!htb]
\caption{Source-users channel gains $|h_{m,n}|$}\label{src_gain}
\centering
{\scriptsize
\begin{tabular}{|L{.5cm} |L{1cm}| L{1cm}| L{1cm}| L{1cm}| L{1cm}|}
\hline
{} & {$c_1$} & {$c_2$} & {$c_3$} & {$c_4$} & {$c_5$} \\
\hline
{$u_1$} & {1.1027} & {0.3856} & {0.6719} & {1.2101} & {0.7043} \\
\hline
{$u_2$} & {0.7423} & {1.0735} & {0.6558} & {1.0006} & {0.8943} \\
\hline
{$u_3$} & {0.7554} & {1.4772} & {0.2498} & {1.3572} & {3.5391} \\
\hline
\end{tabular}
}
\end{table}
\begin{table}[!htb]
\caption{Jammer-users channel gains $|g_{m,n}|$}\label{jammer_gain}
\centering
{\scriptsize
\begin{tabular}{|L{.5cm} |L{1cm}| L{1cm}| L{1cm}| L{1cm}| L{1cm}|}
\hline
{} & {$c_1$} & {$c_2$} & {$c_3$} & {$c_4$} & {$c_5$} \\
\hline
{$u_1$} & {3.3624} & {6.0713} & {3.4125} & {3.0584} & {0.4987} \\
\hline
{$u_2$} & {8.1741} & {7.0607} & {4.1047} & {0.9860} & {1.6860} \\
\hline
{$u_3$} & {0.9028} & {2.0636} & {0.5605} & {3.0277} & {4.5346} \\
\hline
\end{tabular}
}
\end{table}
\subsection{Subcarrier allocation at source}
\label{subsec_subc_alloc_src}
In presence of jammer, subcarrier allocation at source, i.e., $\pi_{m,n}$ decision is difficult.
In secure OFDMA with untrusted users a subcarrier can only be given to the user having maximum SNR over the subcarrier. Any change in $P_{j_n}$ may force the decision of subcarrier allocation to change because of the possible reordering of updated SNRs (cf. (\ref{secure_rate_definition})). Since $P_{s_n}$ is in numerator, any change in $P_{s_n}$ does not affect the SNR ordering.
This makes the problem combinatorial, as we may need to check subcarrier allocation for every update of $P_{j_n}$.
In order to bypass this step, we initially assume that the jammer is not present.
In absence of jammer $\pi_{j_n}=0$ $\forall$ $n$, and the secure rate
definition in (\ref{secure_rate_definition}) changes to
\begin{align}\label{secure_rate_definition_without_jammer}
R_{m,n}|_{_{\pi_{j_n}=0}} & = \left[ \log_2 \left( 1+\frac{P_{s_n}|h_{m,n}|^2}{\sigma^2} \right) \right. \nonumber \\
& \hspace{-0.12in} - \left. \max\limits_{e \in \{1,2,\cdots M\} \setminus m} \log_2 \left( 1+\frac{P_{s_n} |h_{e,n}|^2}{\sigma^2} \right) \right]^+.
\end{align}
As observed in (\ref{secure_rate_definition_without_jammer}), $|h_{m,n}|$ $>$ $\max\limits_{e \in \{1,2,\cdots M\} \setminus m} |h_{e,n}|$ is required to have positive secure rate over subcarrier $n$, irrespective of $P_{s_n}$.
Thus, the subcarrier allocation policy, allocating a subcarrier to its best gain user can be stated as:
\begin{align}\label{subcarrier_alloc_policy}
\pi_{m,n}=
\begin{cases}
1, & \text{if $|h_{m,n}|=\max\limits_{e \in \{1,2,\cdots M\}}|h_{e,n}|$}\\
0, & \text{otherwise.}
\end{cases}
\end{align}
\begin{remark}
Note that the subcarrier allocation (\ref{subcarrier_alloc_policy}) depends only on users' gains. It is indifferent to users' priority imposed through weights which will play their role in power allocation.
\end{remark}
\subsection{Subcarrier allocation at jammer and jammer power bounds}\label{subsec_subc_alloc_jammer_bounds}
In the presence of jammer, even after subcarrier allocation at source is done, the problem is still combinatorial due to $\pi_{j_n}$. Any change in $P_{j_n}$ may even jeopardize the earlier decision on $\pi_{m,n}$ as described in the previous section. In-order to solve this issue, we first introduce the concept of rate improvement, which will help us decide $\pi_{j_n}$ retaining the decision on $\pi_{m,n}$.
\subsubsection{Selective jamming for secure rate improvement}\label{subsec_sel_jamm_rate_imp}
Since jammer affects all the users, it appears that using jammer over a subcarrier may degrade the secure rate.
But it is interesting to note that, with jammer power the secure rate can be improved beyond what is achieved without jammer.
For the proof of concept, let us consider a simple OFDMA scenario having four nodes: source, jammer, and two users $m$ and $e$.
Let a subcarrier $n$ be allocated to user $m$, and $e$ be the eavesdropper.
The following proposition describes the possibility of secure rate improvement and the existence of optimal jammer power achieving maximum secure rate over subcarrier $n$.
\begin{proposition}\label{prop_sri_jammer_rate_imp_constraints}
The secure rate over a subcarrier $n$ having $\lvert{h_{m,n}}|>|{h_{e,n}}|$ can be improved if $|{g_{e,n}}|>|{g_{m,n}}|$ and the source and jammer powers
$P_{s_n}$ and $P_{j_n}$ are constrained as
\begin{align}\label{eqn_pjn_rate_imp_cond}
P_{s_n}&>
\begin{cases}
\frac{ \sigma^2 \left( |g_{m,n}|^2 |h_{m,n}|^2 - |g_{e,n}|^2 |h_{e,n}|^2 \right) }{ \left( |g_{e,n}|^2 - |g_{m,n}|^2 \right) |h_{m,n}|^2 |h_{e,n}|^2 }, & \text{if } \frac{|g_{m,n}||h_{m,n}|}{|g_{e,n}||h_{e,n}|} > 1 \\
0, & \text{otherwise}
\end{cases} \nonumber\\
\text{and }
& P_{j_n} < \frac{P_{s_n} \alpha_n+\sigma^2 \beta_n} {|g_{m,n}|^2 |g_{e,n}|^2 \left( |h_{m,n}|^2- |h_{e,n}|^2 \right) } \triangleq P_{j_{n}}^{th_{i}}
\end{align}
where
$\alpha_n = \left( |g_{e,n}|^2 - |g_{m,n}|^2 \right) |h_{m,n}|^2 |h_{e,n}|^2$ and $\beta_n = \left( |g_{e,n}|^2 |h_{e,n}|^2 - |g_{m,n}|^2 |h_{m,n}|^2 \right)$.
In the constrained domain of rate improvement, the rate is a quasi-concave function of $P_{j_n}$ having a unique maxima.
\end{proposition}
\begin{proof}
See Appendix \ref{sec_appendix_proposition_rate_imp}.
\end{proof}
\emph{Example (continued):}
Observing the source gains in Table \ref{src_gain}, the best gain users of the subcarriers are $u_1, u_3, u_1, u_3, u_3$, respectively.
Users $u_3, u_2, u_2, u_1, u_2$ are their corresponding eavesdroppers.
Subcarriers $c_2, c_3, c_4$ satisfy the condition of secure rate improvement, i.e., $|g_{e,n}|>|g_{m,n}|$.
Considering the unit of transmit power is in Watt, let $P_S = 10$, $P_J=10$, and $\sigma^2=1$.
Source power thresholds for the three subcarriers are $P_{s_n}^{th_i} = 0.0, 0.0, 6.3263$, respectively.
Assuming equal source power allocation over all subcarriers ($P_{s_n} = 2$) and comparing $P_{s_n}$ with $P_{s_n}^{th_i}$, subcarriers $c_2, c_3$ can be utilized for secure rate improvement while $c_4$ cannot be used.
The corresponding jammer power thresholds for $c_2, c_3$ are respectively found as $P_{j_n}^{th_i} = 1.2693, 0.9560$.
Variation of SNRs of the users and the secure rate $R_{3,2}$ of user $u_3$ on subcarrier $c_2$ with jammer power $P_{j_2}$ are presented in Table \ref{carreir_2}.
As observed, $R_{3,2}$ with $P_{j_2}>0$ is higher compared to the value when $P_{j_2}=0$, till $P_{j_2}<P_{j_2}^{th_i} = 1.2693$. $R_{3,2}$ has a maxima between $P_{j_2}=0$ and $P_{j_2}=P_{j_2}^{th_i}$, at $P_{j_2}^o = 0.1027$.\hfill\textbf{$\Box$}
\begin{table}[!htb]
\caption{Users' SNRs and secure rate $R_{3,2}$ versus $P_{j_2}$}\label{carreir_2}
\centering
{\scriptsize
\begin{tabular}{|L{1cm} |L{1cm}| L{1cm}| L{1cm}| L{1cm}| L{1cm}| L{1cm}|}
\hline
{$P_{j_2} \to $} & {$0.0$} & {$0.1$} & {$0.2$} & {$1.2$} & {$1.3$} \\
\hline
{$SNR_{1}$} & {0.1487} & {0.0317} & {0.0178} & {0.0033} & {0.0030} \\
\hline
{$SNR_{2}$} & {1.1524} & {0.1925} & {0.1050} & {0.0189} & {0.0175} \\
\hline
{$SNR_{3}$} & {2.1821} & {1.5304} & {1.1784} & {0.3571} & {0.3339} \\
\hline
{$R_{3,2}$} & {0.6988} & {1.5518} & {1.4720} & {0.7239} & {0.6882}\\
\hline
\end{tabular}
}
\end{table}
Based on the results described in Proposition \ref{prop_sri_jammer_rate_imp_constraints}, we create a prospective set of subcarriers, over which the jammer power can be used for secure rate improvement.
The subcarrier allocation policy at jammer can be summarized as:
\begin{align}\label{subcarrier_alloc_jammer}
\pi_{j_n}=
\begin{cases}
1, & \text{if $|g_{e,n}|>|g_{m,n}|$}\\
0, & \text{otherwise.}
\end{cases}
\end{align}
While extending the result of Proposition \ref{prop_sri_jammer_rate_imp_constraints} to $M>2$, there is an inherent challenge associated with the allocation of $P_{j_n}$, which we refer as SNR reordering. Without loss of generality, let the channel gains from source-to-MUs be sorted as $|h_{1,n}|>|h_{2,n}|>\cdots>|h_{M,n}|$ over a subcarrier $n$ such that user 1 is assigned the subcarrier and user 2 is the eavesdropper. While optimizing source and jammer powers jointly, any update in $P_{s_n}$ does not disturb the resource assignments, but as $P_{j_n}$ is updated it raises the following two concerns:\\
(i) User 1 may not have the maximum SNR.\\
(ii) User 2 may not remain the corresponding eavesdropper.\\
Because of this SNR reordering challenge, for every $P_{j_n}$ update a new main user and the corresponding eavesdropper are to be determined.
This is the problem introduced by the $\max$ operator appearing in the rate definition
(\ref{secure_rate_definition}), which makes the joint source and jammer power allocation a tedious task even after $\{\pi_{m,n}\}$ and $\{\pi_{j_n}\}$ allocation.
In order to address this challenge we develop a strategy as described below.
\subsubsection{Bounds on jammer power to avoid SNR reordering}\label{subsubsec_ri_bounds}
In order to handle the $\max$ operator, we enforce certain constraints over jammer power so as to retain the same main user and the same eavesdropper throughout the jammer power allocation.
In order to retain the eavesdropper, the rate of user $e$ should be larger
than all other possible eavesdroppers, i.e.,
\begin{align}\label{eqn_jra_SPA_pjn_eve_bound}
\frac{P_{s_n} |h_{e,n}|^2}{\sigma^2 + P_{j_{n}}|g_{e,n}|^2} > \frac{P_{s_n} |h_{k,n}|^2}{\sigma^2 + P_{j_{n}}|g_{k,n}|^2}, \text{ }k \in \{1,\cdot \cdot M \} \setminus \{ m,e \}.
\end{align}
Similarly, to preserve the main user we need to have:
\begin{equation}\label{eqn_jra_SPA_pjn_main_eve_bound}
\frac{P_{s_n} |h_{m,n}|^2}{\sigma^2 + P_{j_{n}}|g_{m,n}|^2} > \frac{P_{s_n} |h_{e,n}|^2}{\sigma^2 + P_{j_{n}}|g_{e,n}|^2}.
\end{equation}
The constraints in (\ref{eqn_jra_SPA_pjn_eve_bound}) and (\ref{eqn_jra_SPA_pjn_main_eve_bound}) depend on channel conditions only, which result in lower and upper bounds over $P_{j_n}$ such that $P_{j_{k,n}}^u>P_{j_n}>P_{j_{k,n}}^l$. Since (\ref{eqn_pjn_rate_imp_cond}) enforces another upper bound on $P_{j_n}$, the final lower and upper bounds are given as
\begin{align}\label{jammer_power_bounds}
P_{j_{n}}^l = \underset{k} \max \{P_{j_{k,n}}^l\}; \quad P_{j_{n}}^u = \underset{k} \min \{P_{j_{n}}^{th_i}, P_{j_{k,n}}^u\}
\end{align}
\begin{remark}
Since $|h_{m,n}|$ $>$ $|h_{e,n}|$ $>$ $|h_{k,n}|$, hence (\ref{eqn_jra_SPA_pjn_eve_bound}) and (\ref{eqn_jra_SPA_pjn_main_eve_bound}) may result only in upper bounds, and lower bounds are zero. In case $P_{j_n}^l>P_{j_{n}}^u$, there is no feasible region for $P_{j_n}$ and subcarrier $n$ cannot be considered for rate improvement.
\end{remark}
\emph{
Example (continued):}
The SNR reordering issue can be explained with the help of jammer power variation over subcarrier $c_3$.
The respective SNRs of the users with $P_{j_3}$ variation are presented in Table \ref{carrier_3}.
From $P_{j_3}= 0$ to $0.4$, $u_1$ and $u_2$ are respectively the main user and the eavesdropper. At $P_{j_3} = 0.5$, the eavesdropper changes from $u_2$ to $u_3$ and this reduces the secure rate $R_{1,3}$ from $0.0616$ to $0.0315$. When $P_{j_3}$ increases to $0.7$, even the main user changes from $u_1$ to $u_3$, and now $u_1$ is the corresponding eavesdropper. Now, the secure rate of $u_3$ is $0.0048$, while that of $u_1$ is $0.0$. Though the jammer power threshold $P_{j_n}^{th_i}$ guarantees that, if $P_{j_n}<P_{j_n}^{th_i}$, the secure rate remains greater than that without jammer ($P_{j_n}=0$), this assertion relies on the basic assumption that the main user and the eavesdropper do not change. The jammer power threshold, optimum jammer power, and its upper bound to avoid SNR re-ordering on $c_3$ are respectively $P_{j_3}^{th_i} = 0.9560$, $P_{j_3}^o = 0.0808$, and $P_{j_{3,3}}^{u} = 0.4013$.
As soon as
$P_{j_{3}}>P_{j_{3}}^{u} = \min\{P_{j_3}^{th_i},P_{j_{3,3}}^{u}\} = 0.4013$,
the SNR order changes and $R_{1,3}$ is also reduced.
This issue did not arise in $c_2$ as there was no finite jammer power upper bound $P_{j_{1,2}}^{u}$. \hfill\textbf{$\Box$}
After decision of $\pi_{m,n}$ and $\pi_{j_n}$, combinatorial aspect of the problem is resolved if $P_{j_n}$ remains within bounds. Next we consider the joint source and jammer power allocation.
\begin{table}[!htb]
\caption{Users' SNRs and secure rate $R_{1,3}$ versus $P_{j_3}$}\label{carrier_3}
\centering
{\scriptsize
\begin{tabular}{|L{1cm} |L{1cm}| L{1cm}| L{1cm}| L{1cm}| L{1cm}| L{1cm}|}
\hline
{$P_{j_3}\to $} & {$0.0$} & {$0.1$} & {$0.4$} & {$0.5$} & {$0.7$} \\
\hline
{$SNR_{1}$} & {0.4514} & {0.2086} & {0.0798} & {0.0662} & {0.0493} \\
\hline
{$SNR_{2}$} & {0.4301} & {0.1602} & {0.0556} & {0.0456} & {0.0336} \\
\hline
{$SNR_{3}$} & {0.0624} & {0.0605} & {0.0554} & {0.0539} & {0.0512} \\
\hline
{$R_{1,3}$} & {0.0328} & {0.1020} & {0.0616} & {0.0315} & {0.0000} \\
\hline
\end{tabular}
}
\end{table}
\subsection{Joint optimization of source and jammer power }\label{subsec_ri_jpa}
After the decision on utilization of jammer power based on Proposition \ref{prop_sri_jammer_rate_imp_constraints}, all subcarriers can be categorized in two sets: $\{ \mathcal{J}_0 \}$ - the ones that do not use jammer power ($\pi_{j_n}=0$), and $\{\mathcal{J}_1 \}$ - the others that use jammer power ($\pi_{j_n}=1$).
Let $\gamma_{m,n}$ and $\gamma_{m,n}'$ respectively denote the SNRs of the user $m$, without jammer power and with jammer power over subcarrier $n$, i.e.,
\begin{align}\label{eqn_jra_sja_snr_definition}
\gamma_{m,n} = \frac{P_{s_n} |h_{m,n}|^2}{\sigma^2}; \quad \gamma_{m,n}' = \frac{P_{s_n} |h_{m,n}|^2}{\sigma^2 + P_{j_n} |g_{m,n}|^2} .
\end{align}
The joint power allocation problem can be stated as
\begin{align}\label{opt_prob_jra_SPA_src_jamm_power}
& \underset{P_{s_x}, P_{s_y}, P_{j_y}}{\text{maximize}}
\left\{ \sum_{x \in \mathcal{J}_0} w_x'\left[ \log_2 ( 1+\gamma_{m,x} ) - \log_2 ( 1+\gamma_{e,x} ) \right] \right. \nonumber \\
& \left. \qquad + \sum_{y \in \mathcal{J}_1} w_y' \left[ \log_2 ( 1+ \gamma_{m,y}') - \log_2 ( 1+ \gamma_{e,y}' ) \right] \right \} \nonumber \\
& \text{subject to} \nonumber \\
& C_{2,1}: \sum_{x \in \mathcal{J}_0} P_{s_x} + \sum_{y \in \mathcal{J}_1} P_{s_y} \leq P_S, \quad C_{2,2}: \sum_{y \in \mathcal{J}_1} P_{j_y} \leq P_J,\nonumber \\
& C_{2,3}: P_{j_y} > P_{j_{y}}^l \text{ } \forall \text{ } y \in \mathcal{J}_1, \quad C_{2,4}: P_{j_y} < P_{j_{y}}^u \text{ } \forall \text{ } y \in \mathcal{J}_1,\nonumber \\
& C_{2,5}: P_{s_x}\ge 0, P_{s_y}\ge 0 \text{ } \forall \text{ } x\in \mathcal{J}_0,y\in \mathcal{J}_1
\end{align}
where $w_n'$ is the weight of the main user $m$ over the $n$th subcarrier.
$C_{2,1}$ and $C_{2,2}$ are the power budget constraints.
Constraints $C_{2,3}$ and $C_{2,4}$ are imposed to tackle the SNR re-ordering challenge (cf. Section \ref{subsubsec_ri_bounds}), while the boundary constraints for source power are captured in $C_{2,5}$.
The source power has to be shared among the subcarriers' set $\{ \mathcal{J}_0 \}$ and $\{ \mathcal{J}_1 \}$, while the jammer power has to be allocated on the subcarriers of set $\{ \mathcal{J}_1 \}$ only.
We observe that source power is a coupling variable between the power allocation problem over the complementary sets $\{ \mathcal{J}_0 \}$ and $\{ \mathcal{J}_1 \}$, and $C_{2,1}$ is the corresponding complicating constraint.
Since the secure rate over a subcarrier is an increasing function of source power, the problem has to be solved at full source power budget $P_S$.
The optimization problem (\ref{opt_prob_jra_SPA_src_jamm_power}) can be solved using
\emph{primal decomposition} (PD) procedure by dividing it into one master problem (outer loop) and two subproblems (inner loop) \cite{sboyd_decomposition}.
The first subproblem is source power allocation over set $\{ \mathcal{J}_0 \}$, and second is joint source and jammer power allocation over set $\{ \mathcal{J}_1 \}$.
The subproblem-1 can be stated as: \\%follows: \\
\textbf{\textit{Subproblem-1}}
\begin{align}\label{opt_prob_jra_src_power_p1}
& \underset{P_{s_x}}{\text{maximize}}
\sum_{x \in \mathcal{J}_0} w_x' \left[ \log_2 ( 1+\gamma_{m,x} ) - \log_2 ( 1+\gamma_{e,x} ) \right] \nonumber \\
& \text{subject to} \nonumber \\
& C_{3,1}: \sum_{x \in \mathcal{J}_0} P_{s_x} \leq t, \quad C_{3,2}: P_{s_x}\ge 0 \text{ } \forall \text{ } x \text{ } \in \mathcal{J}_0
\end{align}
where $t$, representing the coupling variable, is the source power budget allotted to subproblem-1.
The source power budget to subproblem-2 is $P_S-t$, as described in the following:\\
\textbf{\textit{Subproblem-2}}
\begin{align}\label{opt_prob_jra_SPA_src_jamm_power_p2}
& \underset{P_{s_y}, P_{j_y}}{\text{maximize}}
\sum_{y \in \mathcal{J}_1} w_y' \left[ \log_2 ( 1+ \gamma_{m,y}') - \log_2 ( 1+ \gamma_{e,y}' ) \right] \nonumber\\
& \text{subject to} \nonumber \\
& C_{4,1}: \sum_{y \in \mathcal{J}_1} P_{s_y} \leq P_S - t, \quad C_{4,2}: \sum_{y \in \mathcal{J}_1} P_{j_y} \leq P_J, \nonumber \\
& C_{4,3}: P_{j_y} > P_{j_{y}}^l \text{ } \forall \text{ } y \in \mathcal{J}_1, \quad C_{4,4}: P_{j_y} < P_{j_{y}}^u \text{ } \forall \text{ }y \in \mathcal{J}_1, \nonumber \\
& C_{4,5}: P_{s_y}\ge 0 \text{ } \forall \text{ } y \in \mathcal{J}_1.
\end{align}
The two subproblems are solved independently for a fixed $t$. Once the solutions of both the subproblems are obtained, the master problem is solved using subgradient method by updating the coupling variable $t$ as $t := t - \xi(\lambda_2-\lambda_1)$, where $\xi$ is an appropriate step size \cite{sboyd_subgradient} and $\lambda_1$, $\lambda_2$ are the Lagrange multipliers \cite{sboyd_decomposition} corresponding to the source power constraints in subproblems (\ref{opt_prob_jra_src_power_p1}) and (\ref{opt_prob_jra_SPA_src_jamm_power_p2}), respectively. This procedure of updating $t$ is repeated until either the sum secure rate saturates or the iteration count exceeds a threshold.
\subsubsection{Solution of subproblem-1}
\label{subsubsec_ri_alloc_ps}
Since each subcarrier is allocated to the best gain user (cf. Section \ref{subsec_subc_alloc_src}), $|h_{m,x}| > |h_{e,x}|$ $\forall$ $x$ $\in$ $\{ \mathcal{J}_0 \}$. Thus, the objective function in (\ref{opt_prob_jra_src_power_p1}) is a concave function of $P_{s_{x}}$. The optimal $P_{s_{x}}^*$ obtained after solving the Karush-Kuhn-Tucker (KKT) conditions is given as
\begin{align}\label{eqn_woj_opt_src_power_allocation}
P_{s_{x}}^* = f \left( \frac{\sigma^2}{|h_{m,x}|^2},\frac{\sigma^2}{|h_{e,x}|^2},\frac{4w_x'}{\lambda_1 \ln 2} \right)
\end{align}
where $f$ is defined as follows:
\begin{align}\label{function_definition}
f(\eta, \nu, \kappa) = - \frac{1}{2} \left[ \left(\nu+\eta\right) - \sqrt{\left(\nu-\eta\right)^2 + \kappa\left(\nu-\eta\right) }\right]^+
\end{align}
$\lambda_1$, associated with $C_{3,1}$, is found such that $\sum_{x \in \mathcal{J}_0} P_{s_x} = t$.
\subsubsection{Solution of subproblem-2}\label{subsubsec_ri_alloc_ps_pj}
In order to solve the subproblem-2, we observe that the secure rate over the subcarriers of set $\{\mathcal{J}_1\}$ is a concave function of source power $P_{s_y}$ for a fixed jammer power $P_{j_y}$, and also a quasi-concave function of $P_{j_y}$ for a fixed $P_{s_y}$ as shown in Proposition \ref{prop_sri_jammer_rate_imp_constraints}. This motivates us to use the method of \emph{alternating optimization} (AO) \cite{sboyd_alternating} for joint power optimization, which alternates between source and jammer power optimizations.
The AO method starts with $P_{s_y} = \frac{P_S-t}{|\mathcal{J}_1|}$, i.e., equal power over all the subcarriers of set $\{ \mathcal{J}_1 \}$, and for the known $P_{s_y}$ optimal $P_{j_y}$ allocation is done. For a fixed source power, the jammer power allocation problem can be stated as:
\begin{align}\label{opt_prob_jra_SPA_src_jamm_power_p2_eq_ps}
& \underset{P_{j_y}}{\text{maximize}}
\sum_{y \in \mathcal{J}_1} w_y' \left[ \log_2 ( 1+ \gamma_{m,y}') - \log_2 ( 1+ \gamma_{e,y}' ) \right] \nonumber \\
& \text{subject to} \nonumber \\
& C_{5,1}: \sum_{y \in \mathcal{J}_1} P_{j_y} \leq P_J, \qquad C_{5,2}: P_{j_y} > P_{j_{y}}^l \text{ } \forall \text{ } y \in \mathcal{J}_1, \nonumber \\
& C_{5,3}: P_{j_y} < P_{j_{y}}^u \text{ } \forall \text{ } y \in \mathcal{J}_1.
\end{align}
Since the secure rate over a subcarrier $y \in \{ \mathcal{J}_1 \}$ achieves a maxima at a unique jammer power $P_{j_y}^{o}$ (cf. Proposition \ref{prop_sri_jammer_rate_imp_constraints}). So, first we evaluate optimal $P_{j_y}^\star \forall y$ for achieving maximum secure rate, respecting the jammer power bounds as follows:
\begin{align}\label{opt_jammer_power_in_bounds}
P_{j_y}^\star=
\begin{cases}
P_{j_{y}}^l + \delta, & \text{if $P_{j_y}^{o} < P_{j_{y}}^l$} \\
P_{j_{y}}^u - \delta, & \text{if $P_{j_y}^{o} > P_{j_{y}}^u$} \\
P_{j_y}^{o}, & \text{otherwise}
\end{cases}
\end{align}
where $\delta$ is a small positive number. Note that, in secure rate improvement $P_{j_{y}}^l=0$ and $P_{j_y}^{o}>0$, so first case does not arise.
If the condition $\sum_{y \in \mathcal{J}_1} P_{j_y}^\star \leq P_J$ is satisfied, then optimum jammer power is allocated over all subcarriers, i.e., $P_{j_y} = P_{j_y}^\star \forall y \in \{ \mathcal{J}_1 \}$.
Otherwise the problem (\ref{opt_prob_jra_SPA_src_jamm_power_p2_eq_ps}) is solved under jammer power budget constraint.
The partial Lagrangian of the problem (\ref{opt_prob_jra_SPA_src_jamm_power_p2_eq_ps}) is given in (\ref{eqn_jra_ao_p2_lagrange_function}).
\begin{figure*}[!t]
\begin{align}\label{eqn_jra_ao_p2_lagrange_function}
L(P_j, \mu ) = \sum_{y \in \mathcal{J}_1} w_y' \left[ \log_2 \left( 1+\frac{P_{s_y}|h_{m,y}|^2}{\sigma^2 + P_{j_y} |g_{m,y}|^2} \right)
- \log_2 \left( 1+\frac{P_{s_y} |h_{e,y}|^2}{\sigma^2 + P_{j_y} |g_{e,y}|^2} \right) \right]
+ \mu \left( P_J - \sum_{y \in \mathcal{J}_1} P_{j_y} \right)
\end{align}
\hrulefill
\end{figure*}
After setting first-order derivative of the Lagrangian in (\ref{eqn_jra_ao_p2_lagrange_function}) equal to zero, we obtain a fourth-order nonlinear equation in $P_{j_y}$ having following form
\begin{align}\label{eqn_jra_ao_p2_non_linear_equation}
& \left( \frac{\mu \ln 2}{w'_y} \right) \left( a_yP_{j_y}^4 + b_y P_{j_y}^3 + c_y P_{j_y}^2 + d_y P_{j_y} + e_y \right) \nonumber \\
& \qquad \qquad = P_{s_y} \left( c_y' P_{j_y}^2 + d_y' P_{j_y} + e_y' \right).
\end{align}
The coefficients of the equation (\ref{eqn_jra_ao_p2_non_linear_equation}) are tabulated in Table \ref{non_linear_equation_coefficients}. In the domain $[0,P_{j_y}^\star)$, the secure rate is a concave increasing function (cf. Proposition \ref{prop_sri_jammer_rate_imp_constraints}) and since $\sum_{y \in \mathcal{J}_1} P_{j_y}^\star > P_J$, depending on $\mu$, there exists a single positive real root $P_{j_y}^{r} ( < P_{j_y}^{\star})$ of (\ref{eqn_jra_ao_p2_non_linear_equation}). After obtaining $P_{j_y}^{r}$ for a fixed value of $\mu$, $\mu$ is updated using the subgradient method \cite{sboyd_subgradient}.
For constrained jammer power budget, optimal jammer power $P_{j_y}^{\diamond}$ is obtained after constraining $P_{j_y}^{r}$ between jammer power bounds as in (\ref{opt_jammer_power_in_bounds}).
Thus, $P_{j_{y}}$ allocation for fixed $P_{s_y}$ can be written as:
\begin{equation}\label{jammer_power_allocation_subpoblem_2}
P_{j_{y}}=
\begin{cases}
P_{j_y}^{\star}, & \text{if } \sum_{y \in \mathcal{J}_1} P_{j_y}^{\star} \leq P_J\\
P_{j_y}^{\diamond}, & \text{otherwise.}
\end{cases}
\end{equation}
For a known $P_{j_{y}}$, the AO method now obtains $P_{s_{y}}$ based on (\ref{eqn_woj_opt_src_power_allocation}) with the source power's coefficient being $\frac{|h_{m,y}|^2}{\sigma^2 + P_{j_y}|g_{m,y}|^2}$, instead of $\frac{|h_{m,y}|^2}{\sigma^2}$. This completes one iteration of the AO method. This procedure of optimizing source and jammer powers alternatively continues until either the secure rate saturates or the iteration count exceeds a threshold. A PD and AO based Joint Power Allocation (JPA) scheme for weighted sum secure rate maximization is presented in Algorithm \ref{global_optimization_algo_rate_imp}.
\begin{remark}
During power optimization in AO, if the jammer power over some of the subcarriers in $\{ \mathcal{J}_1 \}$ is zero, then these subcarriers are taken out of $\{ \mathcal{J}_1 \}$ and added back into $ \{ \mathcal{J}_0 \}$ for source power allocation in the next iteration of PD procedure.
\end{remark}
\begin{table*}[!tbh]
\renewcommand{\arraystretch}{1.}
\caption{Coefficients of the non linear equation (\ref{eqn_jra_ao_p2_non_linear_equation})} \label{non_linear_equation_coefficients}
\centering
\begingroup\makeatletter\def\f@size{9}\check@mathfonts
\begin{tabular}{l}
\hline
${a_y}$ = $\left( |g_{e,y}|^2 |g_{m,y}|^2 \right)^2$; \text{ }
${b_y}$ = $|g_{e,y}|^2 |g_{m,y}|^2 \left\{ 2\sigma^2 \left( |g_{e,y}|^2 + |g_{m,y}|^2 \right) + P_{s_y} \left(|g_{m,y}|^2 |h_{e,y}|^2 + |g_{e,y}|^2 |h_{m,y}|^2 \right) \right\}$; \\
${c_y}$ = $ P_{s_y}^2 |g_{e,y}|^2 |g_{m,y}|^2 |h_{e,y}|^2 |h_{m,y}|^2 + P_{s_y} \sigma^2 \left\{|g_{m,y}|^2|h_{e,y}|^2 \left( |g_{m,y}|^2 + 2|g_{e,y}|^2 \right) + |g_{e,y}|^2 |h_{m,y}|^2 \left( |g_{e,y}|^2 + 2|g_{m,y}|^2 \right) \right\}$ \\
$+ \sigma^4 \left\{ \left( |g_{e,y}|^2 \right) ^2 + \left( |g_{m,y}|^2 \right) ^2 +4|g_{e,y}|^2|g_{m,y}|^2 \right\}$; \\
${d_y}$ = $\left( |g_{e,y}|^2 + |g_{m,y}|^2 \right) \left\{ 2\sigma^4 + P_{s_y}\sigma^2 \left( |h_{m,y}|^2 + |h_{e,y}|^2 \right) + P_{s_y}^2|h_{m,y}|^2|h_{e,y}|^2 \right\} + P_{s_y}\sigma^4 \left(|g_{m,y}|^2 |h_{e,y}|^2 + |g_{e,y}|^2 |h_{m,y}|^2 \right)$; \\
${e_y}$ = $\sigma^4 \left( \sigma^2+P_{s_y}|h_{e,y}|^2 \right) \left( \sigma^2+P_{s_y}|h_{m,y}|^2 \right)$; \text{ }
${c_y'}$ = $|g_{e,y}|^2 |g_{m,y}|^2 \left(|g_{m,y}|^2 |h_{e,y}|^2 - |g_{e,y}|^2 |h_{m,y}|^2 \right)$; \\
${d_y'}$ = $2|g_{e,y}|^2|g_{m,y}|^2\sigma^2 \left( |h_{e,y}|^2-|h_{m,y}|^2 \right)$; \text{ }
${e_y'}$ = $\sigma^4 \left( |g_{e,y}|^2|h_{e,y}|^2-|g_{m,y}|^2|h_{m,y}|^2 \right) + \sigma^2P_{s_y}|h_{e,y}|^2|h_{m,y}|^2 \left( |g_{e,y}|^2-|g_{m,y}|^2 \right)$;\\
\hline
\end{tabular}
\endgroup
\end{table*}
\subsubsection{Convergence of joint power allocation}
The source power allocation is done through PD with $(\lambda_2-\lambda_1)$ as the subgradient. The secure rate is a concave increasing function of source power in subproblem-1 and for a fixed jammer power, in subproblem-2. Thus, $\lambda_1$ and $\lambda_2$ are positive and bounded. Hence, $(\lambda_2-\lambda_1)$ is bounded and the method converges to an $\epsilon$-optimal value in finite number of steps \cite{sboyd_subgradient}.
The authors in \cite{HMWANG_TIFS_2014} have shown with the help of Bolzano-Weirerstrass theorem and \cite{Grippo_ORL_2000} that, AO method converges for a problem which is concave in one set of variable and quasi-concave with unique maxima in another set. Hence, the joint power allocation based on PD and AO converges.
\begin{algorithm}
{\small
\caption{Proposed Sum Secure Rate Maximization}
\label{global_optimization_algo_rate_imp}
\begin{algorithmic}[1]
\Procedure{}{}
\State \noindent\textbf{Subcarrier Allocation:}
\For {every subcarrier $n$}
\State find $k = \arg \underset{m \in \left\{ 1,M \right\} } \max |h_{m,n}|$
\EndFor
\State \noindent\textbf{Subcarrier set creation:}
\State {Init} $\mathcal{J}_0 = \phi$ and $\mathcal{J}_1 = \phi$
\For {every subcarrier $n$}
\If{$(|g_{e,n}|^2>|g_{m,n}|^2)$}
\State compute $P_{s_{n}}^{th_i}$ and $P_{j_{n}}^{th_i}$
\State $\mathcal{J}_1 = \mathcal{J}_1 + n$
\Else
\State $\mathcal{J}_0 = \mathcal{J}_0 + n$
\EndIf
\EndFor
\State \noindent\textbf{Source and Jammer Power Allocation:}
\State \underline{primal decomposition begins}
\State {Init} $t$, $iter_o = 0$
\State compute $P_{s_x} \text{ } \forall \text{ }x \text{ } \in \text{ } \mathcal{J}_0$ for $P_S = t$ according to (\ref{eqn_woj_opt_src_power_allocation})
\State \underline{alternate optimization begins}
\State {Init} $ iter_i = 0; P_{s_y} = \frac{P_S-t}{| \mathcal{J}_1 |} \text{ } \forall \text{ }y \text{ } \in \text{ } \mathcal{J}_1$
\State compute $P_{s_{y}}^{th_i}, P_{j_{y}}^{th_i}$, $P_{j_{y}}^{\diamond}$ and $P_{j_{y}}^{\star} \text{ } \forall \text{ }y \text{ } \in \text{ } \mathcal{J}_1$
\State allocate $P_{j_y}$ according to (\ref{jammer_power_allocation_subpoblem_2})
\State allocate $P_{s_y}$ with $P_S = P_S-t$ according to (\ref{eqn_woj_opt_src_power_allocation})
\State $iter_i = iter_i + 1$
\State iterate till either rate improves or $iter_i \leq iter_i^{max}$
\State \underline{alternate optimization ends}
\State update $t$
\State $iter_o = iter_o + 1;$
\State iterate till either rate improves or $iter_o \leq iter_o^{max}$
\State \underline{primal decomposition ends}
\EndProcedure
\end{algorithmic}
}
\end{algorithm}
\subsection{Solution with reduced complexity for rate maximization}
\label{easy_sol_rate_max}
The complexity involved in joint source and jammer power optimization (discussed in Section \ref{complexity_analysis_rate_imp}) can be reduced to a large extent by allocating source and jammer powers sequentially instead \cite{ravikant_ICC_2015}.
Initially assuming the jammer to be absent, subcarrier allocation is done using (\ref{subcarrier_alloc_policy}) and the source power optimization is done using (\ref{eqn_woj_opt_src_power_allocation}).
After creating subcarrier set $\{ I_m \}$ of user $m$ (using (\ref{subcarrier_alloc_jammer})), over which the secure rate can be improved, the resource allocation problem is attended with jammer power allocation.
The optimization problem of $P_{j_{m,n}}$ (to aid user $m$ over subcarrier $n$) can be written as:
\begin{align}\label{subopt_jammer_power_allocation_problem}
& \underset{P_{j_{m,n}}}{\text{maximize}}
\sum_{m=1}^M w_m \left[ \sum_{n \in I_m} \left\{ \log_2 \left( \frac{1+\frac{P_{s_n} |h_{m,n}|^2}{\sigma^2 + P_{j_{m,n}} |g_{m,n}|^2}} {1+\frac{P_{s_n} |h_{e,n}|^2}{\sigma^2 + P_{j_{m,n}} |g_{e,n}|^2}} \right) \right\} \right] \nonumber \\
& \text{subject to} \nonumber \\
& C_{6,1}: \sum_{m=1}^M \sum_{n \in I_m} P_{j_{m,n}} \leq P_J, \quad C_{6,2}: P_{j_{m,n}} < P_{j_{m,n}}^u \forall \text{ } n \in I_m \nonumber \\
& C_{6,3}: P_{j_{m,n}} > P_{j_{m,n}}^l \forall \text{ } n \in I_m
\end{align}
where $P_{j_{m,n}}^l$ and $P_{j_{m,n}}^u$ are the lower and upper bounds on $P_{j_{m,n}}$, respectively.
If $x>y$, the inequality $\frac{1+x}{1+y}<\frac{x}{y}$ can be used to convert the objective function into a concave function which upper bounds the achievable secure rate of (\ref{subopt_jammer_power_allocation_problem}).
\begin{figure*}[!t]
\begin{align}\label{subopt_lagrange_function}
L(P_j, \lambda) =
& \sum_{m=1}^M w_m \left[ \sum_{n \in I_m} \left\{ \log_2 \left( \frac{|h_{m,n}|^2}{\sigma^2 + P_{j_{m,n}}|g_{m,n}|^2} \right)
- \log_2 \left( \frac{|h_{e,n}|^2}{\sigma^2 + P_{j_{m,n}}|g_{e,n}|^2} \right) \right\} \right]
+ \lambda(P_J - \sum_{m=1}^M \sum_{n \in I_m} P_{j_{m,n}})
\end{align}
\hrulefill
\end{figure*}
The partial Lagrangian of the simplified problem is given in (\ref{subopt_lagrange_function}). Setting the first derivative of the Lagrangian equal to zero, we obtain a quadratic equation in $P_{j_{m,n}}$ as:
\begin{align}\label{rate_imp_quadratic}
P_{j_{m,n}}^2 |g_{m,n}|^2 |g_{e,n}|^2 + P_{j_{m,n}} \sigma^2 \left( |g_{m,n}|^2 + |g_{e,n}|^2 \right) \nonumber \\
+ \sigma^4 - \sigma^2 \left( \frac{w_m}{\lambda \ln 2} \right) \left( |g_{e,n}|^2 - |g_{m,n}|^2 \right) = 0.
\end{align}
The solution $P_{j_{m,n}}^*$ of (\ref{rate_imp_quadratic}) is obtained as
\begin{align}\label{sub_opt_jammer_power}
P_{j_{m,n}}^* = f \left( \frac{\sigma^2}{|g_{e,n}|^2},\frac{\sigma^2}{|g_{m,n}|^2},\frac{4w_m}{\lambda \ln 2} \right)
\end{align}
where $f$ is defined in (\ref{function_definition}) and $\lambda$ is obtained such that $\sum_{m=1}^M \sum_{n \in I_m} P_{j_{m,n}}^* = P_J$. This scheme works fine till $\sum_{m=1}^M \sum_{n \in I_m} P_{j_{m,n}}^u$ $>$ $P_J$. When $\sum_{m=1}^M \sum_{n \in I_m} P_{j_{m,n}}^u$ $\leq$ $P_J$, the scheme allocates $P_{j_{m,n}}$ $=$ $P_{j_{m,n}}^u - \delta$ which results in degraded performance. In order to solve this issue we allocate $P_{j_{m,n}}$ $=$ $(P_{j_{m,n}}^l+P_{j_{m,n}}^u)/2$. Thus, $P_{j_{m,n}}$ is allocated as:
\begin{align}\label{jammer_power_allocation}
P_{j_{m,n}}=
\begin{cases}
P_{j_{m,n}}^*, & \text{if } \sum_{m=1}^M\sum_{n \in I_m} P_{j_{m,n}}^u > P_J\\
\frac{P_{j_{m,n}}^l + P_{j_{m,n}}^u}{2}, & \text{otherwise.}
\end{cases}
\end{align}
The suboptimal scheme
actually maximizes the upper bound of the jammer power allocation problem (\ref{subopt_jammer_power_allocation_problem}).
As anticipated the suboptimal solution referred as JPASO has degraded secure rate
performance compared to JPA as shown in Section \ref{sec_results}.
\subsection{Complexity analysis}\label{complexity_analysis_rate_imp}
Here we analyze complexity of the proposed algorithms for secure rate improvement.
The computation complexity of jammer power upper and lower bound for each subcarrier is $O(NM)$.
The PD procedure first optimizes source power over $N_1(=|\mathcal{J}_0|)$ subcarriers that do not utilize jammer power, in $N_1\log(N_1)$ computations \cite{W_Yu_TCOM_2006}.
The AO procedure optimizes source as well as jammer power over the leftover $N_2=N-N_1$ subcarriers alternatively in $N_2 \log(N_2)$ computations.
Let us denote that AO takes $I_{ao}$ iterations and PD takes $I_{pd}$ subgradient updates for convergence. Then, the total complexity of JPA can be obtained as $O(NM + I_{pd} N_1 \log(N_1) + I_{ao} I_{pd} N_2 \log(N_2))$.
The worst case computational complexity
when $N_2 \simeq N$, is $O(I_{ao} I_{pd} N \log(N))$.
JPASO initially optimizes source power over all the subcarriers in $O(N \log(N))$ computations and then optimizes jammer power over $N_2$ subcarriers with complexity $O(N_2 \log(N_2))$.
Thus, the worst case complexity of JPASO is $O(N \log(N))$.
\section{Fair resource allocation}
\label{sec_max_min_fairness}
Allocating a subcarrier to its best gain user is an optimal sum rate maximization strategy in non-secure OFDMA systems \cite{Rhee2000}, \cite{Jang2003}.
In contrast, secure OFDMA with untrusted users in the absence of jammer has in general no other option but to allocate a subcarrier to its best gain user.
This may cause some users to starve for resources and may lead to poor fairness performance.
The concept of generalized $\alpha$-fairness was introduced in \cite{Altman_alpha_2008}, where $\alpha=0$ corresponds to sum rate maximization, $\alpha=1$ corresponds to proportional fairness, and $\alpha \to \infty$ leads to max-min fairness.
With appropriate selection of the user priority weights, the performance of the first two scenarios, i.e., with $\alpha=0$ and $\alpha=1$, can be captured by the sum rate maximization strategy discussed in Section \ref{sec_sum_rate_imp}.
In this section we explicitly look at the inherent challenges associated with max-min fair resource allocation in secure OFDMA.
\subsection{Max-min fairness scheme for secure OFDMA}
In secure OFDMA the max-min fair resource allocation problem in presence of jammer can be stated as follows:
\begin{align}\label{max_min_optimization_problem}
& \underset{P_{s_n}, P_{j_n}, \pi_{m,n}, \pi_{j_n}} {\text{maximize}} \underset{m}\min \sum_{n=1}^N \pi_{m,n} R_{m,n} \nonumber \\
& \text{subject to}
\quad C_{1,1}, C_{1,2}, C_{1,3}, C_{1,4}, C_{1,5}, C_{1,6} \text{ as in } (\ref{opt_prob_jra_rate_max}).
\end{align}
In non-secure OFDMA, because of high computation complexity involved in finding the optimal solution, the authors in \cite{Rhee2000, Mohanram_CL_2005} proposed suboptimal solutions for the max-min problem.
In secure OFDMA with untrusted users and a jammer, complexity of the problem increases further due to the presence of $\max$ operator in secure rate definition (cf. (\ref{secure_rate_definition})) and the addition of two variables, namely $\pi_{j_n}$ and $P_{j_n}$.
Also, the conventional max-min algorithm \cite{Rhee2000} cannot be directly used in secure OFDMA because the algorithm may get stuck in an infinite loop.
In other words, if a least-rate user does not have maximum SNR over any of the leftover subcarriers, this user gets the algorithm into a deadlock state in the `while loop', as its rate cannot be improved.
In order to address the deadlock problem associated with the conventional max-min fairness in our considered jammer assisted secure OFDMA, we propose a modified max-min fairness, which uses a novel concept of subcarrier snatching discussed below.
\subsection{Subcarrier snatching and maximum rate achievability}
In non-secure OFDMA, a user is poor if its average channel gain is relatively low compared to other users.
The source can help such users by either implementing max-min fairness strategy, or transmitting at higher power, or using both.
In secure OFDMA a poor user is the one who, in-spite of having good channel gain on main channel, has a very strong eavesdropper causing its secure rate close to zero.
This user cannot be helped much by increasing the source transmission power
because rate of the eavesdropper also increases with source power.
Thus, with randomly distributed users, source has very limited maneuverability to help such a poor user.
Below, we introduce the concept of subcarrier snatching with the help of jammer, which is utilized in the proposed max-min fair resource allocation (described in Section \ref{proposed_max_min_scheme}).
Let us reconsider an OFDMA system consisting of four nodes: source, jammer, and users $m$ and $e$. Let us assume that over a subcarrier $n$ gain of $e$ is higher than that of $m$ i.e., $|h_{e,n}|>|h_{m,n}|$. Originally this subcarrier should be allocated to best gain user $e$, but jammer power can be utilized to snatch this subcarrier from user $e$ and allocate to user $m$. The following Proposition describes the conditions of subcarrier snatching and the existence of unique maxima with $P_{j_n}$.
\begin{proposition}\label{prop_max_min_subcarrier_snatching}
In secure OFDMA, a user $m$ can snatch subcarrier $n$ from its best gain user $e$
when channel gains are such that $|g_{e,n}|^2 |h_{m,n}|^2 > |g_{m,n}|^2 |h_{e,n}|^2 $ and jammer power is above the following threshold:
\begin{align}\label{eqn_pjn_subcarrier_snatching}
P_{j_n} >P_{j_{n}}^{th_s} = \frac {\sigma^2 \left( |h_{e,n}|^2 - |h_{m,n}|^2 \right)} {|g_{e,n}|^2 |h_{m,n}|^2 - |g_{m,n}|^2 |h_{e,n}|^2}.
\end{align}
The secure rate achieved over a snatched subcarrier has a quasi-concave nature, achieving a unique maxima with $P_{j_n}$.
\end{proposition}
\begin{IEEEproof}
See Appendix \ref{sec_appendix_proposition_carr_snatch}.
\end{IEEEproof}
Thus, under certain channel conditions, a subcarrier can be snatched from its best gain user after allocating sufficient jammer power. The secure rate over the snatched subcarrier is not a monotonically increasing function of jammer power due to the interplay between channel coefficients, and source and jammer powers. In fact, there exists an optimal jammer power achieving maximum secure rate over the snatched subcarrier.
Due to SNR reordering, (\ref{eqn_jra_SPA_pjn_eve_bound}) may result only in upper bounds as $|h_{e,n}|>|h_{k,n}|$, while (\ref{eqn_jra_SPA_pjn_main_eve_bound}) leads to lower bounds (cf. \eqref{eqn_pjn_subcarrier_snatching}).
\emph{
Example (continued):}
Following the strategy of allocating subcarrier to its best gain user, $c_1$ and $c_3$ can be allocated to $u_1$, and $c_2$, $c_4$, and $c_5$ can be allocated to $u_3$.
Hence, $u_2$ is left without any subcarrier.
If we follow conventional max-min approach \cite{Rhee2000}, both $u_1$ and $u_3$ are assigned a subcarrier each in the `for loop', but the algorithm will get stuck in the `while loop' as the secure rate of $u_2$ cannot be improved further.
If jammer power is utilized, $u_2$ can snatch subcarrier $c_4$ from $u_3$.
We can observe this from the variation of secure rate $R_{2,4}$ of $u_2$ over $c_4$ with $P_{j_4}$.
The secure rate is $R_{2,4}=0.0, 0.2186, 0.5646, 0.5652, 0.5649$ when $P_{j_4} = 0.1, 0.2, 0.9, 0.9587, 1.0$, respectively.
$P_{j_4}^{th_s} = 0.1138$ and $P_{j_4}^o = 0.9587$ (cf. Proposition \ref{prop_max_min_subcarrier_snatching}).
Thus, $R_{2,4}>0$ when $P_{j_4}>P_{j_4}^{th_s}$, and $R_{2,4}$ has a maxima at $P_{j_4}=P_{j_4}^o$. \textbf{$\Box$}
\subsection{Proposed modified max-min fairness scheme}\label{proposed_max_min_scheme}
Our proposed max-min fairness scheme uses the concept of subcarrier snatching and also removes the possibility of algorithm getting locked in `while loop'.
Assuming equal source and jammer power allocation in the initialization phase, the algorithm finds two sets of subcarriers for each user $m$: $\{B_m\}$ and $\{S_m\}$. $\{B_m\}$, hereafter referred as best subcarriers of user $m$, contains those subcarriers over which user $m$ has the best channel gain, and $\{S_m\}$ contains those subcarrier which the user $m$ can snatch from its best gain user with the help of jammer. The algorithm initially assumes all the users to be active users, and stores the threshold jammer powers required for snatching the subcarriers (cf. (\ref{eqn_pjn_subcarrier_snatching})). A brief sketch of the proposed max-min algorithm is outlined as follows:
(1) Allocate one best subcarrier to each user in the `for loop' and update users' rate.
(2) Repeat the following steps till there are active users and leftover subcarriers
\hspace{1em}(i) Pick the user with lowest achieved rate
\hspace{1em}(ii) Find a best subcarrier for the user
\hspace{1em}(iii) If found, allocate it to the user and update its rate
\hspace{1em}(iv) Else, check if the user can snatch a subcarrier
\hspace{1em}(v) If yes, allocate the one with minimum $P_{j_{n}}^{th_s}$ and
\hspace{2.5em} update its rate
\hspace{1em}(vi) Else, remove the user from the active users' list.
The proposed algorithm provides additional opportunity to a least-rate user in the form of snatching a subcarrier in Step (iv). The Proposition \ref{prop_max_min_subcarrier_snatching} suggests that the jammer power should be above a certain threshold for initiating subcarrier snatching. Also there exists an optimal jammer power that achieves the maximum rate over the snatched subcarrier. Thus, the utilization of jammer power at Step (v) can be done in two different ways. Either a fixed jammer power is reserved over each subcarrier called \emph{proactively fair allocation}, or jammer power is allocated based on user demand, called \emph{on-demand allocation}.
For these two methods we present two different max-min fair schemes in following sections.
The Step (vi), provides a graceful exit of the algorithm from a possible bottleneck.
It suggests that if a poor user cannot be helped beyond a stage, the user is taken out of the allocation loop.
\subsubsection{Proactively fair jammer power allocation (PFA)}
In this scheme total jammer power is divided equally among all the subcarriers, i.e.,
at each subcarrier there exists a jammer power budget of $P_{j}^{eq} = \frac{P_J}{N}$ that can be utilized by any user for snatching.
By reserving the jammer power on each subcarrier, the scheme attempts to provide equal opportunity of subcarrier snatching to all the users even on the last subcarrier.
The proposed max-min resource allocation scheme based on PFA is presented in Algorithm \ref{suboptimal_algo_max_min_with_jammer_1}.
Note that, this scheme optimizes source and jammer power after every subcarrier allocation.
Per-user source and jammer power optimizations are done as described in Section \ref{subsec_ri_jpa} with the only difference that, now the sets $\{ \mathcal{J}_0 \}$ and $\{ \mathcal{J}_1 \}$ contain the subcarriers of one user.
\subsubsection{On-demand jammer power allocation (ODA)}\label{max_min_oda}
The condition of subcarrier snatching requires $P_{j_n}>P_{j_{n}}^{th_s}$ on subcarrier $n$ (cf. Proposition \ref{prop_max_min_subcarrier_snatching}). Thus, by limiting the jammer power budget to $P_{j}^{eq}$, PFA reduces the possibilities of subcarrier snatching. The ODA scheme dynamically allocates jammer power based on user demands on a first come first serve basis. While optimizing jammer power through AO, algorithm allocates optimal jammer power $(P_{j_n}^\star)$ required to achieve maximum secure rate over each snatched subcarrier instead of finding $P_{j_n}^\diamond$ (solution of (\ref{eqn_jra_ao_p2_non_linear_equation})). The proposed max-min scheme in this case is similar to the scheme described in Algorithm \ref{suboptimal_algo_max_min_with_jammer_1} except for the following changes:
\begin{itemize}
\item The algorithm calculates optimal jammer power for each possibility of subcarrier snatching in the initialization.
\item While optimizing the jammer power over the subcarriers for a user, the algorithm sums up all the allocated jammer powers of the user and the leftover jammer power as the prospective jammer power budget.
The algorithm then allocates optimal jammer power over all the snatched subcarriers and updates the leftover jammer power.
\end{itemize}
ODA allocates jammer power dynamically, while PFA has conservative nature, it would be interesting to observe how these schemes compete in terms of fairness. We will discuss more about their relative performance in Section \ref{sec_results}.
\algrenewcomment[1]{\(\triangleright\) #1}
\begin{algorithm}
{\small
\caption{Proposed Max-min Fair Resource Allocation}
\label{suboptimal_algo_max_min_with_jammer_1}
\begin{algorithmic}[1]
\Procedure{}{}
\State \emph{Initialization}
\State $U =\{1,2,\cdots M\}$; $C = \{1,2,\cdots N\}$;
\State $R_m = 0 \text{ } \forall \text{ } m \in U$; \Comment{user rates}
\State $B_m = \phi \text{ } \forall \text{ } m \in U$; \Comment{best subcarriers}
\State $Ab_m = \phi \text{ } \forall \text{ } m \in U$; \Comment{allocated best subcarriers }
\State $S_m = \phi \text{ } \forall \text{ } m \in U$; \Comment{possible snatch subcarriers }
\State $As_m = \phi \text{ } \forall \text{ } m \in U$; \Comment{allocated snatched subcarriers}
\State $P_{s_n}^{eq} = P_S/N$ $P_{j_n}^{eq} = P_J/N$; \Comment{equal power allocation}
\For {every user $m$}
\State find $B_m = \{ n: | h_{m,n} | > \underset{e \in \{1,M\} \setminus m} \max (| h_{e,n} |) \}$
\State find all $n$ such that $|g_{e,n}|^2 |h_{m,n}|^2 > |g_{m,n}|^2 |h_{e,n}|^2$
\State \hspace{0.25in} where $| h_{e,n} | = \underset{i \in \{1 \cdots M\}} \max (|h_{i,n}|)$ \& $e \neq m$
\State $S_m = S_m + n$;
\State compute $P_{j_{m,n}}^l$ and $P_{j_{m,n}}^u \text{ } \forall{n \in S_m}$
\State find $n$ = $\arg \underset{n \in B_m } \max (| h_{m,n} |/| h_{e,n} |)$
\State $Ab_m = Ab_m + n $; $C = C - n$; $B_m = B_m - n$;
\State update $R_m$
\EndFor
\While{($(U \neq \phi)$ \&\& $(C \neq \phi)$)}
\State find $v$ = $\arg \underset{m \in \{1 \cdots M\}} \min R_m$ \Comment{minimum rate user}
\If{$B_v \neq \phi$} \Comment{best subcarrier}
\State find $n$ = $\arg \underset{n \in B_v}\max (|h_{v,n}|/|h_{e,n}|)$
\State $Ab_v = Ab_v + n $; $C = C - n$; $B_v = B_v - n$;
\State optimize $P_{s_n}$ and update $R_v$
\Else
\If{$S_v \neq \phi$} \Comment{snatched subcarrier}
\State find $n = \arg \underset{n \in S_v} \min P_{j_{n}}^{th_s}$
\If{$ P_{j_n}^{eq}>=P_{j_{n}}^{th_s}$}
\State $As_v = As_v + n $; $C = C - n$; $S_v = S_v - n$;
\State optimize $P_{s_n}$ and $P_{j_{n}}$, and update $R_v$
\Else
\State $U = U - v$ \Comment{remove the user}
\EndIf
\Else
\State $U = U - v$ \Comment{remove the user}
\EndIf
\EndIf
\EndWhile
\EndProcedure
\end{algorithmic}
}
\end{algorithm}
\subsection{Modified max-min fairness with reduced complexity}
\label{easy_sol_max_fair}
We now present the suboptimal versions for PFA and ODA.
\subsubsection{Suboptimal PFA (PFASO)}
In order to obtain a less complex solution,
instead of optimizing source and jammer power jointly after each subcarrier allocation,
we follow the strategy of sequential power allocation \cite{ravikant_ICC_2015}, as described in Section \ref{easy_sol_rate_max}.
Source power over the best subcarriers of a user is optimized according to (\ref{eqn_woj_opt_src_power_allocation}).
Keeping the equal source power fixed over the snatched subcarriers, the jammer power is optimized by solving a single user jammer power allocation problem on
similar lines as (\ref{subopt_jammer_power_allocation_problem}).
Assuming $\{As_m\}$ to be the set of allocated snatched subcarriers of user $m$,
the jammer power budget is given as $P_J|As_m|/N$.
Since a subcarrier can be snatched only when $P_J/N$ $>$ $P_{j_{m,n}}^l$,
thus $\frac{P_J | As_m |}{N}$ $>$ $\sum_{n \in As_m} P_{j_{m,n}}^l$ and hence (\ref{subopt_jammer_power_allocation_problem}) has a feasible solution.
Till $\sum_{n \in As_m} P_{j_{m,n}}^u > \frac{P_J | As_m |}{N}$, the optimal jammer power $P_{j_{m,n}}^*$ (cf. (\ref{sub_opt_jammer_power})) is utilized.
However, when there is enough jammer power, the assignment is $P_{j_{m,n}} = P_{j_{m,n}}^u -\delta$, because in snatching scenario the secure rate is positive when $P_{j_{m,n}} > P_{j_{m,n}}^l$.
Combinedly, jammer power is allocated as:
\begin{equation}\label{jammer_power_allocation_maxmin}
P_{j_{m,n}}=
\begin{cases}
P_{j_{m,n}}^*, & \text{if } \sum_{n \in As_m} P_{j_{m,n}}^u > \frac{P_J | As_m |}{N}\\
P_{j_{m,n}}^u -\delta, & \text{otherwise}
\end{cases}
\end{equation}
where $\delta$ is a small positive number.
\subsubsection{Suboptimal ODA (ODASO)}
It is a very light weight scheme and does not attempt any power optimization.
With equal source power allocation, every time the algorithm attempts to snatch a subcarrier, it simply allocates the optimal jammer power $(P_{j_n}^\star)$ over the snatched subcarrier and updates
leftover jammer power.
Once the jammer power is exhausted, the algorithm either allocates the best subcarrier to the least-rate user or takes it out from active user set.
\subsection{Complexity analysis}
While creating $\{S_m\}$, PFA considers for each user the possibility of subcarrier snatching from the best gain user. This involves calculation of jammer power thresholds for snatching, lower and upper jammer power bounds, and optimal jammer powers required for achieving maximum rate.
The total computation is $O(NM^2)$.
Denote that a user got $N_1$ best subcarriers and $N_2$ snatched subcarriers before being taken out of the resource allocation loop. The joint power optimization procedure has the complexity of $O(I_{pd} N_1 \log(N_1) + I_{ao} I_{pd} N_2 \log(N_2))$, where $I_{ao}$ and $I_{pd}$ are respectively the number of AO and PD iterations.
The total computational on this user in all the previous iterations is of
$O ( (N_2-1)I_{pd} N_1 \log(N_1) + I_{ao} I_{pd} \sum_{i=2}^{N_2-1}i \log(i) + \sum_{i=2}^{N_1}i \log(i) )$ which can be upper bounded as $O( N_2 I_{pd} N_1 \log(N_1) + I_{ao} I_{pd} N_2^2 \log(N_2) + N_1^2 \log(N_1) )$ using $\sum_{i=2}^{n}i \log(i) \leq (n-1)(n\log(n))<n^2 \log(n)$.
The worst case complexity of the algorithm when $N_2 \simeq N$ is $I_{ao} I_{pd} N^2 \log(N)$.
The computation complexity of ODA is on the same order as that of PFA.
PFASO has worst case computation complexity $O(N^2 \log N)$, because it does not use PD and finishes source and jammer power optimization sequentially.
ODASO does not perform any power optimization at all, and has the worst case computation complexity of $O(N^2M)$.
The worst case computational complexities of PFA and ODA and their respective suboptimal versions are summarized in Table \ref{max_min_algorithm_comparison}.
\begin{table}[!htb]
\caption{Comparison of max-min algorithms}\label{max_min_algorithm_comparison}
\centering
{\scriptsize
\begin{tabular}{|L{0.9cm} |L{2cm}| L{1.5cm}| L{2.5cm}| }
\hline
& {Power optimization} &{$P_j$ allocation} & {Complexity} \\
\hline
\hline
{PFA} & Joint &$P_{j_n}^\star$ or $P_{j_n}^\diamond$ & $O(I_{ao} I_{pd} N^2 \log(N))$ \\
\hline
{ODA} & Joint & $P_{j_n}^\star$ & $O(I_{ao} I_{pd} N^2 \log(N))$ \\
\hline
{PFASO} & Sequential & $P_{j_n}^*$ or $P_{j_{n}}^u$ & $O(N^2 \log(N))$ \\
\hline
{ODASO} & No & $P_{j_n}^\star$ & $O(N^2M)$ \\
\hline
\end{tabular}
}
\end{table}
\section{Asymptotic analysis}\label{sec_asymp_anlysis}
In this section, we are interested to determine the best user, the strongest eavesdropper, and the maximum secure rate achievable when $\{P_{s_n}, P_{j_n}\} \to \infty$ on a subcarrier $n$. We note that, for a fixed main user and eavesdropper, a subcarrier can be used in without-jammer mode or with-jammer mode in either rate improvement or subcarrier snatching scenario. In without-jammer mode the secure rate is an increasing concave function of source power. In both the scenarios with jammer, secure rate is a concave increasing function of $P_{s_n}$ for a fixed $P_{j_n}$, and for a fixed $P_{s_n}$ there exists an optimal jammer power $P_{j_n}^\star$ which too is an increasing function of $P_{s_n}$. Hence, at $P_{j_n}^\star$ secure rate becomes an increasing function of $P_{s_n}$.
When jammer is not active on a subcarrier, the user with the maximum channel gain $|h_{m,n}|$ is the main user. But when jammer is active this might not be true. To find the main user of the subcarrier when $\{P_{s_n}, P_{j_n}\} \to \infty$, we use the concept of jammer power bounds discussed in Section \ref{subsubsec_ri_bounds}. Specifically, a user $m$ will remain the main user if the condition $\gamma_{m,n}'>\gamma_{e,n}' \forall e \in \{ 1,\cdots, M \} \setminus m$ gives no upper bound on $P_{j_n}$. Denote the effective lower bound of these conditions as $P_{j_n}^l$. We claim that only one user will satisfy this condition. Otherwise, let two users $m_1$ and $m_2$ be the contenders. Let the lower bounds on $P_{j_n}$ be $P_{j_n}^{l_{m_1}}$ and $P_{j_n}^{l_{m_2}}$. Without loss of generality let $P_{j_n}^{l_{m_1}} < P_{j_n}^{l_{m_2}}$. This contradicts the fact that user $m_1$ can be the main user at $P_{j_n} \to \infty$, because when $P_{j_n} > P_{j_n}^{l_{m_2}}$, $m_2$ becomes the main user.
Let the main user over a subcarrier be $m$. To identify the eavesdropper and the secure rate achievable at $\{P_{s_n}, P_{j_n}\} \to \infty$ we follow the following approach. We consider each of the leftover users as the possible eavesdroppers. Thus, there are $(M-1)$ $\{m, e\}$ user pairs, where $e \in \{ 1\cdots M \} \setminus m$. Over each of the pair, there exist four cases:
(1) If $|h_{m,n}|>|h_{e,n}|$ and $|g_{m,n}|>|g_{e,n}|$, rate improvement condition is not satisfied.
An obvious decision is to set $P_{j_n} = 0$. In without-jammer case, secure rate is a concave increasing function of $P_{s_n}$ and tends to $\log_2\left( \frac{|h_{m,n}|^2}{|h_{e,n}|^2} \right)$ as $P_{s_n} \to \infty$.
(2) If $|h_{m,n}|>|h_{e,n}|$ and $|g_{m,n}|<|g_{e,n}|$, rate improvement condition is satisfied.
$P_{j_{n}}^{th_{i}}$ is an increasing function of $P_{s_n}$ (cf. Proposition \ref{prop_sri_jammer_rate_imp_constraints}).
Hence, as $P_{s_n} \to \infty$, $P_{j_{n}}^{th_{i}} \to \infty$.
Putting $P_{j_n} = P_{j_n}^\star$, the optimal secure rate is $\log_2 \left( \frac{1 + \gamma_{m,n}'}{1 + \gamma_{e,n}'} \right)$, where
\begin{align}\label{sec_rate_k_e_pair}
\frac{1 + \gamma_{m,n}'}{1 + \gamma_{e,n}'} &= \frac{1+\frac{P_{s_n} |h_{m,n}|^2}{\sigma^2 + P_{j_n}^\star |g_{m,n}|^2}} {1+\frac{P_{s_n} |h_{e,n}|^2}{\sigma^2 + P_{j_n}^\star |g_{e,n}|^2}}
\stackrel{a}{\approx}
\frac{\frac{P_{s_n} |h_{m,n}|^2}{\sigma^2 + P_{j_n}^\star |g_{m,n}|^2}} {\frac{P_{s_n} |h_{e,n}|^2}{\sigma^2 + P_{j_n}^\star |g_{e,n}|^2}} \nonumber \\
& =
\frac{|h_{m,n}|^2}{|h_{e,n}|^2} \frac{\frac{\sigma^2}{P_{j_n}^\star} + |g_{e,n}|^2}{\frac{\sigma^2}{P_{j_n}^\star} + |g_{m,n}|^2}
\stackrel{b}{\to}
\frac{|g_{e,n}|^2 |h_{m,n}|^2 }{|g_{m,n}|^2 |h_{e,n}|^2 }.
\end{align}
The approximation (a), and (b) follows from $P_{j_n}^\star$ being an increasing function of $P_{s_n}$, which increases as $\sqrt{P_{s_n}}$. Thus, with $P_{s_n} \to \infty$ and $P_{j_n} \to \infty$ we have $P_{j_n}^\star \to \infty$.
(3) If $|h_{m,n}|<|h_{e,n}|$ and $|g_{e,n}||h_{m,n}|<|g_{m,n}||h_{e,n}|$, subcarrier snatching condition is not fulfilled; secure rate $=0$.
(4) If $|h_{m,n}|<|h_{e,n}|$ and $|g_{e,n}||h_{m,n}|>|g_{m,n}||h_{e,n}|$, subcarrier snatching condition is satisfied. The secure rate in this case is the same as in case (2).
Once the secure rate for each user pair $\{m, e\}$ is obtained,
the strongest eavesdropper for user $m$ at $\{P_{s_n}, P_{j_n}\} \to \infty$ is the one that causes the minimum secure rate.
Thus, with jammer, for each subcarrier we have the main user, its eavesdropper, and the corresponding secure rate achieved.
When the jammer is inactive, the best channel gain user is the main user and the next best gain user is the corresponding eavesdropper. The secure rate in this case is: $\log_2\left( \frac{|h_{m,n}|^2}{|h_{e,n}|^2} \right)$.
\subsection{Asymptotic bound in sum rate maximization scenario}\label{upper_bound_rate_max}
Motivated by the asymptotic behavior of secure rate and identification of the main user and eavesdropper as $\{P_{s_n}, P_{j_n}\} \to \infty$, we obtain an upper bound to the maximum secure rate of the system.
To do so, we consider a subcarrier without-jammer as well as with-jammer, and choose the mode that offers the maximum secure rate upper bound over that subcarrier.
The system upper bound is then found as the sum of the upper bounds in chosen modes over all the subcarriers.
To find asymptotically optimal solution for rate maximization we note that
the sum rate achievable as $\{P_S, P_J\} \to \infty$ is an upper bound to the maximum sum rate of the system. Hence, the decision of subcarrier allocation and jammer mode at $\{P_S, P_J\} \to \infty$ is optimal.
Keeping the decision at $\{P_S, P_J\} \to \infty$ same over every finite $P_S$ and assuming $P_J \to \infty$, we find the sum rate that becomes optimal as $P_S \to \infty$. Let the sum rate be $R_U(P_S)$.
As $\{P_S, P_J\} \to \infty$, relative gap between the rate achievable in the proposed algorithm and $R_U(P_S)$ at any $P_S$ will demonstrate effectiveness of the algorithm in reaching the optimal point.
We note that at low values of $P_S$, $\{P_S, P_J\} \to \infty$ may not maximize the sum rate; hence it may be below the rate achievable by proposed scheme.
The motivation behind $R_U(P_S)$ is that, for a fixed subcarrier allocation and jammer mode decision, the achievable maximum rate with finite $P_S$ and $P_J \to \infty$ is an upper bound to that achievable with finite $P_S$ and $P_J$.
\subsection{Asymptotic bound in the proposed max-min fairness}\label{upper_bound_max_min}
In this case, we cannot use the per-subcarrier secure rate upper bounds of the two jammer modes. The proposed max-min fair scheme works on a per-subcarrier basis and updates rate of the minimum-rate user after every subcarrier allocation. Hence, if we apply the proposed max-min scheme on the upper bounds, it may not lead to system upper bound. Also, since the decision of subcarrier allocation and jammer usage varies with $P_S$, the decision at $P_S \to \infty$ cannot be kept fixed.
Instead, motivated by the ODA scheme in Section \ref{max_min_oda}, we note that as $P_J \to \infty$ the fairness achievable by ODA will be an upper bound to the fairness achieved by any other bounded $P_J$ scheme.
In ODA scheme with finite $P_J$, the jammer power gets exhausted very soon.
Hence, it allows fewer subcarrier snatching, which limits its fairness performance.
Considering ODA with $P_J \to \infty$, we allocate $P_{j_n} = P_{j_n}^\star$ and optimize source power over all the subcarriers of the minimum rate user.
Thus ODA can now help the poor users to snatch subcarriers and improve their rates without any jammer power budget constraint.
The best fairness achievable by our proposed scheme is given by this achievable upper bound.
\section{Results and discussion}
\label{sec_results}
Performances of the proposed algorithms are evaluated through MATLAB simulations.
We consider the downlink of an OFDMA system with $N=64$ subcarriers, which are assumed to experience frequency-flat slow fading.
Large scale fading is modeled using a path loss exponent equal to $3$, and small scale fading is modeled using i.i.d. Rayleigh faded random variables.
The source is located at the origin and all untrusted users with default $M = 8$ are randomly located inside a unity square in the first quadrant which symbolically maps to a sector in cellular communications system.
Friendly jammer's location is varied to determine its optimum position. For illustration, all users are assumed to have equal weights i.e., $w_i = 1$, and the AWGN noise variance $\sigma^2=1$. Secure rate is measured in bits per OFDM symbol per subcarrier.
\textit{Equal power allocation:} We compare the performance of our proposed schemes with equal power allocation (EPA) that utilizes equal source power on all the subcarriers.
Respecting the jammer power bounds developed in Section \ref{subsubsec_ri_bounds}, equal jammer power is assigned over the selected set of subcarriers following the observations in Proposition \ref{prop_sri_jammer_rate_imp_constraints} and \ref{prop_max_min_subcarrier_snatching} for rate improvement and max-min fairness scenarios, respectively.
\textit{Optimal Source Power Without Jammer (OSPWJ):} In sum rate maximization case, this scheme obtains the optimal source power allocation assuming the jammer to be absent. In max-min fair scenario, after subcarrier allocation to a user, source power over the subcarriers allocated to the user is optimized.
The conventional fairness measure as in \cite{jain1984}, that considers user's rate as the basis for fairness evaluation, is not meaningful in our context because over a large number of iterations with random user locations, the users' rates tends to be similar, causing the fairness index to be close to unity.
Instead, in order to compare the true capability of a fairness algorithm in bridging the imbalance in users' rate, we measure fairness as the relative gap between maximum and minimum secure rate allocated to the users by a competing algorithm. In this case, in each iteration identity of the users are ignored and the secure rates allocated by the algorithm are sorted in ascending order and then fairness is obtained from this sorted rate.
\subsection{Rate maximization schemes}
We first discuss the effect of jammer location on the system performance.
Four possible jammer locations $(0.5,0.5)$, $(0,1)$, $(1,0)$, $(1,1)$ are considered.
Fig. \ref{fig:rate_imp_jammer_location} presents the rate maximization algorithm performance versus source power.
With varying locations of jammer, the algorithm performs differently, because of the varying degree of impact the jammer has on the users.
Performance at location $(0,1)$ and $(1,0)$ are similar, because these are symmetric locations for the square geometry considered.
Location $(1,1)$ performs the poorest as the jammer is too far to have significant effect on users' rates. The central location $(0.5, 0.5)$ performs the best, as the jammer is able to affect all the users and contribute significantly in improving their rates. Motivated by this, we consider the jammer to be located at the center in our subsequent simulations.
\begin{figure}[!htb]
\centering
\epsfig{file=figure2.pdf, height=1.6in}
\caption{Secure rate versus source power at various jammer locations with jammer power $P_J/\sigma^2=0$ dB.}
\label{fig:rate_imp_jammer_location}
\end{figure}
Fig. \ref{fig:rate_imp_ps_variation} shows the secure rate and fairness performance of proposed JPA scheme with respect to source power at two different values of jammer power, $P_{J1}/\sigma^2=0$ dB and $P_{J2}/\sigma^2=6$ dB. The performance of JPA is compared with the suboptimal version JPASO and EPA. The rate achieved with OSPWJ is also plotted to emphasize secure rate improvement with friendly jammer. The performance of asymptotically optimal solution ($P_J \to \infty$) is plotted as `Asymp opt' to indicate closeness of proposed algorithms to the optimal solution. Sum secure rate and the corresponding fairness upper bounds as $\{P_S, P_J\} \to \infty$ are also indicated in text boxes in the respective figures.
Fig. \ref{fig:rate_imp_ps_variation}(a) indicates that JPASO performs better compared to EPA because JPASO performs power optimization while EPA does not. JPASO has a marginal performance penalty with respect to JPA. Also, the gap between JPA and OSPWJ initially keeps increasing and then saturates because of diminishing returns at higher source power.
It may be further noted that, `Asymp opt' has poor performance at lower source power budget, because the decision of subcarrier allocation and jammer mode at $\{P_S, P_J\} \to \infty$ may not be optimal at lower value of $P_S$. At finite $P_S$, the possibility of utilizing jammer power under jammer power bounds over larger number of subcarriers is more compared to that at $P_S \to \infty$. But, as $P_S$ increases the decision of subcarrier allocation and jammer mode becomes optimal and the `Asymp opt' tries to catch the upper bound.
Since secure rate performance of the proposed schemes improve with $P_J$, hence at higher $P_S$ and $P_J$ the performance of JPA tends to that of `Asymp opt'.
Fig. \ref{fig:rate_imp_ps_variation}(b) shows the associated fairness performance.
Because of equal distribution of resources in EPA, its fairness performance is better at lower source power compared to both JPA and JPASO.
With increasing source power, the jammer is able to affect more number of users because the percentage of subcarriers over which jammer can help keep increasing (cf. Proposition \ref{prop_sri_jammer_rate_imp_constraints}).
This results in improved secure rate as well as fairness performance of JPA compared to EPA.
\begin{figure}[!htb]
\centering
\epsfig{file=figure3.pdf, width=3.2in}
\caption{Secure rate and fairness performance versus source power at $P_{J1}/\sigma^2 = 0$ dB and $P_{J2}/\sigma^2=6$ dB. `Rate-ub': rate upper bound; `Fairness-ub': fairness upper bound.}
\label{fig:rate_imp_ps_variation}
\end{figure}
Performance of the secure rate improvement algorithms with respect to jammer power is presented in Fig. \ref{fig:rate_imp_pj_variation}.
As observed in Fig. \ref{fig:rate_imp_pj_variation}(a) the secure rate of JPA initially increases with jammer power and then saturates, as the algorithm start allocating optimal jammer power $(P_{j_n}^\star)$ achieving maximum secure rate over the selected set of subcarriers (cf. Proposition \ref{prop_sri_jammer_rate_imp_constraints}).
Due to sequential power allocation, JPASO performance is inferior compared to JPA.
The secure rate saturates at a value lower than the peak value, because JPASO is oblivious to existence of optimal jammer power and utilizes more jammer power than required.
Since EPA uses equal jammer power, the secure rate initially increases, achieves a maximum and then reduces with increased jammer power.
Compared to EPA which utilizes equal jammer power blindly, the performance of JPASO is relatively better at higher jammer power, which can be attributed to improved jammer power allocation policy (\ref{jammer_power_allocation}).
Because of the existence of finite upper bounds on jammer power (cf. Section \ref{subsubsec_ri_bounds}), the rate achieved by EPA also saturates at higher jammer power but at a relatively lower value compared to JPASO.
The corresponding fairness performance plots for the various schemes are presented in Fig. \ref{fig:rate_imp_pj_variation}(b).
At lower source power, EPA performance is better because of the utilization of equitable distribution of resources, while at higher source power JPA performs comparable to EPA at lower jammer power but outperforms at higher jammer power.
With increasing jammer power JPA fairness saturates while EPA fairness achieves a peak, reduces a bit and then saturates, showing similar trend as the corresponding secure rate plots.
JPASO first completes source power optimization and then finishes jammer power optimization over the selected set of subcarriers, thereby increasing the secure rate imbalance which results in comparatively poor fairness performance.
\begin{figure}[!htb]
\centering
\epsfig{file=figure4.pdf,width=3.2in}
\caption{Secure rate and fairness performance versus jammer power at $P_{S1}/\sigma^2 = 12$ dB and $P_{S2}/\sigma^2=15$ dB.}
\label{fig:rate_imp_pj_variation}
\end{figure}
Fig. \ref{fig:rate_imp_user_var} presents the performance of the algorithms in secure rate improvement scenario with number of users $M$.
It may appear that, with increasing number of users the secure rate should reduce as the number of eavesdropper increases, but eventually
the secure rate of all the algorithms improves with increasing number of users because of multi-user diversity.
\begin{figure}[!htb]
\centering
\epsfig{file=figure5.pdf,width=2.3in}
\caption{Secure rate versus number of users $M$ at $P_J/\sigma^2=6$ dB and $P_{S1}/\sigma^2 = 12$ dB and $P_{S2}/\sigma^2=15$ dB.}
\label{fig:rate_imp_user_var}
\end{figure}
\subsection{Max-min fair schemes}
Next we present the performance of the proposed max-min fairness algorithms in Figs. \ref{fig:max_min_ps_variation} and \ref{fig:max_min_pj_variation}.
PFA and ODA and their corresponding suboptimal versions PFASO and ODASO are considered with EPA.
The performance of asymptotically optimal scheme which act as an upper bound to our proposed max-min scheme has been plotted as `Asymp opt'.
Fig. \ref{fig:max_min_ps_variation} presents the fairness and secure rate performance of the algorithms versus source power.
ODA utilizing jammer power dynamically, allocates optimal jammer power on first come first serve basis.
This results in more subcarrier snatching possibilities and hence a higher fairness at low source power compared to PFA. Being a conservative algorithm, PFA is not able to help many users because of limited per subcarrier jammer power budget ($P_J/N$).
Since the optimal jammer power $(P_{j_n}^\star)$ for maximum secure rate over a snatched subcarrier is an increasing function of source power (cf. (\ref{rate_derivative_pjn_quad_coef1})-(\ref{rate_derivative_pjn_quad_coef3})),
jammer resource gets exhausted very soon in ODA.
Because of this, ODA's capability to improve fairness reduces drastically with increasing source power, and correspondingly its fairness performance starts degrading.
ODASO also faces the same issue of depleting all the jammer resource for a few initial users and later finding itself unable to help users, which results in early saturation of the fairness with source power.
In contrast PFA and EPA even if helping a limited number of users because of their conservative nature, keep performing well with increasing source power and outperform ODA at higher source power.
While ODASO is able to help only a few initial users, EPA provides equal opportunity to all the users. As a result, the overall performance of EPA is better than ODASO.
Though ODA at $P_J=18$ dB has similar performance as with $P_J=12$ dB, the plot gets closer to that of `Asymp opt' as $P_J$ is increased. `Asymp opt' does not face the problem of depleting jammer resources and keep on helping users as far as possible, which results in better system fairness compared to all other bounded $P_J$ schemes. The cost being paid for higher fairness is the reduced secure rate, as observed in Fig. \ref{fig:max_min_ps_variation}(b).
The secure rate of OSPWJ is better than all other schemes. However, its fairness performance is the poorest because it either allocates the best subcarrier to a user or does not allocate at all.
Because of the dynamic allocation, ODA allows more subcarrier snatching which results in poorer secure rate performance compared to PFA as observed in Fig. \ref{fig:max_min_ps_variation}(b).
Note that, with the help of jammer the overall system fairness can be improved significantly (compared to OSPWJ), however at the cost of a little poorer secure rate performance.
\begin{figure}[!htb]
\centering
\epsfig{file=figure6.pdf,width=3.2in}
\caption{Fairness and secure rate versus source power at $P_{J1}/\sigma^2 = 12$ dB and $P_{J2}/\sigma^2 = 18$ dB.}
\label{fig:max_min_ps_variation}
\end{figure}
The performance of the max-min algorithms versus jammer power is presented in Fig. \ref{fig:max_min_pj_variation}.
For fixed source power, performance of ODA as well as PFA keep improving with increasing jammer power, because of the increasing possibility of optimal jammer power allocation $(P_{j_n}^\star)$ over snatched subcarriers, and finally saturates.
At lower jammer power, performance of ODASO is poorer compared to EPA, because ODASO is able to help only a few initial users while EPA provides equal opportunity to all the users.
Because of the increasing possibility of allocating $P_{j_n}^\star$, ODASO outperforms EPA as well as PFASO at higher jammer power.
Both EPA and PFASO are unaware of the existence of optimal jammer power over snatched subcarrier. As a result, they utilize more than the required jammer power, leading to their degraded performance at higher jammer power.
As observed in corresponding secure rate performance in \ref{fig:max_min_pj_variation}(b), secure rate of all the algorithms keep reducing with jammer power due to increasing possibility of subcarrier snatching.
PFA and ODA saturates at higher jammer power because of the utilization of optimal jammer power $(P_{j_n}^\star)$ by the algorithms.
ODASO saturates at a lower value compared to ODA because ODA uses power optimization while ODASO does not.
Similarly PFASO shows poorer secure rate performance because of sequential power allocation.
The secure rate of EPA also saturates at higher jammer power, due to the existence of upper jammer power bounds, but at relatively lower values compared to that of PFASO which uses better jammer power allocation (cf. (\ref{jammer_power_allocation_maxmin})).
\begin{figure}[!htb]
\centering
\epsfig{file=figure7.pdf,width=3.2in}
\caption{Fairness and secure rate versus jammer power at $P_{S}/\sigma^2 = 15$ dB.}
\label{fig:max_min_pj_variation}
\end{figure}
\section{Concluding Remarks}
\label{sec_conclusion}
We have considered jammer power utilization in the downlink of broadcast secure OFDMA for either secure rate or fairness improvement.
We have shown that secure rate can be improved under certain channel conditions with constraints on source and jammer power.
Also in presence of jammer, maximum secure rate is achieved at an optimal jammer power.
While solving the otherwise NP-hard resource allocation problem in steps,
we have used PD and AO procedures for joint source and jammer power optimization.
It has been observed that sum secure rate can be significantly improved by using jammer power.
In max-min fairness scenario we have shown that, with the help of jammer a subcarrier can be snatched form its best gain user and allocated to a poor user who would otherwise have a low secure rate due to resource scarcity.
To this end, we have presented two means for jammer power usage: PFA and ODA.
Overall performance of PFA is better. ODA performs
marginally better at lower source power due to dynamic allocation of resources.
But at higher source power, with increasing user demands ODA performs poorly because of depleting jammer resources for a few initial users.
Asymptotically optimal solutions have also been derived to benchmark optimality of the proposed schemes.
Possible future extensions
include: consideration of multiple antenna at the nodes, imperfect CSI, finding the best location of jammer, and multiplicity of jammer. However, in each of the problems above the combinatorial aspect will open up new challenges. Imperfect CSI can lead to false decisions on subcarrier allocation, which may lead to zero secure rate. Though multi-antenna nodes or multiple jammers will add new degrees of freedom, the resource allocation algorithms need to be modified significantly. Optimizing jammer location is an interesting problem due to users' mobility.
\appendices
\setcounter{equation}{0}
\setcounter{figure}{0}
\renewcommand{\theequation}{A.\arabic{equation}}
\renewcommand{\thefigure}{A.\arabic{figure}}
\section{Proof of proposition III.1}\label{sec_appendix_proposition_rate_imp}
Over a subcarrier $n$ with user $m$ and eavesdropper $e$, secure rate improvement implies that the secure rate with jammer should be greater than that without jammer, i.e.,
\begin{equation*}\label{inequality_secure_rate_imp}
\log_2 \left( \frac{1+\frac{P_{s_n} |h_{m,n}|^2}{\sigma^2 + P_{j_n} |g_{m,n}|^2}} {1+\frac{P_{s_n} |h_{e,n}|^2}{\sigma^2 + P_{j_n} |g_{e,n}|^2}} \right)-\log_2 \left( \frac{1+\frac{P_{s_n} |h_{m,n}|^2}{\sigma^2}}{1+\frac{P_{s_n} |h_{e,n}|^2}{\sigma^2}} \right) > 0 .
\end{equation*}
After simplifications we have following inequality in $P_{j_n}$:
\begin{align}\label{inequality_rate_improvement_p_j_n}
& P_{j_n} |g_{m,n}|^2 |g_{e,n}|^2 \left( |h_{m,n}|^2- |h_{e,n}|^2 \right) \nonumber \\
& \qquad < P_{s_n} \left( |g_{e,n}|^2 - |g_{m,n}|^2 \right) |h_{m,n}|^2 |h_{e,n}|^2 \nonumber \\
& \qquad \qquad + \sigma^2 \left( |g_{e,n}|^2 |h_{e,n}|^2 - |g_{m,n}|^2 |h_{m,n}|^2 \right).
\end{align}
Since $|h_{m,n}|^2 > |h_{e,n}|^2$, coefficient of $P_{j_n}$ is positive. To have $P_{j_n}>0$, right hand side of \eqref{inequality_rate_improvement_p_j_n} should be positive, i.e.,
\begin{align}\label{jammer_rate_imp_psn_constraint}
& P_{s_n} \left( |g_{e,n}|^2 - |g_{m,n}|^2 \right) |h_{m,n}|^2 |h_{e,n}|^2 \nonumber \\
& \quad + \sigma^2 \left( |g_{e,n}|^2 |h_{e,n}|^2 - |g_{m,n}|^2 |h_{m,n}|^2 \right) > 0.
\end{align}
If $|g_{m,n}|^2 > |g_{e,n}|^2$, then $|g_{m,n}|^2 |h_{m,n}|^2>|g_{e,n}|^2 |h_{e,n}|^2$, therefore, (\ref{jammer_rate_imp_psn_constraint}) cannot be satisfied for any $P_{s_n}>0$. Thus, when the jammer is affecting the intended user strongly compared to the eavesdropper, secure rate cannot be improved. If $|g_{m,n}|^2 < |g_{e,n}|^2$, the source power $P_{s_n}$ is conditioned as:
\begin{equation}\label{jammer_rate_psn_inequality}
P_{s_n} > \frac{ \sigma^2 \left( |g_{m,n}|^2 |h_{m,n}|^2 - |g_{e,n}|^2 |h_{e,n}|^2 \right) }{ \left( |g_{e,n}|^2 - |g_{m,n}|^2 \right) |h_{m,n}|^2 |h_{e,n}|^2 } \triangleq P_{s_{n}}^{th_i}.
\end{equation}
If $|g_{m,n}|^2 |h_{m,n}|^2 - |g_{e,n}|^2 |h_{e,n}|^2>0$, $P_{s_n}$ should be above certain threshold $P_{s_{n}}^{th_i}$ as mentioned in \eqref{jammer_rate_psn_inequality}.
If $|g_{m,n}|^2 |h_{m,n}|^2 - |g_{e,n}|^2 |h_{e,n}|^2<0$, $P_{s_{n}}^{th_i}$ becomes negative, which means that the secure rate can be improved for any $P_{s_n}>0$.
Thus, under certain channel conditions and certain source power and jammer power constraints the secure rate of a user can be improved over a subcarrier.
Note that, in order to have positive secure rate improvement, the jammer power $P_{j_{n}}$ should be below certain threshold $P_{j_{n}}^{th_i}$ as described in (\ref{inequality_rate_improvement_p_j_n}).
The secure rate with jammer is equal to the secure rate without jammer at $P_{j_n} = 0$ and $P_{j_n} = P_{j_{n}}^{th_i}$, and in between these two extremes there is a secure rate improvement. Intuitively it indicates the presence of a maxima as described below.
From (\ref{secure_rate_definition}) first derivative of $R_{m,n}$ with respect to $P_{j_n}$ is:
\begin{equation*}
\frac{\delta R_{m,n}}{\delta P_{j_n}} = \frac{1}{\ln2} \left[\frac{ \frac{-P_{s_n} |h_{m,n}|^2 |g_{m,n}|^2}{\left(\sigma^2 + P_{j_n}|g_{m,n}|^2\right)^2}} {1 + \frac{P_{s_n}|h_{m,n}|^2}{\sigma^2 + P_{j_n}|g_{m,n}|^2}}
- \frac{ \frac{-P_{s_n} |h_{e,n}|^2 |g_{e,n}|^2}{\left(\sigma^2 + P_{j_n}|g_{e,n}|^2\right)^2}} {1 + \frac{P_{s_n}|h_{e,n}|^2}{\sigma^2 + P_{j_n}|g_{e,n}|^2}} \right].
\end{equation*}
Simplifying it further we get,
\begin{align*}
&\frac{\delta R_{m,n}}{\delta P_{j_n}} = \left[ \frac{P_{s_n} |h_{e,n}|^2 |g_{e,n}|^2}{\left( \sigma^2 + P_{j_n}|g_{e,n}|^2 \right) \left( \sigma^2 + P_{j_n}|g_{e,n}|^2 + P_{s_n}|h_{e,n}|^2 \right) } \right. \nonumber \\
&- \left. \frac{P_{s_n} |h_{m,n}|^2 |g_{m,n}|^2}{ \left( \sigma^2 + P_{j_n}|g_{m,n}|^2 \right) \left( \sigma^2 + P_{j_n}|g_{m,n}|^2 + P_{s_n}|h_{m,n}|^2 \right)} \right] \frac{1}{\ln2}.
\end{align*}
The derivative has a quadratic in numerator and a fourth-order equation of $P_{j_n}$ with all positive coefficients in the denominator. Hence, the denominator is always positive when $P_{j_n}>0$.
Setting the derivative equal to zero, we obtain a quadratic equation of the form $x_n P_{j_n}^2 + y_n P_{j_n} + z_n = 0 $ with the following coefficients:
\begin{align}\label{rate_derivative_pjn_quad_coef1}
x_n &= |g_{m,n}|^2 |g_{e,n}|^2 \left( |g_{m,n}|^2 |h_{e,n}|^2-|g_{e,n}|^2 |h_{m,n}|^2 \right) \\
y_n &= 2 \sigma^2 |g_{m,n}|^2 |g_{e,n}|^2 \left( |h_{e,n}|^2-|h_{m,n}|^2 \right)
\label{rate_derivative_pjn_quad_coef2}\\
z_n & = \sigma^2 P_{s_n} |h_{m,n}|^2 |h_{e,n}|^2 \left( |g_{e,n}|^2-|g_{m,n}|^2 \right) \nonumber \\
& \quad + \sigma^4 \left( |g_{e,n}|^2 |h_{e,n}|^2-|g_{m,n}|^2 |h_{m,n}|^2 \right)
\label{rate_derivative_pjn_quad_coef3}
\end{align}
The rate improvement scenario, i.e., $|h_{m,n}|^2>|h_{e,n}|^2$ and $|g_{e,n}|^2>|g_{m,n}|^2$, results in $x_n<0$, $y_n<0$,
and
$z_n>0$.
Since the discriminant $\Delta_n = \sqrt{y_n^2-4x_nz_n}$ is positive, and $x_n$ and $z_n$ have opposite signs, there exists only one positive real root of the above quadratic equation.
Thus, the derivative $\frac{\delta R_{m,n}}{\delta P_{j_n}}$ has only one zero crossing in $P_{j_n}>0$ which corresponds to a unique maxima of rate $R_{m,n}$ with respect to jammer power $P_{j_n}$.
The optimum jammer power $(P_{j_n}^{o})$ achieving maximum secure rate is obtained as the positive real root of the above quadratic equation. Observing (\ref{rate_derivative_pjn_quad_coef1}) to (\ref{rate_derivative_pjn_quad_coef3}), we note that $P_{j_n}^{o}$ is an increasing function of $P_{s_n}$
\setcounter{equation}{0}
\setcounter{figure}{0}
\renewcommand{\theequation}{B.\arabic{equation}}
\renewcommand{\thefigure}{B.\arabic{figure}}
\section{Proof of proposition IV.1}\label{sec_appendix_proposition_carr_snatch}
The condition of subcarrier snatching for user $m$ from user $e$ is to achieve positive secure rate over subcarrier $n$, i.e.,
\begin{align}\label{eqn_mmf_snatch_condition}
\log_2 \left( 1+ \gamma_{m,n}' \right) - \log_2 \left( 1+\gamma_{e,n}' \right) >0
\end{align}
Simplifying above equation we have
\begin{equation}
\frac{P_{s_n}|h_{m,n}|^2}{\sigma^2+P_{j_n}|g_{m,n}|^2} > \frac{P_{s_n}|h_{e,n}|^2}{\sigma^2+P_{j_n}|g_{e,n}|^2}
\end{equation}
which gives the following constraint over jammer power $P_{j_n}$
\begin{align}\label{eqn_mmf_jammer_power_for_carr_snatching}
& P_{j_n} \left( |g_{e,n}|^2 |h_{m,n}|^2 - |g_{m,n}|^2 |h_{e,n}|^2 \right) \nonumber \\
& \qquad > \sigma^2 \left( |h_{e,n}|^2 - |h_{m,n}|^2 \right).
\end{align}
Since $|h_{m,n}|^2 < |h_{e,n}|^2$, if $|g_{e,n}|^2>|g_{m,n}|^2$ such that $|g_{e,n}|^2 |h_{m,n}|^2 > |g_{m,n}|^2 |h_{e,n}|^2 $, then left hand side of (\ref{eqn_mmf_jammer_power_for_carr_snatching}) is positive and the jammer power is constrained as
\begin{equation}
P_{j_n} > \frac {\sigma^2 \left( |h_{e,n}|^2 - |h_{m,n}|^2 \right)} {|g_{e,n}|^2 |h_{m,n}|^2 - |g_{m,n}|^2 |h_{e,n}|^2} \triangleq P_{j_{n}}^{th_s}.
\end{equation}
In case $|g_{e,n}|^2 |h_{m,n}|^2 < |g_{m,n}|^2 |h_{e,n}|^2 $, then the left hand side in (\ref{eqn_mmf_jammer_power_for_carr_snatching}) becomes negative.
Since the inequality cannot be satisfied for any positive jammer power, the jammer cannot be utilized to snatch the subcarrier in such channel conditions.
Further, if $|g_{e,n}|^2 < |g_{m,n}|^2$, then also $|g_{e,n}|^2 |h_{m,n}|^2 < |g_{m,n}|^2 |h_{e,n}|^2$, and thus using the same argument as above,
jammer cannot help in snatching the subcarrier.
Let us refer to the equations (\ref{rate_derivative_pjn_quad_coef1}) to (\ref{rate_derivative_pjn_quad_coef3}), which are the coefficients of the quadratic equation obtained after setting $\frac{\delta R_{m,n}}{\delta P_{j_n}}=0$.
Under the subcarrier snatching scenario, we have $|h_{m,n}|^2 < |h_{e,n}|^2$, $|g_{e,n}|^2>|g_{m,n}|^2$, and $|g_{e,n}|^2 |h_{m,n}|^2 > |g_{m,n}|^2 |h_{e,n}|^2$, which cause $x_n<0, y_n>0$, and $z_n>0$.
These conditions indicate the existence of a positive real root, which corresponds to the optimal jammer power $P_{j_n}^{o}$ required to achieve maximum secure rate over the snatched subcarrier.
| {'timestamp': '2019-01-14T02:18:22', 'yymm': '1901', 'arxiv_id': '1901.03614', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03614'} | arxiv |
\section{Introduction}
Given a seismic image that is the result of stacking or migration processing in terms space and time coordinates, the next step is generating a geological interpretation. An interpretation of the seismic image includes delineating geological features, such as faults, chimneys, channels and important horizons. In this work, we focus on horizons and geological units. If two horizons are the upper and lower boundary of a specific rock type or unit, the area in between the two horizons corresponds to a single geologic entity. This is not a requirement for the methods and examples we present. Any two horizons may also contain an arbitrary stack of layers and rock types in between. We can still consider this as a single meta-unit and aim to classify it as such.
Neural networks have a long history of learning from example seismic interpretations, to help and speed up manual interpretation. Classic works \citep{A226265, Veezhinathan1993} were, because of computational resources, limited to train on a single (window of a) time-recording, or a small portion of a seismic image at a time. Various more recent works pose geological interpretation problems as the binary classification of the central pixel of a small patch/volume of seismic data \citep{doi:10.1111/j.1365-2478.2005.00489.x, doi:10.1190/1.1438976, doi:10.1190/tle37070529.1, doi:10.1190/segam2018-2997304.1, doi:10.1190/segam2018-2997865.1}. Applying such a trained network provides the probability that the central pixel of each patch is a fault/channel/salt/chimney/horizon or not. This strategy has the limitation that the network never sees the large-scale features present in large seismic images. Network architectures like autoencoders and U-nets \citep{Ronneberger2015} that map image-to-image do not have the same limitation, provided the data and label images are sufficiently large. These methods simultaneously classify all pixel in a large image, see \cite{wu2018deep, doi:10.1190/segam2018-2997085.1} for geoscientific applications. \cite{doi:10.1190/segam2018-2997085.1} notes that this advantage also creates a challenge when generating the labels. Whereas image-to-pixel networks can work with scattered annotations, standard network and loss functions for image-to-image classifications require the label images to be annotated fully, i.e., each pixel needs to have a known class.
We propose to use a partial loss function as introduced by \cite{SeisHorizons}, to be able to work with data and label images for which only a small subset of the pixels have known labels. This approach avoids the aforementioned difficulties when generating labels. We propose and investigate two strategies for choosing the pixels that need to be labeled, for the problem of segmenting a seismic image into distinct geological units. Our training data consists of a few dozen very large seismic images collected in a sedimentary geological area. We employ a U-net based network design that processes the seismic images on multiple resolutions simultaneously, therefore taking various length-scales of geological features into account explicitly. Numerical results evaluate the proposed labeling strategies. They show that if we take geophysical domain-specific information into account that is not available in other applications such as natural language processing or video segmentation for self-driving vehicles, we obtain better results using fewer labeled pixels.
\section{Labeling strategies for seismic images}
Our goal is to develop strategies that require the least amount of time from a human interpreter of seismic images to generate the labels. Many test data sets for semantic segmentation (e.g., CamVid) come with fully annotated label images. Several geophysical works \citep{doi:10.1190/segam2018-2997085.1, di2018developing} also rely on full label images, which are time-consuming to create manually with high accuracy. Therefore, we propose two labeling strategies that require less user input.
The interpretation information provided to the authors by an industrial partner comes in the form of x-y-z locations of a few important geological horizons. Because the geology is sedimentary, we assume that every horizon occurs at a single depth for a given x-y location. This information opens up the possibility to generate labels of geological units by assigning a class value to the area in between any to horizons. A full label image and the corresponding data are shown in Figure \ref{data_label_ex}. The number of occurances per class in the labels is evidently unbalanced.
\begin{figure}[!htb]
\centering
\begin{subfigure}[b]{0.49\textwidth}
\centering
\includegraphics[width=1.0\textwidth]{data_4.png}
\caption{}
\label{data_ex}
\end{subfigure}
\begin{subfigure}[b]{0.49\textwidth}
\centering
\includegraphics[width=1.0\textwidth]{label_4.png}
\caption{}
\label{label_ex}
\end{subfigure}
\caption{(a) One of the 24 data images of size $1088 \times 2816$ pixels, and (b) corresponding full label (not used in this work).}
\label{data_label_ex}
\end{figure}
\subsection{Scattered annotations}
Probably the simplest method to create label images is by selecting scattered points in the seismic image, and assign the class to just those pixels. If the intepreter investigates $n_\text{samp}$ locations in the seismic image, we obtain $n_\text{samp}$ label pixels. Questions regarding this strategy include 1) should we select an equal number of label pixels per class? 2) What if the interpreter only works on `easy' locations and does not create labels near the class boundaries? Answers are beyond the scope of this work, but in the numerical examples, we generate an equal number of label pixels per class, at randomly selected locations.
\subsection{Column-wise annotations}
Suppose the interpreter labels one column at a time. If $n_\text{horizons}$ horizons are marked in the $n_z \times n_x$ image, all points in between the horizon locations are also known. Labeling $n_\text{samp}$ pixels will thus result in $n_\text{samp} / n_\text{horizons} \times n_z$ labeled pixels. Provided that we are interested in a few horizons and geologic units, column-wise annotations yield a much larger number of label pixels per manual annotation point compared to scattered annotation. The second benefit is that column-based labeling samples points at, and close to, the class boundaries.
\begin{figure}[!htb]
\centering
\begin{subfigure}[b]{0.49\textwidth}
\centering
\includegraphics[width=1.0\textwidth]{label_sub_4.png}
\caption{}
\label{label_sub_column}
\end{subfigure}
\begin{subfigure}[b]{0.49\textwidth}
\centering
\includegraphics[width=1.0\textwidth]{label_sub_4_rand.png}
\caption{}
\label{llabel_sub_rand}
\end{subfigure}
\caption{(a) A label image generated by column-wise annotations, and (b) randomly labeled pixels. Both labels are partial versions of Figure \ref{label_ex}. The colors indicate the class at each location, white space represents unknown labels that are not used to compute the loss or gradient.}
\label{label_sub}
\end{figure}
\section{Network and partial loss function}
Our network $f(\boldsymbol\theta,\mathbf y) : \mathbb{R}^N \rightarrow \mathbb{R}^{N \times n_\text{class}}$ is based on the U-net \citep{Ronneberger2015} and maps a vectorized seismic image, $\mathbf y \in \mathbb{R}^N$, of size $N = n_z \times n_x$ to $n_\text{class}$ probability images of the same size. The final interpretation follows as the class corresponding to the maximum probability per pixel. The network parameters $\boldsymbol\theta$ contain convolutional kernels and a final linear classifier matrix. We use the same network design as \cite{SeisHorizons}, which is a symmetric version of the U-net, with $37$ layers, and it has between $6$ and $32$ convolutional kernels of size $3 \times 3$ per layer. There are no fully connected layers, so that the network can use input-output of varying sizes.
Let us denote the number of training data/label examples (images) as $n_\text{ex}$. We represent the labels, the true probability per class per pixel, for a single image as $\mathbf C \in \mathbb{R}_+^{N \times n_\text{class}}$. The networks in this work train by minimizing the cross-entropy loss, which for a single data image with corresponding full label reads
\begin{equation}
l(\mathbf y,\boldsymbol\theta,\mathbf C) = - \sum_{i=1}^N \sum_{j=1}^{n_\text{class}} \mathbf C_{i,j} \log \bigg( \frac{\operatorname{exp} (f(\boldsymbol\theta,y)_{i,j})}{\sum_{j=1}^{n_\text{class}}\operatorname{exp}(f(\boldsymbol\theta,\mathbf y)_{i,j})} \bigg).
\end{equation}
The cross-entropy loss is separable with respect to the pixels (index $i$). To be able to work with partially known label images, we define the partial cross-entropy loss as
\begin{equation}\label{partial_ce}
l(\mathbf y,\boldsymbol\theta,\mathbf C)_\Omega = - \sum_{i \in \Omega} \sum_{j=1}^{n_\text{class}} \mathbf C_{i,j} \log \bigg( \frac{\operatorname{exp} (f(\boldsymbol\theta,\mathbf y)_{i,j})}{\sum_{j=1}^{n_\text{class}}\operatorname{exp}(f(\boldsymbol\theta,\mathbf y)_{i,j})} \bigg).
\end{equation}
The set $\Omega$ contains all pixels for which we have label information. We thus compute the full forward-propagation through the network using the full data image, $f(\boldsymbol\theta,\mathbf y)$, but the loss and gradient are based on a subset of pixels only.
We train the network using Algorithm 1 from \cite{SeisHorizons}, which is stochastic gradient descent using one out of the $24$ data and label images per iteration. We use the partial cross-entropy loss instead of the partial $\ell_1$-loss because we classify each pixel for the segmentation problem. There are $120$ epochs, where we reduce the learning-rate by a factor $\times 10$ every $30$ epochs, starting at $1.0$.
\section{Results}
We evaluate the results of the labels with scattered and column-wise annotations. Our goal is a) to see which of the two sampling strategies performs best, given a fixed number of manually annotated pixels, and b) can we obtain highly accurate geologic classifications form a `reasonably' small number of labeled pixels?
Both the seismic data and geologic interface locations from the Sea of Ireland were provided by an industrial partner. There are six classes, see Figure \ref{data_label_ex}. We give ourselves a budget of $100$ labeled pixels for each of the $24$ seismic images of size $1088 \times 2816$. We can thus choose to use label images with $100/5=20$ labeled columns because we need $5$ interface locations to obtain a fully labeled column, or $100$ randomly selected label pixels, i.e., $100/6 \approx 17$ per class. Figure \ref{label_sub} displays an example of a label for each labeling strategy.
\begin{figure}[!htb]
\centering
\begin{subfigure}[b]{0.49\textwidth}
\centering
\includegraphics[width=1.0\textwidth]{prediction_threshold4.png}
\caption{}
\label{pred_thres_column}
\end{subfigure}
\begin{subfigure}[b]{0.49\textwidth}
\centering
\includegraphics[width=1.0\textwidth]{prediction_threshold4_rand.png}
\caption{}
\label{pred_thres_random}
\end{subfigure}
\begin{subfigure}[b]{0.49\textwidth}
\centering
\includegraphics[width=1.0\textwidth]{prediction_threshold_error_4.png}
\caption{}
\label{pred_thres_error_column}
\end{subfigure}
\begin{subfigure}[b]{0.49\textwidth}
\centering
\includegraphics[width=1.0\textwidth]{prediction_threshold_error_4_rand.png}
\caption{}
\label{pred_thres_error_random}
\end{subfigure}
\caption{Classified seismic data using (a) column-sampling based training labels and (b) randomly sampled label pixels. Colors correspond to the class of the maximum predicted probability for each pixel. Errors in predicted class are shown in white in the bottom row, corresponding to the predictions above.}
\label{preds}
\end{figure}
The results in Figure \ref{preds} show that column-based annotations lead to more accurate predictions compared to generating labeled pixels at random locations. This verifies the, perhaps, expected result that a larger number of annotated label pixels provide more information. Additional experiments (not shown), reveal that more known label pixels lead to more accurate classifications. The maximum increase in prediction quality for the column-based labeling is limited, however, because the provided labels were generated manually by industrial seismic interpreters, and are not $100\%$ correct. Both labeling strategies achieve similar prediction accuracy when we increase the number of known label pixels to about $600$. We could also use data-augmentation to achieve higher prediction accuracy for a given number of labeled pixels, so the results serve as a baseline for the segmentation quality.
\section{Conclusions}
Interpreting seismic images by classifying them into distinct geologic units is a suitable task for neural-network-based computer vision systems. The networks map seismic images into an interpreted/segmented image. Networks that operate on multiple resolutions simultaneously can take both small and large scale geological structure into account. However, standard image-to-image networks and loss functions require target images for which each pixel has label information. This is a problem for geoscientific applications, as it is difficult and time-consuming to annotate large seismic images manually and completely. We presented a segmentation workflow that works with partially labeled target interpretations, thereby removing one of the main (perceived) barriers to the successful application of neural networks to the automatic interpretation of large seismic images. We proposed and evaluated two strategies for generating partial label images efficiently. Generating column-wise labels is more efficient because a small number of interface annotations also provides us with all labels in between. The combination of a symmetric U-net, partial cross-entropy loss function, training on large seismic images without forming patches, and time-efficient labeling strategies form a powerful segmentation method.
\bibliographystyle{abbrvnat}
| {'timestamp': '2019-01-15T02:04:15', 'yymm': '1901', 'arxiv_id': '1901.03786', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03786'} | arxiv |
\section{Introduction}
Active learning is a main approach to learning with limited labeled data. It tries to reduce the human efforts on data annotation by actively querying the most important examples (\cite{S10}).
ALiPy is a Python toolbox for active learning, which is suitable for various users. On one hand, the whole process of active learning has been well implemented. Users can easily perform experiments by several lines of codes to finish the whole process from data pre-process to result visualization. Also, more than 20 commonly used active learning methods have been implemented in the toolbox, providing users many choices. Table \ref{table:strategies} summarizes the main approaches implemented in ALiPy. On the other hand, ALiPy supports users to implement their own ideas about active learning with high freedom. By decomposing the active learning process into multiple components, and correspondingly implementing them with different modules, ALiPy is designed in a low coupling way, and thus let users to freely configure and modify any parts of the active learning. Furthermore, in addition to the traditional active learning setting, ALiPy also supports other novel settings. For example, the data examples could be multi-labeled, the oracle could be noisy, and the annotation could be cost-sensitive.
\begin{table}[h]
\centering
\caption{Implemented active learning strategies in different settings.} \label{table:strategies}
\begin{tabular}{p{0.35\columnwidth}| p{0.6\columnwidth}}
\toprule
\hline
\textbf{AL with Instance Selection} & Uncertainty (\cite{LewisG94}), Query By Committee (\cite{AbeM98}), Expected Error Reduction (\cite{RoyM01}), Random, Graph Density (\cite{EbertFS12}), BMDR (\cite{WangY13})), QUIRE (\cite{HuangJZ10}), LAL (\cite{KonyushkovaSF17}), SPAL (\cite{TH2019})\\
\hline
\textbf{AL for Multi-Label Data} & AUDI (\cite{HuangZ13}), QUIRE (\cite{HuangJZ14}), MMC (\cite{YangSWC09}), Adaptive (\cite{LiG13}), Random\\
\hline
\textbf{AL by Querying Features}& AFASMC (\cite{HuangXXSNC18}), Stability (\cite{ChakrabortyZBPDY13}), Random \\
\hline
\textbf{AL with Different Costs}& HALC (\cite{YanH18}), Random, Cost performance \\
\hline
\textbf{AL with Noisy Oracles}& CEAL (\cite{HuangCMZ17}), IEthresh (\cite{DonmezCS09}), Repeated (\cite{ShengPI08}), Random \\
\hline
\textbf{AL with Novel Query Types}& AURO (\cite{HuangCZ15}) \\
\hline
\textbf{AL for Large Scale Tasks}& Subsampling \\
\hline
\bottomrule
\end{tabular}
\end{table}
\section{Modules in ALiPy}
As illustrated in Figure~\ref{fig:framework}, we decompose the active learning implementation into multiple components. To facilitate the implementation of different active learning methods under different settings, we develop ALiPy based on multiple modules, each corresponding to a component of the active learning process.
Below is the list of modules in ALiPy.
\begin{itemize}
\item \textbf{alipy.data\_manipulate:} It provides the basic functions of data pre-process and partition. Cross validation or hold out test are supported.
\item \textbf{alipy.query\_strategy:} It consists of 25 commonly used query strategies.
\item \textbf{alipy.index.IndexCollection:} It helps to manage the indexes of labeled and unlabeled examples.
\item \textbf{alipy.metric:} It provides multiple criteria to evaluate the model performance.
\item\textbf{alipy.experiment.state} and \textbf{alipy.experiment.state\_io:} They help to save the intermediate results after each query and can recover the program from breakpoints.
\item\textbf{alipy.experiment.stopping\_criteria} It implements some commonly used stopping criteria.
\item\textbf{alipy.oracle:} It supports different oracle settings. One can set to have multiple oracles with noisy annotations and different costs.
\item\textbf{alipy.experiment.experiment\_analyser:} It provides functions for gathering, processing and visualizing the experimental results.
\item\textbf{alipy.utils.multi\_thread:} It provides a parallel implementation of k-fold experiments.
\end{itemize}
The above modules are independently designed implemented. In this way, the code between different parts can be implemented without limitation. Also, each independent module can be replaced by users' own implementation (without inheriting). The modules in ALiPy will not influence each other and thus can be substituted freely.
In each module, we also provide a high flexibility to make the toolbox adaptive to different settings. For example, in data split function, one can provide the shape of your data matrix or a list of example names to get the split. In the oracle class, one can further specify the cost of each label, and query instance-label pairs in multi-label setting. In the analyser class, the experimental results can also be unaligned for cost-sensitive setting, where an interpolate will be performed automatically when plotting the learning curves.
For more details, please refer to the document at http://parnec.nuaa.edu.cn/huangsj/alipy, and the git repository at https://github.com/NUAA-AL/ALiPy.
\begin{figure*}[!t]
\begin{center}
\centering
\includegraphics[width=0.8\textwidth]{framework.png}\\
\caption{A general framework for implementing an active learning approach.} \label{fig:framework}
\end{center}
\end{figure*}
\section{Usage of ALiPy}
ALiPy provides several optional usages for different users.
For the users who are less familiar with active learning and want to simply apply a method to a dataset, ALiPy provides a class which has encapsulated various tools and implemented the main loop of active learning, namely \textbf{alipy.experiment.AlExperiment}. Users can run the experiments with only a few lines of codes by this class without any background knowledge.
For the users who want to experimentally evaluate the performance of existing active learning methods, ALiPy provides implementations of more than 20 state-of-the-art methods, along with detailed instructions and plentiful example codes.
For the users who want to implement their own idea and perform active learning experiments, ALiPy provides module based structure to support users to modify any part of active learning. More importantly, some novel settings are supported to make the implementation more convenient. We also provide detailed api references and usage examples for each module and setting to help users get started quickly. Note that, ALiPy does not force users to use any tool classes, they are designed in an independent way and can be substituted by users' own implementation without inheriting anything.
For details, please refer to the documents and code examples available on the ALiPy homepage and github.
\vskip 0.2in
| {'timestamp': '2019-01-15T02:05:04', 'yymm': '1901', 'arxiv_id': '1901.03802', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03802'} | arxiv |
\section{The Core Analysis}
\label{sec:analysis}
The $\lambda_{\tt q}$ calculus presented
in Section~\ref{sec:modeling}
is the touchstone of the static analysis proposed
for asynchronous JavaScript programs.
The analysis is designed to be sound;
thus,
we devise abstract domains
and semantics
that over-approximate
the behavior of $\lambda_{\tt q}$.
Currently,
there are few implementations available
for asynchronous JavaScript,
and previous efforts mainly focus on
modeling the event system
of client-side applications~\cite{jensendom,parkdom}.
To the best of our knowledge,
it is the first static analysis for ES6 promises.
The rest of this section describes the details of the analysis.
\subsection{The Analysis Domains}
\label{sec:tajs-domains}
\begin{figure}[th]
\footnotesize
\centering
\begin{align*}
l \in \widehat{Addr} &= \{l_i \mid i\ \text{is\ an\ allocation\ site}\} \cup \{l_{time}, l_{io}\} \\
\pi \in \widehat{Queue} &= \widehat{Addr} \hookrightarrow \mathcal{P}(\widehat{QueueObject})\\
q \in \widehat{QueueObject} &= \widehat{QueueState} \times \mathcal{P}(\widehat{Callback}) \times \mathcal{P}(\widehat{Callback}) \times \mathcal{P}(\widehat{Addr}) \\
qs \in \widehat{QueueState} &= \{{\tt pending}\} \cup (\{{\tt fulfilled, rejected}\} \times Value)\\
clb \in \widehat{Callback} &= \widehat{Addr} \times \widehat{Addr} \times F \times Value^{*} \\
\kappa \in \widehat{ScheduledCallbacks} &= (\mathcal{P}(\widehat{Callback}))^{*} \\
\tau \in \widehat{ScheduledTimerIO} &= (\mathcal{P}(\widehat{Callback}))^{*} \\
\phi \in \widehat{QueueChain} &= (\mathcal{P}(\widehat{Addr}))^{*} \\
\end{align*}
\caption{{The abstract domains of $\lambda_{\tt q}$}.}\label{fig:tajs-async-domains}
\end{figure}
Figure~\ref{fig:tajs-async-domains}
presents the abstract
domains of the $\lambda_{\tt q}$ calculus
that underpin our static analysis.
Below we make a summary of our primary design choices.
\dde{Abstract Addresses}
As a starting point,
we employ allocation site abstraction
for modeling the space of addresses.
It is the standard way used in literature
for abstracting addresses
which keeps the domain finite~\cite{tajs,madsen2015ev}.
Also note that
we still define two internal addresses,
i.e., $l_{time}, l_{io}$,
corresponding to the addresses of the
queue objects responsible for timers
and asynchronous I/O respectively.
\dde{Abstract Queue}
We define an abstract queue as
the partial map of abstract addresses to
an element of the power set of abstract queue objects.
Therefore,
an address might point to multiple queue objects.
This abstraction over-approximates
the behavior of $\lambda_{\tt q}$
and allows us to capture all possible program behaviors
that might stem from the analysis imprecision.
\dde{Abstract Queue Objects}
A tuple
consisting of an abstract queue state---observe
that the domain of abstract queue states
is the same as $\lambda_{\tt q}$---two
sets of abstract callbacks
(executed on fulfillment and rejection respectively),
and a set of abstract addresses
(used to store the queue objects
that are dependent on the current one)
represents an abstract queue object.
Notice how this definition differs from
that of $\lambda_{\tt q}$.
First,
we do not keep the registration order
of callbacks;
therefore,
we convert the two lists into two sets.
The programming pattern related to
promises supports our design decision.
Specifically,
developers often use promises as a chain;
registering two callbacks
on the same promise object is quite uncommon.
Madsen et. al.~\cite{madsen2015ev}
made similar observations for
the event-driven programs.
That abstraction can negatively affect precision
only when we register multiple callbacks on
a \emph{pending} queue object.
Recall from Figure~\ref{fig:semantics},
when we register a callback on a settled queue object,
we can precisely track its execution order
since we directly add it to the list of scheduled callbacks.
Second,
we define the last component as
a set of address;
something that enables us to
track all possible dependent queue objects soundly.
\dde{Abstract Callback}
An abstract callback comprises
two abstract addresses,
one function,
and a list of values
which stands for the arguments
of the function.
Note that the first address corresponds to
{\tt this} object,
while the second one is the queue object
which the return value of the function fulfills.
\dde{Abstract List of Scheduled Callbacks}
We use a list of sets
to abstract the domain responsible
for maintaining the callbacks
which are ready for execution
(i.e., $\widehat{ScheduledCallbacks}$
and $\widehat{ScheduledTimerIO}$).
In this context,
the $i^{th}$ element of a list
denotes the set of callbacks
that are executed after those placed
at the $(i-1)^{th}$ position
and before the callbacks located
at the $(i+1)^{th}$ position of the lists.
The execution of callbacks
of the same set is not known to the analysis;
they can be called in any order.
For example,
consider the following sequence $[\{x\}, \{y,\ z\}, \{w\}]$,
where $x, y, z, w \in \widehat{Callback}$.
We presume that the execution of elements
$y, z$ succeeds that of $x$,
and precedes that of $w$,
but we cannot compare $y$ with $z$,
since they are elements of the same set;
thus,
we might execute $y$ before $z$
and vice versa.
Note that a critical requirement of our domains' definition
is that they should be finite
so that the analysis is guaranteed to terminate.
Keeping the lists of scheduled callbacks bound is tricky
because the event loop might process
the same callback multiple times,
and therefore,
we have to add it to the lists $\kappa$ or $\tau$
more than one time.
For that reason,
those lists monitor the execution order of callbacks
up to a certain limit $n$.
The execution order of the callbacks
scheduled after that limit is not preserved;
thus,
the analysis places them in the same set.
\dde{Abstract Queue Chain}
The analysis uses
the last component of our abstract domains
to capture the effects of uncaught exceptions
during the execution of callbacks.
We define it as a sequence of sets of addresses.
Based on the abstract translation of
the semantics of $\lambda_{\tt q}$,
when the analysis reaches an uncaught exception,
it inspects the top element of
the abstract queue chain
and rejects all the queue objects found in that element.
If the abstract queue chain is empty,
the analysis propagates that exception
to the caller function as usual.
Note that the queue chain is
guaranteed to be bound.
In particular,
during the execution of a callback,
the size of the abstract queue chain is always one
because the event loop executes only one callback at a time.
The only case
when the size of the abstract queue chain is greater than 1 is
when we have nested promise executors.
A promise executor is a function passed as an argument
in a promise constructor.
However,
since we cannot have an unbound number of nested
promise executors,
the size of the abstract queue chain remains finite.
\subsubsection{Tracking the Execution Order}
{\bf Promises.} Estimating the order
in which
the event loop executes callbacks of promises
is straightforward
because it is a direct translation
of the corresponding semantics of $\lambda_{\tt q}$.
In particular,
there are two possible cases:
\begin{itemize}
\item \emph{Settle a promise which has registered callbacks:}
When we settle (i.e., either fulfill or reject) a promise object
which has registered callbacks,
we schedule those callbacks associated with the next
state of the promise
by putting them
on the tail of the list $\kappa$.
For instance,
if we fulfill a promise,
we append all the callbacks
triggered on fulfillment on the list $\kappa$.
A reader might observe
that if there are multiple callbacks registered on
the same promise object,
we put them on the same set
which is the element that we finally add to $\kappa$.
The reason for this is that
an abstract queue object does not
keep the registration order of callbacks.
\item \emph{Register a callback on an already settled promise:}
When we encounter a statement of the form
{\tt x.then(f1, f2)},
where {\tt x} is a settled promise,
we schedule either callback {\tt f1} or {\tt f2}
(i.e., we add it to the list $\kappa$)
depending on the state of that promise,
i.e., we schedule callback {\tt f1}
if {\tt x} is fulfilled
and {\tt f2} if it is rejected.
\end{itemize}
\noindent
{\bf Timers \& Asynchronous I/O.} A static analysis
is not able to reason about the external environment.
For instance,
it cannot decide
when an operation on a file system
or a request to a server is complete.
Similarly,
it is not able to deal with time.
For that purpose,
we adopt a conservative approach
for tracking the execution order
between callbacks related to
timers and asynchronous I/O.
In particular,
we assume that the execution
order between those callbacks is unspecified;
thus,
the event loop might process them in any order.
However,
we \emph{do} keep track the execution order
between nested callbacks.
\subsection{Callback Graph}
\label{sec:callback-graph}
In this section,
we introduce the concept of \emph{callback graph};
a fundamental component of our analysis
that captures how data flow is propagated
between different asynchronous callbacks.
A callback graph is defined as an element of
the following power set:
$$
cg \in CallbackGraph = \mathcal{P}(Node \times Node)
$$
We define every node of a callback graph as
$n \in Node = C \times F$,
where $C$ is the domain of contexts
while $F$ is the set of all the functions of the program.
Every element of a callback graph $(c_1, f_1, c_2, f_2) \in cg$,
where $cg \in CallbackGraph$ has the following meaning:
\emph{the function $f_2$ in context $c_2$ is executed
immediately after the function $f_1$ in context $c_1$}.
We can treat the above statement as
the following expression: $f_1();f_2();$
\begin{definition}\label{def:1}
Given a callback graph $cg \in CallbackGraph$,
we define the binary relation $\rightarrow_{cg}$
on nodes of the callback graph $n_1, n_2 \in Node$ as:
$$
n_1 \rightarrow_{cg} n_2 => (n_1, n_2) \in cg
$$
\end{definition}
\begin{definition}\label{def:2}
Given a callback graph $cg \in CallbackGraph$,
we define the binary relation $\rightarrow_{cg}^{*}$
on nodes of the callback graph $n_1, n_2 \in Node$ as:
\begin{align*}
n_1 \rightarrow_{cg} n_2 &=> n_1 \rightarrow_{cg}^{*} n_2\\
n_1 \rightarrow_{cg}^{*} n_2 \land n_2 \rightarrow_{cg}^{*} n_3 &=> n_1 \rightarrow_{cg}^{*} n_3, \quad \text{where}\ n_3 \in Node
\end{align*}
\end{definition}
Definition~\ref{def:1}
and Definition~\ref{def:2}
introduce the concept of a \emph{path}
between two nodes in a callback graph $cg \in CallbackGraph$.
In particular,
the relation $\rightarrow_{cg}$
denotes that there is path of length one between two nodes
$n_1, n_2$,
i.e., $(n_1, n_2) \in cg$.
On the other hand,
the relation $\rightarrow_{cg}^{*}$
describes
that there is a path of unknown length
between two nodes.
Relation $\rightarrow_{cg}^{*}$
is very important
as it allows us to identify the \emph{happens-before}
relation between two nodes $n_1, n_2$
even if $n_2$ is executed long after $n_1$,
that is $(n_1, n_2) \not\in cg$.
A significant property of a callback graph
is that it does \emph{not} have any cycles,
i.e.,
$$\forall n_1, n_2 \in Node.\: n_1 \rightarrow_{cg}^{*} n_2 => n_2 \not\rightarrow_{cg}^{*} n_1$$
Notice
that if $n_1 \not\rightarrow_{cg}^{*} n_2$,
and $n_2 \not\rightarrow_{cg}^{*} n_1$ hold,
the analysis cannot estimate
the execution order between $n_1$
and $n_2$.
Therefore,
we presume that $n_1$
and $n_2$ can be called in any order.
\subsection{Analysis Sensitivity}
\label{sec:analysis-sensitivity}
\subsubsection{Callback Sensitivity}
Knowing the temporal relations between asynchronous callbacks
enables us to capture how data flow is propagated precisely.
Typically,
a naive flow-sensitive analysis,
which exploits the control flow graph (CFG),
represents the event loop
as a single program point with only one context
corresponding to it.
Therefore---unlike traditional function calls---the
analysis misses
the happens-before relations between callbacks
because they are triggered by the same program location
(i.e., the event loop).
To address those issues,
we exploit the callback graph to devise
a more precise analysis,
which we call \emph{callback-sensitive} analysis.
The callback-sensitive analysis
propagates the state with regards to
the $\rightarrow_{cg}$
and $\rightarrow_{cg}^{*}$ relations
found in a callback graph $cg \in CallbackGraph$.
Specifically,
when the analysis needs to propagate
the resulting state from the exit point of a callback $x$,
instead of propagating that state to the caller
(note that the caller of a callback is the event loop),
it propagates it to the entry points
of the next callbacks,
i.e., all callback nodes $y \in Node$
where $x \rightarrow_{cg} y$ holds.
In other words,
the edges of a callback graph
reflect how the state is propagated
from the exit point of a callback node $x$
to the entry point of a callback node $y$.
Obviously,
if there is not any path between two nodes
in the graph,
that is,
$x \not\rightarrow_{cg}^{*} y$,
and $y \not\rightarrow_{cg}^{*} x$,
we propagate the state coming from the exit point of
$x$ to the entry point of $y$
and vice versa.
\point{Remark}
Callback-sensitivity does not work with contexts
to improve the precision of the analysis.
Therefore,
we still represent the event loop
as a single program point.
As a result,
the state produced
by the last executed callbacks is propagated to the event loop,
leading to the join of this state
with the initial one.
The join of those states
is then again propagated across the nodes of
the callback graph until convergence.
Therefore,
there is still some imprecision.
However,
callback-sensitivity minimizes
the number of those joins,
as they are only caused by the callbacks invoked last.
\subsubsection{Context-Sensitivity}
\label{sec:context-sen}
\begin{figure}
\begin{lstlisting}
function foo() { ... }
var x = Promise.resolve()
.then(foo)
.then(function ff1() { ... })
.then(foo)
.then(function ff2() { ... })
.then(foo)
.then(function ff3() { ... });
\end{lstlisting}
\caption{An example program where we create a promise chain.
Notice that we register the function {\tt foo} multiple times across the chain.}\label{fig:ex-context}
\end{figure}
\begin{figure}[t]
\centering
\subcaptionbox{QR-insensitive analysis\label{fig:context-cg1}}{\includegraphics[width=0.29\linewidth]{no-context.pdf}}%
\hfill
\subcaptionbox{QR-sensitive analysis\label{fig:context-cg2}}{\includegraphics[width=0.7\linewidth]{context.pdf}}%
\caption{Callback graph of program of Figure~\ref{fig:ex-context}
produced by the QR-insensitive and QR-sensitive analysis respectively.}\label{fig:context-cg}
\end{figure}
Recall from Section~\ref{sec:callback-graph}
that a callback graph is defined
as $\mathcal{P}(Node \times Node)$,
where $n \in Node = C \times F$.
It is possible to increase the precision of a callback graph
(and therefore the precision of the analysis)
by distinguishing callbacks based on
the context in which they are invoked.
Existing flavors of context-sensitivity are not
so useful in differentiating asynchronous functions from each other.
For instance,
object-sensitivity~\cite{object-sen,context-sen},
which separates invocations based on
the value of the receiver---and
has been proven to be particularly effective
for the analysis of object-oriented languages---is
not fruitful in the context of
asynchronous callbacks
because in most cases
the receiver of callbacks corresponds to the global object.
Similarly,
previous work in the static analysis of JavaScript~\cite{tajs,jsai}
creates a context with regards to the arguments of a function.
Such a strategy might not be potent in cases
where a callback expects no arguments
or the arguments from two different calls are indistinguishable.
We introduce one novel context-sensitivity flavor---which
we call \emph{QR-sensitivity}---as
an effort to boost the analysis precision.
QR-sensitivity separates callbacks according to
1) the queue object to which they are added (Q),
and 2) the queue object their return value fulfills (R).
In this case,
the domain of contexts is given by:
$$c \in C = \widehat{Addr} \times \widehat{Addr}$$
In other words,
every context is
a pair $(l_q, l_r) \in \widehat{Addr} \times \widehat{Addr}$,
where $l_q$ stands for the allocation site
of the queue object to which we add a callback,
and $l_r$ is the abstract address of the queue object
which the return value of a callback fulfills.
Notice that this domain is finite;
thus,
the analysis always terminates.
\\
\noindent
{\bf Example:} As a motivating example,
consider the program of Figure~\ref{fig:ex-context}.
This program creates a promise chain
where we register different callbacks
at every step of the asynchronous computation.
At line 1,
we define the function {\tt foo()}.
We asynchronously call {\tt foo()}
multiple times,
i.e., at lines 4, 6, and 8.
Recall that the chains of promises
enable us to enforce a deterministic execution
of the corresponding callbacks.
Specifically,
based on the actual execution,
the event loop invokes the callbacks in the following order:
${\tt foo()} -> {\tt ff1()} -> {\tt foo()} -> {\tt ff2()} -> {\tt foo()} -> {\tt ff3()}$.
Figure~\ref{fig:context-cg1}
presents the callback graph
of the program of our example
produced by a QR-insensitive analysis.
In this case,
the analysis considers the different invocations of {\tt foo()}
as identical.
As a result,
the analysis loses the temporal relation between
{\tt foo()}
and {\tt ff1()}, {\tt ff2()}---indicated
by the fact that the respective nodes are not connected
to each other---because {\tt foo()}
is also called both before and after
{\tt ff1()} and {\tt ff2()}.
On the contrary,
a QR-sensitive analysis ends up
with an entirely precise callback graph
as shown in Figure~\ref{fig:context-cg2}.
The QR-sensitive analysis distinguishes
the different invocations of {\tt foo()} from each other
because it creates three different contexts;
one for every call of {\tt foo()}.
Specifically,
we have $c_1=(l_3,l_4), c_2=(l_5,l_6), c_3=(l_7, l_8)$,
where $l_i$ stands for the promise object allocated at line $i$.
For example,
the second invocation of {\tt foo()}
is related to the promise object
created by the call of {\tt then()} at line 5,
and its return value fulfills the promise object
allocated by the invocation of {\tt then()} at line 6.
\subsection{Implementation}
\begin{figure}
\begin{lstlisting}
function open(filename, flags, mode, callback) {
TAJS_makeContextSensitive(open, 3);
var err = TAJS_join(TAJS_make("Undef"), TAJS_makeGenericError());
var fd = TAJS_join(TAJS_make("Undef"), TAJS_make("AnyNum"));
TAJS_addAsyncIOCallback(callback, err, fd);
}
var fs = {
open: open
...
}
\end{lstlisting}
\caption{{A model for {\tt fs.open} function.}
All functions starting with {\tt TAJS\_}
are special functions whose
body does not correspond to any node in the CFG.
They are just hooks for producing side-effects to the state
or evaluating to some value,
and their models are implemented in Java.
For instance,
{\tt TAJS\_make("AnyStr")} evaluates to a value
that can be any string.}\label{fig:ex-model}
\vspace{-4mm}
\end{figure}
Our prototype implementation extends~\emph{TAJS}~\cite{tajs,lazypropagation,jensendom};
a state-of-the-art static analyzer for JavaScript.
TAJS analysis is implemented
as an instance of the abstract interpretation framework~\cite{abstract-inter},
and it is designed to be sound.
It uses a lattice specifically designed for JavaScript
which is capable of handling
the vast majority of JavaScript's complicated features
and semantics.
TAJS analysis is both flow- and context-sensitive.
The output of the analysis is the set of all
reachable states from an initial state
along with a call graph.
TAJS can detect
various type-related errors such as
the use of a non-function variable in a call expression,
property access of {\tt null} or {\tt undefined} variables,
inconsistencies caused by implicit type conversions,
and many others~\cite{tajs}.
Prior to our extensions,
TAJS consisted of approximately \nnum{83500} lines of Java code.
The size of our additions is roughly \nnum{6000} lines of Java code.
Our implementation is straightforward
and is guided by the design of our analysis.
Specifically,
we first incorporate the domains
presented in Figure~\ref{fig:tajs-async-domains}
into the definition of the abstract state of TAJS.
Then,
we provide models for promises
written in Java by faithfully
following the ECMAScript specification.
Recall again that
our models exploit the $\lambda_{\tt q}$ calculus
presented in Section~\ref{sec:modeling}
and they produce side-effects
that over-approximate the behavior of JavaScript promises.
Beyond that,
we implement models for the special constructs of $\lambda_{\tt q}$,
i.e., {\tt addTimerCallback}, {\tt addIOCallback}
(Recall Section~\ref{sec:model-timers-io}),
which are used for adding callbacks
to the timer- and asynchronous I/O-related queue objects
respectively.
We implement the models for timers in Java;
however,
we write JavaScript models for asynchronous I/O operations,
when it is necessary.
For example,
Figure~\ref{fig:ex-model}
shows the JavaScript code that models
function {\tt open()} of the Node.js module {\tt fs}.
In particular,
{\tt open()} asynchronously opens a given file.
When I/O operation completes,
the callback provided by the developer is called
with two arguments:
1) {\tt err} which is not {\tt undefined}
if there is an error during I/O,
2) {\tt fd} which is an integer indicating
the file descriptor of the opened file.
Note that
{\tt fd} is {\tt undefined},
if any error occurs.
Our model first makes
{\tt open()} parameter-sensitive
on the third argument
which corresponds to the callback provided by the programmer.
Then,
at lines 3 and 4,
it initializes the arguments of the callback,
i.e., {\tt err} and
{\tt fd} respectively.
Observe that we initialize those arguments
so that they capture
all the possible execution scenarios,
i.e., {\tt err} might be {\tt undefined} or
point to an error object,
and {\tt fd} might be {\tt undefined}
or any integer reflecting all possible file descriptors.
Finally,
at line 5,
we call the special function {\tt TAJS_addAsyncIOCallback()},
which registers the given callback on
the queue object responsible for I/O operations,
implementing the semantics of the {\tt addIOCallback} primitive
from our $\lambda_{\tt q}$ calculus.
\section{Conclusions \& Future Work}
\label{sec:conclusions}
Building upon previous works,
we presented the $\lambda_{\tt q}$ calculus
for modeling asynchrony in JavaScript.
Our calculus $\lambda_{\tt q}$ is flexible enough
so that we can express almost every asynchronous primitive
in the JavaScript language
up to the 7th edition of the ECMAScript.
We then presented an abstract version of $\lambda_{\tt q}$
which over-approximates the semantics of our calculus.
By exploiting that abstract version,
we designed and implemented what is,
to the best of our knowledge,
the first static analysis for dealing with
a wide range of asynchrony-related features.
At the same time,
we introduced the concept of callback graph;
a directed acyclic graph
which represents the temporal relations
between the execution of asynchronous callbacks,
and we proposed a more precise analysis,
i.e.~\emph{callback-sensitive} analysis
that respects the execution order of callbacks.
We parameterized our analysis
with a new context-sensitivity flavor
that is specifically used for asynchronous callbacks.
We then experimented
with different parameterizations of our analysis
on a set of hand-written
and real-world programs.
The results revealed
that we can analyze medium-sized JavaScript programs
using our approach.
The analysis sensitivity
(i.e., both callback- and context-sensitivity)
is able to ameliorate the analysis precision
without highly sacrificing performance.
Specifically,
as observed in the real-world modules,
our analysis achieves
a~\empirical{79\%} precision for the callback graph,
on average.
If we combine callback- and QR-sensitivity,
we can further improve the callback graph precision
by up to~\empirical{28.5\%}.
Also,
the callback- and QR-sensitive analysis
achieves a~\empirical{88\%} callback graph precision on average,
and reduces the total number of
type errors by~\empirical{16.7\%}.
Our work constitutes a general technique
that can be used as a base for further research.
Specifically, recent studies showed
that concurrency bugs found in JavaScript programs may sometimes be caused
by asynchrony~\cite{concstudy,fuzz}.
We could leverage our work to design a client analysis on top of it
so that it statically detects data races in
JavaScript programs.
Our callback graph might be an essential element
for such an analysis
because we can inspect it to identify
callbacks whose execution might be non-deterministic,
i.e., unconnected nodes in the callback graph.
\section{Empirical Evaluation}
\label{sec:evaluation}
In this section,
we evaluate our static analysis
on a set of hand-written micro-benchmarks
and a set of real-world JavaScript modules.
Then,
we experiment with different parameterizations of the analysis,
and report the precision and performance metrics.
\subsection{Experimental Setup}
\begin{table}[t]
\centering
\resizebox{\linewidth}{!}{%
\begin{tabular}{|l|r|r|r|r|r|r|}
\hline
{\bf Benchmark} & {\bf LOC} & {\bf ELOC} & {\bf Files} & {\bf Dependencies} & {\bf Promises} & {\bf Timers/Async I/O} \bigstrut\\
\hline\hline
\href{https://github.com/vitalets/controlled-promise}{controlled-promise} & 225 & 225 & 1 & 0 & 4 & 1 \\
\href{https://github.com/github/fetch}{fetch} & 517 & \nnum{1118} & 1 & 1 & 26 & 2 \\
\href{https://github.com/kokororin/honoka}{honoka} & 324 & \nnum{1643} & 6 & 6 & 4 & 1 \\
\href{https://github.com/axios/axios}{axios} & \nnum{1733} & \nnum{1733} & 26 & 0 & 7 & 2 \\
\href{https://github.com/alphasp/pixiv-api-client}{pixiv-client} & \nnum{1031} & \nnum{3469} & 1 & 2 & 64 & 2 \\
\href{https://github.com/isaacs/node-glob}{node-glob} & \nnum{1519} & \nnum{6131} & 3 & 6 & 0 & 5 \\
\hline
\end{tabular}
}
\caption{{List of selected macro-benchmarks
and their description.
Each benchmark is described by
its lines of code (LOC),
its lines of code including its dependencies (ELOC),
number of files,
number of dependencies,
number of promise-related statements
(e.g., {\tt Promise.resolve()},
{\tt Promise.reject()},
{\tt then()}, etc.),
and number of statements associated with timers
(e.g., {\tt setTimeout()}, {\tt setImmediate()}, etc.) or
asynchronous I/O
(e.g., asynchronous file system or network operations etc.).
}}
\label{tb:benchmarks}
\vspace{-4mm}
\end{table}
To test that our technique behaves as expected
we first wrote a number of micro-benchmarks.
Each of those programs consists of approximately 20--50 lines of code
and examines certain parts of the analysis.
Beyond micro-benchmarks,
we evaluate our analysis on 6 real-world JavaScript modules.
The most common macro benchmarks
for static analyses used in the literature
are those provided by
JetStream\footnote{\url{https://browserbench.org/JetStream/}},
and V8 engine\footnote{\url{http://www.netchain.com/Tools/v8/}}\cite{tajs,jsai,safe-tunable}.
However,
those benchmarks are not asynchronous;
thus,
they are not suitable for evaluating our analysis.
To find interesting benchmarks,
we developed an automatic mechanism for
collecting and analyzing Github repositories.
First,
we collected a large number of Github repositories
using two different options.
The first option extracted the
Github repositories of the most depended upon
{\tt npm} packages\footnote{\url{https://www.npmjs.com/browse/depended}}.
The second option employed
the Github API\footnote{\url{https://developer.github.com/v3/}}
to find JavaScript repositories
which are related to promises.
We then investigated the Github repositories
which we collected at the first phase
by computing various metrics
such as lines of code,
number of promise-, timer-
and asynchronous IO-related statements.
We manually selected the 6 JavaScript modules
presented in Table~\ref{tb:benchmarks}.
Most of them are libraries
for performing HTTP requests
or file system operations.
We experiment with 4 different analyses:
1) an analysis which is neither callback- nor QR-sensitive (NC-No),
2) a callback-insensitive but QR-sensitive analysis (NC-QR),
3) a callback-sensitive but QR-insensitive analysis (C-No),
and 4) a both callback- and QR-sensitive analysis (C-QR).
We evaluate the precision of each analysis
in terms of the number of the analyzed callbacks,
the precision of the computed callback graph,
and the number of reported type errors.
We define
the precision of a callback graph as
the quotient between
the number of callback pairs
whose execution order is determined
and the total number of callback pairs.
Also,
we embrace a client-based precision metric,
i.e.,
the number of reported type errors
as in the work of~\cite{jsai}.
The fewer type errors an analysis reports,
the more precise it is.
The same applies to the number of callbacks
inspected by the analysis;
fewer callbacks indicate a more accurate analysis.
To compute the performance characteristics of every analysis,
we re-run every experiment ten times
in order to receive reliable measurements.
All the experiments were run on
a machine with an Intel i7 2.4{\tt GHz} quad-core processor
and 8{\tt GB} of RAM.
\begin{table}[t!]
\centering
\resizebox{\textwidth}{!}{%
\begin{tabular}{|l|r|r|r|r||r|r|r|r||r|r|r|r|}
\hline
& \multicolumn{4}{c||}{\textbf{Analyzed Callbacks}} & \multicolumn{4}{c||}{\textbf{Callback Graph Precision}} & \multicolumn{4}{c|}{\textbf{Type Errors}} \bigstrut\\
\hline\hline
{\bf Benchmark} & {\bf NC-No} & {\bf NC-QR} & {\bf C-No} & {\bf C-QR} & {\bf NC-No} & {\bf NC-QR} & {\bf C-No} & {\bf C-QR} & {\bf NC-No} & {\bf NC-QR} & {\bf C-No} & {\bf C-QR} \\
\hline
micro01 & 5 & 5 & 4 & 4 &0.8 & 0.8 & 1.0 & 1.0 &2 & 2 & 0 & 0\\
micro02 & 3 & 3 & 3 & 3 &1.0 & 1.0 & 1.0 & 1.0 &1 & 1 & 0 & 0\\
micro03 & 2 & 2 & 2 & 2 &1.0 & 1.0 & 1.0 & 1.0 &1 & 1 & 0 & 0\\
micro04 & 4 & 4 & 4 & 4 &0.5 & 0.5 & 0.5 & 0.5 &1 & 1 & 1 & 1\\
micro05 & 8 & 8 & 7 & 7 &0.96 & 0.96 & 1.0 & 1.0 &3 & 3 & 0 & 0\\
micro06 & 11 & 11 & 11 & 11 &1.0 & 1.0 & 1.0 & 1.0 &3 & 3 & 1 & 1\\
micro07 & 14 & 14 & 13 & 13 &0.86 & 0.87 & 1.0 & 1.0 &1 & 1 & 0 & 0\\
micro08 & 5 & 5 & 5 & 5 &0.8 & 0.8 & 0.8 & 0.8 &1 & 1 & 0 & 0\\
micro09 & 5 & 5 & 4 & 4 &0.9 & 0.9 & 1.0 & 1.0 &1 & 1 & 0 & 0\\
micro10 & 3 & 3 & 3 & 3 &1.0 & 1.0 & 1.0 & 1.0 &1 & 1 & 1 & 1\\
micro11 & 4 & 4 & 4 & 4 &0.83 & 0.83 & 0.83 & 0.83 &5 & 5 & 5 & 5\\
micro12 & 5 & 5 & 5 & 5 &0.9 & 0.9 & 1.0 & 1.0 &2 & 2 & 0 & 0\\
micro13 & 4 & 4 & 3 & 3 &0.83 & 0.83 & 1.0 & 1.0 &1 & 1 & 0 & 0\\
micro14 & 6 & 6 & 5 & 5 &0.8 & 0.8 & 1.0 & 1.0 &2 & 2 & 0 & 0\\
micro15 & 6 & 6 & 6 & 6 &0.8 & 0.8 & 1.0 & 1.0 &0 & 0 & 0 & 0\\
micro16 & 6 & 6 & 6 & 6 &1.0 & 1.0 & 1.0 & 1.0 &1 & 1 & 0 & 0\\
micro17 & 3 & 3 & 3 & 3 &0.67 & 0.67 & 0.67 & 0.67 &2 & 2 & 2 & 2\\
micro18 & 4 & 3 & 4 & 3 &0.83 & 1.0 & 0.83 & 1.0 &1 & 0 & 1 & 0\\
micro19 & 14 & 7 & 14 & 7 &0.73 & 0.93 & 0.74 & 1.0 &0 & 0 & 0 & 0\\
micro20 & 6 & 6 & 6 & 6 &0.93 & 0.93 & 1.0 & 1.0 &0 & 0 & 0 & 0\\
micro21 & 5 & 5 & 4 & 4 &0.9 & 0.9 & 1.0 & 1.0 &1 & 1 & 0 & 0\\
micro22 & 6 & 6 & 5 & 5 &0.87 & 0.87 & 0.9 & 0.9 &1 & 1 & 0 & 0\\
micro23 & 6 & 6 & 5 & 5 &0.87 & 0.87 & 1.0 & 1.0 &3 & 3 & 1 & 1\\
micro24 & 3 & 3 & 3 & 3 &1.0 & 1.0 & 1.0 & 1.0 &2 & 2 & 1 & 1\\
micro25 & 8 & 8 & 8 & 8 &0.79 & 0.79 & 0.79 & 0.79 &1 & 1 & 0 & 0\\
micro26 & 9 & 9 & 7 & 7 &0.89 & 0.89 & 1.0 & 1.0 &3 & 3 & 1 & 1\\
micro27 & 3 & 3 & 3 & 3 &1.0 & 1.0 & 1.0 & 1.0 &1 & 1 & 1 & 1\\
micro28 & 7 & 7 & 7 & 7 &0.81 & 0.81 & 0.81 & 0.81 &1 & 1 & 1 & 1\\
micro29 & 4 & 4 & 4 & 4 &0.5 & 1.0 & 0.5 & 1.0 &0 & 0 & 0 & 0\\
\hline
{\bf Average} & {\bf 5.83} & {\bf 5.55} & {\bf 5.45} & {\bf 5.17} & {\bf 0.85} & {\bf 0.88} & {\bf 0.91} & {\bf 0.94} & {\bf 1.45} & {\bf 1.41} & {\bf 0.55} & {\bf 0.52} \bigstrut\\
\hline
{\bf Total} & {\bf 169} & {\bf 161} & {\bf 158} & {\bf 150} & & & & & {\bf 42} & {\bf 41} & {\bf 16} & {\bf 15} \bigstrut \\
\hline
\end{tabular}}
\caption{{Precision on micro-benchmarks.}}
\label{table:micro-precision}
\vspace{-4mm}
\end{table}
\subsection{Results}
{\bf Micro-benchmarks.} Table~\ref{table:micro-precision} shows
how precise every analysis is on every micro-benchmark.
Starting with callback-insensitive analyses
(i.e., columns NC-No and NC-QR),
we observe that in general QR-sensitivity improves
the precision of the callback graph by~\empirical{3.6\%} on average.
That small boost of QR-sensitivity
is explained by the fact that \emph{only}~\empirical{3} out of~\empirical{29} micro-benchmarks invoke the same callback multiple times.
Recall from Section~\ref{sec:context-sen}
that QR-sensitivity is used to
distinguish different calls of the same callback.
Therefore,
if one program does not use a specific callback multiple times,
QR-sensitivity does not make any difference.
However, if we focus on the results of the micro-benchmarks
where we come across such behaviors,
i.e. micro18,
micro19,
and micro29,
we get a significant divergence
of the precision of callback graph.
Specifically,
QR-sensitivity improves precision by~\empirical{20.5\%},
\empirical{27.4\%}
and~\empirical{100\%} in
micro18,
micro19
and micro29 respectively.
Besides that,
in micro19,
there is a striking decrease in the number of the analyzed callbacks:
the QR-insensitive analyses inspect~\empirical{14} callbacks
compared to the QR-sensitive analyses
which examine only~\empirical{7}.
The results regarding the number of type errors
are almost identical for every analysis:
a QR-insensitive analysis
reports~\empirical{42} type errors in total,
whereas all the other QR-sensitive analyses
produce warnings for~\empirical{41} cases.
Moving to callback-sensitive analyses, the results indicate clear differences.
First, a callback-sensitive but QR-insensitive analysis
reports only~\empirical{16} type errors in total
(i.e., \empirical{61.9\%} fewer type errors than callback-insensitive analyses), and amplifies the average precision of the callback graph
from~\empirical{0.85} to~\empirical{0.91}.
As before,
the QR-sensitive analyses boost the precision of the callback graph
by~\empirical{20.4\%},
\empirical{35.1\%},
and~\empirical{100\%} in micro18,
micro19, and micro29 respectively.
Finally,
a callback-sensitive
and QR-insensitive analysis decreases
the total number of the analyzed callbacks
from~\empirical{169} to~\empirical{158}.
Notice that if callback-sensitivity
and QR-sensitivity are combined,
the total number of callbacks
is reduced by~\empirical{11.2\%}.
\\
\begin{table}[tp]
\centering
\resizebox{\textwidth}{!}{%
\begin{tabular}{|l|r|r|r|r||r|r|r|r||r|r|r|r|}
\hline
& \multicolumn{4}{c||}{\textbf{Analyzed Callbacks}} & \multicolumn{4}{c||}{\textbf{Callback Graph Precision}} & \multicolumn{4}{c|}{\textbf{Type Errors}} \bigstrut\\
\hline\hline
{\bf Benchmark} & {\bf NC-No} & {\bf NC-QR} & {\bf C-No} & {\bf C-QR} & {\bf NC-No} & {\bf NC-QR} & {\bf C-No} & {\bf C-QR} & {\bf NC-No} & {\bf NC-QR} & {\bf C-No} & {\bf C-QR} \\
\hline
controlled-promise & 6 & 6 & 6 & 6 & 0.866 & 0.905 & 0.866 & 0.905 & 3 & 3 & 2 & 2 \\
fetch & 22 & 22 & 19 & 19 & 0.829 & 0.956 & 0.822 & 0.972 & 8 & 8 & 6 & 6 \\
honoka & 8 & 8 & 6 & 6 & 0.929 & 0.929 & 1.0 & 1.0 & 1 & 1 & 0 & 0 \\
axios & 15 & 15 & 14 & 14 & 0.678 & 0.83 & 0.686 & 0.871 & 2 & 2 & 1 & 1 \\
pixiv-client & 18 & 18 & 17 & 15 & 0.771 & 0.803 & 0.794 & 0.863 & 3 & 3 & 3 & 2 \\
node-glob & 3 & 3 & 3 & 3 & 0.667 & 0.667 & 0.667 & 0.667 & 19 & 19 & 19 & 19 \\
\hline
{\bf Average} & {\bf 12} & {\bf 12} & {\bf 10.8} & {\bf 10.5} & {\bf 0.79} & {\bf 0.848} & {\bf 0.805} & {\bf 0.88} & {\bf 6} & {\bf 6} & {\bf 5.1} & {\bf 5} \bigstrut\\
\hline
{\bf Total} & {\bf 72} & {\bf 72} & {\bf 65} & {\bf 63} & & & & & {\bf 36} & {\bf 36} & {\bf 31} & {\bf 30}\bigstrut \\
\hline
\end{tabular}}
\caption{{Precision on macro-benchmarks.}}
\label{table:macro-precision}
\vspace{-4mm}
\end{table}
\noindent
{\bf Macro-benchmarks.}
Table~\ref{table:macro-precision} reports
the precision metrics of every analysis of the macro-benchmarks.
First, we make similar observations as those of micro-benchmarks.
In general,
QR-sensitivity leads to a more precise callback graph
for~4 out of~6 benchmarks.
The improvement ranges from~\empirical{4.6\%}
to~\empirical{26.9}\%.
On the other hand, callback-sensitive analyses contribute to fewer type errors for~5 out of~6 benchmarks
reporting~\empirical{16.7\%} fewer type errors in total.
Additionally,
if we combine QR- and callback-sensitivity,
we can boost the analysis precision for~5 out of~6 benchmarks.
Specifically,
the QR- and callback-sensitive analysis
improves the callback graph precision by up to~\empirical{28.5\%}
(see the {\tt axios} benchmark),
and achieves a~\empirical{88\%}
callback graph precision on average.
On the other hand,
the naive analysis (neither QR- nor callback-sensitive)
reports only a~\empirical{79\%} precision for callback graph
on average.
By examining the results for the {\tt node-glob} benchmark,
we see that every analysis produces identical results.
{\tt node-glob} uses only timers
and asynchronous I/O operations.
Neither callback- nor QR-sensitivity is effective
for that kind of benchmarks,
since we follow a conservative approach
for modeling the execution order of timers and asynchronous I/O,
regardless of the registration order of their callbacks.
For example,
we assume that two callbacks $x$ and $y$
are executed in any order,
even if $x$ is scheduled before $y$ (and vice versa).
Therefore, keeping a more precise state does not lead to
a more precise callback graph.
\begin{table}[tb]
\centering
\resizebox{\textwidth}{!}{%
\begin{tabular}{|l|r|r|r|r||r|r|r|r|}
\hline
& \multicolumn{4}{c||}{\textbf{Average Time}} & \multicolumn{4}{c|}{\textbf{Median}} \bigstrut\\
\hline\hline
{\bf Benchmark} & {\bf NC-No} & {\bf NC-QR} & {\bf C-No} & {\bf C-QR} & {\bf NC-No} & {\bf NC-QR} & {\bf C-No} & {\bf C-QR}\bigstrut\\
\hline
controlled-promise & 2.3 & 2.22 & 2.27 & 2.28 & 2.29 & 2.26 & 2.25 & 2.31 \\
fetch & 8.53 & 7.97 & 7.07 & 6.98 & 8.52 & 8.26 & 7.46 & 7.22 \\
honoka & 4.14 & 4.05 & 3.86 & 3.94 & 4.12 & 4.0 & 3.61 & 3.81 \\
axios & 6.99 & 7.86 & 6.74 & 8.32 & 7.02 & 8.0 & 6.94 & 8.37 \\
pixiv-client & 22.11 & 24.92 & 24.77 & 28.89 & 22.19 & 25.16 & 24.65 & 29.2 \\
node-glob & 15.55 & 16.71 & 15.46 & 14.47 & 16.62 & 16.71 & 16.17 & 15.74 \\
\hline
\end{tabular}}
\caption{{Times of different analyses in seconds.}}
\label{table:macro-performance}
\vspace{-6mm}
\end{table}
Table~\ref{table:macro-performance}
gives the running times of every analysis
on macro-benchmarks.
We notice that
in some benchmarks
(such as fetch)
a more precise analysis may decrease the running times
by~\empirical{3\%--18\%}.
This is justified
by the fact that a more precise analysis
might compress the state faster
than an imprecise analysis.
For instance,
in fetch,
an imprecise analysis led to the analysis
of 3 spurious callbacks,
yielding to a higher analysis time.
The results appear to be consistent
with those of the recent literature
which suggests that
precision might lead to a faster analysis
in some cases~\cite{parkdom}.
On the other hand,
we observe a non-trivial decrease in the analysis performance
in only benchmark.
Specifically,
the analysis sensitivity increased
the running times of {\tt pixiv-client}
by~\empirical{12\%--30.6\%}.
However,
such an increase seems to be acceptable.
\subsection{Case Studies}
\begin{figure}[t!]
\begin{multicols}{2}
\begin{lstlisting}[basicstyle=\scriptsize\ttfamily]
function consumed(body) {
if (body.bodyUsed) {
return Promise.reject(new TypeError("Already read"));
}
body.bodyUsed = true;
}
...
function Body() {
...
this.bodyUsed = false;
this._bodyInit = function() {
...
if (typeof body === "string") {
this._bodyText = body;
} else if (Blob.prototype.isPrototypeOf(body)) {
this._bodyBlob = body;
}
...
}
this.text = function text() {
var rejected = consumed(this);
if (rejected) {
return rejected;
}
if (this._bodyBlob) {
return readBlobAsText(this._bodyBlob);
} else if (this._bodyArrayBuffer) {
return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer));
} else if (this._bodyFormData) {
throw new Error("could not read FormData body as text");
} else {
return Promise.resolve(this._bodyText);
}
};
...
this.formData = function formData() {
return this.text().then(decode);
}
}
...
function Response(body) {
...
this._bodyInit(body);
}
Body.call(Response.prototype);
...
function fetch(input, init) {
return new Promise(function (resolve, reject) {
...
var xhr = new XMLHttpRequest();
xhr.onload = function onLoad() {
...
resolve(new Response(xhr.response));
}
});
}
\end{lstlisting}
\end{multicols}
\caption{Code fragment taken from fetch.}\label{fig:fetch1}
\end{figure}
In this section,
we describe some case studies
coming from the macro-benchmarks.
{\bf fetch.} Figure~\ref{fig:fetch1} shows a code fragment
taken from fetch\footnote{\url{https://github.com/github/fetch}}.
Note that we omit irrelevant code for brevity.
The function {\tt Body()} defines a couple of methods
(e.g., {\tt text()}, {\tt formData()})
for manipulating the body of a response.
Observe that those methods are registered on
the prototype of {\tt Response} using
the function {\tt Function.prototype.call()} at line 45.
Note that {\tt Body} also contains a method
(i.e., {\tt \_initBody()})
for initializing the body of
a response according to the type of the input.
To this end,
the {\tt Response} constructor takes a body
as a parameter and initializes it
through the invocation of {\tt \_initBody()} (lines 41, 43).
The function {\tt text()}
reads the body of a response in a text format
(lines 20--34).
If the body of the response has been already read,
{\tt text()} returns a rejected promise (lines 3, 22--23).
Otherwise,
it marks the property {\tt bodyUsed}
of the response object as true
(line 5),
and then it returns
a fulfilled promise depending on
the type of the body of the provided response (lines 25--33).
The function {\tt formData()} (lines 36--38) asynchronously reads
the body of a response in a text format,
and then it parses it into a {\tt FormData} object\footnote{\url{https://developer.mozilla.org/en-US/docs/Web/API/FormData}}
through the call of the function {\tt decode()}.
The function {\tt fetch()} (lines 47--56) makes
a new asynchronous request.
When the request completes successfully,
the callback {\tt onLoad()} is executed asynchronously
(line 51).
That callbacks finally fulfills
the promise returned by {\tt fetch()}
with a new response object initialized with the response of
the server (line 53).
\begin{figure}[t]
\begin{adjustbox}{minipage=\linewidth,margin=20pt \smallskipamount,center}
\centering
\begin{minipage}{.5\linewidth}
\begin{lstlisting}[caption={{Case 1}}, label={lst:fetch-case1},
basicstyle=\scriptsize\ttfamily]
fetch("/helloWorld").then(function foo(value) {
var formData = value.formData();
// Do something with form data.
})
\end{lstlisting}
\end{minipage}\hfill
\begin{minipage}{.5\linewidth}
\begin{lstlisting}[caption={{Case 2}}, label={lst:fetch-case2},
basicstyle=\scriptsize\ttfamily]
var response = new Response("foo=bar");
var formData = response.formData();
var response2 = new Response(new Blob("foo=bar"));
var formData2 = response2.formData();
\end{lstlisting}
\end{minipage}
\caption{{Code fragments which use the {\tt fetch} API.}}\label{fig:fetch-cases}
\end{adjustbox}
\end{figure}
In Listing~\ref{lst:fetch-case1},
we make an asynchronous request to the endpoint ``/helloWorld''
using the {\tt fetch} API.
Upon success,
we schedule the callback {\tt foo()}.
Recall that the parameter {\tt value} of {\tt foo()}
corresponds to the response object coming from line 53
(Figure~\ref{fig:fetch1}).
In {\tt foo()},
we convert the response of the server
into a {\tt FormData} object (line 2).
A callback-insensitive analysis,
which considers that
the event loop executes all callbacks in any order,
merges all the data flow stemming from those callbacks into a single point.
As a result,
the side effects of {\tt onLoad()}
and {\tt foo()} are directly propagated
to the event loop.
In turn,
the event loop propagates the resulting state again
to those callbacks.
This is repeated until convergence.
Specifically,
the callback {\tt foo()} calls {\tt value.formData()},
which updates the property {\tt bodyUsed} of
the response object to true
(Figure~\ref{fig:fetch1}, line 5).
The resulting state is propagated to the event loop
where is joined with the state
which stems from the callback {\tt onLoad()}.
Notice that the state of {\tt onLoad()}
indicates that {\tt bodyUsed} is false
because the callback {\tt onLoad()} creates a fresh response object.
(Figure~\ref{fig:fetch1}, lines 10, 53).
The join of those states
changes the abstract value of {\tt bodyUsed}
to $\top$.
That change is propagated again to {\tt foo()}.
This imprecision makes
the analysis to consider both {\tt if}
and {\tt else} branches at lines 2--5.
Thus,
the analysis allocates a rejected promise at line 3,
as it mistakenly considers
that the body has been already consumed.
This makes {\tt consumed()}
return a value
that is either {\tt undefined}
or a rejected promise at line 23.
The value returned by {\tt consumed()} is finally propagated to
{\tt formData()} at line 37,
where the analysis reports a false positive;
a property access of an {\tt undefined} variable
(access of the property ``then''),
because {\tt text()} might return an undefined variable
due to the return statement at line 26.
A callback-sensitive analysis neither
reports a type error at line 43
nor creates a rejected promise at line 4.
It respects the execution order of callbacks,
that is,
the callback {\tt foo()} is executed \emph{after}
the callback {\tt onLoad()}.
Therefore,
the analysis propagates
a more precise state to the entry of {\tt foo()}:
the state resulted
by the execution of {\tt onLoad()},
where a new response object is initialized
with the field {\tt bodyUsed} set to false.
In Listing~\ref{lst:fetch-case2},
we initialize a response object
with a body which has a string type (line 2).
In turn,
by calling the {\tt formData()} method,
we first read the body of the response in a text format,
and then we decode it into a {\tt FormData} object
by asynchronously calling the {\tt decode()} function
(Figure~\ref{fig:fetch1}, line 37).
Since the body of the response is already in a text format,
{\tt text()} returns a fulfilled promise
(Figure~\ref{fig:fetch1}, line 32).
At the same time,
at line 5 of Listing~\ref{lst:fetch-case2},
we allocate a fresh response object
whose body is an instance of {\tt Blob}\footnote{\url{https://developer.mozilla.org/en-US/docs/Web/API/Blob}}.
Therefore,
calling {\tt formData()} schedules function {\tt decode()} again.
However
this time,
the callback {\tt decode()} is registered on a different promise
because the second call of {\tt text()} returns a promise
created by the function {\tt readBlobAsText()}
(Figure~\ref{fig:fetch1}, line 26).
A QR-sensitive analysis---which creates
a context according to the queue object
on which a callback is registered---is
capable of separating the two invocations of {\tt decode()}
because the first call of {\tt decode()} is registered
on the promise object
which comes from line 32,
whereas the second call of {\tt decode()} is added
to the promise created by {\tt readBlobAsText()} at line 26.
{\bf honoka.} We return back to Figure~\ref{fig:motiv-ex-honoka}.
Recall that a callback-insensitive analysis
reports a spurious type error at line 17
when we try to access the property {\tt headers}
of {\tt honoka.response}
because it considers the case
where the callback defined at lines 15--23
is executed before that defined at lines 2--14.
Thus,
{\tt honoka.response} might be uninitialized
(recall that {\tt honoka.response} is initialized
during the execution of the first callback at line 3).
On the other hand,
a callback-sensitive analysis consults the callback graph
when it is time to propagate the state
from the exit point of a callback
to the entry point of another.
In particular,
when we analyze the exit node of the first callback,
we propagate the current state
to the second callback.
Therefore,
the entry point of the second function
has a state
which contains a precise value for {\tt honoka.response},
that is,
the object coming from the assignment at line 3.
\subsection{Threats to Validity}
Below we pinpoint the main threats to the validity of our results:
\begin{itemize}
\item Our analysis is an extension of an existing analyzer,
i.e., TAJS.
Therefore,
the precision and performance of TAJS
play an important role on
the results of our work.
\item Even though our analysis is designed to be sound,
it models some native functions of the JavaScript language unsoundly.
For instance,
we unsoundly model
the native function {\tt Object.freeze()},
which is used to prevent an object from being updated.
Specifically,
the model of {\tt Object.freeze()} simply
returns the object given as argument.
\item We provide manual models for some built-in Node.js modules
like {\tt fs}, {\tt http}, etc.\
or other APIs used in client-side applications
such as {\tt XMLHttpRequest}, {\tt Blob}, etc.
However,
manual modeling might neglect
some of the side-effects
which stem from the interaction with those APIs,
leading to unsoundness~\cite{gatekeeper,parkdom}.
\item Our macro-benchmarks consist of JavaScript libraries.
Therefore,
we needed to write some test cases
that invoke the API functions of those benchmarks.
We provided both hand-written test cases
and test cases or examples taken from
their documentation,
trying to test the main APIs
that exercise asynchrony in JavaScript.
\end{itemize}
\section{Introduction}
JavaScript is an integral part of web development.
Since its initial release in 1995,
it has evolved from a simple scripting language---primarily
used for interacting with web pages---into
a complex and general-purpose programming language
used for developing both client- and server-side applications.
The emergence of Web 2.0 along with
the dynamic features of JavaScript,
which facilitate a flexible and rapid development,
have led to a dramatic increase in its popularity.
Indeed,
according to the annual statistics provided by Github,
which is the leading platform for hosting open-source software,
JavaScript is by far the most popular and active
programming language from 2014 to 2018~\cite{githubstats}.
Although the dominance of JavaScript is impressive,
the community has widely criticized it
because it poses many concerns as to the security
or correctness of the programs~\cite{dynstudy}.
JavaScript is a language
with a lot of dynamic and metaprogramming features,
including but not limited to
prototype-based inheritance,
dynamic property lookups,
implicit type coercions,
dynamic code loading, etc.
Many developers often do not understand
or do not properly use these features,
introducing errors to their programs---which
are difficult to debug---or
baleful security vulnerabilities.
In this context,
JavaScript has attracted many
engineers and researchers over the past decade to
1) study and reason about its peculiar characteristics,
and 2) develop new tools
and techniques---such as type analyzers~\cite{tajs,safe,jsai},
IDE and refactoring tools~\cite{refstatic,refstatic2,wala,async-refactoring},
or bug and vulnerability detectors~\cite{Maffeis2,gatekeeper,webracer,datamatter,fuzz,synode}---to
assist developers with
the development
and maintenance of their applications.
Program analysis,
and especially static analysis,
which automatically computes facts about
program's behavior without actually running it,
plays a crucial role in the design of such tools~\cite{jsanal}.
Additionally,
preserving the scalability of modern web applications
has become more critical than ever.
As an effort to improve the throughput of web programs,
JavaScript has started to adopt
an event-driven programming paradigm~\cite{event-driven}.
In this context,
a code is executed \emph{asynchronously}
in response to certain events,
e.g., user input,
a response from a server,
data read from disk, etc.
In the first years of JavaScript,
someone could come across that asynchrony
mainly in a browser environment
e.g., DOM events,
AJAX calls,
timers, etc.
However,
in recent years,
asynchrony has become a salient
and intrinsic element of the language,
as newer versions of the language's core specification
(i.e., ECMAScript) have introduced
more and more asynchrony-related features.
For example,
ECMAScript 6 introduces promises;
an essential element of asynchronous programming
that allows developers to track
the state of an asynchronous computation easily.
Specifically,
the state of a promise object can be one of:
\begin{itemize}
\item \emph{fulfilled:} the associated operation is complete,
and the promise object tracks its resulting value.
\item \emph{rejected:} the associated operation failed,
and the promise object tracks its erroneous value.
\item \emph{pending:} the associated operation has been
neither completed nor failed.
\end{itemize}
Promises are particularly useful for asynchronous programming
because they provide an intuitive way
for creating chains of
asynchronous computation,
facilitating the enforcement of execution order
as well as error propagation~\cite{callback-study,async-refactoring}.
To do that,
promises trigger the execution of certain functions
(i.e., \emph{callbacks}) depending on their state,
e.g., callbacks that are executed once a promise is fulfilled
or rejected.
For that reason,
the {\tt API} of promises provides the method {\tt x.then(f1, f2)}
for registering new callbacks (i.e., {\tt f1} and {\tt f2})
on a promise object {\tt x}.
For example,
we call the callback {\tt f1}
when the promise is fulfilled,
while we trigger the callback {\tt f2}
once the promise is rejected.
The method {\tt x.then()}
returns a new promise
which the return value of the provided callbacks (i.e., {\tt f1, f2}) fulfills.
Since their initial introduction to the language,
JavaScript developers
have widely embraced promises;
a study in 2015 showed that
75\% of JavaScript frameworks
use promises~\cite{callback-study}.
Building upon promises,
newer versions of ECMAScript have added
new language features related to asynchrony.
Specifically,
in ECMAScript 8,
we have the {\tt async/await} keywords.
The {\tt async} keyword declares a function
as asynchronous
which returns a promise fulfilled
with its return value,
while {\tt await x} defers the execution
of the \emph{asynchronous} function
in which is placed,
until the promise object {\tt x} is \emph{settled}
(i.e., it is either fulfilled or rejected).
The latest edition of ECMAScript
(ECMAScript 9)
adds asynchronous iterators and generators
that allow developers to iterate
over asynchronous data sources.
\begin{figure}[t]
\begin{lstlisting}
asyncRequest(url, options)
.then(function (response) {
honoka.response = response.clone();
switch (options.dataType.toLowerCase()) {
case "arraybuffer":
return honoka.response.arrayBuffer();
case "json":
return honoka.response.json();
...
default:
return honoka.response.text();
}
})
.then(function (responseData) {
if (options.dataType === "" || options.dataType === "auto") {
const contentType = honoka.response.headers.get("Content-Type");
if (contentType && contentType.match("/application\/json/i")) {
responseData = JSON.parse(responseData);
}
}
...
});
\end{lstlisting}
\caption{Real-world example that mixes promises with asynchronous I/O.}\label{fig:motiv-ex-honoka}
\end{figure}
Beyond promises,
many JavaScript applications are written
to perform non-blocking I/O operations.
Unlike traditional statements,
when we perform a non-blocking I/O operation,
the execution is not interrupted
until that operation terminates.
For instance,
a file system operation is done asynchronously,
which means that the execution proceeds
to the next tasks
while I/O takes place.
Programmers often mix
asynchronous I/O with promises.
For instance,
consider the real-world example of Figure~\ref{fig:motiv-ex-honoka}.
At line 1,
the code performs an asynchronous request
and returns a promise object
which is fulfilled asynchronously
once the request succeeds.
Then that promise object
can be used for processing
the response of the server asynchronously.
For instance,
at lines 2--23,
we create a promise chain.
The first callback of this chain (lines 2--14)
clones the response of the request,
and assigns it to the property {\tt response}
of the object {\tt honoka} (line 3).
Then,
it parses the body of the response according to its type
and fulfills the promise object allocated by
the first invocation of {\tt then()}.
The second callback (lines 15--23)
retrieves the headers of the response---which
the statement at line 3 assigns to {\tt honoka.response}---and
if the content type is ``application/json'',
it converts the data of the response into a JSON object
(lines 17--19).
Like the other characteristics of JavaScript,
programmers do not always clearly understand asynchrony,
as a large number of asynchrony-related questions
issued in popular sites like
{\tt stackoverflow.com}\footnote{\url{https://stackoverflow.com/}}~\cite{madsen2015ev,promises},
or the number of bugs
reported in open-source repositories~\cite{concstudy,fuzz} indicate.
However,
existing tools
and techniques have limited
(and in many cases no) support for asynchronous programs.
In particular,
existing tools
mainly focus on the event system of client-side
JavaScript applications~\cite{jensendom,parkdom},
and they lack the support of the more recent features
added to the language like promises.
Also,
many previous works conservatively considered
that all asynchronous callbacks
processed by the \emph{event loop}---the program point
which continuously waits for new events to come
and is responsible for the scheduling
and execution of callbacks---can
be called in any order~\cite{jensendom,parkdom,jsai}.
However,
such an approach may lead to imprecision
and false positives.
Back to the example of Figure~\ref{fig:motiv-ex-honoka},
it is easy to see
that an analysis,
which does not respect the execution order
between the first and the second callback,
will report a type error at line 17
(access of {\tt honoka.response.headers.get (" Content - Type ")}).
Specifically,
an imprecise analysis assumes
that the callback defined at lines 15--23
might be executed first;
therefore,
{\tt honoka.response},
assigned at line 3,
might be uninitialized.
In this work,
we tackle those issues,
by designing and implementing a static analysis
that deals with asynchronous JavaScript programs.
For that purpose,
we first define a model for understanding and
expressing a wide range of
JavaScript's asynchronous constructs,
and then we design a static analysis based on that.
We propose a new representation,
which we call \emph{callback graph},
which provides information
about the execution order of the asynchronous code.
The callback graph
proposed in this work
tries to shed light on
how data flow between asynchronous code is propagated.
Contrary to previous works,
we leverage the callback graph
and devise a more precise analysis
which respects the execution order of
asynchronous functions.
Furthermore,
we parameterize our analysis
with one novel context-sensitivity strategy
designed for asynchronous code.
Specifically,
we distinguish data flow
between asynchronous callbacks
based on the promise object on
which they have registered
or the next computation
to which execution proceeds.
\noindent
\point{Contributions} Our work makes the following four contributions:
\begin{itemize}
\item We propose a calculus,
i.e., $\lambda_{\tt q}$,
for modeling the asynchronous features
in the JavaScript language,
including
timers,
promises,
and asynchronous I/O operations.
Our calculus is a variation of
existing calculi~\cite{asyncjs,promises},
and provides constructs
and domains specifically targeted for our analysis
(\cref{sec:modeling}).
\item We design and implement a static analysis
that is capable of handling asynchronous JavaScript programs
by exploiting the abstract version of $\lambda_{\tt q}$.
To the best of our knowledge,
our analysis is the first to deal with JavaScript promises
(\cref{sec:tajs-domains}).
\item We propose the \emph{callback graph},
a representation
which illustrates the execution order
between asynchronous functions.
Building on that,
we propose a more precise analysis,
(i.e., \emph{callback-sensitive} analysis)
which internally consults the callback graph
to retrieve information about
the temporal relations of asynchronous functions
so that it propagates data flow accordingly.
Besides that,
we parameterize our analysis
with a novel context-sensitivity flavor
(i.e., \emph{QR-sensitivity})
used for distinguishing asynchronous callbacks.
(\cref{sec:callback-graph}, \cref{sec:analysis-sensitivity}).
\item We evaluate the performance
and precision of our analysis on a set of
micro benchmarks
and a set of real-world JavaScript modules.
For the impatient reader,
we find that our prototype is able to analyze
medium-sized asynchronous programs,
and the analysis sensitivity is beneficial
for improving the analysis precision.
The results showed
that our analysis is able to achieve
a~\empirical{79\%} precision for the callback graph,
on average.
The analysis sensitivity (i.e. callback- and QR-sensitivity)
can further improve callback graph precision
by up to~\empirical{28.5\%}
and reduce the total number of type errors
by~\empirical{16,7\%} as observed in the real-world benchmarks
(\cref{sec:evaluation}).
\end{itemize}
\section{Modeling Asynchrony}
\label{sec:modeling}
As a starting point,
we need to define a model
to express asynchrony.
The goal of this model is to provide us
with the foundations
for gaining a better understanding of the asynchronous primitives
and ease the design of a static analysis
for asynchronous JavaScript programs.
This model is expressed through
a calculus called $\lambda_{{\tt q}}$;
an extension of $\lambda_{{\tt js}}$
which is the core calculus
for JavaScript developed by~\cite{ljs}.
The $\lambda_{\tt q}$ calculus is designed to
be flexible so that
it can model various sources of asynchrony
found in the language
up to the 7th edition of ECMAScript.
(i.e., promises, timers, asynchronous I/O).
However,
it does not handle
the {\tt async/await} keywords
and the asynchronous iterators/generators
introduced in recent editions of the specification.
\subsection{The $\lambda_{\tt q}$ calculus}
\label{sec:calculus}
The key component of our model is \emph{queue objects}.
Queue objects are closely related to JavaScript promises.
Specifically,
a queue object---like a promise---tracks
the state of an asynchronous job,
and it can be in one of the following states:
1) \emph{pending},
2) \emph{fulfilled}
or 3) \emph{rejected}.
A queue object may trigger the execution of callbacks
depending on its state.
Initially,
a queue object is pending.
A pending queue object can transition
to a fulfilled or a rejected queue object.
A queue object might be fulfilled or rejected with
a provided value
which is later passed as an argument in
the execution of its callbacks.
Once a queue object is either fulfilled or rejected,
its state is final and cannot be changed.
We keep the same terminology as promises,
so if a queue object is either fulfilled or rejected,
we call it \emph{settled}.
\subsubsection{Syntax and Domains}
\begin{figure}[t]
\begin{center}
\begin{minipage}[5cm]{\linewidth}
\begin{grammar}
<$v \in Val$> ::= ...
\alt $\bot$
<$e \in Exp$> ::= ...
\alt {\tt newQ()}
\alt $e$.{\tt fulfill}$(e)$
\alt $e$.{\tt reject}$(e)$
\alt $e$.{\tt registerFul}$(e, e,\dots)$
\alt $e$.{\tt registerRej}$(e, e,\dots)$
\alt {\tt append}$(e)$
\alt {\tt pop()}
\alt $\bullet$
<$E$> ::= ...
\alt $E$.{\tt fullfill}$(e)$\: |\: $v$.{\tt fulfill}$(E)$
\alt $E$.{\tt reject}$(e)$\: |\: $v$.{\tt reject}$(E)$
\alt $E$.{\tt registerFul}$(e, e,\dots)$\: |\: $v$.{\tt registerFul}$(v, \dots, E, e,\dots)$
\alt $E$.{\tt registerRej}$(e, e,\dots)$\: |\: $v$.{\tt registerRej}$(v, \dots, E, e,\dots)$
\alt {\tt append}$(E)$
\end{grammar}
\end{minipage}
\end{center}
\caption{Syntax of $\lambda_{\tt q}$.}\label{fig:syntax}
\end{figure}
Figure~\ref{fig:syntax} illustrates the syntax of $\lambda_{\tt q}$.
For brevity,
we present only the new constructs added to the language.
Specifically,
we add eight new expressions:
\begin{itemize}
\item {\tt newQ()}: This expression creates a fresh pending
queue object with no callbacks associated with it.
\item $e_1$.{\tt fulfill}$(e_2)$: This expression fulfills
the receiver (i.e., the expression $e_1$) with
the value of $e_2$.
\item $e_1$.{\tt reject}$(e_2)$: This expression rejects
the receiver (i.e., the expression $e_1$) with
the value of $e_2$.
\item $e_1$.{\tt registerFul}$(e_2, e_3,\dots)$:
This expression registers the callback $e_2$ to the receiver.
This callback is executed \emph{only}
when the receiver is fulfilled.
This expression also expects another queue object
passed as the second argument,
i.e., $e_3$.
This queue object will be fulfilled
with the return value of the callback $e_2$.
This allows us to model chains of promises where
a promise resolves with the return value of
another promise's callback.
This expression can also receive optional parameters
(i.e., expressed through ``\dots'')
with which $e_2$ is called
if the queue object is fulfilled with $\bot$ value.
We will justify later the intuition behind that.
\item $e_1$.{\tt registerRej}$(e_2, e_3,\dots)$:
The same as $e$.{\tt registerFul}$(\dots)$ but this time
the given callback is executed once the receiver is rejected.
\item {\tt append}($e$): This expression
appends the queue object $e$ to the top
of the current queue chain.
As we shall see later,
the top element of a queue chain corresponds
to the queue object
that is needed to be rejected
if the execution encounters
an uncaught exception.
\item {\tt pop()}: This expression pops
the top element of the current queue chain.
\item The last expression $\bullet$ stands for the event loop.
\end{itemize}
Observe that we use evaluation contexts~\cite{felleisen2009semantics,ljs,madsen2015ev,asyncjs,promises}
to express how the evaluation of an expression proceeds.
The symbol $E$ denotes
which sub-expression is currently being evaluated.
For instance,
$E$.{\tt fulfill}$(e)$ describes
that we evaluate the receiver of {\tt fulfill},
whereas $v$.{\tt fulfill}$(E)$
implies that the receiver has been evaluated
to a value $v$,
and the evaluation now lies on the argument of {\tt fulfill}.
Beyond those expressions,
the $\lambda_{\tt q}$ calculus introduces a new value,
that is,
$\bot$.
This value differs from {\tt null}
and {\tt undefined}
because it expresses
the absence of value
and it does not correspond to any JavaScript value.
\begin{figure}[t]
\centering
\footnotesize
\begin{align*}
a \in Addr &= \{l_i \mid i \in \mathbb Z^{*}\} \cup \{l_{time}, l_{io}\} \\
\pi \in Queue &= Addr \hookrightarrow QueueObject \\
q \in QueueObject &= QueueState \times Callback^{*} \times Callback^{*} \times Addr \\
s \in QueueState &= \{{\tt pending}\} \cup (\{{\tt fulfilled, rejected}\} \times Val) \\
clb \in Callback &= Addr \times F \times Val^{*} \\
\kappa \in ScheduledCallbacks &= Callback^{*} \\
\kappa \in ScheduledTimerIO &= Callback^{*} \\
\phi \in QueueChain &= Addr^{*}
\end{align*}
\caption{Concrete domains of $\lambda_{\tt q}$.}\label{fig:runtime}
\end{figure}
Figure~\ref{fig:runtime} presents the domains
introduced in the semantics of $\lambda_{\tt q}$.
In particular,
a queue is a partial map of addresses to queue objects.
The symbol $l_i$---where $i$ is a positive integer---indicates
an address.
Notice that the set of the addresses also
includes two special reserved addresses,
i.e., $l_{time}$, $l_{io}$.
We use these two addresses
to store the queue objects
responsible for keeping the state of
callbacks related to timers
and asynchronous I/O respectively
(Section~\ref{sec:async-primitives} explains how
we model those JavaScript features).
A queue object is described by its state---recall
that a queue object is either pending or
fulfilled and rejected with a value---a
sequence of callbacks
executed on fulfillment,
and a sequence of callbacks
called on rejection.
The last element of a queue object
is an address
which corresponds to another queue object
which is dependent on the current,
i.e., it is settled whenever
the current queue object is settled,
and with the same state.
We create such dependencies
when we settle a queue object
with another queue object.
In this case,
the receiver is dependent on
the queue object used as an argument.
Moving to the domains of callbacks,
we see that a callback consists of an address,
a function,
and a list of values
(i.e., arguments of the function).
Note that
the first component
denotes the address of the queue object
which the return value of the function
is going to fulfill.
In the list of callbacks
$\kappa \in ScheduledCallbacks$,
we keep the order in
which callbacks are scheduled.
Note that we maintain one more
list of callbacks
(i.e., $\tau \in ScheduledTimerIO$)
where we store the callbacks registered on
the queue objects
located at the addresses $l_{time}, l_{io}$.
We defer the discussion
about why we keep two separate lists
until Section~\ref{sec:model-event-loop}.
A queue chain $\phi \in QueueChain$
is a sequence of addresses.
In a queue chain,
we store the queue object
that we reject,
if there is an uncaught exception
in the current execution.
Specifically,
when we encounter an uncaught exception,
we inspect the top element of the queue chain,
and we reject it.
If the queue chain is empty,
we propagate the exception to the call stack as usual.
\subsubsection{Semantics}
\begin{figure}[]
\scriptsize
\centering
\[
\inference{
e \hookrightarrow e'
}
{\pi,\: \phi,\: \kappa,\: \tau,\: E[e] \rightarrow \pi',\: \phi',\: \kappa',\: \tau',\: E[e']}[[e-context]]
\]\\
\[
\inference{
fresh\: \alpha &
\pi' = \pi[\alpha \mapsto ({\tt pending},\: [],\: [],\: \bot)]
}
{\pi,\: \phi,\: \kappa,\: \tau,\: E[{\tt newQ}()] \rightarrow \pi',\: \phi,\: \kappa,\: \tau,\: E[\alpha]}[[newQ]]
\]\\
\[
\inference{
v \neq \bot & ({\tt pending},\: t,\: k, l) = \pi(p) & v \not\in dom(\pi) & t' = \langle(\alpha,\: f,\: [v],\: r) \mid (\alpha,\: f,\: a,\: r) \in t\rangle \\
\kappa' = \kappa :: t' & \chi = ({\tt fulfilled}, v) & \pi' = \pi[p \mapsto (\chi, [], [], l)] & p \neq l_{time} \land p \neq l_{io}
}
{\pi,\: \phi,\: \kappa,\: \tau,\: E[p.{\tt fulfill}(v)] \rightarrow \pi',\: \phi,\: \kappa',\: \tau,\: E[l.{\tt fulfill}(v)]}[[fulfill-pending]]
\]\\
\[
\inference{
({\tt pending},\: t,\: k, l) = \pi(p) & v \in dom(\pi) \\
p(v) = ({\tt pending},\: t',\: k', \bot) & \pi' = \pi[v \mapsto ({\tt pending},\: t',\: k',\: p)]
}
{\pi,\: \phi,\: \kappa,\: \tau,\: E[p.{\tt fulfill}(v)] \rightarrow \pi',\: \phi,\: \kappa,\: \tau,\: E[{\tt undef}]}[[fulfill-pend-pend]]
\]\\
\[
\inference{
({\tt pending},\: t,\: k, l) = \pi(p) & v \in dom(\pi) & p(v) = (({\tt fulfilled},\ v'),\: t',\: k', m)
}
{\pi,\: \phi,\: \kappa,\: \tau,\: E[p.{\tt fulfill}(v)] \rightarrow \pi,\: \phi,\: \kappa,\: \tau,\: E[p.{\tt fulfill}(v')]}[[fulfill-pend-ful]]
\]\\
\[
\inference{
v = \bot & ({\tt pending},\: t,\: k, l) = \pi(p) & \kappa' = \kappa :: t\\
\chi = ({\tt fulfilled}, v) & \pi' = \pi[p \mapsto (\chi, [], [], l)]
}
{\pi,\: \phi,\: \kappa,\: \tau,\: E[p.{\tt fulfill}(v)]\rightarrow \pi',\: \phi,\: \kappa',\: \tau,\: E[l.{\tt fulfill}(v)]}[[fulfill-pending-$\bot$]]
\]\\
\[
\inference{
\pi(p)\downarrow_1 \neq {\tt pending}
}
{\pi,\: \phi\:, \kappa,\: \tau,\: E[p.{\tt fulfill}(v)]\rightarrow \pi,\: \phi,\: \kappa,\: \tau,\: E[{\tt undef}]}[[fulfill-settled]]
\]\\
\[
\inference{
({\tt pending}\:, t\:, k, l) = \pi(p) & t' = t \cdot (p',\: f,\: [n_1, n_2,\dots,n_n],\: r) \\
\pi' = \pi[p \mapsto ({\tt pending},\: t',\: k, l)]
}
{\pi,\: \phi,\: \kappa,\: \tau,\: E[p.{\tt registerFul}(f, p', r, n_1, n_2,\dots,n_n)] \rightarrow \pi,'\: \phi,\: \kappa,\: \tau,\: E[{\tt undef}]}[[registerFul-pending]]
\]\\
\[
\inference{
p \neq l_{time} \land p \neq l_{io} & (s,\: t\:, k\:, \chi) = \pi(p) & s\downarrow_1 = {\tt fulfilled} \\
s\downarrow_2 \neq \bot & \kappa' = \kappa \cdot (p',\: f,\: [s\downarrow_2],\: r)
}
{\pi,\: \phi,\: \kappa,\: \tau,\: E[p.{\tt registerFul}(f, p', r, n_1, n_2,\dots,n_n)] \rightarrow \pi,'\: \phi,\: \kappa',\: \tau,\: E[{\tt undef}]}[[registerFul-fulfilled]]
\] \\
\[
\inference{
p \neq l_{time} \land p \neq l_{io} & (s,\: t\:, k\:, \chi) = \pi(p) & s\downarrow_1 = {\tt fulfilled} \\
s\downarrow_2 = \bot & \kappa' = \kappa \cdot (p',\: f,\: [n_1, n_2,\dots,n_n],\: r)
}
{\pi,\: \phi,\: \kappa,\: \tau,\: E[p.{\tt registerFul}(f, p', r, n_1, n_2,\dots,n_n)] \rightarrow \pi,'\: \phi,\: \kappa',\: \tau,\: E[{\tt undef}]}[[registerFul-fulfilled-$\bot$]]
\] \\
\[
\inference{
p = l_{time} \lor p = l_{io} & (s,\: t\:, k\:, \chi) = \pi(p) & s\downarrow_1 = {\tt fulfilled} \\
s\downarrow_2 = \bot & \tau' = \tau \cdot (p',\: f,\: [n_1, n_2,\dots,n_n],\: r)
}
{\pi,\: \phi,\: \kappa,\: \tau,\: E[p.{\tt registerFul}(f, p', r, n_1, n_2,\dots,n_n)] \rightarrow \pi,'\: \phi,\: \kappa,\: \tau',\: E[{\tt undef}]}[[registerFul-timer-io-$\bot$]]
\] \\
\[
\inference{
p \in dom(\pi) & \phi' = p \cdot \phi
}
{\pi,\: \phi,\: \kappa,\: \tau,\: E[{\tt append}(p)] \rightarrow \pi,\: \phi',\: \kappa,\: \tau,\: E[{\tt undef}]}[[append]]
\]
\[
\inference{
}
{\pi,\: p \cdot \phi,\: \kappa,\: \tau,\: E[{\tt pop()}] \rightarrow \pi,\: \phi,\: \kappa,\: \tau,\: E[{\tt undef}]}[[pop]]
\]
\[
\inference{
\phi = p \cdot \phi'
}
{\pi,\: \phi,\: \kappa,\: \tau,\: E[{\bf err}\ v] \rightarrow \pi,\: \phi',\: \kappa,\: \tau,\: E[p.{\tt reject}(v)]}[[error]]
\]\\
\caption{The semantics of $\lambda_{{\tt q}}$}\label{fig:semantics}
\end{figure}
\normalsize
Equipped with the appropriate definitions of the
syntax and domains,
in Figure~\ref{fig:semantics},
we present the small-step semantics of $\lambda_{\tt q}$
which is an adaptation of~\cite{asyncjs,promises}.
Note that
we demonstrate the most representative rules of
our semantics;
we omit some rules for brevity.
For what follows,
the binary operation denoted by the symbol $\cdot$ means
the addition of an element to a list,
the operation indicated by :: stands for list concatenation,
while $\downarrow_i$ means the projection of the $i^{th}$ element.
The rules of our semantics adopt the following form:
$$
\pi,\: \phi,\: \kappa,\: \tau,\: E[e] \rightarrow \pi',\: \phi',\: \kappa',\: \tau',\: E[e']
$$
That form expresses
that a given queue $\pi$,
a queue chain $\phi$,
two sequences of callbacks $\kappa$ and $\tau$,
and an expression $e$ in
the evaluation context $E$ lead to
a new queue $\pi'$,
a new queue chain $\phi'$,
two new sequences of callbacks $\kappa'$ and $\tau'$,
and a new expression $e'$
in the same evaluation context $E$,
assuming that the expression $e$ is reduced to $e'$
(i.e., $e \hookrightarrow e'$).
The {\tt [e-context]} rule describes this behavior.
The {\tt [newQ]} rule creates a new queue object and
adds it to the queue using a fresh address.
This new queue object is pending,
and it does not have any callbacks related to it.
The {\tt [fulfill-pending]} rule demonstrates the case
when we fulfill a pending queue object with the value $v$,
where $v \neq \bot$
and does \emph{not} correspond to any queue object.
In particular,
we first change the state of the receiver object
from ``pending'' to ``fulfilled''.
In turn,
we update the already registered callbacks (if any)
by setting the value $v$ as the only argument of them.
Then,
we add the updated callbacks to
the list of scheduled callbacks $\kappa$
(assuming that the receiver is neither $l_{time}$ nor $l_{io}$).
Also, observe
that the initial expression is reduced to
$l.{\tt fulfill}(v)$,
that is,
if there is a dependent queue object $l$,
we also fulfill that queue object with the same value $v$.
The {\tt [fulfill-pend-pend]}
describes the scenario
of fulfilling a pending queue object $p$
with another pending queue object $v$.
In this case,
we update the queue $\pi$
by making the queue object $p$
to be dependent on $v$.
This means
that we settle $p$
whenever we settle $v$ and in the same way.
Notice that
both $p$ and $v$ remain pending.
The {\tt [fulfill-pend-ful]} rule
demonstrates the case
when we try to fulfill a pending queue object $p$
with the fulfilled queue object $v$.
Then,
$p$ resolves with the value
with which $v$ is fulfilled.
This is expressed by the resulting expression
$p.{\tt fulfill}(v')$.
The {\tt [fulfill-pending-$\bot$]} rule captures the case
when we fulfill a queue object with a $\bot$ value.
This rule is the same with the {\tt [fulfill-pending]} rule,
however,
this time we do not update the arguments of
any callbacks registered on the queue object $p$.
The {\tt [fulfill-settled]} rule illustrates the case
when we try to fulfill a settled queue object.
Notice that this rule neither
affects the queue $\pi$
nor the lists of scheduled callbacks $\kappa$ and $\tau$.
The {\tt [registerFul-pending]} rule adds the provided callback $f$
to the list of callbacks
that we should execute
once the queue object $p$ is fulfilled.
Note that this rule also associates this callback
with the queue object $p'$ given as the second argument.
That queue object $p'$ is fulfilled upon the termination of $f$.
Also,
this rule adds any extra arguments passed in {\tt registerFul}
as arguments of $f$.
The {\tt [registerFul-fulfilled]} rule adds
the given callback $f$ to the list $\kappa$
(assuming that the receiver is neither $l_{time}$ nor $l_{io}$).
We use the fulfilled value of the receiver
as the only argument of the given function.
Like the previous rule,
it relates the provided queue object $p'$
with the execution of the callback.
This time we do ignore any extra arguments
passed in {\tt registerFul},
as we fulfill the queue object $p$ with
a value that is not $\bot$.
The {\tt [registerFul-fulfilled-$\bot$]} rule describes the case
where we register a callback $f$ on a queue object
fulfilled with a $\bot$ value.
Unlike the {\tt [registerFul-fulfilled]} rule,
this rule does not neglect
any extra arguments passed in {\tt registerFul}.
In particular,
it sets those arguments as parameters of the given callback.
This distinction allows us to pass
arguments explicitly to a callback.
Most notably,
these arguments are not dependent on the value
with which a queue object is fulfilled or rejected.
The {\tt [registerFul-timer-io-$\bot$]} rule is the same
as the previous one,
but this time we deal with queue objects
located either at $l_{time}$ or at $l_{io}$.
Thus,
we add the given callback $f$ to
the list $\tau$ instead of $\kappa$.
The {\tt [append]} rule appends the element
$p$ to the front of the current queue chain.
Note that this rule requires the element $p$
to be a queue object
(i.e., $p \in dom(\pi)$).
On the other hand,
the {\tt [pop]} rule removes the top element
of the queue chain.
The {\tt [error]} rule demonstrates the case
when we encounter an uncaught exception,
and the queue chain is not empty.
In that case,
we do not propagate the exception to the caller,
but we pop the queue chain
and get the top element.
In turn,
we reject the queue object $p$
specified in that top element.
In this way,
we capture the actual behavior of the uncaught exceptions
triggered during the execution of
an asynchronous callback.
\subsubsection{Modeling the Event Loop}
\label{sec:model-event-loop}
\begin{figure}[]
\scriptsize
\centering
\[
\inference{
\kappa = (q, f, a) \cdot \kappa' & \phi = [] & \phi' = q \cdot \phi
}
{\pi\:, \phi,\: \kappa,\: \tau,\: E[\bullet] \rightarrow \pi,\: \phi',\: \kappa',\: \tau,\: q{\tt.fulfill}(E[f(a)]); {\tt pop}(); \bullet}[[event-loop]]
\] \\
\[
\inference{
{\tt pick\: } (q, f, a)\: {\tt from\ } \tau & \tau' = \langle\rho\ \mid \forall \rho \in \tau.\: \rho \neq (q, f, a)\rangle\\
\phi = [] & \phi' = q \cdot \phi
}
{\pi\:, \phi,\: [],\: E[\bullet] \rightarrow \pi,\: \phi',\: [],\: \tau',\: q{\tt.fulfill}(E[f(a)]); {\tt pop}(); \bullet}[[event-loop-timers-io]]
\]
\caption{{The semantics of the event loop.}}\label{fig:semantics-event-loop}
\normalsize
\end{figure}
A reader might wonder
why do we keep two separate lists,
i.e., the list $\tau$ for holding callbacks
coming from the $l_{time}$ or $l_{io}$ queue objects,
and the list $\kappa$ for callbacks of any other queue objects.
The intuition behind this design choice is that
it is convenient for us to
model the concrete semantics of the event loop correctly.
In particular,
the implementation of the event loop
assigns different priorities to the callbacks
depending on their kind~\cite{asyncjs,nodejs-schedule}.
For example,
the event loop processes
a callback of a promise object
before any callback of a timer
or an asynchronous I/O operation
regardless of their registration order.
In this context,
Figure~\ref{fig:semantics-event-loop} demonstrates the
semantics of the event loop.
The {\tt [event-loop]} rule pops
the first scheduled callback from the list $\kappa$.
Then,
we get the queue object
specified in that callback,
and we attach it to the front of the queue chain.
Adding the queue object $q$ to the top of
the queue chain allows us to reject that queue object
if there is an uncaught exception
during the execution of $f$.
In this case,
the evaluation of {\tt fulfill} will not have any
effect on the already rejected queue object $q$
(recall the {\tt [fullfill-settled]} rule).
Also,
observe how the event loop is reduced,
i.e., $q.{\tt fulfill}(f(a)); {\tt pop}(); \bullet$.
Specifically,
once we execute the callback $f$
and fulfill the dependent queue object $q$
with the return value of that callback,
we evaluate {\tt pop()},
that is,
we pop the top element of the queue chain
before we re-evaluate the event loop.
This is an invariant of the semantics of the event loop:
every time we evaluate it,
the queue chain is always empty.
The {\tt [event-loop-timers-io]} rule handles
the case when the list $\kappa$ is empty.
In other words,
that rule states
that if there are not any callbacks,
which neither come from the $l_{time}$ nor
the $l_{io}$ queue object,
inspect the list $\tau$,
and pick \emph{non-deterministically} one of those.
Selecting a callback non-deterministically
allows us to over-approximate the actual behavior
of the event loop regarding
its different execution phases~\cite{asyncjs}.
Overall,
that rule describes
the scheduling policy presented in
the work of~\cite{asyncjs},
where initially
we look for any callbacks of promises,
and if there exist,
we select one of those.
Otherwise,
we choose any callback associated
with timers and asynchronous I/O at random.
\subsubsection{Modeling Timers \& Asynchronous I/O}
\label{sec:model-timers-io}
\begin{figure}[t]
\small
\begin{center}
\begin{minipage}[5cm]{\linewidth}
\begin{grammar}
<$e \in Exp$> ::= ...
\alt {\tt addTimerCallback}$(e_1, e_2, e_3,\dots)$
\alt {\tt addIOCallback}$(e_1, e_2, e_3,\dots)$
<$E$> ::= ..
\alt {\tt addTimerCallbackCallback}$(E, e,\dots)$\: |\: {\tt addTimerCallback}$(v, \dots, E, e,\dots)$
\alt {\tt addIOCallback}$(E, e,\dots)$\: |\: {\tt addIOCallback}$(v, \dots, E, e,\dots)$
\end{grammar}
\end{minipage}
\end{center}
\caption{Extending the syntax of $\lambda_{\tt q}$ to deal with
timers and asynchronous I/O.}\label{fig:syntax-extended}
\end{figure}
\begin{figure}[h]
\scriptsize
\[
\inference{
q = \pi(l_{time})
}
{\pi,\: \phi,\: \kappa,\: \tau,\: {\tt addTimerCallback}(f,\ n_1,\dots) \rightarrow \pi,\: \phi,\: \kappa,\: q.{\tt registerFul}(f,\ q,\ n_1,\dots)}[[add-timer-callback]]
\] \\
\[
\inference{
q = \pi(l_{io})
}
{\pi,\: \phi,\: \kappa,\: \tau,\: {\tt addIOCallback}(f,\ n_1,\dots) \rightarrow \pi,\: \phi,\: \kappa,\: q.{\tt registerFul}(f,\ q,\ n_1,\dots)}[[add-io-callback]]
\]
\caption{Extending the semantics of $\lambda_{\tt q}$ to deal with
timers and asynchronous I/O.}\label{fig:semantics-extended}
\end{figure}
To model timers and asynchronous I/O,
we follow a similar approach to
the work of~\cite{asyncjs}.
Specifically,
we start with an initial queue $\pi$,
which contains two queue objects:
the $q_{time}$,
and $q_{io}$
which are located at
the $l_{time}$
and $l_{io}$ respectively.
Both $q_{time}$ and $q_{io}$
are initialized as
$(({\tt fulfilled},\: \bot),\: [],\: [],\: \bot)$.
Besides that,
we extend the syntax of $\lambda_{\tt q}$
by adding two more expressions.
Figure~\ref{fig:syntax-extended}
shows the extended syntax of $\lambda_{\tt q}$
to deal with timers and asynchronous I/O,
while Figure~\ref{fig:semantics-extended}
presents the rules related to those expressions.
The new expressions have high correspondence to each other.
Specifically,
the {\tt addTimerCallback($\dots$)} construct
adds the callback $e_1$
to the queue object located at the address $l_{time}$.
We call the provided callback
The arguments of that callback
are any optional parameters
passed in {\tt addTimerCallback},
i.e.,
$e_2, e_3$,
and so on.
From Figure~\ref{fig:semantics-extended},
we observe that
the {\tt [add-timer-callback]} rule retrieves
the queue object $q$ corresponding to
the address $l_{time}$.
Recall again that the $l_{time}$ can be found
in the initial queue.
Then,
the given expression is reduced to
$q.{\tt registerFul}(f,\ q,\ n_1,\dots)$.
In particular,
we add a new callback $f$ to the queue object
found at $l_{time}$.
Observe that we pass the same queue object
(i.e., $q$)
as the second argument of {\tt registerFul}.
That means that the execution of $f$
does not affect any queue object since
$q$ is already settled.
Recall that
according to the {\tt [fulfill-settled]} rule (Figure~\ref{fig:semantics}),
trying to fulfill (and similarly to reject)
a settled queue object does not have any effect.
Beyond that,
since $q$ is fulfilled with $\bot$,
the extra arguments (i.e., $n_1$,\dots)
are also passed as arguments in the invocation of $f$.
The semantics of the {\tt addIOCallback($\dots$)} primitive
is the same with that of {\tt addTimerCallback($\dots$)};
however,
this time,
we use the queue object located at $l_{io}$.
\subsection{Expressing Promises in Terms of $\lambda_{\tt q}$}
\label{sec:async-primitives}
The queue objects and their operations introduced in
$\lambda_{\tt q}$ are very closely related to
JavaScript promises.
Therefore,
the translation of promises' operations
into $\lambda_{\tt q}$ is straightforward.
We model every property and
method (except for {\tt Promise.all()})
by faithfully following the ECMAScript specification.
\begin{figure}[h]
\centering
\begin{lstlisting}[escapeinside={(*}{*)}]
Promise.resolve = function(value) {
var promise = newQ();
if (typeof value.then === "function") {
var t = newQ();
t.fulfill((*$\bot$*));
t.registerFul(value.then, t, promise.fulfill, promise.reject);
} else
promise.fulfill(value);
return promise;
}
\end{lstlisting}
\caption{
Expressing {\tt Promise.resolve}
in terms of $\lambda_{\tt q}$}\label{fig:modeling-resolve}.
\end{figure}
{\bf Example---Modeling Promise.resolve()}:
In Figure~\ref{fig:modeling-resolve},
we see how we model the {\tt Promise.resolve()} function
in terms of $\lambda_{\tt q}$.
The JavaScript {\tt Promise.resolve()} function creates
a new promise,
and resolves it with the given value.
According to ECMAScript,
if the given {\tt value} is a \emph{thenable},
(i.e., an object
which has a property named ``then''
and that property is a callable),
the created promise resolves asynchronously.
Specifically,
we execute the function {\tt value.then()} asynchronously,
and we pass the resolving functions
(i.e., {\tt fulfill, reject})
as its arguments.
Observe how the expressiveness of $\lambda_{\tt q}$
can model this source of asynchrony (lines 4--6).
First,
we create a fresh queue object {\tt t},
and we fulfill it with $\bot$ (lines 4, 5).
Then,
at line 6,
we schedule the execution of {\tt value.then()}
by registering it on the newly created queue object {\tt t}.
Notice that we also pass {\tt promise.fulfill}
and {\tt promise.reject} as extra arguments.
That means that those functions
will be the actual arguments of {\tt value.then()}
because {\tt t} is fulfilled with $\bot$.
On the other hand,
if {\tt value} is not a thenable,
we synchronously resolve the created promise
using the {\tt promise.fulfill} construct at line 8.
\section{Related Work}
\label{sec:related}
In this section,
we briefly present previous work
related to the formalization
and program analysis for (asynchronous) JavaScript.
{\bf Semantics.}
Maffeis et al.~\cite{maffeis}
presented one of the first formalizations
of JavaScript by designing small-step operational semantics for
a subset of the 3rd version of ECMAScript.
In subsequent work,
Guha et al.\cite{ljs}
expressed the semantics of the 3rd edition of ECMAScript
through a different approach;
they developed a lambda calculus called $\lambda_{{\tt JS}}$,
and provided a desugaring mechanism for
converting JavaScript code into $\lambda_{{\tt JS}}$.
We used $\lambda_{{\tt JS}}$
as a base for modeling asynchronous JavaScript.
Later,
Gardner et al.~\cite{gardnerlogic}
introduced a program logic for reasoning about
client-side JavaScript programs
which support ECMAScript 3.
They presented big-step operational semantics
on the basis of that proposed by~\cite{maffeis},
and they introduced inference rules
for program reasoning
which are highly inspired from separation logic~\cite{separation}.
More recently,
Madsen et al.~\cite{promises}
and Loring et al.~\cite{asyncjs}
extended $\lambda_{{\tt JS}}$
for modeling promises
and asynchronous JavaScript respectively.
Our model is a variation of their works;
our modifications enable us to model
almost all the sources of asynchrony found in JavaScript---some of
them are not handled by their models.
{\bf Static Analysis for JavaScript.}
Guarnieri et al.~\cite{gatekeeper}
proposed one of the first pointer analyses
for a subset of JavaScript.
They precluded the use of {\tt eval}-family functions from
their analysis
as their work focused on widgets
where the use of {\tt eval} is not common.
It was one of the first works
that managed to model some of the peculiar features of JavaScript
such as prototype-based inheritance.
TAJS~\cite{tajs,lazypropagation,jensendom}
is a typer analyzer for JavaScript
which is implemented as a classical dataflow analysis.
Our work is implemented as
an extension of TAJS.
SAFE~\cite{safe} is
a static analysis framework,
which provides three different formal representations of JavaScript programs:
an abstract syntax tree (AST),
an intermediate language (IR)
and a control-flow graph (CFG).
SAFE implements a default analysis phase
which is plugged after the construction of CFG.
This analysis adopts a similar approach with that of TAJS,
i.e., a flow- and context-sensitive analysis
which operates on top of CFG.
JSAI~\cite{jsai} implements an analysis
through the abstract interpretation framework~\cite{abstract-inter}.
Specifically,
it employs a different approach
compared to other existing tools.
Unlike TAJS and SAFE,
JSAI operates on top of AST
rather than CFG;
it is flow-sensitive though.
To achieve this,
the abstract semantics is specified on
a CESK abstract machine~\cite{cesk},
which provides small-step reduction rules
and an explicit data structure (i.e., continuation)
which describes the rest of computation,
unwinding the flow of the program in this way.
The analysis is configurable with different flavors of
context-sensitivity
which are plugged into the analysis
through widening operator used in
the fix-point calculation~\cite{widening}.
Existing static analyses provide sufficient support
for precisely modeling browser environment.
Jensen et al.~\cite{jensendom} modeled HTML DOM
by creating a hierarchy of abstract states
which reflect the actual HTML object hierarchy.
Before the analysis begins,
an initial heap is constructed
which contains the set of the abstract objects
corresponding to the HTML code of the page.
Park et al.~\cite{parkdom} followed
a similar approach for modeling HTML DOM.
They also provided a more precise model
which respects the actual tree hierarchy of the DOM.
For example,
their model distinguishes
whether one DOM node
is nested to another or not.
{\bf Program Analysis for Asynchronous JavaScript Programs.}
The majority of static analyses for JavaScript treat
asynchronous programs conservatively~\cite{tajs,safe,jsai}---they assume
that the event loop processes all the asynchronous callbacks
in any order---leading to the analysis imprecision.
Also,
they focus on the client-side applications,
where asynchrony mainly appears in DOM events
and AJAX calls.
Madsen et al.~\cite{madsen2015ev} proposed
one of the first static analysis for server-side event-driven programs.
Although their approach is able to handle
asynchronous I/O operations---unlike our work---they
do not provide support for ES6 promises.
Additionally,
their work introduced a context-sensitivity strategy
which tries to imitate the different iterations of the event loop.
However,
it imposes a large overhead on the analysis;
it is able to handle only small programs
(less than 400 lines of code).
In our work,
we propose callback-sensitivity
which improves precision without
highly sacrificing performance.
More recently,
Alimadadi et al.~\cite{promises2} presented
a dynamic analysis technique for detecting
promise-related errors
and anti-patterns in JavaScript programs.
Specifically, their approach exploits the promise graph;
a representation designed for debugging promise-based programs.
Beyond promises, our work also handles a broad spectrum of asynchronous features.
{\bf Race Detection.}
Zheng et al.~\cite{staticasync}
presented one of the first race detectors
by employing a static analysis for
identifying concurrency issues in asynchronous AJAX calls.
The aim of their analysis was to
detect data races between the code
which pre-processes an AJAX request
and the callback invoked when the response of the server is received.
A subsequent work~\cite{webracer}
adopted a dynamic analysis to detect data races in web applications.
They first proposed a happens-before relation model
to capture the execution order between different operations
that are present in a client-side application,
such as the loading of HTML elements, execution of scripts, etc.
Using this model,
their analyses reports data races,
by detecting memory conflicts between functions,
where there is not any happens-before relation to each other.
However, their approach introduced a lot of false positives
because most data races did not lead to severe concurrency bugs.
Mutlu et al.~\cite{datamatter} combined both
dynamic and static analysis and primarily focused on detecting data races
that have pernicious consequences on the correctness of applications,
such as those which affect the browser storage.
Initially, they collected the execution traces of an application,
and then, they applied a dataflow analysis on those traces
to identify data races.
Their approach effectively managed to report
a very small number of false positives.
| {'timestamp': '2019-01-14T02:15:52', 'yymm': '1901', 'arxiv_id': '1901.03575', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03575'} | arxiv |
\section*{Appendix}
The appendix is organized as follows: we first describe the five environments we used in this paper. We also provide details about the dataset generation process used for the Sokoban levels that we are releasing. Next, we describe the \clstm{} architecture, various choices of memory type, and all the implementation details. We also list model parameters and RL training hyper-parameters for the \clstm{} and other baseline models. We then present some additional experiments, including ablation studies on the \clstm{} and an extension of our generalization analysis. Finally we compare the \clstm{} against various baseline agents (VIN, ATreeC, and ResNet).
\section{Domains}\label{sec:appendix_domains}
\begin{figure}[h]
\centering
\begin{subfigure}[b]{0.2\textwidth}
\includegraphics[width=\linewidth]{sokoban_level.pdf}
\caption{Sokoban}
\label{fig:sokoban_level}
\end{subfigure}
\begin{subfigure}[b]{0.2\textwidth}
\includegraphics[width=\linewidth]{boxworld_level.pdf}
\caption{\boxworld{}}
\label{fig:boxworld_level}
\end{subfigure}
\begin{subfigure}[b]{0.2\textwidth}
\includegraphics[width=\linewidth]{mini_pacman_level.pdf}
\caption{\minipacman{}}
\label{fig:mini_pacman_level}
\end{subfigure}
\begin{subfigure}[b]{0.2\textwidth}
\includegraphics[width=\linewidth]{gridworld_level.pdf}
\caption{\gridworld{}}
\label{fig:gridworld_level}
\end{subfigure}
\caption{Sample observations for each of the planning environments at the beginning of an episode.}
\label{fig:levels_samples}
\end{figure}
\subsection{Sokoban}
We follow the reward structure in \cite{racaniere2017imagination}, with a reward of 10 for completing a level, 1 for getting a box on a target, and -1 for removing a box from a target, in addition to a cost per time-step of -0.01. Each episode is capped at 120 frames. We use a sprite-based representation of the state as input. Each sprite is an (8, 8, 3)-shaped RGB image.
Dataset generation is described in Appendix \ref{sec:sokobandata}. Unless otherwise noted, we have used the levels from the unfiltered dataset in experiments.
\subsection{\minipacman{}}\label{app:mini-pacman}
\begin{figure}[h]
\centering
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\linewidth]{minipacman.png}
\caption{}
\end{subfigure}
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\linewidth]{superminipacman.png}
\caption{}
\end{subfigure}
\caption{(a) Food in dark blue offers a reward of $1$. After it is eaten, the food disappears, leaving a black space. Power pills in light blue offer a reward of $2$. The player is in green, and ghosts in red. An episode ends when the player is eaten by a ghost. When the player has eaten all the food, the episode continues but the level is reset with power pills and ghosts placed at random positions. (b) When the player eats a power pill, ghosts turn yellow and become edible, with a larger reward or $5$ for the player. They then progressively return to red (via orange), at which point they are once again dangerous for the player.}
\label{fig:minipacman}
\end{figure}
\minipacman{} is a simplified version of the popular game Pac-Man. The first, deterministic version, was introduced in \citep{racaniere2017imagination}. Here we use a stochastic version, where at every time-step, each ghost moves with a probability of $0.95$. This simulates, in a gridworld, the fact that ghosts move slower than the player. An implementation of this game is available under the name Pill~Eater at \url{https://github.com/vasiloglou/mltrain-nips-2017/tree/master/sebastien_racaniere}, where $5$ different reward structures (or \textit{modes}) are available.
\subsection{\boxworld{}}
In all our experiments we use branch length of 3 and maximum solution length of 4. Each episode is capped at 120 frames.
Unlike Sokoban, \boxworld{} levels are generated by the game engine. Unlike Sokoban we do not used sprite-based images; the environment state is provided as a (14, 14, 3) tensor.
\subsection{Atari}
We use the standard Atari setup of \cite{mnih2015human} with up to 30 no-ops at random, episodes capped at 30 mins, an action repeat of $4$, and the full set of $18$ actions.
We made little effort to tune the hyperparameters for Atari; only the encoder size was increased. See Appendix \ref{app:extra_experiments_atari} for details about the experiments, and Figure~\ref{fig:atari} for the learning curves.
\subsection{\gridworld{}}
We generate 32x32-shaped levels by sampling a number of obstacles between 12 and 24. Each obstacle is a square, with side in [2, 10]. These obstacles may overlap. The player and goal are placed on random different empty squares. We use rejection sampling to ensure the player can reach the goal. Episodes terminate when reaching a goal or when stepping on an obstacle, with a reward of 1 and -1 respectively. There is a small negative reward of -0.01 at each step otherwise.
\section{Dataset generation details}
\label{sec:sokobandata}
The unfiltered Sokoban levels are generated by the procedure described in \cite{racaniere2017imagination}. Simple hashing is used to avoid repeats.
To generate medium levels, we trained a DRC(1,1) policy whose LSTM state is reset at every time step. It achieves around 95\% of level solved on the easy set.
Then, we generate medium difficulty levels by rejection sampling: we sample levels using the procedure from \cite{racaniere2017imagination}, and accept a level if the policy cannot solve it after 10 attempts. The levels are not subsampled from the easy levels dataset but from fresh generation instead, so overlap between easy and medium is minimal (though there are 120 levels in common in the easy and medium datasets).
To generate hard levels, we train a DRC(3,3) policy on a mixture of easy and medium levels, until it reached a performance level of around 85\%. We then select the first 3332 levels of a separate medium dataset which are not solved by that policy after 10 attempts (so there is no overlap between hard and medium sets). The datasets for all level types are available at \href{https://github.com/deepmind/boxoban-levels}{https://github.com/deepmind/boxoban-levels}.
A playable demo of some challenging levels is available at \href{https://sites.google.com/view/modelfreeplanning/}{https://sites.google.com/view/modelfreeplanning/}.
\begin{small}
\begin{table}[htb]
\caption{Best results obtained on the test set for the different difficulty levels across RL agents within 2e9 steps of training (averaged across 5 independent runs). See Figure~\ref{fig:sokoban_medium} for training curves.}
\label{tab:sokoban_best_per_difflevel}
\begin{center}
\begin{tabular}{||c | c | c||}
\hline
Unfiltered & Medium & Hard \\[0.5ex]
\hline\hline
99\% & 95\% & 80\% \\
\hline
\end{tabular}
\end{center}
\end{table}
\end{small}
\begin{table}[htb]
\caption{Number of levels in each subset of the dataset and number of overlaps between them.}
\label{tab:sokoban_dataset_overlap}
\begin{center}
\scalebox{0.8}{
\begin{tabular}{||c | c | c | c | c | c ||}
\hline
& Unfiltered train & Unfiltered test & Medium train & Medium test & hard \\[0.5ex]
\hline\hline
Unfiltered train & 900,000 & 0 & 119 & 10 & 0 \\
\hline
Unfiltered test & 0 & 100,000 & 10 & 1 & 0 \\
\hline
Medium train & 119 & 1 & 450,000 & 0 & 0 \\
\hline
Medium test & 10 & 0 & 0 & 50,000 & 0 \\
\hline
Hard & 0 & 0 & 0 & 0 & 3332 \\
\hline
\end{tabular}}
\end{center}
\end{table}
\section{Model} \label{sec:model_appendix}
We denoted $g_\theta(s_{t-1}, i_t) = f_\theta(f_\theta( \dots f_\theta( s_{t-1}, i_t), \dots, i_t), i_t)$ as the computation at a full time-step of the \clstm(D, N) architecture. Here $\theta = (\theta_1, \ldots, \theta_D)$ are the parameters of $D$ stacked memory modules, and $i_t=e(x_t)$ is the agent's encoded observation.
Let $s^{1}_{t-1}, \ldots, s^{N}_{t-1}$ be the state of the $D$ stacked memory modules at the $N$ ticks of time-step $t-1$. Each $s^{n}_{t-1} = (c^n_1, \ldots, c^n_d, h^n_1, \ldots, h^n_d)$. We then have the "repeat" recurrence below:
\begin{align}
\begin{split}
s^{1}_{t-1} & = f_\theta(s_{t-1}, i_t) \\
s^{n}_{t-1} & = f_\theta(s^{n-1}_{t-1}, i_t) \text{ for } 1 < n \le N \\
s_t & = s^N_{t-1}
\end{split}
\end{align} \label{repeat_recurrence}
We can now describe the computation within a single tick, i.e., outputs $c^n_d$ and $h^n_d$ at $d = 1, \ldots, D$ for a fixed $n$. This is the "stack" recurrence:
\begin{align}
c^n_d, h^n_d = \text{MemoryModule}_{\theta_d}(i_t, c^{n-1}_d, h^{n-1}_d, h^n_{d-1})
\end{align} \label{stack_recurrence}
Note that the encoded observation $i_t$ is fed as an input not only at all ticks 1, \ldots, N, but also at all depths 1, \ldots, D of the memory stack. (The latter is described under "encoded observation skip-connections" in Section \ref{improvements} but not depicted in Figure \ref{fig:arch} for clarity.)
Generally each memory module is a ConvLSTM parameterized by $\theta_d$ at location (d, n) of the \clstm{} grid. But we describe alternative choices of memory module in Appendix \ref{memory_module_options}.
\subsection{Additional details/improvements}
\subsubsection{Top-down skip connection}
As described in the stack recurrence, we feed the hidden state of each memory module as an input $h^n_{d-1}$ to the next module in the stack. But this input is only available for modules at depth $d>1$. Instead of setting $h^n_0 = \mathbf{0}$, we use a top-down skip connection i.e. $h^n_0 = h^{n-1}_D$. We will explore the role of this skip-connection in Appendix \ref{sec:appendix_ablations}.
\subsubsection{Pool-and-inject}
The pool operation aggregates hidden states across their spatial dimensions to give vectors $m^n_1, \ldots, m^n_D$. We project these through a linear layer each (weights $W_{p_1}, \ldots, W_{p_D}$), and then tile them over space to obtain summary tensors $p^n_1, \ldots, p^n_D$. These have the same shapes as the original hidden states, and can be injected as additional inputs to the memory modules at the next tick.
\begin{align} \notag
m^n_d & := [\text{max}_{H,W}(h^n_d), \text{mean}_{H,W}(h^n_d)]^T \\
p^n_d & := \text{Tile}_{H,W} (W_{p_d} m^n_d)
\end{align} \label{pool_and_inject_equations}
Finally, $p^{n-1}_d$ is provided as an additional input at location (d,n) of the \clstm{}, and equation \ref{stack_recurrence} becomes:
$$c^n_d, h^n_d = \text{MemoryModule}_{\theta_d}(i_t, c^{n-1}_d, h^{n-1}_d, h^n_{d-1}, p^{n-1}_d)$$
\subsection{Memory modules} \label{memory_module_options}
\subsubsection{ConvLSTM}
$$c^n_d, h^n_d = \text{ConvLSTM}_{\theta_d}(i_t, c^{n-1}_d, h^{n-1}_d, h^n_{d-1})$$
For all $d > 1$:
$$f^n_d = \sigma(W_{fi} * i_t + W_{fh_1} * h^n_{d-1} + W_{fh_2} * h^{n-1}_d + b_f)$$
$$i^n_d = \sigma(W_{ii} * i_t + W_{ih_1} * h^n_{d-1} + W_{ih_2} * h^{n-1}_d + b_i)$$
$$o^n_d = \sigma(W_{oi} * i_t + W_{oh_1} * h^n_{d-1} + W_{oh_2} * h^{n-1}_d + b_o)$$
$$c^n_d = f^n_d \odot c^{n-1}_d + i^n_d \odot \text{tanh}(W_{ci} * i_t + W_{ch_1} * h^n_{d-1} + W_{ch_2} * h^{n-1}_d + b_c)$$
$$h^n_d = o^n_d \odot \text{tanh}(c^{n}_d)$$
For $d = 1$, we use the top-down skip connection $h^{n-1}_D$ in place of $h^n_{d-1}$ as described above.
Here $*$ denotes the convolution operator, and $\odot$ denotes point-wise multiplication. Note that
$\theta_d = (W_{f.}, W_{i.}, W_{o.}, W_{c.}, b_f, b_i, b_o, b_c)_d$ parameterizes the computation of the forget gate, input gate, output gate, and new cell state. $i^n_d$ and $o^n_d$ should not be confused with the encoded input $i_t$ or the final output $o_t$ of the entire network.
\subsubsection{GatedConvRNN}
This is a simpler module with no cell state.
$$h^n_d = \text{GatedConvRNN}_{\theta_d}(i_t, h^{n-1}_d, h^n_{d-1})$$
For all $d > 1$:
$$o^n_d = \sigma(W_{oi} * i_t + W_{oh_1} * h^n_{d-1} + W_{oh_2} * h^{n-1}_d + b_o)$$
$$h^n_d = o^n_d \odot \text{tanh}(W_{hi} * i_t + W_{hh_1} * h^n_{d-1} + W_{hh_2} * h^{n-1}_d + b_h)$$
$\theta_d = (W_{o.}, W_{h.}, b_o, b_h)_d$ has half as many parameters as in the case of the ConvLSTM.
\subsubsection{SimpleConvRNN}
This is a classic RNN without gating.
$$h^n_d = \text{tanh}(W_{hi} * i_t + W_{hh_1} * h^n_{d-1} + W_{hh_2} * h^{n-1}_d + b_h)$$
$\theta_d = (W_{h.}, b_h)_d$ has half as many parameters as the GatedConvRNN, and only a quarter as the ConvLSTM.
We will explore the difference between these memory types in Appendix \ref{sec:appendix_ablations}. Otherwise, we use the ConvLSTM for all experiments.
\section{Hyper-Parameters}\label{sec:hyper}
We tuned our hyper-parameters for the \clstm{} models on Sokoban and used the same settings for all other domains. We only changed the encoder network architectures to accommodate the specific observation format of each domain.
\subsection{Network parameters}
\label{sec:appendix_network_parameters}
All activation functions are ReLU unless otherwise specified.
\textbf{Observation size}
\begin{itemize}
\item Sokoban: (80, 80, 3)
\item \boxworld{}: (14, 14, 3)
\item \minipacman{}: (15, 19, 3)
\item \gridworld{}: (32, 32, 1)
\item Atari: (210, 160, 3)
\end{itemize}
\textbf{Encoder network} is a multilayer CNN with following domain-specific parameters:
\begin{itemize}
\item Sokoban: number of channels: (32, 32), kernel size: (8, 4), strides: (4, 2)
\item \boxworld{}: number of channels: (32, 32), kernel size: (3, 2), strides: (1, 1)
\item \minipacman{}: number of channels: (32, 32), kernel size: (3, 3), strides: (1, 1)
\item \gridworld{}: number of channels: (64, 64, 32), kernel size: (3, 3, 2), strides: (1, 1, 2)
\item Atari: number of channels: (16, 32, 64, 128, 64, 32), kernel size: (8, 4, 4, 3, 3, 3), strides: (4, 2, 2, 1, 1, 1)
\end{itemize}
\textbf{\clstm{}(D, N)}: all ConvLSTM modules use one convolution with 128 output channels, a kernel size of 3 and stride of 1. All cell states and hidden states have 32 channels.
\textbf{1D LSTM(D, N)}: all LSTM modules have hidden size 200. On Sokoban, the (10,10,32)-sized encoded observation is flattened and compressed via a fully connected layer (with 200 units) before it is fed to the LSTM modules. On Atari, however, we flatten the (14,10,32)-sized encoded observation and feed it directly to the LSTM(D, N). This results in a much larger network for Atari.
\textbf{Policy}: single hidden layer MLP with 256 units.
\textbf{Total number of parameters} for all our models are shown in Table~\ref{tab:number_parameters}.
\begin{small}
\begin{table}[!htb]
\caption{Number of trainable parameters for all models we compared}
\label{tab:number_parameters}
\begin{center}
\scalebox{0.8}{
\begin{tabular}{||c | c | c | c | c | c ||}
\hline
Model & Sokoban & \gridworld{} & \boxworld{} & \minipacman{} & Atari \\ [0.5ex] \hline\hline
DRC(3,3) & 2,042,376 & 4,353,642 & 3,615,847 & 5,096,488 & 2,896,229 \\ \hline
DRC(1,1) & 1,752,456 & - & 3,313,639 & 4,782,888 & 2,601,317 \\ \hline
LSTM(3,3) & \begin{tabular}[c]{@{}c@{}}2,152,992\\ (compressed obs)\end{tabular} & - & - & - & \begin{tabular}[c]{@{}c@{}}13,711,877\\ (uncompressed obs)\end{tabular} \\ \hline
LSTM(1,1) & \begin{tabular}[c]{@{}c@{}}1,088,192\\ (compressed obs)\end{tabular} & - & - & - & \begin{tabular}[c]{@{}c@{}}5,159,077\\ (uncompressed obs)\end{tabular} \\ \hline
I2A (unroll=15) & 7,781,269 & - & - & - & - \\ \hline
AtreeC & 3,269,065 & - & - & - & - \\ \hline
VIN & 62,506 & 19,978 & - & - & - \\ \hline
ResNet & 52,584,982 & - & 3,814,197 & 2,490,902 & - \\ \hline
CNN & 2,089,222 & 5,159,755 & - & - & - \\ \hline
\end{tabular}}
\end{center}
\end{table}
\end{small}
\subsection{RL training setup}
\label{app:training_setup}
We use the V-trace actor-critic algorithm described by \cite{espeholt2018impala}, with 4 GPUs for each learner and 200 actors generating trajectories.
We reduce variance and improve stability by using $\lambda$-returns targets ($\lambda=0.97$) and a smaller discount factor ($\gamma=0.97$). This marginally reduces the maximum performance observed, but increases the stability and average performance across runs, allowing better comparisons.
For all experiments, we use a BPTT (Backpropagation Through Time) unroll of length $20$ and a batch size of $32$.
We use the Adam optimizer \citep{kingma2014adam}. The learning rate is initialized to 4e-4 and is annealed to 0 over 1.5e9 environment steps with polynomial annealing. The other Adam optimizer parameters are $\beta_1=0.9, \beta_2=0.999, \epsilon=$1e-4.
The entropy and baseline loss weights are set to 0.01 and 0.5 respectively. We also apply a $\mathcal{L}^2$ norm cost with a weight of 1e-3 on the logits, and a $\mathcal{L}^2$ regularization cost with a weight of 1e-5 to the linear layers that compute the baseline value and logits.
\section{Extra experiments}
\subsection{Sokoban}
Figure~\ref{fig:sokoban_medium} shows learning curve when different \clstm{} architectures have been trained on the medium set as opposed to unfiltered set in the main text.
\begin{figure}[]
\centering
\includegraphics[width=.6\linewidth]{sokoban_clstm_medium.pdf}
\caption{Learning curves in Sokoban for \clstm{} architectures tested on the medium-difficulty test set. The dashed curve shows \clstm{(3,3)} trained on the easier unfiltered dataset. The solid curves show \clstm(3,3) and \clstm(9,1) trained directly on the medium-difficulty train set.}
\label{fig:sokoban_medium}
\end{figure}
\subsection{Atari}
\label{app:extra_experiments_atari}
We train \clstm(3,3) and \clstm(1,1) on five Atari 2600 games: \emph{Alien}, \emph{Asteroid}, \emph{Breakout}, \emph{Ms. Pac-Man}, and \emph{Up'n Down}. We picked these games for their planning flavor. We also train two baseline models, substituting ConvLSTMs for 1D LSTMs, in both the (1,1) and (3,3) configurations. These LSTM baselines are fed a flattened encoded observation, but the rest of the architecture is identical. We do not tune any hyperparameters for this domain and only consider out-of-the-box performance.
Figure~\ref{fig:atari} shows learning curves comparing these models on the above games. We also plot final training scores achieved by ApeX-DQN \citep{horgan2018distributed} for reference. \clstm(3,3) does significantly better than the LSTM baselines on two of the games (\emph{Asteroid} and \emph{Up'n Down}), and comparably on others. Given \clstm(3,3) has a lot fewer parameters than LSTM(1,1) and LSTM(3,3), it appears to make more effective use of them. It's also worth noting that stack-and-repeat (3,3)-representations do offer an improvement on (1,1)- representations for both the \clstm{} and the 1D LSTM architectures. On the whole, we need further study to characterize when \clstm(D,N) offers an advantage over LSTM(D,N) on Atari domains.
Our scores generally improve with more training. For example, if we let the \clstm(3,3) run for longer, it reaches scores above 75000 in Ms. Pacman.
\begin{figure}[]
\centering
\includegraphics[width=.7\textwidth]{atari_3x3_vs_1x1_vs_lstm.pdf}
\caption{Learning curves comparing the \clstm(3,3), \clstm(1,1), LSTM(3,3), and LSTM(1,1) network configurations on five Atari 2600 games. Results are averaged over two independent runs for \clstm(D,N) agents and five independent runs for LSTM(D,N) agents. We also provide ApeX-DQN (no-op regime) results from \cite{horgan2018distributed} as a reference.}
\label{fig:atari}
\end{figure}
\section{Extra ablation studies} \label{sec:appendix_ablations}
\begin{figure}[]
\begin{subfigure}[b]{0.5\textwidth}
\includegraphics[width=\linewidth]{ablations_memory_type.pdf}
\caption{}
\label{fig:ablations_memory_type}
\end{subfigure}
\begin{subfigure}[b]{0.5\textwidth}
\includegraphics[width=\linewidth]{ablations_pooling_and_topdown.pdf}
\caption{}
\label{fig:ablations_pooling_and_topdown}
\end{subfigure}
\caption{Ablation studies on the performance of our baseline \clstm(3,3) agent on Sokoban. All curves show test-set performance. a) We replace the ConvLSTM for simpler memory modules. b) We remove our extra implementation details, namely pool-and-inject, the vision shortcut, and the top-down skip connection, from the model.}
\label{fig:ablations}
\end{figure}
\begin{comment}
In Figure \ref{fig:ablations}, we compare the Sokoban test-set performance of our baseline \clstm(3,3) agent against various ablated versions. These results justify our choice of the ConvLSTM memory module and the architectural improvements described in Section \ref{improvements}.
\end{comment}
\subsection{Memory type}
The ConvLSTM is the top-performing memory module among those we tested. The Gated ConvRNN module comes out very close with half as many parameters. We surmise that the gap between these two types could be larger for other domains.
The Simple ConvRNN suffers from instability and high variance as expected, asserting that some gating is essential for the DRC's performance.
\subsection{Additional improvements}
Without \textbf{pool-and-inject}, the network learns significantly slower at early stages but nevertheless converges to the same performance as the baseline.
The \textbf{vision shortcut} is a residual connection from the output of the encoder module to the output of the \clstm. It has little influence on the performance of the baseline model. This is likely because we already feed the encoded observation to every (d,n)-location of the \clstm{} grid (described as "encoded observation skip-connections" in Section \ref{improvements} and Appendix \ref{sec:model_appendix}).
Without the \textbf{top-down skip connection}, the model exhibits larger performance variance and also slightly lower final performance.
On the whole, none of these are critical to the model's performance.
\section{Generalization}
For generalization experiments in \boxworld{} we generate levels online for each level-set size using seeds. Large approximately corresponds to 22k levels, medium to 5k, and small to 800. But at each iteration it's guaranteed that same levels are generated.
Figure~\ref{fig:overfit_boxword} shows results of similar experiment as Figure~\ref{fig:overfit_sokoban} but for \boxworld{} domain.
Figure~\ref{fig:sokoban_overfit_boxes} shows the extrapolation results on Sokoban when a model that is trained with 4 boxes is tested on levels with larger number of boxes. Performance degradation for \clstm(3,3) is very minimal and the models is still able to perform with performance of above 90\% even on the levels with 7 boxes, whereas the performance on for \clstm(1,1) drops to under 80\%.
Figure~\ref{fig:sokoban_overfit_gap} shows the generalization gap for Sokoban. Generalization gap is computed by the difference of performance (ratio of the levels solved) between train set and test set. The gap increase substantially more for \clstm(1,1) compared to \clstm(3,3) as the training set size decreases.
\begin{figure}[h]
\centering
\includegraphics[width=.9\linewidth]{boxworld_overfit.pdf}
\caption{Generalization performance on \boxworld{} when model is trained on different dataset sizes}
\label{fig:overfit_boxword}
\end{figure}
\begin{figure}[]
\begin{subfigure}[b]{0.48\textwidth}
\includegraphics[width=\linewidth]{sokoban_overfit_box.pdf}
\caption{Extrapolation over number of boxes.}
\label{fig:sokoban_overfit_boxes}
\end{subfigure}
\begin{subfigure}[b]{0.47\textwidth}
\includegraphics[width=\linewidth]{sokoban_overfit_size_gap.pdf}
\caption{Generalization gap for different train set size.}
\label{fig:sokoban_overfit_gap}
\end{subfigure}
\caption{(a) Extrapolation to larger number of boxes than those seen in training. The model was trained on 4 boxes. (b) Generalization gap computed as the difference between performance (in \% of level solved) on train set against test set. Smaller bars correspond to better generalization.}
\end{figure}
\section{Baseline architectures and experiments}
\subsection{Value Iteration Networks} \label{sec:appendix_vin}
Our implementation of VIN closely follows \citep{tamar2016vin}. This includes using knowledge of the player position in the mechanism for attention over the q-values produced by the VIN module in the case of \gridworld{}.
For Sokoban, which provides pixel observations, we feed an encoded frame $I$ to the VIN module. The convolutional encoder is identical to that used by our \clstm{} models (see Appendix \ref{sec:appendix_network_parameters}). We also couldn't use the player position directly; instead we use a learned soft attention mask $A=\sigma(W_{attention} * I)$ over the 2D state space, and sum over the attended values $A \odot \bar{Q_a}$ to obtain an attention-modulated value per abstract action $a$.
We introduce an additional choice of update rule in our experiments. The original algorithm sets $\bar{Q_a}' = W_{transition}^a * [\bar{R} : \bar{V}]$ at each value iteration. We also try the following alternative: $\bar{Q_a}' = \bar{R} + \gamma (W_{transition}^a * \bar{V})$ (note that '$:$' denotes concatenation along the feature dimension and '$*$' denotes 2D convolution). Here, $\gamma$ is a discounting parameter independent of the MDP's discount factor. In both cases, $\bar{R} = W_{reward} * I$ and $\bar{V} = \text{max}_{\substack{a}} \bar{Q_a}$. Although these equations denote a single convolutional operation in the computation of $\bar{Q_a}$, $\bar{R}$, and the attention map A, in practice we use two convolutional layers in each case with a relu activation in between.
We performed parameter sweeps over the choice of update rules (including $\gamma$), learning rate initial value, value iteration depth, number of abstract actions, and intermediate reward channels. The annealing schedule for the learning rate was the same as described in Appendix \ref{app:training_setup}. In total we had 64 parameter combinations for \gridworld{}, and 102 for Sokoban. We show the average of the top five performing runs from each sweep in Figures \ref{fig:gridworld_architectures} and \ref{fig:sokoban_architectures}.
\begin{figure}[h]
\begin{subfigure}[b]{0.48\textwidth}
\includegraphics[width=\linewidth]{gridworld32x32.pdf}
\caption{}
\label{fig:gridworld_architectures}
\end{subfigure}
\begin{subfigure}[b]{0.48\textwidth}
\includegraphics[width=\linewidth]{sokoban_architectures.pdf}
\caption{}
\label{fig:sokoban_architectures}
\end{subfigure}
\caption{Performance curves comparing DRC(3,3) against baseline architectures on (a) \gridworld{} (32x32) and (b) Sokoban. The Sokoban curves show the test-set performance. For VIN we average the top five performing curves from the parameter sweep on each domain. For the other architectures we follow the approach described in Appendix \ref{details_about_figures}, averaging not the top five curves but five independent replicas for fixed hyperparameters.}
\label{fig:gridworld_and_sokoban_architectures}
\end{figure}
\subsection{ATreeC} \label{sec:appendix_atreec}
We implement and use the actor-critic formulation of \citep{farquhar2017treeqn}. We feed it similarly encoded observations from Sokoban as in our \clstm{} and VIN setups. This is flattened and passed through a fully connected layer before the tree planning and backup steps. We do not use any auxiliary losses for reward or state grounding.
We swept over the learning rate initial value, tree depth (2 or 3), embedding size (128, 512), choice of value aggregation (max or softmax), and TD-lambda (0.8, 0.9). We average the top five best-performing runs from the sweep in Figure \ref{fig:sokoban_architectures}.
\subsection{ResNet}
We experimented with different ResNet architectures for each domain and chose one that performs best for each:
\begin{figure}[]
\begin{subfigure}[b]{0.48\textwidth}
\includegraphics[width=\linewidth]{mini_pacman.pdf}
\caption{\minipacman{}}
\label{fig:mini_pacman}
\end{subfigure}
\begin{subfigure}[b]{0.48\textwidth}
\includegraphics[width=\linewidth]{boxworld_lc.pdf}
\caption{\boxworld{}}
\label{fig:boxworld_lc}
\end{subfigure}
\caption{Performance curves comparing DRC(3,3) and DRC(1,1) against the best ResNet architectures we found for (a) \minipacman{} and (b) \boxworld{}. DRC(3,3) reaches nearly 100\% on \boxworld{} at $1e9$ steps.}
\end{figure}
\textbf{\boxworld{}} We used a three-layer CNN as encoder with (16, 32, 64) channels, kernel shape of 2 and stride of 1. This was followed by 8 ResNet blocks. Each block consisted of two CNN layers with 64 channels, kernel shape of 3 and stride 1. The output was flattened and passed to an MLP (1 hidden layer of 256 units), before computing the policy and baseline.
\textbf{\minipacman{}} We used the same ResNet architecture as the one for \boxworld{}, the only difference being that the initial CNN layer channels were (16, 32, 32) and the ResNet blocks had 32 channels.
\textbf{Sokoban} We did not use a separate observation encoder before the ResNet blocks. Instead, we had nine (CNN+ResNet+ResNet) sections. The leading CNN layer in each section could potentially be used for down-sampling using the stride parameter. The ResNet blocks consisted of one CNN layer each, with the same kernel size and output channels as the leading CNN layer of the section. The exact parameters for each section were as follows: (32, 32, 64, 64, 64, 64, 64, 64, 64) output channels, (8, 4, 4, 4, 4, 4, 4, 4, 4) kernel sizes, and (4, 2, 1, 1, 1, 1, 1, 1, 1) strides for the down-sampling CNN layer. Finally, the output was flattened and passed to an MLP with a single hidden layer of 256 units, which provided the policy and baseline outputs.
Figures~\ref{fig:mini_pacman} and~\ref{fig:boxworld_lc} compare the ResNets above against \clstm(3,3) and \clstm(1,1) on \minipacman{} and \boxworld{}.
\subsection{CNN}
\textbf{Sokoban} The CNN we used was similar to the encoder network for \clstm{}, but with more layers. It had (32, 32, 64, 64, 64, 64, 64, 64, 64) channels, (8, 4, 4, 4, 4, 4, 4, 4, 4) kernel sizes, and strides of (4, 2, 1, 1, 1, 1, 1, 1, 1).
\textbf{\gridworld{}} The CNN had (128, 128, 128, 128, 128, 128, 128, 64) channels, constant kernel size 3, and strides of (1, 1, 2, 1, 1, 1, 1, 1).
On both domains, the output of the CNN was flattened and passed to an MLP with a single hidden layer of 256 units, which provided the policy and baseline outputs.
\subsection{I2A}\label{sec:appendix_i2a}
We use the I2A implementation available at \url{https://github.com/vasiloglou/mltrain-nips-2017/tree/master/sebastien_racaniere} with the following modifications:
\begin{itemize}
\item We replace the FrameProcessing class with a $3$-layer CNN with kernel sizes $(8, 3, 3)$, strides $(8, 1, 1)$ and channels $(32, 64, 64)$; the output of the last convolution is then flattened and passed through a linear layer with $512$ outputs.
\item The model-free path passed to the I2A class was a FrameProcessing as describe above.
\item The RolloutPolicy is a $2$-layer CNN with kernel sizes $(8, 1)$, strides $(8, 1)$ and channels $(16, 16)$; the output of the last convolution is flattened and passed through an MLP with one hidden layer of size $128$, and output size $5$ (the number of actions in Sokoban).
\item The environment model is similar to the one used in \cite{racaniere2017imagination}. It consists of a deterministic model that given a frame and one-hot encoded action, outputs a predicted next frame and reward. The input frame is first reduced in size using a convolutional layer with kernel size $8$, stride $8$ and $32$ channels. The action is then combined with the output of this layer using pool-and-inject (see \citep{racaniere2017imagination}). This is followed by $2$ size preserving residual blocks with convolutions of shape $3$. The output of the last residual block is then passed to two separate networks to predict frame and reward. The frame prediction head uses a convolution layer with shape $3$, stride $1$, followed by a de-convolution with stride $8$, kernel shape $8$ and $3$ channels. The reward prediction head uses a convolution layer with shape $3$, stride $1$, followed by a linear layer with output size $3$. We predict rewards binned in $3$ categories (less than $-1$, between $[-1, 1]$ and greater than $1$), reducing it to a classification problem. \cite{racaniere2017imagination}.
\end{itemize}
The agent was trained with the V-trace actor-critic algorithm described by \cite{espeholt2018impala}.
The percentage of levels solved at 1e9 in table \ref{tab:sokoban} is lower than the 90\% reported originally by I2A~\citep{racaniere2017imagination}. This can be explained by some differences between the present paper and the I2A paper. Firstly, the original I2A used procedurally generated levels and did not require a train/test split for the dataset. This prevented any form of over-fitting, which is happening here since the test performance of the agent is 88\% at 1e9 steps. Secondly, in this paper, the environment model was not pre-trained. Instead it was trained online, using the same data that was used to train the RL loss.
\section{Details about figures} \label{details_about_figures}
Unless otherwise noted, each curve is the average of five independent runs (with identical parameters). We also show a 95\% confidence interval (using a shaded area) around each averaged curve. Before independent runs are averaged, we smoothen them with a window size of 5 million steps. Steps in RL learning curves refer to the total number of environment steps seen by the actors.
\section{Introduction}
One of the aspirations of artificial intelligence is a cognitive agent that can adaptively and dynamically form plans to achieve its goal. Traditionally, this role has been filled by model-based RL approaches, which first learn an explicit model of the environment's system dynamics or rules, and then apply a planning algorithm (such as tree search) to the learned model. Model-based approaches are potentially powerful but have been challenging to scale with learned models in complex and high-dimensional environments \cite{talvitie2014model, asadi2018lipschitz}, though there has been recent progress in that direction \cite{buesing2018learning, ebert2018visual}.
More recently, a variety of approaches have been proposed that learn to plan \emph{implicitly}, solely by model-free training. These \emph{model-free planning} agents utilize a special neural architecture that mirrors the structure of a particular planning algorithm. For example the neural network may be designed to represent search trees \citep{farquhar2017treeqn, oh2017value, guez2018mctsnets}, forward simulations \citep{racaniere2017imagination, silver2016predictron}, or dynamic programming \citep{tamar2016vin}. The main idea is that, given the appropriate inductive bias for planning, the function approximator can learn to leverage these structures to learn its own planning algorithm. This kind of \emph{algorithmic function approximation} may be more flexible than an explicit model-based approach, allowing the agent to customize the nature of planning to the specific environment.
In this paper we explore the hypothesis that planning may occur implicitly, even when the function approximator has {\em no special inductive bias toward planning}.
Previous work \citep{pang1998neural, wang2018prefrontal} has supported the idea that model-based behavior can be learned with general recurrent architectures, with planning computation amortized over multiple discrete steps \citep{schmidhuber1990making}, but comprehensive demonstrations of its effectiveness are still missing.
Inspired by the successes of deep learning and the universality of neural representations, our main idea is simply to furnish a neural network with a high capacity and flexible representation, rather than mirror any particular planning structure. Given such flexibility, the network can in principle learn its own algorithm for approximate planning.
Specifically, we utilize a family of neural networks based on a widely used function approximation architecture: the stacked convolutional LSTMs (ConvLSTM by \mbox{\citet{xingjian2015convlstm}}).
It is perhaps surprising that a purely model-free reinforcement learning approach can be so successful in domains that would appear to necessitate explicit planning. This raises a natural question: what is planning? Can a model-free RL agent be considered to be planning, without any explicit model of the environment, and without any explicit simulation of that model?
Indeed, in many definitions \cite{sutton1998reinforcement}, planning requires some explicit deliberation using a model, typically by considering possible future situations using a forward model to choose an appropriate sequence of actions.
These definitions emphasize the nature of the mechanism (the explicit look-ahead), rather than the effect it produces (the foresight).
However, what would one say about a deep network that has been trained from examples in a challenging domain to emulate such a planning process with near-perfect fidelity? Should a definition of planning rule out the resulting agent as effectively planning?
Instead of tying ourselves to a definition that depends on the inner workings of an agent, in this paper we take a behaviourist approach to measuring planning as a property of the agent's interactions. In particular, we consider three key properties that an agent equipped with planning should exhibit.
First, an effective planning algorithm should be able to generalize with relative ease to different situations. The intuition here is that a simple function approximator will struggle to predict accurately across a combinatorial space of possibilities (for example the value of all chess positions), but a planning algorithm can perform a local search to dynamically compute predictions (for example by tree search). We measure this property using procedural environments (such as random gridworlds, Sokoban \citep{racaniere2017imagination}, \boxworld{} \citep{zambaldi2018relational}) with a massively combinatorial space of possible layouts. We find that our model-free planning agent achieves state-of-the-art performance, and significantly outperforms more specialized model-free planning architectures. We also investigate extrapolation to a harder class of problems beyond those in the training set, and again find that our architecture performs effectively -- especially with larger network sizes.
Second, a planning agent should be able to learn efficiently from relatively small amounts of data. Model-based RL is frequently motivated by the intuition that a model (for example the rules of chess) can often be learned more efficiently than direct predictions (for example the value of all chess positions). We measure this property by training our model-free planner on small data-sets, and find that our model-free planning agent still performs well and generalizes effectively to a held-out test set.
Third, an effective planning algorithm should be able to make good use of additional thinking time. Put simply, the more the algorithm thinks, the better its performance should be. This property is likely to be especially important in domains with irreversible consequences to wrong decisions (e.g. death or dead-ends). We measure this property in Sokoban by adding additional thinking time at the start of an episode, before the agent commits to a strategy, and find that our model-free planning agent solves considerably more problems.
Together, our results suggest that a model-free agent, without specific planning-inspired network structure, can learn to exhibit many of the behavioural characteristics of planning.
The architecture presented in this paper serves to illustrate this point, and shows the surprising power of one simple approach. We hope our findings broaden the search for more general architectures that can tackle an even wider range of planning domains.
\section{Methods}
We first motivate and describe the main network architecture we use in this paper. Then we briefly explain our training setup. More details can be found in Appendix~\ref{sec:model_appendix}.
\subsection{Model architectures}
\label{sec:clstm}
We desire models that can represent and learn powerful but unspecified planning procedures. Rather than encode strong inductive biases toward particular planning algorithms, we choose high-capacity neural network architectures that are capable of representing a very rich class of functions. As in many works in deep RL, we make use of convolutional neural networks (known to exploit the spatial structure inherent in visual domains) and LSTMs (known to be effective in sequential problems). Aside from these weak but common inductive biases, we keep our architecture as general and flexible as possible, and trust in standard model-free reinforcement learning algorithms to discover the capacity to plan.
\subsubsection{Basic architecture}
\begin{figure}[]
\centering
\includegraphics[width=\linewidth]{3_3_convlstm_full_model3.pdf}
\caption{Illustration of the agent's network architecture. This diagram shows \clstm(2,3) for two time steps. Square boxes denote ConvLSTM modules and the rectangle box represents an MLP. Boxes with the same color share parameters.}
\label{fig:arch}
\end{figure}
The basic element of the architecture is a ConvLSTM \citep{xingjian2015convlstm} -- a neural network similar to an LSTM but with a 3D hidden state and convolutional operations. A recurrent network $f_\theta$ stacks together ConvLSTM modules. For a stack depth of $D$, the state $s$ contains all the cell states $c_d$ and outputs $h_d$ of each module $d$: $s = (c_1, \dots, c_D, h_1, \dots, h_D)$.
The module weights $\theta = (\theta_1, \ldots, \theta_D) $ are not shared along the stack.
Given a previous state and an input tensor $i$, the next state is computed as $s' = f_\theta(s, i)$.
The network $f_\theta$ is then repeated $N$ times within each time-step (i.e., multiple internal ticks per real time-step). If $s_{t-1}$ is the state at the end of the previous time-step, we obtain the new state given the input $i_t$ as:
\begin{align}
s_t = g_\theta(s_{t-1}, i_t) = \underbrace{f_\theta(f_\theta( \dots f_\theta( s_{t-1}, i_t), \dots, i_t), i_t)}_{N \text{ times}}
\end{align} \label{repeat_equation}
The elements of $s_t$ all preserve the spatial dimensions of the input $i_t$. The final output $o_t$ of the recurrent network for a single time-step is $h_D$, the hidden state of the deepest ConvLSTM module after N ticks, obtained from $s_t$. We describe the ConvLSTM itself and alternative choices for memory modules in Appendix \ref{sec:model_appendix}.
The rest of the network is rather generic. An encoder network $e$ composed of convolutional layers processes the input observation $x_t$ into a $H \times W \times C$ tensor $i_t$ --- given as input to the recurrent module $g$.
The encoded input $i_t$ is also combined with $o_t$ through a skip-connection to produce the final network output. The network output is then flattened and an action distribution $\pi_t$ and a state-value $v_t$ are computed via a fully-connected MLP. The diagram in Fig~\ref{fig:arch} illustrates the full network.
From here on, we refer to this architecture as Deep Repeated ConvLSTM (\clstm) network architecture, and sometimes followed explicitly by the value of $D$ and $N$ (e.g., \clstm(3, 2) has depth $D=3$ and $N=2$ repeats).
\subsubsection{Additional details}
\label{improvements}
Less essential design choices in the architectures are described here. Ablation studies show that these are not crucial, but do marginally improve performance (see Appendix~\ref{sec:appendix_ablations}).
\textbf{Encoded observation skip-connection} The encoded observation $i_t$ is provided as an input to all ConvLSTM modules in the stack.
\textbf{Top-down skip connection}
As described above, the flow of information in the network only goes up (and right through time). To allow for more general computation we add feedback connection from the last layer at one time step to the first layer of the next step.
\textbf{Pool-and-inject} To allow information to propagate faster in the spatial dimensions than the size of the convolutional kernel within the ConvLSTM stack, it is useful to provide a pooled version of the module's last output $h$ as an additional input on lateral connections. We use both max and mean pooling.
Each pooling operation applies pooling spatially for each channel dimension, followed by a linear transform, and then tiles the result back into a 2D tensor. This is operation is related to the pool-and-inject method introduced by \citet{racaniere2017imagination} and to Squeeze-and-Excitation blocks \citep{hu2017squeeze}.
\textbf{Padding} The convolutional operator is translation invariant. To help it understand where the edge of the input image is, we append a feature map to the input of the convolutional operators that has ones on the boundary and zeros inside.
\subsection{Reinforcement Learning}
We consider domains that are formally specified as RL problems, where agents must learn via reward feedback obtained by interacting with the environment~\citep{sutton1998reinforcement}.
At each time-step $t$, the agent's network outputs a policy $\pi_t = \pi_\theta(\cdot | h_t)$ which maps the history of observations $h_t := (x_0, \dots, x_t)$ into a probability distribution over actions, from which the action $a_t ~ \sim \pi_t$, is sampled. In addition, it outputs $v_t = v_\theta(h_t) \in \mathbb{R}$, an estimate of the current policy value, $v^{\pi}(h_t) = \mathbb{E}[ G_t | h_t]$, where $G_t = \sum_{t' \geq t} \gamma^{t'-t} R_{t'}$ is the return from time $t$, $\gamma \leq 1$ is a discount factor, and $R_t$ the reward at time $t$.
Both quantities are trained in an actor-critic setup where the policy (actor) is gradually updated to improve its expected return, and the value (critic) is used as a baseline to reduce the variance of the policy update. The update to the policy parameters have the following form using the score function estimator (a la REINFORCE \citep{williams1992simple}): $(g_t - v_\theta(h_t)) \nabla_\theta \log \pi_\theta(a_t | h_t)$.
In practice, we use truncated returns with bootstrapping for $g_t$ and we apply importance sampling corrections if the trajectory data is off-policy.
More specifically, we used a distributed framework and the IMPALA V-trace actor-critic algorithm \citep{espeholt2018impala}.
While we found this training regime to help for training networks with more parameters, we also ran experiments which demonstrate that the \clstm{} architecture can be trained effectively with A3C \citep{mnih2016a3c}.
More details on the setup can be found in Appendix \ref{app:training_setup}.
\section{Planning Domains}
\label{sec:domains}
The RL domains we focus on are combinatorial domains for which episodes are procedurally generated. The procedural and combinatorial aspects emphasize planning and generalization since it is not possible to simply memorize an observation to action mapping. In these domains each episode is instantiated in a pseudorandom configuration, so solving an episode typically requires some form of reasoning. Most of the environments are fully-observable and have simple 2D visual features.
The domains are illustrated and explained further in Appendix~\ref{sec:appendix_domains}. In addition to the planning domains listed below, we also run control experiments on a set of Atari 2600 games ~\citep{bellemare2013ale}.
\textbf{\gridworld{}}
A simple navigation domain following \citep{tamar2016vin}, consisting of a grid filled with obstacles. The agent, goal, and obstacles are randomly placed for each episode.
\begin{figure}[h]
\begin{subfigure}[b]{0.15\textwidth}
\centering
\includegraphics[width=0.98\linewidth]{sokoban_level_easy.pdf}
\caption{}
\end{subfigure}
\begin{subfigure}[b]{0.15\textwidth}
\centering
\includegraphics[width=0.98\linewidth]{sokoban_level_medium.pdf}
\caption{}
\end{subfigure}
\begin{subfigure}[b]{0.15\textwidth}
\centering
\includegraphics[width=0.98\linewidth]{sokoban_level_hard.pdf}
\caption{}
\end{subfigure}
\caption{Examples of Sokoban levels from the (a) unfiltered, (b) medium test sets, and from the (c) hard set. Our best model is able to solve all three levels.}
\label{fig:sokoban_levels_samples}
\end{figure}
\textbf{Sokoban}
A difficult puzzle domain requiring an agent to push a set of boxes onto goal locations \citep{botea2003soko, racaniere2017imagination}. Irreversible wrong moves can make the puzzle unsolvable.
We describe how we generate a large number of levels (for the fixed problem size 10x10 with 4 boxes) at multiple difficulty levels in Appendix \ref{sec:sokobandata}, and then split some into a training and test set. Briefly, problems in the first difficulty level are obtained from directly sampling a source distribution (we call that difficulty level \textit{unfiltered}). Then the \textit{medium} and \textit{hard} sets are obtained by sequentially filtering that distribution based on an agent's success on each level.
We are releasing these levels as datasets in the standard Sokoban format\footnote{\href{https://github.com/deepmind/boxoban-levels}{https://github.com/deepmind/boxoban-levels}}.
Unless otherwise specified, we ran experiments with the easier \textit{unfiltered} set of levels.
\textbf{\boxworld{}}
Introduced in \citep{zambaldi2018relational}, the aim is to reach a goal target by collecting coloured keys and opening colour-matched boxes until a target is reached. The agent can see the keys (i.e., their colours) locked within boxes; thus, it must carefully plan the sequence of boxes that should be opened so that it can collect the keys that will lead to the target. Keys can only be used once, so opening an incorrect box can lead the agent down a dead-end path from which it cannot recover.
\textbf{\minipacman{}}
~\citep{racaniere2017imagination}. The player explores a maze that contains food while being chased by ghosts. The aim of the player is to collect all the rewarding food. There are also a few power pills which allow the player to attack ghosts (for a brief duration) and earn a large reward. See Appendix~\ref{app:mini-pacman} for more details.
\section{Results}
Paralleling our behaviourist approach to the question of planning, we look at three areas of analysis in our results.
We first examine the performance of our model and other approaches across combinatorial domains that emphasize planning over memorization (Section~\ref{sec:perf}).\footnote{Illustrative videos of trained agents and playable demo available at \href{https://sites.google.com/view/modelfreeplanning/}{https://sites.google.com/view/modelfreeplanning/}}
We also report results aimed at understanding how elements of our architecture contribute to observed performance. Second, we examine questions of data-efficiency and generalization in Section~\ref{sec:generalization}.
Third, we study evidence of iterative computation in Section~\ref{sec:iterative}.
\subsection{Performance \& Comparisons}
\label{sec:perf}
In general, across all domains listed in Section~\ref{sec:domains}, the \clstm{} architecture performed very well with only modest tuning of hyper-parameters (see Appendix~\ref{sec:hyper}). The \clstm(3,3) variant was almost always the best in terms both of data efficiency (early learning) and asymptotic performance.
\textbf{\gridworld{}:} Many methods efficiently learn the \gridworld{} domain, especially for small grid sizes. We found that for larger grid sizes the \clstm{} architecture learns more efficiently than a vanilla Convolutional Neural Network (CNN) architecture of similar weight and computational capacity.
We also tested Value Iteration Networks (VIN) \citep{tamar2016vin}, which are specially designed to deal with this kind of problem (i.e. local transitions in a fully-observable 2D state space).
We found that VIN, which has many fewer parameters and a well-matched inductive bias, starts improving faster than other methods. It outperformed the CNN and even the \clstm{} during early-stage training, but the \clstm{} reached better final accuracy (see Table~\ref{tab:gridworld} and Figure~\ref{fig:gridworld_architectures} in the Appendix). Concurrent to our work, \citet{lee2018gated} observed similar findings in various path planning settings when comparing VIN to an architecture with weaker inductive biases.
\begin{table}[!htb]
\centering
\caption{Performance comparison in \gridworld{}, size 32x32, after 10M environment steps. VIN \citep{tamar2016vin} experiments are detailed in Appendix~\ref{sec:appendix_vin}.
}
\label{tab:gridworld}
\begin{tabular}{||c | c | c||}
\hline
Model & \shortstack{\% solved \\ at $1e6$ steps} & \shortstack{\% solved \\ at $1e7$ steps} \\ [0.5ex]
\hline\hline
\clstm(3, 3) & 30 & \textbf{99}\\
VIN & \textbf{80} & 97 \\
CNN & 3 & 90 \\
\hline
\end{tabular}
\end{table}
\begin{table}[!htb]
\centering
\caption{Comparison of test performance on (unfiltered) Sokoban levels for various methods. I2A \citep{racaniere2017imagination} results are re-rerun within our framework. ATreeC \citep{farquhar2017treeqn} experiments are detailed in Appendix~\ref{sec:appendix_atreec}. MCTSnets \citep{guez2018mctsnets} also considered the same Sokoban domain but in an expert imitation setting (achieving 84\% solved levels).
}
\label{tab:sokoban}
\begin{tabular}{||c | c | c | c||}
\hline
Model & \shortstack{\% solved \\ at $2e7$ steps} & \shortstack{\% solved \\ at $1e9$ steps} \\ [0.5ex]
\hline\hline
\clstm(3, 3) & \textbf{80} & \textbf{99}\\
ResNet & 14 & 96 \\
CNN & 25 & 92 \\
I2A (unroll=15) & 21 & 84\footnotemark{} \\
1D LSTM(3,3) & 5 & 74 \\
ATreeC & 1 & 57 \\
VIN & $12$ & 56 \\
\hline
\end{tabular}
\end{table}\footnotetext{This percentage at 1e9 is lower than the 90\% reported originally by I2A~\citep{racaniere2017imagination}. This can be explained by some training differences between this paper and the I2A paper: train/test dataset vs. procedurally generated levels, co-trained vs. pre-trained models. See appendix~\ref{sec:appendix_i2a} for more details.}
\textbf{Sokoban:} In Sokoban, we demonstrate state-of-the-art results versus prior work which targeted similar box-pushing puzzle domains (ATreeC~\citep{farquhar2017treeqn}, I2A~\citep{racaniere2017imagination}) and other generic networks (LSTM~\citep{hochreiter1997long}, ResNet~\citep{he2016deep}, CNNs).
We also test VIN on Sokoban, adapting the original approach to our state space by adding an input encoder to the model and an attention module at the output to deal with the imperfect state-action mappings.
Table~\ref{tab:sokoban} compares the results for different architectures at the end of training. Only 1\% of test levels remain unsolved by \clstm(3,3) after 1e9 steps, with the second-best architecture (a large ResNet) failing four times as often.
\textbf{\boxworld{}:} On this domain several methods obtain near-perfect final performance. Still, the \clstm{} model learned faster than published methods, achieving $\approx$80\% success after 2e8 steps. In comparison, the best ResNet achieved $\approx$50\% by this point. The relational method of \citet{zambaldi2018relational} can learn this task well but only solved $<$10\% of levels after 2e8 steps.
\textbf{\minipacman{}:} Here again, we found that the DRC architecture trained faster and obtained a better score than the ResNet architectures we tried (see Figure~\ref{fig:mini_pacman}).
\textbf{Atari 2600} To test the capacity of the \clstm{} model to deal with richer sensory data, we also examined its performance on five planning-focused Atari games \citep{bellemare2013ale}. We obtained state-of-the-art scores on three of five games, and competitive scores on the other two (see Appendix \ref{app:extra_experiments_atari} and Figure \ref{fig:atari} for details).
\subsubsection{Influence of network architecture}
We studied the influence of stacking and repeating the ConvLSTM modules in the \clstm{} architecture, controlled by the parameters $D$ (stack length) and $N$ (number of repeats) as described in Section~\ref{sec:clstm}. These degrees of freedom allow our networks to compute its output using shared, iterative, computation with $N>1$, as well as computations at different levels of representation and more capacity with $D>1$.
We found that the \clstm(3,3) (i.e, $D=3, N=3$) worked robustly across all of the tested domain. We compared this to using the same number of modules stacked without repeats (\clstm(9,1)) or only repeated without stacking (\clstm(1,9)). In addition, we also look at the same smaller capacity versions $D=2, N=2$ and $D=1, N=1$ (which reduces to a standard ConvLSTM).
Figure~\ref{fig:clstm_comparision} shows the results on Sokoban for the different network configurations. In general, the versions with more capacity performed better. When trading-off stacking and repeating (with total of 9 modules), we observed that only repeating without stacking was not as effective (this has the same number of parameters as the \clstm(1,1) version), and only stacking was slower to train in the early phase but obtained a similar final performance.
We also confirmed that \clstm(3,3) performed better than \clstm(1,1) in \boxworld{}, \minipacman{}, and \gridworld{}.
\begin{figure}[h]
\begin{subfigure}[b]{\columnwidth}
\includegraphics[width=\linewidth]{sokoban_convlstm_comp_1e8.pdf}
\caption{}
\label{fig:clstm_comparision}
\end{subfigure}
\begin{subfigure}[b]{\columnwidth}
\includegraphics[width=\linewidth]{sokoban_netarch.pdf}
\caption{}
\label{fig:resnet}
\end{subfigure}
\caption{a) Learning curves for various configurations of \clstm{} in Sokoban-Unfiltered. b) Comparison with other network architectures tuned for Sokoban. Results are on test-set levels.
}
\label{fig:sok_easy_comp}
\end{figure}
On harder Sokoban levels (Medium-difficulty dataset), we trained the \clstm(3,3) and the larger capacity \clstm(9,1) configurations and found that, even though \clstm(9,1) was slower to learn at first, it ended up reaching a better score than \clstm(3,3) (94\% versus 91.5\% after 1e9 steps). See Fig~\ref{fig:sokoban_medium} in appendix.
We tested the resulting \clstm(9,1) agent on the hardest Sokoban setting (Hard-difficulty), and found that it solved 80\% of levels in less than 48 minutes of evaluation time. In comparison, running a powerful tree search algorithm, Levin Tree Search \citep{Orseau2018tree}, with a \clstm(1,1) as policy prior solves 94\%, but in 10 hours of evaluation.
In principle, deep feedforward models should support iterative procedures within a single time-step and perhaps match the performance of our recurrent networks~\citep{jastrzebski2017residual}.
In practice, deep ResNets did not perform as well as our best recurrent models (see Figure~\ref{fig:resnet}), and are in any case incapable of caching implicit iterative planning steps over time steps. Finally, we note that recurrence by itself was also not enough: replacing the ConvLSTM modules with flat 1D LSTMs performed poorly (see Figure~\ref{fig:resnet}).
Across experiments and domains, our results suggests that both the network capacity and the iterative aspect of a model drives the agent's performance.
Moreover, in these 2D puzzle domains, spatial recurrent states significantly contribute to the results.
\subsection{Data Efficiency \& Generalization}
\label{sec:generalization}
\begin{figure*}[tb]
\begin{center}
\includegraphics[width=.8\linewidth]{sokoban_overfit.pdf}
\end{center}
\caption{Comparison of \clstm(3,3) (Top, Large network) and \clstm(1,1) (Bottom, Small network) when trained with RL on various train set sizes (subsets of the Sokoban-unfiltered training set). Left column shows the performance on levels from the corresponding train set, right column shows the performance on the test set (the same set across these experiments).}
\label{fig:overfit_sokoban}
\end{figure*}
In combinatorial domains generalization is a central issue. Given limited exposure to configurations in an environment, how well can a model perform on unseen scenarios? In the supervised setting, large flexible networks are capable of over-fitting.
Thus, one concern when using high-capacity networks is that they may over-fit to the task, for example by memorizing, rather than learning a strategy that can generalize to novel situations.
Recent empirical work in SL (Supervised Learning) has shown that the generalization of large networks is not well understood \citep{zhang2016understanding, arpit2017mem}.
Generalization in RL is even less well studied, though recent work \cite{zhang2018dissection, zhang2018study, cobbe2018quantifying} has begun to explore the effect of training data diversity.
\begin{figure*}[tb]
\begin{subfigure}[b]{0.65\columnwidth}
\includegraphics[width=\linewidth]{sokoban_overfit_size_bar_easy.pdf}
\caption{Sokoban unfiltered set}
\label{fig:sokoban_overfit_bar_size_easy}
\end{subfigure}
\centering
\begin{subfigure}[b]{0.65\columnwidth}
\includegraphics[width=\linewidth]{sokoban_overfit_size_bar_medium.pdf}
\caption{Sokoban medium set}
\label{fig:sokoban_overfit_bar_size_medium}
\end{subfigure}
\centering
\begin{subfigure}[b]{0.65\columnwidth}
\includegraphics[width=\linewidth]{boxworld_overfit_size_bar.pdf}
\caption{\boxworld{}}
\label{fig:boxworld_overfit_bar_size}
\end{subfigure}
\caption{Generalization results from a trained model on different training set size (Large, Medium and Small subsets of the unfiltered training dataset) in Sokoban when evaluated on (a) the unfiltered test set and (b) the medium-difficulty test set. (c) Similar generalization results for trained models in \boxworld{}. (These figures show a summary of results in Figure~\ref{fig:overfit_sokoban} and Appendix Fig.~\ref{fig:overfit_boxword}.)}
\label{fig:overfit_bar}
\end{figure*}
We explored two main axes in the space of generalization. We varied both the diversity of the environments as well as the size of our models. We trained the \clstm{} architecture in various data regimes, by restricting the number of unique Sokoban levels --- during the training, similar to SL, the training algorithm iterates on those limited levels many times. We either train on a Large (900k levels), Medium-size (10k) or Small (1k) set --- all subsets of the Sokoban-unfiltered training set. For each dataset size, we compared a larger version of the network, \clstm(3,3), to a smaller version \clstm(1,1).\footnote{\clstm(3,3) has around 300K more parameters, and it requires around 3 times more computation} Results are shown in Figure~\ref{fig:overfit_sokoban}.
In all cases, the larger \clstm(3,3) network generalized better than its smaller counterpart, both in absolute terms and in terms of {\em generalization gap}. In particular, in the Medium-size regime, the generalization gap\footnote{We compute the generalization gap by subtracting the performance (ratio of levels solved) on the training set from performance on the test set.} is 6.5\% for \clstm(3,3) versus 33.5\% for \clstm(1, 1). Figures~\ref{fig:sokoban_overfit_bar_size_easy}-\subref{fig:sokoban_overfit_bar_size_medium} compare these same trained models when tested on both the unfiltered and on the medium(-difficulty) test sets.
We performed an analogous experiment in the \boxworld{} environment and observed remarkably similar results (see Figure~\ref{fig:boxworld_overfit_bar_size} and Appendix Figure~\ref{fig:overfit_boxword}).
Looking across these domains and experiments there are two findings that are of particular note. First, unlike analogous SL experiments, reducing the number of training levels does not necessarily improve performance on the train set.
Networks trained on 1k levels perform worse in terms of the fraction of levels solved. We believe this is due to the exploration problem in low-diversity regime: With more levels, the training agent faces a natural curriculum to help it progress toward harder levels. Another view of this is that larger networks can overfit the training levels, but only if they experience success on these levels at some point. While local minima for the loss in SL are not practically an issue with large networks, local minima in policy space can be problematic.
From a classic optimization perspective, a surprising finding is that the larger networks in our experiment (both Sokoban \& \boxworld{}) suffer {\em less} from over-fitting in the low-data regime than their smaller counterparts (see Figure~\ref{fig:overfit_bar}).
However, this is in line with recent findings \cite{zhang2016understanding} in SL that the generalization of a model is driven by the architecture and nature of the data, rather than simply as a results of the network capacity and size of the dataset.
Indeed, we also trained the same networks in a purely supervised fashion through imitation learning of an expert policy.\footnote{Data was sampled on-policy from the expert policy executed on levels from the training datasets.} We observed a similar result when comparing the classification accuracy of the networks on the test set, with the \clstm(3,3) better able to generalize --- even though both networks had similar training errors on small datasets.
\textbf{Extrapolation}
Another facet of generality in the strategy found by the \clstm{} network is how it performs outside the training distribution.
In Sokoban, we tested the \clstm(3,3) and \clstm(1,1) networks on levels with a larger number of boxes than those seen in the training set. Figure \ref{fig:sokoban_overfit_boxes} shows that \clstm{} was able to extrapolate with little loss in performance to up to 7 boxes (for a a fixed grid size). The performance degradation for \clstm(3,3) on 7 boxes was 3.5\% and 18.5\% for \clstm(1,1). In comparison, the results from \citet{racaniere2017imagination} report a loss of 34\% when extrapolating to 7 boxes in the same setup.
\subsection{Iterative Computation}
\label{sec:iterative}
One desirable property for planning mechanisms is that their performance scales with additional computation without seeing new data. Although RNNs (and more recently ResNets) can in principle learn a function that can be iterated to obtain a result~\citep{graves2016adaptive, jastrzebski2017residual, greff2016highway}, it is not clear whether the networks trained in our RL domains learn to amortize computation over time in this way.
To test this, we took trained networks in Sokoban (unfiltered) and tested post hoc their ability to improve their results with additional steps. We introduced `no-op' actions at the start of each episode -- up to $10$ extra computation steps where the agent's action is fixed to have no effect on the environment.
The idea behind forced no-ops is to give the network more computation on the same inputs, intuitively akin to increasing its search time.
Under these testing conditions, we observed clear performance improvements on medium difficulty levels of about 5\% for \clstm{} networks (see Figure~\ref{fig:extranoops}). We did not find such improvements for the simpler fully-connected LSTM architecture.
This suggests that the DRC networks have learned a scalable strategy for the task which is computed and refined through a series of identical steps, thereby exhibiting one of the essential properties of a planning algorithm.
\begin{figure}[h]
\centering
\includegraphics[width=0.75\columnwidth]{extranoops_fromstart.pdf}
\caption{Forcing extra computation steps after training improves the performance
of \clstm{} on Sokoban medium-difficulty set (5 networks, each tested on the same 5000 levels).
Steps are performed by overriding the policy with no-op actions at the start of an episode. The green
line is the LSTM(1,1) model.
}
\label{fig:extranoops}
\end{figure}
\section{Discussion}
We aspire to endow agents with the capacity to plan effectively in combinatorial domains where simple memorization of strategies is not feasible.
An overarching question is regarding the nature of planning itself. Can the computations necessary for planning be learned solely using model-free RL, and can this be achieved by a general-purpose neural network with weak inductive biases? Or is it necessary to have dedicated planning machinery --- either explicitly encoding existing planning algorithms, or implicitly mirroring their structure?
In this paper, we studied a variety of different neural architectures trained using model-free RL in procedural planning tasks with combinatorial and irreversible state spaces.
Our results suggest that general-purpose, high-capacity neural networks based on recurrent convolutional structure, are particularly efficient at learning to plan.
This approach yielded state-of-the-art results on several domains -- outperforming all of the specialized planning architectures that we tested.
Our generalization and scaling analyses, together with the procedural nature of the studied domains, suggests that these networks learn an algorithm for approximate planning that is tailored to the domain. The algorithmic function approximator appears to compute its plan dynamically, amortised over many steps, and hence additional thinking time can boost its performance.
There are, of course, many approaches to improving the efficacy of model-free algorithms. For example, DARLA, ICM, and UNREAL improve performance and transfer in RL by shaping representations using an unsupervised loss \cite{higgins2017darla,pathak2017curiosity,jaderberg2016reinforcement}. Our work hints that one of the most important approaches may be to study which inductive biases allow networks to learn effective planning-like behaviours. In principle these approaches are straightforward to combine.
Recent work in the context of supervised learning is pushing us to rethink how large neural network models generalize \citep{zhang2016understanding,arpit2017mem}. Our results further demonstrate the mismatch between traditional views on generalisation and model size. The surprising efficacy of our planning agent, when trained on a small number of scenarios across a combinatorial state space, suggests that any new theory must take into account the algorithmic function approximation capabilities of the model rather than simplistic measures of its complexity.
Ultimately, we desire even more generality and scalability from our agents, and it remains to be seen whether model-free planning will be effective in reinforcement learning environments of real-world complexity.
\bibliographystyle{icml2019}
| {'timestamp': '2019-05-21T02:29:09', 'yymm': '1901', 'arxiv_id': '1901.03559', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03559'} | arxiv |
\section{Introduction}
A distributed transactional system that ensures a strong level of consistency greatly simplifies programmer responsibility while developing applications.
A strong level of consistency that clients interacting with a transactional system often desire is referred to \textit{external consistency}~\cite{spanner,strict,exconsistency}.
Roughly, under external consistency a distributed system behaves as if all transactions were executed sequentially, all clients observed the same unique order of transactions completion (also named \textit{external schedule} in~\cite{exconsistency}), in which every read operation returns the value written by the previous write operation.
By relying on the definition of external consistency, a transaction
terminates when its execution is returned to its client;
therefore the order defined by transaction client returns matches the transaction serialization order.
The latter property carries one great advantage:
if clients communicate with each other outside the system, they cannot be confused about the possible mismatch between transaction order they observe and the transaction serialization order provided by the concurrency control inside the system.
Simply, if a transaction is returned to its client, the serialization order of that transaction will be after any other transaction returned earlier, and before any transaction that will return subsequently. Importantly, this property holds regardless of when transactions start their execution.
To picture the value of external consistency,
consider an online document sharing service and two clients, $C_1$ connected to server $N_1$ and $C_2$ connected to another server $N_2$, whose goal is to synchronize the same document $D$. $C_1$ modifies $D$ and starts its synchronization concurrently with $C_2$. Because the underlying distributed system that implements the service is asynchronous, it is plausible for $C_1$ to observe the completion of the synchronization before $C_2$ (e.g., $C_1$ and $C_2$ are handled by two different nodes with different speed). As soon as $C_1$ received the notification, it informs $C_2$ that its modifications are permanent. At this point $C_2$ observes the completion of its synchronization operation and its expectation is to observe $C_1$'s modification on $D$ since $C_1$ completed before $C_2$.
Only if the service is external consistent, then the expectation is met (i.e., $C_2$ observes the modification of $C_1$); otherwise the possible outcomes include the case where $C_2$ does not observe $C_1$, which might confuse $C_2$. Note that if the service provides Serializable~\cite{serializability} operations, $C_2$ will not be guaranteed to observe the outcome of $C_1$.
In this paper we present \textit{SSS}, a key-value store that implements a novel distributed concurrency control providing external consistency and assuming off-the-shelf hardware.
Two features enable high performance and scalability in SSS, especially in read-dominated workloads:
\begin{itemize}
\item SSS supports read-only transactions that never abort due to concurrency, therefore the return value of all their read operations should be consistent at the time the operation is issued.
We name them as \textit{abort-free} hereafter.
This property is very appealing because many real-world applications produce significant read-only workload~\cite{DBLP:conf/sigmetrics/AtikogluXFJP12}.
\item SSS is designed to support a general (partial) replication scheme where keys are allowed to be maintained by any node of the system without predefined partitioning schemes (e.g., sharding~\cite{tapir,scatter}). To favor scalability, SSS does not rely on ordering communication primitives, such as Total Order Broadcast or Multicast~\cite{DBLP:journals/csur/DefagoSU04}.
\end{itemize}
The core components that make the above properties possible in SSS are the following:
\begin{compactitem}
\item SSS uses a vector clock-based technique to track dependent events originated on different nodes. This technique is similar to the one used by existing distributed transactional systems, such as Walter~\cite{walter} and GMU~\cite{gmu12}, and allows SSS to track events without a global source of synchronization.
\item SSS uses a new technique, which we name \textit{snapshot-queuing}, that works as follows. Each key is associated with a \textit{snapshot-queue}.
Only transaction that will surely commit
are inserted into the snapshot-queues of the their accessed keys in order to leave a trace of their existence to other concurrent transactions. Read-only transactions are inserted into their read keys' snapshot-queues at read time, while update transactions into their modified keys' snapshot-queues after the commit decision is reached.
A transaction in a snapshot-queue is inserted along with a scalar value, called \textit{insertion-snapshot}.
This value represents the latest snapshot visible by the transaction on the node storing the accessed key,
at the time the transaction is added to the snapshot queue. SSS concurrency control orders transactions with lesser insertion-snapshot before conflicting transactions with higher insertion-snapshot in the external schedule.
\end{compactitem}
SSS uses snapshot-queues to propagate established serialization orders among concurrent transactions as follows.
If a read-only transaction $T_R$ reads a key $x$ subsequently modified by a concurrent committed transaction $T_W$, $x$'s snapshot-queue is the medium to record the existence of an established serialization order between $T_R$ and $T_W$. With that, any other concurrent transaction accessing $x$ can see this established order and define its serialization accordingly.
In addition, $T_W$'s client response is delayed until $T_R$ completes its execution. This delay is needed so that update transactions can be serialized along with read-only transactions in a unique order where reads always return values written by the last update transaction returned to its client.
Failing in delaying $T_W$'s response would result in a discrepancy between the external order and the transaction serialization order. In fact, the external order would show $T_W$ returning earlier than $T_R$ but $T_R$ is serialized before $T_W$.
For non-conflicting update transactions that have dependencies with concurrent read-only transactions accessing common keys, since these transactions are aware of each other through the snapshot-queues of accessed keys, SSS prevents read-only transactions to observe those update transactions in different orders.
On the flip side, delaying update transactions might have a domino effect on limiting the level of concurrency in the system, which might lead to poor performance. The snapshot-queue technique prevents that: it permits a transaction that is in a snapshot-queue
to expose its written keys to other transactions while it is waiting for the completion of the concurrent read-only transaction(s) holding it. This feature enables progress of subsequent conflicting transactions, hence retaining the high throughput of the system.
Update transactions in SSS are serialized along with read-only transactions.
They always read the latest version of a key and buffer write operations. Validation is performed at commit time to abort if some read key has been overwritten meanwhile. The Two-Phase Commit protocol (2PC)~\cite{strict,gmu12, walter, Cockroach, carousel} is used to atomically lock and install written keys. These keys are externally visible when no concurrent read-only transactions caused the update transaction to wait due to snapshot-queuing, if any.
We implement SSS in Java and compared against two recent key-value stores, Walter~\cite{walter} and ROCOCO~\cite{rococo}, and one baseline where all transactions, including read-only, validate read keys and use 2PC to commit~\cite{serializability}. We name this competitor 2PC-baseline.
Overall, SSS is up to 7$\times$ faster than 2PC-baseline and up to 2.2$\times$ faster than ROCOCO under read-dominated workloads and long (i.e., 16 read keys) read-only transactions.
Also, when the percentage of read-only transactions is dominant and the node count is high, SSS is only 18\% slower than Walter, which provides a weaker isolation level than external consistency and even serializability.
When compared to the overall update transaction latency, in our experiments we assessed in less than 28\% the average waiting time introduced by SSS due to the snapshot-queuing.
\begin{comment}
\section{Background}
\subsection{The Relevance of the External Order}
Serializability~\cite{serializability} is the gold standard to guarantee strong correctness, but it allows for a simple execution pattern that is not acceptable for applications requiring access to the latest written values.
Suppose a new value is written to object $x$ by a committed transaction $T_{w}$, and the output of $T_{w}$ has been already returned to its client.
After that, another client issues a query (or read-only transaction) to the system, named $T_{ro}$.
By adopting a serializable concurrency control, a read operation of $T_{ro}$ might decide not to return the written value by $T_{w}$, but a previous value.
This option is not allowed under external consistency, therefore in the case obsolete values are returned, $T_{ro}$ might need to abort and restart in order to access the latest values. However, this approach does not fit our assumptions, where read-only transactions do not need to undergo multiple trials. Because of this, the return value of every read operation of a read-only transaction should be in accordance with the external schedule at the first trial.
Observing the expected value of $x$ would be easy if a synchronized clock was available in the system. In fact, $T_{ro}$, which starts after $T_{w}$, can select the latest correct value written by $T_{w}$ by just looking at the time $x$ is written. In the absence of a synchronized clock, $T_{ro}$ must track relations with concurrent transactions to make sure it returns the latest value that does not produce a non-serializable execution.
\end{comment}
\begin{comment}
\section{Background: G-Read}
\label{sec:ext-cons}
As firstly observed by Adya in~\cite{adya}, in a distributed system where nodes do not have access to a single point of synchronization (or an ordering component), concurrent non-conflicting transactions executing on different nodes cannot be aware of each other's execution. Because of that, different read-only transactions might order these non-conflicting transactions in a different way, therefore breaking the client's perceived order. For convenience, we name this anomaly as \textit{G-read}. Figure~\ref{pl3u} depicts this scenario, described below through an example borrowed from~\cite{adya}.
\vspace{-5pt}
\begin{figure}[h]
\centering
\subfigure[G-ready Anomaly.]{
\includegraphics[height=90pt,keepaspectratio]{im3.pdf}
\label{pl3u}
}\hspace{-10pt}
\subfigure[Dependency graph.]{
\includegraphics[height=90pt,keepaspectratio]{pl3u-dsg.pdf}
\label{pl3u-g}
}
\vspace{-5pt}
\caption{
Example of G-Read anomaly. For a key $o$, $R(o==oi)$ indicates a read operation on $o$ that returns version $oi$. For $W(o,oi )$, $oi$ is the produced version.
Dashed arrows show write-after-read (rw) anti-dependency and solid arrows show read-after-write (wr) dependency.}
\end{figure}
Consider a stock reporting system. Suppose there are two companies whose stock prices $x$ and $y$ are the same and are set to 50. Suppose $x$ and $y$ are stored in nodes $N_{2}$ and $N_{3}$ respectively. Then transactions $T1$, $T2$, $T3$, $T4$ are originated on nodes $N_{1}$, $N_{2}$, $N_{3}$, $N_{4}$ and executed in the following way. Transactions $T2$ and $T3$ update the stock prices of $x$ and $y$ to be 70 and 75 respectively (they do not conflict with each other). $T1$ and $T4$ are read-only. Transaction $T1$ observes the update of $T3$ but misses the update of $T2$. Transaction $T4$ accesses the update of $T2$ but misses the effect of $T3$.
As a result, in $T1$'s client view, $T3$ happens before $T_{2}$; but from the $T4$'s client perspective, $T2$ happens before $T3$. If clients of $T_{1}$ and $T_{4}$ communicate with each other, they may be confused
about the relative order in which the stock prices went up since there is no unique external schedule observed by both clients.
The conflict graph of this example is shown in Figure~\ref{pl3u-g} and contains a cycle. Worth noting that this execution is not even serializable.
\end{comment}
\begin{comment}
Logical time is the classical alternative to synchronizing clocks.
We rule out solutions that use a scalar per node because they inherently cannot allow correct access to the latest version of an object in the presence of abort-free transactions~\cite{score}.
Vector clocks can track dependent events happening on distinct nodes~\cite{happened_before}. In a vector clock-based approach, every node maintains a vector clock (i.e., an array of integers) with the size equals to the number of nodes. The element in position $j$ of the vector clock of node $N_{i}$ shows the value of the local timestamp of node $N_{j}$ updated during the latest interaction between $N_{i}$ and $N_{j}$.
Vector clocks provide read operations with the capability of returning the latest version of an object~\cite{happened_before}, however they come with pitfalls (e.g., G-read) that need to be addressed in order to achieve serializability or external consistency.
In the rest of this section we present an example of why the G-read anomaly can happen in a system where vector clocks are used to synchronize nodes. Figure~\ref{pl3u} depicts the scenario. Here we do not consider replication for simplicity.
\end{comment}
\begin{comment}
\todo[inline]{Change example and do not use real-time order.}
Let us assume four transactions $T_{1}$, $T_{2}$, $T_{3}$ and $T_{4}$ originated on nodes $N_{1}$, $N_{2}$, $N_{3}$ and $N_{4}$, with $T_{1}$ and $T_{4}$ read-only.
Objects $x$ and $y$ are stored in nodes $N_{2}$ and $N_{3}$ respectively. $T_{2}$ and $T_{3}$ are non-concurrent, non-conflicting, and there is a real-time order between them. $T_{2}$ updates $x$ and $T_{3}$ updates $y$.
In this example, $T_{1}$ and $T_{4}$ both return the latest versions of $x$ and $y$ available at the time of the operation. This is because their vector clocks are not comparable (i.e., an order cannot be defined between them). However, this decision leads them to observe different serialization orders involving $T_{2}$ and $T_{3}$. Specifically, in $T_{1}$'s client view, $T_{3}$ happens before $T_{2}$; but from the $T_{4}$'s client perspective, $T_{2}$ happens before $T_{3}$. Hence there is no unique external schedule observed by both clients.
Note that, in addition to the above issue, $T_1$'s client observes a serialization order of $T_{2}$ and $T_{3}$ that contradicts their real-time order, which inherently violates external consistency.
\end{comment}
\section{System Model \& Assumptions}
SSS assumes a system as a set of nodes that do not share either memory or a global clock. Nodes communicate through message passing and reliable asynchronous channels, meaning messages are guaranteed to be eventually delivered unless a crash happens at the sender or receiver node. There is no assumption on the speed and on the level of synchrony among nodes.
We consider the classic crash-stop failure model: sites may fail by crashing, but do not behave maliciously. A site that never crashes is correct; otherwise it is faulty.
Clients are assumed to be colocated with nodes in the system; this way a client is immediately notified of a transaction's commit or abort outcome, without additional delay.
Clients are allowed to interact with each other through channels that are not provided by the system's APIs.
\underline{Data Organization}.
Every node $N_{i}$ maintains shared objects (or keys) adhering to the key-value model~\cite{gmu12}. Multiple versions are kept for each key. Each version
stores the value and the commit vector clock of the transaction that produced the version.
SSS does not make any assumption on the data clustering policy; simply every shared key can be stored in one or more nodes, depending upon the chosen replication degree. For object reachability, we assume the existence of a local look-up function that matches keys with nodes.
\underline{Transaction execution}.
We model transactions as a sequence of read and write operations on shared keys, preceded by a begin, and followed by a commit or abort operation. A client begins a transaction on the colocated node and the transactions can read/write data belonging to any node; no a-priori knowledge on the accessed keys is assumed.
SSS's concurrency control ensures the ACID properties and targets applications with a degree of data replication.
Every transaction starts with a client submitting it to the system,
and finishes its execution informing the client about its final outcome: \textit{commit} or \textit{abort}.
Transactions that do not execute any write operation are called read-only, otherwise they are update transactions.
SSS requires programmer to identify whether a transaction is update or read-only.
\section{SSS Concurrency Control}
\label{sec:over}
In this section we describe the SSS concurrency control, followed by two execution examples.
\subsection{Metadata}
\underline{\textit{Transaction vector clocks}}. In SSS a transaction $T$ holds two vector clocks, whose size is equal to the number of nodes in the system. One represents its actual dependencies with transactions on other nodes, called \texttt{T.VC}; the other records the nodes where the transaction read from, called \texttt{T.hasRead}.
\texttt{T.VC} represents a version visibility bound for $T$.
Once a transaction begins in node $N_{i}$, it assigns the vector clock of the latest committed transaction in $N_{i}$
to its own \texttt{T.VC}.
Every time $T$ reads from a node $N_{j}$ for the first time during its execution, \texttt{T.VC} is modified based on the latest committed vector clock visible by $T$ on $N_{j}$.
After that, \texttt{T.hasRead[j]} is set to true ($\top$).
\underline{\textit{Transaction read-set and write-set}}. Every transaction holds two private buffers. One is $rs$ (or \textit{read-set}), which stores the keys read by the transaction during its execution, along with their value.
The other buffer is $ws$ (or \textit{write-set}), which contains the keys the transaction wrote, along with their value.
\underline{\textit{Snapshot-queue}}. A fundamental component allowing SSS to establish a unique external schedule is the snapshot-queuing technique. With that, each key is associated with an ordered queue (\texttt{SQueue}) containing: read-only transactions that
read that key; and update transactions that wrote that key while a read-only transaction was reading it.
Entries in a snapshot-queue (\texttt{SQueue}) are in the form of tuples.
Each tuple contains: transaction identifier $T.id$, the \textit{insertion-snapshot}, and transaction type (read-only or update). The \textit{insertion-snapshot} for a transaction $T$ enqueued on some node $N_i$'s snapshot-queue is the value of $T$'s vector clock in position $i^{th}$ at the time $T$ is inserted in the snapshot-queue.
Transactions in a snapshot-queue are ordered according to their insertion-snapshot.
A snapshot-queue contains only transactions that will commit; in fact, besides read-only transactions that are abort-free, update transactions are inserted in the snapshot-queue only after their commit decision has been reached.
\underline{\textit{Transaction transitive anti-dependencies set}}. An update transaction maintains a list of snapshot-queue entries, named \texttt{T.PropagatedSet}, which is populated during the transaction's read operations. This set serves the purpose of propagating anti-dependencies previously observed by conflicting update transactions.
\underline{\textit{Node's vector clock}}. Each node $N_{i}$ is associated with a vector clock, called \texttt{NodeVC}.
The $i^{th}$ entry of \texttt{NodeVC} is incremented when $N_{i}$ is involved in the commit phase of a transaction that writes some key replicated by $N_i$.
The value of $j^{th}$ entry of \texttt{NodeVC} in $N_{i}$ is the value of the $j^{th}$ entry of \texttt{NodeVC} in $N_{j}$
at the latest time $N_{i}$ and $N_{j}$ cooperated in the commit phase of a transaction.
\underline{\textit{Commit repositories}}. \texttt{CommitQ} is an ordered queue, one per node, which is used by SSS to ensure that non-conflicting transactions are ordered in the same way on the nodes where they commit.
\texttt{CommitQ} stores tuples $<$$T$, $vc$, $s$$>$ with the following semantics.
When an update transaction $T$, with commit vector clock $vc$, enters its commit phase, it is firstly added to the \texttt{CommitQ} of the nodes participating in its commit phase with its status $s$ set as \textit{pending}.
When the outcome of the transaction commit phase is decided, the status of the transaction is changed to \textit{ready}. A ready transaction inside the \texttt{CommitQ} is assigned with a final vector clock produced during the commit phase. In each node $N_{i}$, transactions are ordered in the \texttt{CommitQ} according to the $i^{th}$ entry of the vector clock ($VC[i]$). This allows them to be committed in $N_{i}$ with the order given by $VC[i]$.
When $T$ commits, it is deleted from \texttt{CommitQ} and its $vc$ is added to a per node repository, named \texttt{NLog}. We identify the most recent $vc$ in the \texttt{NLog} as \texttt{NLog.mostRecentVC}.
Overall, the presence of additional metadata to be transferred over the network might appear as a barrier to achieve high performance. To alleviate these costs we adopt metadata compression. In addition, while acknowledging that the size of vector clocks grows linearly with the system size, there are existing orthogonal solutions to increase the granularity of such a synchronization to retain efficiency~\cite{VCOptimized,VCOptimized1}
\subsection{Execution of Update transactions}
\label{update-tx}
Update transactions in SSS implements lazy update~\cite{DBLP:conf/sosp/TuZKLM13}, meaning their written keys are not immediately visible and accessible at the time of the write operation, but they are logged into the transactions write-set and become visible only at commit time. In addition, transactions record the information associated with each read key into their read-set.
Read operations of update transactions in SSS simply return the most recent version of their requested keys
(Lines~\ref{vis24}-\ref{vis26} of Algorithm~\ref{visibility}). At commit time, validation is used to verify that all the read versions have not been overwritten.
An update transaction that completes all its operations and commits cannot inform its client if it observes anti-dependency with one or more read-only transactions. In order to capture this waiting stage, we introduce the following phases to finalize an update transaction (Figure~\ref{fig1} pictures them in a running example).
\underline{\textit{Internal Commit}}.
When an update transaction successfully completes its commit phase, we say that it commits internally. In this stage, the keys written by the transactions are visible to other transactions, but its client has not been informed yet about the transaction completion. Algorithms~\ref{internal1} and~\ref{internal2} show the steps taken by SSS to commit a transaction internally.
SSS relies on the Two-Phase Commit protocol (2PC) to internally commit update transactions.
The node that carries the execution of a transaction $T$, known as its coordinator, initiates 2PC issuing the prepare phase, in which it contacts all nodes storing keys in the read-set and write-set. When a participant node $N_{i}$ receives a prepare message for $T$, all keys read/written by $T$ and stored by $N_{i}$ are locked. If the locking acquisition succeeds, all keys read by $T$ and stored by $N_{i}$ are validated by checking if the latest version of a key matches the read one (Lines~\ref{l26}-\ref{l32} Algorithm~\ref{internal1}). If successful, $N_{i}$ replies to $T$'s coordinator with a \texttt{Vote} message, along with a proposed commit vector clock. This vector clock is equal to $N_{i}$'s $NodeVC$ where $NodeVC[i]$ has been incremented. Finally, $T$ is inserted into $N_{i}$'s \texttt{CommitQ} with its $T.VC$.
\begin{algorithm}[h]
\caption{Internal Commit by Transaction T in node $N_{i}$}
\label{internal1}
\begin{algorithmic}[1]
\scriptsize
\Event {boolean Commit(Transaction T)}
\If{(T.ws=$\phi $)}
\For{($k \in T.rs$)}
\State \textbf{Send} \textit{Remove}$[T]$ \textbf{to all} replicas(k)
\EndFor
\State $T.outcome \leftarrow true$
\State \Return {$T.outcome$}
\EndIf
\State $commitVC \leftarrow T.VC$
\State $T.outcome \leftarrow true$
\State \textbf{send} \textit{Prepare}$[T]$ \textbf{to all} ${N_j} \in replicas(T.rs\cup T.ws)\cup {N_i}$
\ForAll {(${N_j}\in replicas(T.rs \cup T.ws) \cup {N_i}$)} \label{int1-11}
\State \textbf{wait receive} \textit{Vote}$[T.id, VC_{j}, res]$ from ${N_j}$ \textbf{or timeout}
\If{($res = false \vee timeout$)}
\State $T.outcome \leftarrow false $
\State break;
\Else
\State $commitVC \leftarrow \max (commitVC,V{C_j})$ \label{l17}
\EndIf
\EndFor
\State $xactVN \leftarrow \max \{ commitVC[w]:{N_w} \in replicas(T.ws) \} $
\ForAll{(${N_j} \in replicas(T.ws)$)}
\State $commitVC[j] \leftarrow xactVN$
\EndFor \label{int1_23}
\State \textbf{send} \textit{Decide}$[T,commitVC,outcome]$ to \textbf{all} ${N_j} \in replicas($
\Statex \hspace{0.4cm} $T.rs \cup T.ws) \cup {N_i}$
\EndEvent
\Statex
\State boolean validate(Set rs, VC T.VC) \label{l26}
\ForAll {($k \in rs$)}
\If {($k.last.vid[i] > T.VC[i]$)}
\State \Return{$ false $}
\EndIf
\EndFor
\State \Return{$true$} \label{l32}
\end{algorithmic}
\end{algorithm}
After receiving each successful \texttt{Vote}, $T$'s coordinator updates $T.VC$ by computing the maximum per entry (Line~\ref{l17} of Algorithm~\ref{internal1}).
This update makes $T$ able to include the causal dependencies of the latest committed transactions in all 2PC participants.
After receiving all \texttt{Vote} messages, the coordinator determines the final commit vector clock for $T$ as in (Lines~\ref{l17}-\ref{int1_23} of Algorithm~\ref{internal1}), and sends it along with the 2PC \texttt{Decide} message.
Lines~\ref{l16}-\ref{l29} of Algorithm~\ref{internal2} shows how 2PC participants handle the \texttt{Decide} message. When $N_i$ receives \texttt{Decide} for transaction $T$,
$N_i$'s $NodeVC$ is updated by computing the maximum with $T.VC$.
Importantly, at this stage the order of $T$ in the $CommitQ$ of $N_{i}$ might change because the final commit vector clock of $T$ has been just defined, and it might be different from the one used during the 2PC prepare phase when $T$ has been added to $CommitQ$.
In Algorithm~\ref{internal2} Lines~\ref{l229}-\ref{l236}, when transaction $T$ becomes the top standing of $N_i$'s $CommitQ$, the internal commit of $T$ is completed by inserting its commit vector clock into the $NLog$ and removing $T$ from $CommitQ$. When transaction's vector clock is inserted into the node's \texttt{NLog}, its written keys become accessible by other transactions.
At this stage, $T$'s client has not been informed yet about $T$'s internal commit.
\underline{\textit{Pre-Commit.}}
An internally committed transaction spontaneously enters the Pre-Commit phase after that. Algorithm~\ref{finalize} shows detail of Pre-commit phase. At this stage, $T$ evaluates if it should hold the reply to its client
depending upon the content of the snapshot-queues of its written keys. If so, $T$ will be inserted into the snapshot-queue of its written keys in $N_i$ with $T.VC[i]$ as \textit{insertion-snapshot}.
If at least one read-only transaction ($T_{ro}$) with a lesser \textit{insertion-snapshot} is found in any snapshot-queue $SQueue$ of $T$'s written keys, it means that $T_{ro}$ read that key before $T_{w}$ internally committed, therefore a write-after-read dependency between $T_{ro}$ and $T_{w}$ is established. In this case, $T$ is inserted into $SQueue$ until $T_{ro}$ returns to its client. With the anti-dependency, the transaction serialization order has been established with $T_{ro}$ preceding $T_{w}$, therefore informing immediately $T_{w}$'s client about $T_{w}$'s completion would expose an external order where $T_{w}$ is before $T_{ro}$, which violates external consistency (and therefore clients expectations).
\begin{algorithm}[h]
\caption{Internal Commit by Transaction T in node $N_{i}$}
\label{internal2}
\begin{algorithmic}[1]
\scriptsize
\Event{\textbf{receive} \textit{Prepare}$[TransactionT]$ from $N_{j}$}
\State boolean $outcome \leftarrow$ \label{lc}
$getExclusiveLocks(T.id, T.ws)$
\NoNumber {$\wedge getSharedLocks(T.id, T.rs)$}
$\wedge validate(T.rs, T.VC)$
\If {($\neg outcome$)}
\State $releaseLocks(T.id, T.rs, T,ws)$
\State \textbf{send} \textit{Vote}$[T.id, T.VC, outcome]$ to $N_{j}$
\Else
\State $prepVC \leftarrow NLog.mostRecentVC$
\If {(${N_i} \in replicas(T.ws)$)}
\State $NodeVC[i] + + $ \label{l9-int3}
\State $prepVC \leftarrow NodeVC$ \label{l10-int3}
\State \hspace{-0.09cm}$CommitQ.put(<T,prepVC,pending>)$
\EndIf
\State \textbf{send} \textit{Vote}$[T.id, prepVC, outcome]$ to $N_{j}$
\EndIf
\EndEvent
\Event {\textbf{receive} \textit{Decide}$[T,commitVC,outcome]$ from $N_{j}$ \textbf{atomically}} \label{l16}
\If{($outcome$)}
\State \hspace{-0.09cm}$NodeVC \leftarrow \max(NodeVC,commitVC)$
\If {(${N_i} \in replicas(T.ws)$)}
\State \hspace{-0.1cm}$CommitQ.update(<T,commitVC,ready>)$
\Else
\State $releaseSharedLocks(T.id,T.rs)$
\EndIf
\Else
\State $CommitQ.remove(T)$
\State $releaseLocks(T.id,T.ws,T.rs)$
\EndIf
\EndEvent \label{l29}
\Event{$\exists <T,vc,s>:<T,vc,s> = commitQ.head \wedge s=ready$}\label{l229}
\ForAll {($k \in T.ws: {N_i} \in replicas(k)$)}
\State apply(k,val,vc)
\EndFor
\State $NLog.add( < T,vc,T.ws > )$
\State $CommitQ.remove(T)$
\State $releaseLocks(T.id,T.ws,T.rs)$
\EndEvent \label{l236}
\end{algorithmic}
\end{algorithm}
\begin{algorithm}[h]
\caption{Start Pre-commit by Transaction T in node $N_{i}$}
\label{finalize}
\begin{algorithmic}[1]
\scriptsize
\ForAll{($k \in T.ws$)} \label{ln7}
\If{(${N_i} \in replicas(k)$)}
\State $k.SQueue.insert( < T.id,vc[i],``W" > )$
\ForAll {($T^{'} \in T.PropagatedSet$)} \label{l4sp}
\State $k.SQueue.insert(<{T^{'}}.id,{T^{'}}.sid,``R">)$
\EndFor \label{l6sp}
\EndIf
\EndFor \label{ln11}
\end{algorithmic}
\end{algorithm}
Tracking only non-transitive anti-dependencies is not enough to preserve correctness. If $T$ reads the update done by $T_{w'}$ and $T_{w'}$ is still in its Pre-commit phase, then $T$ has a transitive anti-dependency with $T_{ro'}$ (i.e., $T_{ro'}\xrightarrow{\text{rw}}T_{w'}\xrightarrow{\text{wr}} T$).
SSS records the existence of transactions like $T_{ro'}$ during $T$'s execution by looking into the snapshot-queues of $T$'s read keys and logging them into a private buffer of $T$, called $T.PropagatedSet$. The propagation of anti-dependency happens during $T$'s Pre-commit phase by inserting transactions in $T.PropagatedSet$ into the snapshot-queues of all $T$'s written keys (Lines~\ref{l4sp}-\ref{l6sp} of Algorithm~\ref{finalize}).
\begin{algorithm}[h]
\caption{End Pre-commit of Transaction T in node $N_{i}$}
\label{precommit}
\begin{algorithmic}[1]
\scriptsize
\ForAll {($k \in T.ws$)} \label{le1}
\If{${N_i} \in replicas(k)$}
\State \textbf{wait until} ($\exists <{T^{'}}.id,{T^{'}}.sid,->:$
\NoNumber{$k.SQueue.contains(<{T^{'}}.id,{T^{'}}.sid, ->) \wedge$
\NoNumber{$ {T^{'}}.sid < T.commitVC[i]$})}
\State $k.SQueue.remove(<T.id,vc[i],``W">)$
\State \textbf{send} \textit{Ack} $[T,vc[i]]$
\textbf{to} $T.coordinator$
\EndIf
\EndFor \label{le7}
\end{algorithmic}
\end{algorithm}
\underline{\textit{External Commit}}.
Transaction $T$ remains in its Pre-commit phase until there is no read-only transaction with lesser insertion-snapshot in the snapshot-queues of $T$'s written keys. After that, $T$ is removed from these snapshot-queues and an \texttt{Ack} message to the transaction 2PC coordinator is sent (Lines~\ref{le1}-\ref{le7} of Algorithm~\ref{precommit}).
The coordinator can inform its client after receiving \texttt{Ack} from all 2PC participants.
At this stage, update transaction's external schedule is established, therefore we say that SSS commits the update transaction \textit{externally}.
\begin{comment}
\begin{algorithm}[h]
\caption{External Commit of Transaction T in $N_{i}$}
\label{remove}
\begin{algorithmic}[1]
\scriptsize
\Event {\textbf{receive} \textit{Ack} $[T, cid]$ from \textbf{all} ${N_j} \in replicas(T.ws)$ } \label{l8}
\State $T.ClientReply()$
\EndEvent \label{l10}
\end{algorithmic}
\end{algorithm}
\end{comment}
\subsection{Execution of Read-Only Transactions}
In its first read operation (Algorithm~\ref{read} Lines~\ref{firsta}-\ref{firstb}), a read-only transaction $T$ on $N_i$ assigns \texttt{NLog.mostRecentVC} to its vector clock ($T.VC$). This way, $T$ will be able to see the latest updated versions committed on $N_i$.
Read operations are implemented by contacting all nodes that replicate the requested key and waiting for the fastest to answer.
When a read request of $T$ returns from node $N_j$, $T$ sets $T.hasRead[j]$ to \texttt{true}. With that, we set the visibility upper bound for $T$ from $N_{j}$ (i.e., $T.VC[j]$). Hence, subsequent read operations by $T$ contacting a node $N_{k}$ should only consider versions with a vector clock $vc_{k}$ such that $vc_{k}[j]<T.VC[j]$.
After a read operation returns, the transaction vector clock is updated by applying an entry-wise maximum operation between the current $T.VC$ and the vector clock associated with the read version (i.e., $VC^{*}$) from $N_{j}$.
Finally, the read value is added to $T.rs$ and returned.
Algorithm~\ref{visibility} shows SSS rules to select the version to be returned upon a read operation that contacts node $N_i$.
The first time $N_{i}$ receives a read from $T$, this request should wait until the value of $N_i$'s \texttt{NLog.mostRecentVC[i]} is equal to $T.VC[i]$
(Line~\ref{line4} Algorithm~\ref{visibility}).
This means that all transactions that are already included in the current visibility bound of $T.VC[i]$ must perform their internal commit before $T$'s read request can be handled.
After that, a correct version of the requested key should be selected for reading. This process starts by identifying the set of versions that are within the visibility bound of $T$, called $VisibleSet$. This means that, given a version $v$ with commit vector clock $vc$, $v$ is visible by $T$ if, for each entry $k$ such that $T.hasRead[k]=true$, we have that $vc[k]\leq T.VC[k]$ (Algorithm~\ref{visibility} Line~\ref{vis-line5}).
\begin{algorithm}[h]
\scriptsize
\caption {Read Operation by Transaction T in node $N_{i}$}
\label{read}
\begin{algorithmic}[1]
\scriptsize
\Event {Value Read(Transaction T, Key k)}
\If{($\exists < k,val > \in T.ws$)}
\State \Return{val}
\EndIf
\If {(is first read of T)} \label{firsta}
\State $T.VC \leftarrow NLog.mostRecentVC$
\EndIf \label{firstb}
\State ${\rm{target}} \leftarrow {\rm{\{ replicas(k)}}\} $
\State\textbf{send} \textit{READREQUEST}$[k, T.VC,T.hasRead,T.isUpdate]$
\NoNumber {to \textbf{all} ${N_j} \in target$}
\State \textbf{wait Receive} \textit{READRETURN} $[val, VC^{*}, PropagatedSet]$
\Statex \hspace{0.4cm} from {${N_h} \in target$}
\State $T.hasRead[h] \leftarrow true$
\State $T.VC \leftarrow \max (T.VC,V{C^{*}})$ \label{l12-read}
\State $T.rs \leftarrow T.rs \cup \{ <k,val>\} $
\State $T.PropagatedSet \leftarrow T.PropagatedSet \cup PropagatedSet$
\State \Return {val}
\EndEvent
\end{algorithmic}
\end{algorithm}
\begin{algorithm}[h]
\caption{Version Selection Logic in node $N_{i}$}
\label{visibility}
\begin{algorithmic}[1]
\scriptsize
\Event{Receive \textit{READREQUEST}$[T, k, T.VC, hasRead, isUpdate]$ from $N_{j}$}
\State $PropagatedSet \leftarrow \phi$
\If {($\neg isUpdate$)}
\If {($\neg {\rm{hasRead[i]}}$)}
\State \textbf{wait until} \label{line4} ${\rm{NLog}}{\rm{.mostRecentVC[i]}} \ge$ ${\rm{T.VC[i]}}$
\State $VisibleSet \leftarrow \{ vc: vc \in {\rm{NLog}} \wedge$ \label{vis-line5}
\Statex \hspace{1.2cm} $\forall w({\rm{hasRead[w]= true}}$ $\Rightarrow {\rm{vc[w]}}$ $\le {\rm{T.VC[w]}})\} $
\State $ExcludedSet\leftarrow\{ T^{'}:<T^{'}.id,T^{'}.cid,``W"> \in$ \label{ver-l6}
\Statex \hspace{1.2cm}$ k.SQueue \Rightarrow vc[i] > T.VC[i]) \}$
\State $VisibleSet \leftarrow VisibleSet \backslash ExcludedSet$
\State$maxVC \leftarrow vc:\forall w,vc[w] = \max \{ v[w]:v$ $\in VisibleSet\} $
\State $k.SQueue.insert( <T.id,maxVC[i],``R"> )$
\State $ver \leftarrow k.last$
\While{$(\exists w:hasRead[w] = true \wedge ver.vc[w] >$
\Statex \indent \indent \indent $maxVC[w]\vee \exists vc \in ExcludedSet:ver.vc = vc $
\Statex \indent \indent \indent $\wedge vc[i] > maxVC[i])$}
\State $ver \leftarrow ver.prev$
\EndWhile
\Else \label{vis-line15}
\State $maxVC \leftarrow T.VC$
\State $k.SQueue.insert(< T.id,maxVC[i],``R">)$
\State $ver \leftarrow k.last$
\While{($\exists w:({\rm{hasRead[w] = }}true \wedge ver.vc{\rm{[w]}} > maxVC[w])$)}
\State $ver \leftarrow ver.prev$
\EndWhile
\EndIf \label{line20}
\Else
\State $maxVC \leftarrow NLog.mostRecentVC$ \label{vis24}
\State $PropagatedSet$=$\{T^{'}:<T^{'}.id,readSid,``R">\in k.SQueue\}$
\State $ver \leftarrow k.last$
\EndIf \label{vis26}
\State \textbf{Send} \textit{READRETURN}[ver.val, maxVC,PropagatedSet ] \textbf{to} $N_{j}$
\EndEvent
\end{algorithmic}
\end{algorithm}
It is possible that transactions associated with some of these vector clocks are still in their Pre-Commit phase, meaning they exist in the snapshot-queues of $T$'s requested key. If so, they should be excluded from $VisibleSet$ in case their insertion-snapshot is higher than $T.VC[i]$.
The last step is needed
to serialize read-only transactions with anti-dependency relations before conflicting update transactions.
This condition is particularly important to prevent a well-known anomaly, firstly observed by Adya in~\cite{adya}, in which read-only transactions executing on different nodes can observe two non-conflicting update transactions in different serialization order~\cite{gmu12}.
Consider a distributed system where nodes do not have access to a single point of synchronization (or an ordering component), concurrent non-conflicting transactions executing on different nodes cannot be aware of each other's execution. Because of that, different read-only transactions might order these non-conflicting transactions in a different way, therefore breaking the client's perceived order. SSS prevents that by serializing both these read-only transactions before those update transactions.
At this stage, if multiple versions are still included in $VisibleSet$, the version with the maximum $VC[i]$ should be selected to ensure external consistency.
Once the version to be returned is selected, $T$ is inserted in the snapshot-queue of the read key using
$maxVC[i]$ as insertion-snapshot (Line 16 of Algorithm~\ref{visibility}). Finally, when the read response is received, the maximum per entry between $maxVC$ (i.e., $VC^{*}$ in Algorithm~\ref{read}) and the $T.VC$ is computed along with the result of the read operation.
\begin{comment}
\begin{algorithm}[h]
\caption{Remove of read-only transaction T in node $N_{i}$}
\label{remove}
\begin{algorithmic}[1]
\scriptsize
\Event{{Receive \textit{Remove}} $[T]$ in $N_{i}$}
\For{$k \in T.rs$}
\If{(${N_i} \in replicas(k)$)}
\State $k.SQueue.remove( < T.id, readSid ,``R" > )$
\EndIf
\EndFor
\ForAll {(${k^{'}}: < T.id, readSid ,``R" >\in {k^{'}}.SQueue$)} \label{p7}
\State \textbf{send} \textit{Remove}$[T]$ {\textbf{to all} replicas(${k^{'}}$)}
\EndFor \label{p10}
\EndEvent
\end{algorithmic}
\end{algorithm}
\end{comment}
When a read-only transaction $T$ commits, it immediately replies to its client. After that, it sends a message to the nodes storing only the read keys in order to notify its completion. We name this message \texttt{Remove}.
Upon receiving \texttt{Remove}, the read-only transaction is deleted from all the snapshot-queues associated with the read keys.
Deleting a read-only transaction from a snapshot-queue enables conflicting update transactions to be externally committed and their responses to be released to their clients.
Because of transitive anti-dependency relations, a node might need to forward the \texttt{Remove} message to other nodes as follows. Let us assume $T$ has an anti-dependency with a transaction $T_w$, and another transaction $T_{w'}$ reads from $T_w$. Because anti-dependency relations are propagated along the chain of conflicting transactions, $T$ exists in the snapshot-queues of $T_{w'}$'s written keys. Therefore, upon \texttt{Remove} of $T$, the node executing $T_w$ is responsible to forward the \texttt{Remove} message to the node where $T_{w'}$ executes for updating the affected snapshot-queues.
When a read operation is handled by a node that already responded to a previous read operation from the same transaction,
the latest version according to $maxVC$
is returned,
and $T$ can be inserted into the snapshot-queue with its corresponding identifier and $maxVC[i]$ as insertion-snapshot.
\subsection{Examples} \label{example}
\textbf{External Consistency \& Anti-dependency}.
Figure~\ref{fig1} shows an example of how SSS serializes an update transaction $T_{1}$ in the presence of a concurrent read-only transaction $T_{2}$. Two nodes are deployed, $N_{1}$ and $N_{2}$, and no replication is used for simplicity. $T_{1}$ executes on $N_{1}$ and $T_{2}$ on $N_{2}$. Key $y$ is stored in $N_{2}$'s repository. The \texttt{NLog.mostRecentVC} for Node 1 is [5,4] and for Node 2 is [3,7].
\begin{comment}
\begin{figure}[h]
\includegraphics[width=.44\textwidth]{im1-ver2.pdf}
\centering
\caption{Example of SSS execution in the presence of an anti-dependency. Orange boxes show the content of the data repository. Gray boxes show transaction execution. Dashed line represents the waiting time for $T2$. The red crossed entries of Q(y) represent their elimination upon Remove.}
\label{fig1}
\end{figure}
\begin{figure}[h]
\includegraphics[width=.48\textwidth]{im6.pdf}
\centering
\caption{Handling read-only transactions along with non-conflicting update transactions. We omitted the snapshot-queue entries elimination upon receiving Remove to improve readability.}
\label{pl3u-fixed}
\end{figure}
\end{comment}
\begin{comment}
\begin{figure*}[!tbp]
\centering
\begin{minipage}[b]{0.45\textwidth}
\centering
\includegraphics[scale=0.3]{im1-ver2.pdf}
\caption{SSS execution in the presence of an anti-dependency. Orange boxes show the content of the data store. Gray boxes show transaction execution. Dashed line represents the waiting time for $T2$. The red crossed entries of Q(y) represent their elimination upon Remove.}
\label{fig1}
\end{minipage}
\hfill
\begin{minipage}[b]{0.45\textwidth}
\centering
\includegraphics[scale=0.25]{im6.pdf}
\caption{Handling read-only transactions along with non-conflicting update transactions. We omitted snapshot-queue entries elimination upon Remove to improve readability.}
\label{pl3u-fixed}
\end{minipage}
\end{figure*}
\end{comment}
$T_{1}$ performs a read operation on key $y$ by sending a remote read request to $N_{2}$. At this point, $T_{1}$ is inserted in the snapshot-queue of $y$ ($Q(y$)) with 7 as insertion-snapshot. This value is the second entry of $N_{2}$'s \texttt{NLog.mostRecentVC}.
Then the update transaction $T_{2}$ begins with vector clock [3,7], buffers its write on key $y$ in its write-set, and performs its internal commit by making the new version of $y$ available, and by inserting the produced commit vector clock (i.e., $T2.commitVC$=[3,8]) in $N_{2}$'s $NLog$. As a consequence of that, $NLog.mostRecentVC$
is equal to $T2.commitVC$.
Now $T_2$ is evaluated to decide whether it should be inserted into $Q(y)$. The insertion-snapshot of $T_2$ is equal to 8, which is higher than $T_{1}$'s insertion-snapshot in $Q(y)$. For this reason, $T_2$ is inserted in $Q(y)$ and its Pre-commit phase starts.
\begin{figure}[h]
\centering
\includegraphics[scale=0.3]{im1-ver2.pdf}
\caption{SSS execution in the presence of an anti-dependency. Orange boxes show the content of the data store. Gray boxes show transaction execution. Dashed line represents the waiting time for $T2$. The red crossed entries of Q(y) represent their elimination upon Remove.}
\label{fig1}
\end{figure}
At this stage, $T_{2}$ is still not externally visible. Hence $T_{2}$ remains in its Pre-Commit phase until $T_{1}$ is removed from $Q(y)$, which happens when $T_1$ commits and sends the \texttt{Remove} message to $N_2$. After that, $T_{2}$'s client is informed about $T_{2}$'s completion. Delaying the external commit of $T_{2}$ shows clients a sequence of transactions completion that matches their serialization order.
\textbf{External Consistency \& Non-conflicting transactions}.
Figure~\ref{pl3u-fixed} shows how SSS builds the external schedule in the presence of read-only transactions and non-conflicting update transactions.
There are four nodes, $N_1$, $N_2$, $N_3$, $N_4$, and four concurrent transactions, $T_1$, $T_2$, $T_3$, $T_4$, each executes on the respective node. By assumption, $T_2$ and $T_3$ are non-conflicting update transactions, while $T_1$ and $T_4$ are read-only.
\begin{figure}[h]
\centering
\includegraphics[scale=0.25]{im6.pdf}
\caption{Handling read-only transactions along with non-conflicting update transactions. We omitted snapshot-queue entries elimination upon Remove to improve readability.}
\label{pl3u-fixed}
\end{figure}
SSS ensures that $T_1$ and $T_4$ do not serialize $T_2$ and $T_3$ in different orders and they return to their clients in the same way they are serialized by relying on snapshot-queuing. $T_1$ is inserted into $Q(x)$ with insertion-snapshot equals to 7. Concurrently, $T_4$ is added to the snapshot-queue of $y$ with insertion-snapshot equals to 10.
The next read operation by $T_1$ on $y$ has two versions evaluated to be returned: $y0$ and $y1$. Although $y1$ is the most recent, since $T_4$ returned $y0$ previously (in fact $T_4$ is in $Q(y)$), $y1$ is excluded and $y0$ is returned. Similar arguments apply to $T_4$'s read operation on $x$.
The established external schedule serializes $T_1$ and $T_4$ before both $T_2$ and $T_3$.
\begin{comment}
\subsubsection{Avoiding Processing Stalls}
Figure~\ref{fig2} shows how SSS avoids that transactions in the snapshot-queues hamper the progress and correctness of other concurrent conflicting transactions. The following example covers the case where nodes interacted (through the commit of $T_2$) prior the start time of $T_3$, and $y$'s post-commit version is accessed.
\begin{figure}[h]
\includegraphics[width=.44\textwidth]{im2.pdf}
\centering
\caption{SSS's Pre-commit phase. The snapshot $d$ is related with $T_2$'s commit vector clock ($T_2$'s commits internally), and therefore is greater than $b$ and $c$.}
\label{fig2}
\end{figure}
In this example, $T_{1}$ reads the latest value of object $y$, its vector clock is modified, and $T_{1}$ is inserted into $Q(y)$. After that, $T_{2}$ executes entirely, commits involving also $N_3$, and enter its Pre-Commit phase, waiting for $T_{1}$'s removal from $Q(y)$. Now $T_{3}$ starts on $N_{3}$. According to its vector clock, obtained from $N_{3}$ at the beginning of its execution, it is able to observe the latest version of $y$ produced by $T_2$. This is possible because the second entry of $T_3$'s vector clock matches the second entry of $T_2$'s vector clock due to their previous interaction (i.e., the commit of $T_2$).
In this scenario, the clients of $T_2$ and $T_3$ will still observe a unique external schedule, which is where $T_2$ precedes $T_3$, even if $T_3$ might reply to its client sooner than $T_2$ if $T_3$ is read-only.
\end{comment}
\subsection{Additional Considerations of SSS}
\underline{\textit{Garbage Collection}}. A positive side effect of the \texttt{Remove} message is the implicit garbage collection of entries in the snapshot-queues. In fact, SSS removes any entry representing transactions waiting for a read-only transaction to finish upon receiving \texttt{Remove}, which cleans up the snapshot-queues.
\underline{\textit{Starvation}}. Another important aspect of SSS is the chance to slow down update transactions, possibly forever, due to an infinite chain of conflicting read-only transactions issued concurrently. We handle this corner case by applying admission control to read operations of read-only transactions in case they access a key written by a transaction that is in a snapshot-queue for a pre-determined time. In practice, if such a case happens, we apply an artificial delay to the read operation (exponential back-off) to give additional time to update transaction to be removed from the snapshot-queue. In the experiments we never experienced starvation scenarios, even with long read-only transactions.
\underline{\textit{Deadlock-Freedom}}. SSS uses timeout to prevent deadlock during the commit phase's lock acquisition. Also, the waiting condition applied to update transactions cannot generate deadlock. This is because read-only transactions never wait for each other, and there is no condition in the protocol where an update transaction blocks a read-only transaction. The only wait condition occurs when read-only transactions force update transactions to hold their client response due to snapshot-queuing. As a result, no circular dependency can be formed, thus SSS cannot encounter deadlock.
\underline{\textit{Fault-Tolerance}}. SSS deploys a protocol that tolerates failures in the system using replication. In the presented version of the SSS protocol, we did not include either logging of messages to recover update transactions' 2PC upon faults, or a consensus-based approach (e.g., Paxos-Commit~\cite{2pc}) to distribute and order 2PC messages. Solutions to make 2PC recoverable are well-studied. To focus on the performance implications of the distributed concurrency control of SSS and all its competitors, operations to recover upon a crash of a node involved in a 2PC have been disabled. This decision has no correctness implication.
\section{Correctness}
\label{sec:correctness}
Our target is proving that every history $H$ executed by SSS, which includes committed update transactions and read-only transactions (committed or not), is external consistent.
We adopt the classical definition of history~\cite{adya}.
For understanding correctness, it is sufficient to know that a history is external consistent if the transactions in the history return the same values and leave the data store in the same state as they were executed in a sequential order (one after the other), and that order does not contradict the order in which transactions return to their clients.
We decompose SSS's correctness in three statements, each highlighting a property guaranteed by SSS.
Each statement claims that a specific history $H'$, which is derived from $H$, is external consistent. In order to prove that, we rely on the characteristics of the Direct Serialization Graph (DSG)~\cite{adya} which is derived from $H'$. Note that DSG also includes order relations between transactions' completion.
Every transaction in $H'$ is a node of the DSG graph, and every dependency of a transaction $T_j$ on a transaction $T_i$ in $H'$ is an edge from $T_i$ to $T_j$ in the graph. The concept of dependency is the one that is widely adopted in the literature: \textit{i)} $T_j$ read-depends on $T_i$ if a read of $T_j$ returns a value written by $T_i$, \textit{ii)} $T_j$ write-depends on $T_i$ if a write of $T_j$ overwrites a value written by $T_i$; \textit{iii)} $T_j$ anti-depends on $T_i$ if a write of $T_j$ overwrites a value previously read by $T_i$. We also map the completion order relations to edges in the graph: if $T_i$ commits externally before $T_j$ does, then the graph has an edge from $T_i$ to $T_j$. A history $H'$ is external consistent iff the DSG does not have any cycle~\cite{serializability,adya}.
In our proofs we use the binary relation $\leq$ to define an ordering on pair of vector clocks $v_1$ and $v_2$ as follows: $v_1 \leq v_2$ if $\forall i$, $v_1[i]\leq v_2[i]$. Furthermore, if there also exists at least one index $j$ such that $ v_1[j]<v_2[j]$, then $v_1<v_2$ holds.
\textit{\underline{Statement 1}. For each history $H$ executed by SSS, the history $H'$, which is derived from $H$ by only including committed update transactions in $H$, is external consistent.}
In the proof we show that if there is an edge from transaction $T_i$ to transaction $T_j$ in DSG, then $T_i.commitVC$ $<$ $T_j.commitVC$. This statement implies that transactions modify the state of the data store as they were executed in a specific sequential order, which does not contradict the transaction external commit order. Because no read-only transactions is included in $H'$, the internal commit is equivalent to the external commit (i.e., no transaction is delayed). The formal proof is included in the technical report~\cite{tech-rep}.
\textit{\underline{Statement 2}. For each history $H$ executed by SSS, the history $H'$, which is derived from $H$ by only including committed update transactions and one read-only transaction in $H$, is external consistent.}
The proof shows that read-only transactions always observe a consistent state by showing that in both the case of a direct dependency or anti-dependency, the vector clock of the read-only transactions is comparable with the vector clocks of conflicting update transactions.
This statement implies that read operations of a read-only transaction always return values from a state of the data store as the transaction was executed atomically in a point in time that is not concurrent with any update transaction. The formal proof is included in the technical report~\cite{tech-rep}.
\textit{\underline{Statement 3}. For each history $H$ executed by SSS, the history $H'$, which is derived from $H$ by only including committed update transactions and two or more read-only transactions in $H$, is external consistent.}
Since Statement 2 holds, SSS guarantees that each read-only transaction appears as it were executed atomically in a point in time that is not concurrent with any update. Furthermore, since Statement 1 holds, the read operations of that transaction return values of a state that is the result of a sequence of committed update transactions. Therefore, Statement 3 implies that, given such a sequence $S1$ for a read-only transaction $T_{r1}$, and $S2$ for a read-only transaction $T_{r2}$, either $S1$ is a prefix of $S2$, or $S2$ is a prefix of $S1$.
In practice, this means that all read-only transactions have a coherent view of all transactions executed on the system. The formal proof is included in the technical report~\cite{tech-rep}.
\begin{comment}
Since at least two read-only transactions can be in $H'$, we need to differentiate the two cases when a read-only transaction accesses versions written by externally committed transactions (\textit{case 1}), from the case where it accesses versions written by a transaction in Pre-commit, which we call Pre-commit versions (\textit{case 2}).
Note that we exclude the scenario where all read-only transactions access Pre-commit versions since, in this case, at least one update transaction should be snapshot-queued due to a read-only transaction that produced an anti-dependency. The existence of this read-only transaction violates the assumption that all read-only transactions access Pre-commit versions.
\vspace{-5pt}
\begin{figure}[h]
\includegraphics[width=.35\textwidth]{correctness.pdf}
\centering
\caption{Schedule violating external consistency where T1 and T4 are read-only.}
\label{fig:correctness}
\end{figure}
\vspace{-5pt}
In \textit{case 1}, the arguments used for Statement 1 and 2 hold, therefore a read-only transaction is serialized before an update transaction that produces an anti-dependency. At this point, any other conflicting read-only transaction will be aware of the existence of a read-only transaction with an anti-dependency by leveraging the snapshot-queuing technique, which propagates the information about the anti-dependency (Line~\ref{ver-l6} of Algorithm~\ref{visibility}). With this knowledge, other read-only transactions accessing externally committed versions will be serialized before the update transactions, therefore all observing the same serialization schedule. As in Statement 2, update transactions have a higher insertion-snapshot, therefore their execution will be externally visible only after the completion of the read-only transactions, maintaining the serialization order.
For \textit{case 2}, we rely on Figure~\ref{fig:correctness} in which we show a scenario where $T_1$ and $T_4$ are two read-only transactions that create a loop in the DSG because one of them decides to read from a Pre-commit version of an object, therefore serializing itself after some update transactions. We prove that SSS cannot produce this scenario by contradiction.
Let us assume that $T_4$ has an anti-dependency with $T_5$, therefore the edge connecting $T_4$ to $T_5$. At this point $T_5$ is snapshot-queued. Let us now assume that $T_3$ (or a chain of dependent update transactions) is an update transaction that accesses a Pre-commit version produced by $T_5$. $T_1$ is a read-only transaction that starts after the internal commit of $T_3$ on some common node, and therefore can access some Pre-commit version written by $T_3$, and at the same time it has an anti-dependency with a version written by $T_2$ (or directly by $T_6$ due to a chain of update transactions accessing Pre-commit versions).
In order for $T_4$ to read from $T_6$, $T_4$ must have started after the internal commit of $T_6$. However, it is impossible for $T_4$ to have had at the same time an existing anti-dependency with $T_5$ and have started after the internal commit of $T_6$. In fact, if it would have happened, then there could not be the chain of conflicting transactions accessing a Pre-commit version of an object with a read-only transaction among them.
\end{comment}
\begin{figure*}[!htb]
\begin{minipage}{.64\textwidth}
\centering
\includegraphics[width=.9\textwidth]{legend.pdf}\\
\hspace{-10pt}
\subfigure[20\%]{
\includegraphics[height=72pt,keepaspectratio]{nonLocal20.pdf}
\label{fig:repl-thr-nolocal-a}
}\hspace{-10pt}
\subfigure[50\%]{
\includegraphics[height=72pt,keepaspectratio]{nonLocal50.pdf}
\label{fig:repl-thr-nolocal-b}
}\hspace{-10pt}
\subfigure[80\%]{
\includegraphics[height=72pt,keepaspectratio]{nonLocal80.pdf}
\label{fig:repl-thr-nolocal-c}
}
\vspace{-4pt}
\caption{Throughput varying \% of read-only transactions. Number of nodes in X-axes.}
\label{fig:repl-thr-nolocal}
\end{minipage}\hfill
\begin{minipage}{0.36\textwidth}
\centering
\subfigure[Maximum attainable throughput. Number of nodes in X-axis.]{
\includegraphics[height=70pt,keepaspectratio]{max-throughput.pdf}
\label{fig:max-thr}
}\hspace{2pt}
\subfigure[External Commit latency. Clients per node in X-axis.]{
\includegraphics[height=70pt,keepaspectratio]{sss-2pc-ext.pdf}
\label{fig:latency}
}
\vspace{-10pt}
\caption{Performance of SSS against 2PC-baseline using 5k objects and 50\% read-only transactions.}
\label{myass}
\end{minipage}
\end{figure*}
\begin{comment}
\begin{figure*}[t]
\centering
\includegraphics[width=.6\textwidth]{legend.pdf}\\
\subfigure[20\%]{
\includegraphics[width=.25\textwidth]{nonLocal20.pdf}
\label{fig:repl-thr-nolocal-a}
}\hspace{10pt}
\subfigure[50\%]{
\includegraphics[width=.25\textwidth]{nonLocal50.pdf}
\label{fig:repl-thr-nolocal-b}
}\hspace{10pt}
\subfigure[80\%]{
\includegraphics[width=.25\textwidth]{nonLocal80.pdf}
\label{fig:repl-thr-nolocal-c}
}
\vspace{-4pt}
\caption{Throughput of SSS, Walter, 2PC-baseline varying \% of read-only transactions. Number of nodes in X-axes.}
\label{fig:repl-thr-nolocal}
\end{figure*}
\end{comment}
\section{Evaluation} \label{sec:eval}
We implemented SSS in Java from the ground up and performed a comprehensive evaluation study. In the software architecture of SSS there is an optimized network component where multiple network queues, each for a different message type, are deployed. This way, we can assign priorities to different messages and avoid protocol slow down in some critical steps due to network congestion caused by lower priority messages (e.g., the \texttt{Remove} message has a very high priority because it enables external commits). Another important implementation aspect is related to snapshot-queues. Each snapshot-queue is divided into two: one for read-only transactions and one for update transactions. This way, when the percentage of read-only transactions is higher than update transactions, a read operation should traverse few entries in order to establish its visible-set.
We compare SSS against the following competitors: 2PC-baseline (shortly 2PC in the plots), ROCOCO~\cite{rococo}, and Walter~\cite{walter}. All these competitors offer transactional semantics over key-value APIs. With 2PC-baseline we mean the following implementation: all transactions execute as SSS's update transactions; read-only transactions validate their execution, therefore they can abort; and no multi-version data repository is deployed. As SSS, 2PC-baseline guarantees external consistency.
ROCOCO is an external consistent two-round protocol where transactions are divided into pieces and dependencies are collected to establish the execution order. ROCOCO classifies pieces of update transactions into immediate and deferrable. The latter are more efficient because they can be reordered. Read-only transactions can be aborted, and they are implemented by waiting for conflicting transactions to complete. Our benchmark is configured in a way all pieces are deferrable. ROCOCO uses preferred nodes to process transactions and consensus to implement replication. Such a scheme is different from SSS where multiple nodes are involved in the transaction commit process.
To address this discrepancy, in the experiments where we compare SSS and ROCOCO, we disable replication for a fair comparison.
The third competitor is Walter, which provides PSI a weaker isolation level than SSS. Walter has been included because it synchronizes nodes using vector clocks, as done by SSS.
All competitors have been re-implemented using the same software infrastructure of SSS because we want to provide all competitors with the same underlying code structure and optimization (e.g., optimized network). For fairness, we made sure that the performance obtained by our re-implementation of competitors matches the trends reported in~\cite{walter} and~\cite{rococo}, when similar configurations were used.
In our evaluation we use YCSB~\cite{DBLP:conf/cloud/CooperSTRS10} benchmark ported to key-value store. We configure the benchmark to explore multiple scenarios. We have two transaction profiles: update, where two keys are read and written, and read-only transactions, where two or more keys are accessed.
In all the experiments we co-locate application clients with processing nodes, therefore increasing the number of nodes in the system also increases the amount of issued requests. There are 10 application threads (i.e., clients) per node injecting transactions in the system in a closed-loop (i.e., a client issues a new request only when the previous one has returned).
All the showed results are the average of 5 trials.
We selected two configurations for the total number of shared keys: 5k and 10k. With the former, the observed average transaction abort rate is in the range of 6\% to 28\% moving from 5 nodes to 20 nodes when 20\% read-only transactions are deployed. In the latter, the abort rate was from 4\% to 14\%. Unless otherwise stated, transactions select accessed objects randomly with uniform distribution.
As test-bed, we used CloudLab~\cite{ricci2014introducing}, a cloud infrastructure available to researchers. We selected 20 nodes of type c6320 available in the Clemson cluster~\cite{clamson}. This type is a physical machine with 28 Intel Haswell CPU-cores and 256GB of RAM. Nodes are interconnected using 40Gb/s Infiniband HPC cards.
In such a cluster, a network message is delivered in around 20 microseconds (without network saturation), therefore we set timeout on lock acquisition to 1ms.
In Figure~\ref{fig:repl-thr-nolocal} we compare the throughput of SSS against 2PC-baseline and Walter in the case where each object is replicated in two nodes of the system. We also varied the percentage of read-only transactions in the range of 20\%, 50\%, and 80\%.
As expected, Walter is the leading competitor in all the scenarios because its consistency guarantee is much weaker than external consistency; however, the gap between SSS and Walter reduces from 2$\times$ to 1.1$\times$ when read-only transactions become predominant (moving from Figure~\ref{fig:repl-thr-nolocal-a} to~\ref{fig:repl-thr-nolocal-c}). This is reasonable because in Walter, update transactions do not have the same impact in read-only transactions' performance as in SSS due to the presence of the snapshot-queues. Therefore, when the percentage of update transactions reduces, SSS reduces the gap. Considering the significant correctness level between PSI (in Walter) and external consistency, we consider the results of the comparison between SSS and Walter remarkable.
Performance of 2PC-baseline is competitive when compared with SSS only at the case of 20\% read-only. In the other cases, although SSS requires a more complex logic to execute its read operations, the capability of being abort-free allows SSS to outperform 2PC-baseline by as much as 7$\times$ with 50\% read-only and 20 nodes. 2PC-baseline's performance in both the tested contention levels become similar at the 80\% read-only case because, although lock-based, read-only transaction's validation will likely succeed since few update transactions execute in the system.
Figure~\ref{fig:repl-thr-nolocal} also shows the scalability of all competitors. 2PC-baseline suffers from higher abort rate than others, which hampers its scalability. This is because its read-only transactions are not abort-free. The scalability trend of SSS and Walter is similar, although Walter stops scaling at 15 nodes using 80\% of read-only transactions while SSS proceeds. This is mostly related with network congestion, which is reached by Walter earlier than SSS since Walter's transaction processing time is lower than SSS, thus messages are sent with a higher rate.
\begin{comment}
\begin{figure}[h]
\centering
\subfigure[Maximum attainable throughput. Number of nodes in X-axis.]{
\includegraphics[height=88pt,keepaspectratio]{max-throughput.pdf}
\label{fig:max-thr}
}\hspace{5pt}
\subfigure[External Commit latency. Clients per node in X-axis.]{
\includegraphics[width=.2\textwidth]{sss-2pc-ext.pdf}
\label{fig:latency}
}
\vspace{-4pt}
\caption{Performance of SSS against 2PC-baseline using 5k objects and 50\% read-only transactions.}
\label{myass}
\end{figure}
\end{comment}
In Figure~\ref{myass} we compare 2PC-baseline and SSS in terms of maximum attainable throughput and transaction latency. Figure~\ref{fig:max-thr} shows 2PC-baseline and SSS configured in a way they can reach their maximum throughput with 50\% read-only workload and 5k objects, meaning the number of clients per nodes differs per reported datapoint. Performance trends are similar to those in Figure~\ref{fig:repl-thr-nolocal-b}, but 2PC-baseline here is faster than before. This is related with the CPU utilization of the nodes' test-bed. In fact, 2PC-baseline requires less threads to execute, meaning it leaves more unused CPU-cores than SSS, and those CPU-cores can be leveraged to host more clients.
\begin{figure}[h]
\centering
\includegraphics[width=.2\textwidth]{sss-delay.pdf}
\caption{Breakdown of SSS transaction latency.}
\label{fig:breakdown}
\end{figure}
The second plot (Figure~\ref{fig:latency}) shows transaction latency from its begin to its external commit when 20 nodes, 50\% read-only transactions, and 5k objects are deployed.
In the experiments we varied the number of clients per node from 1 to 10. When the system is far from reaching saturation (i.e., from 1 to 5 clients), SSS's latency does not vary, and it is on average 2$\times$ lower than 2PC-baseline's latency. At 10 clients, SSS's latency is still lower than 2PC-baseline but by a lesser percentage. This confirms one of our claim about SSS capability of retaining high-throughput even when update transactions are held in snapshot-queues. In fact, Figure~\ref{fig:repl-thr-nolocal-b} shows the throughput measurement in the same configuration: SSS is almost 7$\times$ faster than 2PC-baseline.
\begin{comment}
\begin{wrapfigure}{l}{0.22\textwidth}
\vspace{-10pt}
\begin{center}
\includegraphics[width=.2\textwidth]{sss-delay.pdf}
\caption{Breakdown of SSS transaction latency.}
\label{fig:breakdown}
\end{center}
\vspace{-12pt}
\end{wrapfigure}
\end{comment}
Figure~\ref{fig:breakdown} shows the relation between the internal commit latency and the external commit latency of SSS update transactions. The configuration is the one in Figure~\ref{fig:latency}. Each bar represents the latency between a transaction begin and its external commit. The internal red bar shows the time interval between the transaction's insertion in a snapshot-queue and its removal (i.e., from internal to external commit). This latter time is on average 30\% of the total transaction latency.
In Figure~\ref{yourass} we compare SSS against ROCOCO and 2PC-baseline. To be compliant with ROCOCO, we disable replication for all competitors and we select 5k as total number of shared keys because ROCOCO finds its sweet spot in the presence of contention. Accesses are not local.
\begin{figure}[h]
\centering
\subfigure[20\%.]{
\includegraphics[width=.2\textwidth]{rep120.pdf}
\label{fig:rococo-20}
\subfigure[80\%.]{
\includegraphics[width=.2\textwidth]{rep180.pdf}
\label{fig:rococo-80}
}
\vspace{-5pt}
\caption{SSS, 2PC-baseline, ROCOCO varying \% of read-only transactions. Legend in (a) applies to (b).}
\label{yourass}
\end{figure}
Figures~\ref{fig:rococo-20} and~\ref{fig:rococo-80} show the results with 20\% and 80\% read-only transactions respectively. In write intensive workload, ROCOCO slightly outperforms SSS due to its lock-free executions and its capability of re-ordering deferrable transaction pieces. However, even in this configuration, which matches a favorable scenario for ROCOCO, SSS is only 13\% slower than ROCOCO and 70\% faster than 2PC-baseline.
In read-intensive workload, SSS outperforms ROCOCO by 40\% and by almost 3$\times$ 2PC-baseline at 20 nodes. This gain is because ROCOCO is not optimized for read-only transactions; in fact, its read-only are not abort-free and they need to wait for all conflicting update transactions in order to execute.
\begin{comment}
\begin{figure}[h]
\centering
\includegraphics[width=.25\textwidth]{theBestPlot.pdf}
\caption{Throughput 80\% read-only and 50\% locality.}
\label{local-stuff}
\end{figure}
\end{comment}
We also configured the benchmark to produce 50\% of keys access locality,
meaning the probability that a key is stored by the node where the transaction is executing (local node), and 50\% of uniform access.
Increasing local accesses has a direct impact on the application contention level. In fact, since each key is replicated on two nodes, remote communication is still needed by update transactions, while the number of objects accessible by a client reduces when the number of nodes increases (e.g., with 20 nodes and 5k keys, a client on a node can select its accessed keys among 250 keys rather than 5k). Read-only transactions are the ones that benefit the most from local accesses because they can leverage the local copy of each accessed key.
\begin{figure}[!htb]
\begin{minipage}{0.24\textwidth}
\centering
\includegraphics[width=.92\textwidth]{theBestPlot.pdf}
\caption{Throughput 80\% read-only and 50\% locality.}
\label{local-stuff}
\end{minipage}\hfill
\begin{minipage}{0.24\textwidth}
\centering
\includegraphics[width=1\textwidth]{Picture1.pdf}
\caption{Speedup of SSS over ROCOCO and 2PC-baseline increasing the size of read-only transactions.}
\label{bestplot}
\end{minipage}
\end{figure}
We report the results (in Figure~\ref{local-stuff}) using the same configuration in Figure~\ref{fig:repl-thr-nolocal-c} because that is the most relevant to SSS and Walter.
Results confirm similar trend.
SSS is more than 3.5$\times$ faster than 2PC-baseline but, as opposed to the non-local case, here it cannot close the gap with Walter due to the high contention
around snapshot-queues.
\begin{comment}
\vspace{-3pt}
\begin{figure}[h]
\centering
\includegraphics[width=.25\textwidth]{Picture1.pdf}
\caption{Speedup of SSS over ROCOCO and 2PC-baseline increasing the size of read-only transactions.}
\label{bestplot}
\end{figure}
\end{comment}
In Figure~\ref{bestplot} we show the impact of increasing the number of read operations inside read-only transactions from 2 to 16. For this experiment we used 15 nodes and 80\% of read-only workload. Results report the ratio between the throughput of SSS and both ROCOCO and 2PC-baseline. When compared to ROCOCO, SSS shows a growing speedup, moving from 1.2$\times$ with 2 read operations to 2.2$\times$ with 16 read operations. This is because, as stated previously, ROCOCO encounters a growing number of aborts for read-only transactions while increasing accessed objects.
2PC-baseline degrades less than ROCOCO when operations increases because it needs less network communications for read-only transactions.
\section{Related Work}
Many distributed transactional repositories have been proposed in literature, examples include~\cite{granola,hstore,pnuts,dynamo,spanner,cure, gentlerain,rethinking,Cockroach}.
Among them, Spanner~\cite{spanner}, Scatter~\cite{scatter}, and ROCOCO~\cite{rococo} guarantee the same level of consistency as SSS.
Google Spanner~\cite{spanner} is a high performance solution that leverages a global source of synchronization to timestamp transactions so that a total order among them can always be determined, including when nodes are in different geographic locations. This form of synchronization is materialized by the \textit{TrueTime} API. This API uses a combination of a very fast dedicated network, GPS, and atomic clocks to provide accuracy of the assigned timestamps.
Although outstanding, Spanner's architecture needs special-purpose hardware and therefore it cannot be easily adopted and extended.
Scatter provides external consistency on top of a Paxos-replicated log. The major difference with SSS is that Scatter only supports single key transactions while SSS provides a more general semantics.
ROCOCO uses a two-round protocol to establish an external schedule in the system, but it does not support abort-free read-only transactions.
Replicated Commit~\cite{rp} provides serializability by replicating the commit operation using 2PC in every data center and Paxos to establish consensus among data centers. As opposed to SSS, in Replicated Commit read operations require contacting all data centers and collect replies from a majority of them in order to proceed. SSS's read operations are handled by the fastest replying server.
Granola~\cite{granola} ensures serializability using a timestamp-based approach with a loosely synchronized clock per node. Granola provides its best performance when transactions can be defined as independent, meaning they can entirely execute on a single server.
SSS has no restriction on transaction accesses.
CockroachDB~\cite{Cockroach} uses a serializable optimistic concurrency control, which processes transactions by relying on multi-versioning and timestamp-ordering. The main difference with SSS is the way consistent reads are implemented. CockroachDB relies on consensus while SSS needs only to contact the fastest replica of an object.
Calvin~\cite{calvin}
uses a deterministic locking protocol supported by a sequencer layer that orders transactions. In order to do that, Calvin requires a priori knowledge on accessed read and written objects. Although the sequencer can potentially be able to assign transaction timestamp to meet external consistency requirements, SSS does that without assuming knowledge of read-set and write-set prior transaction execution and without the need of such a global source of synchronization.
SCORe~\cite{score}, guarantees similar properties as SSS, but it fails to ensure external consistency since it relies on a single non-synchronized scalar timestamp per node to order transactions, and therefore its abort-free read-only transactions might be forced to read old version of shared objects.
Other protocols, such as GMU~\cite{gmu12}, Walter~\cite{walter}, Clock-SI~\cite{clocksi} and Dynamo~\cite{dynamo},
provide scalability by supporting weaker levels of consistency.
GMU~\cite{gmu12} provides transactions with the possibility to read the latest version of an object by using vector clocks; however it cannot guarantee serializable transactions. Walter use a non-monotonic version of Snapshot Isolation (SI) that allows long state fork.
Clock-SI provides SI using a loosely synchronized clock scheme.
\section{Conclusions}
In this paper we presented SSS, a transactional repository that implements a novel distributed concurrency control providing external consistency without a global synchronization service. SSS is unique because it preserves the above properties while guaranteeing abort-free read-only transactions. The combination of snapshot-queuing and vector clock is the key technique that makes SSS possible. Results confirmed significant speedup over state-of-the-art competitors in read-dominated workloads.
\newpage
\bibliographystyle{abbrv}
\section{Introduction}
A distributed transactional system that ensures a strong level of consistency greatly simplifies programmer responsibility while developing applications.
A strong level of consistency that clients interacting with a transactional system often desire is referred to \textit{external consistency}~\cite{spanner,strict,exconsistency}.
Roughly, under external consistency a distributed system behaves as if all transactions were executed sequentially, all clients observed the same unique order of transactions completion (also named \textit{external schedule} in~\cite{exconsistency}), in which every read operation returns the value written by the previous write operation.
By relying on the definition of external consistency, a transaction
terminates when its execution is returned to its client;
therefore the order defined by transaction client returns matches the transaction serialization order.
The latter property carries one great advantage:
if clients communicate with each other outside the system, they cannot be confused about the possible mismatch between transaction order they observe and the transaction serialization order provided by the concurrency control inside the system.
Simply, if a transaction is returned to its client, the serialization order of that transaction will be after any other transaction returned earlier, and before any transaction that will return subsequently. Importantly, this property holds regardless of when transactions start their execution.
To picture the value of external consistency,
consider an online document sharing service and two clients, $C_1$ connected to server $N_1$ and $C_2$ connected to another server $N_2$, whose goal is to synchronize the same document $D$. $C_1$ modifies $D$ and starts its synchronization concurrently with $C_2$. Because the underlying distributed system that implements the service is asynchronous, it is plausible for $C_1$ to observe the completion of the synchronization before $C_2$ (e.g., $C_1$ and $C_2$ are handled by two different nodes with different speed). As soon as $C_1$ received the notification, it informs $C_2$ that its modifications are permanent. At this point $C_2$ observes the completion of its synchronization operation and its expectation is to observe $C_1$'s modification on $D$ since $C_1$ completed before $C_2$.
Only if the service is external consistent, then the expectation is met (i.e., $C_2$ observes the modification of $C_1$); otherwise the possible outcomes include the case where $C_2$ does not observe $C_1$, which might confuse $C_2$. Note that if the service provides Serializable~\cite{serializability} operations, $C_2$ will not be guaranteed to observe the outcome of $C_1$.
In this paper we present \textit{SSS}, a key-value store that implements a novel distributed concurrency control providing external consistency and assuming off-the-shelf hardware.
Two features enable high performance and scalability in SSS, especially in read-dominated workloads:
\begin{itemize}
\item SSS supports read-only transactions that never abort due to concurrency, therefore the return value of all their read operations should be consistent at the time the operation is issued.
We name them as \textit{abort-free} hereafter.
This property is very appealing because many real-world applications produce significant read-only workload~\cite{DBLP:conf/sigmetrics/AtikogluXFJP12}.
\item SSS is designed to support a general (partial) replication scheme where keys are allowed to be maintained by any node of the system without predefined partitioning schemes (e.g., sharding~\cite{tapir,scatter}). To favor scalability, SSS does not rely on ordering communication primitives, such as Total Order Broadcast or Multicast~\cite{DBLP:journals/csur/DefagoSU04}.
\end{itemize}
The core components that make the above properties possible in SSS are the following:
\begin{compactitem}
\item SSS uses a vector clock-based technique to track dependent events originated on different nodes. This technique is similar to the one used by existing distributed transactional systems, such as Walter~\cite{walter} and GMU~\cite{gmu12}, and allows SSS to track events without a global source of synchronization.
\item SSS uses a new technique, which we name \textit{snapshot-queuing}, that works as follows. Each key is associated with a \textit{snapshot-queue}.
Only transaction that will surely commit
are inserted into the snapshot-queues of the their accessed keys in order to leave a trace of their existence to other concurrent transactions. Read-only transactions are inserted into their read keys' snapshot-queues at read time, while update transactions into their modified keys' snapshot-queues after the commit decision is reached.
A transaction in a snapshot-queue is inserted along with a scalar value, called \textit{insertion-snapshot}.
This value represents the latest snapshot visible by the transaction on the node storing the accessed key,
at the time the transaction is added to the snapshot queue. SSS concurrency control orders transactions with lesser insertion-snapshot before conflicting transactions with higher insertion-snapshot in the external schedule.
\end{compactitem}
SSS uses snapshot-queues to propagate established serialization orders among concurrent transactions as follows.
If a read-only transaction $T_R$ reads a key $x$ subsequently modified by a concurrent committed transaction $T_W$, $x$'s snapshot-queue is the medium to record the existence of an established serialization order between $T_R$ and $T_W$. With that, any other concurrent transaction accessing $x$ can see this established order and define its serialization accordingly.
In addition, $T_W$'s client response is delayed until $T_R$ completes its execution. This delay is needed so that update transactions can be serialized along with read-only transactions in a unique order where reads always return values written by the last update transaction returned to its client.
Failing in delaying $T_W$'s response would result in a discrepancy between the external order and the transaction serialization order. In fact, the external order would show $T_W$ returning earlier than $T_R$ but $T_R$ is serialized before $T_W$.
For non-conflicting update transactions that have dependencies with concurrent read-only transactions accessing common keys, since these transactions are aware of each other through the snapshot-queues of accessed keys, SSS prevents read-only transactions to observe those update transactions in different orders.
On the flip side, delaying update transactions might have a domino effect on limiting the level of concurrency in the system, which might lead to poor performance. The snapshot-queue technique prevents that: it permits a transaction that is in a snapshot-queue
to expose its written keys to other transactions while it is waiting for the completion of the concurrent read-only transaction(s) holding it. This feature enables progress of subsequent conflicting transactions, hence retaining the high throughput of the system.
Update transactions in SSS are serialized along with read-only transactions.
They always read the latest version of a key and buffer write operations. Validation is performed at commit time to abort if some read key has been overwritten meanwhile. The Two-Phase Commit protocol (2PC)~\cite{strict,gmu12, walter, Cockroach, carousel} is used to atomically lock and install written keys. These keys are externally visible when no concurrent read-only transactions caused the update transaction to wait due to snapshot-queuing, if any.
We implement SSS in Java and compared against two recent key-value stores, Walter~\cite{walter} and ROCOCO~\cite{rococo}, and one baseline where all transactions, including read-only, validate read keys and use 2PC to commit~\cite{serializability}. We name this competitor 2PC-baseline.
Overall, SSS is up to 7$\times$ faster than 2PC-baseline and up to 2.2$\times$ faster than ROCOCO under read-dominated workloads and long (i.e., 16 read keys) read-only transactions.
Also, when the percentage of read-only transactions is dominant and the node count is high, SSS is only 18\% slower than Walter, which provides a weaker isolation level than external consistency and even serializability.
When compared to the overall update transaction latency, in our experiments we assessed in less than 28\% the average waiting time introduced by SSS due to the snapshot-queuing.
\begin{comment}
\section{Background}
\subsection{The Relevance of the External Order}
Serializability~\cite{serializability} is the gold standard to guarantee strong correctness, but it allows for a simple execution pattern that is not acceptable for applications requiring access to the latest written values.
Suppose a new value is written to object $x$ by a committed transaction $T_{w}$, and the output of $T_{w}$ has been already returned to its client.
After that, another client issues a query (or read-only transaction) to the system, named $T_{ro}$.
By adopting a serializable concurrency control, a read operation of $T_{ro}$ might decide not to return the written value by $T_{w}$, but a previous value.
This option is not allowed under external consistency, therefore in the case obsolete values are returned, $T_{ro}$ might need to abort and restart in order to access the latest values. However, this approach does not fit our assumptions, where read-only transactions do not need to undergo multiple trials. Because of this, the return value of every read operation of a read-only transaction should be in accordance with the external schedule at the first trial.
Observing the expected value of $x$ would be easy if a synchronized clock was available in the system. In fact, $T_{ro}$, which starts after $T_{w}$, can select the latest correct value written by $T_{w}$ by just looking at the time $x$ is written. In the absence of a synchronized clock, $T_{ro}$ must track relations with concurrent transactions to make sure it returns the latest value that does not produce a non-serializable execution.
\end{comment}
\begin{comment}
\section{Background: G-Read}
\label{sec:ext-cons}
As firstly observed by Adya in~\cite{adya}, in a distributed system where nodes do not have access to a single point of synchronization (or an ordering component), concurrent non-conflicting transactions executing on different nodes cannot be aware of each other's execution. Because of that, different read-only transactions might order these non-conflicting transactions in a different way, therefore breaking the client's perceived order. For convenience, we name this anomaly as \textit{G-read}. Figure~\ref{pl3u} depicts this scenario, described below through an example borrowed from~\cite{adya}.
\vspace{-5pt}
\begin{figure}[h]
\centering
\subfigure[G-ready Anomaly.]{
\includegraphics[height=90pt,keepaspectratio]{im3.pdf}
\label{pl3u}
}\hspace{-10pt}
\subfigure[Dependency graph.]{
\includegraphics[height=90pt,keepaspectratio]{pl3u-dsg.pdf}
\label{pl3u-g}
}
\vspace{-5pt}
\caption{
Example of G-Read anomaly. For a key $o$, $R(o==oi)$ indicates a read operation on $o$ that returns version $oi$. For $W(o,oi )$, $oi$ is the produced version.
Dashed arrows show write-after-read (rw) anti-dependency and solid arrows show read-after-write (wr) dependency.}
\end{figure}
Consider a stock reporting system. Suppose there are two companies whose stock prices $x$ and $y$ are the same and are set to 50. Suppose $x$ and $y$ are stored in nodes $N_{2}$ and $N_{3}$ respectively. Then transactions $T1$, $T2$, $T3$, $T4$ are originated on nodes $N_{1}$, $N_{2}$, $N_{3}$, $N_{4}$ and executed in the following way. Transactions $T2$ and $T3$ update the stock prices of $x$ and $y$ to be 70 and 75 respectively (they do not conflict with each other). $T1$ and $T4$ are read-only. Transaction $T1$ observes the update of $T3$ but misses the update of $T2$. Transaction $T4$ accesses the update of $T2$ but misses the effect of $T3$.
As a result, in $T1$'s client view, $T3$ happens before $T_{2}$; but from the $T4$'s client perspective, $T2$ happens before $T3$. If clients of $T_{1}$ and $T_{4}$ communicate with each other, they may be confused
about the relative order in which the stock prices went up since there is no unique external schedule observed by both clients.
The conflict graph of this example is shown in Figure~\ref{pl3u-g} and contains a cycle. Worth noting that this execution is not even serializable.
\end{comment}
\begin{comment}
Logical time is the classical alternative to synchronizing clocks.
We rule out solutions that use a scalar per node because they inherently cannot allow correct access to the latest version of an object in the presence of abort-free transactions~\cite{score}.
Vector clocks can track dependent events happening on distinct nodes~\cite{happened_before}. In a vector clock-based approach, every node maintains a vector clock (i.e., an array of integers) with the size equals to the number of nodes. The element in position $j$ of the vector clock of node $N_{i}$ shows the value of the local timestamp of node $N_{j}$ updated during the latest interaction between $N_{i}$ and $N_{j}$.
Vector clocks provide read operations with the capability of returning the latest version of an object~\cite{happened_before}, however they come with pitfalls (e.g., G-read) that need to be addressed in order to achieve serializability or external consistency.
In the rest of this section we present an example of why the G-read anomaly can happen in a system where vector clocks are used to synchronize nodes. Figure~\ref{pl3u} depicts the scenario. Here we do not consider replication for simplicity.
\end{comment}
\begin{comment}
\todo[inline]{Change example and do not use real-time order.}
Let us assume four transactions $T_{1}$, $T_{2}$, $T_{3}$ and $T_{4}$ originated on nodes $N_{1}$, $N_{2}$, $N_{3}$ and $N_{4}$, with $T_{1}$ and $T_{4}$ read-only.
Objects $x$ and $y$ are stored in nodes $N_{2}$ and $N_{3}$ respectively. $T_{2}$ and $T_{3}$ are non-concurrent, non-conflicting, and there is a real-time order between them. $T_{2}$ updates $x$ and $T_{3}$ updates $y$.
In this example, $T_{1}$ and $T_{4}$ both return the latest versions of $x$ and $y$ available at the time of the operation. This is because their vector clocks are not comparable (i.e., an order cannot be defined between them). However, this decision leads them to observe different serialization orders involving $T_{2}$ and $T_{3}$. Specifically, in $T_{1}$'s client view, $T_{3}$ happens before $T_{2}$; but from the $T_{4}$'s client perspective, $T_{2}$ happens before $T_{3}$. Hence there is no unique external schedule observed by both clients.
Note that, in addition to the above issue, $T_1$'s client observes a serialization order of $T_{2}$ and $T_{3}$ that contradicts their real-time order, which inherently violates external consistency.
\end{comment}
\section{System Model \& Assumptions}
SSS assumes a system as a set of nodes that do not share either memory or a global clock. Nodes communicate through message passing and reliable asynchronous channels, meaning messages are guaranteed to be eventually delivered unless a crash happens at the sender or receiver node. There is no assumption on the speed and on the level of synchrony among nodes.
We consider the classic crash-stop failure model: sites may fail by crashing, but do not behave maliciously. A site that never crashes is correct; otherwise it is faulty.
Clients are assumed to be colocated with nodes in the system; this way a client is immediately notified of a transaction's commit or abort outcome, without additional delay.
Clients are allowed to interact with each other through channels that are not provided by the system's APIs.
\underline{Data Organization}.
Every node $N_{i}$ maintains shared objects (or keys) adhering to the key-value model~\cite{gmu12}. Multiple versions are kept for each key. Each version
stores the value and the commit vector clock of the transaction that produced the version.
SSS does not make any assumption on the data clustering policy; simply every shared key can be stored in one or more nodes, depending upon the chosen replication degree. For object reachability, we assume the existence of a local look-up function that matches keys with nodes.
\underline{Transaction execution}.
We model transactions as a sequence of read and write operations on shared keys, preceded by a begin, and followed by a commit or abort operation. A client begins a transaction on the colocated node and the transactions can read/write data belonging to any node; no a-priori knowledge on the accessed keys is assumed.
SSS's concurrency control ensures the ACID properties and targets applications with a degree of data replication.
Every transaction starts with a client submitting it to the system,
and finishes its execution informing the client about its final outcome: \textit{commit} or \textit{abort}.
Transactions that do not execute any write operation are called read-only, otherwise they are update transactions.
SSS requires programmer to identify whether a transaction is update or read-only.
\section{SSS Concurrency Control}
\label{sec:over}
In this section we describe the SSS concurrency control, followed by two execution examples.
\subsection{Metadata}
\underline{\textit{Transaction vector clocks}}. In SSS a transaction $T$ holds two vector clocks, whose size is equal to the number of nodes in the system. One represents its actual dependencies with transactions on other nodes, called \texttt{T.VC}; the other records the nodes where the transaction read from, called \texttt{T.hasRead}.
\texttt{T.VC} represents a version visibility bound for $T$.
Once a transaction begins in node $N_{i}$, it assigns the vector clock of the latest committed transaction in $N_{i}$
to its own \texttt{T.VC}.
Every time $T$ reads from a node $N_{j}$ for the first time during its execution, \texttt{T.VC} is modified based on the latest committed vector clock visible by $T$ on $N_{j}$.
After that, \texttt{T.hasRead[j]} is set to true ($\top$).
\underline{\textit{Transaction read-set and write-set}}. Every transaction holds two private buffers. One is $rs$ (or \textit{read-set}), which stores the keys read by the transaction during its execution, along with their value.
The other buffer is $ws$ (or \textit{write-set}), which contains the keys the transaction wrote, along with their value.
\underline{\textit{Snapshot-queue}}. A fundamental component allowing SSS to establish a unique external schedule is the snapshot-queuing technique. With that, each key is associated with an ordered queue (\texttt{SQueue}) containing: read-only transactions that
read that key; and update transactions that wrote that key while a read-only transaction was reading it.
Entries in a snapshot-queue (\texttt{SQueue}) are in the form of tuples.
Each tuple contains: transaction identifier $T.id$, the \textit{insertion-snapshot}, and transaction type (read-only or update). The \textit{insertion-snapshot} for a transaction $T$ enqueued on some node $N_i$'s snapshot-queue is the value of $T$'s vector clock in position $i^{th}$ at the time $T$ is inserted in the snapshot-queue.
Transactions in a snapshot-queue are ordered according to their insertion-snapshot.
A snapshot-queue contains only transactions that will commit; in fact, besides read-only transactions that are abort-free, update transactions are inserted in the snapshot-queue only after their commit decision has been reached.
\underline{\textit{Transaction transitive anti-dependencies set}}. An update transaction maintains a list of snapshot-queue entries, named \texttt{T.PropagatedSet}, which is populated during the transaction's read operations. This set serves the purpose of propagating anti-dependencies previously observed by conflicting update transactions.
\underline{\textit{Node's vector clock}}. Each node $N_{i}$ is associated with a vector clock, called \texttt{NodeVC}.
The $i^{th}$ entry of \texttt{NodeVC} is incremented when $N_{i}$ is involved in the commit phase of a transaction that writes some key replicated by $N_i$.
The value of $j^{th}$ entry of \texttt{NodeVC} in $N_{i}$ is the value of the $j^{th}$ entry of \texttt{NodeVC} in $N_{j}$
at the latest time $N_{i}$ and $N_{j}$ cooperated in the commit phase of a transaction.
\underline{\textit{Commit repositories}}. \texttt{CommitQ} is an ordered queue, one per node, which is used by SSS to ensure that non-conflicting transactions are ordered in the same way on the nodes where they commit.
\texttt{CommitQ} stores tuples $<$$T$, $vc$, $s$$>$ with the following semantics.
When an update transaction $T$, with commit vector clock $vc$, enters its commit phase, it is firstly added to the \texttt{CommitQ} of the nodes participating in its commit phase with its status $s$ set as \textit{pending}.
When the outcome of the transaction commit phase is decided, the status of the transaction is changed to \textit{ready}. A ready transaction inside the \texttt{CommitQ} is assigned with a final vector clock produced during the commit phase. In each node $N_{i}$, transactions are ordered in the \texttt{CommitQ} according to the $i^{th}$ entry of the vector clock ($VC[i]$). This allows them to be committed in $N_{i}$ with the order given by $VC[i]$.
When $T$ commits, it is deleted from \texttt{CommitQ} and its $vc$ is added to a per node repository, named \texttt{NLog}. We identify the most recent $vc$ in the \texttt{NLog} as \texttt{NLog.mostRecentVC}.
Overall, the presence of additional metadata to be transferred over the network might appear as a barrier to achieve high performance. To alleviate these costs we adopt metadata compression. In addition, while acknowledging that the size of vector clocks grows linearly with the system size, there are existing orthogonal solutions to increase the granularity of such a synchronization to retain efficiency~\cite{VCOptimized,VCOptimized1}
\subsection{Execution of Update transactions}
\label{update-tx}
Update transactions in SSS implements lazy update~\cite{DBLP:conf/sosp/TuZKLM13}, meaning their written keys are not immediately visible and accessible at the time of the write operation, but they are logged into the transactions write-set and become visible only at commit time. In addition, transactions record the information associated with each read key into their read-set.
Read operations of update transactions in SSS simply return the most recent version of their requested keys
(Lines~\ref{vis24}-\ref{vis26} of Algorithm~\ref{visibility}). At commit time, validation is used to verify that all the read versions have not been overwritten.
An update transaction that completes all its operations and commits cannot inform its client if it observes anti-dependency with one or more read-only transactions. In order to capture this waiting stage, we introduce the following phases to finalize an update transaction (Figure~\ref{fig1} pictures them in a running example).
\underline{\textit{Internal Commit}}.
When an update transaction successfully completes its commit phase, we say that it commits internally. In this stage, the keys written by the transactions are visible to other transactions, but its client has not been informed yet about the transaction completion. Algorithms~\ref{internal1} and~\ref{internal2} show the steps taken by SSS to commit a transaction internally.
SSS relies on the Two-Phase Commit protocol (2PC) to internally commit update transactions.
The node that carries the execution of a transaction $T$, known as its coordinator, initiates 2PC issuing the prepare phase, in which it contacts all nodes storing keys in the read-set and write-set. When a participant node $N_{i}$ receives a prepare message for $T$, all keys read/written by $T$ and stored by $N_{i}$ are locked. If the locking acquisition succeeds, all keys read by $T$ and stored by $N_{i}$ are validated by checking if the latest version of a key matches the read one (Lines~\ref{l26}-\ref{l32} Algorithm~\ref{internal1}). If successful, $N_{i}$ replies to $T$'s coordinator with a \texttt{Vote} message, along with a proposed commit vector clock. This vector clock is equal to $N_{i}$'s $NodeVC$ where $NodeVC[i]$ has been incremented. Finally, $T$ is inserted into $N_{i}$'s \texttt{CommitQ} with its $T.VC$.
\begin{algorithm}[h]
\caption{Internal Commit by Transaction T in node $N_{i}$}
\label{internal1}
\begin{algorithmic}[1]
\scriptsize
\Event {boolean Commit(Transaction T)}
\If{(T.ws=$\phi $)}
\For{($k \in T.rs$)}
\State \textbf{Send} \textit{Remove}$[T]$ \textbf{to all} replicas(k)
\EndFor
\State $T.outcome \leftarrow true$
\State \Return {$T.outcome$}
\EndIf
\State $commitVC \leftarrow T.VC$
\State $T.outcome \leftarrow true$
\State \textbf{send} \textit{Prepare}$[T]$ \textbf{to all} ${N_j} \in replicas(T.rs\cup T.ws)\cup {N_i}$
\ForAll {(${N_j}\in replicas(T.rs \cup T.ws) \cup {N_i}$)} \label{int1-11}
\State \textbf{wait receive} \textit{Vote}$[T.id, VC_{j}, res]$ from ${N_j}$ \textbf{or timeout}
\If{($res = false \vee timeout$)}
\State $T.outcome \leftarrow false $
\State break;
\Else
\State $commitVC \leftarrow \max (commitVC,V{C_j})$ \label{l17}
\EndIf
\EndFor
\State $xactVN \leftarrow \max \{ commitVC[w]:{N_w} \in replicas(T.ws) \} $
\ForAll{(${N_j} \in replicas(T.ws)$)}
\State $commitVC[j] \leftarrow xactVN$
\EndFor \label{int1_23}
\State \textbf{send} \textit{Decide}$[T,commitVC,outcome]$ to \textbf{all} ${N_j} \in replicas($
\Statex \hspace{0.4cm} $T.rs \cup T.ws) \cup {N_i}$
\EndEvent
\Statex
\State boolean validate(Set rs, VC T.VC) \label{l26}
\ForAll {($k \in rs$)}
\If {($k.last.vid[i] > T.VC[i]$)}
\State \Return{$ false $}
\EndIf
\EndFor
\State \Return{$true$} \label{l32}
\end{algorithmic}
\end{algorithm}
After receiving each successful \texttt{Vote}, $T$'s coordinator updates $T.VC$ by computing the maximum per entry (Line~\ref{l17} of Algorithm~\ref{internal1}).
This update makes $T$ able to include the causal dependencies of the latest committed transactions in all 2PC participants.
After receiving all \texttt{Vote} messages, the coordinator determines the final commit vector clock for $T$ as in (Lines~\ref{l17}-\ref{int1_23} of Algorithm~\ref{internal1}), and sends it along with the 2PC \texttt{Decide} message.
Lines~\ref{l16}-\ref{l29} of Algorithm~\ref{internal2} shows how 2PC participants handle the \texttt{Decide} message. When $N_i$ receives \texttt{Decide} for transaction $T$,
$N_i$'s $NodeVC$ is updated by computing the maximum with $T.VC$.
Importantly, at this stage the order of $T$ in the $CommitQ$ of $N_{i}$ might change because the final commit vector clock of $T$ has been just defined, and it might be different from the one used during the 2PC prepare phase when $T$ has been added to $CommitQ$.
In Algorithm~\ref{internal2} Lines~\ref{l229}-\ref{l236}, when transaction $T$ becomes the top standing of $N_i$'s $CommitQ$, the internal commit of $T$ is completed by inserting its commit vector clock into the $NLog$ and removing $T$ from $CommitQ$. When transaction's vector clock is inserted into the node's \texttt{NLog}, its written keys become accessible by other transactions.
At this stage, $T$'s client has not been informed yet about $T$'s internal commit.
\underline{\textit{Pre-Commit.}}
An internally committed transaction spontaneously enters the Pre-Commit phase after that. Algorithm~\ref{finalize} shows detail of Pre-commit phase. At this stage, $T$ evaluates if it should hold the reply to its client
depending upon the content of the snapshot-queues of its written keys. If so, $T$ will be inserted into the snapshot-queue of its written keys in $N_i$ with $T.VC[i]$ as \textit{insertion-snapshot}.
If at least one read-only transaction ($T_{ro}$) with a lesser \textit{insertion-snapshot} is found in any snapshot-queue $SQueue$ of $T$'s written keys, it means that $T_{ro}$ read that key before $T_{w}$ internally committed, therefore a write-after-read dependency between $T_{ro}$ and $T_{w}$ is established. In this case, $T$ is inserted into $SQueue$ until $T_{ro}$ returns to its client. With the anti-dependency, the transaction serialization order has been established with $T_{ro}$ preceding $T_{w}$, therefore informing immediately $T_{w}$'s client about $T_{w}$'s completion would expose an external order where $T_{w}$ is before $T_{ro}$, which violates external consistency (and therefore clients expectations).
\begin{algorithm}[h]
\caption{Internal Commit by Transaction T in node $N_{i}$}
\label{internal2}
\begin{algorithmic}[1]
\scriptsize
\Event{\textbf{receive} \textit{Prepare}$[TransactionT]$ from $N_{j}$}
\State boolean $outcome \leftarrow$ \label{lc}
$getExclusiveLocks(T.id, T.ws)$
\NoNumber {$\wedge getSharedLocks(T.id, T.rs)$}
$\wedge validate(T.rs, T.VC)$
\If {($\neg outcome$)}
\State $releaseLocks(T.id, T.rs, T,ws)$
\State \textbf{send} \textit{Vote}$[T.id, T.VC, outcome]$ to $N_{j}$
\Else
\State $prepVC \leftarrow NLog.mostRecentVC$
\If {(${N_i} \in replicas(T.ws)$)}
\State $NodeVC[i] + + $ \label{l9-int3}
\State $prepVC \leftarrow NodeVC$ \label{l10-int3}
\State \hspace{-0.09cm}$CommitQ.put(<T,prepVC,pending>)$
\EndIf
\State \textbf{send} \textit{Vote}$[T.id, prepVC, outcome]$ to $N_{j}$
\EndIf
\EndEvent
\Event {\textbf{receive} \textit{Decide}$[T,commitVC,outcome]$ from $N_{j}$ \textbf{atomically}} \label{l16}
\If{($outcome$)}
\State \hspace{-0.09cm}$NodeVC \leftarrow \max(NodeVC,commitVC)$
\If {(${N_i} \in replicas(T.ws)$)}
\State \hspace{-0.1cm}$CommitQ.update(<T,commitVC,ready>)$
\Else
\State $releaseSharedLocks(T.id,T.rs)$
\EndIf
\Else
\State $CommitQ.remove(T)$
\State $releaseLocks(T.id,T.ws,T.rs)$
\EndIf
\EndEvent \label{l29}
\Event{$\exists <T,vc,s>:<T,vc,s> = commitQ.head \wedge s=ready$}\label{l229}
\ForAll {($k \in T.ws: {N_i} \in replicas(k)$)}
\State apply(k,val,vc)
\EndFor
\State $NLog.add( < T,vc,T.ws > )$
\State $CommitQ.remove(T)$
\State $releaseLocks(T.id,T.ws,T.rs)$
\EndEvent \label{l236}
\end{algorithmic}
\end{algorithm}
\begin{algorithm}[h]
\caption{Start Pre-commit by Transaction T in node $N_{i}$}
\label{finalize}
\begin{algorithmic}[1]
\scriptsize
\ForAll{($k \in T.ws$)} \label{ln7}
\If{(${N_i} \in replicas(k)$)}
\State $k.SQueue.insert( < T.id,vc[i],``W" > )$
\ForAll {($T^{'} \in T.PropagatedSet$)} \label{l4sp}
\State $k.SQueue.insert(<{T^{'}}.id,{T^{'}}.sid,``R">)$
\EndFor \label{l6sp}
\EndIf
\EndFor \label{ln11}
\end{algorithmic}
\end{algorithm}
Tracking only non-transitive anti-dependencies is not enough to preserve correctness. If $T$ reads the update done by $T_{w'}$ and $T_{w'}$ is still in its Pre-commit phase, then $T$ has a transitive anti-dependency with $T_{ro'}$ (i.e., $T_{ro'}\xrightarrow{\text{rw}}T_{w'}\xrightarrow{\text{wr}} T$).
SSS records the existence of transactions like $T_{ro'}$ during $T$'s execution by looking into the snapshot-queues of $T$'s read keys and logging them into a private buffer of $T$, called $T.PropagatedSet$. The propagation of anti-dependency happens during $T$'s Pre-commit phase by inserting transactions in $T.PropagatedSet$ into the snapshot-queues of all $T$'s written keys (Lines~\ref{l4sp}-\ref{l6sp} of Algorithm~\ref{finalize}).
\begin{algorithm}[h]
\caption{End Pre-commit of Transaction T in node $N_{i}$}
\label{precommit}
\begin{algorithmic}[1]
\scriptsize
\ForAll {($k \in T.ws$)} \label{le1}
\If{${N_i} \in replicas(k)$}
\State \textbf{wait until} ($\exists <{T^{'}}.id,{T^{'}}.sid,->:$
\NoNumber{$k.SQueue.contains(<{T^{'}}.id,{T^{'}}.sid, ->) \wedge$
\NoNumber{$ {T^{'}}.sid < T.commitVC[i]$})}
\State $k.SQueue.remove(<T.id,vc[i],``W">)$
\State \textbf{send} \textit{Ack} $[T,vc[i]]$
\textbf{to} $T.coordinator$
\EndIf
\EndFor \label{le7}
\end{algorithmic}
\end{algorithm}
\underline{\textit{External Commit}}.
Transaction $T$ remains in its Pre-commit phase until there is no read-only transaction with lesser insertion-snapshot in the snapshot-queues of $T$'s written keys. After that, $T$ is removed from these snapshot-queues and an \texttt{Ack} message to the transaction 2PC coordinator is sent (Lines~\ref{le1}-\ref{le7} of Algorithm~\ref{precommit}).
The coordinator can inform its client after receiving \texttt{Ack} from all 2PC participants.
At this stage, update transaction's external schedule is established, therefore we say that SSS commits the update transaction \textit{externally}.
\begin{comment}
\begin{algorithm}[h]
\caption{External Commit of Transaction T in $N_{i}$}
\label{remove}
\begin{algorithmic}[1]
\scriptsize
\Event {\textbf{receive} \textit{Ack} $[T, cid]$ from \textbf{all} ${N_j} \in replicas(T.ws)$ } \label{l8}
\State $T.ClientReply()$
\EndEvent \label{l10}
\end{algorithmic}
\end{algorithm}
\end{comment}
\subsection{Execution of Read-Only Transactions}
In its first read operation (Algorithm~\ref{read} Lines~\ref{firsta}-\ref{firstb}), a read-only transaction $T$ on $N_i$ assigns \texttt{NLog.mostRecentVC} to its vector clock ($T.VC$). This way, $T$ will be able to see the latest updated versions committed on $N_i$.
Read operations are implemented by contacting all nodes that replicate the requested key and waiting for the fastest to answer.
When a read request of $T$ returns from node $N_j$, $T$ sets $T.hasRead[j]$ to \texttt{true}. With that, we set the visibility upper bound for $T$ from $N_{j}$ (i.e., $T.VC[j]$). Hence, subsequent read operations by $T$ contacting a node $N_{k}$ should only consider versions with a vector clock $vc_{k}$ such that $vc_{k}[j]<T.VC[j]$.
After a read operation returns, the transaction vector clock is updated by applying an entry-wise maximum operation between the current $T.VC$ and the vector clock associated with the read version (i.e., $VC^{*}$) from $N_{j}$.
Finally, the read value is added to $T.rs$ and returned.
Algorithm~\ref{visibility} shows SSS rules to select the version to be returned upon a read operation that contacts node $N_i$.
The first time $N_{i}$ receives a read from $T$, this request should wait until the value of $N_i$'s \texttt{NLog.mostRecentVC[i]} is equal to $T.VC[i]$
(Line~\ref{line4} Algorithm~\ref{visibility}).
This means that all transactions that are already included in the current visibility bound of $T.VC[i]$ must perform their internal commit before $T$'s read request can be handled.
After that, a correct version of the requested key should be selected for reading. This process starts by identifying the set of versions that are within the visibility bound of $T$, called $VisibleSet$. This means that, given a version $v$ with commit vector clock $vc$, $v$ is visible by $T$ if, for each entry $k$ such that $T.hasRead[k]=true$, we have that $vc[k]\leq T.VC[k]$ (Algorithm~\ref{visibility} Line~\ref{vis-line5}).
\begin{algorithm}[h]
\scriptsize
\caption {Read Operation by Transaction T in node $N_{i}$}
\label{read}
\begin{algorithmic}[1]
\scriptsize
\Event {Value Read(Transaction T, Key k)}
\If{($\exists < k,val > \in T.ws$)}
\State \Return{val}
\EndIf
\If {(is first read of T)} \label{firsta}
\State $T.VC \leftarrow NLog.mostRecentVC$
\EndIf \label{firstb}
\State ${\rm{target}} \leftarrow {\rm{\{ replicas(k)}}\} $
\State\textbf{send} \textit{READREQUEST}$[k, T.VC,T.hasRead,T.isUpdate]$
\NoNumber {to \textbf{all} ${N_j} \in target$}
\State \textbf{wait Receive} \textit{READRETURN} $[val, VC^{*}, PropagatedSet]$
\Statex \hspace{0.4cm} from {${N_h} \in target$}
\State $T.hasRead[h] \leftarrow true$
\State $T.VC \leftarrow \max (T.VC,V{C^{*}})$ \label{l12-read}
\State $T.rs \leftarrow T.rs \cup \{ <k,val>\} $
\State $T.PropagatedSet \leftarrow T.PropagatedSet \cup PropagatedSet$
\State \Return {val}
\EndEvent
\end{algorithmic}
\end{algorithm}
\begin{algorithm}[h]
\caption{Version Selection Logic in node $N_{i}$}
\label{visibility}
\begin{algorithmic}[1]
\scriptsize
\Event{Receive \textit{READREQUEST}$[T, k, T.VC, hasRead, isUpdate]$ from $N_{j}$}
\State $PropagatedSet \leftarrow \phi$
\If {($\neg isUpdate$)}
\If {($\neg {\rm{hasRead[i]}}$)}
\State \textbf{wait until} \label{line4} ${\rm{NLog}}{\rm{.mostRecentVC[i]}} \ge$ ${\rm{T.VC[i]}}$
\State $VisibleSet \leftarrow \{ vc: vc \in {\rm{NLog}} \wedge$ \label{vis-line5}
\Statex \hspace{1.2cm} $\forall w({\rm{hasRead[w]= true}}$ $\Rightarrow {\rm{vc[w]}}$ $\le {\rm{T.VC[w]}})\} $
\State $ExcludedSet\leftarrow\{ T^{'}:<T^{'}.id,T^{'}.cid,``W"> \in$ \label{ver-l6}
\Statex \hspace{1.2cm}$ k.SQueue \Rightarrow vc[i] > T.VC[i]) \}$
\State $VisibleSet \leftarrow VisibleSet \backslash ExcludedSet$
\State$maxVC \leftarrow vc:\forall w,vc[w] = \max \{ v[w]:v$ $\in VisibleSet\} $
\State $k.SQueue.insert( <T.id,maxVC[i],``R"> )$
\State $ver \leftarrow k.last$
\While{$(\exists w:hasRead[w] = true \wedge ver.vc[w] >$
\Statex \indent \indent \indent $maxVC[w]\vee \exists vc \in ExcludedSet:ver.vc = vc $
\Statex \indent \indent \indent $\wedge vc[i] > maxVC[i])$}
\State $ver \leftarrow ver.prev$
\EndWhile
\Else \label{vis-line15}
\State $maxVC \leftarrow T.VC$
\State $k.SQueue.insert(< T.id,maxVC[i],``R">)$
\State $ver \leftarrow k.last$
\While{($\exists w:({\rm{hasRead[w] = }}true \wedge ver.vc{\rm{[w]}} > maxVC[w])$)}
\State $ver \leftarrow ver.prev$
\EndWhile
\EndIf \label{line20}
\Else
\State $maxVC \leftarrow NLog.mostRecentVC$ \label{vis24}
\State $PropagatedSet$=$\{T^{'}:<T^{'}.id,readSid,``R">\in k.SQueue\}$
\State $ver \leftarrow k.last$
\EndIf \label{vis26}
\State \textbf{Send} \textit{READRETURN}[ver.val, maxVC,PropagatedSet ] \textbf{to} $N_{j}$
\EndEvent
\end{algorithmic}
\end{algorithm}
It is possible that transactions associated with some of these vector clocks are still in their Pre-Commit phase, meaning they exist in the snapshot-queues of $T$'s requested key. If so, they should be excluded from $VisibleSet$ in case their insertion-snapshot is higher than $T.VC[i]$.
The last step is needed
to serialize read-only transactions with anti-dependency relations before conflicting update transactions.
This condition is particularly important to prevent a well-known anomaly, firstly observed by Adya in~\cite{adya}, in which read-only transactions executing on different nodes can observe two non-conflicting update transactions in different serialization order~\cite{gmu12}.
Consider a distributed system where nodes do not have access to a single point of synchronization (or an ordering component), concurrent non-conflicting transactions executing on different nodes cannot be aware of each other's execution. Because of that, different read-only transactions might order these non-conflicting transactions in a different way, therefore breaking the client's perceived order. SSS prevents that by serializing both these read-only transactions before those update transactions.
At this stage, if multiple versions are still included in $VisibleSet$, the version with the maximum $VC[i]$ should be selected to ensure external consistency.
Once the version to be returned is selected, $T$ is inserted in the snapshot-queue of the read key using
$maxVC[i]$ as insertion-snapshot (Line 16 of Algorithm~\ref{visibility}). Finally, when the read response is received, the maximum per entry between $maxVC$ (i.e., $VC^{*}$ in Algorithm~\ref{read}) and the $T.VC$ is computed along with the result of the read operation.
\begin{comment}
\begin{algorithm}[h]
\caption{Remove of read-only transaction T in node $N_{i}$}
\label{remove}
\begin{algorithmic}[1]
\scriptsize
\Event{{Receive \textit{Remove}} $[T]$ in $N_{i}$}
\For{$k \in T.rs$}
\If{(${N_i} \in replicas(k)$)}
\State $k.SQueue.remove( < T.id, readSid ,``R" > )$
\EndIf
\EndFor
\ForAll {(${k^{'}}: < T.id, readSid ,``R" >\in {k^{'}}.SQueue$)} \label{p7}
\State \textbf{send} \textit{Remove}$[T]$ {\textbf{to all} replicas(${k^{'}}$)}
\EndFor \label{p10}
\EndEvent
\end{algorithmic}
\end{algorithm}
\end{comment}
When a read-only transaction $T$ commits, it immediately replies to its client. After that, it sends a message to the nodes storing only the read keys in order to notify its completion. We name this message \texttt{Remove}.
Upon receiving \texttt{Remove}, the read-only transaction is deleted from all the snapshot-queues associated with the read keys.
Deleting a read-only transaction from a snapshot-queue enables conflicting update transactions to be externally committed and their responses to be released to their clients.
Because of transitive anti-dependency relations, a node might need to forward the \texttt{Remove} message to other nodes as follows. Let us assume $T$ has an anti-dependency with a transaction $T_w$, and another transaction $T_{w'}$ reads from $T_w$. Because anti-dependency relations are propagated along the chain of conflicting transactions, $T$ exists in the snapshot-queues of $T_{w'}$'s written keys. Therefore, upon \texttt{Remove} of $T$, the node executing $T_w$ is responsible to forward the \texttt{Remove} message to the node where $T_{w'}$ executes for updating the affected snapshot-queues.
When a read operation is handled by a node that already responded to a previous read operation from the same transaction,
the latest version according to $maxVC$
is returned,
and $T$ can be inserted into the snapshot-queue with its corresponding identifier and $maxVC[i]$ as insertion-snapshot.
\subsection{Examples} \label{example}
\textbf{External Consistency \& Anti-dependency}.
Figure~\ref{fig1} shows an example of how SSS serializes an update transaction $T_{1}$ in the presence of a concurrent read-only transaction $T_{2}$. Two nodes are deployed, $N_{1}$ and $N_{2}$, and no replication is used for simplicity. $T_{1}$ executes on $N_{1}$ and $T_{2}$ on $N_{2}$. Key $y$ is stored in $N_{2}$'s repository. The \texttt{NLog.mostRecentVC} for Node 1 is [5,4] and for Node 2 is [3,7].
\begin{comment}
\begin{figure}[h]
\includegraphics[width=.44\textwidth]{im1-ver2.pdf}
\centering
\caption{Example of SSS execution in the presence of an anti-dependency. Orange boxes show the content of the data repository. Gray boxes show transaction execution. Dashed line represents the waiting time for $T2$. The red crossed entries of Q(y) represent their elimination upon Remove.}
\label{fig1}
\end{figure}
\begin{figure}[h]
\includegraphics[width=.48\textwidth]{im6.pdf}
\centering
\caption{Handling read-only transactions along with non-conflicting update transactions. We omitted the snapshot-queue entries elimination upon receiving Remove to improve readability.}
\label{pl3u-fixed}
\end{figure}
\end{comment}
\begin{comment}
\begin{figure*}[!tbp]
\centering
\begin{minipage}[b]{0.45\textwidth}
\centering
\includegraphics[scale=0.3]{im1-ver2.pdf}
\caption{SSS execution in the presence of an anti-dependency. Orange boxes show the content of the data store. Gray boxes show transaction execution. Dashed line represents the waiting time for $T2$. The red crossed entries of Q(y) represent their elimination upon Remove.}
\label{fig1}
\end{minipage}
\hfill
\begin{minipage}[b]{0.45\textwidth}
\centering
\includegraphics[scale=0.25]{im6.pdf}
\caption{Handling read-only transactions along with non-conflicting update transactions. We omitted snapshot-queue entries elimination upon Remove to improve readability.}
\label{pl3u-fixed}
\end{minipage}
\end{figure*}
\end{comment}
$T_{1}$ performs a read operation on key $y$ by sending a remote read request to $N_{2}$. At this point, $T_{1}$ is inserted in the snapshot-queue of $y$ ($Q(y$)) with 7 as insertion-snapshot. This value is the second entry of $N_{2}$'s \texttt{NLog.mostRecentVC}.
Then the update transaction $T_{2}$ begins with vector clock [3,7], buffers its write on key $y$ in its write-set, and performs its internal commit by making the new version of $y$ available, and by inserting the produced commit vector clock (i.e., $T2.commitVC$=[3,8]) in $N_{2}$'s $NLog$. As a consequence of that, $NLog.mostRecentVC$
is equal to $T2.commitVC$.
Now $T_2$ is evaluated to decide whether it should be inserted into $Q(y)$. The insertion-snapshot of $T_2$ is equal to 8, which is higher than $T_{1}$'s insertion-snapshot in $Q(y)$. For this reason, $T_2$ is inserted in $Q(y)$ and its Pre-commit phase starts.
\begin{figure}[h]
\centering
\includegraphics[scale=0.3]{im1-ver2.pdf}
\caption{SSS execution in the presence of an anti-dependency. Orange boxes show the content of the data store. Gray boxes show transaction execution. Dashed line represents the waiting time for $T2$. The red crossed entries of Q(y) represent their elimination upon Remove.}
\label{fig1}
\end{figure}
At this stage, $T_{2}$ is still not externally visible. Hence $T_{2}$ remains in its Pre-Commit phase until $T_{1}$ is removed from $Q(y)$, which happens when $T_1$ commits and sends the \texttt{Remove} message to $N_2$. After that, $T_{2}$'s client is informed about $T_{2}$'s completion. Delaying the external commit of $T_{2}$ shows clients a sequence of transactions completion that matches their serialization order.
\textbf{External Consistency \& Non-conflicting transactions}.
Figure~\ref{pl3u-fixed} shows how SSS builds the external schedule in the presence of read-only transactions and non-conflicting update transactions.
There are four nodes, $N_1$, $N_2$, $N_3$, $N_4$, and four concurrent transactions, $T_1$, $T_2$, $T_3$, $T_4$, each executes on the respective node. By assumption, $T_2$ and $T_3$ are non-conflicting update transactions, while $T_1$ and $T_4$ are read-only.
\begin{figure}[h]
\centering
\includegraphics[scale=0.25]{im6.pdf}
\caption{Handling read-only transactions along with non-conflicting update transactions. We omitted snapshot-queue entries elimination upon Remove to improve readability.}
\label{pl3u-fixed}
\end{figure}
SSS ensures that $T_1$ and $T_4$ do not serialize $T_2$ and $T_3$ in different orders and they return to their clients in the same way they are serialized by relying on snapshot-queuing. $T_1$ is inserted into $Q(x)$ with insertion-snapshot equals to 7. Concurrently, $T_4$ is added to the snapshot-queue of $y$ with insertion-snapshot equals to 10.
The next read operation by $T_1$ on $y$ has two versions evaluated to be returned: $y0$ and $y1$. Although $y1$ is the most recent, since $T_4$ returned $y0$ previously (in fact $T_4$ is in $Q(y)$), $y1$ is excluded and $y0$ is returned. Similar arguments apply to $T_4$'s read operation on $x$.
The established external schedule serializes $T_1$ and $T_4$ before both $T_2$ and $T_3$.
\begin{comment}
\subsubsection{Avoiding Processing Stalls}
Figure~\ref{fig2} shows how SSS avoids that transactions in the snapshot-queues hamper the progress and correctness of other concurrent conflicting transactions. The following example covers the case where nodes interacted (through the commit of $T_2$) prior the start time of $T_3$, and $y$'s post-commit version is accessed.
\begin{figure}[h]
\includegraphics[width=.44\textwidth]{im2.pdf}
\centering
\caption{SSS's Pre-commit phase. The snapshot $d$ is related with $T_2$'s commit vector clock ($T_2$'s commits internally), and therefore is greater than $b$ and $c$.}
\label{fig2}
\end{figure}
In this example, $T_{1}$ reads the latest value of object $y$, its vector clock is modified, and $T_{1}$ is inserted into $Q(y)$. After that, $T_{2}$ executes entirely, commits involving also $N_3$, and enter its Pre-Commit phase, waiting for $T_{1}$'s removal from $Q(y)$. Now $T_{3}$ starts on $N_{3}$. According to its vector clock, obtained from $N_{3}$ at the beginning of its execution, it is able to observe the latest version of $y$ produced by $T_2$. This is possible because the second entry of $T_3$'s vector clock matches the second entry of $T_2$'s vector clock due to their previous interaction (i.e., the commit of $T_2$).
In this scenario, the clients of $T_2$ and $T_3$ will still observe a unique external schedule, which is where $T_2$ precedes $T_3$, even if $T_3$ might reply to its client sooner than $T_2$ if $T_3$ is read-only.
\end{comment}
\subsection{Additional Considerations of SSS}
\underline{\textit{Garbage Collection}}. A positive side effect of the \texttt{Remove} message is the implicit garbage collection of entries in the snapshot-queues. In fact, SSS removes any entry representing transactions waiting for a read-only transaction to finish upon receiving \texttt{Remove}, which cleans up the snapshot-queues.
\underline{\textit{Starvation}}. Another important aspect of SSS is the chance to slow down update transactions, possibly forever, due to an infinite chain of conflicting read-only transactions issued concurrently. We handle this corner case by applying admission control to read operations of read-only transactions in case they access a key written by a transaction that is in a snapshot-queue for a pre-determined time. In practice, if such a case happens, we apply an artificial delay to the read operation (exponential back-off) to give additional time to update transaction to be removed from the snapshot-queue. In the experiments we never experienced starvation scenarios, even with long read-only transactions.
\underline{\textit{Deadlock-Freedom}}. SSS uses timeout to prevent deadlock during the commit phase's lock acquisition. Also, the waiting condition applied to update transactions cannot generate deadlock. This is because read-only transactions never wait for each other, and there is no condition in the protocol where an update transaction blocks a read-only transaction. The only wait condition occurs when read-only transactions force update transactions to hold their client response due to snapshot-queuing. As a result, no circular dependency can be formed, thus SSS cannot encounter deadlock.
\underline{\textit{Fault-Tolerance}}. SSS deploys a protocol that tolerates failures in the system using replication. In the presented version of the SSS protocol, we did not include either logging of messages to recover update transactions' 2PC upon faults, or a consensus-based approach (e.g., Paxos-Commit~\cite{2pc}) to distribute and order 2PC messages. Solutions to make 2PC recoverable are well-studied. To focus on the performance implications of the distributed concurrency control of SSS and all its competitors, operations to recover upon a crash of a node involved in a 2PC have been disabled. This decision has no correctness implication.
\section{Correctness}
\label{sec:correctness}
Our target is proving that every history $H$ executed by SSS, which includes committed update transactions and read-only transactions (committed or not), is external consistent.
We adopt the classical definition of history~\cite{adya}.
For understanding correctness, it is sufficient to know that a history is external consistent if the transactions in the history return the same values and leave the data store in the same state as they were executed in a sequential order (one after the other), and that order does not contradict the order in which transactions return to their clients.
We decompose SSS's correctness in three statements, each highlighting a property guaranteed by SSS.
Each statement claims that a specific history $H'$, which is derived from $H$, is external consistent. In order to prove that, we rely on the characteristics of the Direct Serialization Graph (DSG)~\cite{adya} which is derived from $H'$. Note that DSG also includes order relations between transactions' completion.
Every transaction in $H'$ is a node of the DSG graph, and every dependency of a transaction $T_j$ on a transaction $T_i$ in $H'$ is an edge from $T_i$ to $T_j$ in the graph. The concept of dependency is the one that is widely adopted in the literature: \textit{i)} $T_j$ read-depends on $T_i$ if a read of $T_j$ returns a value written by $T_i$, \textit{ii)} $T_j$ write-depends on $T_i$ if a write of $T_j$ overwrites a value written by $T_i$; \textit{iii)} $T_j$ anti-depends on $T_i$ if a write of $T_j$ overwrites a value previously read by $T_i$. We also map the completion order relations to edges in the graph: if $T_i$ commits externally before $T_j$ does, then the graph has an edge from $T_i$ to $T_j$. A history $H'$ is external consistent iff the DSG does not have any cycle~\cite{serializability,adya}.
In our proofs we use the binary relation $\leq$ to define an ordering on pair of vector clocks $v_1$ and $v_2$ as follows: $v_1 \leq v_2$ if $\forall i$, $v_1[i]\leq v_2[i]$. Furthermore, if there also exists at least one index $j$ such that $ v_1[j]<v_2[j]$, then $v_1<v_2$ holds.
\textit{\underline{Statement 1}. For each history $H$ executed by SSS, the history $H'$, which is derived from $H$ by only including committed update transactions in $H$, is external consistent.}
In the proof we show that if there is an edge from transaction $T_i$ to transaction $T_j$ in DSG, then $T_i.commitVC$ $<$ $T_j.commitVC$. This statement implies that transactions modify the state of the data store as they were executed in a specific sequential order, which does not contradict the transaction external commit order. Because no read-only transactions is included in $H'$, the internal commit is equivalent to the external commit (i.e., no transaction is delayed). The formal proof is included in the technical report~\cite{tech-rep}.
\textit{\underline{Statement 2}. For each history $H$ executed by SSS, the history $H'$, which is derived from $H$ by only including committed update transactions and one read-only transaction in $H$, is external consistent.}
The proof shows that read-only transactions always observe a consistent state by showing that in both the case of a direct dependency or anti-dependency, the vector clock of the read-only transactions is comparable with the vector clocks of conflicting update transactions.
This statement implies that read operations of a read-only transaction always return values from a state of the data store as the transaction was executed atomically in a point in time that is not concurrent with any update transaction. The formal proof is included in the technical report~\cite{tech-rep}.
\textit{\underline{Statement 3}. For each history $H$ executed by SSS, the history $H'$, which is derived from $H$ by only including committed update transactions and two or more read-only transactions in $H$, is external consistent.}
Since Statement 2 holds, SSS guarantees that each read-only transaction appears as it were executed atomically in a point in time that is not concurrent with any update. Furthermore, since Statement 1 holds, the read operations of that transaction return values of a state that is the result of a sequence of committed update transactions. Therefore, Statement 3 implies that, given such a sequence $S1$ for a read-only transaction $T_{r1}$, and $S2$ for a read-only transaction $T_{r2}$, either $S1$ is a prefix of $S2$, or $S2$ is a prefix of $S1$.
In practice, this means that all read-only transactions have a coherent view of all transactions executed on the system. The formal proof is included in the technical report~\cite{tech-rep}.
\begin{comment}
Since at least two read-only transactions can be in $H'$, we need to differentiate the two cases when a read-only transaction accesses versions written by externally committed transactions (\textit{case 1}), from the case where it accesses versions written by a transaction in Pre-commit, which we call Pre-commit versions (\textit{case 2}).
Note that we exclude the scenario where all read-only transactions access Pre-commit versions since, in this case, at least one update transaction should be snapshot-queued due to a read-only transaction that produced an anti-dependency. The existence of this read-only transaction violates the assumption that all read-only transactions access Pre-commit versions.
\vspace{-5pt}
\begin{figure}[h]
\includegraphics[width=.35\textwidth]{correctness.pdf}
\centering
\caption{Schedule violating external consistency where T1 and T4 are read-only.}
\label{fig:correctness}
\end{figure}
\vspace{-5pt}
In \textit{case 1}, the arguments used for Statement 1 and 2 hold, therefore a read-only transaction is serialized before an update transaction that produces an anti-dependency. At this point, any other conflicting read-only transaction will be aware of the existence of a read-only transaction with an anti-dependency by leveraging the snapshot-queuing technique, which propagates the information about the anti-dependency (Line~\ref{ver-l6} of Algorithm~\ref{visibility}). With this knowledge, other read-only transactions accessing externally committed versions will be serialized before the update transactions, therefore all observing the same serialization schedule. As in Statement 2, update transactions have a higher insertion-snapshot, therefore their execution will be externally visible only after the completion of the read-only transactions, maintaining the serialization order.
For \textit{case 2}, we rely on Figure~\ref{fig:correctness} in which we show a scenario where $T_1$ and $T_4$ are two read-only transactions that create a loop in the DSG because one of them decides to read from a Pre-commit version of an object, therefore serializing itself after some update transactions. We prove that SSS cannot produce this scenario by contradiction.
Let us assume that $T_4$ has an anti-dependency with $T_5$, therefore the edge connecting $T_4$ to $T_5$. At this point $T_5$ is snapshot-queued. Let us now assume that $T_3$ (or a chain of dependent update transactions) is an update transaction that accesses a Pre-commit version produced by $T_5$. $T_1$ is a read-only transaction that starts after the internal commit of $T_3$ on some common node, and therefore can access some Pre-commit version written by $T_3$, and at the same time it has an anti-dependency with a version written by $T_2$ (or directly by $T_6$ due to a chain of update transactions accessing Pre-commit versions).
In order for $T_4$ to read from $T_6$, $T_4$ must have started after the internal commit of $T_6$. However, it is impossible for $T_4$ to have had at the same time an existing anti-dependency with $T_5$ and have started after the internal commit of $T_6$. In fact, if it would have happened, then there could not be the chain of conflicting transactions accessing a Pre-commit version of an object with a read-only transaction among them.
\end{comment}
\begin{figure*}[!htb]
\begin{minipage}{.64\textwidth}
\centering
\includegraphics[width=.9\textwidth]{legend.pdf}\\
\hspace{-10pt}
\subfigure[20\%]{
\includegraphics[height=72pt,keepaspectratio]{nonLocal20.pdf}
\label{fig:repl-thr-nolocal-a}
}\hspace{-10pt}
\subfigure[50\%]{
\includegraphics[height=72pt,keepaspectratio]{nonLocal50.pdf}
\label{fig:repl-thr-nolocal-b}
}\hspace{-10pt}
\subfigure[80\%]{
\includegraphics[height=72pt,keepaspectratio]{nonLocal80.pdf}
\label{fig:repl-thr-nolocal-c}
}
\vspace{-4pt}
\caption{Throughput varying \% of read-only transactions. Number of nodes in X-axes.}
\label{fig:repl-thr-nolocal}
\end{minipage}\hfill
\begin{minipage}{0.36\textwidth}
\centering
\subfigure[Maximum attainable throughput. Number of nodes in X-axis.]{
\includegraphics[height=70pt,keepaspectratio]{max-throughput.pdf}
\label{fig:max-thr}
}\hspace{2pt}
\subfigure[External Commit latency. Clients per node in X-axis.]{
\includegraphics[height=70pt,keepaspectratio]{sss-2pc-ext.pdf}
\label{fig:latency}
}
\vspace{-10pt}
\caption{Performance of SSS against 2PC-baseline using 5k objects and 50\% read-only transactions.}
\label{myass}
\end{minipage}
\end{figure*}
\begin{comment}
\begin{figure*}[t]
\centering
\includegraphics[width=.6\textwidth]{legend.pdf}\\
\subfigure[20\%]{
\includegraphics[width=.25\textwidth]{nonLocal20.pdf}
\label{fig:repl-thr-nolocal-a}
}\hspace{10pt}
\subfigure[50\%]{
\includegraphics[width=.25\textwidth]{nonLocal50.pdf}
\label{fig:repl-thr-nolocal-b}
}\hspace{10pt}
\subfigure[80\%]{
\includegraphics[width=.25\textwidth]{nonLocal80.pdf}
\label{fig:repl-thr-nolocal-c}
}
\vspace{-4pt}
\caption{Throughput of SSS, Walter, 2PC-baseline varying \% of read-only transactions. Number of nodes in X-axes.}
\label{fig:repl-thr-nolocal}
\end{figure*}
\end{comment}
\section{Evaluation} \label{sec:eval}
We implemented SSS in Java from the ground up and performed a comprehensive evaluation study. In the software architecture of SSS there is an optimized network component where multiple network queues, each for a different message type, are deployed. This way, we can assign priorities to different messages and avoid protocol slow down in some critical steps due to network congestion caused by lower priority messages (e.g., the \texttt{Remove} message has a very high priority because it enables external commits). Another important implementation aspect is related to snapshot-queues. Each snapshot-queue is divided into two: one for read-only transactions and one for update transactions. This way, when the percentage of read-only transactions is higher than update transactions, a read operation should traverse few entries in order to establish its visible-set.
We compare SSS against the following competitors: 2PC-baseline (shortly 2PC in the plots), ROCOCO~\cite{rococo}, and Walter~\cite{walter}. All these competitors offer transactional semantics over key-value APIs. With 2PC-baseline we mean the following implementation: all transactions execute as SSS's update transactions; read-only transactions validate their execution, therefore they can abort; and no multi-version data repository is deployed. As SSS, 2PC-baseline guarantees external consistency.
ROCOCO is an external consistent two-round protocol where transactions are divided into pieces and dependencies are collected to establish the execution order. ROCOCO classifies pieces of update transactions into immediate and deferrable. The latter are more efficient because they can be reordered. Read-only transactions can be aborted, and they are implemented by waiting for conflicting transactions to complete. Our benchmark is configured in a way all pieces are deferrable. ROCOCO uses preferred nodes to process transactions and consensus to implement replication. Such a scheme is different from SSS where multiple nodes are involved in the transaction commit process.
To address this discrepancy, in the experiments where we compare SSS and ROCOCO, we disable replication for a fair comparison.
The third competitor is Walter, which provides PSI a weaker isolation level than SSS. Walter has been included because it synchronizes nodes using vector clocks, as done by SSS.
All competitors have been re-implemented using the same software infrastructure of SSS because we want to provide all competitors with the same underlying code structure and optimization (e.g., optimized network). For fairness, we made sure that the performance obtained by our re-implementation of competitors matches the trends reported in~\cite{walter} and~\cite{rococo}, when similar configurations were used.
In our evaluation we use YCSB~\cite{DBLP:conf/cloud/CooperSTRS10} benchmark ported to key-value store. We configure the benchmark to explore multiple scenarios. We have two transaction profiles: update, where two keys are read and written, and read-only transactions, where two or more keys are accessed.
In all the experiments we co-locate application clients with processing nodes, therefore increasing the number of nodes in the system also increases the amount of issued requests. There are 10 application threads (i.e., clients) per node injecting transactions in the system in a closed-loop (i.e., a client issues a new request only when the previous one has returned).
All the showed results are the average of 5 trials.
We selected two configurations for the total number of shared keys: 5k and 10k. With the former, the observed average transaction abort rate is in the range of 6\% to 28\% moving from 5 nodes to 20 nodes when 20\% read-only transactions are deployed. In the latter, the abort rate was from 4\% to 14\%. Unless otherwise stated, transactions select accessed objects randomly with uniform distribution.
As test-bed, we used CloudLab~\cite{ricci2014introducing}, a cloud infrastructure available to researchers. We selected 20 nodes of type c6320 available in the Clemson cluster~\cite{clamson}. This type is a physical machine with 28 Intel Haswell CPU-cores and 256GB of RAM. Nodes are interconnected using 40Gb/s Infiniband HPC cards.
In such a cluster, a network message is delivered in around 20 microseconds (without network saturation), therefore we set timeout on lock acquisition to 1ms.
In Figure~\ref{fig:repl-thr-nolocal} we compare the throughput of SSS against 2PC-baseline and Walter in the case where each object is replicated in two nodes of the system. We also varied the percentage of read-only transactions in the range of 20\%, 50\%, and 80\%.
As expected, Walter is the leading competitor in all the scenarios because its consistency guarantee is much weaker than external consistency; however, the gap between SSS and Walter reduces from 2$\times$ to 1.1$\times$ when read-only transactions become predominant (moving from Figure~\ref{fig:repl-thr-nolocal-a} to~\ref{fig:repl-thr-nolocal-c}). This is reasonable because in Walter, update transactions do not have the same impact in read-only transactions' performance as in SSS due to the presence of the snapshot-queues. Therefore, when the percentage of update transactions reduces, SSS reduces the gap. Considering the significant correctness level between PSI (in Walter) and external consistency, we consider the results of the comparison between SSS and Walter remarkable.
Performance of 2PC-baseline is competitive when compared with SSS only at the case of 20\% read-only. In the other cases, although SSS requires a more complex logic to execute its read operations, the capability of being abort-free allows SSS to outperform 2PC-baseline by as much as 7$\times$ with 50\% read-only and 20 nodes. 2PC-baseline's performance in both the tested contention levels become similar at the 80\% read-only case because, although lock-based, read-only transaction's validation will likely succeed since few update transactions execute in the system.
Figure~\ref{fig:repl-thr-nolocal} also shows the scalability of all competitors. 2PC-baseline suffers from higher abort rate than others, which hampers its scalability. This is because its read-only transactions are not abort-free. The scalability trend of SSS and Walter is similar, although Walter stops scaling at 15 nodes using 80\% of read-only transactions while SSS proceeds. This is mostly related with network congestion, which is reached by Walter earlier than SSS since Walter's transaction processing time is lower than SSS, thus messages are sent with a higher rate.
\begin{comment}
\begin{figure}[h]
\centering
\subfigure[Maximum attainable throughput. Number of nodes in X-axis.]{
\includegraphics[height=88pt,keepaspectratio]{max-throughput.pdf}
\label{fig:max-thr}
}\hspace{5pt}
\subfigure[External Commit latency. Clients per node in X-axis.]{
\includegraphics[width=.2\textwidth]{sss-2pc-ext.pdf}
\label{fig:latency}
}
\vspace{-4pt}
\caption{Performance of SSS against 2PC-baseline using 5k objects and 50\% read-only transactions.}
\label{myass}
\end{figure}
\end{comment}
In Figure~\ref{myass} we compare 2PC-baseline and SSS in terms of maximum attainable throughput and transaction latency. Figure~\ref{fig:max-thr} shows 2PC-baseline and SSS configured in a way they can reach their maximum throughput with 50\% read-only workload and 5k objects, meaning the number of clients per nodes differs per reported datapoint. Performance trends are similar to those in Figure~\ref{fig:repl-thr-nolocal-b}, but 2PC-baseline here is faster than before. This is related with the CPU utilization of the nodes' test-bed. In fact, 2PC-baseline requires less threads to execute, meaning it leaves more unused CPU-cores than SSS, and those CPU-cores can be leveraged to host more clients.
\begin{figure}[h]
\centering
\includegraphics[width=.2\textwidth]{sss-delay.pdf}
\caption{Breakdown of SSS transaction latency.}
\label{fig:breakdown}
\end{figure}
The second plot (Figure~\ref{fig:latency}) shows transaction latency from its begin to its external commit when 20 nodes, 50\% read-only transactions, and 5k objects are deployed.
In the experiments we varied the number of clients per node from 1 to 10. When the system is far from reaching saturation (i.e., from 1 to 5 clients), SSS's latency does not vary, and it is on average 2$\times$ lower than 2PC-baseline's latency. At 10 clients, SSS's latency is still lower than 2PC-baseline but by a lesser percentage. This confirms one of our claim about SSS capability of retaining high-throughput even when update transactions are held in snapshot-queues. In fact, Figure~\ref{fig:repl-thr-nolocal-b} shows the throughput measurement in the same configuration: SSS is almost 7$\times$ faster than 2PC-baseline.
\begin{comment}
\begin{wrapfigure}{l}{0.22\textwidth}
\vspace{-10pt}
\begin{center}
\includegraphics[width=.2\textwidth]{sss-delay.pdf}
\caption{Breakdown of SSS transaction latency.}
\label{fig:breakdown}
\end{center}
\vspace{-12pt}
\end{wrapfigure}
\end{comment}
Figure~\ref{fig:breakdown} shows the relation between the internal commit latency and the external commit latency of SSS update transactions. The configuration is the one in Figure~\ref{fig:latency}. Each bar represents the latency between a transaction begin and its external commit. The internal red bar shows the time interval between the transaction's insertion in a snapshot-queue and its removal (i.e., from internal to external commit). This latter time is on average 30\% of the total transaction latency.
In Figure~\ref{yourass} we compare SSS against ROCOCO and 2PC-baseline. To be compliant with ROCOCO, we disable replication for all competitors and we select 5k as total number of shared keys because ROCOCO finds its sweet spot in the presence of contention. Accesses are not local.
\begin{figure}[h]
\centering
\subfigure[20\%.]{
\includegraphics[width=.2\textwidth]{rep120.pdf}
\label{fig:rococo-20}
\subfigure[80\%.]{
\includegraphics[width=.2\textwidth]{rep180.pdf}
\label{fig:rococo-80}
}
\vspace{-5pt}
\caption{SSS, 2PC-baseline, ROCOCO varying \% of read-only transactions. Legend in (a) applies to (b).}
\label{yourass}
\end{figure}
Figures~\ref{fig:rococo-20} and~\ref{fig:rococo-80} show the results with 20\% and 80\% read-only transactions respectively. In write intensive workload, ROCOCO slightly outperforms SSS due to its lock-free executions and its capability of re-ordering deferrable transaction pieces. However, even in this configuration, which matches a favorable scenario for ROCOCO, SSS is only 13\% slower than ROCOCO and 70\% faster than 2PC-baseline.
In read-intensive workload, SSS outperforms ROCOCO by 40\% and by almost 3$\times$ 2PC-baseline at 20 nodes. This gain is because ROCOCO is not optimized for read-only transactions; in fact, its read-only are not abort-free and they need to wait for all conflicting update transactions in order to execute.
\begin{comment}
\begin{figure}[h]
\centering
\includegraphics[width=.25\textwidth]{theBestPlot.pdf}
\caption{Throughput 80\% read-only and 50\% locality.}
\label{local-stuff}
\end{figure}
\end{comment}
We also configured the benchmark to produce 50\% of keys access locality,
meaning the probability that a key is stored by the node where the transaction is executing (local node), and 50\% of uniform access.
Increasing local accesses has a direct impact on the application contention level. In fact, since each key is replicated on two nodes, remote communication is still needed by update transactions, while the number of objects accessible by a client reduces when the number of nodes increases (e.g., with 20 nodes and 5k keys, a client on a node can select its accessed keys among 250 keys rather than 5k). Read-only transactions are the ones that benefit the most from local accesses because they can leverage the local copy of each accessed key.
\begin{figure}[!htb]
\begin{minipage}{0.24\textwidth}
\centering
\includegraphics[width=.92\textwidth]{theBestPlot.pdf}
\caption{Throughput 80\% read-only and 50\% locality.}
\label{local-stuff}
\end{minipage}\hfill
\begin{minipage}{0.24\textwidth}
\centering
\includegraphics[width=1\textwidth]{Picture1.pdf}
\caption{Speedup of SSS over ROCOCO and 2PC-baseline increasing the size of read-only transactions.}
\label{bestplot}
\end{minipage}
\end{figure}
We report the results (in Figure~\ref{local-stuff}) using the same configuration in Figure~\ref{fig:repl-thr-nolocal-c} because that is the most relevant to SSS and Walter.
Results confirm similar trend.
SSS is more than 3.5$\times$ faster than 2PC-baseline but, as opposed to the non-local case, here it cannot close the gap with Walter due to the high contention
around snapshot-queues.
\begin{comment}
\vspace{-3pt}
\begin{figure}[h]
\centering
\includegraphics[width=.25\textwidth]{Picture1.pdf}
\caption{Speedup of SSS over ROCOCO and 2PC-baseline increasing the size of read-only transactions.}
\label{bestplot}
\end{figure}
\end{comment}
In Figure~\ref{bestplot} we show the impact of increasing the number of read operations inside read-only transactions from 2 to 16. For this experiment we used 15 nodes and 80\% of read-only workload. Results report the ratio between the throughput of SSS and both ROCOCO and 2PC-baseline. When compared to ROCOCO, SSS shows a growing speedup, moving from 1.2$\times$ with 2 read operations to 2.2$\times$ with 16 read operations. This is because, as stated previously, ROCOCO encounters a growing number of aborts for read-only transactions while increasing accessed objects.
2PC-baseline degrades less than ROCOCO when operations increases because it needs less network communications for read-only transactions.
\section{Related Work}
Many distributed transactional repositories have been proposed in literature, examples include~\cite{granola,hstore,pnuts,dynamo,spanner,cure, gentlerain,rethinking,Cockroach}.
Among them, Spanner~\cite{spanner}, Scatter~\cite{scatter}, and ROCOCO~\cite{rococo} guarantee the same level of consistency as SSS.
Google Spanner~\cite{spanner} is a high performance solution that leverages a global source of synchronization to timestamp transactions so that a total order among them can always be determined, including when nodes are in different geographic locations. This form of synchronization is materialized by the \textit{TrueTime} API. This API uses a combination of a very fast dedicated network, GPS, and atomic clocks to provide accuracy of the assigned timestamps.
Although outstanding, Spanner's architecture needs special-purpose hardware and therefore it cannot be easily adopted and extended.
Scatter provides external consistency on top of a Paxos-replicated log. The major difference with SSS is that Scatter only supports single key transactions while SSS provides a more general semantics.
ROCOCO uses a two-round protocol to establish an external schedule in the system, but it does not support abort-free read-only transactions.
Replicated Commit~\cite{rp} provides serializability by replicating the commit operation using 2PC in every data center and Paxos to establish consensus among data centers. As opposed to SSS, in Replicated Commit read operations require contacting all data centers and collect replies from a majority of them in order to proceed. SSS's read operations are handled by the fastest replying server.
Granola~\cite{granola} ensures serializability using a timestamp-based approach with a loosely synchronized clock per node. Granola provides its best performance when transactions can be defined as independent, meaning they can entirely execute on a single server.
SSS has no restriction on transaction accesses.
CockroachDB~\cite{Cockroach} uses a serializable optimistic concurrency control, which processes transactions by relying on multi-versioning and timestamp-ordering. The main difference with SSS is the way consistent reads are implemented. CockroachDB relies on consensus while SSS needs only to contact the fastest replica of an object.
Calvin~\cite{calvin}
uses a deterministic locking protocol supported by a sequencer layer that orders transactions. In order to do that, Calvin requires a priori knowledge on accessed read and written objects. Although the sequencer can potentially be able to assign transaction timestamp to meet external consistency requirements, SSS does that without assuming knowledge of read-set and write-set prior transaction execution and without the need of such a global source of synchronization.
SCORe~\cite{score}, guarantees similar properties as SSS, but it fails to ensure external consistency since it relies on a single non-synchronized scalar timestamp per node to order transactions, and therefore its abort-free read-only transactions might be forced to read old version of shared objects.
Other protocols, such as GMU~\cite{gmu12}, Walter~\cite{walter}, Clock-SI~\cite{clocksi} and Dynamo~\cite{dynamo},
provide scalability by supporting weaker levels of consistency.
GMU~\cite{gmu12} provides transactions with the possibility to read the latest version of an object by using vector clocks; however it cannot guarantee serializable transactions. Walter use a non-monotonic version of Snapshot Isolation (SI) that allows long state fork.
Clock-SI provides SI using a loosely synchronized clock scheme.
\section{Conclusions}
In this paper we presented SSS, a transactional repository that implements a novel distributed concurrency control providing external consistency without a global synchronization service. SSS is unique because it preserves the above properties while guaranteeing abort-free read-only transactions. The combination of snapshot-queuing and vector clock is the key technique that makes SSS possible. Results confirmed significant speedup over state-of-the-art competitors in read-dominated workloads.
\newpage
\bibliographystyle{abbrv}
| {'timestamp': '2019-01-15T02:03:25', 'yymm': '1901', 'arxiv_id': '1901.03772', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03772'} | arxiv |
\section{Introduction}
\medskip
Although Shewhart type control charts work in many situations, the prerequisites for their use are hardly ever exactly met. In practice, the most commonly observed phenomenon is a violation of normality in the observed values.
It often becomes evident due to the heavy tails when multiple observed measurements lie below the mean of the expected normal distribution.
A very common phenomenon is the skewness of data. In this case, deviations from the mean value frequently occur that are biased to one side, and the distribution becomes asymmetrical. Due to the measuring devices and human error, outliers occur, i.e., values significantly distant from the mean. Typically, this includes errors arising from the wrong decimal point when writing the measured values or zero measurement due to a failure in reading and writing of the measured values. In some cases, the measured value is, in addition to purely random factors, affected by other inherent or unrecognized systematic effects and the resulting distribution of values is a mixture of several distributions.
These and other deviations from the exact normal distribution usually lead to an increase in the frequency of false signals. This phenomenon is undesirable for several reasons -- it:
-- increases the costs of control,
-- increases the variability in the controlled process,
-- reduces the credibility of the control chart and is likely to lead to its merely formal use,
\phantom{mnn} and less attention is consequently devoted to the actual signals.
\medskip
Another phenomenon, leading to an increased frequency of false alarms, is a violation of independence in the measurements over time. It may, however, to some extent eliminate an appropriately chosen model (e.g., ARMA, ARIMA) and the observed characteristics indicate deviations from this model \cite{montgomery},\cite{amin},\cite{jensen}.
Eliminating the influence of outliers or heavy tails is much more complicated. In such cases, we are looking for a robust version of control charts \cite{rocke}.
The effort to increase robustness of the control chart usually leads to two effects that occur simultaneously:
\begin {itemize}\setlength\itemsep{-1mm}
\item reduction in the frequency of false signals;
\item the resulting control chart becomes less sensitive to the behavior change of the process, in consequence of an assignable cause
\end {itemize}
\noindent The second effect can be just as annoying as the high frequency of false signals. Long delays in the signal for the emergence of assignable causes may lead to
\smallskip
\noindent-- cost increases due to poor production when the process is in an out-of-control
\phantom{n} state
\noindent-- lower confidence in the effectiveness of the control chart
\smallskip
\noindent This unpleasant phenomenon can be partially eliminated using the adaptive approach to the sequential detection scheme \cite{tagaras},\cite{woodal},\cite{zimmer},\cite{tsung}.
\medskip
In Section 2 we will review some robust proposals based on robust estimates of control characteristics. Section 3 gives some examples of adaptive approaches, and designs a new adaptive scheme.
\section{Robust control charts}
\medskip
The robustness of control charts is usually understood as a control chart being less sensitive to violated assumptions of normality in the observed characteristics.
The robustness of control charts is usually increased in three ways:
\begin {itemize}\setlength\itemsep{-1mm}
\item adjusting control limits \cite{quesen},\cite{figueir},
\item using robust estimates of controlled characteristics, such as using the median estimate for the position or inter-quartile range to estimate variability \cite{jensen}, \cite{rocke}
\item using nonparametric tests in a sequential detection scheme \cite{lehman},\cite{chakra},\cite{baker}
\end {itemize}
In this paper we will show results of applying the adaptive scheme on a robust CUSUM chart. We assume the following control chart based on the CUSUM statistics:
\begin{eqnarray*}
\tilde{C}^{+}_{n+1}= \max\big[ 0, \tilde{C}^{+}_{n}-(\mu_0+\delta_0)+\tilde{X}_n\big] \\
\tilde{C}^{-}_{n+1}= \max\big[ 0, \tilde{C}^{-}_{n}+(\mu_0+\delta_0)-\tilde{X}_n\big]
\end{eqnarray*}
where $\mu_0$ is the desired process mean, $\delta_0$ is the threshold for shift detection, and $\tilde{X}_n$ is a median of the $n$-th sample. The signal will be sent out whenever $C^{+}_n \geq L$. This describes the robust version of a chart denoted as CUSUM $\tilde{X}$ in the text that follows (see, e.g., \cite{reynolds}).
\section{Adaptive control charts}
\medskip
An adaptive sequential detection scheme (SDS) responds to the current state of the process, estimated from the results of measurements made during the inspection. According to current information on the process, we choose parameters for the next SDS period (until the next inspection). A slow response of an adaptive procedure can, to a certain extent, be remedied using a robust control chart. An adaptive SDS is primarily intended to shorten the delay of the control chart.
\smallskip
Moreover, obtaining data in Phase I of SDS (see \cite{montgomery}) for estimation of parameters to reach an acceptable level is often too costly. An insufficient number of samples in Phase I can lead to large uncertainties in parameter estimation. An alternative is to improve estimation accuracy by using samples collected in Phase II using an adaptive approach. This leads us to adaptive control charts.
\medskip
In this context, we distinguish between two groups of parameters: sample parameters and design parameters of the chart.
The sample parameters mainly include the time between inspections $h$ and sample sizes $n$ to be inspected. Shortening the time between inspections can significantly reduce the average delay of a control chart. Moreover, if the probability of failure (assignable cause) increases with time, long intervals can be set between inspections at the beginning of control and be further reduced with an increasing probability of failure. This can save considerable costs of control on the one hand, and shorten the response time to the emergence of assignable causes on the other hand. Increasing the number of measurements during the inspections in the event that we suspect the process to be out of statistical control, we refine our estimates of observed characteristics and can reduce the probability of false signals, while simultaneously increasing the likelihood of detecting faults in the process.
A disadvantage of sample parameters is that a change during the process run requires organizational interventions in the work of operators. In contrast, design parameters, which include control limits, the threshold value in a CUSUM chart, weight $\lambda $ of an EWMA chart and others, can be changed independent of the operator, who takes samples and measurements. These parameter changes are easily accomplished as long as SDS is implemented with the aid of computers \cite{tsung}.
\bigskip
\subsection{Examples of charts with adaptive design parameters}
\medskip
\subsubsection{CUSUM adaptive control chart}
Sparks in \cite{sparks} suggested the following adaptive CUSUM control scheme with an adaptive reference parameter:
$$
C_t=\max\big[0,\ C_{t-1}+(x_t-\delta_t/2)/h(\delta_t)\big]
$$
where $h(\delta_t)$ is a function which maintains a constant control limit. The shift magnitude $\delta_t$ is updated on line using an EWMA-type equation
$$ \delta_t=\max\big(wx_{t-1}+(1-w)\delta_{t-1}, \ \delta_{\min}\big).
$$
(suggested $\delta_{\min}$ is 0.5 for detecting smaller shifts, 1.0 for detecting shifts larger than 1.0)
\medskip
\subsubsection{EWMA adaptive control chart}
Capizzi and Masarotto in \cite{capizi} introduced an adaptive EWMA procedure with an adaptive smoothing parameter $w(e_t)$:
$$
Z_t=\big(1-w(e_t)\big)Z_{t-1}+w(e_t)x_t
$$
where $e_t=x_t-Z_t$. For small values of $e_t$, $w(e_t)$ becomes relatively small, while for large $e_t$ the value of $w(e_t)$ is enlarged accordingly.
\subsubsection{Zone adaptive procedure with adaptive control limits}
The control chart of a zone type respects, in a certain manner, the supplementary run rules introduced by Western Electric in 1956.
Suppose a zone control chart $\bar{X}$ with ten zones, defined by a central line $CL$ and four limits $k_1, k_2, k_3$ and $k_4$, which symmetrically space out the
diagram into five zones below $CL$ (zones $-Z_0, -Z_1, -Z_2, -Z_3, -Z_4$) and five zones above $CL$ (zones $Z_0, Z_1, Z_2, Z_3, Z_4$ are on the left in Figure 1). Scores are assigned to points falling into each zone according to the right column in Figure 1. The function of a classical zone diagram is described in literature \cite{davis}, \cite{dohnal1}.
\bigskip
\begin{center}
\begin{picture}(240,110)\setlength{\unitlength}{0.5mm}
\put(10,40){\line(1,0){160}} \put(-1,38){CL}
\put(10,80){\line(6,0){160}}
\multiput(10,30)(4,0){40}{\line(1,0){2}}
\multiput(10,20)(4,0){40}{\line(1,0){2}}
\multiput(10,10)(4,0){40}{\line(1,0){2}}
\multiput(10,50)(4,0){40}{\line(1,0){2}}
\multiput(10,60)(4,0){40}{\line(1,0){2}}
\multiput(10,70)(4,0){40}{\line(1,0){2}}
\put(10,0){\line(1,0){160}}
\put(2,48){$k_1$}\put(2,58){$k_2$}\put(2,68){$k_3$}\put(2,78){$k_4$}
\put(-4,28){$-k_1$}\put(-4,18){$-k_2$}\put(-4,8){$-k_3$}\put(-4,-2){$-k_4$}
\put(139,42){$Z_0$}\put(139,52){$Z_1$}\put(139,62){$Z_2$}\put(139,72){$Z_3$}\put(120,82){zone: $Z_4$, score: 8}
\put(133.6,32){$-Z_0$}\put(133.6,22){$-Z_1$}\put(133.6,12){$-Z_2$}\put(133.6,2){$-Z_3$}\put(133.6,-8){$-Z_4$}
\put(169,42){0}\put(169,52){1}\put(169,62){2}\put(169,72){4}
\put(169,32){0}\put(169,22){1}\put(169,12){2}\put(169,2){4}\put(169,-8){8}
\put(10,-5){\line(0,1){90}}
\put(25,39){\line(0,1){2}} \put(22.5,43){*}
\put(15,39){\line(0,1){2}} \put(12.5,48){*}
\put(35,39){\line(0,1){2}}\put(32.5,20){*}
\put(45,39){\line(0,1){2}}\put(42.5,50){*}
\put(55,39){\line(0,1){2}}\put(52.5,39){*}
\put(65,39){\line(0,1){2}}\put(62.5,52){*}
\put(75,39){\line(0,1){2}}\put(72.5,28){*}
\put(85,39){\line(0,1){2}}\put(82.5,44){*}
\put(95,39){\line(0,1){2}}\put(92.5,63){*}
\put(105,39){\line(0,1){2}}\put(102.5,40){*}
\put(115,39){\line(0,1){2}}\put(112.5,58){*}
\multiput(124,38)(0,4){8}{\line(0,1){1}}
\put(122.5,68){*}
\put(122,32){$T$}
\end{picture}
\bigskip
Figure 1: Zone control chart. \end{center}
\medskip
Here we introduce a new adaptive version of the zone chart.
\noindent The decision rule is based on exceeding the lower or upper control limits (LCL, UCL),the same as in the Shewhart-type chart. These limits will be changed in each inspection step.
For each subgroup average, we determine into which zone $Z_k$ the value falls and look up the shrinkage parameter $s_k$ given for that zone. The control process starts with $(LCL_0, UCL_0)$.
At each inspection $n$, if the subgroup average $\bar{X}_n$ is within the current control limits $(LCL_{n-1},UCL_{n-1})$, we will compute a new tuple of control limits $(LCL_n, UCL_n)$ in the following way:
\begin{eqnarray*}
(\bar{X}_n < 0) \wedge (\bar{X}_n \in -Z_k) \Rightarrow (LCL_n, UCL_n)=\big(L_n(LCL_{n-1}, s_k), UCL_0\big), \\
(\bar{X}_n \geq 0) \wedge (\bar{X}_n \in Z_k) \Rightarrow (LCL_n, UCL_n)=\big(LCL_0, L_n(UCL_{n-1}, s_k)\big),
\end{eqnarray*}
where the shrinkage function is defined as follows:
$$
L_n(LCL,s) = LCL + s\sigma_{\bar{X}}, \ \ \text{and} \ \ L_n(UCL,s) = UCL - s\sigma_{\bar{X}}.
$$
\noindent If the current subgroup average is on the same side of the central line as the preceding subgroup average, then the corresponding control limit will be shrunk, while the opposite control limit will be set to its maximal absolute value. As more subsequent observations are on the same side of CL, the corresponding control limit will get close to CL and the probability of signal will increase. An example of such a control chart is shown in Figure 2.
\setcounter{figure}{1}
\begin{figure}[htb]
\begin{center}
\includegraphics[width=3in]{pic1.pdf}
\caption{Detected shift.}
\end{center}
\end{figure}\label{fig2}
\section{Robust adaptive control charts}
Let a control chart CUSUM $\tilde{X}$ be given which was introduced in Section 2.
Suppose that parameters $\delta_0, \mu_0$ and $L$ for the process at in-control state were set within the design phase.
When we apply to statistics $C^{+}_n, \ n=0,1,\dots$ the zone adaptive scheme described in the previous section, we obtain a robust adaptive control chart, which we shall denote as Ad-CUSUM $\tilde{X}$. The considered zone adaptive procedure is characterized by zone limits $\{k_0, k_1, k_2\}, k_2=L$ and shrinkage parameters $\{s_0, s_1, s_2\}$. In Figure 3 we can see two possible runs of these charts.
\setcounter{figure}{2}
\begin{figure}[htb]
\begin{center}
\includegraphics[width=5in]{pic2.pdf}
\caption{Detected shift.}
\end{center}
\end{figure}\label{fig3}
For a comparison of the listed diagrams' properties, we performed a numerical study in which we simulated data from both normal distribution $N(0,1)$ and a contaminated distribution, which means that observations $(100-\theta)\%$ come from the $N(\delta,1)$ normal distribution and $\theta\%$ come from the $N(\delta, \sigma^2)$ normal distribution, $\delta \geq 0$.
\subsection{Numerical results}
The comparison of various control charts is based on ARL evaluation for both normal and contaminated data. The following settings were used:
\begin{enumerate}
\setlength\itemsep{-1.5mm}
\item The normal data are from the $N(\delta, 1)$ normal distribution.
\item The contaminated data consists of $94\%$ from the $N(\delta, 1)$ and $6\%$ from the $N(\delta, 6.25)$ normal distribution.
\item We simulated 10,000 runs with sample size $n=5$ for $\delta = 0.0, 0.1, 0.3,$ $0.5,$ $0.7, 1.0, 1.5$.
\item The following parameters were used for various control charts:
\begin{enumerate}
\item Shewhart $\bar{X}$: $CL=0, LCL=-3.09, UCL=3.09$
\item Shewhart $\tilde{X}$: $CL=0, LCL=-3.128, UCL=3.128$
\item CUSUM $\bar{X}$: $\delta_0=0.15, L=4.001$
\item CUSUM $\tilde{X}$: $\delta_0=0.15, L=4.344$
\item EWMA $\bar{X}$: $\lambda=0.1, L=2.835$
\item EWMA $\tilde{X}$: $\lambda=0.1, L=2.827$
\item Ad-CUSUM $\tilde{X}$: $\delta_0=0.15, L=4.344$
\end{enumerate}
\end{enumerate}
\noindent The parameters were chosen to obtain $ARL_0 \approx 0$. The Table 1 shows the comparison of control charts (a)--(g) on the normally distributed data.
We can see that, for different values of the shift $\delta$, different types of control charts are the best. For a small shift (0.1), Ad-CUSUM $\tilde{X}$ seems to be best. For medium shifts $0.3--1.0$, EWMA $\bar{X}$ gives the best results; and for the shift $\delta=1.5$, a chart of the Shewhart type is the best.
\medskip
\begin{tabular}{|l|c|c|c|c|c|c|c|}
\hline
Control Chart & \multicolumn{7}{|c|}{shift $\delta$} \\
\cline{2-8}
& 0.0 & 0.1 & 0.3 & 0.5 & 0.7 & 1.0 & 1.5 \\
\hline
Shewhart $\bar{X}$ & 500.2 & 405.3 & 128.1 & 41.5 & 16.3 & 5.0 & 1.7 \\
\hline
Cusum $\bar{X}$ & 501.2 & 130.0 & 20.2 & 9.9 & 6.5 & 4.5 & 2.9 \\
\hline
EWMA $\bar{X}$ & 501.0 & 136.3 & 19.2 & 8.5 & 5.2 & 3.4 & 2.4 \\
\hline
Shewhart $\tilde{X}$ & 500.1 & 439.2 & 175.3 & 69.6 & 28.3 & 9.7 & 2.7 \\
\hline
Cusum $\tilde{X}$ & 502.0 & 151.4 & 26.2 & 13.1 & 8.7 & 5.7 & 3.8 \\
\hline
EWMA $\tilde{X}$ & 499.2 & 165.4 & 24.4 & 10.3 & 6.4 & 4.0 & 2.7 \\
\hline
Ad-Cusum $\tilde{X}$ & 504.1 & 124.9 & 24.5 & 11.7 & 7.9 & 5.4 & 3.7 \\
\hline
\end{tabular}
\begin{center}Table 1. ARLs of different control charts with data from $N(0,1)$.
\end{center}
\noindent Table 2 obtained for control charts on the contaminated data is hard to evaluate. At first glance, EWMA $\bar{X}$ seems to be best for shifts $\delta \geq 0.1$, but ARL(0) is too small and therefore the probability of false alarms is much higher than for the other considered charts.
\medskip
\begin{tabular}{|l|c|c|c|c|c|c|c|}
\hline
Control Chart & \multicolumn{7}{|c|}{shift $\delta$} \\
\cline{2-8}
& 0.0 & 0.1 & 0.3 & 0.5 & 0.7 & 1.0 & 1.5 \\
\hline
Shewhart $\bar{X}$ & 87.1 & 78.0 & 48.2 & 24.5 & 13.8 & 5.7 & 2.7 \\
\hline
Cusum $\bar{X}$ & 265.4 & 97.4 & 19.2 & 9.9 & 6.6 & 4.4 & 2.9 \\
\hline
EWMA $\bar{X}$ & 186.1 & 85.2 & 17.1 & 8.0 & 5.0 & 3.4 & 2.4 \\
\hline
Shewhart $\tilde{X}$ & 264.5 & 236.8 & 126.6 & 48.6 & 24.1 & 9.8 & 4.0 \\
\hline
Cusum $\tilde{X}$ & 430.0 & 139.4 & 26.8 & 12.8 & 8.6 & 5.8 & 3.8 \\
\hline
EWMA $\tilde{X}$ & 343.9 & 127.4 & 23.3 & 10.0 & 6.2 & 4.0 & 2.7 \\
\hline
Ad-Cusum $\tilde{X}$ & 466.2 & 121.5 & 24.1 & 11.8 & 7.9 & 5.4 & 3.7 \\
\hline
\end{tabular}
\begin{center}Table 2. ARLs of different control charts with data from a mixture of 94\% $N(\delta, 1)$ and 6\% of $N(\delta, 6.25)$.
\end{center}
\bigskip
\section{Conclusions}
For comparison purposes, we introduce the $RARL_C$ index, which expresses the relative ARL for different control charts on contaminated data.
The $RARL_C$ index is defined as follows
$$
RARL_C = k.ARL_C(\delta), \ \ \ \text{where} \ \ \ k=\frac{ARL(0)}{ARL_C(0)}.
$$
\noindent Table 3 shows the comparison between different types of control charts using the $RARL_C$ index on the contaminated data.
\medskip
\begin{tabular}{|l|c|c|c|c|c|c|c|}
\hline
Control Chart & \multicolumn{7}{|c|}{shift $\delta$} \\
\cline{2-8}
& 0.0 & 0.1 & 0.3 & 0.5 & 0.7 & 1.0 & 1.5 \\
\hline
Shewhart $\bar{X}$ & 500 & 447.7 & 276.7 & 140.6 & 79.2 & 32.7 & 15.5 \\
\hline
Cusum $\bar{X}$ & 500 & 183.5 & 36.2 & 18.7 & 12.4 & 8.3 & 5.46 \\
\hline
EWMA $\bar{X}$ & 500 & 228.9 & 45.9 & 21.5 & 13.4 & 9.1 & 6.45 \\
\hline
Shewhart $\tilde{X}$ & 500 & 446.1 & 238.5 & 91.6 & 45.4 & 18.5 & 7.54 \\
\hline
Cusum $\tilde{X}$ & 500 & 162.1 & 31.1 & 14.9 & 10.0 & 6.74 & 4.42 \\
\hline
EWMA $\tilde{X}$ & 500 & 185.2 & 33.9 & 14.5 & 9.01 & 5.82 & 3.93 \\
\hline
Ad-Cusum $\tilde{X}$ & 500 & 130.3 & 25.9 & 12.7 & 8.47 & 5.79 & 3.97 \\
\hline
\end{tabular}
\begin{center}Table 3. Relative ARLs of different control charts with contaminated data.
\end{center}
\medskip
The last row of the table clearly shows that, in the case of contaminated data, an improved control chart using an adaptive detection scheme is the best choice.
\bigskip\noindent
{\bf Affiliation}: The presented research has been supported by the Ministry of Education of the Czech Republic under the Center of Advanced Aviation Technology CZ.02.1.01/0.0/0.0/16\_019/0000826.
| {'timestamp': '2019-01-15T02:00:09', 'yymm': '1901', 'arxiv_id': '1901.03701', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03701'} | arxiv |
\section{Introduction} \label{Introduction}
Video streaming applications including video conferencing, virtual reality (VR) and online gaming are expected to dominate 82 percent of the Internet traffic by 2022, up from 75 percent in 2017~\cite{CiscoWhitePaper2018}. Since the user experience for a video streaming application is directly impacted by the latency and reliability guarantees supported by the underlying connection, we are motivated to find effective error correction strategies for general low-latency applications over the Internet including video streaming.
Two main error control schemes have been implemented at the data link layer and the transport layer to alleviate the effect of packet losses on applications that are run over the Internet: Automatic repeat request (ARQ) and forward error correction (FEC). In order to implement error correction for low-latency applications, FEC is preferred over ARQ when retransmitting lost packets is costly. Consider the example of remotely controlling a critical device over the Tactile Internet~\cite{tactileInternet16} where a sensor wants to communicate with an actuator in real time through a control server with round-trip latency less than 1~ms as illustrated in~\cite[Fig.~3]{5GPPP}. The latency goals for processing delay at the terminals, transmission delay over the air interfaces between the terminals and the control server and data processing delay at the control server are 0.3~ms, 0.2~ms and 0.5~ms respectively. If an ARQ scheme is used for error control, then retransmissions compete the precious time resources with data computation at the terminals and the control server. The advantage of FEC over ARQ is most obvious when retransmitting lost packets directly affects the quality of service. For example, retransmitting a Voice-over-IP (VoIP) packet incurs an extra round-trip delay (backward + forward) which will result in an overall three-way delay (forward + backward + forward) that may exceed the 150 ms delay recommended by International Telecommunication Union~\cite{onewayTransTime} (see~\cite{StockhammerHannuksela2005} for an overview of the ubiquitous H.264/AVC video coding standard). Given the fact that the three-way propagation delay (forward + backward + forward) is at least 200~ms for communication between two diametrically opposite points on the earth's circumference~\cite{BKTAmagazine17}, FEC has a clear advantage over ARQ for long-distance low-latency communication.
This paper focuses on low-latency FEC schemes implemented at the transport layer, where a source packet is either received by the destination without error or dropped by the network (possibly due to unreliable links or network congestion). In other words, a source packet is either perfectly recovered by the destination or completely erased. Since packet erasures often occur in a bursty rather than sparse manner~\cite{Bolot1993,Paxson1999}, we model the connection between the source and the destination as a packet erasure channel that introduces burst erasures. In order to capture the nature of streaming messages and the low-latency requirements, we assume that a source message is generated in every time slot and a decoding delay constraint~$T$ is imposed on every message, where each message is encoded into a channel packet before being transmitted through the erasure channel. If the destination cannot decode a message within~$T$ time slots from the time when the message is generated, the message is considered lost. Ideally, we would like to characterize the maximum achievable rates for statistical models that generate burst erasures such as the well-known Gilbert-Elliott channel \cite{Gilbert1960,Elliott1963} and its generalization the Fritchman channel~\cite{Fritchman1967}. However, such characterizations seem intractable due to the decoding delay constraint and the fact that statistical models that generate burst erasures are not memoryless. Therefore, Martinian and Sundberg~\cite{MartinianSundberg2004} have instead fully characterized the capacity, i.e., maximum coding rate, for a simpler deterministic model where a burst erasure of length~$B$ is introduced on the discrete timeline and every message has to be perfectly recovered at the destination with a decoding delay of~$T$ time slots. They proposed a streaming code that not only achieves the capacity~$\frac{T}{T+B}$ for the deterministic model, but also can significantly outperform traditional FEC schemes for the Gilbert-Elliott channel. Various generalizations of the packet erasure model and the streaming codes studied in~\cite{MartinianSundberg2004} have been proposed in~\cite{LeungHo2012, LQH2013, BKTA2013, AdlerCassuto2017,FKLTZA2018}.
Note that an Internet application may consist of multiple types of data streams (video, audio, text, etc.), and also within a single data stream such as video there are different subsets of data that have different delivery deadlines. Moreover, multiplexing streams of different latency constraints has been implemented in the QUIC transport protocol to reduce latency of Google Search responses and reduce rebuffer rates of YouTube playbacks~\cite{QUIC2017}. Therefore, Badr et al.\ \cite{BLKTZA2018} extended the study of single-stream codes in~\cite{MartinianSundberg2004} and initiated the study of streaming codes which multiplex a stream of urgent messages with a stringent delay constraint and a stream of less-urgent messages with a less stringent delay constraint. Simulation results in~\cite[Sec.~VIII]{BLKTZA2018} demonstrate that using multiplexed streaming codes can significantly outperform concatenating multiple single-stream codes for the Gilbert-Elliott channel. In the multiplexed streaming model studied in~\cite{BLKTZA2018}, every urgent message has to be decoded within $T_\mathrm{u}$ time slots from the time when the urgent message is generated, and every less-urgent message has to be decoded within $T_\mathrm{v}$ time slots from the time when the less-urgent message is generated. It is assumed that $T_\mathrm{u}\le T_\mathrm{v}$, consistent with the notion that the urgent messages have to be decoded with less decoding delay than the less-urgent messages. Similar to the single-stream case, we assume that the channel introduces a burst erasure of length~$B$ on the discrete timeline and define the capacity region to be the set of rate pairs $(R_\mathrm{v}, R_\mathrm{u})$ which are supported by streaming codes that correct any length-$B$ burst erasure where $R_\mathrm{v}$ and $R_\mathrm{u}$ denote the rates of the less-urgent stream and urgent stream respectively. For the case $T_\mathrm{u}\le T_\mathrm{v}\le T_\mathrm{u}+B$, systematic streaming codes have been proposed in~\cite{BLKTZA2018} to achieve the capacity region.
However, for the remaining non-trivial case $T_\mathrm{v}> T_\mathrm{u}+B$, it is unclear whether the capacity region can be achieved by the multiplexed streaming codes proposed in~\cite{BLKTZA2018}. Therefore, we are motivated to investigate the capacity region for the case $T_\mathrm{v}> T_\mathrm{u}+B$.
\subsection{System Model}\label{subsecChannelModel}
In order to describe the existing results for the packet-erasure channel model, we would like to briefly describe the channel model. A formal description will appear later in the paper. The channel consists of a source and a destination. In each time slot, the source generates a collection of~$k_\mathrm{u}$ urgent symbols and a collection of~$k_\mathrm{v}$ less-urgent symbols. Then, the source encodes the $k_\mathrm{u}+k_\mathrm{v}$ symbols into a collection of~$n$ symbols followed by transmitting the~$n$ symbols through the channel. The collection of~$n$ symbols transmitted in a time slot are either received perfectly by the destination or erased (lost). The fractions $k_{\textrm{u}}/n$ and $k_{\mathrm{v}}/n$ specify the rates of the urgent and less-urgent streams respectively. We call the~$k_\mathrm{u}$ symbols chosen by the source, the~$k_\mathrm{v}$ symbols chosen by the source, the~$n$ symbols transmitted by the source and the~$n$ symbols received by the destination the \emph{urgent source packet}, the \emph{less-urgent source packet}, the \emph{transmitted packet} and the \emph{received packet} respectively. We assume that every urgent source packet generated in a time slot must be decoded with delay~$T_\mathrm{u}$, i.e., within the future~$T_\mathrm{u}$ time slots, and every less-urgent source packet generated in a time slot must be decoded with delay
\begin{equation}
T_\mathrm{v}\ge T_\mathrm{u}. \label{TvGreaterThanTu}
\end{equation}
In order to capture the packet loss behavior over the Internet, we consider the simple scenario where the channel introduces on the discrete timeline a burst erasure of length~$B$.
We assume without loss of generality (wlog) that
\begin{align}
T_\mathrm{v}\ge B, \label{TgreaterThanB}
\end{align}
or otherwise a burst erasure of length~$B$ starting from a certain time slot would prevent the destination to timely recover (within $T_\mathrm{v}$ time slots) both the urgent and less-urgent source packets generated in the same time slot. If the channel is noiseless where $B=0$, no coding is needed to asymptotically achieve all the rate pairs $(k_{\mathrm{v}}/n, k_{\textrm{u}}/n)$ on the boundary of the capacity region that satisfy $k_{\textrm{u}}/n + k_{\mathrm{v}}/n = 1$. Therefore, we assume wlog that
\begin{align}
B\ge 1. \label{assumptionIntro}
\end{align}
\subsection{Existing Results} \label{subsecKnownResults}
For the case $T_\mathrm{u}< B$ under the assumption $T_\mathrm{v}\ge B\ge 1$ by~\eqref{TgreaterThanB} and~\eqref{assumptionIntro}, it can be observed that a burst erasure of length~$B$ starting from a certain time slot would prevent the destination to timely recover (within $T_\mathrm{u}$ time slots) the urgent source packet transmitted in the same time slot. Consequently, no rate pair $(k_{\mathrm{v}}/n, k_{\textrm{u}}/n)$ with $k_{\textrm{u}}/n>0$ is achievable, which implies that the capacity region reduces to the interval $[0, \mathrm{C}(T_\mathrm{v}, B)]$ on the horizontal axis where
\begin{align}
\mathrm{C}(T, B) \triangleq \frac{T}{T+B} \label{defCapacityPTP}
\end{align}
denotes the maximum coding rate of streaming codes with delay~$T$ that correct any length-$B$ burst erasure~\cite[Th.~1 and Th.~2]{MartinianSundberg2004} (see also~\cite[Sec.~III-C]{FKLTZA2018}). Since the case $T_\mathrm{u}< B$ degenerates the multiplexing problem to the previously known single-stream problem described above, we assume wlog that
\begin{align}
T_\mathrm{u} \ge B. \label{TuGreaterThanB}
\end{align}
For the case $T_\mathrm{u}=T_\mathrm{v}$, since the urgent and less-urgent source packets can be viewed as single-stream source packets with delay $T_\mathrm{u}$, any rate pair $(k_{\mathrm{v}}/n, k_{\textrm{u}}/n)$ must satisfy $k_{\textrm{u}}/n + k_{\mathrm{v}}/n \le \mathrm{C}(T_\mathrm{u}, B)$ (recall that the capacity of the single-stream problem equals $\mathrm{C}(T, B)$ by~\cite{MartinianSundberg2004}). In addition, the boundary of the capacity region $k_{\textrm{u}}/n + k_{\mathrm{v}}/n = \mathrm{C}(T_\mathrm{u}, B)$ can be asymptotically achieved by partitioning each source packet of an optimal code with rate $\mathrm{C}(T_\mathrm{u}, B)$ into an urgent source packet and a less-urgent source packet. Consequently, the case $T_\mathrm{u}= T_\mathrm{v}$ degenerates the multiplexing problem to a single-stream problem described above. Therefore, in view of~\eqref{TvGreaterThanTu}, we assume wlog that
\begin{align}
T_\mathrm{v}>T_\mathrm{u}. \label{TuSmallerThanTv}
\end{align}
Summarizing the assumptions \eqref{assumptionIntro}, \eqref{TuGreaterThanB} and~\eqref{TuSmallerThanTv}, we assume in the rest of the paper that
\begin{align}
T_\mathrm{v}> T_\mathrm{u} \ge B \ge 1. \label{assumptionWholePaper}
\end{align}
Any condition that does not satisfy~\eqref{assumptionWholePaper} leads to known results as explained in this and the previous subsections.
For the special case where
\begin{align}
1\le B\le T_\mathrm{u}< T_\mathrm{v} \le T_\mathrm{u}+B, \label{case1Capacity}
\end{align}
systematic streaming codes have been proposed in~\cite{BLKTZA2018} to achieve the capacity region, which is the set of rate pairs $(R_{\mathrm{v}}, R_{\mathrm{u}})$ satisfying
\begin{align*}
\left(1+\frac{T_\mathrm{u}+B-T_\mathrm{v}}{T_\mathrm{u}}\right)R_{\mathrm{v}} + \frac{R_{\mathrm{u}}}{\mathrm{C}(T_\mathrm{u}, B)} \le 1
\end{align*}
and
\begin{align}
R_{\mathrm{v}} + R_{\mathrm{u}} \le \mathrm{C}(T_\mathrm{v}, B) \label{capacityEq2}
\end{align}
as illustrated in Figure~\ref{figureCapacity}(a). In addition, other systematic streaming codes have been proposed in~\cite{BLKTZA2018} to achieve two different rate regions for the cases $T_\mathrm{u}+B< T_\mathrm{v}<T_\mathrm{u}+2B $ and $T_\mathrm{v}\ge T_\mathrm{u}+2B$ respectively, denoted by $\mathcal{R}_{\{T_\mathrm{u}+B< T_\mathrm{v}<T_\mathrm{u}+2B\}}$ and $\mathcal{R}_{\{T_\mathrm{v}\ge T_\mathrm{u}+2B\}}$ respectively. In particular, if only systematic streaming codes are allowed, $\mathcal{R}_{\{T_\mathrm{v}\ge T_\mathrm{u}+2B\}}$ was shown in~\cite{BLKTZA2018} to be the largest.
\begin{figure}[!t]
\centering
\subfigure[Case $T_\mathrm{u}< T_\mathrm{v}\le T_\mathrm{u}+B$]{
\includegraphics[width=3 in]{figureCapacityBurstCase1.pdf}
}
\subfigure[Case $T_\mathrm{v}> T_\mathrm{u}+B$]{
\includegraphics[width=3 in]{figureCapacityBurstCase2.pdf}
}
\caption{Capacity region}
\label{figureCapacity}
\end{figure}
\subsection{Main Contribution}
Under the assumption~\eqref{assumptionWholePaper}, the capacity region for case~\eqref{case1Capacity} was proved in~\cite{BLKTZA2018}. This paper solves the only remaining case
\begin{align}
T_\mathrm{v}> T_\mathrm{u}+B \label{assumptionWholePaper*}
\end{align}
and characterize the capacity region to be the set of rate pairs $(R_{\mathrm{v}}, R_{\mathrm{u}})$ satisfying~\eqref{capacityEq2}
and
\begin{align}
R_{\mathrm{v}} + \frac{R_{\mathrm{u}}}{\mathrm{C}(T_\mathrm{u}, B)} \le 1 \label{capacityEq3}
\end{align}
as illustrated in Figure~\ref{figureCapacity}(b).
In order to prove the achievability, we propose a \emph{non-systematic} streaming code that achieves the non-trivial corner point $\big(\frac{T_\mathrm{v}-T_\mathrm{u}}{T_\mathrm{v}+B},\frac{T_\mathrm{u}}{T_\mathrm{v}+B}\big)$. The proposed multiplexed streaming code is constructed by superimposing two single-stream codes with respective rates~$\frac{T_\mathrm{v}-T_\mathrm{u}}{T_\mathrm{v}-T_\mathrm{u}+B}$ and $\frac{T_\mathrm{u}}{T_\mathrm{u}+B}$ and respective delays~$T_\mathrm{v}-T_\mathrm{u}$ and~$T_\mathrm{u}$.
In order to prove the converse, we first prove a genie-aided outer bound when the channel is subject to a periodic erasure pattern where each period consists of a length-$B$ burst erasure followed by a length-$T_\mathrm{u}$ noiseless duration. The genie provides the least amount of information to the destination so that both the urgent and less-urgent streams can be perfectly recovered at the destination. {Then, we average the genie-aided bound over all offsets of the periodic erasure pattern and combine the averaged genie-aided bound with the existing trivial bound $R_{\mathrm{v}} + R_{\mathrm{u}}\le \mathrm{C}(T_\mathrm{v}, B)$,} resulting an outer bound with four corner points as shown in Figure~\ref{figureCapacity}(b). In particular, for the case $T_\mathrm{v}\ge T_\mathrm{u}+2B$, the converse proof combined with the result in~\cite{BLKTZA2018} as described at the end of Section~\ref{subsecKnownResults} implies that systematic streaming codes alone are sufficient to achieve the capacity region.
\subsection{Paper Outline}
This paper is organized as follows. The notation in this paper is explained in the next subsection. Section~\ref{sectionDefinition} presents the formulation of multiplexed streaming codes for the packet erasure channel and states the main result --- the capacity region for the case $T_\mathrm{v}>T_\mathrm{u}+B$. Section~\ref{sectionAchievability} contains the achievability proof of the main result which involves the construction of a multiplexed streaming code that achieves the non-trivial corner point of the capacity region. Section~\ref{sectionConverse} presents the converse proof of the main result which involves obtaining a genie-aided bound.
Section~\ref{conclusion} concludes this paper.
\subsection{Notation}\label{notation}
The sets of natural numbers, integers, non-negative integers, and non-negative real numbers are denoted by $\mathbb{N}$, $\mathbb{Z}$, $\mathbb{Z}_+$ and $\mathbb{R}_+$ respectively. All the elements of any matrix considered in this paper are taken from a common finite field~$\mathbb{F}$, where~$0$ and~$1$ denote the additive identity and the multiplicative identity respectively. The set of $k$-dimensional row vectors over $\mathbb{F}$ is denoted by $\mathbb{F}^k$, and the set of $k\times n$ matrices over $\mathbb{F}$ is denoted by $\mathbb{F}^{k\times n}$. A row vector in $\mathbb{F}^k$ is denoted by $\mathbf{a} \triangleq [a_0\ a_1\ \ldots \ a_{k-1}]$ where $a_\ell$ denotes the $(\ell+1)^{\text{th}}$ element of $\mathbf{a}$.
The $k$-dimensional identity matrix is denoted by $\mathbf{I}_k$
and the $L\times B$ all-zero matrix is denoted by $\mathbf{0}^{L\times B}$. An $L \times B$ parity matrix of a systematic maximum-distance separable (MDS) $(L+B, L)$-code is denoted by
$\mathbf{V}^{L\times B}$,
which possesses the property that any $L$ columns of $[\mathbf{I}_{L} \ \mathbf{V}^{L\times B}]\in \mathbb{F}^{L\times (L+B)}$ are independent. It is well known that a systematic maximum-distance separable (MDS) $(L+B, L)$-code always exists as long as $|\mathbb{F}|\ge L+B$ \cite{MacWilliamsSloane1988}. We will take all logarithms to base~$2$ throughout this paper. {For any discrete random tuple $(X,Y,Z)$, we let $H(X|Z)$ denote the entropy of $X$ given $Z$, and let $I(X;Y|Z)$ denote the mutual information between $X$ and $Y$ given~$Z$.}
\section{Multiplexed Streaming Codes for Channels with Burst Erasures} \label{sectionDefinition}
\subsection{Problem formulation}
The source wants to simultaneously send a sequence of length-$k_{\textrm{u}}$ packets~$\mathbf{u}^\infty\triangleq \{\mathbf{u}_i\}_{i=0}^{\infty}$ with decoding delay $T_\mathrm{u}$ and a sequence of length-$k_{\mathrm{v}}$ packets~$\mathbf{v}^\infty\triangleq\{\mathbf{v}_i\}_{i=0}^{\infty}$ with decoding delay $T_\mathrm{v}\ge T_\mathrm{u}$ to the destination, where $k_{\textrm{u}}$ and $k_{\mathrm{v}}$ denote the sizes of each urgent packet $\mathbf{u}_i$ and each less-urgent packet $\mathbf{v}_i$ respectively. Each $\mathbf{u}_i$ is an element in $\mathbb{F}^{k_{\textrm{u}}}$ and each $\mathbf{v}_i$ is an element in $\mathbb{F}^{k_{\mathrm{v}}}$ where $\mathbb{F}$ is some finite field. In each time slot~$i\in\mathbb{Z}_+$, the source packets $\mathbf{v}_i$ and $\mathbf{u}_i$ are encoded into a length-$n$ packet $\mathbf{x}_i\in\mathbb{F}^n$ to be transmitted to the destination through an erasure channel, and the destination receives $\mathbf{y}_i\in\mathbb{F}^n \cup \{*\}$ where the received packet $\mathbf{y}_i$ equals either the transmitted packet $\mathbf{x}_i$ or the erasure symbol~`$*$'. The urgent and less-urgent streams are subject to the delay constraints of~$T_\mathrm{u}$ and~$T_\mathrm{v}$ time slots respectively, meaning that the destination must produce an estimate of $\mathbf{u}_i$, denoted by $\hat{\mathbf{u}}_i$, upon receiving $\mathbf{y}_{i+T_\mathrm{u}}$ and produce an estimate of $\mathbf{v}_i$, denoted by $\hat{\mathbf{v}}_i$, upon receiving $\mathbf{y}_{i+T_\mathrm{v}}$.
As mentioned in Section~\ref{subsecChannelModel}, we assume that the channel introduces a burst erasure of length~$B$. Recall that we assume~\eqref{assumptionWholePaper} wlog.
\subsection{Standard definitions}
\begin{Definition} \label{definitionCode}
An $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code consists of the following:
\begin{enumerate}
\item A sequence of less-urgent source packets~$\mathbf{v}^{\infty}$ where $\mathbf{v}_i\in \mathbb{F}^{k_\mathrm{v}}$.
\item A sequence of urgent source packets~$\mathbf{u}^{\infty}$ where $\mathbf{u}_i\in \mathbb{F}^{k_\mathrm{u}}$.
\item
An encoder~$f_i: \underbrace{\mathbb{F}^{k_\mathrm{u} + k_\mathrm{v}} \times \ldots \times \mathbb{F}^{k_\mathrm{u} + k_\mathrm{v}}}_{i +1 \text{ times }} \rightarrow \mathbb{F}^n$ for each $i\in\mathbb{Z}_+$, where $f_i$ is used by the source at time~$i$ to encode $\mathbf{u}_i$ and $\mathbf{v}_i$ such that
\[
\mathbf{x}_i = f_i((\mathbf{u}_0, \mathbf{v}_0), (\mathbf{u}_1, \mathbf{v}_1), \ldots, (\mathbf{u}_i, \mathbf{v}_i)).
\]
\item A decoding function~$\varphi_{i+T_\mathrm{v}}^{(\mathrm{v})}: \underbrace{\mathbb{F}^n\cup\{*\} \times \ldots \times \mathbb{F}^n\cup\{*\}}_{i+T_\mathrm{v}+1 \text{ times }}\rightarrow \mathbb{F}^{k_\mathrm{v}}$ for each $i\in\mathbb{Z}_+$, where $\varphi_{i+T_\mathrm{v}}^{(\mathrm{v})}$ is used by the destination at time $i+T_\mathrm{v}$ to estimate $\mathbf{v}_i$ such that
\begin{align}
\hat{\mathbf{v}}_i= \varphi_{i+T_\mathrm{v}}^{(\mathrm{v})}(\mathbf{y}_0, \mathbf{y}_1, \ldots, \mathbf{y}_{i+T_\mathrm{v}}). \label{defDecoderNonurgent}
\end{align}
\item A decoding function~$\varphi_{i+T_\mathrm{u}}^{(\mathrm{u})}: \underbrace{\mathbb{F}^n\cup\{*\} \times \ldots \times \mathbb{F}^n\cup\{*\}}_{i+T_\mathrm{u}+1 \text{ times }}\rightarrow \mathbb{F}^{k_\mathrm{u}}$ for each $i\in\mathbb{Z}_+$, where $\varphi_{i+T_\mathrm{u}}^{(\mathrm{u})}$ is used by the destination at time $i+T_\mathrm{u}$ to estimate $\mathbf{u}_i$ according to
\begin{align}
\hat{\mathbf{u}}_i= \varphi_{i+T_\mathrm{u}}^{(\mathrm{u})}(\mathbf{y}_0, \mathbf{y}_1, \ldots, \mathbf{y}_{i+T_\mathrm{u}}). \label{defDecoderUrgent}
\end{align}
\end{enumerate}
In addition, the code is said to be $\emph{systematic}$ if $\mathbf{x}_i=[\mathbf{v}_i\ \mathbf{u}_i\ \mathbf{a}_i]$ for some $\mathbf{a}_i\in\mathbb{F}^{n-k_\mathrm{v}-k_\mathrm{u}}$ at each time $i\in\mathbb{Z}_+$.
\end{Definition}
The formal definition of a length-$B$ burst erasure is given below.
\begin{Definition} \label{definitionErasureSeq}
An erasure sequence is a binary sequence denoted by $\mathbf{e}\triangleq\{e_i\}_{i=0}^{\infty}$ where
\begin{equation*}
e_i=\mathbf{1}\{\text{erasure occurs at time~$i$}\}.
\end{equation*}
If $\sum_{i=0}^\infty e_i= B$ holds with all the~$1$'s occupying consecutive positions, $\mathbf{e}$ is called a $B$-erasure sequence. The set of $B$-erasure sequences is denoted by $\Omega_B$. Similarly, for any~$n\ge B$, a length-$n$ binary sequence denoted by $e^n\triangleq\{e_i\}_{i=0}^{n-1}$ is called a $B$-erasure sequence if $e^n$ satisfies $\sum_{i=0}^{n-1} e_i= B$ with all the~$1$'s occupying consecutive positions. The set of length-$n$ $B$-erasure sequences is denoted by $\Omega_B^n$.
\end{Definition}
\medskip
\begin{Definition} \label{definitionChannel}
The mapping $g_n: \mathbb{F}^n \times \{0,1\} \rightarrow \mathbb{F}^n \cup \{*\}$ of the erasure channel is defined as
\begin{align}
g_n(\mathbf{x},e)= \begin{cases}\mathbf{x} & \text{if $e=0$,}\\
* & \text{if $e=1$.}
\end{cases} \label{defChannelLaw}
\end{align}
For any erasure sequence $\mathbf{e}$ and any $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code, the following input-output relation holds for the erasure channel for each $i\in\mathbb{Z}_+$:
\begin{align}
\mathbf{y}_i = g_n(\mathbf{x}_i, e_i).\label{defChannelOutput}
\end{align}
\end{Definition}
\medskip
\begin{Definition} \label{definitionRecover}
An $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code is said to correct a $B$-erasure sequence $\mathbf{e}\in\Omega_B$ if the following holds: For all $i\in\mathbb{Z}_+$ and all $[\mathbf{u}_i\ \mathbf{v}_i]\in \mathbb{F}^{k_\mathrm{u}+k_\mathrm{v}}$, we have
\begin{equation*}
[\hat{\mathbf{u}}_i\ \hat{\mathbf{v}}_i] = [\mathbf{u}_i\ \mathbf{v}_i]
\end{equation*}
where
\begin{equation*}
\hat{\mathbf{u}}_i = \varphi_{i+T_\mathrm{u}}^{(\mathrm{u})}\big( g_n(\mathbf{x}_0, e_0), \ldots, g_n(\mathbf{x}_{i+T_\mathrm{u}}, e_{i+T_\mathrm{u}})\big)
\end{equation*}
and
\begin{equation*}
\hat{\mathbf{v}}_i = \varphi_{i+T_\mathrm{v}}^{(\mathrm{v})}\big( g_n(\mathbf{x}_0, e_0), \ldots, g_n(\mathbf{x}_{i+T_\mathrm{v}}, e_{i+T_\mathrm{v}})\big)
\end{equation*}
due to~\eqref{defDecoderUrgent}, \eqref{defDecoderNonurgent} and~\eqref{defChannelOutput}.
\end{Definition}
\medskip
{The following corollary is a direct consequence of Definition~\ref{definitionCode} and Definition~\ref{definitionRecover}, and its proof is relegated to Appendix~\ref{appendixA-}.
\begin{Corollary}\label{corollaryConcatenate}
Suppose an $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code that corrects any $B$-erasure sequence exists. Then for each $q\in\mathbb{N}$, we can construct a $(qn, qk_\mathrm{v}, qk_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code that corrects any $B$-erasure sequence.
\end{Corollary}
}
\medskip
\begin{Definition} \label{definitionAchievability}
A rate pair $(R_\mathrm{v}, R_\mathrm{u})\in\mathbb{R}_+^2$ is said to be $(T_\mathrm{v}, T_\mathrm{u},B)$-achievable if there exists an $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code which corrects any $B$-erasure sequence such that
$
\frac{k_\mathrm{v}}{n} \ge R_\mathrm{v}
$
and
$
\frac{k_\mathrm{u}}{n} \ge R_\mathrm{u}
$.
\end{Definition}
\medskip
The following corollary is a direct consequence of Definition~\ref{definitionAchievability} and the existing single-stream result~\cite[Th.~2]{MartinianSundberg2004} (see also~\cite[Th.~1]{FKLTZA2018})) stated as follows: Suppose $T\ge B\ge 1$. Then, there exists a streaming code with rate~$\mathrm{C}(T,B)$ which guarantees the recovery of every streaming message with delay~$T$ when the channel is subject to any length-$B$ burst erasure on the discrete timeline.
\begin{Corollary}[{\cite[Th.~2]{MartinianSundberg2004}}] \label{corollaryAch}
The rate pairs $(\mathrm{C}(T_\mathrm{v},B),0)$ and $(0, \mathrm{C}(T_\mathrm{u},B))$ are $(T_\mathrm{v}, T_\mathrm{u},B)$-achievable.
\end{Corollary}
\medskip
\begin{Definition} \label{definitionCapacity}
Fix any $(T_\mathrm{v}, T_\mathrm{u},B)$ that satisfies~\eqref{assumptionWholePaper}. The $(T_\mathrm{v}, T_\mathrm{u},B)$-achievable rate region, denoted by $\mathcal{C}_{T_\mathrm{v}, T_\mathrm{u},B}$, is the closure of the set of $(T_\mathrm{v}, T_\mathrm{u},B)$-achievable rate pairs.
\end{Definition}
\medskip
The following convexity statement regarding~$\mathcal{C}_{T_\mathrm{v}, T_\mathrm{u},B}$ will help us simplify the achievability proof of our main result. The proof is standard and is therefore relegated to Appendix~\ref{appendixA}.
\begin{Corollary} \label{corollaryConvex}
For any $(T_\mathrm{v}, T_\mathrm{u},B)$ that satisfies~\eqref{assumptionWholePaper}, $\mathcal{C}_{T_\mathrm{v}, T_\mathrm{u},B}$ is convex.
\end{Corollary}
\subsection{Main Result} \label{subsecMainResult}
The following theorem is the main result of this paper, which states the capacity region in terms of the single-stream capacity function~$\mathrm{C}(\cdot, \cdot)$ as defined in~\eqref{defCapacityPTP}.
\begin{Theorem}\label{thmMainResult}
Fix any $(T_\mathrm{v},T_\mathrm{u},B)$ that satisfies~\eqref{assumptionWholePaper} and~\eqref{assumptionWholePaper*}. Define
\begin{align}
\mathcal{R}_{\{T_\mathrm{v}> T_\mathrm{u}+B\}}\triangleq \left\{(R_\mathrm{v}, R_\mathrm{u})\in\mathbb{R}_+^2 \left|\: \parbox[c]{1.2 in}{$
R_{\mathrm{v}} + \frac{R_{\mathrm{u}}}{\mathrm{C}(T_\mathrm{u}, B)} \le 1,
\\
R_{\mathrm{v}} + R_{\mathrm{u}} \le \mathrm{C}(T_\mathrm{v}, B)$}\right. \right\} \label{defSetR}
\end{align}
as illustrated in Figure~\ref{figureCapacity}(b).
Then,
\begin{align*}
\mathcal{C}_{T_\mathrm{v}, T_\mathrm{u},B} =
\mathcal{R}_{\{T_\mathrm{v}> T_\mathrm{u}+B\}}.
\end{align*}
\end{Theorem}
\begin{Remark} \label{remark1}
Consider the special case where $T_\mathrm{v} \ge T_\mathrm{u} +2B$. It has been shown in~\cite[Th.~1]{BLKTZA2018} that systematic streaming codes (cf.\ Definition~\ref{definitionCode}) achieve~$\mathcal{R}_{\{T_\mathrm{v}> T_\mathrm{u}+B\}}$. Therefore, it follows from Theorem~\ref{thmMainResult} that systematic streaming codes are sufficient to achieve the capacity region.
\end{Remark}
\begin{Remark} \label{remark2}
Consider the special case where $T_\mathrm{u}+B< T_\mathrm{v} < T_\mathrm{u} +2B$. The systematic streaming codes proposed in~\cite[Th.~1]{BLKTZA2018} cannot achieve the non-trivial corner point $\big(\frac{T_\mathrm{v}-T_\mathrm{u}}{T_\mathrm{v}+B},\frac{T_\mathrm{u}}{T_\mathrm{v}+B}\big)$ of the capacity region $\mathcal{C}_{T_\mathrm{v}, T_\mathrm{u},B}$. On the other hand, our achievability proof presented in Section~\ref{sectionAchievability} proposes a \emph{non-systematic} streaming code that achieves the non-trivial corner point. It remains open whether systematic streaming codes are sufficient to achieve the capacity region.
\end{Remark}
\section{Achievability Proof of Main Result} \label{sectionAchievability}
The achievability proof of Theorem~\ref{thmMainResult} consists of two steps. The first step involves constructing a multiplexed block code which corrects any $B$-erasure sequence. The second step involves constructing a multiplexed streaming code which corrects any $B$-erasure sequence by periodically interleaving the multiplexed block code. The formal definitions and existing results related to multiplexed block codes and periodic interleaving are presented in the following subsection.
\subsection{Preliminaries}
\begin{Definition} \label{definitionCodeBlock}
An $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-block code consists of the following:
\begin{enumerate}
\item A vector of $k_\mathrm{v}$ less-urgent source symbols in~$\mathbb{F}$ denoted by $\vec v\triangleq\big[v[0]\ v[1]\ \ldots\ v[k_\mathrm{v}-1]\big]$.
\item A vector of $k_\mathrm{u}$ urgent source symbols in~$\mathbb{F}$ denoted by $\vec u \triangleq \big[u[0]\ u[1]\ \ldots\ u[k_\mathrm{u}-1]\big]$.
\item
A generator matrix $\mathbf{G}\in \mathbb{F}^{(k_\mathrm{v}+k_\mathrm{u})\times n}$. The codeword is generated according to
\begin{align*}
\big[x[0]\ x[1]\ \ldots \ x[n-1]]=[\vec v\ \vec u\big]\, \mathbf{G}.
\end{align*}
\item A decoding function~$\varphi_{i+T_\mathrm{v}}^{(\mathrm{v})}: \underbrace{\mathbb{F}\cup\{*\} \times \ldots \times \mathbb{F}\cup\{*\}}_{i+T_\mathrm{v}+1 \text{ times }}\rightarrow \mathbb{F}$ for each $i\in\{0, 1, \ldots, k_\mathrm{v}-1\}$, where $\varphi_{i+T_\mathrm{v}}^{(\mathrm{v})}$ is used by the destination at time $i+T_\mathrm{v}$ to estimate $v[i]$ according to
\begin{align*}
\hat{v}[i]=
\begin{cases}
\varphi_{i+T_\mathrm{v}}^{(\mathrm{v})}(y[0], y[1], \ldots, y[i+T_\mathrm{v}]) & \text{if $i+T_\mathrm{v}\le n-1$} \\ \varphi_{i+T_\mathrm{v}}^{(\mathrm{v})}(\underbrace{y[0], \ldots, y[n-1], *, \ldots, *}_{i+T_\mathrm{v}+1\text{ symbols}}) & \text{if $i+T_\mathrm{v}> n-1$.}
\end{cases
\end{align*}
\item A decoding function~$\varphi_{i+T_\mathrm{u}}^{(\mathrm{u})}: \underbrace{\mathbb{F}\cup\{*\} \times \ldots \times \mathbb{F}\cup\{*\}}_{i+T_\mathrm{u}+1 \text{ times }}\rightarrow \mathbb{F}$ for each $i\in\{0, 1, \ldots, k_\mathrm{u}-1\}$, where $\varphi_{i+T_\mathrm{u}}^{(\mathrm{u})}$ is used by the destination at time $i+T_\mathrm{u}$ to estimate $u[i]$ according to
\begin{align*}
\hat{u}[i]=
\begin{cases}
\varphi_{i+T_\mathrm{u}}^{(\mathrm{u})}(y[0], y[1], \ldots, y[i+T_\mathrm{u}]) & \text{if $i+T_\mathrm{u}\le n-1$} \\ \varphi_{i+T_\mathrm{u}}^{(\mathrm{u})}(\underbrace{y[0], \ldots, y[n-1], *, \ldots, *}_{i+T_\mathrm{u}+1\text{ symbols}}) & \text{if $i+T_\mathrm{u}> n-1$.}
\end{cases
\end{align*}
\end{enumerate}
\end{Definition}
The following definition concerns the error-correcting capability of a block code.
\begin{Definition} \label{definitionAchievabilityBlock}
An $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-block code is said to correct a $B$-erasure sequence $e^n\in\Omega_B^n$ if the following holds: Let $y[i]=g_1(x[i], e_i)$ be the symbol received by the destination at time~$i$ for each $i\in\{0, 1,\ldots, n-1\}$ where $g_1$ is defined in~\eqref{defChannelLaw}. Then, $\hat v[i] = v[i]$ holds for all $i\in\{0, 1, \ldots, k_\mathrm{v}-1\}$ and all $v[i]\in \mathbb{F}$, and $\hat u[i] = u[i]$ holds for all $i\in\{0, 1, \ldots, k_\mathrm{u}-1\}$ and all $u[i]\in \mathbb{F}$,
{where
$\hat{v}[i]$
and
$ \hat{u}[i]$ are as defined in Definition~\ref{definitionCodeBlock}.}
\end{Definition}%
The following lemma implies that constructing a streaming code which corrects any length-$B$ burst erasure is not more difficult than constructing a block code which corrects any length-$B$ burst erasure. The proof of the following lemma is deferred to Appendix~\ref{appendixB} because it follows the standard argument of interleaving a block code into a streaming code by means of periodic interleaving~\cite{Forney1971} (see also \cite[Sec.\ IV-A]{MartinianSundberg2004}).
\begin{Lemma}\label{lemmaBlockToStreaming}
Given an $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-block code which corrects any $B$-erasure sequence, we can construct an $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code which corrects any $B$-erasure sequence.
\end{Lemma}
\begin{Example}\label{exampleBlockToConv}
Suppose we are given a $(5, 2, 1, 3, 2)_{\mathbb{F}}$-block code which corrects any length-$2$ burst erasure with generator matrix
\begin{align*}
\mathbf{G}=\left[\begin{array}{cccccc}1&0&0& 1&0\\0&1&0&0&1\\0&0&1&1&1 \end{array}\right].
\end{align*}
Let $\{\mathbf{v}_i\}_{i\in\mathbb{Z}_+}$ and $\{\mathbf{u}_i\}_{i\in\mathbb{Z}_+}$ be the messages of the less-urgent stream and urgent stream respectively where $\mathbf{v}_i=\big[v_i[0] \ v_i[1]\big]\in \mathbb{F}^{2}$ and $\mathbf{u}_i= u_i[0]\in \mathbb{F}$. From time~$i-2$ to $i+4$, the symbols yielded by the $(5, 2, 1, 3, 2)_{\mathbb{F}}$-streaming code constructed by interleaving the block code according to Lemma~\ref{lemmaBlockToStreaming} are shown in Table~\ref{tableInterleave}.
\begin{table}[!t]
\centering
\begin{tabular}{|c|*{8}{c|}}\hline
\backslashbox{\small Symbol}{\small Time $m$}
&\makebox[1.5em]{$i-2$}&\makebox[1.5em]{$i-1$}&\makebox[1.5em]{$i$}&\makebox[1.5em]{$i+1$}&\makebox[1.5em]{$i+2$}
&\makebox[1.5em]{$i+3$}&\makebox[1.5em]{$i+4$} \\\hline
$x_m[0]=v_m[0]$ &\textcolor{red}{$\boxed{v_{i-2}[0]}$} &\magenta{$v_{i-1}[0]$} & \blue{$v_i[0]$} &$v_{i+1}[0]$&$v_{i+2}[0]$&$v_{i+3}[0]$ &$v_{i+4}[0]$ \\\hline
$x_m[1]=v_m[1]$ & $v_{i-2}[1]$ &$\textcolor{red}{\boxed{v_{i-1}[1]}}$ & $\magenta{v_i[1]}$ & \blue{$v_{i+1}[1]$}&$v_{i+2}[1]$&$v_{i+3}[1]$ &$v_{i+4}[1]$ \\\hline
$x_m[2]=u_m[0]$ &$u_{i-2}[0]$ &$u_{i-1}[0]$ & $\textcolor{red}{\boxed{u_i[0]}}$ &\magenta{$u_{i+1}[0]$}& \blue{$u_{i+2}[0]$}&$u_{i+3}[0]$ &$u_{i+4}[0]$ \\\hline
\parbox[c]{1.2 in}{$x_m[3]=v_{m-3}[0] \\ \text{\qquad\qquad}+u_{m-1}[0]$} &$\ddots$ & $\ddots$& $\ddots$ &\textcolor{red}{\boxed{\parbox[c]{0.5 in}{$v_{i-2}[0]\\+u_i[0]$}}} &\magenta{\parbox[c]{0.6 in}{$v_{i-1}[0]\\+u_{i+1}[0]$}} & \blue{\parbox[c]{0.6 in}{$v_i[0]\\+u_{i+2}[0]$}} &$\ddots$ \\\hline
\parbox[c]{1.2 in}{$x_m[4]=v_{m-3}[1]\\ \text{\qquad\qquad}+u_{m-2}[0]$} &$\ddots$ &$\ddots$ &$\ddots$ &$\ddots$ &\textcolor{red}{\boxed{\parbox[c]{0.5 in}{$v_{i-1}[1]\\+ u_{i}[0]$}}} & \parbox[c]{0.6 in}{\magenta{$v_{i}[1]\\+ u_{i+1}[0]$}}& \parbox[c]{0.6 in}{\blue{$v_{i+1}[1]\\+ u_{i+2}[0]$}} \\\hline
\end{tabular}\smallskip
\caption{Symbols yielded by a $(5, 2, 1, 3, 2)_{\mathbb{F}}$-streaming code through interleaving a $(5, 2, 1, 3, 2)_{\mathbb{F}}$-block code.}
\label{tableInterleave}
\end{table}
The symbols in Table~\ref{tableInterleave} which are highlighted in the same color diagonally (in~$\searrow$ direction) {are the components of the same codeword with generator matrix $\mathbf{G}$.} Given the fact that the $(5, 2, 1, 3, 2)_{\mathbb{F}}$-block code corrects any length-$2$ burst erasure, we can see from Table~\ref{tableInterleave} that $\big[v_i[0] \ v_i[1]\big]$ and $u_i[0]$ can be perfectly recovered by time $i+3$ and time $i+2$ respectively as long as the erasure sequence is taken from $\Omega_2^5$.
\end{Example}
Lemma~\ref{lemmaBlockToStreaming} reduces the problem of finding high-rate streaming codes which correct any $B$-erasure sequence to the problem of finding high-rate block codes which correct any $B$-erasure sequence. We will construct high-rate block codes by superimposing the codewords of two single-stream block codes, and therefore we need the following definition of a single-stream block code.
\medskip
\begin{Definition}\label{definitionBlockCodeSingleStream}
An $(n, k, 0, T, 0)_{\mathbb{F}}$-block code is also called an \emph{$(n, k, T)_\mathbb{F}$-block code}. The $(n, k, T)_\mathbb{F}$-block code is said to correct a $B$-erasure sequence $e^n$ if the equivalent $(n, k, 0, T, 0)_{\mathbb{F}}$-block code corrects~$e^n$.
\end{Definition}
\medskip
By Definition~\ref{definitionBlockCodeSingleStream}, an $(n, k, T)_\mathbb{F}$-block code ignores the urgent stream of messages by letting the message size for the urgent stream be zero. The following lemma is a restatement of an existing construction~\cite[Th.~2]{MartinianSundberg2004} (see also \cite[Remark~3]{FKLTZA2018}) of an $(n, k, T)_\mathbb{F}$-block code with rate $k/n=\mathrm{C}(T,B)$ which corrects any length-$B$ burst erasure.
\begin{Lemma}\label{lemmaBlockCodeAch}
Suppose $T\ge B\ge 1$ and let $k\triangleq T$ and $n\triangleq k+B$. Fix any $\mathbb{F}$ with $|\mathbb{F}|\ge T$ such that a systematic MDS $(T, T-B)$-code always exists. Let $\mathbf{P}$ denote the parity matrix of the MDS code such that the generator matrix of the MDS code equals $[\mathbf{I}_{T-B}\ \mathbf{P}]$. Then, the $(n, k, T)_\mathbb{F}$-block code with rate $k/n=\mathrm{C}(T,B)$ and generator matrix~$\mathbf{G}$ defined as
\[
\mathbf{G}\triangleq \left[\begin{array}{c:c:c} \mathbf{I}_B & \mathbf{0}^{B\times (T-B)} & \mathbf{I}_B\\\mathbf{0}^{(T-B)\times B}& \mathbf{I}_{T-B} & \mathbf{P}\end{array}\right]
\]
corrects any length-$B$ burst erasure.
\end{Lemma}
\subsection{Achievability Proof of Theorem~\ref{thmMainResult}}
Fix any $(T_\mathrm{v},T_\mathrm{u},B)$ that satisfies~\eqref{assumptionWholePaper} and~\eqref{assumptionWholePaper*}. Our goal is to show that $\mathcal{C}_{T_\mathrm{v}, T_\mathrm{u},B} \supseteq
\mathcal{R}_{\{T_\mathrm{v}> T_\mathrm{u}+B\}}$ where $\mathcal{R}_{\{T_\mathrm{v}> T_\mathrm{u}+B\}}$ is defined in~\eqref{defSetR} and illustrated in Figure~\ref{figureCapacity}(b). By Corollary~\ref{corollaryConvex}, it suffices to show that the four corner points of $\mathcal{R}_{\{T_\mathrm{v}> T_\mathrm{u}+B\}}$ are $(T_\mathrm{v}, T_\mathrm{u},B)$-achievable. Since the corner points $(0,0)$, $(\mathrm{C}(T_\mathrm{v},B), 0)$ and $(0, \mathrm{C}(T_\mathrm{u},B))$ are $(T_\mathrm{v}, T_\mathrm{u},B)$-achievable by Corollary~\ref{corollaryAch}, it suffices to show that the remaining corner point $\big(\frac{T_\mathrm{v}-T_\mathrm{u}}{T_\mathrm{v}+B},\frac{T_\mathrm{u}}{T_\mathrm{v}+B}\big)$ is $(T_\mathrm{v}, T_\mathrm{u},B)$-achievable. To this end, we let $k_\mathrm{v}\triangleq T_\mathrm{v}-T_\mathrm{u}>0$, $k_\mathrm{u}\triangleq T_\mathrm{u}$ and $n\triangleq T_\mathrm{v}+B$, and will construct an~$(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-block code which corrects any length-$B$ burst erasure, which together with Lemma~\ref{lemmaBlockToStreaming} will imply that $\big(\frac{T_\mathrm{v}-T_\mathrm{u}}{T_\mathrm{v}+B},\frac{T_\mathrm{u}}{T_\mathrm{v}+B}\big)$ is $(T_\mathrm{v}, T_\mathrm{u},B)$-achievable. The construction of the $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-block code is described as follows. Fix any~$\mathbb{F}$ with $|\mathbb{F}|\ge \max\{T_\mathrm{u}, T_\mathrm{v}-T_\mathrm{u}\}$. The vectors of less-urgent source symbols and urgent source symbols are denoted by $\vec v=[v[0]\ v[1]\ \ldots v[T_\mathrm{v}-T_\mathrm{u}-1]]$ and $\vec u=[u[0]\ u[1]\ \ldots u[T_\mathrm{u}-1]]$ respectively. Let $\mathbf{V}$ and $\mathbf{U}$ be the parity matrices of a systematic MDS $(T_\mathrm{v}-T_\mathrm{u}, T_\mathrm{v}-T_\mathrm{u}-B)$-code and a systematic MDS $(T_\mathrm{u}, T_\mathrm{u}-B)$-code respectively, and let
\begin{align}
\mathbf{G}\triangleq \left[\begin{array}{c:c:c} \mathbf{I}_{T_\mathrm{v}-T_\mathrm{u}} & \begin{matrix}\mathbf{I}_B \\ \mathbf{V}\end{matrix} & \mathbf{0}^{(T_\mathrm{v}-T_\mathrm{u})\times B} \\\hdashline \mathbf{0}^{T_\mathrm{u}\times(T_\mathrm{v}-T_\mathrm{u})}& \begin{matrix} \mathbf{I}_B\\ \mathbf{0}^{(T_\mathrm{u}-B)\times B} \end{matrix} & \begin{array}{c:c} \mathbf{0}^{B\times (T_\mathrm{u}-B)} & \mathbf{I}_B\\ \mathbf{I}_{T_\mathrm{u}-B}& \mathbf{U} \end{array}\end{array}\right] \label{defMatrixG}
\end{align}
be the generator matrix of the $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-block code. The intuition behind the construction of $\mathbf{G}$ is to superimpose the codeword generated from the less-urgent symbols
\begin{align}
[x^{(\mathrm{v})}[0]\ x^{(\mathrm{v})}[1]\ \ldots \ x^{(\mathrm{v})}[T_\mathrm{v}-T_\mathrm{u}+B-1]] \triangleq \vec v \left[\begin{array}{c:c}\mathbf{I}_{T_\mathrm{v}-T_\mathrm{u}} & \begin{matrix}\mathbf{I}_B \\ \mathbf{V}\end{matrix}\end{array}\right] \label{defXv}
\end{align}
and the codeword generated from the urgent symbols
\begin{align}
[x^{(\mathrm{u})}[0]\ x^{(\mathrm{u})}[1]\ \ldots \ x^{(\mathrm{u})}[T_\mathrm{u}+B-1]] \triangleq \vec u \left[\begin{array}{c:c}\mathbf{I}_{T_\mathrm{u}} & \begin{matrix}\mathbf{I}_B \\ \mathbf{U}\end{matrix}\end{array}\right] \label{defXu}
\end{align}
such that the two streams interfere with each other in the resultant codeword at~$B$ consecutive positions. Applying Lemma~\ref{lemmaBlockCodeAch} to~\eqref{defXv} and~\eqref{defXu}, we obtain the following two properties for the less-urgent symbols and urgent symbols respectively for each $e^n\in\Omega_B^n$:
\begin{enumerate}
\item[(i)] For each $i\in\{0, 1, \ldots, T_\mathrm{v}-T_\mathrm{u}-1\}$, $v[i]$ can be perfectly recovered from the following set of packets that are not erased by the length-$B$ burst erasure specified by~$e^n$:
\[
\left\{\left. x^{(\mathrm{v})}[\ell]\right| \ell\in\{0, 1, \ldots, \min\{i+T_\mathrm{v}-T_\mathrm{u},T_\mathrm{v}-T_\mathrm{u}+B-1\}\}, e_\ell=0\right\}.
\]
\item[(ii)] For each $i\in\{0, 1, \ldots, T_\mathrm{u}-1\}$, $u[i]$ can be perfectly recovered from the non-erased packets
\[
\left\{\left. x^{(\mathrm{u})}[\ell]\right| \ell\in\{0, 1, \ldots, \min\{i+T_\mathrm{u},T_\mathrm{u}+B-1\}\}, e_\ell=0\right\}.
\]
\end{enumerate}
Combining~\eqref{defMatrixG}, \eqref{defXv} and~\eqref{defXu}, we obtain
\begin{align}
&[x[0]\ x[1]\ \ldots \ x[n-1]] =\notag\\*
& \left[\begin{array}{c:c:c} x^{(\mathrm{v})}[0]\ \ldots\ x^{(\mathrm{v})}[T_\mathrm{v}-T_\mathrm{u}-1] & \begin{matrix}x^{(\mathrm{v})}[T_\mathrm{v}-T_\mathrm{u}]\\ +\\ x^{(\mathrm{u})}[0]\end{matrix}\ \ldots\ \begin{matrix}x^{(\mathrm{v})}[T_\mathrm{v}-T_\mathrm{u}+B-1]\\ + \\ x^{(\mathrm{u})}[B-1]\end{matrix} & x^{(\mathrm{u})}[B]\ \ldots \ x^{(\mathrm{u})}[T_\mathrm{u}+B-1] \end{array}\right] \label{defSymbolsX}
\end{align}
where the last~$B$ symbols of the less-urgent stream codeword interfere with the first~$B$ symbols of the urgent stream codeword. In order to show that the~$(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-block code defined by~\eqref{defMatrixG} corrects any length-$B$ burst erasure, we fix an arbitrary $e^n\in\Omega_B^n$ and would like to show the following two properties:
\begin{enumerate}
\item[(I)] For each $i\in\{0, 1, \ldots, T_\mathrm{v}-T_\mathrm{u}-1\}$, {suppose the less-urgent symbol $v[i]$ is generated at time~$i$. Then, $v[i]$ can be perfectly recovered with delay~$T_\mathrm{v}$ by time $i+T_\mathrm{v}$ from the following set of packets that are not erased by the length-$B$ burst erasure specified by~$e^n$:
\begin{equation}
\left\{\left. x[\ell]\right| \ell\in\{0, 1, \ldots, \min\{i+T_\mathrm{v},n-1\}\}, e_\ell=0\right\}. \label{eqn_nonerased_packet}
\end{equation}}
\item[(II)] For each $i\in\{0, 1, \ldots, T_\mathrm{u}-1\}$, {suppose the urgent symbol $u[i]$ is generated at time~$T_\mathrm{v}-T_\mathrm{u}+i$. Then, $u[i]$ can be perfectly recovered with delay~$T_\mathrm{u}$ by time $(T_\mathrm{v}-T_\mathrm{u}+i) + T_\mathrm{u} = i+T_\mathrm{v}$ from the set of non-erased packets as stated in~\eqref{eqn_nonerased_packet}.}
\end{enumerate}
We will show Properties~(i) and (ii) in each of the following two cases:\\
\textbf{Case $\{\left.i\in\{0, 1, \ldots, T_\mathrm{v}-T_\mathrm{u}-1\} \right|e_i=1\} =\emptyset$:}\\
By the hypothesis, $\vec v$ can be perfectly recovered by time~$T_\mathrm{v}-T_\mathrm{u}-1$ and hence Property~(I) holds. It remains to prove Property~(II). To this end, we first observe from~\eqref{defSymbolsX} that $x^{(\mathrm{v})}[T_\mathrm{v}-T_\mathrm{u}], x^{(\mathrm{v})}[T_\mathrm{v}-T_\mathrm{u}+1], \ldots, x^{(\mathrm{v})}[T_\mathrm{v}-T_\mathrm{u}+B-1]$ can be perfectly recovered by time~$T_\mathrm{v}-T_\mathrm{u}-1$ because they are functions of~$\vec v$ by~\eqref{defXv}. Therefore, it follows from~\eqref{defSymbolsX} and~\eqref{defXu} that the destination can construct
\[
\left\{\left. x^{(\mathrm{u})}[\ell]\right| \ell\in\{0, 1, \ldots, \min\{i+T_\mathrm{u},T_\mathrm{u}+B-1\}\}, e_\ell=0\right\}
\]
by time~$i+T_\mathrm{v}$ for each $i\in\{0, 1, \ldots, T_\mathrm{u}-1\}$, which implies from the fact $e^n\in\Omega_B^n$ and Property~(ii) that the destination can perfectly recover $x^{(\mathrm{u})}[i]$ by time $i+T_\mathrm{v}$ for each $i\in\{0, 1, \ldots, T_\mathrm{u}-1\}$, and hence Property~(II) holds.
\\
\textbf{Case $\{\left.i\in\{0, 1, \ldots, T_\mathrm{v}-T_\mathrm{u}-1\} \right|e_i=1\} \ne \emptyset$:}\\
In view of the hypothesis and~\eqref{defSymbolsX} and using the fact $e^n\in\Omega_B^n$, we conclude that the destination receives $x^{(\mathrm{u})}[i]$ at time $T_\mathrm{v}-T_\mathrm{u}+i$ for each $i\in\{B, B+1, \ldots, T_\mathrm{u}+B-1\}$ and hence Property~(II) holds. It remains to prove Property~(I). To this end, we first observe from {Property~(ii)} that the destination can perfectly recover $x^{(\mathrm{u})}[i]=u[i]$ by time~$i+T_\mathrm{v}$ for each $i\in\{0, 1, \ldots, T_\mathrm{u}-1\}$. Therefore, it follows from~\eqref{defSymbolsX} that the destination can construct
\[
\left\{\left. x^{(\mathrm{v})}[\ell]\right| \ell\in\{0, 1, \ldots, \min\{i+T_\mathrm{v},T_\mathrm{v}-T_\mathrm{u}+B-1\}\}, e_\ell=0\right\}
\]
by time~$i+T_\mathrm{v}$ for each $i\in\{0, 1, \ldots, T_\mathrm{v}-T_\mathrm{u}+B-1\}$, which implies from the fact $e^n\in\Omega_B^n$ and Property~(i) that the destination can perfectly recover $x^{(\mathrm{v})}[i]$ by time $i+T_\mathrm{v}$ for each $i\in\{0, 1, \ldots, T_\mathrm{v}-T_\mathrm{u}-1\}$, and hence Property~(I) holds.
Combining the above two cases, we conclude the Properties~(I) and (II) hold for all $e^n\in\Omega_B^n$, which implies that the~$(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-block code defined by~\eqref{defMatrixG} corrects any length-$B$ burst erasure, which together with Lemma~\ref{lemmaBlockToStreaming} implies that $\big(\frac{T_\mathrm{v}-T_\mathrm{u}}{T_\mathrm{v}+B},\frac{T_\mathrm{u}}{T_\mathrm{v}+B}\big)$ is $(T_\mathrm{v}, T_\mathrm{u},B)$-achievable (cf.\ Definition~\ref{definitionAchievability}).
\section{Converse Proof of Main Result} \label{sectionConverse}
Our goal is to show that
$
\mathcal{C}_{T_\mathrm{v}, T_\mathrm{u},B} \subseteq
\mathcal{R}_{\{T_\mathrm{v}> T_\mathrm{u}+B\}}
$.
Equivalently, we would like to show that~\eqref{capacityEq2} and~\eqref{capacityEq3} hold.
To this end, we let $(R_\mathrm{v}, R_\mathrm{u})$ be a rate pair in $\mathcal{C}_{T_\mathrm{v}, T_\mathrm{u},B}$. Fix an arbitrary~$\delta>0$. By Definition~\ref{definitionAchievability} and Definition~\ref{definitionCapacity}, there exists an $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code which corrects any $B$-erasure sequence such that
\begin{align}
\frac{k_\mathrm{v}}{n}\ge R_\mathrm{v}-\delta \label{converseProofRateRv}
\end{align}
and
\begin{align}
\frac{k_\mathrm{u}}{n}\ge R_\mathrm{u}-\delta. \label{converseProofRateRu}
\end{align}
\subsection{Sum-Rate Bound~\eqref{capacityEq2}}
By Definition~\ref{definitionCode}, the $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code can be viewed as an $(n, k_\mathrm{v}+k_\mathrm{u}, 0, T_\mathrm{v}, 0)_{\mathbb{F}}$-streaming code which corrects any $B$-erasure sequence. Consequently, the sum-rate for the $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming codes must not exceed the single-stream capacity $\mathrm{C}(T_\mathrm{v}, B)$ (cf.\ Section~\ref{subsecKnownResults}), which implies that
\begin{align}
\frac{k_\mathrm{v}+k_\mathrm{u}}{n} \le \mathrm{C}(T_\mathrm{v}, B). \label{eq1ConverseProof}
\end{align}
Combining~\eqref{eq1ConverseProof}, \eqref{converseProofRateRv} and \eqref{converseProofRateRu}, we have
\begin{align*}
R_\mathrm{u} + R_\mathrm{v} \le \mathrm{C}(T_\mathrm{v}, B) + 2\delta,
\end{align*}
which then implies~\eqref{capacityEq2} by taking the limit $\delta\to 0$.
\subsection{Genie-Aided Bound~\eqref{capacityEq3}}
\begin{figure}[!t]
\centering
\includegraphics[width=4 in]{erasurePattern1.pdf}
\caption{The periodic erasure sequence $\boldsymbol{\varepsilon}^{(0)}$.}
\label{figureErasurePattern}
\end{figure}
{Given the $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code that corrects any $B$-erasure sequence and satisfies~\eqref{converseProofRateRv} and~\eqref{converseProofRateRu}, we use Corollary~\ref{corollaryConcatenate} to construct for each $q\in\mathbb{N}$ a $(qn, qk_\mathrm{v}, qk_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code that corrects any $B$-erasure sequence and satisfies~\eqref{converseProofRateRv} and~\eqref{converseProofRateRu}.
Fix any $q\in\mathbb{N}$.
In order to develop a genie-aided bound associated with the $(qn, qk_\mathrm{v}, qk_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code, we let~$\mathbf{u}_0$ and~$\mathbf{v}_0$ be the urgent and less-urgent source packets which are uniformly distributed on $\mathbb{F}^{qk_\mathrm{u}}$ and $\mathbb{F}^{qk_\mathrm{v}}$ respectively, and assume that $\{(\mathbf{u}_i,\mathbf{v}_i)\}_{i\in\mathbb{Z}_+}$ are independent and identically distributed (i.i.d.).}
{The genie-aided bound associated with the $(qn, qk_\mathrm{v}, qk_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code is obtained by considering the following set of periodic erasure patterns:} Define
\begin{align*}
n_\mathrm{u}\triangleq T_\mathrm{u}+B
\end{align*}
and construct for each $\Delta\in\{0, 1, \ldots, T_\mathrm{u}+B-1\}$ a periodic erasure pattern $\boldsymbol{\varepsilon}^{(\Delta)}=\{\varepsilon_i^{(\Delta)}\}_{i=0}^\infty$ as
\begin{align}
\varepsilon_i^{(\Delta)} \triangleq
\begin{cases}
1 & \text{if $i-\Delta\in \{\kappa n_\mathrm{u}, \kappa n_\mathrm{u}+1, \ldots, \kappa n_\mathrm{u} + B-1\}$ for some $\kappa\in\mathbb{Z}$,} \\
0 & \text{otherwise.}
\end{cases} \label{defVarepsilon}
\end{align}
In other words, we construct $\boldsymbol{\varepsilon}^{(\Delta)}$ by offsetting the periodic erasure sequence $\boldsymbol{\varepsilon}^{(0)}$ by~$\Delta$ time slots to the right, where $\boldsymbol{\varepsilon}^{(0)}$ is illustrated in Figure~\ref{figureErasurePattern}.
By construction, each $\boldsymbol{\varepsilon}^{(\Delta)}$ has a period of $n_\mathrm{u}$ time slots and each period consists of an initial length-$B$ burst erasure followed by a length-$T_\mathrm{u}$ noiseless duration.
{Fix a erasure pattern $\boldsymbol{\varepsilon}^{(\Delta)}$, and we will obtain a corresponding genie-aided bound associated with the $(qn, qk_\mathrm{v}, qk_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code in the following.} Let
\begin{align}
\beta_m
= H\big(\mathbf{x}_m\big| \mathbf{u}^\infty, \{\mathbf{x}_\ell\}_{\ell=0}^{m-1}\big) \label{eq5ConverseProof}
\end{align}
be the conditional entropy of~$\mathbf{x}_m$ conditioned on $(\mathbf{u}^\infty, \{\mathbf{x}_\ell\}_{\ell=0}^{m-1})$ for each~$m\in \{0, 1, \ldots, qn_\mathrm{u}-1\}$, which specifies the approximate number of bits required to construct~$\mathbf{x}_m$ based on the knowledge of $(\mathbf{u}^\infty, \{\mathbf{x}_\ell\}_{\ell=0}^{m-1})$. Suppose we use a standard arithmetic code~\cite[Ch.~13.3]{Cover06} to compress $\mathbf{x}_m$ conditioned on each outcome assumed by $(\mathbf{u}^\infty, \{\mathbf{x}_\ell\}_{\ell=0}^{m-1})$ for each $m\in\{0, 1, \ldots, qn_\mathrm{u}-1\}$, and let $\hat X_m$ be the noiseless compressed version of $\mathbf{x}_m$ {accessible to the genie} that satisfies the equality
\begin{align}
H\big(\mathbf{x}_m\big| \mathbf{u}^\infty, \{\mathbf{x}_\ell\}_{\ell=0}^{m-1},\hat X_m\big)=0 \label{eq6ConverseProof}
\end{align}
and the inequality (cf.\ \cite[Ch.~13.3]{Cover06})
\begin{align}
H(\hat X_m)
&\le H\big(\mathbf{x}_m\big| \mathbf{u}^\infty, \{\mathbf{x}_\ell\}_{\ell=0}^{m-1}\big) + 2 \notag \\*
& = \beta_m + 2 \label{eq7ConverseProof}
\end{align}
where the last equality is due to~\eqref{eq5ConverseProof}.
{According to the arithmetic code,} the random variable $\hat X_m$ is constructed by first generating $\{\mathbf{u}_\ell\}_{\ell=0}^{m}$ and $\{\mathbf{x}_\ell\}_{\ell=0}^{m-1}$ followed by generating $\hat X_m$ based on the conditional distribution $p_{\hat X_m|\{\mathbf{u}_\ell\}_{\ell=0}^{m},\{\mathbf{x}_\ell\}_{\ell=0}^{m-1}}$. {Note that for the special case where the $(qn, qk_\mathrm{v}, qk_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code is systematic, it can be seen that $\{\mathbf{x}_\ell\}_{\ell=0}^{m-1}$ contains $\{\mathbf{v}_\ell\}_{\ell=0}^{m-1}$ and hence setting $\hat X_m$ equal to $\mathbf{v}_m$ suffices to yield~\eqref{eq6ConverseProof} and~\eqref{eq7ConverseProof}. However, for the general case where the streaming code can be non-systematic, the arithmetic coding argument is needed for obtaining~\eqref{eq6ConverseProof} and~\eqref{eq7ConverseProof}.}
In order to obtain the genie-aided bound corresponding to the fixed~$q$, the fixed~$(qn, qk_\mathrm{v}, qk_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code and the fixed~$\boldsymbol{\varepsilon}^{(\Delta)}$, we suppose the genie provides the destination with
$\{\hat X_m\,|\,m\in\mathcal{A}_{\Delta}\}$
where
\begin{equation}
\mathcal{A}_{\Delta}\triangleq \big\{i\in\mathbb{Z}_+\big| \varepsilon_i^{(\Delta)}=1 \big\} \label{defSetA}
\end{equation}
{denotes the set of time indices at which the transmitted packets are erased according to~$\boldsymbol{\varepsilon}^{(\Delta)}$.}
To simplify notation, we let $\mathcal{A}_{\Delta}^c \triangleq \mathbb{Z}_+\setminus \mathcal{A}_{\Delta}$.
Then we claim that every urgent source packet and every less-urgent source packet can be recovered when the erasure sequence is $\boldsymbol{\varepsilon}^{(\Delta)}$ (cf.\ \eqref{defVarepsilon}). To prove the claim, we consider the following chain of inequalities:
\begin{align}
&H\big(\{(\mathbf{u}_i, \mathbf{v}_{i})\}_{i=0}^{q n_\mathrm{u}-T_\mathrm{u}-T_\mathrm{v}-1}\big|\{\mathbf{x}_m: \mathcal{A}_{\Delta}^c\cap[0, q n_\mathrm{u}-1]\}, \{\hat X_m: m \in \mathcal{A}_{\Delta}\cap[0,q n_\mathrm{u}-1]\} \big) \notag\\*
&\le H\big(\{\mathbf{x}_i\}_{i=0}^{q n_\mathrm{u}-T_\mathrm{u}-1}\big|\{\mathbf{x}_m: \mathcal{A}_{\Delta}^c\cap[0, q n_\mathrm{u}-1]\}, \{\hat X_m: m \in \mathcal{A}_{\Delta}\cap[0,q n_\mathrm{u}-1]\} \big)\label{eq8ConverseProofa} \\
&= \sum_{i=0}^{q n_\mathrm{u}-T_\mathrm{u}-1} H\big(\mathbf{x}_i\big|\{\mathbf{x}_\ell\}_{\ell=0}^{i-1}, \{\mathbf{x}_m: m\in\mathcal{A}_{\Delta}^c\cap [i, q n_\mathrm{u}-1]\}, \{\hat X_m: m \in \mathcal{A}_{\Delta}\cap[0,q n_\mathrm{u}-1]\}\big) \notag\\
&\le \sum_{i=0}^{q n_\mathrm{u}-T_\mathrm{u}-1} H\big(\mathbf{x}_i\big|\{\mathbf{x}_\ell\}_{\ell=0}^{i-1}, \{\mathbf{x}_m: m\in\mathcal{A}_{\Delta}^c\cap [i, i+T_\mathrm{u}]\}, \{\hat X_m: m \in \mathcal{A}_{\Delta}\cap[0,q n_\mathrm{u}-1]\}\big) \notag\\
&= \sum_{i=0}^{q n_\mathrm{u}-T_\mathrm{u}-1} \!\!\!\!\! H\big(\mathbf{x}_i\big|\{\mathbf{u}_\ell\}_{\ell=0}^{i},\{\mathbf{x}_\ell\}_{\ell=0}^{i-1},\{\mathbf{x}_m: m\in\mathcal{A}_{\Delta}^c\cap[i, i+T_\mathrm{u}]\}, \{\hat X_m: m \in \mathcal{A}_{\Delta}\cap[0,q n_\mathrm{u}-1]\}\big) \label{eq8ConverseProofb}\\
&\le \sum_{i=0}^{q n_\mathrm{u}-T_\mathrm{u}-1} \mathbf{1}\{\varepsilon_i^{(\Delta)}=1\}\times H\big(\mathbf{x}_i\big| \{ \mathbf{u}_\ell\}_{\ell=0}^i, \{\mathbf{x}_\ell\}_{\ell=0}^{i-1}, \hat X_i \big) \label{eq8ConverseProofc}\\
&= 0\label{eq8ConverseProof}
\end{align}
where
\begin{itemize}
\item \eqref{eq8ConverseProofa} is due to that fact that $\{(\mathbf{u}_i, \mathbf{v}_{i})\}_{i=0}^{q n_\mathrm{u}-T_\mathrm{u}-T_\mathrm{v}-1}$ is a function of~$\{\mathbf{x}_i\}_{i=0}^{qn_\mathrm{u}-T_\mathrm{u}-1}$.
\item \eqref{eq8ConverseProofb} is due to the fact that $\{\mathbf{u}_\ell\}_{\ell=0}^{i}$ is a function of $(\{\mathbf{x}_\ell\}_{\ell=0}^{i-1},\{\mathbf{x}_m: m\in\mathcal{A}_{\Delta}^c\cap[i, i+T_\mathrm{u}]\})$, which is a direct consequence of the fact that the $(qn, qk_\mathrm{v}, qk_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code corrects any $B$-erasure sequence.
\item \eqref{eq8ConverseProofc} is due to the definition of~$\mathcal{A}_{\Delta}$ in~\eqref{defSetA}.
\item \eqref{eq8ConverseProof} is due to~\eqref{eq6ConverseProof}.
\end{itemize}
{Equation~\eqref{eq8ConverseProof} implies that the urgent and less-urgent source packets generated before time~$q n_\mathrm{u}-T_\mathrm{u}-T_\mathrm{v}-1$ can be recovered by the destination by time $q n_\mathrm{u}+1$ if the erasure sequence is $\boldsymbol{\varepsilon}^{(\Delta)}$ and the genie provides the destination with the side information $\{\hat X_m: m \in \mathcal{A}_{\Delta}\cap[0,q n_\mathrm{u}-1]\}$.}
Therefore, it follows from~\eqref{eq8ConverseProof} and~\eqref{eq7ConverseProof} that
\begin{align}
q(k_\mathrm{u}+k_\mathrm{v})(q n_\mathrm{u}-T_\mathrm{u}-T_\mathrm{v}) & = H\big(\{(\mathbf{u}_i, \mathbf{v}_{i})\}_{i=0}^{q n_\mathrm{u}-T_\mathrm{u}-T_\mathrm{v}-1}\big) \notag\\
& \le H\big(\{\mathbf{x}_m: \mathcal{A}_{\Delta}^c\cap[0, q n_\mathrm{u}-1]\}, \{\hat X_m: m \in \mathcal{A}_{\Delta}\cap[0,q n_\mathrm{u}-1]\}\big) \notag\\
& \le H\big(\{\mathbf{x}_m: \mathcal{A}_{\Delta}^c\cap[0, q n_\mathrm{u}-1]\}\big) + H\big(\{\hat X_m: m \in \mathcal{A}_{\Delta}\cap[0,q n_\mathrm{u}-1]\}\big)\notag\\
& \le \sum_{ m \in \mathcal{A}_{\Delta}^c\cap[0,q n_\mathrm{u}-1]} H(\mathbf{x}_m) + \sum_{ m \in \mathcal{A}_{\Delta}\cap[0,q n_\mathrm{u}-1]}(\beta_m+2). \label{eq9ConverseProof}
\end{align}
{
Taking average on both sides of~\eqref{eq9ConverseProof} over $\Delta\in\{0, 1, \ldots, T_\mathrm{u}+B-1\}$, we obtain
\begin{align*}
q(k_\mathrm{u}+k_\mathrm{v})(q n_\mathrm{u}-T_\mathrm{u}-T_\mathrm{v}) \le \frac{1}{T_\mathrm{u}+B}\sum_{\Delta=0}^{T_\mathrm{u}+B-1}\bigg( \sum_{ m \in \mathcal{A}_{\Delta}^c\cap[0,q n_\mathrm{u}-1]} H(\mathbf{x}_m) + \sum_{ m \in \mathcal{A}_{\Delta}\cap[0,q n_\mathrm{u}-1]}(\beta_m+2)\bigg),
\end{align*}
which together with the definition of~$\mathcal{A}_\Delta$ in~\eqref{defSetA} implies that
\begin{align}
q(k_\mathrm{u}+k_\mathrm{v})(q n_\mathrm{u}-T_\mathrm{u}-T_\mathrm{v}) \le \frac{T_\mathrm{u}}{T_\mathrm{u}+B}\sum_{m=0}^{q n_\mathrm{u}-1} H(\mathbf{x}_m) + \frac{B}{T_\mathrm{u}+B}\sum_{m=0}^{q n_\mathrm{u}-1}(\beta_m+2). \label{eq9ConverseProof+}
\end{align}
Since $H(\mathbf{x}_m) \le qn$ for each $m$ by construction and
\begin{align*}
\sum_{m=0}^{q n_\mathrm{u}-1}\beta_m &= H\big(\{\mathbf{x}_\ell\}_{\ell=0}^{q n_\mathrm{u}-1}\big| \mathbf{u}^\infty \big)\notag\\*
&\le H\big(\{\mathbf{v}_\ell\}_{\ell=0}^{q n_\mathrm{u}-1}\big) \notag\\*
& \le q^2 n_\mathrm{u}k_\mathrm{v}
\end{align*}
due to~\eqref{eq5ConverseProof} and the fact that $\{\mathbf{x}_\ell\}_{\ell=0}^{q n_\mathrm{u}-1}$ is a function of $\{\mathbf{u}_\ell,\mathbf{v}_\ell\}_{\ell=0}^{q n_\mathrm{u}-1}$, it follows from~\eqref{eq9ConverseProof+} that
\begin{align}
q(k_\mathrm{u}+k_\mathrm{v})(q n_\mathrm{u}-T_\mathrm{u}-T_\mathrm{v}) \le
\frac{q^2 n n_\mathrm{u}T_\mathrm{u}}{T_\mathrm{u}+B}+ \frac{ q^2 n_\mathrm{u}k_\mathrm{v}B}{T_\mathrm{u}+B}+ \frac{2qn_\mathrm{u}B}{T_\mathrm{u}+B}. \label{eq10ConverseProof}
\end{align}
}
Dividing both sides of~\eqref{eq10ConverseProof} by~$q^2nn_\mathrm{u}$, we obtain
\begin{align*}
\left(\frac{k_\mathrm{u}+k_\mathrm{v}}{n}\right)\left(1-\frac{T_\mathrm{u}+T_\mathrm{v}}{q\mathrm{n}_\mathrm{u}}\right) \le \frac{T_\mathrm{u}}{T_\mathrm{u}+B}+ \frac{B}{T_\mathrm{u}+B}\times\frac{k_\mathrm{v}}{n}+\frac{2B}{qn(T_\mathrm{u}+B)},
\end{align*}
which together with the fact $n_\mathrm{u}=T_\mathrm{u}+B$ implies that
\begin{align}
\left(1-\frac{T_\mathrm{u}+T_\mathrm{v}}{q\mathrm{n}_\mathrm{u}}\right)\frac{k_\mathrm{u}}{n} +\left(\frac{T_\mathrm{u}}{n_\mathrm{u}}-\frac{T_\mathrm{u}+T_\mathrm{v}}{q\mathrm{n}_\mathrm{u}}\right)\frac{k_\mathrm{v}}{n} \le \frac{T_\mathrm{u}}{n_\mathrm{u}}+\frac{2B}{qnn_\mathrm{u}}. \label{eq11ConverseProof}
\end{align}
Combining~\eqref{eq11ConverseProof}, the definition of~$\mathrm{C}(\cdot, \cdot)$ in~\eqref{defCapacityPTP}, \eqref{converseProofRateRv} and~\eqref{converseProofRateRu}, we obtain
\begin{align}
\left(1-\frac{T_\mathrm{u}+T_\mathrm{v}}{q\mathrm{n}_\mathrm{u}}\right)(R_\mathrm{u}-\delta) +\left(\mathrm{C}(T_\mathrm{u}, B)-\frac{T_\mathrm{u}+T_\mathrm{v}}{q\mathrm{n}_\mathrm{u}}\right)(R_\mathrm{v}-\delta) \le \mathrm{C}(T_\mathrm{u}, B)+\frac{2B}{qnn_\mathrm{u}}.\label{eq12ConverseProof}
\end{align}
Taking the limit $q\to\infty$ followed by letting $\delta\to 0$ on both sides of~\eqref{eq12ConverseProof}, we obtain~\eqref{capacityEq3}.
\section{Concluding Remarks} \label{conclusion}
We have investigated streaming codes that multiplex an urgent stream of messages with delay constraint~$T_\mathrm{u}$ and a less-urgent stream of messages with delay constraint~$T_\mathrm{v}$ over the deterministic burst-erasure model where $T_\mathrm{v}\ge T_\mathrm{u}$. The capacity region has been proved for the case $T_\mathrm{v}> T_\mathrm{u}+B$ under assumption~\ref{assumptionWholePaper}, which together with the existing results described in Section~\ref{subsecKnownResults} implies the full characterization of the capacity region for all parameters of $(T_\mathrm{v}, T_\mathrm{u},B)$. In particular, the capacity regions for the case $T_\mathrm{u}<T_\mathrm{v}\le T_\mathrm{u} +B$ and the case $T_\mathrm{v}> T_\mathrm{u} +B$ are shown in Figure~\ref{figureCapacity}(a) and Figure~\ref{figureCapacity}(b) respectively. While systematic streaming codes alone achieve the capacity region for the case~$T_\mathrm{u}< T_\mathrm{v}\le T_\mathrm{u} +B$ and the case $T_\mathrm{v}\ge T_\mathrm{u} +2B$ by~\cite[Th.~3]{BLKTZA2018} and Remark~\ref{remark2} respectively, it remains open whether systematic streaming codes are sufficient to achieve the capacity region for the case $T_\mathrm{u}+B < T_\mathrm{v} < T_\mathrm{u}+2B$.
The main result in this paper, i.e., Theorem~\ref{thmMainResult}, is readily generalized to the following deterministic model that generates multiple burst erasures as explained in~{\cite[Remark 1]{EKT2014}} (see also {\cite[Sec.~II]{BLKTZA2018}}): The channel introduces multiple burst erasures on the discrete timeline where the length of each burst does not exceed~$B$ and the length of the guard space between two adjacent bursts is at least~$T_\mathrm{v}$. Future work may generalize the main result to the erasure model which introduces both burst and arbitrary erasures as investigated in~\cite{BPKTA17} and~\cite{FKLTZA2018}.
\appendices
\section{Proof of Corollary~\ref{corollaryConcatenate}} \label{appendixA-}
{Fix an $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code that corrects any $B$-erasure sequence and fix any $q\in\mathbb{N}$. Construct $q$ instances of the $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code. Recalling Definition~\ref{definitionCode}, we concatenate the length-$n$ transmitted packets generated at time~$i$ by the $q$ instances of the streaming code and construct at time~$i$ a length-$(qn)$ transmitted packet for each~$i\in\mathbb{Z}_+$. Due to Definition~\ref{definitionCode} and Definition~\ref{definitionRecover}, the concatenated code associated with the sequence of length-$(qn)$ transmitted packets can be viewed as a $(qn, qk_\mathrm{v}, qk_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code which corrects any $B$-erasure sequence.
}
\section{Proof of Corollary~\ref{corollaryConvex}} \label{appendixA}
By Definition~\ref{definitionAchievability} and Definition~\ref{definitionCapacity}, it suffices to prove the following: For any $(n^{(0)}, k_\mathrm{v}^{(0)}, k_\mathrm{u}^{(0)}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code and any $(n^{(1)}, k_\mathrm{v}^{(1)}, k_\mathrm{u}^{(1)}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code which correct any $B$-erasure sequence, there exists an $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code which corrects any $B$-erasure sequence where
\begin{align}
\frac{k_\mathrm{v}}{n} = \frac{k_\mathrm{v}^{(0)}}{2n^{(0)}} + \frac{ k_\mathrm{v}^{(1)}}{2n^{(1)}}\label{eq1AppendixA}
\end{align}
and
\begin{align}
\frac{k_\mathrm{u}}{n} = \frac{k_\mathrm{u}^{(0)}}{2n^{(0)}} + \frac{ k_\mathrm{u}^{(1)}}{2n^{(1)}}. \label{eq2AppendixA}
\end{align}
In order to show~\eqref{eq1AppendixA} and~\eqref{eq2AppendixA}, {we concatenate $n^{(1)}$ instances of the length-$n^{(0)}$ transmitted packet generated at time~$i$ and $n^{(0)}$ instances of the length-$n^{(1)}$ transmitted packet generated at time~$i$ and form at time~$i$ a new length-$(2n^{(0)}n^{(1)})$ transmitted packet for each~$i\in\mathbb{Z}_+$.} By construction, the concatenated code associated with the sequence of length-$(2n^{(0)}n^{(1)})$ transmitted packets can be viewed as a $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code which corrects any $B$-erasure sequence where $n=2n^{(0)}n^{(1)}$, $k_\mathrm{v}=n^{(1)}k_\mathrm{v}^{(0)} + n^{(0)}k_\mathrm{v}^{(1)}$ and $k_\mathrm{u}=n^{(1)}k_\mathrm{u}^{(0)} + n^{(0)}k_\mathrm{u}^{(1)}$. In particular, the concatenated code satisfies~\eqref{eq1AppendixA} and~\eqref{eq2AppendixA}.
\section{Proof of Lemma~\ref{lemmaBlockToStreaming}} \label{appendixB}
Suppose we are given an $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-block code which corrects any $B$-erasure sequence, and let
$\mathbf{G}\in\mathbb{F}^{(k_\mathrm{v}+ k_\mathrm{u})\times n}$
be the generator matrix. By Definition~\ref{definitionCodeBlock}, the block code has the following properties:
\begin{enumerate}
\item[(i)] The length of the block code is~$n$.
\item[(ii)] From time $0$ to $n-1$, the symbols
\begin{align*}
\big[x[0] \ x[1]\ \cdots \ x[n-1]\big]=\big[\vec v \ \vec u\big]\mathbf{G}
\end{align*}
are transmitted.
\item[(iii)] Upon receiving
\begin{align*}
&\big[y[0]\ \ldots\ y[\min\{\ell+T_\mathrm{v},n-1\}]\big] \notag\\
&\quad= \big[g_1(x[0], e_0)\ \ldots\ g_1(x[\min\{\ell+T_\mathrm{v},n-1\}], e_{\min\{\ell+T_\mathrm{v},n-1\}})\big],
\end{align*}
the destination can perfectly recover $v[\ell]$ by time $\min\{\ell+T_\mathrm{v},n-1\}$ for each $\ell\in\{0, 1, \ldots, k_\mathrm{v}-1\}$ as long as $e^n\in\Omega_B^n$.
\item[(iv)] Upon receiving
\begin{align*}
&\big[y[0]\ \ldots\ y[\min\{\ell+T_\mathrm{u},n-1\}]\big] \notag\\
&\quad= \big[g_1(x[0], e_0)\ \ldots\ g_1(x[\min\{\ell+T_\mathrm{u},n-1\}], e_{\min\{\ell+T_\mathrm{u},n-1\}})\big],
\end{align*}
the destination can perfectly recover $u[\ell]$ by time $\min\{\ell+T_\mathrm{u},n-1\}$ for each $\ell\in\{0, 1, \ldots, k-1\}$ as long as $e^n\in\Omega_B^n$.
\end{enumerate}
In order to construct $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code (cf.\ Definition~\ref{definitionCode}) which corrects any length-$B$ burst erasure, we first let $\{\mathbf{v}_i\}_{i=0}^\infty$ denote a sequence of length-$k_\mathrm{v}$ less-urgent packets
and let $\{\mathbf{u}_i\}_{i=0}^\infty$ denote a sequence of length-$k_\mathrm{u}$ urgent packets, and let $v_i[\ell]$ and $u_i[\ell]$ denote the $(\ell+1)^{\text{th}}$ element of $\mathbf{v}_i$ and $\mathbf{u}_i$ respectively such that
\begin{align}
\mathbf{v}_i \triangleq [v_i[0]\ v_i[1]\ \cdots \ v_i[k_\mathrm{v}-1] ] \label{defViAppendixB}
\end{align}
and
\begin{align}
\mathbf{u}_i \triangleq [u_i[0]\ u_i[1]\ \cdots \ u_i[k_\mathrm{u}-1] ] \label{defUiAppendixB}
\end{align}
for all $i\in\mathbb{Z}_+$. Using the convention that $\big[\mathbf{u}_j\ \mathbf{v}_j\big] \triangleq \mathbf{0}^{1\times(k_\mathrm{v}+k_\mathrm{u})}$ for any $j<0$, we construct
\begin{align}
\big[x_i[0]\ x_{i+1}[1]\ \cdots \ x_{i+n-1}[n-1] \big] \triangleq \big[\vec v_i \ \vec u_i \big] \mathbf{G} \label{appendixBeq1}
\end{align}
for each $i\in\{-n+1, -n+2, \ldots\}$ where
\begin{align}
\vec v_i \triangleq \big[v_i[0]\ v_{i+1}[1]\ \ldots \ v_{i+k_\mathrm{v}-1}[k_\mathrm{v}-1] \big], \label{defViAppendixB}
\end{align}
\begin{align}
\vec u_i \triangleq \big[u_{i+k_\mathrm{v}}[0]\ v_{i+k_\mathrm{v}+1}[1]\ \ldots \ v_{i+k_\mathrm{v}+k_\mathrm{u}-1}[k_\mathrm{u}-1] \big], \label{defUiAppendixB}
\end{align}
and $\mathbf{G}$ is the generator matrix of the $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-block code which corrects any length-$B$ burst erasure. In other words, {we are coding $\{[\mathbf{v}_i\ \mathbf{u}_i]: i\in\mathbb{Z}_+\}$ diagonally as illustrated in Table~\ref{tableInterleave} where $x_m[\ell]$ denotes the symbol~$\ell$ transmitted at time~$m$}.
At each time $i\in\mathbb{Z}_+$, the source transmits
\begin{align}
\mathbf{x}_i\triangleq \big[x_i[0]\ x_i[1]\ \cdots \ x_i[n-1]\big]. \label{defXiAppendixB}
\end{align}
Based on the $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-block code which satisfies Properties~(i) to~(iv) as stated at the beginning of this proof, we have constructed an $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code where $\mathbf{v}_i$, $\mathbf{u}_i$ and $\mathbf{x}_i$ satisfy~\eqref{appendixBeq1}, \eqref{defViAppendixB}, \eqref{defUiAppendixB} and~\eqref{defXiAppendixB}. Our remaining goal is to show that the $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code corrects any length-$B$ burst erasure. To this end, we fix any $i\in\mathbb{Z}_+$ and any $\mathbf{e}\in\Omega_B$, and would like to show that the destination can perfectly recover $\mathbf{v}_i=\big[v_i[0]\ v_i[1]\ \cdots \ v_i[k_\mathrm{v}-1]\big]$ based on
\begin{align}
[\mathbf{y}_0\ \mathbf{y}_1\ \ldots\ \mathbf{y}_{i+T_\mathrm{v}}]= [g_n(\mathbf{x}_0, e_0)\ g_n(\mathbf{x}_1, e_1)\ \ldots\ g_n(\mathbf{x}_{i+T_\mathrm{v}}, e_{i+T_\mathrm{v}})],\label{appendixBeq5}
\end{align}
and can perfectly recover
$\mathbf{u}_i=\big[u_i[0]\ u_i[1]\ \cdots \ u_i[k_\mathrm{u}-1]\big]$ based on
\begin{align}
[\mathbf{y}_0\ \mathbf{y}_1\ \ldots\ \mathbf{y}_{i+T_\mathrm{u}}]= [g_n(\mathbf{x}_0, e_0)\ g_n(\mathbf{x}_1, e_1)\ \ldots\ g_n(\mathbf{x}_{i+T_\mathrm{u}}, e_{i+T_\mathrm{u}})],\label{appendixBeq6}
\end{align}
According to~\eqref{defXiAppendixB}, for each $i\in\{-n+1, -n+2, \ldots\}$, the symbols in $\big[x_i[0]\ x_{i+1}[1]\ \cdots \ x_{i+n-1}[n-1]\big]$ are transmitted between time~$i$ to $i+n-1$. Therefore, it follows from~\eqref{appendixBeq1}, Property~(iii) and~\eqref{appendixBeq5} that for each $i\in\mathbb{Z}_+$ and each $\ell\in\{0, 1, \ldots, k_\mathrm{v}-1\}$, the destination can perfectly recover $v_i[\ell]$ by time $i+T_\mathrm{v}$ based on $ [\mathbf{y}_0\ \mathbf{y}_{1}\ \ldots\ \mathbf{y}_{i+T_\mathrm{v}}]$. Similarly, it follows from~\eqref{appendixBeq1}, Property~(iv) and~\eqref{appendixBeq6} that for each $i\in\mathbb{Z}_+$ and each $\ell\in\{0, 1, \ldots, k_\mathrm{u}-1\}$, the destination can perfectly recover $u_i[\ell]$ by time $i+T_\mathrm{u}$ based on $ [\mathbf{y}_0\ \mathbf{y}_{1}\ \ldots\ \mathbf{y}_{i+T_\mathrm{u}}]$. Consequently, for any $i\in\mathbb{Z}_+$ and any $\mathbf{e}\in\Omega_B$, the destination can perfectly recover $v_i[\ell]$ by time $i+T_\mathrm{v}$ for each~$\ell\in\{0, 1, \ldots, k_\mathrm{v}-1\}$ and perfectly recover $u_i[\ell]$ by time $i+T_\mathrm{u}$ for each~$\ell\in\{0, 1, \ldots, k_\mathrm{u}-1\}$, which then implies by Definition~\ref{definitionAchievability} that the $(n, k_\mathrm{v}, k_\mathrm{u}, T_\mathrm{v}, T_\mathrm{u})_{\mathbb{F}}$-streaming code corrects any $B$-erasure sequence.
| {'timestamp': '2019-11-12T02:02:19', 'yymm': '1901', 'arxiv_id': '1901.03769', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03769'} | arxiv |
\section{Introduction}
The development of real-time affect detection models often depends upon obtaining annotated data for supervised learning by employing human experts to label the student data. One open question in annotating affective data for affect detection is whether the labelers (i.e., human experts) need to be socio-culturally similar to the students being labeled, as this impacts the cost feasibility of obtaining the labels. In this study, we investigate the following research questions: For affective state annotation, how does the socio-cultural background of human expert labelers, compared to the subjects, impact the degree of consensus and distribution of affective states obtained? Secondly, how do differences in labeler background impact the performance of affect detection models that are trained using these labels?
\section{Methodology}
\label{method}
We employed 5 experts from the United States and 5 experts from Turkey to label the same data collected through authentic classroom pilots with students in Turkey. Using HELP \cite{ET-2017}, each group labeled 14 hours of multi-modal data collected from ten 9\textsuperscript{th} grade students in 2 sessions (40 mins each) for 3 affective states: \textit{Satisfied}, \textit{Bored}, and \textit{Confused}. We analyzed within-country and cross-country inter-rater agreements using Krippendorff’s alpha \cite{Krippendorff-2011, Siegert-2014}, where we checked all-5 and the best-3 experts (having the highest agreement) of each group. We also compared affective state distributions using majority labels obtained by each group.
For affect detection models, we employed two modalities: (1) \textit{Appearance (Appr)}: upper-body information from the camera, (2) \textit{Context \& Performance (C\&P)}: interaction and performance logs from the online learning platform for Math. For \textit{Appr}, the raw video data are segmented into instances and time series analysis methods were utilized to extract 188 appearance features, consisting of motion and energy measures, robust statistical estimators of head velocity, and frequency domain features related to head position, pose, and facial expressions. Further details of the \textit{Appr} modality can be found in our previous study \cite{AIED-2017} where we used the
same features in this study. For \textit{C\&P}, we extracted 24 features related to time (time spent on video/questions), grade (success/failure of attempts), hints (number of hints used on questions), attempts (number of trials), and others (gender). Further details of the \textit{C\&P} features employed, which are adapted from the study \cite{Pardos-2014}, can be found in our previous study \cite{MIE-ICMI-2017}. Separate generic classifiers (Random Forests) trained using majority labels from each expert group for each modality and each activity type (\textit{Instructional} and \textit{Assessment}). Instances are sliding windows of 8-sec with 4-sec overlaps. Further details of the methodology used in this study can be found in the full version of this paper \cite{AIED-2018}.
\iffalse
\begin{table}
\caption{Inter-rater agreements (Krippendorff’s Alpha) among experts from the United States (US) and Turkey (TR).}
\label{T1}
\centering
\begin{tabular}{*5c}
\toprule
& \textbf{Experts} & \textbf{Alpha} & \textbf{Experts} & \textbf{Alpha} \\
\toprule
Within-country & US-all-5 & 0.472 & US-best-3 & 0.564 \\
& TR-all-5 & 0.585 & TR-best-3 & 0.626 \\
\midrule
Cross-country & Cross-all-10 & 0.379 & Cross-best-6 & 0.400 \\
\bottomrule
\end{tabular}
\end{table}
\fi
\begin{table}[!t]
\caption{Inter-rater agreements (Krippendorff’s Alpha) among experts from the United States (US) and Turkey (TR).}
\label{T1}
\centering
\begin{tabular}{*3c}
\toprule
& \textbf{Human Experts} & \textbf{Krippendorff’s Alpha} \\
\toprule
Within-country (all-5) & US-all-5 & 0.472 \\
& TR-all-5 & 0.585 \\
\midrule
Within-country (best-3) & US-best-3 & 0.564 \\
& TR-best-3 & 0.626 \\
\midrule
Cross-country & Cross-all-10 & 0.379 \\
& Cross-best-6 & 0.400 \\
\bottomrule
\end{tabular}
\end{table}
\begin{table}[!b]
\caption{Affect detection classifier results (F1-scores) for separate modalities (Appr: \textit{Appearance}, C\&P: \textit{Context \& Performance}) and section types (Instr: \textit{Instructional}, Assess: \textit{Assessment}) trained using labels by experts from the United States (US) and Turkey (TR).}
\label{T2}
\centering
\begin{tabular}{*6c}
\toprule
& & \multicolumn{2}{c}{\textbf{Labels: US}} & \multicolumn{2}{c}{\textbf{Labels: TR}} \\
\cmidrule{3-6}
\textbf{Section Type} & \textbf{Class} & \textbf{Appr} & \textbf{C\&P} & \textbf{Appr} & \textbf{C\&P} \\
\toprule
Instructional & Satisfied & 0.62 & 0.58 & 0.41 & 0.42 \\
& Bored & \underline{0.67} & \underline{0.59} & \underline{0.86} & \underline{0.88} \\
\cmidrule{2-6}
& Overall & 0.65 & 0.58 & 0.77 & 0.80 \\
\midrule
Assessment & Satisfied & 0.59 & 0.80 & 0.43 & 0.73 \\
& Confused & \underline{0.45} & \underline{0.63} & \underline{0.57} & \underline{0.66} \\
\cmidrule{2-6}
& Overall & 0.53 & 0.74 & 0.51 & 0.70 \\
\bottomrule
\end{tabular}
\end{table}
\begin{figure}[h]
\centering
\includegraphics[width=\textwidth]{Fig2_Distributions_best3_bigger.jpg}
\caption{Affective-state distributions by the experts from US and TR}
\label{fig:dist}
\end{figure}
\section{Experimental Results}
\label{exp_res}
The inter-rater agreements and affect detection model results are summarized in Table~\ref{T1} and Table~\ref{T2}, respectively. Students’ affective states distributions are given in Figure~\ref{fig:dist}. These results indicate that experts from Turkey obtained moderately better inter-rater agreement than the experts from the U.S. Note that even though the U.S. experts agree with each other, they agree fairly poorly with the Turkey experts. In addition, we observed important differences between the distributions of affective states provided by experts in the U.S. versus Turkey, and between the performances of the resulting real-time multi-modal affect detectors; especially for \textit{Bored} and \textit{Confused} states.
\section{Discussion and Conclusion}
Our findings suggest that there are indeed implications to using expert labelers who do not belong to the same population as the research subjects. The results in this study indicate that there could be a cultural impact in interpreting labeling ambiguities for affective states, which also has an impact on the affect detection model accuracies, especially for detecting the \textit{Bored} and \textit{Confused} states of the students. One key take-away message from this research is that cross-national or cross-cultural labelers should be vetted for inter-rater agreement very carefully \cite{BROMP-2015}.
\small
| {'timestamp': '2019-01-15T02:04:45', 'yymm': '1901', 'arxiv_id': '1901.03793', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03793'} | arxiv |
\section{Introduction}
A fundamental issue in understanding evolutionary dynamics of biological systems is the interplay between competition and cooperation. Evolutionary dynamics requires Darwinian selection in which biological entities compete in terms of survival and reproduction. But while we certainly observe competition in living entities, juxtaposed and intertwined with it, we also notice very frequently unselfish, altruistic and cooperative behavior. The paradox of competition and cooperation next to each other can be resolved by presuming that there must be situations where in evolutionary terms cooperation is more advantageous than competition. Mathematical models for discussing these questions are provided by evolutionary game theory, which gives a theoretical framework and a bio--inspired computational paradigm~\cite{broom13,nowak06}.
Studying the emergence of cooperation crystallizes into a well--defined form by considering so--called social dilemma games. In an evolutionary type of these games a population of players interacts in a predefined manner among themselves by each selecting one of two strategies, cooperate or defect, and receiving a payoff according to these selections. By converting the payoff into accumulable fitness, repeating the interaction and allowing players to change strategies depending on the accumulated fitness, the long--term effect of strategy selection becomes visible~\cite{allen17,chen13,hinder15,taylor07}. A frequently studied question of considerable biological relevance is whether or not one strategy is favored over another depending on the values of the payoff matrix \emph{and} on the structure of the interaction network specifying who--plays--whom~\cite{chen16,hinder15,rich18a,rich18b}.
Recently, and independent from each other, two proposals have been made to formalize strategy selection and payoff allocation, on the one hand, and strategy distribution over interaction networks, on the other hand. Wang et al.~\cite{wang15} introduced an approach of universal scaling for payoff matrices that facilitates to study a continuum of social dilemmas including (but not restricted to) well--known examples such as the Prisoner’s dilemma (PD), the stag hunt (SH) and the snow drift (SD) game. Chen et al.~\cite{chen16} presented a scheme to define structure coefficients for any arrangement of cooperators and defectors on interaction networks modelled as regular graphs.
In this paper, these recent additions to evolutionary game theory are combined. There are simple algebraic relations between structure coefficients, the elements of any payoff matrix and whether or not cooperation is favored over defection~\cite{chen16,tarnita09}. Thus, we can study fixation properties across the universal scaling for payoff matrices and dilemma strength. The paper is structured as follows. In Sec. 2 we briefly review coevolutionary games, particularly highlighting the scaling of dilemma strength~\cite{wang15} as well as configurations and structure coefficients~\cite{chen16,rich18a,rich18b}. Numerical results are presented for different interaction networks modeled as regular graphs. It is shown how different networks may entail different combinations of dilemma strength where cooperation is favored over defection.
\section{Game description}
\subsection{Coevolutionary games, payoff matrices and scaling for the dilemma strength } \label{sec:desc}
We consider coevolutionary games of $N$ players $\mathcal{I}=\left(\mathcal{I}_1,\mathcal{I}_2,\ldots,\mathcal{I}_N\right)$. The game has 2 strategies, cooperate ($C_i$) and defect ($D_i$) and each pairwise interaction between 2 players $\mathcal{I}_i$ and $\mathcal{I}_j$, $i\neq j$, (which thus are mutual coplayers) yields a payoff. A (possibly varying) interaction network describes which player interacts with whom, while the number of coplayers is the same for all players. We need
three entities for describing such a game:
(i) the network of interaction, (ii) the configuration describing the strategy of each player, and (iii) the payoff matrix~\cite{perc10,rich16,rich17}.
\begin{figure}[t]
\centering
\includegraphics[trim = 17mm 120mm 138mm 120mm,clip, width=4cm, height=4.2cm]{frucht00.pdf}
\includegraphics[trim = 17mm 120mm 138mm 120mm,clip, width=4cm, height=4.2cm]{frucht01.pdf}
\includegraphics[trim = 17mm 120mm 138mm 120mm,clip, width=4cm, height=4.2cm]{c2max3_00.pdf}
\includegraphics[trim = 17mm 120mm 138mm 120mm,clip, width=4cm, height=4.2cm]{c2max3_01.pdf}
(a) $\sigma_{max}=1.7059$ \hspace{1cm} (b) $\sigma_{max}=1.7568$ \hspace{1cm} (c) $\sigma_{max}=1.8485$ \hspace{1cm} (d) $\sigma_{max}=1.9159$
\includegraphics[trim = 17mm 120mm 138mm 120mm,clip, width=4cm, height=4.2cm]{chvatal00.pdf}
\includegraphics[trim = 17mm 120mm 138mm 120mm,clip, width=4cm, height=4.2cm]{chvatal01.pdf}
\includegraphics[trim = 17mm 120mm 138mm 120mm,clip, width=4cm, height=4.2cm]{c2max4_10.pdf}
\includegraphics[trim = 17mm 120mm 138mm 120mm,clip, width=4cm, height=4.2cm]{c2max4_11.pdf}
(e) $\sigma_{max}=1.2857$ \hspace{1cm} (f) $\sigma_{max}=1.2957$ \hspace{1cm} (g) $\sigma_{max}=1.4433$ \hspace{1cm} (h) $\sigma_{max}=1.4727$
\caption{\small{Examples of interaction networks: (a)--(d) cubic ($3$--regular) and (e)--(h) quartic ($4$--regular) graphs. Two graph are named: (a),(b) the Frucht graph, (e),(f) the Chvatal graph. The other two graphs have particularly large maximal structure coefficients $\sigma(\pi)=\sigma_{max}$ for some configurations $\pi$. A red vertex is a cooperator ($\pi_i=1$), while a grey vertex is a defector ($\pi_i=0$). The values of $\sigma_{max}$ are shown for: (a),(c),(e),(f) $c(\pi)=4$ cooperators; (b),(d),(f),(h) $c(\pi)=5$ cooperators. }}
\label{fig:graph}
\end{figure}
The interaction network is given by an undirected graph $\mathcal{G}=(V,E)$ and specifies who--plays--whom. According to evolutionary graph theory~\cite{allen14,sha12,szabo07}, the set of vertices $V$ equals the set of players $\mathcal{I}$ and the set of edges $E$ shows which players are mutual coplayers, see Fig. \ref{fig:graph} for examples. As each players has $k$ coplayers, the interaction network is a $k$--regular graph. The configuration $\pi=(\pi_1\pi_2\ldots\pi_N)$ specifies the strategy $\pi_i \in \{C_i,D_i\}$ of each player $\mathcal{I}_i$, ($i=1,2,\ldots,N$). With 2 strategies ($C_i$ and $D_i$) there are $2^N$ configurations. These configurations enumerate all possible arrangements of cooperators and defectors among the players. Additionally, the configurations describe any outcome of a player changing its strategy in a strategy updating process, for instance death--birth (DB) or birth--death (BD) updating~\cite{allen14,sha12,zuk13}.
It is convenient to binary code the strategies $\{C_i,D_i\} \rightarrow \{1,0\}$, thus having a binary string to specify the strategies of all players~\cite{chen16,rich17}. As an example, see Fig. \ref{fig:graph}(a) with the configuration $\pi=(1000\:0000\:1110)$ showing players $\mathcal{I}_1$,$\mathcal{I}_9$, $\mathcal{I}_{10}$ and $\mathcal{I}_{11}$ cooperating, while the remaining 8 players defect.
The $2 \times 2$ payoff matrix is
\begin{equation}
\bordermatrix{~ & C_j & D_j \cr
C_i & R & S \cr
D_i & T & P \cr} \label{eq:payoff}
\end{equation}
where $T$ is temptation to defect, $R$ is reward for mutual cooperation, $P$ is punishment for mutual defection, and $S$ is sucker payoff for cooperating with a defector. According to the values and order of these 4 elements of the payoff matrix (\ref{eq:payoff}), we obtain different social dilemma games.
Several suggestions have been made to rescale the payoff matrix (\ref{eq:payoff}) by freezing or linearly coupling its elements, which may reduce the $4$--dimensional parameter space to a $2$--dimensional plane~\cite{tani09,wang15,zuk13}, while preserving frequently--studied social dilemmas such as prisoner's dilemma (PD), snowdrift (SD), stag--hunt (SH), or harmony (H). Following Wang et al.~\cite{wang15}, we consider two scaling parameters for the dilemma strength $u$ and $v$ to obtain a rescaled payoff matrix
\begin{equation}
\bordermatrix{~ & C_j & D_j \cr
C_i & R & P-(R-P)v \cr
D_i & R+(R-P)u & P \cr} \label{eq:payoff1}
\end{equation}
with $u=\frac{T-R}{R-P}$ and $v=\frac{P-S}{R-P}$. We may interpret $u$ as gamble--intending dilemma strength and $v$ as risk--averting dilemma strength. The rescaling (\ref{eq:payoff1}) requires $R>P$, while $T-R$ and $P-S$ may change sign to have different orders of $(T,R,P,S)$, and thus different social dilemmas. Apparently, matrix (\ref{eq:payoff1}) reduces to matrix (\ref{eq:payoff}) by inserting $u$ and $v$. However, by varying $u$ and $v$ for $-1 \leq u \leq 1$ and $-1 \leq v \leq 1$, we may traverse a bounded two--dimensional $uv$--parameter plane encompassing all the social dilemmas given above, but also some intermediate forms, see Fig. \ref{fig:uv_plane}(a). We obtain SD games for $0 \leq u \leq 1$ and $-1 \leq v \leq 0$, PD games for $0 \leq u \leq 1$ and $0 \leq v \leq 1$, and so on. Thus, a rescaling by matrix (\ref{eq:payoff1}) significantly eases analyzing the games across social dilemmas. A square in the $uv$--plane generalizes the payoff matrix (\ref{eq:payoff}) and produces a multitude of dilemmas that are significant and interesting in evolutionary game theory. Moreover, Wang et al.~\cite{wang15} have shown that by the rescaling (\ref{eq:payoff1}) fixation properties of the games over the $uv$--plane are fairly robust with respect to the choice of $R$ and $P$.
\begin{figure}[t]
\includegraphics[trim = 3mm 0mm 0mm 0mm,clip, width=8.5cm, height=5.9cm]{icnc_uvplan1.pdf}
\includegraphics[trim = 3mm 0mm 0mm 0mm,clip, width=8.5cm, height=5.9cm]{icnc_sigma_nd1.pdf}
\hspace{1cm} (a) \hspace{10cm} (b)
\caption{(a) Schematic description of social dilemmas in a $uv$--parameter plane, as defined by the rescaled payoff matrix (\ref{eq:payoff1}). The plane can be divided into four sections (identified by different colors) which correspond to prisoner's dilemma (PD), snowdrift (SD), stag hunt (SH), and harmony (H) games. Condition (\ref{eq:cond1}) implies straight lines $u=\sigma(\pi)-1-v$ from north--west to south--east in the $uv$--plane for which cooperation is favored over defection below these lines. (b) The structure coefficient of a single cooperator (\ref{eq:sig}) for different number of players $N$ over the number of coplayers $k$. The structure coefficient $\sigma$ falls rapidly for $k$ increasing, which means an increasing number of coplayers reduces the sections in $uv$--plane where cooperation is favored over defection, see Fig. \ref{fig:uv_plane}(a).}
\label{fig:uv_plane}
\end{figure}
\subsection{Fixation properties, configurations and structure coefficients}
Recently, Chen et al.~\cite{chen16} have shown that for $2 \times 2$ games with $N$ players, payoff matrix (\ref{eq:payoff}), any configuration $\pi$ of cooperators and defectors and for any interaction network modeled by a simple, connected, $k$--regular graph,
in the case of weak selection strategy $C_i$ is favored over $D_i$ if \begin{equation} \sigma(\pi)> \frac{T-S}{R-P}. \label{eq:cond} \end{equation}
The quantity $\sigma(\pi)$ is called the structure coefficient of the configuration $\pi$ implying that it may have different values for different arrangements of cooperators and defectors described by $\pi$. It generalizes the structure coefficient \begin{equation} \sigma=\frac{(k+1)N-4k}{(k-1)N} \label{eq:sig} \end{equation} applying to a single cooperator~\cite{chen16,tarnita09}, see Fig. \ref{fig:uv_plane}(b) with curves of $\sigma$ for some $N$ and $k$.
For the rescaled payoff matrix (\ref{eq:payoff1}) the condition (\ref{eq:cond}) simplifies to
\begin{equation} \sigma(\pi)> 1+u+v. \label{eq:cond1} \end{equation} Condition (\ref{eq:cond1}) depends linearly on the scaling parameters for dilemma strength $-1 \leq u \leq 1$ and $-1 \leq v \leq 1$, but not on the parameter of the payoff matrix (\ref{eq:payoff}) and particularly not on $R$ and $P$. Obtaining such a simple algebraic expression as to whether or not
cooperation is favored over defection over the whole $uv$--plane expressing all major social dilemmas is another advantage of the rescaling with payoff matrix (\ref{eq:payoff1}), as compared to other types of rescaling~\cite{tani09,zuk13}.
The structure coefficient $\sigma(\pi)$ can be calculated with time complexity $\mathcal{O}(k^2N)$ for weak selection, the interaction graph $\mathcal{G}=(V,E)$ also describing the replacement structure, and DB updating: \begin{equation}
\sigma(\pi)=\frac{N\left(1+1/k \right) \overline{\omega^1} \cdot \overline{\omega^0}-2\overline{\omega^{10}}-\overline{\omega^1 \omega^0} }{N\left(1-1/k \right) \overline{\omega^1} \cdot \overline{\omega^0}+\overline{\omega^1 \omega^0}}. \label{eq:sigma}
\end{equation} The local frequencies $\overline{\omega^1}$, $\overline{\omega^0}$, $\overline{\omega^{10}}$, $\overline{\omega^1 \omega^0}$ can be interpreted as follows~\cite{chen16,rich18a,rich18b}. Suppose a random walk is carried out with the starting
vertex chosen uniformly--at--random on a given interaction network. The local frequency $\overline{\omega^1}$ (or $\overline{\omega^0}=1-\overline{\omega^1}$) is the probability that for a configuration $\pi$ the player at the first step of the walk is a cooperator (or defector). The local frequency $\overline{\omega^{10}}$ is the probability that for a walk with 2 steps the player at the first step is a cooperator and at the second step it is a defector. The local frequency $\overline{\omega^1 \omega^0}$ is the probability that for 2 random walks independent of each other the player at the first step on the first walk is a cooperator, but at the first step on the second walk is a defector.
\section{Numerical results and discussion}
We next present and discuss numerical results for the interaction networks given in Fig. \ref{fig:graph}. As shown above,
condition (\ref{eq:cond1}) depends linearly on the scaling parameters for dilemma strength $u$ and $v$ yielding straight lines with $u=\sigma(\pi)-1-v$ from north--west to south--east in the $uv$--parameter plane, see Fig. \ref{fig:uv_plane}(a). Such a straight line is the more towards the north--east corner, the larger the structure coefficient $\sigma(\pi)$ is. In other words, the largest $\sigma(\pi)=\sigma_{max}$ gives the largest section in the bounded $uv$--plane generalizing elements of the payoff matrix for which cooperation is favored over defection, while the smallest $\sigma(\pi)=\sigma_{min}$ gives the smallest section. We first briefly look at how the structure coefficients are distributed for each number of cooperators $c(\pi)$, see Fig. \ref{fig:viol_frucht_frank} for the Frucht ($k=3$) and the Chvatal ($k=4$) graph. We notice that for 1 cooperator ($c(\pi)=1$) and 1 defector ($c(\pi)=N-1=11$) we get the single values $\sigma=\{3/2,11/9\}$ obtained for a single cooperator according to Eq. (\ref{eq:sig}). For $2 \leq c(\pi) \leq 10$ we obtain a symmetric distribution with some values of $\sigma(\pi)$ larger and some smaller than $\sigma$, depending on the arrangement of cooperators and defectors on the evolutionary graph. This means there are for the same number of cooperators $c(\pi)$ some configurations $\pi$ that are more prone to cooperation than others.
\begin{figure}[htb]
\includegraphics[trim = 0mm 0mm 0mm 0mm,clip,width=8.5cm, height=5.9cm]{sigma_viol_frucht12_3.pdf}
\includegraphics[trim = 0mm 0mm 0mm 0mm,clip,width=8.5cm, height=5.9cm]{sigma_viol_chvatal12_4.pdf}
\hspace{1cm} (a) \hspace{10cm} (b)
\caption{Distributions of the structure coefficients $\sigma(\pi)$ for graphs: (a) Frucht, Fig. \ref{fig:graph}(a); (b) Chvatal, Fig. \ref{fig:graph}(e). The blue lines intersecting the distributions show the values $\sigma=\{3/2,11/9\}$ obtained for a single cooperator with $N=12$, $k=\{3,4\}$ and Eq. (\ref{eq:sig}).}
\label{fig:viol_frucht_frank}
\end{figure}
\begin{figure}[htb]
\includegraphics[trim = 0mm 0mm 0mm 0mm,clip,width=8.5cm, height=5.9cm]{icnc_uvplan_frucht4.pdf}
\includegraphics[trim = 0mm 0mm 0mm 0mm,clip,width=8.5cm, height=5.9cm]{icnc_uvplan_c2max3.pdf}
\hspace{0.5cm} (a) Network in Fig. \ref{fig:graph}(a): Frucht graph \hspace{2cm} (b) Network in Fig. \ref{fig:graph}(c)
\includegraphics[trim = 0mm 0mm 0mm 0mm,clip,width=8.5cm, height=5.9cm]{icnc_uvplan_chvatal4.pdf}
\includegraphics[trim = 0mm 0mm 0mm 0mm,clip,width=8.5cm, height=5.9cm]{icnc_uvplan_c2max4.pdf}
\hspace{0.5cm} (c) Network in Fig. \ref{fig:graph}(e): Chvatal graph \hspace{2cm} (d) Network in Fig. \ref{fig:graph}(g)
\caption{Sections of condition $u<\sigma(\pi)-1-v$ between the maximal and minimal structure coefficients, $\sigma(\pi)=\sigma_{max}$ and $\sigma(\pi)=\sigma_{min}$ for the interaction networks given in Fig. \ref{fig:graph} for the number of cooperators $2 \leq c(\pi) \leq 6$. The bars give the range of the condition $u<\sigma(\pi)-1-v$ between $\sigma_{max}$ and $\sigma_{min}$ according to the color code for each number of cooperators $c(\pi)$. The black line indicates the section for a single cooperator with $\sigma$ according to Eq. (\ref{eq:sig}).}
\label{fig:uv_plane_graph}
\end{figure}
The main result is given by Fig. \ref{fig:uv_plane_graph}, which shows for the interaction networks given in Fig. \ref{fig:graph} the sections of condition $u<\sigma(\pi)-1-v$ between the maximal and minimal structure coefficients, $\sigma(\pi)=\sigma_{max}$ and $\sigma(\pi)=\sigma_{min}$ for the number of cooperators $2 \leq c(\pi) \leq 6$ (the results for $7 \leq c(\pi) \leq 10$ are omitted as they are symmetric, see Fig. \ref{fig:viol_frucht_frank}).
Different graphs yield different $\sigma_{min}$ and $\sigma_{max}$ for each $c(\pi)$, which in turn produce different ranges in the $uv$--plane indicating that cooperation is favored or not. For instance, the interaction graph given in Fig.
\ref{fig:graph}(d) has for $c(\pi)=5$ cooperators the largest value $\sigma_{max}=1.9159$. For this configuration $\pi$ cooperation prevails for almost all SD and SH games and a considerable fraction of PD games, see the green--yellow line in Fig.
\ref{fig:uv_plane_graph}(b). Comparing the interaction graphs reveals that the lower line defined by $\sigma_{min}$ is the same (or almost the same) for the examples considered, while the upper line is not and gives the largest range for the graph and configuration in Fig.
\ref{fig:graph}(d). However, comparing $k=3$ and $k=4$ shows that the upper and lower lines are more in favor for cooperation for $k=3$ than for $k=4$, which is a consequence of the structure coefficient for a single cooperator$\sigma$ with $\sigma_{min} \leq \sigma \leq \sigma_{max}$ being smaller for $k=4$ as for $k=3$, see Fig. \ref{fig:uv_plane}(b). Compare also to Fig. \ref{fig:viol_frucht_frank} showing that for all configurations the structure coefficients $\sigma(\pi)$ for the Frucht graph ($k=3$) are larger than for the Chvatal graph ($k=4$). A recent work suggests that it is general result for regular interaction graphs that structure coefficients fall for the degree $k$ ($=$ number of coplayers) of the graph getting larger~\cite{rich18a,rich18b}.
\section{Conclusions}
Different types of social dilemma games such as Prisoners dilemma, stag--hunt or snow--drift can be universally expressed by a scaling of dilemma strength.
We have considered structure coefficients defined for each configuration describing any arrangement of cooperators and defectors on a regular evolutionary graphs. As these structure coefficients are linked to whether or not cooperation is favored over defection, we could study how the universal scaling of dilemma strength relates to specific favorable configurations of cooperators and defectors. The main findings are that some graphs permit certain arrangements of cooperators and defectors to possess particularly large structure coefficients. Moreover, these large coefficients imply particularly large sections of a bounded parameter plane spanned by scaling gamble--intending and risk--averting dilemma strength. In addition, the sections can be described by linear inequalities depending only on the two scaling parameters.
| {'timestamp': '2019-05-14T02:31:20', 'yymm': '1901', 'arxiv_id': '1901.03545', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03545'} | arxiv |
\section{Extracting Java Class Files}
\label{p1:app:extracting_java_class}
AC\-Miner\xspace first obtains the Java class files for the desired version of Android.
Soot analyzes Java programs by translating their code into its own Java code representation (i.e., Jimple).
It parses \textit{.class}, \textit{.java}, \textit{.jimple}, and \textit{.jar} files.
The recent incorporation of Dexpler~\cite{bklm12} into Soot adds support for \textit{.dex} files and \textit{.jar} files containing \textit{.dex} files (i.e., \textit{.apk} files).
AC\-Miner\xspace is designed to analyze both AOSP and OEM builds of the Android middleware.
As such, AC\-Miner\xspace must process Android's \textit{system.img} and extract the class files.
If the \textit{system.img} contains \textit{.odex} or \textit{.oat} files, AC\-Miner\xspace decompiles and recompiles them into \textit{.dex} using baksmali/smali~\cite{smali}.
As shown in Figure~\ref{fig:design_diagram}, AC\-Miner\xspace automates this process and outputs a \textit{.jar} file containing all the class files of the Android middleware in Soot's Jimple format.
This \textit{.jar} containing Jimple files is then then used on all subsequent runs of AC\-Miner\xspace.
This pre-processing can take upwards of 20 minutes and saves unnecessary re-computation.
\section{Extracting System Services and Entry Points}
\label{p1:app:extracting_java_class_2}
Android's middleware is largely composed of isolated services that only communicate through predefined \ttt{Binder} boundaries.
This division allows each service to be analyzed separately, and to define each service by the code reachable through its \ttt{Binder} entry points. AC\-Miner\xspace extracts system services and their entry points similar to PScout~\cite{azhl12}, Kratos~\cite{socq+16}, and AceDroid~\cite{ahs+18}.
Specifically, AC\-Miner\xspace uses Soot's class hierarchy information to find all classes that: (1) are subclasses of \ttt{android.os.Binder} and (2) implement the \ttt{onTransact} method.
Next, AC\-Miner\xspace identifies the signatures of the handler methods that \ttt{onTransact} methods call.
Our insight is that all such methods are invoked on the same receiver object (i.e., \textit{this}).
Note that handler methods need not be implemented in the \textit{stub} class itself: it can also be implemented in subclasses.
AC\-Miner\xspace therefore uses Soot's class hierarchy information to identify all of the \textit{stub's} subclasses.
Finally, the class and method information is used to identify all concrete methods in these \textit{stub} and subclasses that match the handler method signatures. These concrete methods become the entry points for analysis.
\section{The Exclude List}
\label{p1:app:appendix_excludeList}
\input{tables/exclude_list}
A subset of the exclude list is displayed in Table~\ref{p1:table:excluded_elements} which groups the excluded elements by the five different procedures we use for excluding elements of the call graph (see our website~\cite{acminer-website} for the complete exclude list).
The first procedure \textit{Class Path} will exclude any method of a class whose full class name either exactly equals the listed name or starts with the listed name when the listed name ends with \ttt{.*} or \ttt{\$*}. The second \textit{Interface} excludes any method that implements a method of an interface that exactly equals the listed name. The third \textit{Interface All} excludes all methods of all classes that implement directly or indirectly an interface that exactly equals the listed name. The fourth \textit{Superclass} excludes any method that implements a method of a class that exactly equals the listed name. The fifth \textit{Superclass All} excludes all methods of all classes that extend directly or indirectly a class that exactly equals the listed name. Finally, \textit{Method Signature} excludes a single method that matches the supplied method signature.
To define the exclude list, we explored the call graph, looking for classes and methods that form roots of call graph areas not useful to our analysis. We started by broadly excluding, using the Class Path procedure, any packages that are not Android related as these are generic Java libraries and will not contain Android specific authorization checks. Since these generic Java libraries often contain interfaces and classes implemented and extended in code outside the Java libraries, we also found it necessary to use the Interface and Superclass procedures to cover subclasses of these in Android specific code. Next, as we still observed significant bloat, we broadened our search to include Android specific code. We started excluding packages such as \ttt{android.icu.*} and \ttt{com.android.org.bouncycastle.*} as these are common non-Android libraries that were integrated into the Android specific code but hold no Android-specific authorization checks. Lastly, we looked for methods in the call graph with a large number of outgoing edges and/or a large number of outgoing edges for the same method invoke statement, adding the methods and classes to the exclude list as needed.
In addition to those described above, the exclude list has a few more additions and omissions. First, while \ttt{com.android.Context} is excluded using the Superclass procedure, all permission check methods in the class are omitted from this exclusion. This enables AC\-Miner\xspace to capture the authorization checks inside these various important methods. Second, classes such as \ttt{android.os.UserHandle} and \ttt{android.os.Process} have many authorization check methods, yet are elements of the exclude list. Adding such classes to the exclude list gives context to the operations these authorization-checks perform. Such context would be lost otherwise since the actual checks involve manipulating integers values.
\section{Simplification of Authorization Checks}
\label{p1:app:appendix_authCheckSimplify}
We apply the following 10 simplification rules when generating authorization checks for a entry point and use the value \textit{ALL} in our output to indicate that a variable can be assigned any value. (1) Any variable that does not represent a variable of a primitive type or a string type is assigned the value ALL. We found such variables were safely ignored as they did not add any additional context to the authorization checks being output and instead generated a large amount of noise when included. (2) To handle loops and recursion, a value of ALL is assigned if a cycle is detected when resolving the possible values for a variable. (3) When a variable represents a parameter of the current entry point method, a value of ALL is assigned as the parameter's value could be anything. (4) A value of ALL is assigned to all variables obtaining there value from \textit{lengthof}, \textit{instanceof}, \textit{new}, and \textit{cast} expressions as no new context is gained about the authorization checks by including these expressions. (5) If an expression retrieving a value from an array has the value ALL for either its index or its array reference, then a value of ALL is assigned to the value retrieved from the array as no new context will be gained from such expressions. (6) Variables assigned from the return of a method in the class \ttt{Bundle} always get assigned the value ALL since \ttt{Bundle} is used to pass data through \ttt{Binder} and can therefore be anything. (7) For a control predicates\xspace or context queries\xspace when computing the product of all the possible variables and the values for each variable, if the possible set of values for a variable contains ALL then the set is transformed into a singleton set containing only the value ALL. (8) If a variable is assigned a value of \textit{NULL} and has any other value assigned to it, the NULL value is ignored so as to remove NULL checks. (9) When dealing with the final set of values generated from a control predicate\xspace (i.e., a set of pairs), we remove a pair from this set if: the pair has NULL or ALL for either of its values, the pair has a constant value for both of its values, or both of the values in the pair are equivalent. (10) As Java object \ttt{equals} methods when used in a conditional statements take the form \ttt{if(o1.equals(o2)} \ttt{==} \ttt{0)}, the pair generated by AC\-Miner\xspace representing the authorization check would normally contain one entry for the value of the equals method and one entry for the constant value being compared. However, what is really desired is the values of the objects being compared by the equals (e.g., in the case of string comparisons). As such, we simplify the representation of such authorization checks by reconstructing the pairs so that they contain values for the calling object and the argument object (i.e., \ttt{o1} and \ttt{o2}) of the \ttt{equals} method.
\section{Representing Context Queries\xspace}
\label{p1:app:appendix_repCQS}
\input{tables/matching_expressions}
\begin{figure}
\centering
\resizebox{0.95\columnwidth}{!}{
\input{figs/appendix_cqExprExample}
}
\caption{An example of the expressions used to describe context queries\xspace.}
\label{p1:fig:appendix_cqExprExample}
\end{figure}
\begin{figure}
\centering
\resizebox{0.95\columnwidth}{!}{
\input{figs/appendix_exampleCode1}
}
\caption{Pseudo-code from the \texttt{\protect\seqsplit{ActivityManagerService}} class.\protect\footnotemark}
\label{p1:fig:appendix_exampleCode1}
\end{figure}
\footnotetext{\label{ams2}\scriptsize\url{http://androidxref.com/7.1.1_r6/xref/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java\#11401}}
To generalize our definition of context queries\xspace, we developed a representation that allows us to express the context queries\xspace as a combination of regular expressions and several string matching procedures used to describe the package, class, and/or method name, combined with conditional logic (i.e., \textit{and}, \textit{or}, and \textit{not}). Table~\ref{p1:table:match-expr} outlines a complete list of the base expressions used to define the regular expressions and string matching procedures. Figure~\ref{p1:fig:appendix_cqExprExample} shows an example expression from the set of expressions generated for Android AOSP 7.1.1 that describes, along with several others, the context query\xspace \ttt{canClearIdentity} shown in line 19 of Figure~\ref{p1:fig:appendix_exampleCode1}.
In Figure~\ref{p1:fig:appendix_cqExprExample} we see the expression is actually made up of 4 different operations. As one would imagine, \textit{and} and \textit{or} operations behave just like their counterparts in normal conditional logic. Furthermore, \textit{starts-with-package} behaves as expected in that it checks to see if the package name of the class in which a method is defined starts with a given string, in this case either \ttt{android.} or \ttt{com.android.}. Finally, \textit{regex-name-words} is a bit more complicated in that checks to see if any part of a method name matches the given regular expression when the method name is split by word boundary indicators (i.e., splitting the name at capital letters in the case of camel-case or at an underscore character). That is, for the method named \ttt{canClearIdentity}, the method name is transformed into the string \ttt{can} \ttt{clear} \ttt{identity} before the regular expression matching is performed. By splitting the method name at word boundary indicators, this allows the regular expressions to be defined in terms of key words without having to worry about situations where one word might contain others in its spelling (e.g., \textit{is} and \textit{list}).
\section{Defining Control Predicates\xspace Filter}
\label{p1:app:appendix_definingCPSFilter}
The first step in defining the control predicate\xspace filer was to have a domain expert explore the unique fields, strings, and methods (i.e., elements) used in every marked conditional statement to decide which of these elements are used in an authorization context and which are unimportant. In general, the exploration of these lists proceeds as follows: (1) Start by looking at the control predicates\xspace contained within context queries\xspace and the name of the context queries\xspace themselves. As any element used within control predicates\xspace of context queries\xspace are likely important, we can already include these elements in our list of elements that indicate control predicates\xspace. However, by studying the control predicates\xspace, we can also gain further insight into what control predicates\xspace might look like elsewhere in Android's code. Moreover, we can learn key words that might help with identifying additional elements with authorization context from our lists. (2) Perform a search on our lists of elements using the key words learned from the previous step as these can indicate common functionality. (3) Verify if the elements resulting from the previous search are actually used in control predicates\xspace by looking at both how all conditional statements use an element and the overall flow of the methods containing the conditional statements using the element. Add any that are determined to be used in control predicates\xspace to our list of elements that indicate control predicates\xspace. Note, when recording elements that indicate control predicates\xspace it is also important to indicate exactly how the elements are being used in control predicates\xspace as certain elements may only be authorization related in specific context. For example, as shown in Figure~\ref{p1:fig:appendix_exampleCode2}, some control predicates\xspace involve the use of methods that only when combined together in a specific way construct an authorization check (e.g., the string \ttt{equals} method and the \ttt{get} method of \ttt{SystemProperties} when \ttt{get} is provided the string \ttt{SYSTEM\_DEBUGGABLE}). (4) On the remaining unchecked elements, go through each element as in step 3. If new key words are added to our key word list as a result of finding a new indicator element, perform steps 2-3 again. Keep performing step 4 until all elements in our lists have been processed.
In defining the control predicate\xspace filter, it is important to understand that the use of the fields, methods, and strings identified do not always indicate control predicates\xspace. Instead, they indicate control predicates\xspace when used in a specific context. As such, any filter we design will have to allow us to specify such a context along with the fields, methods, and strings. Therefore, while we cannot rely solely on the expressions outlined in Table~\ref{p1:table:match-expr} we can reuse them. We use a customized XML document that AC\-Miner\xspace takes in as input as shown in Figure~\ref{fig:design_diagram} as our filter specification. The filter specification is constructed from a group of rules that are conditionally joined together using the \textit{and}, \textit{or}, and \textit{not} operators into one large conditional expression that specifies if a given conditional statement should be included in our final list of control predicates\xspace.
\begin{figure}
\centering
\resizebox{0.95\columnwidth}{!}{
\input{figs/appendix_filterExample1.tex}
}
\caption{An example of the an entry in the control predicate\xspace filter. This entry matches a number of flag field control predicates\xspace, such as Figure~\ref{p1:fig:appendix_exampleCode2} line 6, by their name, class, and use that have authorization context.}
\label{p1:fig:appendix_filterExample1}
\end{figure}
Figure~\ref{p1:fig:appendix_filterExample1} provides an example rule from our filter specification. It details the rule \textit{KeepFieldValueUse} used to match the control predicate\xspace at line 6 of Figure~\ref{p1:fig:appendix_exampleCode2}. As shown, the rule uses the expressions outlined in Table~\ref{p1:table:match-expr} to first identify the use of a flag field in a conditional statement that may potentially indicate a control predicate\xspace. The rule then further restricts what is considered a control predicate\xspace by applying the restriction \textit{IsInArithmaticChain}. This restriction only allows conditional statements to be considered control predicates\xspace if the field or method return value is used in a chain of arithmetic expressions whose resolution is then used in the conditional statement. The arithmetic operations are all standard Java binary and unary operators (e.g., +, -, ==, !=, and !). Such a restriction allows us to exclude situations like \verb| if(0 == method(flag))| where the flag field is being used in a conditional statement as an argument to a method while including conditional statements who use field and method return values as in Figure~\ref{p1:fig:appendix_exampleCode2} line 6.
\begin{figure}
\centering
\resizebox{0.95\columnwidth}{!}{
\input{figs/appendix_filterExample2.tex}
}
\caption{An example of the an entry in the control predicate\xspace filter. This entry specifically matches situations such as the control predicate\xspace shown in Figure~\ref{p1:fig:appendix_exampleCode2} line 5.}
\label{p1:fig:appendix_filterExample2}
\end{figure}
To further illustrate how rules are expressed in our filter specification, we take a look at the more complex example of Figure~\ref{p1:fig:appendix_filterExample2} which is a rule to match control predicates\xspace like line 5 of Figure~\ref{p1:fig:appendix_exampleCode2}. The rule \textit{KeepMethodReturnValueUse} specification is similar to that of KeepFieldValueUse from our previous example except it has an additional set of restrictions. These restrictions are all forms of the \textit{IsValueUsedInMethodCall} which enables us to specify the possible arguments for a method as well as the possible calling object of the method. In this case, we have two sets of nested IsValueUsedInMethodCall restrictions the results of which are ored together when evaluated. The outer most IsValueUsedInMethodCall restriction in either set specifies that only the methods whose return value is used as part of the \ttt{equals} call, whose name contains \ttt{get}, and who is a member of the class \ttt{SystemProperties} be considered a control predicate\xspace. The \textit{Position} attribute of IsValueUsedInMethodCall specifies where this restriction is to check for a value matching this description (i.e., -1 for the calling object and 0 for the first argument of the method). The inner IsValueUsedInMethodCall restriction of each set then further specifies that any method matching the outer restrictions description must also take as an argument at position 0 a string that matches the given regex. Combining all these restrictions together, we get a rule that says to treat any conditional statements as \textit{cps} if they are checking if a value \textit{A} equals some string where \textit{A} is the return value of a \ttt{get} method in \ttt{SystemProperties} retrieving the associated system value for some given key.
\begin{figure}
\centering
\resizebox{0.95\columnwidth}{!}{
\input{figs/appendix_exampleCode2}
}
\caption{Pseudo-code from the \texttt{\protect\seqsplit{ActivityManagerService}} class.\protect\footnotemark}
\label{p1:fig:appendix_exampleCode2}
\end{figure}
\footnotetext{\label{ams1}\scriptsize\url{http://androidxref.com/7.1.1_r6/xref/frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java\#21497}}
Aside from rules like those presented above, the filter also covers a few corner cases. Mainly context queries\xspace and loop conditionals. As defined in Section~\ref{sec:id-auth-check}, any conditional statement in a context query\xspace or using a context query\xspace's return value should be considered a control predicate\xspace. As such, the filter should always include these conditional statements as control predicates\xspace. The filter uses the description of context queries\xspace (see Section~\ref{sec:refine-cq}) to identify context queries\xspace and preserve conditional statements as control predicates\xspace if a conditional statement is within the body of a context query\xspace or the context query\xspace's return value is used in an chain of arithmetic expressions.
Moreover, as mentioned above, one of the main sources of noise in AC\-Miner\xspace's view of the authorization checks was loop conditionals (i.e., the conditional statements that decide if the control flow should exit a loop). As loops conditionals are not important when viewing Android's authorization checks the filter explicitly rejects all conditional statements that are loop conditionals.
\section{Completeness Proof for Closed Association Rule Mining}
\label{p1:app:appendix_proof}
\begin{comment}
\begin{defn}
\label{defn:dcl}
(Monotonicity Property). Every non-empty subset of a frequent itemset $F$ is also frequent.
\begin{equation*}
\sigma(F) \geq minsup \implies \sigma(f) \geq minsup, \forall f \in \wp(F) / \{\emptyset\}
\end{equation*}
\end{defn}
\end{comment}
\begin{lemma}
If $X \implies Y$ is a closed association rule and not confident (i.e., $\textit{conf}(X \implies Y) < minconf$), there does not exist an itemset $Y' \subset Y$ where $X \implies Y'$ is a confident association rule (i.e., $\textit{conf}(X \implies Y') \geq minconf$) unless $X \cup Y'$ is also a closed frequent itemset.
\end{lemma}
\begin{proof}
Let $\textit{conf}(X \cup Y) = \frac{\sigma(X \cup Y)}{\sigma(X)}$ and $\textit{conf}(X \cup Y') = \frac{\sigma(X \cup Y')}{\sigma(X)}$ where $Y' \subset Y$. If $\textit{conf}(X \implies Y') \geq \textit{conf}(X \implies Y)$, then $\sigma(X \cup Y') \geq \sigma(X \cup Y)$. Due to the monotonicity property, $\sigma(X \cup Y') \geq \sigma(X \cup Y)$, because $Y' \subset Y$ and $\sigma(Y') \geq \sigma(Y)$. If $\sigma(X \cup Y') = \sigma(X \cup Y)$, then $\textit{conf}(X \cup Y') < minconf$. If $\sigma(X \cup Y') > \sigma(X \cup Y)$, then $X \cup Y'$ is also a closed itemset according to Lemma~\ref{citemset-lemma}.
\end{proof}
\begin{lemma}
\label{citemset-lemma}
If $X \cup Y$ is a frequent closed itemset, then $X \cup Y'$ where $Y' \subset Y$ is also a frequent closed itemset if $\sigma(X \cup Y') > \sigma(X \cup Y)$.
\end{lemma}
\begin{proof}
Let $\sigma(X \cup Y') > \sigma(X \cup Y)$ and $\alpha(X \cup Y) \neq \emptyset$. For $X \cup Y'$ to not be a frequent closed itemset, then $\exists Y'' \supset Y' \mid \sigma(X \cup Y') = \sigma(X \cup Y'')$ by the definition of a frequent closed itemset. If $\sigma(X \cup Y'') = \sigma(X \cup Y')$, then $\alpha(X \cup Y'') = \alpha(X \cup Y')$. Further, since $\sigma(X \cup Y') > \sigma(X \cup Y) \wedge \alpha(Y) \neq \emptyset$, then $\alpha(Y) \subset \alpha(Y'')$. If $\alpha(Y) \not\subset \alpha(Y'')$, then $\sigma(X \cup Y'') < \sigma(X \cup Y')$ by definition.
Since $Y \supset Y'$ exists and $\sigma(X \cup Y'') = \sigma(X \cup Y')$, then $\sigma(X \cup Y \cup Y'') = min(\sigma(X \cup Y), \sigma(X \cup Y''))$ by the monotonicity property. Since $\sigma(X \cup Y') > \sigma(X \cup Y) \wedge \sigma(X \cup Y') = \sigma(X \cup Y'') \implies \sigma(X \cup Y \cup Y'') = \sigma(X \cup Y)$. Therefore, $\nexists X \cup Y'' \mid \sigma(X \cup Y'') = \sigma(X \cup Y')$, because $X \cup Y$ is defined as a closed itemset. Thus, $X \cup Y'$ is also a frequent closed itemset.
\end{proof}
\section{Non-security Inconsistencies}
\label{p1:app:appendix_eval_otherInconsistencies}
AC\-Miner\xspace identified \pTotalOtherInconsistencies{} inconsistencies (i.e., rules) that did not represent vulnerabilities. Aside from the 20 rules that were caused by easily fixed bugs in AC\-Miner\xspace, we resolve these non-security inconsistencies to their likely causes, and classify them into 9 categories, shown in
Table~\ref{p1:table:other_inconsistencies} (~\ref{rq:causes}).
\subsection{Irregular Coding Practices}
\label{p1:sec:eval_otherInconsistencies_codingPractices}
In addition to detecting vulnerabilities, AC\-Miner\xspace can also be useful for detecting irregular coding practices in Android's system services. This may not only improve code quality, but may also help increase computation speed, fix access bugs, or indicate locations of future vulnerabilities, as described below.
\myp{1. Shortcuts to Speed-Up Access} As Table~\ref{p1:table:other_inconsistencies} shows, AC\-Miner\xspace detected 7{} inconsistencies that when fixed will improve the performance of the system. For example, consider the \ttt{BatteryStatsService}. In this service, whenever an entry point checks for the permission \ttt{UPDATE\_DEVICE\_STATS}, the entry point first calls \ttt{enforceCallingPermission}, which contains an additional \textit{PID} check that grants the service quick access to its own entry point, bypassing the permission check. This optimization speeds up access without a significant security-cost. Now consider another entry point \ttt{takeUidSnapshots} in the same service.
AC\-Miner\xspace recommended this same \textit{PID} check to be included when other permissions in the service \ttt{BATTERY\_STATS} permission is checked for this entry point, i.e., ensuring the consistent application of such valuable short cuts.
\myp{2. Fixing Access Bugs} AC\-Miner\xspace detected 2{} inconsistencies that when fixed solve access-related bugs, i.e., discrepancies in how a permission should be used (i.e., as per the documentation). For example, consider the entry point \ttt{getUserCreationTime} of the \ttt{UserManagerService}. The entry point is currently limited to being called by either the same user as the user indicated by the \text{userId} passed in as an argument or a parent of user. However, other similar entry points in the service also grant access to callers with the \textit{signature} level permission \ttt{MANAGE\_USERS}. Thus, AC\-Miner\xspace recommends the addition of the \ttt{MANAGE\_USERS} permission check to this entry point. This is consistent with the documentation,
which states that callers with the \ttt{MANAGE\_USERS} permission may call \ttt{getUserCreationTime}.
\myp{3. Potential Vulnerabilities} AC\-Miner\xspace detected 16{} inconsistencies which may lead to future vulnerabilities. Consider the entry point \ttt{deletePackage} in the \ttt{PackageManagerService}, which checks for the permission \ttt{INTERACT\_ACROSS\_USERS\_FULL} when verifying if the calling user can operate on the user represented by the \textit{userId} argument. Almost all the entry points in the service use the authorization check \ttt{enforceCrossUserPermission} to perform a similar user-related authorization check. That is, \ttt{deletePackage} still performs the hard-coded permission check, and is inconsistent with the majority that call the modular \ttt{enforceCrossUserPermission} permission check. Thus, there is as strong possibility that the hard-coded check in \ttt{deletePackage} may be overlooked when additional user-related enforcement is introduced, resulting in a vulnerability.
\subsection{Improvements to AC\-Miner\xspace's Accuracy}
\label{p1:sec:eval_ImproveAccuracy}
Our systematic investigation of AC\-Miner\xspace's results leads to 6 causes of non-security rules that motivate future work:
\myp{1. Difference in Functionality} A majority of the non-security inconsistencies (i.e., 189) were caused in cases where the target and \glspl{support_p1} contained unrelated protected operations, and thus, comparing their authorization checks resulted in unusable \glspl{arule_p1}. We are exploring techniques such as call graph comparison and method-name comparison to improve entry point groupings to mitigate such rules.
\myp{2. Checks With Different Arguments} We observed 66 non-security inconsistencies where same authorization checks were instantiated in code with slightly different arguments, without affecting the security context.
This problem may be mitigated by making AC\-Miner\xspace's analysis more precise, i.e., by analyzing consistency in terms of the relevant arguments and variables that actually affect the security context of the authorization check. Such fine-grained analysis is a non-trivial problem for future work.
\myp{3. Noise in Captured Checks} Despite the use of the control predicate\xspace filter, AC\-Miner\xspace still identifies some conditional statements and method calls improperly as authorization checks. We have already determined the statements causing this issue, and are addressing it via a routine refinement of the control predicate\xspace filter as well as the expressions used to identify context queries\xspace.
\myp{4. Restricted to Special Callers} We found that numerous entry points in the system are restricted to being called by special callers (e.g., the \textit{UID} of system, shell, or root). As a result, any \gls{arule_p1}s generated for such entry points are valueless since the \gls{target_p1} is more restrictive than the \glspl{support_p1}.
We are exploring the integration of a unified view of the hierarchy among the different authorization checks in AC\-Miner\xspace (i.e., in terms of which checks supersede others) to mitigate such issues.
\myp{5. Semantic Groups of Checks} We observed that a number of unrelated permission checks are always accompanied by checks for the system or root \textit{UID} or isolated processes. Thus, AC\-Miner\xspace ends up generating rules using the UIDs/isolated process checks as \glspl{supportac_p1}, recommending unrelated permissions as the missing authorization checks. That is, since AC\-Miner\xspace does not consider such semantic groups, it generates multiple incorrect rules in cases where a few entry points check for different, unrelated, permissions, while also checking for UIDs/isolated processes. From our analysis of the results, we have discovered that such rules can be filtered out as the generally follow a pattern.
\myp{6. Equivalent Checks} AC\-Miner\xspace does not consider the semantic equivalence between authorization checks, and thus, cannot eliminate \glspl{arule_p1} generated due to multiple checks having the same outcome. Fortunately, we have discovered numerous sets of equivalent checks through this analysis, which we plan to apply to AC\-Miner\xspace to improve its accuracy.
\section{Background and Motivation}
\label{sec:background}
\label{sec:motivation}
The Android middleware is implemented using the same component abstractions as third-party applications~\cite{eom09a}: activities, content providers, broadcast receivers, and services.
In this paper, we only consider service components, which provide daemon-like functionality.
Apps interface with service components via the \ttt{Binder} inter-process communication (IPC) mechanism, which consists of sending \textit{parcel} objects that indicate the target interface method being called via an integer. For the most part, Android's system services use the Android Interface Description Language (AIDL) to automatically generate the code that unmarshalles these parcels. Moreover, when interfacing with system services, third party apps rely on public APIs implementing a \textit{proxy} to construct the parcel.
When the parcel is unmarshalled by the service interface, the arguments are passed to a \textit{stub} that calls the corresponding \textit{entry point} method in the service component.
\begin{extended}
While not all service entry points have corresponding public APIs, any third-party application can use reflection to invoke the entry points for ``hidden'' APIs.
\end{extended}
Android uses two broad techniques to enforce access control.
For coarse-grained checks (i.e., at the component level), the Activity Manager Service (AMS) enforces policy specified in application manifest files.
This paper focuses on fine-grained checks (i.e., at the service entry point level), which are enforced using hard-coded logic within the service implementation.
This hard-coded logic includes variants of the \method{checkPermission} method, Unix Identifier (UID) checks, as well as many subtle checks based on service-specific state.
Prior work~\cite{socq+16, ahs+18} has primarily relied on manual enumeration of these checks, which is error prone.
To simplify discussion in this paper, we refer to such methods that return or check Android system state as \textit{context queries.}
\begin{figure}
\centering
\resizebox{0.9\columnwidth}{!}{
\input{figs/overview_code}
}
\caption{Vulnerability found in \ttt{UserManagerService} by our tool}
\label{p1:fig:overview_code}
\end{figure}
Figure~\ref{p1:fig:overview_code} provides a motivating example for this paper, which contains a vulnerability discovered by AC\-Miner\xspace.
The simplified code snippet is from the User Manager Service, which provides core functionality similar to the Activity Manager and Package Manager Services.
In the figure, there are two entry points: \method{hasBaseUserRestriction} and \method{hasUserRestriction}.
The entry points perform very similar functionality, but have inconsistent authorization checks.
Specifically, \method{hasBaseUserRestriction} throws a \class{SecurityException} if the caller does not have the proper UID or permission.
This example is particularly apropos to AC\-Miner\xspace, because \method{hasUserRestriction} does not call any of the context queries considered by prior work~\cite{socq+16, ahs+18}.
It also does not throw a \class{SecurityException}.
Without knowledge that \method{isValidRestriction} is an authorization check, no form of consistency analysis could have identified that \method{hasUserRestriction} has a missing check.
\section{Conclusion}
\label{sec:conc}
This paper provides an approach for the systematic and in-depth analysis of a crucial portion of Android's reference monitor, i.e., its system services. We design AC\-Miner\xspace, a static analysis framework that comprehensively identifies a diverse array of authorization checks used in Android's system services, and then adapts the well-founded technique of association-rule mining to detect inconsistent access control among service entry points. We discover 28 security vulnerabilities by analyzing AOSP version 7.1 using AC\-Miner\xspace, and demonstrate significantly higher coverage of checks than the state of the art. Our work demonstrates the feasibility of in-depth analysis of Android's system services with AC\-Miner\xspace, as it significantly reduces the number of entry points that must be analyzed, from over 4000 with millions of lines of code to a mere 246{}.
\myp{Acknowledgements} This work was supported by the Army Research Office (ARO) grant W911NF-16-1-0299 and the National Science Foundation (NSF) grants CNS-1253346 and CNS-1513690. Opinions, findings, conclusions, or recommendations in this work are those of the authors and do not reflect the views of the funders.
\section{Design}
\label{sec:design}
AC\-Miner\xspace is constructed on top of the Java static analysis framework Soot~\cite{vcg+99,lam2011soot} and has been largely parallelized so as to improve the run time of the complex analysis of Android's services.
The design of AC\-Miner\xspace can be divided into three phases: (\S\ref{sec:mine-auth-check}) Mining Authorization Checks, (\S\ref{dsgn:refine}) Refining Authorization Checks, and (\S\ref{sec:const}) Inconsistency Analysis.
\subsection{Mining Authorization Checks}
\label{sec:mine-auth-check}
The first phase of AC\-Miner\xspace is mining authorization checks.
This phase consist of the following program analysis challenges: (\S\ref{sec:cg-const}) Call Graph Construction, (\S\ref{sec:id-auth-check}) Identifying Authorization-Check Statements, and (\S\ref{p1:sec:rep-auth-checks}) Representing Authorization Checks.
\begin{figure}[t]
\centering
\resizebox{0.9\columnwidth}{!}{
\includegraphics{figs/design_diagram}
}
\caption{AC\-Miner\xspace's processing stages and input files.}
\label{fig:design_diagram}
\end{figure}
\subsubsection{Call Graph Construction}
\label{sec:cg-const}
Authorization checks are mined by traversing a call graph of the service implementation.
AC\-Miner\xspace constructs call graphs using the following three steps.
\myp{Extracting Java Class Files}
AC\-Miner\xspace extracts a \textit{.jar} containing all the class files of the Android middleware in Soot's Jimple format from Android's \textit{system.img}. This \textit{.jar} containing Jimple files is then used on all subsequent runs of AC\-Miner\xspace.
\begin{conference}
The implementation of this approach is detailed in the extended version~\cite{acminer-extended}.
\end{conference}
\begin{extended}
The implementation of this approach is detailed in Appendix~\ref{p1:app:extracting_java_class}.
\end{extended}
\myp{Extracting System Services and Entry Points}
Android's middleware is composed of isolated services that communicate through predefined \ttt{Binder} boundaries.
This division allows AC\-Miner\xspace to analyze each service separately, by defining each service by the code reachable through its \ttt{Binder} entry points. AC\-Miner\xspace extracts system services and their entry points similar to prior work~\cite{azhl12,socq+16,ahs+18}.
\begin{conference}
For implementation details, please see the extended version~\cite{acminer-extended}.
\end{conference}
\begin{extended}
For implementation details, please see Appendix~\ref{p1:app:extracting_java_class_2}.
\end{extended}
\myp{Reducing the Call Graph}
AC\-Miner\xspace constructs a call graph representing all possible transitive calls from the entry points.
AC\-Miner\xspace uses the Class Hierarchy Analysis (CHA)~\cite{dgc95}, which is guaranteed to provide an over-approximation of the actual runtime call graph.
In contrast, Kratos and AceDroid use other potentially more accurate call graph builders (i.e., SPARK~\cite{lh03} and its WALA equivalent), which use points-to analysis to construct a less complete
under-approximation of the runtime call graph.
The loss of completeness occurs when constructing call graphs for libraries and other Java code without main methods.
Therefore, it is important to note that unlike the prior work, AC\-Miner\xspace is more complete and guaranteed to include all paths containing authorization checks.
\begin{comment}
AC\-Miner\xspace uses the Class Hierarchy Analysis (CHA)~\cite{dgc95}, which is guaranteed to provide an over-approximation of the actual runtime call graph.
In contrast, other potentially more accurate call graph builders that use points-to information lead to an unsound under-approximation of the runtime call graph.
The unsoundness occurs when constructing call graphs for libraries and other Java code without main methods.
Both Kratos and AceDroid uses these unsound call graph builders, specifically SPARK~\cite{lh03} and its WALA equivalent.
Therefore, AC\-Miner\xspace is guaranteed to include all paths containing authorization checks whereas Kratos and AceDroid are not.
\end{comment}
Since CHA call graphs are coarse over-approximations of the runtime call graph, AC\-Miner\xspace must apply heuristics to mitigate call graph bloat.
When resolving targets for method invocations, CHA considers every possible implementation of the target method whose declaring type is within the type hierarchy of the call's receiver type.
If the invoked method is defined in a widely used interface or superclass, the resolution may identify hundreds of targets for a single invocation.
Thus, the resulting CHA call graph for the Android middleware is too large to be analyzed in a reasonable amount of time and memory~\cite{lhotak2007comparing}.
To mitigate call graph bloat, we manually defined a list of classes and methods to exclude from the analysis, which become cutoff points in the call graph.
We ensured that the class or method subject to exclusion did not contain, lead to, or was used in an authorization check.
While the exclude list may require revision for newer versions of AOSP or modifications made by vendors, the creation of the exclude list is a largely one-time effort.
\begin{conference}
Please see the extended version~\cite{acminer-extended}
\end{conference}
\begin{extended}
Please see Appendix~\ref{p1:app:appendix_excludeList}
\end{extended}
for a detailed description of the exclusion procedure and our website~\cite{acminer-website} for a full list of excluded classes/methods.
Finally, when analyzing an entry point, AC\-Miner\xspace treats all other entry points as cutoff points in the call graph. This decision further reduces call graph bloat.
Unfortunately, it also introduces unsoundness into the call graph, which we discuss in Section~\ref{p1:sec:limitations}.
\subsubsection{Identifying Authorization Check Statements}
\label{sec:id-auth-check}
Once AC\-Miner\xspace has the call graph for all entry points, the next step is to identify authorization checks.
As described in Section~\ref{sec:motivation}, the complete set of authorization checks is unknown.
AC\-Miner\xspace takes a two pronged approach to identifying authorization checks.
First, it identifies all possible checks leading to a protected operation (this section).
Second, it refines the list of possible authorization checks based on code names and string values (Section~\ref{dsgn:refine}).
To describe this process, we must first define a \textit{control predicate\xspace}.
\begin{defn}[\textit{Control Predicate\xspace}]\label{defn:cps}
A conditional statement (i.e., an \ttt{if} or \ttt{switch} statement) whose logic authorizes access to some protected operation.
\end{defn}
Identifying protected operations is nontrivial, as they may range from accessing a device node to returning a private member variable.
However, even if we knew the protected operations, we would still need to determine which conditional statements are control predicates\xspace.
AC\-Miner\xspace uses the key observation that Android frequently throws a \class{SecurityException} when access is denied.
Therefore, AC\-Miner\xspace marks all conditional statements on the control flow path between entry points and the statement throwing the \class{SecurityException} as \emph{potential} control predicates\xspace.
While throwing a \class{SecurityException} is the most common way Android denies access, it is not the only way.
Some entry points deny access by returning false or even by returning empty data.
Such denials are not easily identifiable.
Fortunately, as shown in Figure~\ref{p1:fig:overview_code}, Android often groups authorization checks into methods to simplify placement. We refer to such groups of authorization checks as \textit{context queries\xspace}.
\begin{defn}[\textit{Context Query\xspace}]\label{defn:cqs}
A method consisting entirely of a set of \textit{control predicates\xspace}, calls to other \textit{context queries\xspace}, and/or whose return value is frequently used as part of a \textit{control predicate\xspace}.
\end{defn}
By identifying \textit{context queries\xspace}, AC\-Miner\xspace can mark control predicates\xspace not on the path between a entry point and a thrown \class{SecurityException}, thereby making the authorization check mining more complete.
As shown in Figure~\ref{fig:design_diagram}, AC\-Miner\xspace is configured with a input file that specifies context queries\xspace.
Our method for defining this input is described in Section~\ref{dsgn:refine}.
Using these insights, AC\-Miner\xspace identifies authorization checks with fairly high accuracy.
The identification procedure is as follows.
First, AC\-Miner\xspace marks all conditional statements inside a context query\xspace and the subsequent transitive callees as control predicates\xspace for the entry point.
Next, AC\-Miner\xspace performs a backwards inter-procedural control flow analysis from each statement throwing a \class{SecurityException} and each context query\xspace invocation to the entry point.
During this backwards analysis, AC\-Miner\xspace marks all conditional statements on the path as potential control predicates\xspace.
Finally, to capture control predicates\xspace that occur without a \class{SecurityException}, AC\-Miner\xspace performs a forward inter-procedural def-use analysis on the return value of a context query\xspace.
During this analysis, AC\-Miner\xspace marks any conditional statement that uses the return value as a potential control predicate\xspace.
Note, AC\-Miner\xspace does not currently track the return value through fields, as this was found to be too noisy.
However, AC\-Miner\xspace can track the return value through variable assignments, arithmetic operations, array assignments, and the passed parameters of a method invoke.
\subsubsection{Representing Authorization Checks}
\label{p1:sec:rep-auth-checks}
AC\-Miner\xspace represents the authorization checks for each entry point as a set of context queries\xspace and control predicates\xspace.
We initially represented authorization checks as boolean expressions representing the control flow decisions that lead to a thrown \class{SecurityException} or invoked context query\xspace.
This representation would allow AC\-Miner\xspace to verify the existence, order, and the comparison operators of the authorization checks.
However, for complex services (e.g., the Activity Manager) this representation was infeasible due to the large number of authorization checks.
Additionally, we found that without more complex context-sensitive analysis, AC\-Miner\xspace could not extract authorization checks involving implicit flows.
Therefore, we simplified our consistency analysis to only consider \emph{the existence} of an authorization check for an entry point.
This approach requires two reasonable correctness assumptions:
(1) all authorization checks have been placed and ordered correctly, and
(2) all control predicates\xspace have the correct comparison operator.
AC\-Miner\xspace cannot detect violations of these assumptions.
The existence of authorization checks is easily represented as a set; however some processing is required.
For each variable in a authorization check statement, AC\-Miner\xspace must substitute all possible values for that variable.
More specifically, for each control predicates\xspace and context queries\xspace statement (i.e., conditional or method invoke statement), AC\-Miner\xspace must generate a list containing the product of all the possible variables and the values for each variable.
To reduce redundant output, AC\-Miner\xspace only computes the product for context queries\xspace that do not have a return value or whose return value is not used in a control predicates\xspace.
For this expansion, AC\-Miner\xspace applies an inter-procedural def-use analysis to each variable used in a statement, thereby obtaining the set of all possible values for that variable from the entry point to this specific use site.
It then computes the product of these sets to achieve the complete set of authorization checks for a single statement.
If a variable is assigned a value from the return of a method call, AC\-Miner\xspace does not consider the possible return values of the method, but instead includes a reference to all the possible targets of the method call.
Similarly, if a variable is assigned a value from the field of a class or an array, AC\-Miner\xspace includes only a reference to the field or array instead of all the possible values that may be assigned to the field or array.
As such, while the list of values largely consists of constants, it may also contain references to fields, methods and arrays.
The resulting combination of all the iterations of values for each control predicate\xspace and each required context query\xspace of an entry point makes up the final set of authorization checks output by AC\-Miner\xspace.
The resulting set has the potential to be exponentially large.
To prevent this growth and to remove noise in AC\-Miner\xspace's output, we apply several simplifications to the authorization checks
\begin{conference}
(see the extended version~\cite{acminer-extended}).
\end{conference}
\begin{extended}
(see Appendix~\ref{p1:app:appendix_authCheckSimplify}).
\end{extended}
These simplifications are designed to increase the number of authorization checks that are equivalent from a security standpoint and in no way affect the completeness of the authorization checks.
\subsection{Refining Authorization Checks}
\label{dsgn:refine}
The techniques in Section~\ref{sec:id-auth-check} identify \emph{potential} control predicates\xspace; however, not all conditional statements are authorization checks.
Performing consistency analysis at this point would be infeasible due to the excessive noise in the data.
Therefore, AC\-Miner\xspace uses a one-time, semi-automated method to significantly reduce noise.
Our key observation is that Section~\ref{sec:mine-auth-check} over approximates authorization checks on the path from entry points to a thrown \class{SecurityException} or context query\xspace.
From this over-approximation, AC\-Miner\xspace can generate a list of all the strings and fields used in the conditional statements, a list of the methods whose return values are used in the conditional statements, and the methods containing the conditional statements.
These values can be manually classified as authorization-related or not.
The general refinement procedure is as follows:
(1) a domain expert filters out values not related to authorization;
(2) the refined list is translated into generalized expressions;
(3) AC\-Miner\xspace uses the generalized expressions to automatically filter out values not related to authorization;
(4) the generalized expressions are refined until the automatically generated list is close to that defined by the domain expert.
While creating generalized expressions is time consuming, they can be used to analyze multiple Android builds with minimal modifications.
The specific refinement procedure is divided into two phases:
(\S\ref{sec:refine-cq}) identifying additional context queries\xspace, and (\S\ref{refine-cp}) refining control predicate\xspace identification.
\input{tables/context_queries_org}
\subsubsection{Identifying Additional Context Queries\xspace}
\label{sec:refine-cq}
AC\-Miner\xspace uses context queries\xspace as indicators of the existence of authorization checks when no \class{SecurityException} is thrown.
Our initial list of \textit{context queries\xspace}, shown in Table~\ref{table:cqs-org}, was very limited and only contained 33{} methods.
To expand this list we performed the following steps:
(1) run AC\-Miner\xspace as described in Section~\ref{sec:mine-auth-check} using the initial list of \textit{context queries\xspace},
(2) from the marked conditional statements, generate a list of the methods containing these conditional statements and the methods whose return values are used in these conditional statements,
(3) have a domain expert inspect the list and identify methods that match our definition of a context query\xspace, and add these to our list of context queries\xspace, and
(4) repeat steps 1$\rightarrow$3 until no new context queries\xspace are added to the list.
For Android AOSP 7.1.1, this procedure took about 48 hours and increased the number of \textit{context queries\xspace} to 620{} methods.
To make this list reusable, we translate it into a set of generalized expressions that describe context queries\xspace across different Android versions.
The expressions consist of regular expressions and string matches for the package, class, and name of a method, and also include conditional logic. An example expression is shown in
Figure~\ref{p1:fig:design_cqExprExample}.
Overall, we defined 49 generalized expressions to describe context queries\xspace for Android AOSP 7.1.1, which took $<$10 hours. The expressions enabled AC\-Miner\xspace to identify an additional \pTotalDiffManualContextQueries{} methods, resulting in a total of 875{} context queries\xspace. Please see
\begin{conference}
the extended version~\cite{acminer-extended}
\end{conference}
\begin{extended}
Appendix~\ref{p1:app:appendix_repCQS}
\end{extended}
for details on the translation procedure and our website~\cite{acminer-website} for the expression-list.
\begin{figure}
\centering
\resizebox{0.65\columnwidth}{!}{
\input{figs/design_cqExprExample}
}
\vspace{-0.5em}
\caption{Example expressions to describe context queries\xspace.}
\label{p1:fig:design_cqExprExample}
\end{figure}
\subsubsection{Refining Control Predicate\xspace Identification}
\label{refine-cp}
To refine the over-approximation of authorization checks, AC\-Miner\xspace again uses a semi-automated method of refinement, this time for control predicates\xspace.
The process begins by running AC\-Miner\xspace with the refined context queries\xspace from Section~\ref{sec:refine-cq}.
The expert then inspects lists of strings, fields, and methods for the \emph{potential} control predicates\xspace, removing those not related to authorization.
From our exploration, we discovered a number of different categories of control predicates\xspace. Some we were aware of such as those involving \textit{UID}, \textit{PID}, \textit{GID}, \textit{UserId}, \textit{AppId}, and package name.
However, even within these categories, we discovered new fields, methods, and contexts in which checks are performed.
We also discovered previously unknown categories of control predicates\xspace including those: (1) involving \ttt{SystemProperties}, (2) involving flags, (3) performing permission checks using the string equals method instead of the standard check permission methods, (4) checking for specific intent strings, and (5) checking boolean fields in specific classes.
Finally, we discovered that a significant amount of noise was generated by the conditional statements of loops and sanity checks such as \textit{null} checks. Using all of the information gained from the exploration of elements related to possible \textit{control predicates\xspace}, we defined a filter that refines control predicate\xspace and reduces the overall noise.
Overall, the exploration took about 56 hours.
We defined a 41-rule filter in about 16 hours (see our website~\cite{acminer-website} for the actual filter and
\begin{conference}
the extended version~\cite{acminer-extended}
\end{conference}
\begin{extended}
Appendix~\ref{p1:app:appendix_definingCPSFilter}
\end{extended}
for the specification process).
The application of the filter for Android AOSP 7.1.1 reduced what AC\-Miner\xspace considered to be control predicates\xspace from 25808{} to 3308{}. Such a significant reduction not only underscores the need for a filter but also makes the consistency analysis (Section~\ref{sec:const}) more feasible.
\input{inconsistency}
\section{Evaluation}
\label{sec:eval}
We evaluated AC\-Miner\xspace by performing an empirical analysis of the system services in AOSP version 7.1.1\_r1 (i.e., API 25) built for a Nexus 5X device. Our analysis was performed on a machine with an Intel Xeon E5-2620 V3 (2.40 GHz), 128 GB RAM, running Ubuntu 14.04.1 as the host OS, OpenJDK 1.8.0\_141, and Python 2.7.6.
We used AC\-Miner\xspace to mine the authorization checks of all the entry points from this build of AOSP and perform consistency analysis, as described in Section~\ref{sec:design}. Finally, we manually analyzed the inconsistencies using a systematic methodology to identify high risk (i.e., easily exploitable) and high impact vulnerabilities, and developed proof-of-concept exploits to validate our findings. Our evaluation is guided by the following research questions:
\begin{enumerate}[label=\textbf{RQ\arabic*},ref=\textbf{RQ\arabic*}]
\item \label{rq:triaging} {\em Does AC\-Miner\xspace reduce the effort required by the domain expert in terms of the entry points that need to be analyzed?}
\item \label{rq:vuln} {\em Do the inconsistencies identified by AC\-Miner\xspace help a domain expert in finding security vulnerabilities?}
\item \label{rq:causes} {\em What are the major causes behind inconsistencies that do not resolve to security vulnerabilities?}
\item \label{rq:prior} {\em Is AC\-Miner\xspace more effective than prior work at detecting vulnerabilities in system services?}
\item \label{rq:time} {\em What is the time required by AC\-Miner\xspace to analyze all the system services in a build of Android?}
\end{enumerate}
We now highlight the salient findings from our evaluation, followed by the categorization of the discovered vulnerabilities. The categorization of non-security inconsistencies, developed via a systematic manual analysis of our results, is described in Section~\ref{p1:sec:eval_otherInconsistencies}.
\subsection{Evaluation Highlights}
\label{p1:sec:eval_summary}
\begin{figure}
\centering
\begin{subfigure}{.5\columnwidth}
\centering
\setlength{\belowcaptionskip}{-12pt}
\setlength{\abovecaptionskip}{2pt}
\input{figs/entry_points_reduce}
\caption{Entry Point Reduction}
\label{p1:fig:entry_points_reduce}
\end{subfigure}%
\begin{subfigure}{.5\columnwidth}
\centering
\setlength{\abovecaptionskip}{2pt}
\setlength{\belowcaptionskip}{0pt}
\input{figs/eval_risk_vs_impact}
\caption{Risk vs. Impact}
\label{p1:fig:eval_risk_vs_impact}
\end{subfigure}
\caption{(a) shows how AC\-Miner\xspace is able to reduce the scope of the AOSP 7.1.1 system code a domain expert needs to evaluate and (b) breaks down the \pTotalRiskImpactEp{} vulnerabilities in terms of risk and impact.}
\end{figure}
As shown in Figure~\ref{p1:fig:entry_points_reduce}, AC\-Miner\xspace reduces the total number of entry points that need to be manually analyzed down to just 246{} entry points with inconsistent authorization checks, a \pEpReduction{}\% reduction (\ref{rq:triaging}). As a result, AC\-Miner\xspace significantly enhances a domain expert's ability to evaluate the consistency of access control enforcement in the Android system by minimizing the effort required.
Further, AC\-Miner\xspace took approximately 1 hour and 16 minutes to mine the authorization checks of all entry points from the system image of the AOSP build, and spent an additional 30 minutes producing the HTML files for the \glspl{arule_p1} that represent potentially vulnerable entry points. While AC\-Miner\xspace could be optimized further, time taken by AC\-Miner\xspace is a feasible cost, given its scalability benefits over a fully manual analysis (\ref{rq:time}).
On manually analyzing the 246{} entry points, we discovered a total of \pTotalRiskImpactEp{} entry points containing security vulnerabilities (\ref{rq:vuln}). As Figure~\ref{p1:fig:eval_risk_vs_impact} illustrates, these \pTotalRiskImpactEp{} vulnerabilities were then classified in terms of their risk (i.e., the ease of exploiting a vulnerability) as well as the impact (i.e., the gravity of the consequence of an exploited vulnerability). Using this criteria, we found 7{} vulnerabilities that were high risk as well as high impact, 1{} vulnerability that was high risk only, 12{} vulnerabilities that were high impact only, and 8{} vulnerabilities that were low in terms of both risk and impact. All \pTotalRiskImpactEp{} vulnerabilities have been submitted to Google. So far, 2 of our vulnerabilities have been assigned a ''moderate'' Android Security Rewards (ASR) severity level, which is generally awarded to bypasses in access control mechanisms (e.g., restrictions on constrained processes, or general bypasses of privileged processes~\cite{asr}). In Section~\ref{p1:sec:eval_findings}, we categorize these \pTotalRiskImpactEp{} vulnerabilities according to their effect; however, we only discuss a few of these vulnerabilities in depth, due to space constraints.
AC\-Miner\xspace is significantly more effective than prior work at identifying inconsistent authorization checks. For instance, AC\-Miner\xspace is able to identify 875{} unique context queries\xspace using the semi-auto\-mated approach described in Section~\ref{sec:refine-cq}, a drastic \pPrecentIncreaseContextQueries{}\% improvement over the original 33{} context queries\xspace that encompass a majority of the context queries\xspace considered by Kratos~\cite{socq+16}. Further, while AceDroid~\cite{ahs+18} is more comprehensive than Kratos in its identification of Android's authorization checks, it relies on a manually defined list of context queries\xspace, which is insufficient. That is, as described in Section~\ref{sec:refine-cq}, our thorough attempts at identifying context queries\xspace through manual observation alone resulted in the identification of only 620{} context queries\xspace, \pPrecentIdContextQueries\% of the total context queries\xspace that AC\-Miner\xspace is able to find using its semi-automated approach. Thus, while AceDroid does not provide quantitative information on its set of context queries\xspace, we can certainly say that it is not as complete as AC\-Miner\xspace in its identification of Android's authorization checks.
Indeed, the context query\xspace \ttt{isValidRestriction} in Figure~\ref{p1:fig:overview_code} is an example of a context query\xspace that neither AceDroid nor Kratos was able to identify, and in fact, one that we missed in our manual definition of Android's authorization checks. However, through the general expressions, AC\-Miner\xspace was able to identify \ttt{isValidRestriction} as a context query\xspace and the vulnerability outlined in Figure~\ref{p1:fig:overview_code}. Moreover, neither AceDroid nor Kratos makes any mention of the App Ops restrictions in their definition of Android's authorization checks. Yet AC\-Miner\xspace is able to identify 2 vulnerabilities relating to the App Ops restrictions (see Section~\ref{p1:sec:eval_findings}). While a full empirical comparison with Kratos and AceDroid is infeasible due to the lack of source code access, our evaluation demonstrates that AC\-Miner\xspace makes significant advancements to existing work in terms of the coverage of the authorization checks, making the consistency analysis as complete as possible (\ref{rq:prior}).
Finally, AC\-Miner\xspace produced 453{} \glspl{arule_p1} denoting inconsistent authorization checks in 246{} entry points. Some entry points had more than one inconsistency. Furthermore, while some inconsistencies were indeed valid security vulnerabilities (\pTotalRiskImpactRule{}/453{}), others were a result of irregular coding practices in Android (\pTotalNonVulnerability{}/453{}) or indicative of AC\-Miner\xspace's limitations in terms of analyzing the semantics of the authorization checks (\ref{rq:causes}). The limitations identified via our analysis point to hard problems in analyzing Android's access control logic and motivate future work.
\input{findings}
\subsection{Findings}
\label{p1:sec:eval_findings}
\input{tables/vuln_table}
Table~\ref{tab:vuln} describes the vulnerabilities discovered through our analysis of Android 7.1.1 with AC\-Miner\xspace. On manually analyzing the inconsistent entry points produced by AC\-Miner\xspace, we discovered \pTotalRiskImpactEp{} entry points that represent security vulnerabilities. While most of these entry points represent one vulnerability each, two entry points (i.e., \ttt{getLastLocation} and \ttt{setStayOnSetting}, vulnerabilities 15 and 16 in Table~\ref{tab:vuln} respectively) each led us to clusters of multiple identically vulnerable entry points, as described later in this section. For simplicity, we count each cluster as a single vulnerability.
We group the vulnerabilities into the following 3 categories: {\sf (1)} user separation and restrictions, {\sf (2)} App Ops, {\sf (3)} and pre23. This categorization is based on the subsystems affected by the vulnerabilities (e.g., App Ops), as well as the characteristics they have in common (e.g., pre23). Additionally, some vulnerabilities that are hard to classify have been categorized as {\sf (4)} miscellaneous.
\myp{VC1: Multi-user Enforcement}
As shown in Table~\ref{tab:vuln}, a majority (i.e., 14{}) of the vulnerabilities affect Android's separation among users (i.e. user profiles in Android's multi-user enforcement~\cite{multi-user}). These can be further divided into four subcategories based on how they may be exploited: (1) leaking user information across users, (2) operating across users, (3) modifying user settings before a user exists, and (4) allowing users to bypass restrictions.
\emparagraph{1. Leaking Information to Other Users} In 5 entry points (i.e., 1$\rightarrow$5 in Table~\ref{tab:vuln}), the lack of checks leads to potential leaks of security-sensitive information to other users. For instance, using the vulnerable entry point \ttt{getInstalledApplications} in the \ttt{PackageManagerService}, any user can learn of the applications another user has installed, as the entry point does not enforce any checks other than checking if the user being queried exists.
Similarly, the entry point \ttt{hasUserRestriction} in the \ttt{UserManagerService}, previously used as the motivating example, is not protected with the \textit{signature} level permission \ttt{MANAGE\_USERS}, which is present in the similar \ttt{hasBaseUserRestriction} entry point. This omitted authorization check allows a user to know of the restrictions placed on other users, which is security-sensitive information that should not be public. The entry points \ttt{getPackagesHoldingPermissions}, \ttt{checkUriPermission} and \ttt{grantUriPermission} similarly leak sensitive information.
We experimentally confirmed the existence of both the vulnerabilities in \ttt{hasUserRestriction} and \ttt{getInstalledApplications} in Android 7.1.1 as well as Android 8.1. We have submitted bug reports to Google and received ''moderate'' ASR severity level for both the bugs. Further, we confirmed that the vulnerability in \ttt{getPackagesHoldingPermissions} was fixed in Android 8.1. As a result, we could not submit it to Google's bug program, which only considers bugs affecting the latest version of Android. All remaining vulnerabilities have been reported to Google.
\emparagraph{2. Operating Across Users} Missing authorization checks in 4 entry points (i.e., 6$\rightarrow$9 in Table~\ref{tab:vuln}) allow users to bypass multi-user restrictions and perform sensitive operations on behalf of other users. For example, we discovered that the entry point {\ttt{killPackageDependents}} takes in a \textit{userId} as an argument but does not actually verify whether the calling user is allowed to perform operations on behalf of the supplied \textit{userId}. This allows {\em any user to kill the apps and background processes of any other user}. A similar flaw in entry point \ttt{setUserProvisioningState} enables any user to set the state of any other user profile to states such as "managed", "unmanaged", or "finalized". Such changes may be dangerous. For instance, a user may be able to set their managed enterprise profile to unmanaged, releasing it from the administrator's control.
Fortunately, all four entry points described in this category can only be called from apps installed on the system image (i.e., are protected by authorization checks that ensure this). This indirectly mitigates some damage, by making the vulnerabilities difficult to exploit from a third-party app. However, capability leaks in privileged apps may allow such vulnerabilities to be exploited by third-party apps, as prior work has demonstrated~\cite{gzwj12,wgz+13}. All of these vulnerabilities have been reported to Google.
\emparagraph{3. Modifying User Settings Before A User Exists} Both the entry points \ttt{installExistingPackageAsUser} and \ttt{setApplicationHiddenSettingAsUser} do not perform the authorization check \ttt{exists}, which verifies if a the \textit{userId} passed into the entry points represents a valid user. Without this check, it is possible for a caller to install an app for a non-existent user or hide an app from a non-existent user. Thus, when the user for whom this change was made is actually created, these settings will already be in place. These entry points are only callable from systems apps; however, system apps may be compromised or may leak capabilities, and the \textit{exists} check needs to be in place to prevent system apps from being tricked into allowing users to install apps in profiles that have yet to be created (e.g., installing apps in a future enterprise profile). We have submitted these vulnerabilities to Google.
\emparagraph{4. Allowing Users to Bypass Restrictions} Vulnerabilities in entry points 12$\rightarrow$14 from Table~\ref{tab:vuln} allow a user to perform operations despite the restrictions placed on the user profile. For instance, the entry point \ttt{setAlwaysOnVpnPackage} does not check for the restriction \ttt{no\_config\_vpn}, allowing a managed user to set the always on VPN for the user profile to another application, effectively switching VPN connections. The entry points \ttt{setWallpaperComponent} and \ttt{startUpdateCredentialsSession} have similar vulnerabilities. All of these vulnerabilities have been reported to Google.
\myp{VC2: App Ops}
AC\-Miner\xspace identified weaknesses related to App Ops.
One such vulnerability lies in the \ttt{noteProxyOperation} of the \ttt{AppOpsService}. The entry point makes a note of an application performing some operation on behalf of some other application through IPC. However, unlike other entry points in the \ttt{AppOpsService}, \ttt{noteProxyOperation} is missing the authorization check \ttt{verifyIncomingUid} which includes a check for the \textit{signature} level permission \ttt{UPDATE\_APP\_OPS\_STATS}. Without \ttt{verifyIncomingUid}, it is possible for any non-system app to use \ttt{noteProxyOperation} to query the restrictions a user has placed on other apps, thus retrieving information that should not be available to non-system apps.
\begin{figure}
\centering
\resizebox{0.9\columnwidth}{!}{
\input{figs/eval_code_5}
}
\vspace{-0.5em}
\caption{The comment above \ttt{checkOp} from the class \ttt{AppOpsManager} that states it should not be used as a security check.
}
\label{p1:fig:eval_code_5}
\end{figure}
We discovered a set of identical vulnerabilities in App Ops through our analysis of the \ttt{getLastLocation} entry point in the \ttt{LocationManagerService}, which AC\-Miner\xspace pointed out as having inconsistent authorization checks. The \ttt{getLastLocation} entry point calls the authorization check \ttt{reportLocationAccessNoThrow} which performs the check \ttt{noteOpNoThrow} from the \ttt{AppOpsManager}, a wrapper for the \ttt{AppOpsService}. AC\-Miner\xspace correctly identified the use of \ttt{noteOpNoThrow} as an inconsistency since a majority of the entry points (9) in \ttt{LocationManagerService} use the authorization check \ttt{checkLocationAccess} which performs the check \ttt{checkOp} from the \ttt{AppOpsManager}. However, as Figure~\ref{p1:fig:eval_code_5} shows, the comment above the \ttt{checkOp} method clearly states that \ttt{checkOp} should not be used to perform a security check. Instead, one of the various forms of \ttt{noteOp} should be used. This implies that all 9 entry points using the context query\xspace \ttt{checkLocationAccess} suffer from a vulnerability, and that the use of \ttt{reportLocationAccessNoThrow} in \ttt{getLastLocation} is actually appropriate. This instance demonstrates an interesting outcome of the use of consistency analysis in AC\-Miner\xspace. That is, our use of consistency analysis in AC\-Miner\xspace is also useful in identifying instances, where the majority of the related entry points are vulnerable. As described previously, for simplicity, we count this cluster of vulnerable entry points as a single vulnerability, which has been submitted to Google.
\myp{VC3: Pre23}
\begin{figure}
\centering
\resizebox{0.9\columnwidth}{!}{
\input{figs/eval_code_7}
}
\vspace{-0.5em}
\caption{The permission protection levels of \ttt{WRITE\_SETTINGS} in the \ttt{AndroidManifest.xml} file~\cite{pre23}}
\label{p1:fig:eval_code_7}
\end{figure}
AC\-Miner\xspace identified a group of vulnerabilities related to Android's \textit{pre23} permission protection level.
The entry point \ttt{setStayOnSetting} in the \ttt{PowerManagerService} uses the authorization check \ttt{checkAndNoteWriteSettingsOperation}, which checks if an app has the \textit{signature} level permission \ttt{WRITE\_SETTINGS}. Permissions with the \textit{signature} protection level can only be granted to system apps (i.e., apps that were originally packaged with the system image). However, as shown in Figure~\ref{p1:fig:eval_code_7}, \ttt{WRITE\_SETTINGS} has an additional protection level of \textit{pre23}, which has an interesting effect on Android versions 6.0 or above (i.e., API 23 or above). It allows permissions marked as \textit{pre23} to be granted to non-system apps that target API 22 or below~\cite{protection_level}. Thus, as a result of the improperly defined permission protection levels for \ttt{WRITE\_SETTINGS}, the \ttt{pre23} grants non-system apps access to a \ttt{signature} level permission.
The damage resulting from the \textit{pre23} vulnerability is not restricted to the entry point \ttt{setStayOnSetting}. A simple search for the use of the permission \ttt{WRITE\_SETTINGS} in the authorization checks AC\-Miner\xspace mined for all entry points in the system revealed 13 additional entry points checking for the permission \ttt{WRITE\_SETTINGS}, 6 of which can be called from a non-system app using the \textit{pre23} vulnerability (i.e., these 6 entry points are not protected with any other \textit{signature} permission). Of the 6, the following 5 entry points deal with tethering and are located in the \ttt{ConnectivityService}: \ttt{setUsbTethering}, \ttt{stopTethering}, \ttt{startTethering}, \ttt{tether}, and \ttt{untether}. The last \ttt{setWifiApEnabled} was located in the \ttt{WifiServiceImpl} and allows a caller to set some WIFI access point configuration, causing the device to connect or disconnect from any WIFI access point the caller provides. These entry points are clearly more important to protect than \ttt{setStayOnSetting}, and an adversary may be able to do considerable damage by exploiting them. We do not count these entry points in our initial list of \pTotalRiskImpactEp{} vulnerabilities. All entry points affected by the \textit{pre23} vulnerability have been submitted to Google.
\myp{VC4: Miscellaneous Vulnerabilities}
AC\-Miner\xspace also identified 11{} vulnerabilities related to information leaks, denial of service, disabling of administrator apps, and a mixture of other minor vulnerabilities. All of these vulnerabilities have been reported to Google.
\subsection{Consistency Analysis}
\label{sec:const}
The final step of AC\-Miner\xspace is consistency analysis of authorization checks for each entry point.
In this paper, we perform consistency analysis of all entry points within a service.
However, the methodology may work across multiple services, or even across different OEM firmwares.
AC\-Miner\xspace performs consistency analysis by automatically discovering underlying correlative relationships between sets of authorization checks.
Specifically, AC\-Miner\xspace adopts a targeted approach for association rule mining by using constraint-based querying.
It then uses these association rules to predict whether an entry point's authorization checks are consistent.
The results are presented to a domain expert for review.
Figure~\ref{p1:fig:overview_association_rule} shows an example association rule generated by AC\-Miner\xspace from the code in Figure~\ref{p1:fig:overview_code}.
$X$ and $Y$ are sets of authorization checks found in entry points. The rule states that if an entry point has check(s) from the set $X$, then it must also have the check(s) in set $Y$.
AC\-Miner\xspace then uses these generated rules to identify potential vulnerabilities by reporting entry points that violate the learned rules (i.e., if an entry point has all of the checks in $X$, but it is missing checks in $Y$, then a violation occurs).
For instance, Figure~\ref{p1:tbl:overview_association_rule} shows the three entry points that match $X$ for the rule in Figure~\ref{p1:fig:overview_association_rule}, out of which \method{hasUserRestriction} fails to satisfy the rule (it does not contain \method{checkManageUsersPermission}).
On closer inspection, we discovered that all three entry points either set or get information about user restrictions.
Moreover, the functionality of \method{hasUserRestriction} is nearly identical to \method{hasBaseUserRestriction}, which suggests \method{checkManageUsersPermission} is needed.
As seen in these examples, AC\-Miner\xspace allows an expert to only compare entry points that are close
in terms of their authorization checks, which is
more precise than comparing all entry points to one another.
The remainder of this section discusses AC\-Miner\xspace's approach to efficiently discover these association rules and how AC\-Miner\xspace uses them to detect inconsistencies in authorization checks.
\begin{figure}
\centering
\begin{subfigure}[b]{.5\columnwidth}
\centering
\setlength{\abovecaptionskip}{6pt}
\setlength{\belowcaptionskip}{0pt}
\input{figs/overview_association_rule}
\caption{Association Rule}
\label{p1:fig:overview_association_rule}
\end{subfigure}%
\begin{subfigure}[b]{.5\columnwidth}
\centering
\input{tables/overview_association_rule_tbl}
\caption{Entry Points For Rule}
\label{p1:tbl:overview_association_rule}
\end{subfigure}
\vspace{-1em}
\caption{(a) shows an association rule generated from the code in Figure~\ref{p1:fig:overview_code} and (b) illustrates how the first 2 entry points satisfy the rule, while \ttt{hasUserRestriction} does not, indicating it contains one or more inconsistent authorization checks.}
\end{figure}
\subsubsection{Association Rule Mining}
\label{subsubsec:arm}
Association rule mining discovers correlative relationships between sets of authorization checks, $A = \{i_{1}, i_{2},\cdots,i_{n}\}$, across a set of entry points, $E=\{t_{1}, t_{2},\cdots, t_{m}\}$ where each entry point in $E$ contains a subset of the items in $A$.
An association rule takes the form $X \implies Y$ where $X$ (antecedent) and $Y$ (consequent) are sets of authorization checks and $X$ and $Y$ are disjoint, i.e., $X \subseteq A$ and $Y \subseteq A$ and $X \cap Y = \emptyset$.
To avoid an excessive number of association rules, AC\-Miner\xspace uses two statistical constraints (support and confidence) to remove candidate association rules that are less than the thresholds minimum support (\textit{minsup}) and minimum confidence (\textit{minconf}).
Let $\alpha(I)$ represent the set of entry points in $E$ that contain the authorization checks $I \subseteq A$, i.e., $ \alpha(I) = \{ t \in E \mid \forall i \in I, i \in t \}$. The support of an association rule $X \implies Y$ is the probability that a set of authorization checks $Z = X \cup Y$ appears in the set of transactions $E$, i.e., $\sigma(Z) = \frac{|\alpha(Z)|}{|E|}$. The confidence of an association rule is an estimate of the conditional probability of the association rule $P(Y|X)$ where $X \implies Y$ and can be calculated as $\textit{conf}(X \implies Y) = \frac{\sigma(X \cup Y)}{\sigma(X)}$.
While association rule mining has been applied to similar problems by prior work~\cite{hxha10}, the large transaction size (i.e., number of authorization checks in an entry point) in our problem domain makes general association rule mining algorithms infeasible due to their exponential complexity.
Therefore, AC\-Miner\xspace uses two main optimizations to reduce the complexity to polynomial time.
First, AC\-Miner\xspace only generates a subset of the association rules called closed association rules~\cite{szathmary06}. An association rule $X \implies Y$ is closed if $X \cup Y$ is a frequent closed itemset. A frequent closed itemset is a set of authorization checks $C \subseteq A$ where the support of $C$ is greater than \textit{minsup} and there does not exist a superset $C'$ that has the same support as $C$. $C$ is closed iff $\beta(\alpha(C)) = C$ where $\beta(T)$ represents the largest set of common authorization checks present in the entry points $T$ where $T \subseteq E$, i.e., $\beta(T) = \{ i \in A \mid \forall t \in T, i \in t \}$. Note that only mining frequent closed itemsets is loss-less, because all frequent itemsets can be generated from the set of frequent closed itemsets, as proven by Zaki and Hsiao~\cite{ZH02}. Our proof that closed association rules also do not result in information loss can be found in
\begin{conference}
the extended version~\cite{acminer-extended}.
\end{conference}
\begin{extended}
Appendix~\ref{p1:app:appendix_proof}.
\end{extended}
Second, AC\-Miner\xspace generates closed association rules in a targeted manner by placing constraints on the authorization checks that appear in the antecedent of the association rule. Since the goal of consistency analysis is to predict whether an entry point's implementation of authorization checks is consistent, we are only interested in generating association rules where the antecedent of the association rule is a subset of the entry point's authorization checks (i.e., $X \subseteq A_{j}$ where $A_{j}$ is the authorization checks of entry point $e_{j}$). For example, consider $A_{j} = \{i_{1}, i_{2}, i_{3}\}$ and we have two frequent closed itemsets $\{i_{1}, i_{2}, i_{3}, i_{4}\}$ and $\{i_{5}, i_{6}, i_{7}\}$. The association rule $\{i_{1}, i_{2}, i_{3} \implies i_{4}\}$ is useful, as it could potentially hint that the authorization checks in $A_{j}$ is inconsistent and should also contain $i_{4}$. However, all of the association rules from the set $\{i_{5}, i_{6}, i_{7}\}$ do not provide additional information on the consistency of authorization checks in $A_{j}$, as the two sets are disjoint.
Further, assuming that the authorization checks that are present within an entry point are correct, we can force the antecedent to be constant. In particular, when generating association rules from a frequent closed itemset $I$ for an entry point $A_{j}$, we set $X = A_{j} \cap I$ and can generate association rules by varying the items in $Y$. If we reduce the authorization checks in $X$, then we are making the rule less relevant to the consistency of the entry point $A_{j}$ while keeping $X$ constant only produces the most relevant association rules.
\subsubsection{Inconsistency Detection and Output Generation}
\label{subsubsec:output}
AC\-Miner\xspace uses the \glspl{arule_p1} discussed in Section~\ref{subsubsec:arm}
to analyze the consistency of an entry point's authorization checks.
To minimize the amount of manual effort required to verify the presence of an inconsistency, we ensure the output only contains high confidence rules by setting \textit{minconf} to 85\%. Moreover, as we want the authorization checks in the consequent of an association rule to be formed by at least 2 entry points, we set the \textit{minsup} to $\frac{2}{|E|}$.
While generating the \glspl{arule_p1}, we mark an entry point's authorization checks as consistent if there exists a frequent closed itemset that contains the exact same authorization checks as the entry point, as this hints that the entry point's authorization checks are consistent with another entry point's authorization checks. In particular, entry point $e_{j}$'s authorization checks $A_{j}$ is consistent iff $\exists C \in A | C = A_{j} \wedge \beta(\alpha(C)) \wedge \sigma(C) \geq \frac{2}{|E|}$. In contrast, we mark an entry point's authorization checks as potentially inconsistent if an \gls{arule_p1} exists where the entry point's authorization checks are the antecedent of the rule and the consequent is not empty (i.e., $\exists X \implies Y | X \subseteq A_{j} \wedge Y \neq \emptyset$).
AC\-Miner\xspace outputs an HTML file for the domain expert to review
for each \gls{arule_p1} representing a potentially inconsistent entry point.
The HTML file contains the set of \glspl{supportac_p1} for the \gls{arule_p1} (i.e. the antecedent), the set of authorization checks being recommended by the \gls{arule_p1} (i.e. the consequent), and the 3 or more entry points that contain the authorization checks of the \gls{arule_p1}. This group of entry points can be subdivided into two sets: the \gls{target_p1} and the \glspl{support_p1}. The \gls{target_p1} is the entry point the \gls{arule_p1} has identified as being inconsistent, i.e., the entry point the \gls{arule_p1} is recommending additional authorization checks for. The \glspl{support_p1} are the 2 or more entry points where the \glspl{recommend_p1} occur. Note that the \glspl{supportac_p1} occur in both the target and the \glspl{support_p1}.
To aid the review,
the HTML file also contains the set of all authorization checks from the \gls{target_p1} that do not occur in the \glspl{supportac_p1} and for all authorization checks, the method in the Android source code where the checks occur.
To reduce the manual effort required to confirm inconsistencies, we perform two post-processing techniques. First, we remove \glspl{arule_p1} where $|$\textit{\glspl{recommend_p1}}$| >= 5 * |$\textit{\glspl{supportac_p1}}$|$, since \glspl{arule_p1} that contain 100 authorization checks which imply 500 authorization checks is improbable. Second, we remove any remaining \glspl{arule_p1} that have over 100 \glspl{recommend_p1} as such \glspl{arule_p1} are unlikely to indicate inconsistencies, and the domain expert may not be able to evaluate such rules in a reasonable amount of time.
\section{Introduction}
Android has become the world's dominant computing platform, powering over 2 billion devices by mid-2017~\cite{android_stats}.
Not only is Android the primary computing platform for many end-users, it also has significant use by business enterprises~\cite{android_business} and government agencies~\cite{android_governmenta,android_governmentb}.
As a result, any security flaw in the Android platform is likely to cause significant and widespread damage, lending immense importance to evaluating the platform's security.
While Android is built on Linux, it has many differences.
A key appeal of the platform is its semantically rich application programming interfaces (APIs) that provide application developers simple and convenient abstractions to access information and resources (e.g., retrieve the GPS location, record audio using the microphone, and take a picture with the camera).
This functionality, along with corresponding security checks, is implemented within a collection of privileged userspace services.
While most Android security research has focused on third party applications~\cite{eom09b,fch+11,fwm+11,egc+10,pfnw12,ne13,sbl+14,bbh+15}, the several efforts that consider platform security highlight the need for more systematic evaluation of security and access control checks within privileged userspace services (e.g., evidence of system apps re-exposing information without security checks~\cite{gzwj12, wgz+13}, or missing checks in the Package Manager service leading to Pile-Up vulnerabilities~\cite{xpw+14}).
To date, only two prior works have attempted to evaluate the correctness of access control logic within Android's system services. Both Kratos~\cite{socq+16} and AceDroid~\cite{ahs+18} approximate correctness through consistency measures, as previously done for evaluating correctness of security hooks in the Linux kernel~\cite{ejz02,jez04,tzm+08}. However, these prior works have limitations. Kratos only considers a small number of manually-defined authorization checks (e.g., it excludes App Ops checks). AceDroid considers a larger set of authorization checks, but these are still largely manually defined, primarily through observation. Kratos performs coarse-grained analysis using call-graphs, leading to imprecision. AceDroid's program analysis provides better precision, but oversimplifies its access control representation, making it difficult to identify vulnerabilities within single system images.
In this paper, we propose Authorization Check Miner (AC\-Miner\xspace), a framework for evaluating the correctness of Android's access control enforcement through consistency analysis of authorization checks.
AC\-Miner\xspace is based on several novel insights.
First, we avoid identification of protected operations (a key challenge in the space) by considering program logic between service entry points and code that throws a \ttt{SecurityException}.
Second, we propose a semi-automated method of discovering authorization checks.
More specifically, we mine all constants and names of methods and variables that influence conditional logic leading to throwing a \ttt{SecurityException}.
From this dataset, we identify security-relevant values (e.g., ``restricted'') and develop regular expressions to automatically identify those conditions during program analysis that mines policy rules from the code.
Third, we use association rule mining to identify inconsistent authorization checks for entry points in the same service.
Association rule mining has the added benefit of suggesting changes to make authorization checks more consistent, which is valuable when triaging results.
By applying this methodology, AC\-Miner\xspace allows a domain expert (i.e., a developer familiar with the AOSP source code) to quickly identify missing authorization checks that allow abuse by third-party applications.
We evaluated the utility of AC\-Miner\xspace by applying it to the AOSP code for Android 7.1.1.
Of the 4,004 total entry points to system services, AC\-Miner\xspace identified 1,995 with authorization checks.
Of these entry points, the association rule mining identified inconsistencies in 246.
We manually investigated these 246 entry points with the aid of the rules suggested by the association rule mining, which allowed us to identify \pTotalRiskImpactEp{} security vulnerabilities. AC\-Miner\xspace not only reduced the effort required to analyze system services (i.e., by narrowing down to only 246 entry points out of 4004), but also allowed us to rapidly triage results by suggesting solutions. Out of the \pTotalRiskImpactEp{} security vulnerabilities, 7{} were in security-sensitive entry points that may be exploited from third-party applications, and an additional 12{} were in security-sensitive entry points that may be exploited from system applications. The rest were in entry points with relatively low security value.
All \pTotalRiskImpactEp{} vulnerabilities have been reported to Google.
At the time of writing, Google has confirmed 2{} of these vulnerabilities as ``moderate severity.''
This paper makes the following contributions:
\begin{itemize}
\item \textit{We design and implement AC\-Miner\xspace, a framework that enables a domain expert to identify and systematically evaluate inconsistent access control enforcement in Android's system services.}
Our results show that this analysis is not only useful for identifying existing vulnerabilities, but also inconsistencies that may lead to vulnerabilities in the future.
\item \textit{We combine program and text analysis techniques to generate a rich set of authorization checks used in system services.} This technique is a significant improvement over prior approaches that use manually-defined authorization checks.
\item \textit{We use AC\-Miner\xspace to evaluate the AOSP version of Android 7.1.1 and identify \pTotalRiskImpactEp{} vulnerabilities.} All vulnerabilities have been reported to Google, which at the time of writing has classified 2{} as ``moderate severity.''
\end{itemize}
\begin{extended}
We designed AC\-Miner\xspace to give security researchers and system developers deep insights into the security of Android’s system services.
\end{extended}
This paper describes how AC\-Miner\xspace can systematically analyze the consistency of the authorization checks in the system services.
However, AC\-Miner\xspace may also be useful for other forms of analysis.
For instance, AC\-Miner\xspace can aid regression testing, as it can be extended to highlight changes to the policy implementation on a semantic level.
The information extracted by AC\-Miner\xspace can also be used to study the evolution of access control in Android, potentially discovering new vulnerabilities.
Finally, since changes by OEMs have historically introduced vulnerabilities, OEMs can use AC\-Miner\xspace to validate their implemented checks against AOSP.
The remainder of this paper proceeds as follows.
Section~\ref{sec:background} provides background.
Section~\ref{sec:overview} describes the challenges and provides an overview of AC\-Miner\xspace.
Section~\ref{sec:design} describes the design of AC\-Miner\xspace in detail.
Sections~\ref{sec:eval} and~\ref{p1:sec:eval_otherInconsistencies} describe our analysis of the system services of AOSP 7.1.1.
Section~\ref{p1:sec:limitations} describes the limitations of our approach.
Section~\ref{sec:relwork} discusses related work.
Section~\ref{sec:conc} concludes.
\section{Limitations}
\label{p1:sec:limitations}
While AC\-Miner\xspace is effective at discovering inconsistencies that lead to vulnerabilities, consistency analysis has a general limitation, i.e., it may not discover vulnerabilities that are consistent throughout code. Further, for precision, AC\-Miner\xspace does not handle the invocation of secondary entry points, i.e., calls to entry points from within other entry points. AC\-Miner\xspace omits the {\em ordering} of the authorization checks and hence does not identify improper operator use in \textit{control predicates\xspace}, which we plan to explore in the future. Moreover, AC\-Miner\xspace's semi-automated analysis requires the participation of domain experts. However, as Section~\ref{sec:eval} demonstrates, our design significantly reduces manual effort in contrast with the manual validation of system services. As we have already analyzed AOSP version 7.1.1, only minor input is needed to analyze newer versions or vendor modifications.
Finally, AC\-Miner\xspace shares the general choices made by Android static analysis techniques for precision, i.e., it does not consider native code, or runtime modifications (e.g., reflection, dynamic code loading, Message Handlers).
\section{Non-security Inconsistencies}
\label{p1:sec:eval_otherInconsistencies}
AC\-Miner\xspace identified \pTotalOtherInconsistencies{} inconsistencies (i.e., rules) that did not represent vulnerabilities. Aside from the 20 rules that were caused by easily fixed bugs in AC\-Miner\xspace, we resolve these non-security inconsistencies to their likely causes, and classify them into 9 categories, shown in
Table~\ref{p1:table:other_inconsistencies} (\ref{rq:causes}). The first three categories point to irregular coding practices, i.e., (1) inconsistent application of short-cuts to speed up access, (2) access bugs or discrepancies in how the permission should be used as per the documentation, or (3) inconsistent application of hard-coded checks that would potentially lead to vulnerabilities on future updates. The remaining 6 categories point to issues that could be corrected by engineering improvements to AC\-Miner\xspace, such as considering semantic equivalence between authorization checks, or the integration of call graph comparison and method-name comparison to mitigate the analysis of functionally different entry points. We provide additional details on all of the 9 categories in
\begin{conference}
the extended version~\cite{acminer-extended}.
\end{conference}
\begin{extended}
Appendix~\ref{p1:app:appendix_eval_otherInconsistencies}.
\end{extended}
\input{tables/other_inconsistencies}
\section{Overview}
\label{sec:overview}
The goal of this paper is to help a domain expert quickly identify and assess the impact of incorrect access control logic in implementations of system services in Android.
As with most nontrivial software systems, no ground truth specification of correctness exists.
Rather, the ``ground truth'' resides largely within the heads of the platform developers.
Prior literature has approached this type of problem by approximating correctness with consistency.
The intuition is that system developers are not malicious and that they are likely to get most of the checks correct.
The approach was first applied to security hook placement in the Linux kernel~\cite{ejz02,jez04,tzm+08} and more recently the Android platform~\cite{socq+16, ahs+18}.
Evaluating authorization check correctness via consistency analysis requires addressing the following challenges.
\begin{itemize}
\item \textit{Protected Operations:}
Nontrivial systems rarely have a clear specification of the functional operations that require protection by the access control system.
Protected operations range from accessing a device node to reading a value from a private member variable.
Axplorer~\cite{bbd+16} attempts to enumerate protected operations for Android; however, the specification is far from complete.
\item \textit{Authorization Checks:}
What constitutes an authorization check is vague and imprecise.
While some authorization checks are clear (e.g., those based on \class{checkPermission} and \class{getCallingUid}), many others are based on service-specific state and the corresponding authorization checks use a variety of method and variable names.
\item \textit{Consistency:}
The granularity and type of consistency impacts the precision and utility of the analysis.
While increasing the scope of relevant authorization checks increases the noise in the analysis, not considering all authorization checks (as in Kratos~\cite{socq+16}) or using heuristics to determine relevancy (as in AceDroid~\cite{ahs+18}) raises the risk of not detecting vulnerabilities.
\end{itemize}
\begin{figure}[t]
\centering
\scalebox{0.85}{
\includegraphics[width=3.1in]{figs/overview}
}
\caption{Overview of AC\-Miner\xspace. At each stage, AC\-Miner\xspace significantly reduces the information an expert needs to analyze.}
\label{fig:overview}
\end{figure}
AC\-Miner\xspace addresses these challenges through several novel insights.
First, AC\-Miner\xspace avoids the need to specify protected operations by considering program logic between service entry points and code that throws a \class{SecurityException}.
Our intuition is that if one control flow path leads to a \class{SecurityException}, an alternate control flow path leads to a protected operation.
Furthermore, the conditional logic leading to the \class{SecurityException} describes the authorization checks.
However, we found that not all authorization denials lead to a \class{SecurityException}, therefore, we also include entry points that contain known authorization checks.
Second, AC\-Miner\xspace semi-automatically discovers new authorization checks using a combination of static program analysis and textual processing.
More specifically, AC\-Miner\xspace identifies all of the method names, variable names, and strings that influence the conditional logic leading to a \class{SecurityException}.
The security-relevant values are manually refined and used to generate regular expressions that identify a broader set of authorization checks within service implementations.
Third and finally, AC\-Miner\xspace uses association rule mining for consistency analysis.
For each entry point, AC\-Miner\xspace uses static program analysis to extract a set of authorization checks.
Association rule mining compares the authorization check sets between entry points in the same service.
The analysis produces suggestions (called ``rules'') of how the sets should change to make them more consistent.
These rules include confidence scores that greatly aid domain experts when triaging the results.
This general approach is depicted in Figure~\ref{fig:overview}.
To more concretely understand how AC\-Miner\xspace operates, consider the discovery of the vulnerability shown in Figure~\ref{p1:fig:overview_code}. As a pre-processing step, AC\-Miner\xspace helps a domain expert semi-automatically identify authorization checks. First, AC\-Miner\xspace determines that the return value of \ttt{isValidRestriction} controls flow from the entry point \ttt{hasBaseUserRestriction} to a \ttt{SecurityException}. As such, this method name, along with many security irrelevant names are given to a domain expert. The domain expert then identifies security relevant terms (e.g. ``restriction``), which AC\-Miner\xspace consumes as part of a regular expression. Next, AC\-Miner\xspace mines the policy of the User Manager Service, extracting a policy for both \ttt{hasBaseUserRestriction} and \ttt{hasUserRestriction}, with the policy for \ttt{hasUserRestriction} only being extracted because \ttt{isValidRestriction} was identified as an authorization check. For each entry point, the policy is then encoded as a set of authorization checks (e.g. \ttt{isValidRestriction} and \ttt{ROOT\_UID} \ttt{==} \ttt{getCallingUid()}). Finally, AC\-Miner\xspace performs association rule mining to suggest set changes that make the policy more consistent. Such suggestions led us to discover the vulnerability in \method{hasUserRestriction}.
\section{Related Work}
\label{sec:relwork}
AC\-Miner\xspace addresses a problem that has conceptual origins in prior work on
authorization hook validation for traditional systems.
Early investigations targeted the
Linux Security Modules (LSM) hook placement in the Linux kernel, using techniques such as type analysis using CQUAL~\cite{zej02}, program
dominance~\cite{zjk04}, and dynamic analysis to create authorization graphs
from control flow traces~\cite{jez04,ejz02}.
As the lack of ground truth is a general
challenge for hook validation, prior work
commonly uses consistency analysis~\cite{jez04, ejz02,
tzm+08}. Closest to our work is AutoISES~\cite{tzm+08}, which infers
security specifications from code bases such as the Linux kernel and
Xen. However, AutoISES assumes a known set of security functions or security-specific data structures, whereas AC\-Miner\xspace identifies a diverse set of authorization checks in the Android middleware.
The closest to our approach is prior work on authorization hook validation in the Android platform, i.e., Kratos~\cite{socq+16} and AceDroid~\cite{ahs+18}. AC\-Miner\xspace distinguishes itself from Kratos and AceDroid through its deep analysis of Android's system services, and its significantly improved coverage of Android's authorization checks.
Kratos~\cite{socq+16} compares a small subset of Android's authorization checks across entry points of the same system image to look for inconsistent checks between different system services. AC\-Miner\xspace does not analyze for consistency across services. Instead, we hypothesize that entry points within a single service are similar in purpose, and hence, analyze the consistency of the authorization checks by comparing the entry points of every system service with other entry points in the same service. Further, AC\-Miner\xspace's semi-automated approach for identifying authorization checks results in a \pPrecentIncreaseContextQueries{}\% improvement over Kratos' manually-curated list (Section~\ref{sec:eval}).
Similarly, AceDroid~\cite{ahs+18} evaluates the consistency of the authorization checks among different vendor-modified Android images, and hence differs from AC\-Miner\xspace in terms of its objective. AceDroid makes key improvements over Kratos, as it considers various non-standard context queries\xspace not considered by Kratos. However, AceDroid also relies on a manually-defined list of context queries\xspace, which
may produce only approximately \pPrecentIdContextQueries\% of the context queries\xspace that AC\-Miner\xspace is able to find (Section~\ref{sec:eval}).
\begin{extended}
While a quantitative comparison with Kratos and AceDroid is difficult due to the unavailability of code/data, this qualitative comparison demonstrates the remarkable improvements made by AC\-Miner\xspace's novel techniques.
\end{extended}
Finally, recent literature is rich with static and dynamic program analysis of
third-party Android apps targeted at privacy
infringement~\cite{egc+10, hhj+11, gcec12}, malware~\cite{zdyz14,
hzt+14, ejm+14}, as well as vulnerabilities~\cite{eomc11,
cfgw11}.
As the Android platform and apps use similar programming
abstractions, researchers have applied these
tools and techniques to the platform code, e.g., for providing a mapping between APIs and corresponding permissions~\cite{fch+11, azhl12, bkml14} or automatically identifies privacy-sensitive sources and sinks~\cite{arb14}. Moreover, prior work has also studied the platform
code, to analyze OEM apps for capability leaks (e.g., Woodpecker~\cite{gzwj12} and
SEFA~\cite{wgz+13}), discover privilege escalation on update vulnerabilities (e.g., Xing et al.~\cite{xpw+14}), or uncover gaps in the file access control policies in OEM firmware images (e.g., Zhou et al.~\cite{zlz+14}). While AC\-Miner\xspace shares a similar objective, unlike prior work, AC\-Miner\xspace provides an
automated and systematic investigation of core platform services.
| {'timestamp': '2019-01-14T02:17:43', 'yymm': '1901', 'arxiv_id': '1901.03603', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03603'} | arxiv |
\section{Introduction}
Medical imaging is the non-invasive process of producing internal visuals of a body for the purpose of medical examination, analysis, and treatment. In some cases, volumetric (3D) scans are required to diagnose certain conditions. The two most common techniques for producing detailed 3D medical imagery are Magnetic Resonance Imaging (MRI), and CT (Computed Tomography). Both MRI and CT scanner are essential tools in the medical domain. In 2016, there were approximately 38 million MRI scans and 79 million CT scans performed in the United States \cite{stats}.\footnote{245 CT scans and 118 MRI scans per 1,000 inhabitants.}
MRI and CT scanners are similar in that they both create 3D images by taking many 2D scans of the body over the axial plane (from front to back) along the body. The difference between the two is that MRIs use powerful magnetic fields and CTs use X-Rays. As a result, the two modalities capture body tissues differently: MRIs are used to diagnose issues with bone, joint, ligament, cartilage, and herniated discs. CTs are used to diagnose cancer, heart disease, appendicitis, musculoskeletal disorders, trauma, and infectious diseases \cite{john2008ct}.
Today, CT and MRI scanners are managed though a picture archiving and communication system (PACS). A PACS is essentially an Ethernet-based network involving a central server which (1) receives scans from connected imaging devices, (2) stores the scans in a database for later retrieval, and (3) retrieves the scans for radiologists to analyze and annotate. The digital medical scans are sent and stored using the standardized DICOM format.\footnote{\url{https://www.dicomstandard.org/about/}}
\subsection{The Vulnerability}
The security of health-care systems has been lagging behind modern standards \cite{Thebigge8:online, Feelingt39:online, Cybersec8:online, COVENTRY201848}. This is partially because health-care security policies mostly address data privacy (access-control) but not data security (availability/integrity) \cite{jalali2018cybersecurity}. Some PACS are intentionally or accidentally exposed to the Internet via web access solutions. Some example products include Centricity PACS (GE Healthcare), IntelliSpace (Philips), Synapse Mobility (FujiFilm), and PowerServer (RamSoft). A quick search on Shodan.io reveals 1,849 medical image (DICOM) servers and 842 PACS servers exposed to the Internet. Recently, a researcher at McAfee demonstrated how these web portals can be exploited to view and modify a patient's 3D DICOM imagery \cite{McAfeeRe34:online}. PACS which are not directly connected to the Internet are indirectly connected via the facility's internal network \cite{huang2019pacs}. They are also vulnerable to social engineering attacks, physical access, and insiders \cite{insider}.
Therefore, a motivated attacker will likely be able to access a target PACS and the medical imagery within it. Later in section \ref{sec:attackmodel} we will discuss the attack vectors in greater detail.
\subsection{The Threat}
An attacker with access to medical imagery can alter the contents to cause a misdiagnosis. Concretely, the attacker can add or remove evidence of some medical condition. Fig. \ref{fig:attack_overview} illustrates this process where an attacker injects/removes lung cancer from a scan.
Volumetric medical scans provide strong evidence of medical conditions. In many cases, a patient may be treated based on this evidence without the need to consider other medical tests. For example, some lesions are obvious or require immediate surgery. Moreover, some lesions will legitimately not show up on other medical tests (e.g., meniscus trauma and some breast cancers). Regardless, even if other tests aren't usually negative, ultimately, the evidence in the scan will be used to diagnose and treat the patient. As a result, an attacker with access to a scan has the power to change the outcome of the patient's diagnosis. For example, an attacker can add or remove evidence of aneurysms, heart disease, blood clots, infections, arthritis, cartilage problems, torn ligaments or tendons, tumors in the brain, heart, or spine, and other cancers.
There are many reasons why an attacker would want to alter medical imagery. Consider the following scenario: An individual or state adversary wants to affect the outcome of an election. To do so, the attacker adds cancer to a CT scan performed on a political candidate (the appointment/referral can be pre-existing, setup via social engineering, or part of a lung cancer screening program). After learning of the cancer, the candidate steps-down from his or her position. The same scenario can be applied to existing leadership.
\begin{figure}[t]
\centering
\includegraphics[width=\columnwidth]{CT_overview5_f.pdf
\caption{By tampering with the medical imagery between the investigation and diagnosis stages, both the radiologist and the reporting physician believe the fallacy set by the attacker.}
\label{fig:attack_overview}
\vspace{-1em}
\end{figure}
Another scenario to consider is that of ransomware: An attacker seeks out monetary gain by holding the integrity of the medical imagery hostage. The attacker achieves this by altering a few scans and then by demanding payment for revealing which scans have been affected.
Furthermore, consider the case of insurance fraud: Somebody alters his or her own medical records in order to receive money directly from his or her insurance company, or receive handicap benefits (e.g., lower taxes etc.) In this case, there is no risk of physical injury to others, and the payout can be very large. For example, one can (1) sign up for disability/life insurance, then (2) fake a car accident or other incident, (3) complain of an inability to work, sense, or sleep, then (4) add a small brain hemorrhage or spinal fracture to his or her own scan during an investigation (this evidence is very hard to refute), and then (5) file a claim and receive cash from the insurance company.\footnote{For example, see products such as AIG's Quality of Life insurance.}
There are many more reasons why an attacker would want to tamper with the imagery. For example: falsifying research evidence, sabotaging another company's research, job theft, terrorism, assassination, and even murder.
\begin{figure}[t]
\centering
\captionof{table}{Summary of an attacker's motivations and goals for injecting/removing evidence in 3D medical imagery.} \label{tab:attack}
\includegraphics[width=.95\columnwidth]{attack_table3_e.pdf}
\vspace{-1em}
\end{figure}
Depending on the attacker's goal, the attack may be either untargeted or targeted:
\begin{description}
\item[Untargeted Attacks] are where there is no specific target patient. In this case, the attacker targets a victim who is receiving a random voluntary cancer screening, is having an annual scan (e.g., BRACA patients, smokers...), or is being scanned due to an injury. These victims will either have an `incidental finding' when the radiologist reviews the scan (injection) or are indeed sick but the evidence won't show (removal).
\item[Targeted Attacks] are where there is a specific target patient. In these attacks, the patient may be lured to the hospital for a scan. This can be accomplished by (1) adding an appointment in the system, (2) crafting a cancer screening invite, (3) spoofing the patient's doctor, or (4) tampering/appending the patient's routine lab tests. For example, high-PSA in blood indicates prostate cancer leading to an \textbf{abdominal MRI}, high thyrotropin in blood indicates a brain tumor leading to a \textbf{head MRI}, and metanephrine in urine of hypertensive patients indicates cancer/tumor leading to a \textbf{chest/abdominal CT}
\end{description}
In this paper we will focus on the injection and removal of lung cancer from CT scans. Table \ref{tab:attack} summarizes attacker's motivations, goals, and effects by doing so. The reason we investigate this attack is because lung cancer is common and has the highest mortality rate \cite{bray2018global}. Therefore, due its impact, an attacker is likely to manipulate lung cancer to achieve his or her goal. We note that the threat, attack, and countermeasures proposed in this paper also apply to MRIs and medical conditions other than those listed above.
\subsection{The Attack}
With the help of machine learning, the domain of image generation has advanced significantly over the last ten years \cite{wu2017survey}. In 2014, there was a breakthrough in the domain when Goodfellow et al. \cite{goodfellow2014generative} introduced a special kind of deep neural network called a generative adversarial network (GAN). GANs consist of two neural networks which work against each other: the \textit{generator} and the \textit{discriminator}. The \textit{generator} creates fake samples with the aim of fooling the \textit{discriminator}, and the \textit{discriminator} learns to differentiate between real and fake samples. When applied to images, the result of this game helps the \textit{generator} create fake imagery which are photo realistic.
While GANs have been used for positive tasks, researchers have also shown how they can be used for malicious tasks such as malware obfuscation \cite{hu2017generating,rigaki2018bringing} and misinformation (e.g., deepfakes \cite{deepfakes}).
%
In this paper, we show how an attacker can realistically inject and remove medical conditions with 3D CT scans. The framework, called CT-GAN, uses two conditional GANs (cGAN) to perform in-painting (image completion) \cite{isola2017image} on 3D imagery. For injection, a cGAN is trained on unhealthy samples so that the \textit{generator} will always complete the images accordingly. Conversely, for removal, another cGAN is trained on healthy samples only.
To make the process efficient and the output anatomically realistic, we perform the following steps: (1) locate where the evidence should be inject/removed, (2) cut out a rectangular cuboid from the location, (3) interpolate (scale) the cuboid, (4) modify the cuboid with the cGAN, (5) rescale, and (6) paste it back into the original scan. By dealing with a small portion of the scan, the problem complexity is reduced by focusing the GAN on the relevant area of the body (as opposed to the entire CT). Moreover, the algorithm complexity is reduced by processing fewer inputs\footnote{A 3D CT scan can have over 157 million pixels whereas the latest advances in GANs can only handle about 2 million pixels (HD images).} (pixels) and concepts (anatomical features). This results in fast execution and high anatomical realism. The interpolation step is necessary because the scale of a scan can be different between patients. To compensate for the resulting interpolation blur, we mask the relevant content according to water density in the tissue (Hounsfield units) and hide the smoothness by adding Gaussian white noise. In order to assist the GAN in generating realistic features, histogram equalization is performed on the input samples. We found that this transformation helps the 3D convolutional neural networks in the GAN learn how to generate the subtle features found in the human body. The entire process is automated, meanings that the attack can be deployed in an air gapped PACS.
To verify the threat of this attack, we trained CT-GAN to inject/remove lung cancer and hired three radiologists to diagnose a mix of 70 tampered and 30 authentic CT scans. The radiologists diagnosed 99\% of the injected patients with malign cancer, and 94\% of cancer removed patients as being healthy. After informing the radiologists of the attack, they still misdiagnosed 60\% of those with injections, and 87\% of those with removals.
In addition to the radiologists, we also showed how CT-GAN is an effective adversarial machine learning attack. We found that the state-of-the-art lung cancer screening model misdiagnosed 100\% of the tampered patients. Thus, cancer screening tools, used by some radiologists, are also vulnerable to this attack.
This attack is a concern because infiltration of healthcare networks has become common \cite{Thebigge8:online}, and internal network security is often poor \cite{RSAConfe73:online}. Moreover, for injection, the attacker is still likely to succeed even if medical treatment is not performed. This is because many goals rely on simply scaring the patient enough to affect his/her daily/professional life. For example, even if an immediate deletion surgery is not deemed necessary based on the scan and lab results, there will still be weekly/monthly follow-up scans to track the tumor's growth. This will affect the patient's life given the uncertainty of his or her future.
\subsection{The Contribution}
To the best of our knowledge, it has not been shown how an attacker can maliciously alter the content of a 3D medical image in a realistic and automated way. Therefore, this is the first comprehensive research which exposes, demonstrates, and verifies the threat of an attacker manipulating 3D medical imagery. In summary, the contributions of this paper are as follows:
\makeatletter
\renewenvironment{description}%
{\list{}{\leftmargin=10pt
\labelwidth\z@ \itemindent-\leftmargin
\let\makelabel\descriptionlabel}}%
{\endlist}
\makeatother
\begin{description}
\item[The Attack Model] We are the first to present how an attacker can infiltrate a PACS network and then use malware to autonomously tamper 3D medical imagery. We also provide a systematic overview of the attack, vulnerabilities, attack vectors, motivations, and attack goals. Finally, we demonstrate one possible attack vector through a penetration test performed on a hospital where we covertly connect a man-in-the-middle device to an actual CT scanner. By performing this pen-test, we provide insights into the security of a modern hospital's internal network.
\item[Attack Implementation] We are the first to demonstrate how GANs, with the proper preprocessing, can be used to efficiently, realistically, and automatically inject/remove lung cancer into/from large 3D CT scans. We also evaluate how well the algorithm can deceive both humans and machines: radiologists and state-of-the-art AI. We also show how this implementation might be used by an attacker since it can be automated (in the case of an air gapped system) and is fast (in the case of an infected DICOM viewer).
\item[Countermeasures] We enumerate various countermeasures which can be used to mitigate the threat. We also provide the reader with best practices and configurations which can be implemented immediately to help prevent this attack.
\end{description}
For reproducibility and further investigation, we have published our tampered datasets and source code online\footnote{\url{https://github.com/ymirsky/CT-GAN}} along with a pen-test video.\footnote{\url{https://youtu.be/_mkRAArj-x0}}
The remainder of the paper is organized as follows: First we present a short background on GANs. Then, in section \ref{sec:relworks}, we review related works and contrast them ours. In section \ref{sec:attackmodel} we present the attack model and demonstrate one of the attack vectors. In section \ref{sec:attack}, we present CT-GAN's neural architecture, its attack process, and some samples. In section \ref{sec:eval} we evaluate the quality of the manipulations and asses the threat of the attack. Finally, in sections \ref{sec:countermeasures} and \ref{sec:conclusion} we present countermeasures and our conclusion.
\section{Background: GANs}\label{sec:background}
The most basic GAN consists of two neural networks: the \textit{generator} ($G$) and \textit{discriminator} ($D$). The objective of the GAN is to generate new images which are visually similar to real images found in a sample data distribution $X$ (i.e., a set of images). The input to $G$ is the random noise vector $z$ drawn from the prior distribution $p(z)$ (e.g., a Gaussian distribution). The output of $G$, denoted $x_g$, is an image which is expected to have visual similarity with those in $X$. Let the non-linear function learned by $G$ parametrized by $\theta_g$ be denoted as $x_g = G(z; \theta_g)$. The input to $D$ is either a real image $x_r \in X$ or a generated image $x_g \in G(Z; \theta_g)$. The output of $D$ is the probability that $x_g$ is real or fake. Let the non-linear function learned by $D$ parametrized by $\theta_d$ be denoted as $x_d = D(x; \theta_d)$.
The top of Fig. \ref{fig:gans} illustrates the configuration of a classic GAN.
%
\begin{figure}[t]
\centering
\includegraphics[width=\columnwidth]{GANS2a_e.pdf}
\caption{A schematic view of a classic GAN (top) and a cGAN setup for in-painting.}
\label{fig:gans}
\vspace{-1.5em}
\end{figure}
It can be seen that $D$ and $G$ are playing a zero-sum game where $G$ is trying to find better (more realistic) samples to fool $D$, while $D$ is learning to catch every fake sample generated by $G$. After training, $D$ is discarded and $G$ is used to generate new samples.
A cGAN is a GAN which has a \textit{generator} and \textit{discriminator} conditioned on an additional input (e.g., class labels). This input extends the latent space $z$ with further information thus assisting the network to generate and discriminate images better. In \cite{isola2017image} the authors propose an image-to-image translation framework using cGANs (a.k.a. pix2pix). There the authors showed how deep convolutional cGANs can be used to translate images from one domain to another. For example, converting casual photos to a Van Gogh paintings.
One application of the pix2pix framework is in-painting; the process of completing a missing part of an image. When using pix2pix to perform in-painting, the \textit{generator} tries to fill in a missing part of an image based on the surrounding context, and its past experience (other images seen during training). Meanwhile, the \textit{discriminator} tries to differentiate between completed images and original images, given the surrounding context. Concretely, the input to $G$ is a copy of $x_r$ where missing regions of the image are replaced with zeros. We denote this masked input as $x_r^*$. The output of $G$ is the completed image, visually similar to those in $X$. The input to $D$ is either the concatenation $(x_r^*, x_r)$ or $(x_r^*, G(x_r^*; \theta_g))$. The bottom of Fig. \ref{fig:gans} illustrates the described cGAN. The process for training this kind of GAN is as follows:
\begin{tcolorbox}[breakable,title=\textit{Training Procedure for cGAN In-painting}]
\small{
\noindent Repeat for $k$ training iterations:
\begin{enumerate}[leftmargin=*]
\item Pull a random batch of samples $x_r \in X$, and mask the samples with zeros to produce the respective $x_r^*$.
\item \textbf{Train $D$}:
\begin{enumerate}[leftmargin=*]
\item Forward propagate $(x_r^*,x_r)$ through $D$, compute the error given the label $y=0$, and back propagate the error through $D$ to update $\theta_d$.
\item Forward propagate $(x_r^*,G(x_r^*; \theta_g))$ through $D$, compute the error given the label $y=1$, and back propagate the error through $D$ to update $\theta_d$.
\end{enumerate}
\item \textbf{Train $G$}:
\begin{enumerate}[leftmargin=*]
\item Forward propagate $x_r^*$ through $G$ and then $(x_r^*,G(x_r^*; \theta_g))$ through $D$, compute the error at the output of $D$ given the label $y=0$,
back propagate the error through $D$ to $G$ without updating $\theta_d$, and
continue the back propagation through $G$ while updating $\theta_g$.
\end{enumerate}
\end{enumerate}
}
\end{tcolorbox}
Although pix2pix does not use a latent random input $z$, it avoids deterministic outputs by performing random dropouts in the generator during training. this forces the network to learn multiple representations of the data.
We note that there is a GAN called a CycleGAN \cite{zhu2017unpaired} that can directly translate images between two domains (e.g., benign $\leftrightarrow$ malign). However, we found that the CycleGAN was unable to inject realistic cancer into 3D samples. Therefore, we opted to use the pix2pix model for in-painting because it produced much better results. This may be due to the complexity of the anatomy in the 3D samples and the fact that we had relatively few training samples. Since labeled datasets contain at most a few hundred scans, our approach is more likely to be used by an attacker. Another reason is that in-painting is arguably easier to perform than `style transfer' when considering different bodies. Regardless, in-painting ensures that the final image can be seamlessly pasted back into the scan without border effects.
\section{Related Work}\label{sec:relworks}
The concept of tampering medical imagery, and the use of GANs on medical imagery, is not new. In this section we briefly review these subjects and compare prior results to our work.
\subsection{Tampering with Medical Images}\label{subsec:relworktampering}
Many works have proposed methods for detecting forgeries in medical images \cite{Singh2017}, but none have focused on the attack itself. The most common methods of image forgery are: copying content from one image to another (image splicing), duplicating content within the same image to cover up or add something (copy-move), and enhancing an image to give it a different feel (image retouching) \cite{Sadeghi2018}.
Copy-move attacks can be used to cover up evidence or duplicate existing evidence (e.g., a tumor). However, duplicating evidence will raise suspicion because radiologists closely analyze each discovered instance. Image-splicing can be used to copy evidence from one scan to another. However, CT scanners have distinct local noise patterns which are visually noticeable \cite{7018385,duan2017computed}. The copied patterns would not fit the local pattern and thus raise suspicion.
More importantly, both copy-move and image-splicing techniques are performed using 2D image editing software such as Photoshop. These tools require a digital artist to manually edit the scan. Even if the attacker has a digital artist, it is hard to accurately inject and remove cancer realistically. This is because human bodies are complex and diverse. For example, cancers and tumors are usually attached to nearby anatomy (lung walls, bronchi, etc.) which may be hard to alter accurately under the scrutiny of expert radiologists. Another consideration is that CT scans are 3D and not 2D, which adds to the difficulty. It is also important to note that an attacker will likely need to automate the entire process in a malware since (1) many PACS are not directly connected to the Internet and (2) the diagnosis may occur immediately after the scan is performed.
In contrast to the Photoshopping approach, CT-GAN (1) works on 3D medical imagery, which provide stronger evidence than a 2D scans, (2) realistically alters the contents of a 3D scan while considering nearby anatomy, and (3) can be completely automated. The latter point is important because (1) some PACS are not directly connected to the Internet, (2) diagnosis can happen right after the actual scan, (3) the malware may be inside the radiologist's viewing app.
\subsection{GANs in Medical Imagery}
Since 2016, over 100 papers relating to GANs and medical imaging have been published \cite{yi2018generative}.
These publications mostly relate image reconstruction, denoising, image generation (synthesis), segmentation, detection, classification, and registration.
We will focus on the use of GANs to generate medical images.
Due to privacy laws, it is hard to acquire medical scans for training models and students. As a result, the main focus of GANs in this domain has been towards augmenting (expanding) datasets. One approach is to convert imagery from one modality to another. For example, in \cite{Bi2017SynthesisGANs} the authors used cGANs to convert 2D slices of CT images to Positron Emission Tomography (PET) images. In \cite{BenCohen2017VirtualResults, BenCohen2018CrossModalityDetection} the authors demonstrated a similar concept using a fully convolutional network with a cGAN architecture. In \cite{Dou2018UnsupervisedLoss}, the authors converted MRI images to CT images using domain adaptation. In \cite{Jin2018DeepData}, the authors converted MRI to CT images and vice versa using a CycleGAN.
Another approach to augmenting medical datasets is the generation of new instances. In \cite{bermudez2018learning}, the authors use a deep convolutional GAN (DCGAN) to generate 2D brain MRI images with a resolution of 220x172. In \cite{FridAdar2018GANbasedClassification}, the authors used a DCGAN to generate 2D liver lesions with a resolution of 64x64. In \cite{Wolterink2018}, the authors generated 3D blood vessels using a Wasserstien (WGAN). In \cite{baur2018melanogans}, the authors use a Laplace GAN (LAPGAN) to generate skin lesion images with 256x256 resolution. In \cite{madani2018chest}, the authors train two DCGANs for generating 2D chest X-rays (one for malign and the other for benign). However, in \cite{madani2018chest}, the generated samples were down sampled to 128x128 in resolution since this approach could not be scaled to the original resolution of 2000x3000.
In \cite{Chuquicusma2018} the authors generated 2D images of pulmonary lung nodules (lung cancer) with 56x56 resolution. The author's motivation was to create realistic datasets for doctors to practice on. The samples were generated using a DCGAN and their realism was assessed with help of two radiologists. The authors found that the radiologists were unable to accurately differentiate between real and fake samples.
These works contrast to our work in the following ways:
\begin{enumerate}
\item We are the first to introduce the use of GANs as a way to tamper with 3D imagery. The other works focused on synthesizing cancer samples for boosting classifiers, experiments, and training students, but not for malicious attacks. We also provide an overview of how the attack can be accomplished in a modern medical system.
\item All of the above works either generate small regions of a scan without the context of a surrounding body or generate a full 2D scan with a very low resolution. Samples which are generated without a context cannot be realistically `pasted' back into any arbitrary medical scan. We generate/remove content realistically within existing bodies. Moreover, very low-resolution images of full scans cannot replace existing ones without raising suspicion (especially if the body doesn't match the actual person). Our approach can modify full resolution 3D scans,\footnote{A CT scan can have a resolution from 512x512x600 to 1024x1024x600 and larger.} and the approach can be easily extended to 2D as well.
\item We are the first to evaluate how well a GAN can fool expert radiologists and state-of-the-art AI in full 3D lung cancer screening. Moreover, in our evaluation, the radiologists and AI were able to consider how the cancer was attached and placed within the surrounding anatomy.
\end{enumerate}
\section{The Attack Model}\label{sec:attackmodel}
In this section we explore the attack surface by first presenting the network topology and then by discussing the possible vulnerabilities and attack vectors. We also demonstrate one of the attack vectors on an actual CT scanner.
\begin{figure*}[t]
\centering
\includegraphics[width=\textwidth]{attack_points_e.pdf}
\caption{A network overview a PACS in a hospital. 1-3: points where an attacker can tamper with all scans. 4-5: points where an attacker can tamper with a subset of scans.}
\label{fig:attack_points}
\vspace{-1em}
\end{figure*}
\subsection{Network Topology}
In order to discuss the attack vectors we must first present the PACS network topology. Fig. \ref{fig:attack_points} presents the common network configuration of PACS used in hospitals. The topology is based on PACS literature \cite{hruby2013digital, peck2017clark, carter2018digital, huang2019pacs}, PACS enterprise solutions (e.g., Carestream), and our own surveys conducted on various hospitals. We note that, private medical clinics may have a much simpler topology and are sometimes directly connected to the Internet \cite{McAfeeRe34:online}.
The basic elements of a PACS are as follows:
\begin{description}
\item[PACS Server.] The heart of the PACS system. It is responsible for storing, organizing, and retrieving DICOM imagery and reports commonly via SQL. Although the most facilities use local servers, a few hospitals have transitioned to cloud storage \cite{Cloudbas46:online}.
\item[RIS Server.] The radiology information system (RIS) is responsible for managing medical imagery and associated data. Its primary use is for tracking radiology imaging orders and the reports of the radiologists. Doctors in the hospital's internal network can interface with the RIS to order scans, receive the resulting reports, and to obtain the DICOM scans \cite{PictureA43:online}.
\item[Modality Workstation.] A PC (typically Windows) which is used to control an imaging modality such as a CT scanner. During an appointment, the attending technician configures and captures the imagery via the workstation. The workstation sends all imagery in DICOM format to the PACS server for storage.
\item[Radiologist Workstation.] A radiologist can retrieve and view scans stored on the PACS server from various locations. The most common location is a viewing workstation within the department. Other locations include the radiologist's personal PC (local or remote via VPN), and sometimes a mobile device (via the Internet or within the local network).
\item[Web Server.] An optional feature which enables radiologists to view of DICOM scans (in the PACS server) over the Internet. The content may be viewed though a web browser (e.g., medDream and Orthanc \cite{jodogne2013orthanc}), an app on a mobile device (e.g., FujiFilm's Synapse Mobility), or accessed via a web API (e.g., Dicoogle \cite{costa2011dicoogle}).
\item[Administrative Assistant's PC.] This workstation has both Internet access (e.g., for emails) and access to the PACS network. Access to the PACS is enabled so that the assistant can maintain the devices' schedules: When a patient arrives at the imaging modality, for safety reasons, the technician confirms the patient's identity with the details sent to the modality's workstation (entered by the assistant). This ensures that the scans are not accidentally mixed up between the patients.
\item[Hospital Network.] Other departments within the hospital usually have access to the PACS network. For example, Oncology, Cardiology, Pathology, and OR/Surgery. In these cases, various workstations around the hospital can load DICOM files from the server given the right credentials. Furthermore, it is common for a hospital to deploy Wi-Fi access points, which are connected to the internal network, for employee access.
\end{description}
\subsection{Attack Scenario}
The attack scenario is as follows: An attacker wants to achieve one of the goals listed in Table \ref{tab:attack} by injecting/removing medical evidence. In order to cause the target effect, the attacker will alter the contents of the target's CT scan(s) before the radiologist performs his or her diagnosis. The attacker will achieve this by either targeting the data-at-rest or data-in-motion.
Thedata-at-rest refers to the DICOM files stored on the PACS Server, or on the radiologist's personal computer (saved for later viewing). In some cases, DICOM files are stored on DVDs and then transferred to the hospital by the patient or an external doctor. Although the DVD may be swapped by the attacker, it is more likely the interaction will be via the network. The data-in-motion refers to DICOM files being transferred across the network or loaded into volatile memory by an application (e.g., a DICOM viewer).
We note that this scenario does not apply to the case where the goal is to falsify or sabotage research. Moreover, for insurance fraud, an attacker will have a much easier time targeting a small medical clinic. For simplicity, we will assume that the target PACS is in a hospital.
\subsection{Target Assets}
To capture/modify a medical scan, an attacker must compromise at least one of the assets numbered in Fig. \ref{fig:attack_points}. By compromising one of (1-4), the attacker gains access to every scan. By compromising (5) or (6), the attacker only gains access to a subset of scans. The RIS (3) can give the attacker full control over the PACS server (2), but only if the attacker can obtain the right credentials or exploit the RIS software. The network wiring between the modalities and the PACS server (4) can be used to install a man-in-the-middle device. This device can modify data-in-motion if it is not encrypted (or if the protocol is flawed).
In all cases, it is likely that the attacker will infect the target asset with a custom malware, outlined in Fig. \ref{fig:malflow}. This is because there may not be a direct route to the PACS via the Internet or because the diagnosis may take place immediately after the scan is taken.
\begin{figure}[b]
\vspace{-1em}
\centering
\includegraphics[width=\columnwidth]{malflow_fig2_f.pdf}
\caption{The tampering process of an autonomous malware.}
\label{fig:malflow}
\end{figure}
\subsection{Attack Vectors}
There are many ways in which an attacker can reach the assets marked in Fig. \ref{fig:attack_points}. In general, the attack vectors involve either remote or local infiltration of the facility's network.
\vspace{.3em}
\noindent\textbf{Remote Infiltration. }
The attacker may be able to exploit vulnerabilities in elements facing the Internet, providing the attacker with direct access to the PACS from the Internet (e.g., \cite{McAfeeRe34:online}). Another vector is to perform a social engineering attack. For example, a spear phishing attack on the department's administrative assistant to infect his/her workstation with a backdoor, or a phishing attack on the technician to have him install fraudulent updates.
If the PACS is not directly connected to the Internet, an alternative vector is to (1) infiltrate the hospital's internal network and then (2) perform lateral movement to the PACS. This is possible because PACS is usually connected to the internal network (using static routes and IPs), and the internal network is connected to the Internet (evident from the recent wave of cyber-attacks on medical facilities \cite{Healthca49:online, 11Things18:online,UShospit17:online, Thebigge8:online}). The bridge between the internal network and the PACS is to enable doctors to view scans/reports and to enable the administrative assistant to manage patient referrals \cite{huang2019pacs}. Another vector from the Internet is to compromise a remote site (e.g., a partnered hospital or clinic) which is linked to the hospital's internal network. Furthermore, the attacker may also try to infect a doctor's laptop or phone with a malware which will open a back door into the hospital.
If the attacker knows that radiologist analyzes scans on his or her personal computer, then the attacker can infect the radiologist's device or DICOM viewer remotely with the malware.
\vspace{.3em}
\noindent\textbf{Local Infiltration. } The attacker can gain physical access to the premises with a false pretext, such as being a technician from Philips who needs to run a diagnostic on the CT scanner. The attacker may also hire an insider or even be an insider. A recent report shows that $56\%$ of cyber attacks on the healthcare industry come from internal threats \cite{insider}.
Once inside, the attacker can plant the malware or a back door by (1) connecting a device to exposed network infrastructure (ports, wires, ...) \cite{muniz2015penetration} or (2) by accessing an unlocked workstation. Another vector which does not involve access to a restricted area, is to access to the internal network by hacking Wi-Fi access points. This can be accomplished using existing vulnerabilities such as 'Krack' \cite{vanhoef2017key} or the more recent `BleedingBit' vulnerabilities which have affected many hospitals \cite{Security72:online}.
\vspace{.3em}
\noindent\textbf{Compromising the PACS. }
Once access to the PACS has been achieved, there are numerous ways an attacker can compromise a target asset. Aside from exploiting misconfigurations or default credentials, the attacker can exploit known software vulnerabilities. With regards to PACS servers, some already disclose private information/credentials which can be exploited remotely to create of admin accounts, and have hard-coded credentials.\footnote{\texttt{CVE-2017-14008} and \texttt{CVE-2018-17906}} A quick search on \url{exploit-db.com} reveals seven implemented exploits for PACS servers in 2018 alone.
With regards to modality workstations, they too have been found to have significant vulnerabilities \cite{Hospital7:online}. In 2018 the US Department of Homeland Security exposed `low skill' vulnerabilities in Philips' Brilliance CT scanners \cite{Philipsi87:online}. For example, improper authentication, OS command injection, and hard-coded credentials.\footnote{\texttt{CVE-2018-8853}, \texttt{CVE-2018-8857}, and \texttt{CVE-2018-8861}} Other recent vulnerabilities include hard-coded credentials.\footnote{\texttt{CVE-2017-9656}}
Given the state of health-care security, and that systems such as CT scanners are rarely given software updates \cite{Imaginey88:online}, it is likely that these vulnerabilities and many more exist. Once the target asset in the PACS has been compromised, the attacker will be able to install the malware and manipulate the scans of target patients.
\subsection{Attack Demonstration}
To demonstrate how an attacker can access and manipulate CT scans, we performed a penetration test on a hospital's radiology department. The pen-test was performed with full permission of the participating hospital. To gain access to all CT scans, we performed a man-in-the-middle attack on the CT scanner using a Raspberry Pi 3B. The Pi was given a USB-to-Ethernet adapter, and was configured as a passive network bridge (without network identifiers). The Pi was also configured as a hidden Wi-Fi access point for backdoor access. We also printed a 3D logo of the CT scanner's manufacturer and glued it to the Pi to make it less conspicuous.
\begin{figure}[t]
\centering
\includegraphics[width=\columnwidth]{pentest2aaa.png}
\caption{Left: The CT scanner and the medical dummy used to validate the attack. Top-right: the Pi-bridge used to intercept the scans. Bottom-right: one of the dummy's slices, sent by the CT scanner, and intercepted by the Pi-bridge. }
\label{fig:pentest}
\vspace{-1em}
\end{figure}
The pen-test was performed as follows: First we waited at night until the cleaning staff opened the doors. Then we found the CT scanner's room and installed the Pi-bridge between the scanner's workstation and the PACs network (location \#2 in Fig. \ref{fig:attack_points}). Finally, we hid the Pi-bridge under an access panel in the floor. The entire installation process took 30 seconds to complete. We were able to connect to the Pi wirelessly from the waiting room (approximately 20m away) to monitor the device's status, change the target identifier, etc.
At this point, an attacker could either intercept scans directly or perform lateral movement through the PACS to other subsystems and install the malware there. To verify that we could intercept and manipulate the scans, we scanned a medical dummy (Fig. \ref{fig:pentest}). We found that the scan of the dummy was sent over the network twice: once in cleartext over TCP to an internal web viewing service, and again to the PACS storage server using TLSv1.2. However, to our surprise, the payload of the TLS transmission was also in cleartext. Moreover, within 10 minutes, we obtained the usernames and passwords of over 27 staff members and doctors due to multicasted Ethernet traffic containing \texttt{HTTP POST} messages sent in cleartext. A video of the pen-test can be found online.\footnote{\url{https://youtu.be/_mkRAArj-x0}}
These vulnerabilities were disclosed to the hospital's IT staff and to their PACS software provider. Though inquiry, we found that it is not common practice for hospitals to encrypt their internal PACs traffic \cite{zetter:online}. One reason is compatibility: hospitals often have old components (scanners, portals, databases, ...) which do not support encryption. Another reason is some PACS are not directly connected to the Internet, and thus is it erroneously thought that there is no need for encryption.
\begin{figure*}[t]
\centering
\includegraphics[width=\textwidth]{cGANw2_e.pdf}
\caption{The network architecture, layers, and parameters used for both the injection ($GAN_{\text{inj}}$) and removal ($GAN_{\text{rem}}$) networks.}
\label{fig:arch}
\vspace{-1em}
\end{figure*}
\begin{figure}[t]
\centering
\includegraphics[width=\columnwidth]{train_samples_c.png}
\caption{Training samples after 100 epochs showing the middle slice only. Top: the masked sample $x_r^*$ given to both the \textit{generator} $G_{inj}$ and \textit{discriminator} $D_{inj}$. Middle: The in-painted image $x_g$ produced by the $G_{inj}$. Bottom: the ground-truth $x_r$. Note, $D_{inj}$ sees either ($x_r^*$, $x_r$) or ($x_r^*$, $x_g$).}
\label{fig:train_prog}
\vspace{-1em}
\end{figure}
\section{The CT-GAN Framework}\label{sec:attack}
In this section, we present the technique which an attacker can use to add/remove evidence in CT scans. First, we present the CT-GAN architecture and how to train it. Then, we will describe the entire tampering process and present some sample results. As a case study, we will focus on injecting/removing lung cancer.
It is important to note that there are many types of lung cancer. A common type of cancer forms a round mass of tissue called a solitary pulmonary nodule. Most nodules with a diameter less than 8mm are benign. However, nodules which are larger may indicate a malign cancerous growth. Moreover, if \textit{numerous} nodules having a diameter $>8$mm are found, then the patient has an increased risk of primary cancer \cite{macmahon2017guidelines}. For this attack, we will focus on injecting and removing multiple solitary pulmonary nodules.
\subsection{The Neural Architecture}
A single slice in a CT scan has a resolution of \textit{at least} 512x512 pixels. Each pixel in a slice measures the radiodensity at that location in Hounsfield units (HU). The CT scan of a human's lungs can have over 157 million voxels\footnote{A voxel is the three dimensional equivalent of a pixel.} (512x512x600). In order to train a GAN on an image of this size, we first locate a candidate location (voxel) and then cut out a small region around it (cuboid) for processing. The selected region is slightly larger than needed in order to provide the cGAN with context of the surrounding anatomy. This enables the cGAN to generate/remove lung cancers which connect to the body in a realistic manner.
To accurately capture the concepts of injection and removal, we use a framework consisting of two cGANs: one for injecting cancer ($GAN_{\text{inj}}$) and one for removing cancer ($GAN_{\text{rem}}$). Both $GAN_{\text{inj}}$ and $GAN_{\text{rem}}$ are deep 3D convolutional cGANs trained to perform in-painting on samples which are $32^3$ voxels in dimension. For the completion mask, we zero-out a $16^3$ cube in the center of the input sample. To inject a large pulmonary nodule into a CT scan, we train $GAN_{\text{inj}}$ on cancer samples which have a diameter of least 10mm. As a result, the trained \textit{generator} completes sample cuboids with similar sized nodules. To remove cancer, $GAN_{\text{rem}}$ is trained using the same architecture, but with samples containing benign lung nodules only (having a diameter $<3$mm).
The model architecture (layers and configurations) used for both $GAN_{\text{inj}}$ and $GAN_{\text{rem}}$ is illustrated in Fig. \ref{fig:arch}. Overall, $\theta_g$ and $\theta_d$ had $162.6$ million and $26.9$ million trainable parameters respectively ($189.5$ million in total).
We note that follow up CT scans are usually ordered when a large nodule is found. This is because nodule growth is a strong indicator of cancer \cite{macmahon2017guidelines}. We found that an attacker is able to simulate this growth by conditioning each cancerous training sample on the nodule's diameter. However, the objective of this paper is to show how GANS can add/remove evidence realistically. Therefore, for the sake of simplicity, we have omitted this `feature' from the above model.
\begin{figure*}[t]
\centering
\includegraphics[width=\textwidth]{attack_flow_e.pdf}
\caption{Top: the complete cancer injection/removal process. Bottom: sample images from the \textit{injection} process. The grey numbers indicate from which step the image was taken. The sample 2D images are the middle slice of the respective 3D cuboid.}
\label{fig:attack_flow}
\vspace{-1em}
\end{figure*}
\subsection{Training CT-GAN}
To train the GANs, we used a free dataset of 888 CT scans collected in the LIDC-IDRI lung cancer screening trial \cite{armato2011lung}. The dataset came with annotations from radiologists: the locations and diameters of pulmonary nodules having diameters greater than $3$mm. In total there were 1186 nodules listed in the annotations.
To create the training set for $GAN_{\text{inj}}$, we extracted from the CT scans all nodules with a diameter between 10mm and 16mm (169 in total). To increase the number of training samples, we performed data augmentation: For each of the 169 cuboid samples, we (1) flipped the cuboid on the $x$, $y$, and $xy$ planes, (2) shifted the cuboid by 4 pixels in each direction on the xy plane, and (3) rotated the cuboid 360 degrees at 6 degree intervals. This produced an additional 66 instances for each sample. The final training set had 11,323 training samples.
To create the training set for $GAN_{\text{rem}}$, we first selected clean CT scans which had no nodules detected by the radiologists. On these scans, we used the nodule detection algorithm from \cite{murphy2009large} (also provided in the dataset's annotations) to find benign micro nodules. Of the detected micro nodules, we selected 867 nodules at random and performed the same data augmentation as above. The final training set had 58,089 samples.
Prior to training the GANs, all of the samples were preprocessed with scaling, equalization, and normalization (described in the next section in detail). Both of the GANs were trained on their respective datasets for 200 epochs with a batch size of 50 samples. Each GAN took 26 hours to complete its training on an NVIDIA GeForce GTX TITAN X using all of the GPU's memory. Fig. \ref{fig:train_prog} shows how well $GAN_{\text{inj}}$ was able to in-paint cancer patterns after 150 epochs.
\subsection{Execution: The Tampering Process}
In order to inject/remove lung cancer, pre/post-processing steps are required. The following describes the entire injection/removal process as illustrated in Fig. \ref{fig:attack_flow}:
\begin{enumerate}[leftmargin=*]
\item \textbf{Capture Data.} The CT scan is captured (as data-at-rest or data-in-motion) in either raw or DICOM format using one of the attack vectors from section \ref{sec:attackmodel}.
\item \textbf{Localize \& Cut.} A candidate location is selected where cancer will be injected/removed, and then the cuboid $x'_r$ is cut out around it.
\begin{itemize}[noitemsep,wide=0pt, leftmargin=\dimexpr\labelwidth + 2\labelsep\relax]
\item[] \textbf{Injection:} An injection location can be selected in one of two ways. The fastest way is to take one of the middle slices of the CT scan and select a random location near the middle of the left or right half (see Fig. \ref{fig:average} in the appendix). With $888$ CT scans, this strategy gave us a $99.1$\% successes rate. A more precise way is to execute an existing nodule detection algorithm to find a random micro nodule. To improve speed, the algorithm can be given only a few slices and implemented with early stopping. In our evaluation, we used the algorithm in \cite{murphy2009large}, though many other options are available.
\item[] \textbf{Removal:} A removal location can be found by selecting the largest nodule with \cite{murphy2009large}, or by using a pre-trained deep learning cancer detection model.\footnote{Pre-trained models are available here:\\ \url{https://concepttoclinic.drivendata.org/algorithms}}
\end{itemize}
\item \textbf{Scale.} $x'_r$ is scaled to the original 1:1:1 ratio using 3D spline interpolation.\footnote{In Python: \texttt{scipy.ndimage.interpolation.zoom}} The ratio information is available in the DICOM meta data with the tags (\texttt{0x0028},\texttt{0x0030}) and (\texttt{0x0018},\texttt{0x0050}). Scaling is necessary because each scan is stored with a different aspect ratio, and a GAN needs consistent units to produce accurate results. To minimize the computations, the cuboid cut in step 2 is cut with the exact dimensions so that the result of the rescaling process produces a $32^3$ cube.
\item[4-5.] \textbf{Equalize \& Normalize.} Histogram equalization is applied to the cube to increase contrast. This is a critical step since it enables the GAN to learn subtle features in the anatomy
Normalization is then applied using the formula $X_n=2\frac{X-\text{min}(X)}{\text{max}(X)-\text{min}(X)}-1$. This normalization ensures that all values fall on the range of $[-1,1]$ which helps the GAN learn the features better. The output of this process is the cube $x_r$.
\item[6.] \textbf{Mask.} In the center of $x_r$, a $16^3$ cube is masked with zeros to form $x_r^*$. The masked area will be in-painted (completed) by the \textit{generator}, and the unmasked area is the context).
\item[7.] \textbf{Inject/Remove.} $x_r^*$ is passed through the chosen \textit{discriminator} ($G_{\text{inj}}$ or $G_{\text{rem}}$) creating a new sample ($x_g$) with new 3D generated content.
\item[8-10.] \textbf{Reverse Preprocessing.} $x_g$ is unnormalized, unequalized, and then rescaled with spline interpolation back to its original proportions, forming $x'_g$.
\item[11.] \textbf{Touch-up.} The result of the interpolation usually blurs the imagery. In order to hide this artifact from the radiologists, we added Gaussian noise to the sample: we set $\mu=0$ and $\sigma$ to the sampled standard deviation of $x'_r$. To get a clean sample of the noise, we only measured voxels with values less than $-600$ HU. Moreover, to copy the relevant content into the scan, we merged the original cuboid ($x'_r$) with the generated one ($x'_g$) using a sigmoid weighted average.
Let $W$ be the weight function defined as
\begin{equation}\label{eq:alphachannel}
W_{\alpha,\beta}(x) = \frac{1}{1+e^{-(x+\alpha)/\beta}} * G(x)
\end{equation}
where parameter $\alpha$ is the HU threshold between wanted and unwanted tissue densities, and parameter $\beta$ controls the smoothness of the cut edges. The function $G(x)$ returns a 0-1 normalized Gaussian kernel with the dimensions of $x$. $G(x)$ is used to decay the contribution of each voxel the further it is the cuboid's center.
With $W$, we define the merging function as
\begin{equation}
merge_{\alpha,\beta}(x,y) = W_{\alpha,\beta}(x)*x + \left(1-W_{\alpha,\beta}(x)\right)*y
\end{equation}
where $x$ is source ($x'_g$) and $y$ is the destination ($x'_r$).
We found that setting $\alpha=500$ and $\beta=70$ worked best. By applying these touch-ups, the final cuboid $x_g^*$ is produced.
\item[12.] \textbf{Paste.} The cuboid $x_g^*$ is pasted back into the CT scan at the selected location. See Fig. \ref{fig:average} in the appendix for one slice of a complete scan.
\item[13.] \textbf{Repeat.} If the attacker is removing cancer, then return to step 2 until no more nodules with a diameter $>3$mm are found. If the attacker is injecting cancer, then (optionally) return to step 2 until four injections have been performed. The reason for this is because the risk of a patient being diagnosed with cancer is statistically greater in the presence of exactly four solitary pulmonary nodules having a diameter $>8$mm \cite{macmahon2017guidelines}.
\item[14.] \textbf{Return Data.} The scan is converted back into the original format (e.g. DICOM) and returned back to the source.
\end{enumerate}
The quality of the injection/removal process can be viewed in figures \ref{fig:various_examples} and \ref{fig:3dexample}. Fig. \ref{fig:various_examples} presents a variety of examples before and after tampering, and Fig. \ref{fig:3dexample} provides a 3D visualization of a cancer being injected and removed. More visual samples can be found in the appendix (figures \ref{fig:various_examples_extra} and \ref{fig:inj_slices_extra}).
We note that although some steps involve image touch-ups, the entire process is automatic (unlike Photoshop) and thus can be deployed in an autonomous malware or inside a viewing application (real-time tampering). We note that the same neural architecture and tampering process works on other modalities and medical conditions. For example, Fig. \ref{fig:braintumors} in the appendix shows CT-GAN successfully injecting brain tumors into MRI head scans.
\begin{figure}[t]
\centering
\includegraphics[width=.48\columnwidth]{various_injections_small_e.pdf} \hspace{.5em}
\includegraphics[width=.48\columnwidth]{various_removals_small_e.pdf}
\caption{Sample injections (left) and removals (right). For each image, the left side is before tampering and the right side is after. Note that only the middle 2D slice is shown.}
\label{fig:various_examples}
\vspace{1em}
\centering
\includegraphics[width=.48\columnwidth]{3d_injection_e.pdf}
\includegraphics[width=.48\columnwidth]{3d_removal_e.pdf}
\caption{A 3D sample of injection (left) and removal (right) before (blue) and after (red) tampering with the CT scan.}
\label{fig:3dexample}
\end{figure}
\begin{figure}
\centering
\captionof{table}{Summary of the scans and the relevant notations} \label{tab:dataset}
\includegraphics[width=.95\columnwidth]{dataset_tab_f.png}
\vspace{-1em}
\end{figure}
\begin{figure*}[t]
\centering
\captionof{table}{Cancer Detection Performance - Blind Trial} \label{tab:conf_exp1}
\includegraphics[width=\textwidth]{conf_table_exp1_f.png}
\vspace{-2em}
\end{figure*}
\begin{figure}[t]
\centering
\captionof{table}{Attack Detection Confusion Matrix - Open Trial\\Evalauted by Instance} \label{tab:conf_exp2}
\includegraphics[width=.7\columnwidth]{conf_table_exp2_f.png}
\end{figure}
\begin{figure}[t]
\centering
\includegraphics[width=\columnwidth]{exp12_attack_succ2a_e.pdf}
\caption{Attack success rates - Both Trials.}
\label{fig:exp1_succ}
\vspace{-1em}
\end{figure}
\begin{figure}[t]
\centering
\includegraphics[width=\columnwidth]{exp1_malignancy2_e.pdf}
\caption{Malignancy of injected cancers (FM) - Blind Trial.}
\label{fig:exp1_malig}
\end{figure}
\begin{figure}[t]
\centering
\includegraphics[width=\columnwidth]{exp2_classf_figf_e.pdf}
\caption{Attack detection performance - Open Trial.}
\label{fig:exp2_metrics}
\vspace{-1em}
\end{figure}
\begin{figure}[t]
\centering
\includegraphics[width=\columnwidth]{exp1_likerts_2f_e.pdf}
\caption{Confidence in detecting attacks - Open Trial.}
\label{fig:exp2_likerts}
\vspace{-1em}
\end{figure}
\section{Evaluation}\label{sec:eval}
In this section we present our evaluation on how well the CT-GAN attack can fool expert radiologists and state-of-the-art AI.
\subsection{Experiment Setup}
To evaluate the attack, we recruited three radiologists (denoted \textbf{R1}, \textbf{R2}, and \textbf{R3}) with 2, 5, and 7 years of experience respectively. We also used a trained lung cancer screening model (denoted \textbf{AI}), the same deep learning model which won the 2017 Kaggle Data Science Bowl (a \$1 million competition for diagnosing lung cancer).\footnote{Source code and model available here: \url{https://github.com/lfz/DSB2017}}
The experiment was performed in two trials: blind and open. In the blind trial, the radiologists were asked to diagnose 80 \textit{complete} CT scans of lungs, but they were not told the purpose of the experiment or that some of the scans were manipulated. In the open trial, the radiologists were told about the attack, and were asked to identify fake, real, and removed nodules in 20 CT scans. In addition, the radiologists were asked to rate the confidence of their decisions. After each trial, we gave the radiologists a questionnaire to assess how susceptible they were to the attacks. In all cases, the radiologists were asked to only detect and diagnose pulmonary nodules which have a diameter greater than 3mm.
The CT scans were taken from the LIDC-IDRI dataset \cite{armato2011lung}. The set of CT scans used in each trial and the notations used in this section are available in Table \ref{tab:dataset}.
False benign (FB) and true malign (TM) scans truthfully contained at least one nodule with a diameter between 10mm and 16mm. FB scans were made by removing every nodule in the scan. FM scans were made by randomly injecting 1-4 nodules into a benign scan, where the injected nodules had a diameter of 14.4mm on average. In total, there were 100 CT scans analyzed by each of the radiologists, and the radiologists spent approximately 10 minutes analyzing each of these scans.
We note that the use of three radiologists is common practice in medical research (e.g., \cite{esteva2017dermatologist}). Moreover, we found that radiologists (and AI) significantly agreed with each other's diagnosis per patient and per nodule. We verified this agreement by computing Fliess' kappa \cite{conger1980integration} (a statistical interrater reliability measure) which produced an excellent kappa of 0.84 (p-value $<0.0001$). Therefore, adding more radiologists will likely not affect the results.
\subsection{Results: Blind Trial}
In Table \ref{tab:conf_exp1} we present the cancer detection performance of the radiologists and AI. The table lists the number of false-positives (FP - \textit{detected a non-existent cancer}), true-positives (TP - \textit{detected a real cancer}), false-negatives (FN - \textit{missed a real cancer}), and their respective rates. The TCIA annotations (nodule locations) were used as our ground truth for measuring the performance on FB and TM scans. We evaluated these metrics per instance of cancer, and per patient as a whole. All four detectors performed well on the baseline (TB and TM) having an average TPR of 0.975 and a TNR of 1.0 in diagnosing the patients, meaning that we can rely on their diagnosis.
The top of Fig. \ref{fig:exp1_succ} summarizes the attack success rates for the blind trial. In general, the attack had an average success rate of 99.2\% for cancer injection and 95.8\% for cancer removal. The AI was fooled completely which is an important aspect since some radiologists use AI tools to support their analysis (e.g. the Philips IntelliSite Pathology Solution). The radiologists were fooled less so, primarily due to human error (e.g., missing a nodule). When asked, none of the radiologists reported anything abnormal with the scans with the exception of R2 who noted some noise in the area of one removal (FB). This may be attributed to ``inattentional blindness,'' where one may miss an obvious event (artifacts) while engaged in a different task (searching for large nodules). In \cite{drew2013invisible}, the authors showed that this phenomenon also affects radiologists.
With regards to the injected cancers (FM), the consensus among the radiologists was that one-third of the injections require an immediate surgery/biopsy, and that all of the injections require follow-up treatments/referrals. When asked to rate the overall malignancy of the FM patients, the radiologists said that nearly all cases were significantly malign and pose a risk to the patient if left untreated. Fig. \ref{fig:exp1_malig} summarizes radiologists' ratings of the FM patients. One interesting observation is that the malignancy rating increased with the experience of the radiologist. Finally, we note that an attacker could increase the overall malignancy of the injections if CT-GAN were trained only on samples with high malignancy and/or a larger diameter.
\subsection{Results: Open Trial}
In Table \ref{tab:conf_exp2} we present the radiologists' attack detection performance with knowledge of the attack. Fig. \ref{fig:exp2_metrics} summarizes these results and provides the radiologists' accuracy (ACC) and area under the curve (AUC). An AUC of 1.0 indicates a perfect binary classifier, whereas an AUC of 0.5 indicates random guessing. The results show that the radiologists could not consistently tell the difference between real and fake cancers or identify the locations of removed cancers.
With regards to the attack success rates (bottom of Fig. \ref{fig:exp1_succ}), knowledge of the attack did not significantly affect cancer removal (90\% from 95.8\%). However, the success of the cancer injection was affected (70\% from 99.2\%). Moreover, R2 also picked up on a particular pattern which gave away several instances. This is a promising result, since it indicates that a portion of CT-GAN's attacks can be mitigated by educating radiologists. However, aside from low accuracy (61\% for detecting an injection and 39\% for detecting a removal), there was a significant number of false positives. With a high likelihood of making a mistake, a radiologist may choose not to report abnormalities. This is also apparent from the low confidence scores which the radiologists gave decisions (see Fig. \ref{fig:exp2_likerts}).
In summary, both radiologists and AI are highly susceptible to CT-GAN's image tampering attacks. Although knowledge of the attack can help mitigate some cases of cancer injection, the error rates and confidence scores suggest that the attack may not be reported in most cases.
\subsection{Baseline Analysis}
As mentioned earlier, the attacker cannot use Photoshop on the images. This may be due to a time restriction: the radiologist may perform the diagnosis immediately after the scan has been taken, or the malware may be in the viewing application and operating in real-time. This may also be due to a connectivity restriction: many PACS do not have a direct connection to the Internet. Therefore, the attacker would need to infect the PACS with a malware that can perform the tampering autonomously.
However, for cancer injection, one may argue that there are simpler \textit{automated} methods than using a GAN. For example, the malware could simply paste a pre-saved cropped image of cancer into a scan at a candidate location (found using steps 1 and 2 in Fig. \ref{fig:attack_flow}). Therefore, to validate the use of a GAN, we evaluated this splice attack as a baseline comparison.
The experiment was setup as follows. To create our set of `pre-saved cancers' we carefully cut out ten 32x32x32 cubes of real cancerous nodules from \cite{armato2011lung}. We then removed the irrelevant background tissue by producing transparency (alpha) channels using equation (\ref{eq:alphachannel}).
The evaluation dataset contained 20 scans in total: 10 FM and 10 TM. To create a FM scan, we took a random healthy scan and used steps 1 and 2 of Fig. \ref{fig:attack_flow} to select a candidate injection location. We then pasted one of the pre-saved cancers into the scan at that location using the transparency channel. To create the FM scans, we randomly selected 10 sick patients with exactly one nodule each.
To evaluate the baseline attack, we asked radiologist \textbf{R2} to analyze the 20 scans and determine which of the scans were authentic (TM) and which were tampered (FM) --similar to the open trial. This task took the radiologist approximately two hours to perform.
In summary, \textbf{R2} correctly labeled all of the tampered scans as fake. The only error was that \textbf{R2} mislabeled three of the authentic scans as fake. These results indicate that the baseline cancer injection attack cannot trick a radiologist, in comparison to CT-GAN which succeeds nearly every time.
The reason the baseline attack failed to trick \textbf{R2} is because the process of automatically pasting cancer creates obvious artifacts. This is because the pasted samples ignore the surrounding anatomy and may contain inconsistent noise patterns (textures). Fig. \ref{fig:splice} illustrates some examples of these abnormalities such as cut bronchi, inconsistent noise patterns, and unaligned borders. CT-GAN does not produce these artifacts because it uses in-painting which considers the original content and surrounding anatomy.
\begin{figure}
\centering
\includegraphics[width=\columnwidth]{injection_paste5a.png}
\caption{An illustration showing artifacts which can occur when using an \textit{unsupervised} splice attack instead of CT-GAN. Only the middle slice is shown.}
\label{fig:splice}
\vspace{-1em}
\end{figure}
\section{Countermeasures}\label{sec:countermeasures}
The tampering of DICOM medical files is a well-known concern. In the section we provide a brief overview of solutions for preventing and detecting this attack.
\subsection{Prevention}
To mitigate this threat, administrators should secure both the data-in-motion (DiM) and the data-at-rest (DaR). To secure data-in-motion, admins should enable encryption between the hosts in their PACS network using proper SSL certificates. This may seem trivial, but after discovering this flaw in the hospital we pen-tested, we turned to the PACS software provider for comment. The company, with over 2000 installations worldwide, confirmed to us that their hospitals do not enable encryption in their PACS because ``it is not common practice''. We were also told that some of the PACS don't support encryption at all.\footnote{See \cite{zetter:online} for further comments.}
To secure the DaR, servers and anti-virus software on modality and radiologist workstations should be kept up to date, and admins should also limit the exposure which their PACS server has to the Internet.
\subsection{Detection}
The best way to detect this attack is to have the scanner sign each scan with a digital signature. The DICOM image file standard already allows users to store signatures within the file's data structure \cite{cao2003medical,dicomsecStandard}. However, although some PACS software providers offer this feature, we have not seen it in use within a PACS. If enabled, admins should check that valid certificates are being used and that the radiologists' viewing applications are indeed verifying the signatures.
%
Another method for detecting this attack is digital watermarking (DW). A DW is a hidden signal embedded into an image such that tampering corrupts the signal and thus indicates a loss of integrity. For medical images, this subject has been researched in depth \cite{Singh2017} and can provide a means for localizing changes in a tampered image. However, we did not find any medical devices or products which implement DW techniques. This may be due to the fact that they add noise to images which may harm the medical analysis.
Tampered images can also be detected with machine learning. In the supervised setting (where models are trained on examples of tampered images) the authors in \cite{ghoneim2018medical} propose detection by (1) extracting a scan's noise pattern using a Wiener filter, then (2) applying a multi-resolution regression filter on the noise, and then (3) executing an SVM and ELM together via a Bayesian Sum Rule model. Many domain specific methods exist for detecting images tampered by GANs (e.g., images/videos of faces \cite{rossler2019faceforensics++,matern2019exploiting,tariq2018detecting}). However, the supervised approach in \cite{cozzolino2018forensictransfer} is more suitable for detecting our attack since it is domain generic.
Several approaches have been proposed for unsupervised setting as well. These approaches attempt to detect anomalies (inconsistencies) within the tampered images. To detect these inconsistencies, researchers have considered JPEG blocks, signal processing, and compression/resampling artifacts \cite{zheng2019survey}. For example, in a recent work the authors trained a Siamese network to predict the probability that a pair of patches from two images have the same EXIF metadata (e.g., focal length and shutter speed) \cite{huh2018fighting}. In \cite{huh2018fighting}, the model is trained using a dataset of real images only. In \cite{cozzolino2018noiseprint}, the authors proposed `noiseprint' which uses a Siamese network to extract the camera's unique noise pattern from an image (PRNU) to find inconsistent areas. In their evaluation, the authors show that they can detect GAN-based inpainting. In \cite{Korus2016TIFS}, the authors proposed three strategies for using PRNU-based tampering localization techniques with multi-scale analysis. Using this method, the authors were able to detect forgeries of all shapes and sizes.
While these countermeasures may apply to CT-GAN in some cases, they do admit some caveats; namely, that (1) medical scans are usually not compressed so compression methods are irrelevant, (2) these methods were tested on 2D images and not 3D volumetric imagery, and (3) CT/MR imaging systems produce very different noise patterns than standard cameras. For example, we found that the PRNU method in \cite{Korus2016TIFS} does not work out-of-the-box on our tampered CT scans. This is because the noise patterns of CT images are altered by a radon transform used to construct the image. As future work, we plan to research how these techniques can be applied to detecting attacks such as CT-GAN.
\vspace{-.5em}
\section{Conclusion}\label{sec:conclusion}
In this paper we introduced the possibility of an attacker modifying 3D medical imagery using deep learning. We explained the motivations for this attack, discussed the attack vectors (demonstrating one of them), and presented a manipulation framework (CT-GAN) which can be executed by a malware autonomously. As a case study, we demonstrated how an attacker can use this approach to inject or remove lung cancer from full resolution 3D CT scans using free medical imagery from the Internet. We also evaluated the attack and found that CT-GAN can fool both humans and machines: radiologists and state-of-the-art AI. This paper also demonstrates how we should be wary of closed world assumptions: both human experts and advanced AI can be fooled if they fully trust their observations.
\bibliographystyle{unsrt}
| {'timestamp': '2019-06-07T02:11:42', 'yymm': '1901', 'arxiv_id': '1901.03597', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03597'} | arxiv |
\section{Introduction}
The dramatic increase in the number of smart phones, tablets, wearable, and other smart mobile devices has resulted in tremendous growth in traffic demands for current and future wireless networks. According to Cisco Visual Networking Index (VNI) \cite{cisco}, global mobile data traffic will reach 48.3 EB per month by 2021 with a growth of 46 percent between 2016 and 2021.
Thus, future wireless networks are expected to manage and satisfy the requirements of billions of connected
devices. Due to the near-Shannon’s capacity limit achieved by the current cellular wireless technologies (such as LTE Advanced and LTE Pro) the foreseen growth in traffic can only be sustained by: a) densification of wireless networks, b) by deploying Heterogeneous Network (HetNet) architectures consisting of a single holistic network that include network deployments of nodes
which support multiple Radio Access Technology (RAT) joint operations.
Therefore, higher capacity and data rate along with improved spectral efficiency and reduced power consumption
requirements are anticipated to be fulfilled by dense HetNet deployments, where IEEE 802.11-based
Wi-Fi networks and LTE-based cellular networks are envisioned to be the main technologies whose joint
operations can provide indoor as well as outdoor coverage. Currently, LTE operates efficiently over the licensed
spectrum from 700MHz to 2.6GHz, while Wi-Fi operates on Industrial, Scientific and Medical (ISM) 2.4 GHz
and National Information Infrastructure (U-NII) 5 GHz band.
The IEEE 802.11-based Wireless Local Area Networks (WLANs) (i.e. Wi-Fi networks), are the most successful
indoor wireless solutions and have evolved as a key technology adopted in unlicensed bands to cover
medium to large-scale enterprise, public area hot-spots and apartment complexes, among others. Due to the continuous
technological innovations and their ability to provide increased mobility, flexibility, ease of use along with
reduced cost of setting up, Wi-Fi continues to remain the first choice of connectivity for numerous use cases.
Motivated by the scarcity and cost of licensed spectrum, the future small cells HetNets based on cellular
technologies are expected to share the same spectrum with macro-cells, that will result in severe co-channel
interference. Motivated to achieve the required future capacity growth and to reduce the impact of co-channel
interference, standardization efforts are underway by the 3GPP to enable cellular mobile networks operate over the unlicensed 2.4 and 5GHz spectrum which is currently being used by Wi-Fi, Zigbee and
other communication systems.
To date, there are five different unlicensed LTE approaches: 1) LTE-WLAN Radio Aggregation (LWA) \cite{LWA-LWIP}, 2) LTE-WLAN Radio Level Integration (LWIP)\cite{LWA-LWIP}, 3) Licensed Assisted Access (LAA)\cite{LAA}, 4) LTE-Unlicensed (LTE-U)\cite{LTE-U}, and 5) MuLTEFire\cite{multifire}. Each of these alternative methods proposed for LTE to offload data traffic over unlicensed spectrum aim to opportunistically meet the future growth in cellular traffic. However, no analysis is found in the
state-of-the-art which compares and ranks these techniques according to their feasibility of implementation and performance.
In this work, we present the implementation details of LWA and LWIP protocols over Network Simulator 3 (NS-3)\cite{NS-3} to enable filling the aforementioned gap. NS-3 is a discrete-event network simulator for internet systems and is developed in C++ language. It provides realistic models to mimic the behavior of packet data networks. NS-3 provides a great compromise, by combining the ability to run real applications and network protocol codes, with the flexibly, as well as the ability to simulate in a controlled network environment and ease of reproducibility. NS-3 also provides support for several models and protocols such as Wi-Fi, WiMAX, LTE, Point-to-Point and so on.
The details of different NS-3 modules used and enhanced to develop the aforementioned techniques are provided. Our design is based on specifications of LWA and LWIP set in Release 13 of 3GPP.
\paragraph{Outline}
The remainder of this article is organized as follows. In Sections \ref{Overview of LWA architecture} and \ref{Overview of LWIP architecture}, a detailed overview of LWA and LWIP mechanisms is presented, respectively. Section \ref{Background} enlists and explains the building blocks that are used within the design of these interworking techniques in NS-3. Section \ref{Customization to create LWA model in NS-3} and \ref{Customization to create LWIP model in NS-3} describe the implementation details of LWA and LWIP. Validation results for the two techniques are presented in Section \ref{results}. Additional results of LWA technique implemented over two separate instances of NS-3 are highlighted in Section \ref{Results of LWA and LWIP for two instance of NS-3 simulation}. Finally, Section~\ref{conclusions} presents conclusions of this article.
\section{Overview of LWA architecture}
\label{Overview of LWA architecture}
LTE-WLAN Aggregation (LWA), was first introduced in 3GPP release 13 and combines Wi-Fi unlicensed bandwidth with the licensed LTE bandwidth, taking advantage of the high indoor availability of Wi-Fi networks. It efficiently integrates LTE and WLAN at the Packet Data Convergence Protocol (PDCP) layer of LTE. LWA aims for optimal operation of licensed/unlicensed bands by allowing downlink traffic to be carried by both LTE and WLAN. In order to avoid the asymmetric contention problem of Wi-Fi, the uplink traffic is only carried through LTE. Wi-Fi APs, which act as secondary access for user data, are connected to LWA base stations and thus can leverage LTE core network functionalities without a dedicated gateway.
\begin{figure}
\centering
\begin{subfigure}[b]{.5\textwidth}
{\raisebox{12mm}{
\includegraphics[width=1\linewidth]{fig1LWAa.pdf}}}
\caption{Network Architecture}
\label{fig1:sub1}
\end{subfigure}%
\begin{subfigure}[b]{.5\textwidth}
\centering
\includegraphics[width=1\linewidth]{Fig6ocLWA.pdf}
\caption{Protocol architecture defined by 3GPP}
\label{fig1:sub2}
\end{subfigure}
\caption{Overview of LWA}
\label{fig1}
\end{figure}
LWA architecture consists of Evolved Node B (eNB), LWA-aware Wi-Fi Access Point (AP), LWA-aware Wi-Fi station and User Equipment (UE). Release 13 of 3GPP LTE defines two development scenarios of LWA, namely collocated and non-collocated, through which the eNB and WLAN entities are connected. In the collocated scenario, the Wi-Fi AP is collocated and connected through an internal backhaul connection to the eNB. This deployment option is more appropriate for small cells. For the non-collocated deployment as shown in \chg{Figure \ref{fig1:sub1}}, an optional standardized interface, called $Xw$, is used to connect the WLAN AP to the eNB through a WLAN Termination (WT) logical node (which can be a Wi-Fi AP or a Wi-Fi controller). This interface supports control (called $Xw$-$C$) and user (data) plane (called $Xw$-$U$). Apart from PDCP Service Data Unit (SDU)s, the $Xw$ interface is also used for flow control feedback. The $Xw$-$U$ interface is used to deliver LWA PDUs from eNB to WT. The eNB-WT control plane signalling for LWA is performed by means of $Xw$-$C$ interface signalling. It supports the following functions: \emph{i)} Transfer of WLAN metrics from WT to eNB, \emph{ii)} Support of LWA for UE (establishment, management and control of user plane), and \emph{iii)} $Xw$ management and error handling function. Figure \chg{\ref{fig1:sub2}} shows the protocol architecture of user plane for the non-collocated LWA approach. It is defined to allow connection of the LTE network to the already existing Wi-Fi deployments (i.e. Wi-Fi APs can operate as native APs while not forwarding the LWA traffic).
A new sublayer, called LWA Adaptation Protocol (LWAAP), that adds the Data Radio Bearer (DRB) ID to the PDCP frames and transmits it to the Wi-Fi interface is defined. This allows multiple bearers to be offloaded to the Wi-Fi network. In the control plane, the eNB is responsible for selecting the bearers to offload to WLAN and for the activation/deactivation of LWA. However, Release 13 does not specify any algorithm for the interface selection
Regardless of the deployment scenario, PDCP frames are scheduled by the eNB, where some frames are encapsulated with Wi-Fi protocol and transmitted through the Wi-Fi interface. \chg{LWA can also configure the network to allow use of both Wi-Fi and LTE simultaneously. This procedure, called split bearer, uses both eNB and Wi-Fi radio resources. On the contrary, LWA also allows switched bearers, which only utilizes the WLAN radio resources for transmission of frames from the eNB to the UE.
While using the split bearer operation, the UE supports in-sequence delivery of frames based on the reordering procedure introduced in 3GPP Release 12 for dual connectivity. This is done using a reordering window controlled by a reordering timer running at the UE. The received frames from both LTE and WiFi are reordered by the aforementioned additional PDCP functionality of the LWA UE.
In the uplink, PDCP PDUs can only be sent via the LTE. }
\section{Overview of LWIP architecture}
\label{Overview of LWIP architecture}
\begin{figure}
\centering
\begin{subfigure}[b]{.5\textwidth}
{\raisebox{10mm}{
\includegraphics[width=1\linewidth]{fig1LWIPa.pdf}}}
\caption{Network Architecture.}
\label{fig2:sub1}
\end{subfigure}%
\begin{subfigure}[b]{.5\textwidth}
\centering
\includegraphics[width=1\linewidth]{Fig6ocLWIP.pdf}
\caption{Protocol architecture defined by 3GPP.}
\label{fig2:sub2}
\end{subfigure}
\caption{Overview of LWIP.}
\label{fig2}
\end{figure}
The foundation of 3GPP LWIP release 13 was set by Wi-Fi boost, which realized the first implementation of downlink switching of Internet Protocol (IP) layer connectivity. The basic aim of LWIP was to readily adopt and supplement LTE without making any major changes to the WLAN infrastructure. Figure \ref{fig2:sub1} shows the network architecture of LWIP scheme.
Figure \ref{fig2:sub2} shows the protocol architecture for LWIP. As can be seen, traffic splitting is performed above the PDCP layer, and data path bypasses all LTE protocols. The LWIP aggregation scheme involves the use of an Internet Protocol Security (IPSec) tunnel to transfer PDCP SDU packets from eNB to UE via WLAN infrastructure. IPSec is an end-to-end security framework (which includes a set of protocols and algorithms for mutual authentication) that operates at the network layer by extending the IP header of the frames. That is, in the IPSec tunnel mode, the entire IP packet is protected by inner and outer IP datagrams. The inner headers specify the communication endpoints whereas the outer IP header defines cryptographic end-points. Since the IPSec connection is unconcerned of WLAN deployments, the LWIP solution supports legacy WLAN deployments more easily than LWA (that requires software as well has hardware additions).
While the LWIP scheme is used, the Radio Resource Control (RRC) and signalling messages, which are exchanged between eNB and the UE, are carried over the LTE interface. A new protocol, called LWIP Encapsulation Protocol (LWIPEP), is specified for the transfer of user plane data. LWIPEP is also used for identification of the data bearer identity to which the LWIPEP SDU belongs. The traffic splitting is performed above the PDCP layer and the data path going towards WLAN is only passed through LWIPEP layer (and is bypassed by the LTE protocols below the PDCP layer). The LWIPEP protocol allows forwarding frames of different DRB using the IPSec tunnel configured for the UE. It is important to note here that no reordering procedure is employed at the UE (since aggregation is done above the PDCP layer) and all LWIP bearer data is forwarded towards to Wi/Fi network.
Since LWIP is transparent to the WLAN, the flow control mechanism used in LWA are not applicable. Also, the $Xw$ interface and WT nodes are not required. However, due to security issues, the IPSec tunnel is terminated into a dedicated gateway, called Security Gateway (SeGW). It is an interconnection point between WLAN and eNB (with a dedicated interface) and can be deployed at the eNB. Due to LWIP SeGW, the UE does not have a direct IP connectivity to the eNB through WLAN. Each UE is assigned a unique IPSec tunnel.
The eNB is responsible for activating and deactivating LWIP operations based on UE measurement reporting. The main drawback of this scheme is that the IPSec tunneling protocol appends an IPSec header to the Downlink IP packets that travel from eNB to UE via the WLAN network.
\section{Comparison between LWA and LWIP}
\chg{In both LWA and LWIP, the licensed operation (with aggregated LTE link) provides coverage and mobility robustness, whereas, the unlicensed operation (with aggregated WLAN link) provides higher (peak) UE data throughput by routing of high data traffic. There are a number of similarities between LWA and LWIP. In more detail: \emph{i)} both techniques are controlled/activated by the eNB, \emph{ii)} similar Wi-Fi measurement reporting frameworks are used in both, \emph{iii)} the same mobility set is used to determine the AP to which the UE would be connected to and \emph{iv)} regular Wi-Fi service can run in parallel to these techniques over the same hardware. In terms of security architecture, both the techniques use WLAN authentication methods to provide secure authentication and protection against relay attacks.
\begin{table}[H]
\caption{Comparison of LWA and LWIP across different performance indicators.}
\label{tab:1}
\centering
{
\scalebox{0.9}{
\begin{tabular}{|>{\centering\arraybackslash}p{6cm}|>{\centering\arraybackslash}p{3cm}|>{\centering\arraybackslash}p{3cm}|}
\hline
\parbox[c][5ex]{5ex}{\centering}\bf{Attributes}&\bf{LWA}&\bf{LWIP}\\ \hline
\parbox[c][4ex]{4ex}{\centering}Specifications & 3GPP Release 13&3GPP Release 13 \\\hline
\parbox[c][4ex]{4ex}{\centering}eNB control&Yes&Yes \\\hline
\parbox[c][4ex]{4ex}{\centering}Connecting layers&PDCP&IP (PDCP SDU) \\\hline
\parbox[c][4ex]{4ex}{\centering}Offloading granularity&Split or Switched Bearer & Switched Bearer\\\hline
\parbox[c][4ex]{4ex}{\centering}Modification to legacy Wi-Fi AP&Yes&No \\\hline
\parbox[c][4ex]{4ex}{\centering}Development scenarios&Collocated or non-collocated&Collocated\\\hline
\parbox[c][4ex]{4ex}{\centering}Upgrade in LTE network&eNB and UE&eNB\\\hline
\parbox[c][4ex]{4ex}{\centering}Upgrade in Wi-Fi network&LWA cognizant AP&None\\\hline
\parbox[c][4ex]{4ex}{\centering}New network entities in LTE&LWAAP and $Xw$ Interface&LWIPEP and SeGW\\\hline
\parbox[c][4ex]{4ex}{\centering}New network nodes in Wi-Fi&WT&None\\\hline
\parbox[c][4ex]{4ex}{\centering}Additional interface for flow control and security&$Xw$&None\\\hline
\parbox[c][4ex]{4ex}{\centering}WLAN measurements&Yes&Yes\\\hline
\parbox[c][4ex]{4ex}{\centering}WLAN security&WLAN native 802.1x EAP/AKA with fast authentication method&WLAN native 802.1x EAP/AKA\\\hline
\parbox[c][4ex]{4ex}{\centering}Regular Wi-Fi services on the same hardware&Yes&Yes\\\hline
\parbox[c][4ex]{4ex}{\centering}Additional UE cost&New software&New software\\\hline
\parbox[c][4ex]{4ex}{\centering}WLAN traffic direction&Downlink&Downlink plus uplink\\\hline
\end{tabular}
}}
\end{table}
Despite the similarities, LWA and LWIP techniques have significant differences. The main difference between these two architectures is the protocol layers at which the aggregation occurs and the security mechanism applied. In LWA, the eNB forwards PDCP data units (PDUs) to the WLAN AP and in LWIP, the eNB forwards PDCP SDUs, i.e., IP packets, to the WLAN AP. Table \ref{tab:1} provides a comparison between LWA and LWIP in terms of some of the key performance indicators.
The advantage of LWA is that it can provide better control and utilization of radio resources on both LTE and Wi-Fi links (but requires careful splitting of the traffic between LTE and Wi-Fi to ensure good load balance). This, in return, can increase the aggregate throughput for all users and improve the total system capacity. The non-collocated case of LWA allows higher density, independent placement, and, most importantly leverages the existing WLAN deployments.
While LWA in collocated scenario can be enabled via a simple software upgrade to LTE and Wi-Fi deployments and doesn't require deploying all new hardware with the associated cost, LWIP is a solution that is agnostic to the WLAN infrastructure (i.e. the IPSec tunnel is transparent to WLAN). LWA non-collocated flow control mechanisms are not applicable in LWIP. For this reason, the $Xw$ interface and the WT node are not required (but can be used to implement LWIP). In LWIP, eNB is in control of traffic steering. This protocol shows compatibility with any legacy WLAN, as it does not need any modifications or enhancements to the Wi-Fi AP. The drawbacks of LWIP are that the eNB hosts the SeGW (which is a new component) and it can only support switched bearer option (where the capacity of both LTE and Wi-Fi networks can not be used together).}
\section{Building Blocks}
\label{Background}
As highlighted in the previous sections, the basic aim of this work is to extend NS-3 to incorporate the additional LWA and LWIP functionalities to enable the support of LTE transmissions in the unlicensed band. In this section, we first explore the basics of the NS-3 simulator. It is important to mention here that NS-3 has Wi-Fi and LTE modules already included, but these technologies were adapted (in particular, LTE PDCP layer was updated) and used together to enable the LWA and LWIP implementation.
NS-3 is an open-source, discrete event-based network simulator, which is licensed under the GNU GPLv2 license. It is currently one of the most powerful and complete network simulators with a strong community support. It aims to provide open and extensible representative models of real world communication networks so as to produce realistic behaviors and statistics.
\begin{figure}
\centering
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=1\linewidth]{ns3design.pdf}
\caption{Fundamental Objects}
\label{fig:sub1}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=1\linewidth]{Nodeinsight.pdf}
\caption{Overview of a node model}
\label{fig:sub2}
\end{subfigure}
\caption{NS-3 overview}
\label{fig:test}
\end{figure}
The key networking abstraction used by NS-3 comprises node, application, channel, net device (NetDevice) and topology helpers. As shown in Figure \ref{fig:sub2}, a node is the basic computing device which contains different applications, protocol stacks and software drivers plus simulated hardware (representing a network interface card). Application framework provides methods for managing representation of user-level applications within simulations. A node is connected to a channel which is a logical path over which information flows. It provides methods to manage communication sub-networks and connects nodes over them. Net device represents the network device card which connects a node to a network. In NS-3, the net device abstraction covers both the software driver and the simulated hardware. A net device is installed in a node in order to enable it to communicate with other nodes within the simulation through different channels. Nodes can also contain multiple net devices and application objects. Examples of different applications available in NS-3 are as follows: OnOff, PacketSink, UdpEcho, BulkSend, UdpClientServer etc. Sockets (UDP/TCP) are then used to port the existing application to the NS-3 environment. To allow an application to operate over two nodes, one node is set as a source while the other node is set as the receiver. These sockets can be identified using IPv4/IPv6 addresses. Receiver socket is used to bind with the incoming request from the socket and source socket connects to the receiver socket by identifying it with a given IP address. For synchronization purposes, the port number of both the source and receiver sockets is kept the same.
NS-3 allows a programmer to follow specific simulation events by creating new tracing functions. In addition, different network statistics can be inspected using already existing network monitoring statistics, called FlowMonitor. The flow metrics, such as throughput, delay, jitter and packet loss ratio can be observed using FlowMonitor. NS-3 also allows the possibility to store multiple layer output events in a text file and to trace packet transmit/receive events via Packet Capture (PCAP) files.
NS-3 consists of a set of libraries and other external software libraries that can be combined together to evaluate a variety of access technologies. It supports the development of new components using C++ or Python. In our work we opted to use C++. To the best of our knowledge, none of the existing work has investigated the development and evaluation of LWA and LWIP protocols in NS-3.
\subsection{LTE implementation in NS-3}
\label{LTE implementation in NS-3}
\begin{figure}[tb]
\centering
\includegraphics[width=0.7\textwidth]{figNSLTE.pdf}
\caption{LTE EPC model.}
\label{fig2a}
\end{figure}
We focus our work in the use of the NS-3 LTE module called LENA (LTE-EPC Network Simulator)\cite{LTEEPCLENA}, which is developed and maintained by the Centre Tecnologic de Telecomunicacions de Catalunya (CTTC), Barcelona, Spain. As shown by Figure \ref{fig2a}, the LTE-EPC model has two main components; LTE module and Evolved Packet Core (EPC) model. The LTE model represented by pink, includes protocol stacks such as Radio Resource Control (RRC), PDCP, Radio Link Control (RLC), Medium Access Control (MAC) and Physical (PHY) layer. It also handles and manages the communication between UEs and eNB station. The EPC Model, represented by blue lines and green lines, contains the communication between different network interfaces.
The LTE module in NS-3 has been designed to support the evaluation of several aspects of LTE elements, namely Radio Resource Management (RRM), QoS-aware packet scheduling, intercell interference coordination and dynamic spectrum access. It includes the LTE Radio Protocol stack (PDCP, RLC, MAC, PHY) which resides entirely within the eNB and the UE.
\chg{The EPC model used in LTE NS-3 is depicted in Figure \ref{fig2b}. It provides the means to simulate end-to-end IP connectivity over the LTE Model. The remote host is connected to the LTE network through the Service Gateway/Packet Gateway (SGW/PGW) node of this model. Two different layers of IP networking are defined in the EPC model. The first one is the IP networking of EPC local area network. It involves the connection of eNB and SGW/PGW nodes through a set of point-to-point links. The second IP networking is the end-to-end connectivity for end users that consists of UEs, the SGW/PGW and the remote host. It does not include the eNB.
Based on Figure \ref{fig2b}, the downlink data flow is explained as follows: IP packets are generated at the remote host and addressed to the UE device. The internet routing algorithm diverts these packets to the netdevice at the PGW/SGW node. A virtual net device is installed at the PGW/SGW node, which is assigned the gateway IP address of the UE subnet. Thus, the static routing rules will allow the incoming frames to be routed through this Virtual net device. Afterwards, packets are sent to the eNB through the S1-U interface. Upon receiving the packets, the RLC and PDCP instances of eNB net device are used to retrieve the Radio Bearer ID (RBID) information embedded in a tag attached with the packets. This RBID information is used to forward the packet over the LTE radio interface. Finally, the UE net device receives the frame and forwards it locally to the IP stack.
\begin{figure}[htb]
\centering
\includegraphics[width=0.55\textwidth]{LTElayer1.pdf}
\caption{LTE module architecture in NS-3.}
\label{fig2b}
\end{figure}
The LTE network allows data traffic from the eNB to be routed to the remote host or UE through the EPC and handles the management and signaling functions of LTE. An important aspect of this implementation is that a secure tunnel is created from the PGW/SGW node, through eNB to the UE. In addition, the static routing algorithm diverts traffic from/to the UE. Therefore, the second IP networking does not involve the use of IP stack at the eNB in the EPC model of the NS-3.}
In this work, we focus on extracting data from either the PDCP layer, of the eNB module in NS-3, so that it could be offloaded to a Wi-Fi infrastructure network.
\subsubsection{NS-3 PDCP layer implementation}
\chg{The main function of PDCP layer in LTE-EPC model is to allow transmission of both data and signalling in a unified manner. Apart from this, PDCP layer also manages the compression and decompression of both the header and the content of IP data packets. It can also manage integrity protection and verification in the control plane. It is responsible for handling bearers and Each PCDP PDU can be uniquely by the following fields:
\begin{itemize}
\item PCDP SN
Each PDCP PDU is identified by a Sequence Number (SN), which is put in the PDCP header. It is used for in-sequence delivery of upper layer PDUs and to eliminate duplicated lower layer SDU.
\item LCID
A Logical Channel Identifier (LCID) is also used to identify the different logical channels corresponding to different QoS requirements.
\item RNTI
A Radio Network Temporary Identifier (RNTI) is assigned by the eNB to identify the UE over the radio interface.
\end{itemize}
With respect to 3GPP specification, The PDCP model of NS-3 supports the following features:
\begin{enumerate}
\item Transfer of data (user plane or control plane),
$DoTransmitPdcpSdu()$ interface is provided to upper RRC entity to transmit. The PDCP entity calls this primitive to send data to RLC SAP Provider (i.e. the part of the SAP that contains the RLC methods called by the PDCP). $DoReceivePdu()$ is the interface provided to lower RLC entity. The PDCP entity calls this primitive to receive entity to notify the RRC entity of the reception of a new RRC PDU.
\item Maintenance of PDCP SNs,
Status variables of the PDCP are maintained by TX sequence number $txSn$ and RX sequence number $rxSn$.
\item Transfer of SN status (for use upon handover).
$GetStatus()$ is used to get the status of the PDCP that includes the sequence number of the received and transmitted frames.
\end{enumerate}
Other PDCP features, such as header compression and ciphering are not implemented. The trace functionality available at the PDCP of the current NS-3 LTE implementation includes LCID, RNTI and packet size information for frames to be transmitted to transmitted and received.
In order to implement the LWA and LWIP schemes, the PDCP layer was enhanced to allow the possibility to forwarded data to the primary RLC layer or to offload it to the Wi-Fi network. This was achieved by passing a state variable $lwaactivate$ to the PDCP layer. The detail operation of the aforementioned variable are provided in Section~\ref{Packet generation at remote host and transfer to PDCP layer}.}
\subsubsection{NS-3 LTE code}
In this section, we describe a simple LTE/EPC example program. This script instantiates one eNB and attaches a single UE to it. It also creates an EPC network which is connected to a remote host. The three main component of EPC core in LTE (i.e. SGW, PGW and MME) are implemented in the following NS-3 code snippet.
\begin{lstlisting}[numbers=left, breaklines=true]
Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
Ptr<Node> pgw = epcHelper->GetPgwNode ();
Ptr<PointToPointEpcHelper> epcHelper = CreateObject<PointToPointEpcHelper> ();
lteHelper->SetEpcHelper (epcHelper);
\end{lstlisting}
The statements in line 1 and 2 create an LTE object and SGW/PGW node. The last two statements interconnect them together. The interconnection between them is made automatically by the LteHelper object. The eNB and UE are created and attached together by using the following code.
\begin{lstlisting}[numbers=left, breaklines=true]
NodeContainer ueNodes;
NodeContainer eNBNodes;
eNBNodes.Create(1);
ueNodes.Create(1);
NetDeviceContainer eNBLteDevs = lteHelper->InstalleNBDevice (eNBNodes);
NetDeviceContainer ueLteDevs = lteHelper->InstallUeDevice (ueNodes);
lteHelper->Attach (ueLteDevs, eNBLteDevs);
\end{lstlisting}
Line 1 to 4 are used in creating a single eNB node and a UE. The 4 and 5 line create net devices at the eNB and UE. The line 7 attaches the UE with the eNB via their respective net devices.
The following code outlines how to connect a single remote host to the PGW via a point-to-point link.
\begin{lstlisting}[numbers=left, breaklines=true]
NodeContainer remoteHostContainer;
remoteHostContainer.Create (1);
Ptr<Node> remoteHost = remoteHostContainer.Get (0);
InternetStackHelper internetLTE;
internetLTE.Install (remoteHostContainer);
PointToPointHelper p2ph;
p2ph.SetDeviceAttribute ("DataRate", DataRateValue (DataRate ("100Gb/s")));
p2ph.SetDeviceAttribute ("Mtu", UintegerValue (1500));
p2ph.SetChannelAttribute ("Delay", TimeValue (Seconds (0.010)));
NetDeviceContainer internetDevices = p2ph.Install (pgw, remoteHost);
Ipv4AddressHelper ipv4h;
ipv4h.SetBase ("10.0.0.0", "255.0.0.0");
Ipv4InterfaceContainer internetIpIfaces = ipv4h.Assign (internetDevices);
\end{lstlisting}
The following code enables the remote host to reach the UE by specifying static routes. The PointToPointEpcHelper, by default, assigns an IP address of the 7.0.0.0 network to the UE .
\begin{lstlisting}[numbers=left, breaklines=true]
Ipv4StaticRoutingHelper ipv4RoutingHelper;
Ptr<Ipv4StaticRouting> remoteHostStaticRouting =
ipv4RoutingHelper.GetStaticRouting (remoteHost->GetObject<Ipv4> ());
remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask ("255.0.0.0"), 1);
\end{lstlisting}
\subsection{Wi-Fi implementation in NS-3}
\label{Wi-Fi implementation in NS-3}
Wi-Fi technology is based on the IEEE 802.11 standard that defines the MAC and PHY layer for implementation of WLAN communication. Figure \ref{fig3aa} highlights the fundamental architecture of Wi-Fi in infrastructure mode. The basic building block of a Wi-Fi network is called the Basic Service Set (BSS). It is the area or cell that an AP covers (i.e. the transmissions from the AP have signal to noise ratio above the decodable threshold within this range) and all non-AP stations\footnote{In this report, we use the term "station" to represent a non-AP station.} communicate in a centralized manner to the AP.
\begin{figure}[htb]
\centering
\includegraphics[width=1\textwidth]{Wifilayers.pdf}
\caption{IEEE 802.11 protocol layers.}
\label{fig3aa}
\end{figure}
The MAC layer of 802.11 consists of the Distributed Coordination Function (DCF) and the Point Coordination Function (PCF), which are used to coordinate stations that perform simultaneous data transmissions. PCF, a central polling scheme in 802.11, is not mandatory in the IEEE 802.11 specifications. DCF is the dominant protocol used due to its simple and distributed implementation. It operates by using the well-known carrier sense paradigm, with an exponential backoff mechanism devised to ensure low probability of simultaneous transmission attempts by multiple stations. It also guarantees the same probability of channel access for all the stations intending to transmit over the shared channel.
The PHY layer specifications of IEEE 802.11 concentrate mainly on wireless transmission and on performing secondary functions, such as assessing the state of the wireless medium and reporting it back to the MAC layer. It is divided into two sublayers: Physical Layer Convergence Procedure (PLCP) and Physical Medium (PMD). The MAC layer communicates to the PLCP sublayer through Service Access Points (SAP). The IEEE 802.11 Physical carrier sensing includes the Physical Clear Channel Access Mechanism (PHYCCA) procedure, which is a function of the PLCP sublayer. The actual transmission and reception of data is performed at the PMD layer under the directions of the PLCP sublayer.
The Wi-Fi module in NS-3 is by far the largest network device component. It contains numerous modules and sub-classes and implements the IEEE 802.11 MAC and Physical layers that conform to the 802.11a, 802.11b, 802.11g, 802.11n and 802.11ac specifications.
\begin{figure}[tb]
\centering
\includegraphics[width=0.5\textwidth]{wifinetdevice.pdf}
\caption{Wi-Fi models and interactions in NS-3.}
\label{fig4a}
\end{figure}
A Wi-Fi net device is built up of classes that coordinate the packet reception and transmission. As highlighted in Figure \ref{fig4a}, the main components of NS-3 Wi-Fi implementation consist of the following modules: WifiNetDevice, MacHigh, DcfManager, DcaTxop, MacRx, MacLow, YansWi-FiPhy, and YansWi-Fichannel.
The WifiNetDevice module is used for interfacing with higher layers. The MacHigh models management functionalities such as beacon generation, probing and association frame exchange. Two types of MAC high classes are available for infrastructure configuration in NS-3. Namely, $ns3 :: ApWifiMac$ (AP class) and $ns3 :: StaWifiMac$ (station class). The AP class models functions of an AP such as beacon generation, association and authentication. In addition, it performs all the necessary methods to receive, process and forward packets to the lower and higher layers. The different MACHigh classes share a common parent class $ns3:: RegularWifiMac$ that implements the basic features related to QoS and provides support for High Throughput (HT) and Very High Throughput (VHT) wireless configuration.
MacHigh forwards incoming data to a single DcaTxop. The main classes implementing the DCF mechanism for the MAC layer are DcfManager and DcaTxop classes. DcaTxop contains the backoff counter and pushes data to MacLow for transmission after gaining medium access from the DcfManager. DxaTxop and MacRXMiddle together handle the sequence number of packets, fragmentation, filtering of duplicate reception, and re-transmissions. MacLow module takes care of the Request to Send (RTS)/Clear to Send (CTS)/Data and Acknowledge (ACK) packet transmissions.
The $ns3::YansWifiPhy$ class is designed to implement the IEEE 802.11 physical layer. It models an additive Gaussian Noise Channel (AWGN) with cumulative noise handled by InterferenceHelper and implements a packet level physical model. It manages the reception and transmission of the packets over the wireless channel, models channel interference and errors, channel sensing, Signal to Interference plus Noise Ratio (SINR) computation, etc. In addition, this class allows the tracking of the energy consumed during the transmissions and also while listening to the channel. The abstract class $ns3:: YansWifiChannel$ provides an analytical approximation of the physical medium over which the Wi-Fi data is transmitted. It permits the definition of the propagation loss and propagation delay models of the channel. The delay of the received frames is calculated according to the PropagationDelayModel class and the calculation of the reception power is performed by the PropagationLossModel class.
\subsubsection{NS-3 Wi-Fi Infrastructure mode code}
In the following section, a simple description is provided to design a simulation model of Wi-Fi network in an infrastructure mode within the NS-3 environment. We start by first declaring two Wi-Fi stations (i.e. a single AP and a single station)
\begin{lstlisting}[numbers=left, breaklines=true]
NodeContainer WifiStaNodes;
NodeContainer WifiApNode;
WifiApNode.Create(1);
WifiStaNodes.Create(1);
\end{lstlisting}
The Wi-Fi standard properties can be defined by WifiHelperclass with the following code:
\begin{lstlisting}[numbers=left, breaklines=true]
WifiHelper Wifi;
Wifi.SetStandard (Wifi_PHY_STANDARD_80211ac);
StringValue DataRateWifi = VhtWifiMacHelper::DataRateForMcs (datamcs);
StringValue ControlRateWifi
VhtWifiMacHelper::DataRateForMcs (controlmcs);
Wi-Fi.SetRemoteStationManager ("ns3::ConstantRateWi-FiManager", "DataMode", DataRateWifi,"ControlMode", ControlRateWifi);
\end{lstlisting}
Next, the details of the Wi-Fi channel to be used in the simulations are added.
\begin{lstlisting}[numbers=left, breaklines=true]
YansWifiChannelHelper WifiChannel;
WifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
WifiChannel.AddPropagationLoss
("ns3::FixedRssLossModel","Rss",DoubleValue (rss)); WifiPhy.SetChannel (WifiChannel.Create ());
\end{lstlisting}
Next, MAC and PHY protocols are installed on the Wi-Fi station and the AP.
\begin{lstlisting}[numbers=left, breaklines=true]
YansWifiPhyHelper WifiPhy = YansWifiPhyHelper::Default ();
VhtWifiMacHelper WifiMac = VhtWifiMacHelper::Default ();
NetDeviceContainer devicesta;
Ssid ssid = Ssid ("ns3-80211ac");
WifiMac.SetType ("ns3::StaWi-FiMac", "Ssid", SsidValue (ssid), "ActiveProbing", BooleanValue (false));
devicesta.Add(Wi-Fi.Install (WifiPhy, WifiMac, WifiStaNodes));
WifiMac.SetType ("ns3::ApWifiMac","Ssid", SsidValue (ssid));
NetDeviceContainer deviceap = Wifi.Install (WifiPhy, WifiMac, WifiApNode);
\end{lstlisting}
The first two lines create the default PHY and MAC protocols. Then, line 3 and line 8 create new NetDevices labeled as devicesta and deviceap which are used within the Wi-Fi stations. This code creates the configuration of IEEE 802.11 in infrastructure mode. The network identifier is defined in line 4. Line 5 to 8 attach the station NetDevices with the AP, completing the WLAN configuration.
\subsection{Point-to-Point implementation in NS-3}
\label{Point-to-Point implementation in NS-3}
The NS-3 Point-to-Point (P2P) model is a simplistic model of a point to point serial line link. Data is encapsulated in the Point-to-Point Protocol (PPP - RFC 1661). The key is that the point-to-point protocol link is assumed to be established and authenticated at all times. Simulation of P2P requires that node objects have $ns3::PointToPointNetDevice$ objects installed on them and individual node objects are connected using $ns3::PointToPointChannel$ object. This P2P channel models two wires transmitting bits at the data rate specified by the source net device.
\begin{figure}[tb]
\centering
\includegraphics[width=0.6\textwidth]{pointtopoint.pdf}
\caption{PointToPoint protocol layers.}
\label{fig4}
\end{figure}
\subsubsection{NS-3 Point-to-Point code}
The following simple code is used to create a P2P link in NS-3:
\begin{lstlisting}[numbers=left, breaklines=true]
PointToPointHelper p2p;
NetDeviceContainer apeNB = p2p.Install(WifiApNode, eNBNodes)
\end{lstlisting}
\subsection{Tracing using Callback functions in NS-3}
The main tracing system provided by NS-3 is callback-based tracing. A callback is an NS-3 object that operates similarly to a function pointer with additional functionality. Each trace source is associated with a specific object class and is identified by a name. A programmer can register a C++ function or method to be called when a certain trace produces a new event. The common uses of callback-based tracing include: 1) Extracting raw data based on events and writing it to a file, 2) Collecting statistics based on certain events and writing them to a file, 3) Reacting to the event and changing some parameter in the simulation in real time.
In Sections \ref{Methodology to create LWA} and \ref{Methodology to create LWIP}, the detail description of different callback functions used within the design of LWA and LWIP is provided.
\subsection{Packet tags in NS-3}
\label{Packet tags in NS-3}
A tag is a small chunk of information that can be added within a packet generated by the NS-3 simulator without increasing the packet size (i. e. the duration of packet on the medium is not changed when a tag is included). These tags help in adding simulation information to a packet. The general structure of tags in NS-3 is,
\begin{lstlisting}[numbers=left, breaklines=true]
Ptr <Packet>;
MyTag tag;
p-> AddTag(tag)
p->PeekTag(tag)
\end{lstlisting}
\chg{In our implementation, tags are only visible to EnB and are used to forward the splitting functionality enabled at the PDCP layer (i.e. LWA is not, is partially or is fully activated) and the RBID of a packet to the LWAAP}.
\subsection{Packet headers in NS-3}
\chg{NS-3 defines packet headers for different protocols used within the simulations.
The packet classes inherit the NS-3 Header class and provides the interface for other classes to interact with the packets.
Following is the implementation of a new subclass of the ns3::Header base class to represent a protocol header,}
\begin{lstlisting}[numbers=left, breaklines=true]
class NewHeader : public Header
{
public:
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (Buffer::Iterator start) const;
virtual uint32_t Deserialize (Buffer::Iterator start);
virtual void Print (std::ostream &os) const;
void SetData (uint32_t data);
uint32_t GetData (void) const;
private:
uint32_t m_data;
};
\end{lstlisting}
The protocol header can attached to a packet by using,
\begin{lstlisting}[numbers=left, breaklines=true]
Ptr<Packet> p = ...;
YHeader yHeader;
yHeader.SetData (0xdeadbeaf);
p->AddHeader (yHeader);
\end{lstlisting}
This header can be extracted from the packet by using the following code,
\begin{lstlisting}[numbers=left, breaklines=true]
Ptr<Packet> p = ...;
YHeader yHeader;
p->RemoveHeader (yHeader);
uint32_t data = yHeader.GetData ();
\end{lstlisting}
\chg{In order to keep a track of the sequence number of packets that are transmitted through LWA or LWIP interface, we use an already existing header for UDP client/server application (called $SeqTsHeader$). To generate the LWAAP PDUs that encompass the status of $lwaactivate$ and RBID, a new header (called $lwaheader$) was defined.} Similarly, an $lwipheader$ is defined that contains $lwipactivate$ and RBID information. This header is inserted by LWIPEP protocol to generate LWIP PDUs.
\subsection{IPSec tunnel implementation in NS-3}
\label{IPSec tunnel implementation in NS-3}
Tunnels are used to create the illusion for some protocols running on a network device that they have a direct connection to another device even when no direct physical link exist between them. In NS-3, the idea of tunneling is achieved through the use of Virtual net devices (called VirtualNetDevice). The main idea is to place an adaptation of interface on top of the real network interfaces. This adaptation allows the use of a unique IP address over different technologies. The virtual net device delegates the task of actual packet transmission to a user callback function. It also allows the user defined code to inject the packets as if they had been received by the VirtualNetDevice. Together, these features are used to build tunnels. For example, by transmitting packets into a UDP socket, an IP-over-UDP-over-IP tunnel can be created.
The use of VirtualNetDevice allows the entire original IP packet to be encapsulated with a new packet header with different source and destination addresses. One of the drawbacks of using IPSec tunnel is that tunneling increases the bandwidth constraints of the network.
\subsubsection{NS-3 tunnel code}
The NS-3 implementation of a tunnel is represented by the following code example.
\begin{lstlisting}[numbers=left, breaklines=true]
class Tunnel
{
Ptr<Socket> m_n1Socket;
Ptr<Socket> m_n2Socket;
Ipv4Address m_n1Address;
Ipv4Address m_n2Address;
Ptr<VirtualNetDevice> m_n1Tap;
Ptr<VirtualNetDevice> m_n2Tap;
bool
N1VirtualSend (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber)
bool
N2VirtualSend (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber)
void N2SocketRecv (Ptr<Socket> socket)
void N1SocketRecv (Ptr<Socket> socket)
\end{lstlisting}
The starting and ending point of the tunnel are set as the node containers over which the tunnel is intended to be made. The IP addresses of the netdevice container corresponding to the node container are also passed to the tunnel class. Within the tunnel, VirtualNetDevice is defined and configured to send packets.
\subsection{Flow Monitor in NS-3}
In NS-3, the task for automated result gathering is performed by using a network monitoring feature called Flow Monitor (FlowMonitor). It is integrated in NS-3 as a module and collects/stores network performance data based on per-flow statistics at the IP layer including throughput and latency. etc. It is important to mention here that the main difference between FlowMonitor and PCAP is that the former provide per flow end-to-end statistics, whereas, the later is used to capture intermediate traffic being transported over the medium. Therefore, PCAP packet length is expected to be greater as it contains different technology headers used for transportation.
The problem with the FlowMonitor is that it is not designed to be used for protocols/mechanism operating in loopback mode.
\subsubsection{NS-3 FlowMonitor code}
The syntax to define flow probes, to automatically classify
simulated traffic, and to collect flow statistics is shown below.
\begin{lstlisting}[numbers=left, breaklines=true]
FlowMonitorHelper flowmon;
Ptr<FlowMonitor> monitor = flowmon.Install(c);
monitor->CheckForLostPackets ();
Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier> (flowmon.GetClassifier ());
std::map<FlowId, FlowMonitor::FlowStats> stats = monitor->GetFlowStats ();
for (std::map<FlowId, FlowMonitor::FlowStats>::const_iterator i = stats.begin (); i != stats.end (); ++i)
{
Ipv4FlowClassifier::FiveTuple t = classifier->FindFlow (i->first);
std::cout << "Flow " << i->first << " (" << t.sourceAddress << " -> " << t.destinationAddress << ")\n";
std::cout << " Tx Bytes: " << i->second.txBytes << "\n";
std::cout << " Rx Bytes: " << i->second.rxBytes << "\n";
std::cout << " Throughput: " << i->second.rxBytes * 8.0 / (i->second.timeLastRxPacket.GetSeconds() - i-
>second.timeFirstTxPacket.GetSeconds())/1024 << " Kbps\n";
}
monitor->SerializeToXmlFile("scratch/newtrial.flowmon", true, true);
\end{lstlisting}
FlowMonitorHelper takes care of all the details of creating the single classifier, creating one Ipv4FlowProbe per node, and creating the FlowMonitor instance. It installs the monitor in the nodes, set the monitor attributes, and prints the statistics
\section{Implementation of LWA in NS-3}
\label{Customization to create LWA model in NS-3}
As highlighted in Section \ref{Overview of LWA architecture}, the key concept of LWA is that it enables routing packets by using the PDCP layer in the eNB as convergence layer (i.e. a UE in $RRC$-${Connected}$ mode is configured by the eNB to utilize radio resources of LTE and WLAN). The control plane connection remains with the LTE, whereas the data can be routed via both eNB and WLAN. In order to explain how this architecture was simulated in NS-3, we refer to Figure \ref{fig5}, which shows the interconnection between different network devices. Although LWA bearers may be configured to deliver both uplink and downlink data over the WLAN, we focus our study on the implementation of LWA mentioned in release 13 which only focuses on downlink communication.
\begin{figure}[tb]
\centering
\includegraphics[width=1\textwidth]{Lwa-NS33.pdf}
\caption{\chg{LWA NS-3 implementation.}}
\label{fig5}
\end{figure}
Before initiating the simulation, the PDCP layer of LTE eNB can be commanded to activate/deactivate the offloading of data. If LWA is fully activated, the data flow from eNB to UE is stopped and the data is diverted towards the Wi-Fi AP. The aforementioned procedure is accomplished by using the event triggering capabilities of callback functions.
\subsection{Assumptions}
\label{Assumptions LWA}
In our implementation, we make the following assumptions:
\begin{enumerate}[(1)]
\item The non-collocated LWA scenario is assumed, were the LTE network is connected through a WT to an already existing Wi-Fi network.
\item We assume an ideal $Xw$-$C$ interface where there is no error in communication and setting up.
\item No mobility model is set for all the the stations (either LTE or WLAN) within the simulation.
\item \chg
The Wi-Fi AP can accommodate traffic of normal Wi-Fi stations as well as the station used by LWA.}
\item Wifi station is already configured and associated with a WLAN AP.
\end{enumerate}
\subsection{Implementation Details}
\label{Methodology to create LWA}
In this section, we describe the sequence of actions that take place during the simulation of our LWA protocol implementation in NS-3. As shown in Figure \ref{fig5}, multiple network components corresponding to different technologies (LTE, PointToPoint, Wi-Fi) are used together. It also contains various components and features described in Section \ref{Background}. First, any traffic initiated between the remote host and the UE within the EPC model attempts to follow the direct path. However, the downlink traffic can be managed, based on LWA being partially or fully activated. For the case of full LWA being used, all the the traffic is forwarded to the Wi-Fi network. Whereas for partial LWA, some packets are allowed to flow through LTE while others are diverted to flow through Wi-Fi network.
As shown in Figure \ref{fig5}, two main mechanism representing LWA implementation at the PDCP layer are: LWA Tag and Split. If partial or full LWA is activated, all the packets that are to be passed to Wi-Fi network are tagged to maintain their identity. In the split part, all frames with LWA tags are passed to the P2P link to be forwarded to Wi-Fi network. All the other frames, that are not LWA tagged, are forwarded to the RLC layer.
\begin{figure}[htb]
\centering
\includegraphics[width=1\textwidth]{FlowgraphLWA2.pdf}
\caption{\chg{Activity diagram of LWA implementations in NS-3.}}
\label{fig5a}
\end{figure}
Figure \ref{fig5} shows a high-level sketch of the implementation, more details of the modifications within the PDCP class along with the design detail of LWA in NS-3 main file are depicted in Figure \ref{fig5a}. This flowgraph provides a detailed description and the subsequent flow of packets of the new additions that connect LTE and Wi-Fi networks in NS-3 (the parts highlighted in green in Figure \ref{fig5} correspond to code additions).
The implementation of the hybrid nature of the LWA architecture is explained as follows;
\begin{enumerate}[(1)]
\item \textit{Packet generation at the remote host and transfer to PDCP layer}
\label{Packet generation at remote host and transfer to PDCP layer}
The remote host within the EPC model of NS-3 provides IP-based service to a single UE. An OnOff/PacketSink application (that mimics a Voice Over IP (VoIP) traffic flow) is used to transfer as burst of UDP packets over a Client/Server configuration from the remote host to the UE. The Ipv4StaticRoutingHelper class is used to create a static routing table to enable a connection to operate between the remote host and the UE through the eNB. The sequence number of generated packet is attached with the packet as header (called $SeqTsHeader$) within the OnOff packet generator. Following code from $SendPacket ()$ fuction of onoff application shows the process of header attachment.
\begin{lstlisting}[numbers=left, breaklines=true]
SeqTsHeader seqTs;
seqTs.SetSeq (m_sent);
Ptr<Packet> packet = Create<Packet> (m_pktSize);
packet->AddHeader (seqTs);
\end{lstlisting}
where $m\_sent$ is the counter for sent packets
\item \textit{LWA data flow differentiation}
In NS-3, attributes are used to organize, document and modify the default values used by the various components of the models. In-order to inform the PDCP layer of the eNB about the activation or deactivation of LWA, a new attribute is added. This attribute is called $lwaactivate$.
At the PDCP layer, the new attribute is defined as,
\begin{lstlisting}[numbers=left, breaklines=true]
.AddAttribute ("PDCPDecLwa",
"PDCP LWA decision variable",
UintegerValue (0),
MakeUintegerAccessor (&LtePdcp::pdcp_decisionlwa),
MakeUintegerChecker<uint32_t>())
\end{lstlisting}
Add attribute binds the member variable $pdcp$$\_$$decision$ to a public string PDCPDecLwa. It is important to mention here that the value of variable $pdcp$$\_$$decision$ is accessible in the attribute namespace, which is based on string "PDCPDecLwa" and TypeId name ns3::LtePdcp. This variable $pdcp$$\_$$decision$ is used to activate and deactivate the LWA connection. As highlighted in Section \ref{Overview of LWA architecture}, the LWA technique also allows the partial use of both LTE and Wi-Fi technologies together so as to enable in-sequence combining of packets at the UE. The following table enlists different values of $pdcp$$\_$$decision$ and the corresponding stages.
\begin{table}[H]
\centering
\begin{tabular}{|c|c|}
\hline
Value assigned & State \\ \hline
0 & LWA deactivated (LTE only) \\ \hline
1 & Partial LWA (LTE+Wi-Fi) \\ \hline
2 & LWA activated (Wi-Fi only) \\ \hline
\end{tabular}
\end{table}
These states are also used to to mimic the split and switched bearer operations of LWA (where a $pdcp$$\_$$decision$ value of 1 represents the split bearer and a $pdcp$$\_$$decision$ of 2 indicates the swicthed bearer option).
At the start of the simulation, the $Config::SetDefault$ method is used to override the initial (default) value of the PDCPDecLwa attribute:
\begin{lstlisting}[numbers=left, breaklines=true]
Config::SetDefault ("ns3::LtePdcp::PDCPDecLwa", UintegerValue(lwaactivate));
\end{lstlisting}
We currently activate/deactivate the use of LWA before the start of the simulation. However, LWA can be enabled during run-time based on a feedback path from the UE. This procedure would require modifications to be made at the attribute defined within the PDCP layer and can be considered as future work.
As an alternative, the current approach can also be used to mimic the activation/deactivation based on a feedback. This could be done by running two separate instances of NS-3 LWA simulation in a sequence, so that the outcome of the first could be used as means to enable/disable LWA in the second simulation (while keeping a constant positions of nodes within the two simulations).
As described in Figure \ref{fig5a}, the first stage of the flowgraph resolves the activation of LWA. If LWA or partial LWA is not activated by setting $pdcp$$\_$$decision$, the received packet is passed to the TransmitPdcpPdu function so that it could be forwarded to the RLC layer.
\item \textit{RBID and LWA activation status tags}
When $pdcp$$\_$$decision$ variable is assigned a value corresponding to partial or full LWA activate, all packets are tagged with the corresponding RBID and LWA status information before being en-queued for transmission from LWAAP node. Two new tags are created by sub-classing from the abstract base class ns3::Tag (i.e. LWAtag and LCIDtag). This procedure is represented by the entity "Add LWATag and RBIDTag" in Figure \ref{fig5a}. The aforementioned task is achieved by the following code,
\begin{lstlisting}[numbers=left, breaklines=true]
pdcptag.Set(pdcp_decisionlwa);
lcidtag.Set((uint32_t)m_lcid);
p->AddPacketTag (pdcptag);
p->AddByteTag (lcidtag);
\end{lstlisting}
where $pdcptag$ includes the LWA activation status and $lcidtag$ contains the logical ID of the bearer (RBID is derived from the logical ID).
\item \textit{Flow control in LTE PDCP layer}
Packets upon arriving at the PDCP layer with $pdcp$$\_$$decision$ variable assigned a value corresponding to full LWA activate, are tagged and are en-queued for transmission over the Wi-Fi infrastructure. On the other hand, if the variable $pdcp$$\_$$decision$ is assigned a value corresponding to partial LWA activate, the modulo operator is used to decide the percentage of packets that are to be send to Wi-Fi AP and the eNB\footnote{It is pertinent to mention here that Release 13 of 3GPP does not define the mechanism to split}. This is represented by "Remainder = PDCPcounter \% “N”" in Figure \ref{fig5a}. The variable $N$ can decide the percentage of split. Similar to $lwaactivate$, a new attribute can be defined at the PDCP layer, which can enable $N$ to be set at the start of the simulation. However, in the current implementation, $N$ is set to a fixed value of 2. Thus, when partial LWA is activated, the traffic flow is equally split between LTE and Wi-Fi networks.
In order to allow in-sequence delivery of frames at the LWA UE upper layers, each packet arriving at the PDCP layer of eNB is already assigned a sequence number. This number is embedded within a 12 bytes header called $SeqTsHeader$. The sequence number along with RBID information can be used to aggregate data at the LWA UE.
In order to extract frames from the PDCP layer of eNB, a new callback function is added in the PDCP class of LTE. Given that the same PDCP class is used by the UE, this callback function is only initialized for LTE eNB and is declared as:
\begin{lstlisting}[numbers=left, breaklines=true]
Config::ConnectWithoutContext ("/NodeList/*/DeviceList/*/$ns3::LteeNBNetDevice/LteeNBRrc/UeMap/*/DataRadioBearerMap/*/LtePdcp/TxPDUtrace", MakeCallback (&Lte_pdcpDlTxPDU));
\end{lstlisting}
A new attribute, called TxPDUtrace, is added in the PDCP layer, which gives access to the LWA packet (i.e. Lte\_pdcpDlTxPDU) and is used for the collection of the actual transmission. That is, when ever a packet is tagged with LWAtag and LCIDtag, the trace callback function $LtePdcp::m_pdcptxtrace$ at the PDCP layer is triggered and the packet is passed to the $Lte\_pdcpDlTxPDU$ function. This procedure is represented by "Callback LtePDCPTX" box in Figure \ref{fig5a}.
This packet (with both header and data contents) is copied and en-queued in the buffer for transfer to the Wi-Fi network through a $Xw$ (P2P) link. The new attribute is defined as:
\begin{lstlisting}[numbers=left, breaklines=true]
.AddTraceSource ("TxPDUtrace",
"PDU to be transmit.",
MakeTraceSourceAccessor (&LtePdcp::m_pdcptxtrace),
"ns3::Packet::TracedCallback")
\end{lstlisting}
It is important to mention here that the above mentioned callback function is used only for LWA tagged frames and these frames are not passed to the RLC layer of the LTE eNB.
\item \textit{Packet generation to LWAAP}
In 3GPP LTE, a typical Transmit Time Interval (TTI), which refers to the duration of a transmission over the radio link, is set to 1 ms \cite{3GPP}. For a timely and accurate transmission of frames from LTE eNB to Wi-Fi AP, the buffer is continuously observed after every "X" interval. The value of this interval is kept below the aforementioned TTI (i.e. $X$ $= 0.1ms$). Therefore, whenever a packet is placed in the buffer, it is immediately transferred to the source of the UDP socket installed at the LWAAPnode. The aforementioned procedures are represented by "Enqueue packet" "Queue empty" and "Wait for "X" time" entities in Figure \ref{fig5a}.
\item \textit{Packet formulation by LWAAP and transmission to the $Xw$ link}
As described above, RBID and sequence number of a packets are important parameters that can enable the aggregation of flow at the UE. Information regarding the sequence number is passed along when the packet is copied along with $SeqTsHeader$. RBID and $lwaactivate$ information is first extracted from tags and then added as header within a packet to be transmitted over the $Xw$ interface.
While tags are used to pass information within a packet in NS-3, they are not part of the packet and do not extend the size of the packet. Thus, in the first stage, LWATag and RBIDTag information is extracted from the packets by using the following code,
\begin{lstlisting}[numbers=left, breaklines=true]
if (m_currentPacket->PeekPacketTag(pdcptag)){
lwastatus = pdcptag.Get();
}
if(m_currentPacket->FindFirstMatchingByteTag (lcidtag)){
lcid = lcidtag.Get();
rbid = lcid - 2;
}
\end{lstlisting}
As described by the 3GPP LWA release 13 standard, the LWAAP entity generates LWAAP PDU containing a RBID identity.
To forward the RBID and LWA status information, a new 2 byte header named $LwaHeader$ is defined. This header is attached to the packet by using the following code,
\begin{lstlisting}[numbers=left, breaklines=true]
LwaHeader lwa;
lwa.SetLwaActivate (lwaactivate);
lwa.SetBearerId (bearerid);
\end{lstlisting}
In the next stage, the packet is transferred to the source of the UDP socket installed at the LWAAPnode. The above highlighted steps are represented by LWAAP entity in Figure \ref{fig5a}.
\item \textit{Data forward from LWAAPnode to the Wi-Fi station through the Wi-Fi AP}
The downlink flow of a packet from the LWAAPnode to Wi-Fi station is accomplished by creating a source destination socket. The $Xw$ interface in the simulation is assumed to be a P2P link created between the LWAAPnode and the WTnode. Wi-fi AP is also connected to the WT through a P2P link. It is important to mention here that the P2P link of $Xw$-$U$ interface can be replaced with other NS-3 netdevices (such as CSMA) to enable access to outside sockets using tap bridge\footnote{The Tap Bridge is designed to integrate real internet hosts (or more precisely, hosts that support Tun/Tap devices) into NS-3 simulations.} netdevice. This can help in running two separate instance s of NS-3, where one can represent the eNB and LWAAP and the other can include Wi-Fi AP and the Wi-Fi station. Such a setting can be used to reduce the processing strain of running all NS-3 entities within a single machine.
The LWAAPnode node is set as a source socket and the Wi-Fi station node as the destination sink. Both sockets are identified using IPv4 addresses. The task of the source socket is to connect to the destination socket by identifying it with a given IP address. At the receiver end, the destination socket's task is to bind with the incoming request from the source socket. For synchronization between sockets, the port number for source and destination is kept the same. In order to create the routing database and initialize the routing tables for connection between the P2P node, Wi-Fi AP and Wi-Fi station, the Ipv4GlobalRoutingHelper class was used.
\item \textit{Packet reception at Wi-Fi station}
The packet received at the destination socket at the Wi-Fi station include the $SeqTsHeader$ and the $LwaHeader$ headers. The $lwaactivate$ status, RBID information (i.e. bearer ID) and sequence number of the received packet can be extracted by using the following code.
\begin{lstlisting}[numbers=left, breaklines=true]
m_currentPacket->RemoveHeader (lwa);
lwaactivate=lwa.GetLwaActivate();
bearerid=lwa.GetBearerId();
m_currentPacket->RemoveHeader (seqTsx);
currentSequenceNumber = seqTsx.GetSeq ();
\end{lstlisting}
This information can be used to aggregate packets at the application layer of the UE.
\end{enumerate}
\chg{With the help of Table~\ref{tab:2}, a comparison between implemented functions of LWA in NS-3 with 3GPP LWA standard is provided. As highlighted in the table, most of the specifications of LWA provided by 3GPP release 13 were implemented in NS-3. LWA was controlled at the eNB and the splitting of frames was performed at the PDCP layer. The $pdcp\_decisionlwa$ variable enabled the NS-3 implementation to support split and switched bearer functionality. Since the implementation did not include a method to aggregate data at the PDCP layer, no changes were made at the NS-3 LTE UE\footnote{The aggregation of flows at the PDCP layer required modifications to the core of the NS-3 LTE module and was considered out of scope of our current work.}}. As mentioned in Section \ref{Assumptions LWA}, it was assumed that an ideal control plane ($Xw$-$C$) was available between eNB and WT. Therefore, the details of WLAN measurements, support for Establishment, modification and error handling mechanism were not considered within this implementation.
\begin{table}[H]
\caption{\chg{NS-3 LWA implementation compared with 3GPP standard.}}
\label{tab:2}
\centering
{
\scalebox{0.9}{
\begin{tabular}{|>{\centering\arraybackslash}p{6cm}|>{\centering\arraybackslash}p{3cm}|>{\centering\arraybackslash}p{3cm}|}
\hline
\parbox[c][5ex]{5ex}{\centering}\bf{Attributes}&\bf{NS-3 LWA}&\bf{3GPP standard LWA}\\ \hline
\parbox[c][4ex]{4ex}{\centering}eNB control&Yes&Yes \\\hline
\parbox[c][4ex]{4ex}{\centering}Connecting layers&PDCP&PDCP \\\hline
\parbox[c][4ex]{4ex}{\centering}Offloading granularity&Split or Switched Bearer & Split or Switched Bearer\\\hline
\parbox[c][4ex]{4ex}{\centering}Upgrade in LTE network&eNB and UE&eNB\\\hline
\parbox[c][4ex]{4ex}{\centering}Aggregating flows at UE PDCP&No&Yes\\\hline
\parbox[c][4ex]{4ex}{\centering}New network entities in LTE&LWAAP and $Xw$-$U$&LWAAP and $Xw$\\\hline
\parbox[c][4ex]{4ex}{\centering}Additional interface for flow control&$Xw$-$U$&$Xw$-$U$\\\hline
\parbox[c][4ex]{4ex}{\centering}$Xw$ control plane interface&No&$Xw$-$C$\\\hline
\parbox[c][4ex]{4ex}{\centering}
WT connection establishment&No&Yes\\\hline
\parbox[c][4ex]{4ex}{\centering}New network nodes in Wi-Fi&WT&WT\\\hline
\parbox[c][4ex]{4ex}{\centering}WLAN measurements&No&Yes\\\hline
\parbox[c][4ex]{4ex}{\centering}WLAN security&No&WLAN native 802.1x EAP/AKA with fast authentication method\\\hline
\parbox[c][4ex]{4ex}{\centering}Regular Wi-Fi services on the same hardware&Yes&Yes\\\hline
\parbox[c][4ex]{4ex}{\centering}WLAN traffic direction&Downlink&Downlink\\\hline
\end{tabular}
}}
\end{table}
\section{Customization to create LWIP model in NS-3}
\label{Customization to create LWIP model in NS-3}
In LWIP, an IPSec tunnel is used to transmit downlink traffic from eNB to the UE through a Wi-Fi AP. Similar to LWA, the UE in LWIP has a RRC connection to the eNB. However, the main difference between LWIP and LWA is that LWIP supports downlink switching of IP flows at the IP layer while LWA is able to aggregate flows at the PDCP layer. Unlike LWA, packets in LWIP can not be simultaneously transmitted to both LTE or WLAN link. As described in Section \ref{LTE implementation in NS-3}, the IP networking for end-to-end connectivity for end users (that contains UE, SGW/PGW and remote host) does not involve the use of IP stack at the eNB in the EPC model of the NS-3. In order to counter the aforementioned problem and to gain access to PDCP SDUs (IP packets),
the LWIP protocol was designed to follow the same methodology used in Section \ref{Methodology to create LWA} for LWA to extract frames at the PDCP layer.
\begin{figure}[tb]
\centering
\includegraphics[width=0.9\textwidth]{Lwip-NS34.pdf}
\caption{LWIP NS-3 implementation.}
\label{fig8}
\end{figure}
\subsection{Main Idea}
Similar to LWA implementation, the PDCP layer of LTE eNB can be commanded to activate/deactivate the offloading of data. If LWIP is activated, the complete flow from LTE to UE is stopped and the data is diverted towards the Wi-Fi AP. The aforementioned procedure is accomplished by event driven triggering technique. An IPSec tunnel is created on which IP packets are tunneled over UDP/IP. It is important to mention here that LWIP specifications mentioned in 3GPP Release 13 do not allow the use of split bearer technique. Also, the use of $Xw$ interface is not mandatory. For the NS-3 implementation, since the same LWA mechanism is leveraged, $Xw$ interface was used. This is also justified by the fact that the implemented $Xw$-$U$ interface was only responsible for transfer of packets.
\subsection{Assumptions}
\label{Assumptions for LWIP}
For our implementation, we make the following assumptions:
\begin{enumerate}[(1)]
\item The non-collocated scenario is assumed, where LTE network is connected through SeGW to an already existing Wi-Fi network.
\item We assume an ideal $Xw$-$C$ interface where there is no error in communication and setting up.
\item No mobility model is set for all the the stations (either LTE or WLAN) within the simulation.
\item Wi-Fi station is already configured and associated with a WLAN AP.
\item The LWIP tunnel between the LWIP SeGW and the Wi-Fi station is already established through Wi-Fi infrastructure.
\item The IPSec tunnel is an IP tunnel that only contains authentication but does not use encryption. While the packets sent over the tunnel are authenticated by the LWIP tag, adding end-to-end encryption of frames is left as a future work.
\end{enumerate}
\subsection{Methodology to create LWIP}
\label{Methodology to create LWIP}
In this section, we describe the sequence of events that take place during the simulation of LWIP protocol in NS-3. Figure \ref{fig8} indicates that multiple network components corresponding to different technologies (LTE, PointToPoint, VirtualNetDevice and Wi-Fi) are used together to develop the LWIP protocol. An IP tunnels is created using a VirtualNetDevice that wraps UDP packets with new IP headers. The significance of different technologies used together in Figure \ref{fig8} is explained as follows.
First, any traffic generated from the remote host to the UE attempts to follow the direct path. However, if the downlink traffic is to be forwarded to the Wi-Fi network, a secure tunnel is used to funnel the data to the LWIP UE (i.e. the Wi-Fi station).
The details of modifications within PDCP classes and the interconnection between different classes is highlighted in Figure \ref{fig9a}.
\begin{figure}[htb]
\centering
\includegraphics[width=1\textwidth]{FlowgraphLWIP1.pdf}
\caption{Activity diagram of LWIP implementations in NS-3.}
\label{fig9a}
\end{figure}
This flowgraph provides a detailed description and the subsequent flow of packets over the new network nodes/modules added to connect LTE and Wi-Fi networks through the IP tunnel (the parts highlighted as NS-3 additions in Figure \ref{fig8}).
The implementation of the hybrid nature of the LWIP architecture is explained as follows;
\begin{enumerate}[(1)]
\item \textit{Packet generation at remote host and transfer to PDCP layer}
An OnOff/PacketSink application (that mimics a Voice Over IP traffic flow) is used to transfer a burst of UDP packets over a Client/Server configuration from the remote host to the LTE UE. The Ipv4StaticRoutingHelper class is used to create a static routing table to create a connection from the remote host to the UE through eNB. The sequence number of generated packet is attached with the packet as header. As mentioned above, $SeqTsHeader$ is the header that contains the aforementioned information.
\item \textit{LWIP data flow differentiation}
In order to inform the PDCP layer of the eNB about the activation or deactivation of LWIP, a new attribute is added. This attribute is called lwipactivate.
At the PDCP layer, the new attribute is defined as,
\begin{lstlisting}[numbers=left, breaklines=true]
.AddAttribute ("PDCPDecLwip",
"PDCP LWIP decision variable",
UintegerValue (0),
MakeUintegerAccessor (&LtePdcp::pdcp_decisionlwip),
MakeUintegerChecker<uint32_t>())
\end{lstlisting}
This variable $pdcp$$\_$$decision$ is used to activate and deactivate the LWIP connection. The following table enlists different values of $pdcp$$\_$$decision$ and the corresponding stages.
\begin{table}[H]
\centering
\begin{tabular}{|c|c|}
\hline
Value assigned & State \\ \hline
0 & LWIP deactivated (LTE only) \\ \hline
1 & LWIP activated (Wi-Fi only) \\ \hline
\end{tabular}
\end{table}
At the start of the simulation, the Config::SetDefault method is used to override the initial (default) value of the PDCPDecLwip attribute. This change in value is achieved by the following code,
\begin{lstlisting}[numbers=left, breaklines=true]
Config::SetDefault ("ns3::LtePdcp::PDCPDecLwip", UintegerValue(lwipactivate));
\end{lstlisting}
As described in Figure \ref{fig9a}, the first stage of the flowgraph is used to take a decision about the activation of LWIP. If LWIP is not activated by setting $pdcp$$\_$$decision$, the received packet is passed to the $TransmitPdcpPdu$ function so that it could be forwarded to the RLC layer.
\item\textit{RBID and LWA activation status tags}
Similar to LWA, when $pdcp\_decision$ variable is assigned a value corresponding to LWIP activate, all packets are tagged with the corresponding RBID and LWIP status information before being en-queued for transmission from LWIPEP node. The LCIDtag defined for LWA is reused. However, for LWIP status, a new tag (called LWIPTag) is defined. This procedure is represented by the entity ”Add LWIPTag and RBIDTag” in Figure 10.
\item \textit{Flow control in LTE PDCP layer}
Packets upon arriving at the PDCP layer with $pdcp$$\_$$decision$ variable assigned a value corresponding to LWIP activate, are tagged and are en-queued for transmission over the Wi-Fi Infrastructure.
In order to allow in-sequence delivery of frames at the LWA UE upper layers, each packet arriving at the PDCP layer of eNB is already assigned a sequence number. This number is embedded within a 12 bytes SeqTsHeader.
In order to extract the LWIP tagged frames from the PDCP layer, the same approach followed in step 4 of Section \ref{Methodology to create LWA} was used.
\item \textit{Packet generation to LWIPEP entity}
Step 5 of Section \ref{Methodology to create LWA} was reused to immediately transferred available packets to the LWIPEPnode.
\item \textit{Packet formulation by LWIPEP and transmission to SeGW link}
As mentioned in Section \ref{Overview of LWIP architecture}, the responsibility of LWIPEP module is to generate user plane data along with the bearer identification. Similar to LWA mechanism, RBID and lwip activate information is first extracted from tags and then added as header with the packet to be transmitted over the $Xw$ interface. A new 2 byte header named $LwipHeader$ is defined (similar to $LWAHeader$) that contains lwip activate and bearer ID information. This stage is represented by LWIPEP entity in Figure \ref{fig9a}.
In the next phase, the packet is transferred to the SeGW from LWIPEPnode for transmission over the IPSec tunnel.
\item \textit{Data forward from SeGW to Wi-Fi station through IP tunnel}
To create an IP tunnel, extra interfaces (virtual interfaces) were installed over the SeGW link and the Wi-Fi station (i.e. an interface with a new address set to 11.0.0.1 was installed over the P2P link and the interface with address 11.0.0.254 was installed over the Wi-Fi station). Thus, the flow of packets would be between 11.0.0.x (i.e. the tunnel) instead of the actual IP addresses (10.0.x.y for P2P and 192.168.x.y for the Wi-Fi network). The use of VirtualNetDevice at the SeGW represents a contact point towards external Wi-Fi network. This is the point where the secured IPSec tunnel is initiated. A tunnel class is created that utilizes callback functions to create virtual UDP source and destination sockets over the VirtualNetDevice. These sockets are used to transmit the IP encapsulated LWIP from SeGW to Wi-Fi station.
The $Xw$ interface defined for LWA is used to provide a connection between SeGW and Wi-Fi AP.
\item \textit{Packet reception at Wi-Fi station}
The packet received at the destinatio at the Wi-Fi station include the $SeqTsHeader$ and the $LwipHeader$ headers. The $lwaactivate$ status, RBID information (i.e. bearer ID) and sequence number of the received packet can be extracted by using the following code.
\begin{lstlisting}[numbers=left, breaklines=true]
m_currentPacket->RemoveHeader (lwip);
lwipactivate=lwip.GetLwaActivate();
bearerid=lwip.GetBearerId();
m_currentPacket->RemoveHeader (seqTsx);
currentSequenceNumber = seqTsx.GetSeq ();
\end{lstlisting}
This information can be used to aggregate packets at the application layer of the UE.
\end{enumerate}
With the help of Table~\ref{tab:3}, a comparison between implemented functions of LWA in Ns-3 with 3GPP standard is provided. As highlighted in the table, most of the specifications of LWIP provided by 3GPP release 13 were implemented in NS-3. Activation and deactivation of LWIP mechanism was controlled by the eNB. Due to the problem of non-existing IP stack at the eNB, the splitting of IP packets was performed at the PDCP layer. The $pdcp\_decisionlwip$ variable enabled the NS-3 implementation to support switched bearer functionality. Since the implementation did not include a method to aggregate data at the IP layer, no changes were made at the NS-3 LTE UE. As mentioned in Section \ref{Assumptions for LWIP}, it was assumed that an ideal control plane ($Xw$-$C$) was available between SeGW and Wi-Fi AP. Therefore, the details of WLAN measurements, support for establishment, modification and error handling mechanism were not considered within this implementation. Although LWIP can be configured to deliver both uplink and downlink data over the WLAN, we focused our study on the implementation particularly for downlink communication.
\begin{table}[tb]
\caption{\chg{NS-3 LWIP implementation compared with 3GPP standard.}}
\label{tab:3}
\centering
{
\scalebox{0.9}{
\begin{tabular}{|>{\centering\arraybackslash}p{6cm}|>{\centering\arraybackslash}p{3cm}|>{\centering\arraybackslash}p{3cm}|}
\hline
\parbox[c][5ex]{5ex}{\centering}\bf{Attributes}&\bf{NS-3 LWIP}&\bf{3GPP standard LWIP}\\ \hline
\parbox[c][4ex]{4ex}{\centering}eNB control&Yes&Yes \\\hline
\parbox[c][4ex]{4ex}{\centering}Connecting layers&PDCP&IP (PDCP SDU) \\\hline
\parbox[c][4ex]{4ex}{\centering}Offloading granularity&Switched Bearer &Switched Bearer\\\hline
\parbox[c][4ex]{4ex}{\centering}Upgrade in LTE network&eNB&eNB\\\hline
\parbox[c][4ex]{4ex}{\centering}Aggregating flows at UE IP&No&Yes\\\hline
\parbox[c][4ex]{4ex}{\centering}New network entities in LTE&LWIPEP and SeGW&LWIPEP and SeGW\\\hline
\parbox[c][4ex]{4ex}{\centering}New network nodes in Wi-Fi&None&None\\\hline
\parbox[c][4ex]{4ex}{\centering}WLAN measurements&No&Yes\\\hline
\parbox[c][4ex]{4ex}{\centering}WLAN security&No&WLAN native 802.1x EAP/AKA with fast authentication method\\\hline
\parbox[c][4ex]{4ex}{\centering}Regular Wi-Fi services on the same hardware&Yes&Yes\\\hline
\parbox[c][4ex]{4ex}{\centering}WLAN traffic direction&Downlink&Downlink plus uplink\\\hline
\end{tabular}
}}
\end{table}
\section{Results of LWA and LWIP for single instance of NS-3 simulation}\label{results}
In this section, we describe some of the results for the LWA and LWIP implementation for the case when all entities reside in a single instance of NS-3 simulation. Figure \ref{sinin} describes the aforementioned scenario.
\begin{figure}[H]
\centering
\includegraphics[width=.4\textwidth]{ns3sin.pdf}
\caption{Single instance of NS-3.}
\label{sinin}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=0.8\textwidth]{NoLWALWIP.jpg}
\caption{LWA and LWIP deactivated.}
\label{fig10}
\end{figure}
A single VoIP application with data rate of 64 Kbps and packet size of 600 bytes was initiated from the remote host to the UE. The application is run in saturation conditions for 4.825 seconds. We start by first showing the case when both LWA and LWIP techniques are deactivated.
Figure \ref{fig10} shows the FlowMonitor output of the aforementioned case. The packet length received with IP and UDP header is 628 bytes (i.e. 8 Bytes for UDP header and 20 Bytes for IP header).
\subsection{LWA NS-3 Implementation}
Figure \ref{fig11} shows the flow monitor results when half of the VoIP flow is diverted to the Wi-Fi network and the other half follows directly to the UE.
\begin{figure}[H]
\centering
\includegraphics[width=0.8\textwidth]{partialLWA.jpg}
\caption{Partial LWA activated.}
\label{fig11}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=1\textwidth]{wiresharkLWA.jpg}
\caption{Glimpse of PCAP for LWA scheme.}
\label{fig12}
\end{figure}
Even though half of the packets are transferred to the Wi-Fi network, the packet length over the Wi-Fi network increases to 658 bytes. This is because packets are copied at the PDCP layer which contains 30 bytes of PDCP and RRC header. Figure \ref{fig12} shows the PCAP over the Wi-Fi channel. Packet length, in this case is 740, which includes the 82 bytes of Wi-Fi headers and 28 bytes of the IP/UDP header.
\subsection{LWIP NS-3 Implementation}
For LWIP implementation, we consider the complete transfer of packets from LTE to the Wi-Fi network (no traffic splitting is considered as defined by the 3GPP). Figure \ref{fig13} indicates the flow monitor results for the aforementioned case. These results correspond to the packets received at the IP layer of the LWIP Wi-Fi station. Thus, the packet size is similar to LWA flow monitor results (i.e. 658 bytes) and it only contains the additional UDP/IP header. As shown in Figure \ref{fig8}, the VirtualNetDevice in installed on Wi-Fi station below the UDP and IP layer, the packet size does not include the additions due to virtual net devices.
\begin{figure}[tb]
\centering
\includegraphics[width=0.8\textwidth]{fulllwip.jpg}
\caption{LWIP activated.}
\label{fig13}
\end{figure}
However, the PCAP results shown in Figure \ref{fig14} indicate an increase of 28 bytes when compared with LWA PCAP. This corresponds to the additional UDP and IP header used to create the tunnel.
\begin{figure}[htb]
\centering
\includegraphics[width=1\textwidth]{wiresharkLWIP.jpg}
\caption{Glimpse of PCAP for LWIP scheme.}
\label{fig14}
\end{figure}
\section{Results of LWA for two instance of NS-3 simulation}
\label{Results of LWA and LWIP for two instance of NS-3 simulation}
As described in \ref{Methodology to create LWA}, the downlink flow of packets from LWAAPnode to Wi-Fi station is achieved with the creation of source destination socket. This source and destination sockets could also be replaced with Linux socket, so as to enable to separate NS-3 instances to communicate with each other. Figure \ref{twoin} describes the details of the aforementioned scenario. Lte EPC model along with Wi-Fi AP and the modification to enable LWA and LWIP are placed in first instance of NS-3 and the second instance of NS-3 contains the Wi-Fi station. The source socket is created in Xwnodes and destination socket is placed at Wi-Fi station.
\begin{figure}[H]
\centering
\includegraphics[width=.4\textwidth]{ns3two.pdf}
\caption{Two instance of NS-3.}
\label{twoin}
\end{figure}
\subsection{Partial LWA results}
In the section, we present results for th case when LWA is partially activated. Figure \ref{partenbap} represents the results for first instance of NS-3 and indicates that half of the packet are transmitted to the LTE UE.
\begin{figure}[H]
\centering
\includegraphics[width=0.8\textwidth]{PartialLWAEnBAP.jpg}
\caption{Results for first instance of NS-3 for partial LWA.}
\label{partenbap}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=0.8\textwidth]{PartialLWASta.jpg}
\caption{Results for second instance of NS-3 for partial LWA.}
\label{partensta}
\end{figure}
Figure \ref{partensta} shows that half of the packets are passed through LWAAPnode to Wi-Fi stations. It is pertinent to highlight here that the $SeqTsHeader$ header is used to extract the sequence number of packet received by the Wi-Fi station. Also, $LwaHeader$ header is used to gain information regarding bearer id and status of LWA procedure.
\section{Conclusions}\label{conclusions}
In this article, we present the design details of our implementation of LTE-WLAN offloading techniques (i.e. LWA and LWIP) proposed in release 13 by 3GPP. We provide details of the two techniques and describe the building blocks used to implement them in NS-3. We provide a step-by-step description of different aspects of the implementation. Through results, we showcase the viability of the implementation. The main difference between the LWA and LWIP implementation are as follows: 1) In LWA technique, flow can be simultaneously transmitted in both the LTE or WLAN link. This feature can allow a UE to enjoy the aggregated bandwidth of LTE and Wi-Fi. However, the in-sequence delivery of packets requires extra complexity at both the eNB and the UE, where packets are tagged for each path. 2) While LWIP provides secure means of data delivery and provides universal solution which can work with any Wi-Fi node, it increases the bandwidth constraints of the network. Also, complete use of either LTE or Wi-Fi path makes this technique less flexible to be used by the UE.
\bibliographystyle{abbrv}
| {'timestamp': '2019-01-14T02:22:15', 'yymm': '1901', 'arxiv_id': '1901.03683', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03683'} | arxiv |
\section{Introduction}
\label{sec:intro}
Pearson's correlation coefficient is a measure indicating how well one can
approximate (estimate in an average least squares sense) a (response) random variable $Y$ as a linear (more precisely affine) function of a (predictor/observed) random variable $X$, i.e., as $Y=aX+b$.\footnote{We assume that the random variables $X$ and $Y$ have finite variance.}
The coefficient is given by
\begin{align}
\rho(X \leftrightarrow Y)=\frac{\rm{Cov}(X,Y)}{\sqrt{\ensuremath{\textrm{var}}(X)} \sqrt{ \ensuremath{\textrm{var}}(Y)}}.
\end{align}
The coefficient is symmetric in $X$ and $Y$ so it just as well measures how well one can approximate $X$ as a linear function of $Y$.
The correlation ratio of $Y$ on $X$, also suggested by Pearson (see, e.g., \cite{cramer2016mathematical}), similarly measures how well one can approximate $Y$ as a general admissible function of $X$, i.e., as $Y=f(X)$.\footnote{We define a function $f(\cdot)$ to be admissible w.r.t. the random variable $X$ if it is a Borel-measurable real-valued functions such that
$\mathbb{E}[f(X)]=0$ and it has finite and positive variance.}
Specifically, the correlation ratio of $Y$ on $X$ is given by
\begin{align}
\theta(X \rightarrow Y)
& =\sqrt{\frac{\ensuremath{\textrm{var}}(\mathbb{E}[Y|X])}{\ensuremath{\textrm{var}}(Y)}}
\label{eq:corrRatioEq1}
\\
&=\sqrt{1-\frac{\mathbb{E}[\ensuremath{\textrm{var}}(Y|X)]}{\ensuremath{\textrm{var}}(Y)}}. \nonumber
\end{align}
The correlation ratio can also be expressed as
\begin{align}
\theta(X \rightarrow Y)=\sup_{f}\rho(f(X) \leftrightarrow Y)
\label{eq:corr_ratio}
\end{align}
where the supremum is taken over all (admissible) functions $f$ (see, e.g., \cite{renyi1959new}).
This measure is naturally nonsymmetric.
A drawback of the correlation ratio is that it ``equals zero too easily''. Specifically, it can vanish even where the variables are dependent.
We note that one may equivalently say that the correlation ratio measures how well one can approximate
$Y$ as $Y=aX'+b$ for some admissible transformation of the random variable $X'=f(X)$. While perhaps seeming superfluous at this point, this view will prove useful when considering different generalizations of the correlation ratio to the case where the observations are a random vector.
The Hirschfeld-Gebelein-R\'enyi maximal correlation coefficient \cite{hirschfeld1935connection,gebelein1941statistische,renyi1959measures} measures the maximal (Pearson) correlation that can be attained by transforming the pair $X,Y$ into random variables $X'=g(X)$ and $Y'=f(Y)$; that is, how well $X'=aY'+b$ holds in a mean squared error sense for some pair of functions $f$ and $g$. More precisely, the maximum correlation coefficient is defined as the supremum over all (admissible) functions $f,g$ of the correlation between $f(X)$ and $g(Y)$:
\begin{align}
\rho^{**}_{\rm max}(X \leftrightarrow Y)=\sup_{f,g}\rho(f(X) \leftrightarrow g(Y)).
\end{align}
This measure is again symmetric by definition. We use the superscript ``**'' to indicate that both functions (applied to the response and the predictor random variables) need not satisfy any restrictions beyond being admissible.
The maximal correlation coefficient has some very pleasing properties.
In particular, in \cite{renyi1959measures}, R\'enyi
put forth a set of seven axioms deemed natural to require of a measure of dependence between
a pair of random variables and established that the maximal correlation coefficient satisfies the full set of axioms. In particular, unlike the correlation ratio, the maximal correlation coefficient ``does not equal zero too easily''. Further, unlike the correlation ratio it is symmetric, which was set as one of the axioms. Nonetheless, these pleasing properties come at the price of introducing new problems as elaborated on below.
Another appealing trait of the maximal correlation coefficient, greatly contributing to its popularity, is its tight relation to
a Euclidean geometric framework and to operator theory. In particular, it is readily computable numerically via the alternating conditional expectation (ACE) algorithm of Breiman and Friedman \cite{breiman1985estimating}.
Moreover, and as recalled in the sequel, the ACE algorithm naturally extends to cover linear estimation of a (transformed) random variable from a component-wise transformed random vector.
R\'enyi's seminal work inspired substantial subsequent work aiming to identify other measures of dependence satisfying the set of axioms. We refer the reader to \cite{samuel2001correlation} for a survey of some of these.
Despite its elegance and it being amenable to computation, the maximal correlation coefficient suffers from some significant deficiencies as was recognized since its inception.
Specifically, it is well known that it ``equals one too easily''; see, e.g. \cite{hall1967characterizing}, \cite{kimeldorf1978monotone}, as well as Footnote~3 in \cite{renyi1959measures}.
In fact,
it can equal one even for two random variables that are nearly independent (as also demonstrated below).
Disconcerted by this behavior of the maximal correlation coefficient, Kimeldorf and Sampson \cite{kimeldorf1978monotone}
proposed to alter its definition,
introducing monotonicity constraints. They defined a monotone dependence measure as follows.
\vspace{-0mm}
\begin{align}
\rho^{mm}_{\rm max}(X \leftrightarrow Y)=\sup_{f,g}\rho(f(X) \leftrightarrow g(Y)),
\label{eq:MonotoneDependence}
\end{align}
where $f$ and $g$ are not only admissible but also monotone.
Nevertheless, as stated in \cite{kimeldorf1978monotone}, while the imposed constraints somewhat mitigate the ``easiness of attaining the value of one", the measure \eqref{eq:MonotoneDependence} still can equal one for a pair of random variables that are not completely dependent.
The definition of the monotone dependence measure \eqref{eq:MonotoneDependence} is unsatisfactory in two respects. The first is that is imposes
symmetric constraints on the two transformations. As the process of estimation/prediction (and more generally inference) is directional, if the goal of the dependence measure is to characterize how well one can achieve the latter tasks, there is no apparent reason to impose any restriction on the transformation applied to the observed data. In this respect,
it is worth quoting the incisive comments (in reference to \cite{ramsay1988monotone}) of Hastie and Tibshirani \cite{hastie1988monotone}:
\emph{``\ldots a monotone restriction makes sense for a response transformation because it is necessary to allow predictions of the response from the estimated model. \ldots~On the other hand, why restrict
predictor transformations (such as for displacement and weight in the city gas consumption problem) to be monotone? Instead, why not leave them unrestricted and let the data suggest the shape of the relevant transformation?"}
The second and more subtle deficiency of the monotone dependence measure of Kimeldorf and Sampson (as well as the semi-monotone variant suggested by Hastie and Tibshirani) is that when it comes to the response variable, the requirement that the transformation be monotone is not strong enough.
The goal of the present work is first to reiterate some of the known drawbacks of both the correlation ratio and of the maximal correlation coefficient, and then to suggest a possible resolution.
In particular, we demonstrate
that while allowing a transformation to be applied to the response variable is important, it is not sufficient to require that it be monotonic.
Rather, one must strengthen the required ``degree'' of monotonicity.
Specifically, we introduce the notion of $\kappa$-monotonicity and argue in favor of constraining (only) the transformation applied to the response random variable to be $\kappa$-monotonic, leading to a proposed semi-$\kappa$-monotone maximal correlation measure.
The parameter $\kappa$ dictates a minimal and maximal slope that the function applied to the response variable must maintain.
We show that requiring that $0<\kappa<1$ yields a measure that does not suffer from the drawbacks of neither the maximal correlation coefficient nor from those of the correlation ratio.
The proposed measure satisfies a set of modified R\'enyi axioms that does not sacrifice the natural requirements of capturing {\em both} independence and complete dependence.
It is important to note that setting $\kappa=0$ amounts to requiring merely monotonicity, as already suggested in \cite{hastie1988monotone}, without imposing a minimal (or maximal) positive slope. Setting $\kappa=1$, on the other hand, the semi-$\kappa$-monotone maximal correlation measure reduces to the correlation ratio. This implies that while both of these choices are not sufficient to satisfy the proposed set of modified R\'enyi axioms, they lie right on the boundary of the set of values that do. Thus, in a sense, these choices may be considered satisfactory if we rule out ``pathological'' examples. The same \emph{cannot} be said of the maximal correlation coefficient. These points are illustrated in Section~\ref{sec:numericalExample}.
Finally, as the usefulness of the maximal correlation coefficient is due in part to it being readily computable, we suggest modifications to the ACE algorithm and exemplify the resulting performance via several examples.
The rest of the paper is organized as follows. Section~\ref{sec:short} describes the shortcomings of the correlation ratio and maximal correlation coefficient as well as presents the proposed dependence measure. Section~\ref{sec:mod_ren}
puts forth a set of modified R\'enyi axioms, outlining the main steps involved in proving that the proposed measure satisfies the latter. Section~\ref{sec:modifiedAce} provides some modifications to the ACE algorithm, enforcing monotonicity constraints. Finally, several numerical examples illustaring the main ideas are given in Section~\ref{sec:numericalExample}.
\section{Shortcomings of the Correlation Ratio and Maximal Correlation Coefficient and a Proposed Resolution}
\label{sec:short}
As a simple example, consider two (sequences of) random variables that share only the least significant bit:
\begin{align}
X^{(N)} &=C +\sum_{i=1}^N A_i 2^i \nonumber \\
Y^{(N)} &=C +\sum_{i=1}^N B_i 2^i,
\label{eq:example0}
\end{align}
where ${A_i},{B_i},C$ are mutually independent random variables, all taking the values $0$ or $1$ with equal probability.
Clearly, applying modulo $2$ to both variables yields
a correlation of one.
This seems quite unsatisfactory if our goal is estimation subject to any reasonable distortion metric as the two random variables become virtually independent as $N$ grows. Specifically, the pair $(X^{(N)}/2^N,Y^{(N)}/2^N)$ converges in distribution to a uniform distribution over the unit square.
\begin{remark}
It should be noted in this respect that the maximal correlation coefficient is a good measure for a different goal. It quantifies to what extent two random variables share any common ``features".
\end{remark}
\begin{remark}[Discrete random variables]
While the emphasis in this paper is on continuous random variables, symmetric measures are also generally not appropriate for measuring the dependence between discrete random variables.
For instance, a natural measure in this case is the minimal possible probability of error when predicting one from the other.
Clearly, this measure is also not symmetric.
While minimum error probability is related via universal lower and upper bounds to the conditional entropy and mutual information (the latter being a symmetric measure), as shown in \cite{tebbe1968uncertainty} (Equations 5 and 6), the gap between the lower and upper bounds (keeping the probability of error fixed) grows unbounded with the cardinality of the random variables.
This is yet another indication that symmetric measures are ill-suited for estimation/prediction purposes.
\end{remark}
A natural and quite satisfying measure of directional dependence between random variables, that takes the value of one only when the response variable is a function of the predictor variable, is the correlation ratio defined in \eqref{eq:corrRatioEq1}.
While R\'enyi objected to the correlation ratio due to its asymmetric nature, as was noted in \cite{hall1967characterizing}, when our goal is asymmetric (i.e., estimating $Y$ from $X$), there is no reason for requiring that the measure be symmetric.
Nonetheless, in some cases one does not have strong grounds to assume a particular ``parameterization" of the desired (response) random variable. Thus, not allowing to apply any transformation to the response variable, as is the case of the correlation ratio, may be too restrictive.
In other words, in the absence of a preferred ``natural" parameterization of the response variable, one may consider choosing a strictly monotone transformation (change of variables) so as to make it easier to estimate.
A more severe drawback of the correlation ratio is that it vanishes too easily, i.e., it can be zero for two dependent random variables.
In light of these considerations, we propose the following modification to the definition of the maximal correlation coefficient.
\begin{definition}
\label{def:eps_increasing}
For $0 \leq \kappa \leq 1$, a function $f$ is said to be $\kappa$-increasing, if for all $x_2 \geq x_1$
\begin{align*}
f(x_2)-f(x_1) & \geq \kappa(x_2-x_1) \, , \nonumber \\
f(x_2)-f(x_1) & \leq \frac{1}{\kappa}(x_2-x_1).
\end{align*}
\vspace{-1mm}
\end{definition}
\begin{definition}
\label{def:semiMonotoneMeasure}
For a given $0<\kappa<1$, the semi-$\kappa$-monotone maximal correlation measure is defined as
\begin{align*}
\rho^{*m_{\kappa}}_{\rm max}(X\rightarrow Y)=\sup_{f,g}\rho(f(X)\leftrightarrow g(Y) )
\end{align*}
where and the supremum is taken over all admissible functions $f$, and over $\kappa$-increasing admissible functions $g$.
\end{definition}
\begin{remark}
Limiting $g$ to be $\kappa$-increasing implies that, in particular, it is invertible, which is a natural requirement. Moreover, the set of $\kappa$-increasing admissible functions is closed.
We further note that the value of $\kappa$ controls how far the measure can deviate from the correlation ratio.
\end{remark}
\subsection{The vector observation case}
Let $\svv{X}=(X_1,\ldots,X_p)$ be a vector of predictor variables.
The maximal correlation coefficient becomes
\begin{align}
\rho^{**}_{\rm max}( \svv{X} \leftrightarrow Y)=\sup_{f,g}\rho(f(\svv{X}) \leftrightarrow g(Y))
\end{align}
where the supremum is over all admissible functions.
Following Breiman and Friedman \cite{breiman1985estimating}, we may also consider a simplified (quasi-additive) relationship between $Y$ and $\svv{X}$
where we seek an optimal linear regression between a transformation of $Y$ and a component-wise non-linear transformation of the predictor random vector $\svv{X}$. Denote the fraction of the variance not explained by a regression of $f(Y)$ on $\sum_i f_i(X_i)$ as
\begin{align}
e^2(g,f_1,\ldots,f_p)=\frac{\mathbb{E}\left[\left(g(Y)-\sum_i f_i(X_i)\right)^2\right]}{\mathbb{E} [g(Y)^2]}
\end{align}
where zero-mean functions are assumed.
In \cite{breiman1985estimating}, conditions for the existence of optimal transformations $\{f_i\},g$ such that the supremum is attained are given, and it is shown that under these conditions the ACE algorithm converges to the optimal transformations.
Going back to the rationale for requiring $\kappa$-monotonicity, one may object to the example \eqref{eq:example0} as being artificial and argue that the maximum correlation coefficient merely captures whatever dependence there is between the random variables. In this respect, it is worthwhile quoting Breiman \cite{breiman1988monotone} (commenting on \cite{ramsay1988monotone}):
\emph{``I only know of infrequent cases in which I would
insist on monotone transformations. Finding non-monotonicity can lead to interesting scientific discoveries. If the appropriate transformation is monotone,
then the fitted spline functions (or ACE transformations) will produce close to a monotonic transformation. So it is hard to see what there is to gain in the
imposition of monotonicity.''}
We now demonstrate that the problematic nature of the maximal correlation coefficient becomes more pronounced when considering the multi-variate case and so does the necessity of restricting the transformation of the response variable (only) to be
monotone.
Specifically, let us consider again the example of \eqref{eq:example0}.
Suppose that $Y$ and $X$ are as defined but that in addition to $X$, there is another slightly noisy observation of $Y$, say $\tilde{X}=Y+Z$ where the variance of $Z$ is small with respect to that of $Y$. Clearly, the maximal correlation coefficient will still equal $1$, and the observation $\tilde{X}$ will be discarded even though it could have allowed to estimate $Y$ with small distortion.
Thus, in this example, the maximal correlation coefficient is maximized by perfectly estimating the least significant bit while doing away with the more significant bits even though nearly distortionless reconstruction is possible.
See also Section~\ref{sec:numericalExample} below for a numerical
example.
\section{modified R\'enyi axioms}
\label{sec:mod_ren}
We follow the approach of Hall \cite{hall1967characterizing} in defining an asymmetric variant of the R\'enyi axioms; more precisely, we adopt a slight variation on the somewhat stronger version formulated by Li \cite{li2016true}. However, unlike both of these works, when it comes to putting forward a candidate dependence measure satisfying the modified axioms, we adhere to a mean square error methodology.
Assume $r(X\rightarrow Y)$ is to measure the degree of dependence of $Y$ on $X$. Then we require that it satisfy the following:
\begin{enumerate}[label=(\alph*)]
\item \mbox{$r(X\rightarrow Y)$} is defined for all non-constant random variables $X,Y$ having finite variance.\footnote{In \cite{li2016true}, the first axiom only requires that $r(X\rightarrow Y)$ be defined for \emph{continuous} random variables $X,Y$.
}
\item $r(X\rightarrow Y)$ may not be equal to $r(Y\rightarrow X)$.
\item $0\leq r(X\rightarrow Y)\leq 1$.
\item $r(X\rightarrow Y)=0$ if and only if $X,Y$ are independent.
\item $r(X\rightarrow Y)=1$ if and only if $Y=f(X)$ almost surely for some admissible function $f$.
\item If $f$ is an admissible bijection on $\mathbb{R}$, then $r(f(X)\rightarrow Y)=r(X\rightarrow Y)$
\item If $X,Y$ are jointly normal with correlation coefficient $\rho$, then $r(X\rightarrow Y)=|\rho|$.\footnote{In \cite{li2016true}, the last axiom only requires that if $X,Y$ are jointly normal with correlation coefficient $\rho$, $r(X\rightarrow Y)$ is a strictly
increasing function of $|\rho|$.}
\end{enumerate}
\begin{remark}
We note that the correlation ratio, defined in \eqref{eq:corr_ratio}, satisfies all of the modified axioms except for the ``only if'' part of axiom (d).
\end{remark}
We next observe that for absolutely continuous (or discrete) distributions, the
semi-$\kappa$-monotone maximal correlation measure of Definition~\ref{def:semiMonotoneMeasure}
satisfies the proposed axioms.
It is readily verified that axioms (a), (b) and (c) hold.
To show that axiom (d) holds, we note that if $X,Y$ are independent, then obviously \mbox{$\rho^{*m_{\kappa}}_{\rm max}(X\rightarrow Y)=0$}, as so is even \mbox{$\rho^{**}_{\rm max}(X\leftrightarrow Y)$}. As for the other direction, we first note that it suffices to consider the case where the correlation ratio equals $0$ and $X,Y$ are dependent. Since the correlation ratio is $0$, it follows
from \eqref{eq:corrRatioEq1} that $\mathbb{E}[Y|X] \equiv const$ (in the mean square sense), i.e.,
\begin{align}
\int p(y|x)y dy={\rm const}.
\end{align}
We may break the symmetry of $g(y)=y$ by defining, e.g.,
\begin{align}
g_{a,\kappa}(y)=\begin{cases}
y~~~y\geq a \\
\kappa y~~y<a
\end{cases}.
\label{eq:g_a_k}
\end{align}
Consider two values of $x_1$ and $x_2$ for which
the functions $p(y|x_i)$ are not identical (as functions of $y$), as must exist by the assumption of dependence.
Let $a$ be a value such that
\begin{align}
\int^a p(y|x_1)ydy \neq \int^a p(y|x_2)ydy.
\end{align}
Without loss of generality, we may assume that the left hand side is smaller than the right hand side (we may rename $x_1$ and $x_2$).
Recalling that $\kappa<1$, it follows that
\begin{align}
\int p(y|x_1)g_a(y)dy > \int p(y|x_2)g_a(y)dy
\end{align}
Thus,
$$\mathbb{E}[g_a(Y)|X=x_1] \neq \mathbb{E}[g_a(Y)|X=x_2]$$
and hence the correlation ratio of $Y'=g_a(Y)$ on $X$ is non-zero, giving a lower bound to the semi-$\kappa$-monotone maximal correlation measure between $Y$ and $X$. Note that~\eqref{eq:g_a_k} imposes only a lower bound on the slope of the function applied to the response variable.
To show that axiom (e) holds, we note that by definition, if $Y=f(X)$ (almost surely), then $\rho^{*m_{\kappa}}_{\rm max}(X\rightarrow Y)=1$. To show that the opposite direction holds, we first note that it can be shown that the supremum in \eqref{def:semiMonotoneMeasure} is attained.
Recalling that if $\rho^{*m_{\kappa}}_{\rm max}(X\rightarrow Y)=1$, then by the properties of Pearson's correlation coefficient, there is a \emph{perfect} linear regression between $g(Y)$ and $f'(X)$ ($g,f'$ being maximizing functions of the measure).
Now, it can be shown that the supremum
Hence, we have $g(Y)=af'(X)+b$ where $g$ is an increasing function with slope greater than $\kappa$.
Since $\kappa$ is strictly positive, it follows that not only is $g$ invertible, but also $g^{-1}(Y)$ has finite variance (since the slope of $g^{-1}(Y)$ is at most $\frac{1}{\kappa}$ and $Y$ has finite variance). Therefore we have $Y=g^{-1}(af'(X)+b)$. Denoting $f(X)=g^{-1}(af'(X)+b)$, we note that if $f'$ is admissible, then so is $f$
Axiom (f) trivially holds.
To show that axiom (g) holds, we recall that it is well known that when $X,Y$ are jointly normal with correlation coefficient $\rho$, then \mbox{$\rho^{**}_{\rm max}(X\leftrightarrow Y)=|\rho|$} (see, e.g., \cite{lancaster1957some} and \cite{yu2008maximal}). Since this implies that the maximal correlation is achieved taking $g(y)=y$ (i.e., a monotone function) and $f(x)=x$ or $f(x)=-x$, it follows that
\begin{align}
\rho^{*m_{\kappa}}_{\rm max}(X\rightarrow Y)&=\rho^{**}_{\rm max}(X\leftrightarrow Y) \nonumber \\
&=|\rho|.
\end{align}
We note that the restriction $0 < \kappa < 1$ is necessary. Specifically, for $\kappa=1$, axiom (d) is not satisfied whereas for $\kappa=0$, axiom (e) is not satisfied.
Finally, we note that one may define other dependence measures satisfying modified R\'enyi axioms, most notably via the theory of copulas (which is inherently related to monotone constraints); e.g., a symmetric measure is given in \cite{schweizer1981nonparametric} and a directional one is given in \cite{li2016true}.
Nonetheless, we believe that the proposed
measure has the advantage of being closely tied to linear regression methods and geometric considerations.
\section{Modified ACE Algorithm}
\label{sec:modifiedAce}
We begin by presenting a modification of the ACE algorithm with the goal of computing
the semi-$0$-monotone maximal correlation measure $\rho^{*m_{0}}_{\rm max}(X\rightarrow Y)$,
restricting the function applied to the response variable only to be weakly monotone.
As we do not know of a simple means to enforce the slope constraints, we do not have an algorithm for computing the semi-$\kappa$-monotone maximal correlation measure. Instead, we have employed a regularized version of the original ACE algorithm as described in Section~\ref{sec:reglar}.
\subsection{Evaluating the semi-$0$-monotone maximal correlation measure}
\label{sec:modACE}
We now present a modification of the ACE algorithm to compute
the semi-$0$-monotone maximal correlation measure $\rho^{*m_{0}}_{\rm max}(X\rightarrow Y)$ for the case of single predictor variable. It is readily seen that the correlation increases in each iteration of the algorithm and thus converges but we do not pursue proving optimality.
We then generalize the algorithm to the quasi-additive multi-variate scenario.
Following in the footsteps of
\cite{breiman1985estimating}, recall that the space of all random variables with finite variance is a Hilbert space, which we denote by $\mathcal{H}_2$, with the usual definition of the inner product \mbox{$<X,Y>=\mathbb{E}[X Y]$}, for $X,Y\in\mathcal{H}_2$.
We may further define the subspace $\mathcal{H}_2(X)$ as the set of all random variables that correspond to an admissible function of $X$. We similarly define the subspace $\mathcal{H}_2(Y)$.
Now, if we further limit the functions applied to $Y$ to be non-decreasing,
we obtain a closed and convex subset of the Hilbert space $\mathcal{H}_2(Y)$. We denote this set by $\mathcal{M}_{0}(Y)$.
Denoting by $P_{\mathcal{A}}(Y)$ the orthogonal projection of $Y$ onto the closed convex set $\mathcal{A}$,\footnote{Note that $\mathcal{P}_{\mathcal{H}_2(X)}\left(g(Y)\right)=\mathbb{E}\left[ g(Y)\given X \right]$.} the modified ACE algorithm is described in Algorithm~\ref{Alg:ACE_Semi_0_mono_Single_Predictor} for the case of single predictor variable.
\begin{algorithm}
\caption{}\label{Alg:ACE_Semi_0_mono_Single_Predictor}
\begin{algorithmic}[1]
\Procedure{Calculate-Semi-$0$-monotone}{}
\State Set $g(Y)=Y/\|Y\|$;
\While{$e^2(g,f)$ decreases}
\State $f'(X)=\mathcal{P}_{\mathcal{H}_2(X)}\left(g(Y)\right)$
\State replace $f(X)$ with $f'(X)$
\State $g'(Y)=\mathcal{P}_{\mathcal{M}_{0}(Y)}\left(f(X)\right)$
\State replace $g(Y)$ with $g'(Y)/\|g'(Y)\|$
\EndWhile
\State End modified ACE
\EndProcedure
\end{algorithmic}
\end{algorithm}
In the case of a multi-variate predictor, the original ACE algorithm seeks an optimal linear regression between a transformation of $Y$ and a component-wise non-linear transformation of the predictor random vector $\bf{X}$. The latter transformations are defined by a set of admissible functions $f_1,\ldots,f_p$, each function operating on the corresponding random variable, yielding an estimator of the form $\sum_i f_i(X_i)$.
Therefore Algorithm~\ref{Alg:ACE_Semi_0_mono_Single_Predictor} becomes
\begin{algorithm}
\caption{}\label{Alg:ACE_Semi_0_mono_Multi_Predictor}
\begin{algorithmic}[1]
\Procedure{Calculate-Semi-$0$-monotone}{}
\State Set $g(Y)=Y/\|Y\|$ and $f_1(x_1),\cdots,f_p(x_p)=0$;
\While{$e^2(g,f_1,\ldots,f_p)$ decreases}
\While{$e^2(g,f_1,\ldots,f_p)$ decreases}
\For{\texttt{$k=1$ to $p$}}
\State $f'_{k}(X_k)=$ \newline
\hspace*{6em} $\mathcal{P}_{\mathcal{H}_2(X_k)}\left(g(Y)-\sum_{i\neq k}f_{i}(X_i)\right)$
\State replace $f_k(X_k)$ with $f'_{k}(X_k)$
\EndFor
\EndWhile
\State $g'(Y)=\mathcal{P}_{\mathcal{M_{0}}(Y)}(Y)\left(\sum_i f_{i}(X_i) \right)$
\State replace $g(Y)$ with $g'(Y)/\|g'(Y)\|$
\EndWhile
\State End modified ACE
\EndProcedure
\end{algorithmic}
\end{algorithm}
\subsection{Regularized ACE algorithm}
\label{sec:reglar}
We may enforce that the transformation $g$ be
$\kappa$-monotone by applying the following regularization. Given a monotone transformation $g$ (e.g., the outcome of Algorithm~1), do:\footnote{Note that this method of regularization actually forces the slope to be between $\kappa$ and $1/\kappa+\kappa$.
}
\begin{align*}
g'(Y)&=g^{-1}(Y)+\kappa\cdot Y \\
g(Y)&=g'^{-1}(Y)+\kappa\cdot Y
\end{align*}
\begin{algorithm}
\caption{}\label{Alg:ACE_kappa_inc_fixed_norm}
\begin{algorithmic}[1]
\Procedure{Regularized-ACE}{}
\State Set $g(Y)=Y/\|Y\|$;
\While{$e^2(g,f)$ decreases}
\State $f'(X)=\mathcal{P}_{\mathcal{H}_2(X)}\left(g(Y)\right)$
\State replace $f(X)$ with $f'(X)$
\State $g'(Y)=\mathcal{P}_{\mathcal{M}_{0}(Y)}\left(f(X)\right)$
\State replace $g(Y)$ with $g'(Y)/\|g'(Y)\|$
\EndWhile
\State Apply regularization
\State End regularized ACE
\EndProcedure
\end{algorithmic}
\end{algorithm}
A similar regularization can be applied to Algorithm~\ref{Alg:ACE_Semi_0_mono_Multi_Predictor}.
\section{Numerical examples}
\label{sec:numericalExample}
As we do not know of an efficient means to evaluate the
semi-$\kappa$-monotone maximal correlation measure for $\kappa\neq 0$, we for the most part demonstrate the advantage of the semi-$0$-monotone maximal correlation measure over the standard maximal correlation measure,
in the context of estimation of a random variable $Y$ from a random vector $\bf{X}$. We further demonstrate its potential for improvement over the correlation ratio. To that end, we compute the semi-$0$-monotone maximal correlation measure using Algorithm 1 presented in Section~\ref{sec:modifiedAce}.
We begin with a multi-variate example where one of the two observed random variables ``masks'' the other while the latter is more significant for estimation purposes. We then demonstrate why taking $\kappa=1$ is inadequate and hence the semi-$\kappa$-monotone maximal correlation measure may be advantageous with respect to the correlation ratio.
The third example illustrates why taking $\kappa=0$ is not sufficient in general, and heuristically demonstrates that Algorithm~\ref{Alg:ACE_kappa_inc_fixed_norm} yields more satisfying results.
For simulating ACE, we used the ACE Matlab code provided by the authors of \cite{voss1997reconstruction}.
To limit $g$ to be a monotonic function, we used isotonic regression.
\subsection{Example 1 - Multi-variate predictor}
Assume that the response variable $Y$ is distributed uniformly over the interval $[0,1]$ and that we have two predictor variables
\begin{align}
X_1&=\rm{mod}(Y,0.2)+N_1 \nonumber \\
X_2&=Y^3+N_2,
\label{eq:example1}
\end{align}
where $N_1,N_2$ are independent zero-mean Gaussian variables with $\sigma^2_{N_1}=0.01$ and $\sigma^2_{N_2}=0.2$.
The optimization invloved in the maximal correlation coefficient results in ``shadowing'' the more significant variable, $X_2$, for estimation purposes of the response $Y$. To see this, we start by running the ACE algorithm to evaluate the maximal correlation coefficient between $Y$ and $X_1$. As can be seen from Figure~\ref{fig:y_x1_ACE}, this results in a very high value. Inspecting the transformations yielding this result, we observe that $g$ is not monotonic and hence we cannot recover $Y$ from $g(Y)$.
\begin{figure}[htbp]
\centering
\includegraphics[width=\figSize\columnwidth]{y_x1_ACE.eps}
\caption{Example 1: Running ACE on $Y$ and $X_1$.}
\label{fig:y_x1_ACE}
\end{figure}
Next, we apply the ACE algorithm to calculate the maximal correlation coefficient between $Y$ and $X_2$. As can be seen from Figure~\ref{fig:y_x2_ACE}, this value is much smaller (than that between $Y$ and $X_1$) since in this case we have stronger additive noise. Nevertheless, the transformation applied to $Y$ is now monotonic. Therefore, even though the maximal correlation coefficient is smaller, the observation $X_2$ can better serve the purpose of estimation of $Y$.
\begin{figure}[htbp]
\centering
\includegraphics[width=\figSize\columnwidth]{y_x2_ACE.eps}
\caption{Example 1: Running ACE on $Y$ and $X_2$.}
\label{fig:y_x2_ACE}
\end{figure}
Next we apply the ACE algorithm to
$Y$ and the
vector $(X_1,X_2)$. As can be seen from Figure~\ref{fig:y_x1_x2_ACE}, the ACE algorithm, in order to maximize the correlation, chooses similar functions as in case of running only on $Y$ and $X_1$, practically choosing to ignore $X_2$. While, indeed, this maximizes the correlation coefficient, it is far from satisfying from an estimation viewpoint.
\begin{figure}[htbp]
\centering
\includegraphics[width=\figSize\columnwidth]{y_x1_x2_ACE.eps}
\caption{Example 1: Running ACE on $Y$, $X_1$ and $X_2$.}
\label{fig:y_x1_x2_ACE}
\end{figure}
As can be seen from Figure~\ref{fig:y_x1_x2_SemiMon_stric},
the resulting value of the semi-$0$-monotone maximal correlation measure is very close to the maximal correlation value between $Y$ and $X_2$. Thus, the algorithm ``chooses to ignore'' $X_1$ (even though it suffers from a lower noise level) and bases the estimation on $X_2$.
\begin{figure}[htbp]
\centering
\includegraphics[width=\figSize\columnwidth]{y_x1_x2_SemiEpsNorm.eps}
\caption{Example 1: Running modified ACE (Algorithm~\ref{Alg:ACE_Semi_0_mono_Multi_Predictor}) on $Y$, $X_1$ and $X_2$ with $\kappa=0$.}
\label{fig:y_x1_x2_SemiMon_stric}
\end{figure}
\subsection{Comparisons with the correlation ratio}
\subsubsection{Example 2a}
The proposed dependence measure can be viewed as a generalization of the correlation ratio (the correlation ratio amounts to setting $g$ to have a constant slope of $1$).
We first demonstrate how the semi-$\kappa$-monotone maximal correlation measure deals with a well-known example where the correlation ratio equals $0$ for a pair of dependent random variables. Specifically, we consider a vector $(X,Y)$ that is uniformly distributed over a circle with radius $1$. The correlation ratio is $0$ as depicted in Figure~\ref{fig:y_x_exmp4_corr_ratio} where we ran ACE enforcing $g(y)=y$.
\begin{figure}[htbp]
\centering
\includegraphics[width=\figSize\columnwidth]{y_x_exmp4_corr_ratio.eps}.
\caption{Example 2a: Optimal transformation corresponding to the correlation ratio.}
\label{fig:y_x_exmp4_corr_ratio}
\end{figure}
Applying Algorithm~\ref{Alg:ACE_Semi_0_mono_Single_Predictor} with $\kappa=0$ yields a much larger correlation. Thus, it manages to capture the dependence between $X$ and $Y$. This is depicted in Figure~\ref{fig:y_x_exmp4_semi_mono_0_1}.
\begin{figure}[htbp]
\centering
\includegraphics[width=\figSize\columnwidth]{y_x_exmp4_semi_mono_eps_Norm.eps}.
\caption{Example 2a: Running modified ACE (Algorithm~\ref{Alg:ACE_Semi_0_mono_Single_Predictor}) on $Y$ and $X_1$ with $\kappa=0$.}
\label{fig:y_x_exmp4_semi_mono_0_1}
\end{figure}
\subsubsection{Example 2b}
The next example demonstrates another potential advantage over the correlation ratio.
As was already noted, there are cases where there is no a priori preferred (natural) parameterization for the
response variable and thus choosing one that maximizes the correlation may be a reasonable approach as we now demonstrate.
Assume that the response variable $Y$ is distributed uniformly over the interval $[0,10]$ and that the predictor variable $X$ is
\begin{align}
X=\log(Y)+N,
\label{eq:example3}
\end{align}
where $N$ is a zero-mean Gaussian (and independent of $Y$) with unit variance.
Comparing the correlation ratio (Figure~\ref{fig:y_x_exmp3_Corr_Ratio}) and the results of Algorithm~\ref{Alg:ACE_Semi_0_mono_Single_Predictor} with $\kappa=0$ (Figure~\ref{fig:y_x_exmp3_semi_0_1}), reveals that the correlation of the latter is significantly higher.
\begin{figure}[htbp]
\centering
\includegraphics[width=\figSize\columnwidth]{y_x_exmp3_Corr_Ratio.eps}.
\caption{Example 2b: Optimal transformations corresponding to the correlation ratio.}
\label{fig:y_x_exmp3_Corr_Ratio}
\end{figure}
\begin{figure}[htbp]
\centering
\includegraphics[width=\figSize\columnwidth]{y_x_exmp3_semi_eps_Norm.eps}
\caption{Example 2b: Running modified ACE (Algorithm~\ref{Alg:ACE_Semi_0_mono_Single_Predictor}) on $Y$ and $X_1$ with $\kappa=0$.}
\label{fig:y_x_exmp3_semi_0_1}
\end{figure}
\subsection{Example 3 - Semi-$0$-monotonicity is insufficient}
To illustrate why it does not suffice to limit $g$ to be merely monotone, consider the following example. Assume that the response $Y$ is distributed uniformly over the interval $[-10,10]$ and that
\begin{align}
X=\begin{cases}
X=Y~~~Y>9 \\
X=N_1~~~ {\rm otherwise}
\end{cases}
\label{eq:example2}
\end{align}
where $N_1\sim {\rm Unif}([-1,1])$ and is independent of $Y$.
Limiting $g$ only to be monotone
(with no slope limitations)
results in a correlation value of $1$
since the optimal solution is to set $g(y)=0$ in the region it cannot be estimated
and $g(y)=y$ otherwise (and then apply normalization). Clearly, the function $g$ is non-invertible as is depicted in Figure~\ref{fig:y_x_exmp2_onlyMono}.
\begin{figure}[htbp]
\centering
\includegraphics[width=\figSize\columnwidth]{y_x_exmp2_onlyMono.eps}
\caption{Example 3: Running modified ACE (Algorithm~\ref{Alg:ACE_Semi_0_mono_Single_Predictor}) on $Y$, $X$ with $\kappa=0$.}
\label{fig:y_x_exmp2_onlyMono}
\end{figure}
Next, we ran Algorithm~\ref{Alg:ACE_kappa_inc_fixed_norm} - the regularized ACE algorithm, enforcing a minimal slope of $\kappa=0.1$.
The results are depicted in Figure~\ref{fig:y_x_exmp2_Mono_0_1}.
\begin{figure}[htbp]
\centering
\includegraphics[width=\figSize\columnwidth]{y_x_exmp2_Mono_0_1.eps}.
\caption{Example 3: Running regularized ACE (Algorithm~\ref{Alg:ACE_kappa_inc_fixed_norm}) on $Y$, $X$ with $\kappa=0.1$}
\label{fig:y_x_exmp2_Mono_0_1}
\end{figure}
This example sheds light on the trade-off that exists when setting the value of $\kappa$.
Setting $\kappa$ to be large
limits the possible gain over the correlation ratio whereas setting it too low
risks overemphasizing regions where the noise is weaker.
\bibliographystyle{IEEEtran}
| {'timestamp': '2019-06-04T02:19:03', 'yymm': '1901', 'arxiv_id': '1901.03590', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03590'} | arxiv |
\section{Introduction}\label{sec:introduction}}
\IEEEPARstart{R}{ecently}, \keze{estimating 3D full-body human poses from monocular RGB imagery has attracted substantial academic interests for its vast potential on human-centric applications, including human-computer interactions~\cite{errity2016human}, surveillance~\cite{held2012intelligent}, and virtual reality~\cite{zz_rheingold1991virtual}. In fact, estimating human pose from images is quite challenging with respect to large variances in human appearances, arbitrary viewpoints, invisibilities of body parts. Besides, the 3D articulated pose recovery from monocular imagery is considerably more difficult since 3D poses are inherently ambiguous from a geometric perspective~\cite{zhou2016deep}, as shown in Fig.~\ref{fig:3d_pose_example}. }
\begin{figure}[t]
\centering
\includegraphics[width=0.99 \columnwidth]{stage_by_stage_example}
\caption{Some visual results of our approach on \keze{the} Human3.6M \keze{benchmark}~\cite{huamn3.6m}. (a) illustrates the intermediate 3D poses estimated by the 2D-to-3D pose transformer module, (b) denotes the final 3D poses refined by the 3D-to-2D pose projector module, \kezen{and} (c) denotes the ground-truth. The estimated 3D joints are reprojected into the images and shown by themselves from the side view (next to the images). As shown, \keze{the predicted 3D poses} in (b) \keze{have been} significantly corrected, compared with (a). Best viewed in color. \keze{Note that, red} and green indicate left and right, respectively.}
\label{fig:3d_pose_example}
\end{figure}
\keze{Recently, notable successes have been achieved for 2D pose estimation based on 2D part models coupled with 2D deformation priors~\cite{xiaohan2015joint,yang2011articulated}, and the deep learning techniques~\cite{deeppose, deepfacialpoint, wei2016convolutional,yang2016end}.} Driven by these successes,
\keze{some 3D pose estimation works~\cite{andriluka2010monocular,zhou2014spatio,zhou2015sparseness,Tekin_2016_CVPR,pem17CVPR,ds16CVPR} attempt to leverage the state-of-the-art 2D pose network architectures (e.g., Convolutional Pose Machines (CPM)~\cite{wei2016convolutional} and Stacked Hourglass Networks~\cite{newell2016stacked}) by combing the image-based 2D part detectors, 3D geometric pose priors and temporal models. These attempts mainly follow \kezen{three} types of pipelines.}
\keze{The first type~\cite{pavlakos2017volumetric,lfd17CVPR,rpsm17CVPR} focuses on directly recovering 3D human poses from 2D input images by utilizing the state-of-the-art 2D pose network architecture to extract 2D pose-aware features with separate techniques and prior knowledge. In this way, these methods can employ sufficient 2D pose annotations to improve the shared feature representation of the 3D pose and 2D pose estimation tasks. The second type~\cite{pem17CVPR,yasin2016dual,weak17ICCV} concentrates on learning a 2D-to-3D pose mapping function. Specifically, the methods\keze{belonging} to this kind first extract 2D poses from 2D input images and further perform 3D pose reconstruction/regression based on these 2D pose predictions. \kezen{The third type~\cite{bogo2016keep,omran2018nbf,hmrKanazawa17} aims at integrating the Skinned Multi-Person Linear (SMPL) model~\cite{SMPL2015} within a deep network to reconstruct 3D human pose and shape in a full 3D mesh of human bodies.} Although having achieved a promising performance, \kezen{all of} these \kezen{kinds} suffer from the heavy computational cost \kezen{by using the time-consuming network architecture (e.g., ResNet-50~\cite{he2015deep})} and limited scalability for all scenarios due to the insufficient 3D pose data.}
\keze{To address the above-mentioned issues and utilize the sufficient 2D pose data for training}, we propose an effective yet efficient 3D human pose estimation framework, which \keze{implicitly learns to integrate the 2D spatial relationship, temporal coherency and 3D geometry knowledge by utilizing the advantages afforded by Convolutional Neural Networks (CNNs)~\cite{wei2016convolutional} (i.e., the ability to learn feature representations for both image and spatial context directly from data), recurrent neural networks (RNNs)~\cite{Hochreiter1997Long} (i.e., the ability to model the temporal dependency and prediction smoothness) and the self-supervised correction (i.e., the ability to implicitly retain 3D geometric consistency between the 2D projections of 3D poses and the predicted 2D poses). Concretely,} our model employs a sequential training to capture long-range temporal coherency among multiple human body parts, and it is further enhanced via a novel self-supervised correction mechanism, which involves two dual learning tasks, i.e., 2D-to-3D pose transformation and 3D-to-2D pose projection, to generate geometrically consistent 3D pose predictions under a \keze{self-supervised} correction mechanism, i.e., forcing the 2D projections of the generated 3D poses to be identical to the estimated 2D poses.
As illustrated in Fig.~\ref{fig:3d_pose_example}, our model enables \keze{the} gradual refinement of the 3D pose prediction for each frame according to the coherency of sequentially predicted 2D poses and 3D poses, contributing to seamlessly learning the pose-dependent \kezen{constraints} among multiple body parts and sequence-dependent context from the previous frames. Specifically, \keze{taking} each frame as \kezen{input}, \keze{our model} first extracts the 2D pose representations and predicts the 2D poses. Then, the 2D-to-3D pose transformer module is injected to transform the learned pose representations from the 2D domain to the 3D domain, and it further regresses the intermediate 3D poses via two stacked long short-term memory (LSTM) layers by combining the following two lines of information, \latinabbrev{i.e}, the transformed 2D pose representations and the learned states from past frames. Intuitively, the 2D pose representations are conditioned on the monocular image, which captures the spatial appearance and context information. Then, temporal contextual dependency is captured by the hidden states of LSTM units, which effectively improves the robustness of the 3D pose estimations over time. Finally, the 3D joint prediction implicitly encodes the 3D geometric structural information by the 3D-to-2D pose projector module under the introduced \keze{self-supervised} correction mechanism. In specific, considering that the 2D projections of 3D poses and the predicted 2D poses should be identical, the minimization of their dissimilarities is regarded as a learning objective for the 3D-to-2D pose projector module to \keze{bidirectionally} correct (or refine) the intermediate 3D pose predictions. Through this \keze{self-supervised} correction mechanism, our model is capable of effectively achieving geometrically coherent 3D human pose predictions without requesting additional 3D \keze{pose} annotations. Therefore, our introduced correction mechanism is self-supervised, and can enhance our model by adding the external large-scale 2D human pose data into the training \kezen{process} to cost-effectively \kezen{increase} the \keze{3D pose} estimation performance.
The main \textbf{contributions} of this work are three-fold. i) We present a novel model that learns to integrate rich spatial and temporal long-range dependencies as well as 3D geometric constraints, rather than relying on specific manually defined body smoothness or kinematic constraints; ii) Developing a simple yet effective \keze{self-supervised} correction mechanism to incorporate 3D pose geometric structural information is innovative in literature, \kezen{and} may also inspire other 3D vision tasks; iii) The proposed self-supervised correction mechanism enables our model to significantly improve 3D human pose estimation via sufficient 2D human pose data. Extensive evaluations on the public challenging Human3.6M~\cite{huamn3.6m} and HumanEva-I~\cite{sigal2010humaneva} benchmarks \keze{demonstrate the superiority of our framework over all the compared \kezen{competing} methods.}
The remainder of this paper is organized as follows. Section~\ref{sec:related} briefly reviews the existing 3D human pose estimation approaches that motivate this work. Section~\ref{sec:alg} presents the details of the proposed model, with a thorough analysis of every component. Section~\ref{sec:exper} presents the experimental results on two public benchmarks with comprehensive evaluation protocols, as well as comparisons with \kezen{competing} alternatives. Finally, Section~\ref{sec:conclude} concludes this paper.
\section{Related Work}
\label{sec:related}
Considerable research has addressed the challenge of 3D human pose estimation. Early research on 3D monocular pose estimation from videos \kezen{involved} frame-to-frame pose tracking and dynamic models that rely on Markov dependencies among previous frames, \latinabbrev{e.g}, \cite{wang2014robust,sigal2012loose}. The main drawbacks of these approaches are the requirement of the initialization pose and the inability to recover from tracking failure. To overcome these drawbacks, more recent approaches \cite{andriluka2010monocular,BurgosArtizzuBMVC13PoseNms} focus on detecting candidate poses in each individual frame, and a post-processing step attempts to establish temporally consistent poses. Yasin \latinabbrev{et al} \cite{yasin2016dual} proposed a dual-source approach for 3D pose estimation from a single image. They combined the 3D pose data from a motion capture system with an image source annotated with 2D poses. They transformed the estimation into a 3D pose retrieval problem. One major limitation of this approach is its time efficiency. Processing an image requires more than 20 seconds. Sanzari \latinabbrev{et al} \cite{DBLP:conf/eccv/SanzariNP16} proposed a hierarchical Bayesian non-parametric model, which relies on a representation of the idiosyncratic motion of human skeleton joint groups, and the consistency of the connected group poses is \kezen{considered} during the pose reconstruction.
Deep learning has recently demonstrated its capabilities in many computer vision tasks, such as 3D human pose estimation. Li and Chan \cite{li20143d} first used CNNs to regress the 3D human pose from monocular images and proposed two training strategies to optimize the network. Li \latinabbrev{et al} \cite{li2015maximum} proposed integrating the structure learning into a deep learning framework, which consists of a convolutional neural network to extract image features and two following subnetworks to transform the image features and poses into a joint embedding. Tekin \latinabbrev{et al} \cite{Tekin_2016_CVPR} proposed exploiting motion information from consecutive frames and applied a deep learning network to regress the 3D pose. Zhou \latinabbrev{et al} \cite{zhou2015sparseness} proposed a 3D pose estimation framework from videos that consists of a novel synthesis among a deep-learning-based 2D part detector, a sparsity-driven 3D reconstruction approach and a 3D temporal smoothness prior. Zhou \latinabbrev{et al} \cite{zhou2016deep} proposed directly embedding a kinematic object model into the deep learning network. Du \latinabbrev{et al} \cite{DBLP:conf/eccv/DuWLHGWKG16} introduced additional built-in knowledge for reconstructing the 2D pose and formulated a new objective function to estimate the 3D pose from the detected 2D pose. More recently, Zhou \latinabbrev{et al} \cite{pavlakos2017volumetric} presented a coarse-to-fine prediction scheme to cast 3D human pose estimation as a 3D keypoint localization problem in a voxel space in an end-to-end manner. Moreno-Noguer \latinabbrev{et al} \cite{DMR17CVPR} formulated the 3D human pose estimation problem as a regression between matrices encoding 2D and 3D joint distances. Chen \latinabbrev{et al} \cite{pem17CVPR} proposed a simple approach to 3D human pose estimation by performing 2D pose estimation followed by 3D exemplar matching. Tome \latinabbrev{et al} \cite{lfd17CVPR} proposed a multi-task framework to jointly integrate 2D joint estimation and 3D pose reconstruction to improve both tasks. To leverage the well-annotated large-scale 2D pose datasets, Zhou \latinabbrev{et al} \cite{weak17ICCV} proposed a weakly-supervised transfer learning method that uses mixed 2D and 3D labels in a unified deep \keze{two-stage cascaded structure network}. However, these methods oversimplify the 3D geometric knowledge. In contrast to all these \kezen{aforementioned} methods, our model can leverage a lightweight network architecture to implicitly learn to integrate the 2D spatial relationship, temporal coherency and 3D geometry knowledge in a fully differential manner.
\kezen{Instead of directly computing 2D and 3D joint locations, several works concentrate on producing a 3D mesh body representation by using a CNN to predict Skinned Multi-Person Linear model \cite{SMPL2015}. For instance, Omran \latinabbrev{et al} \cite{omran2018nbf} proposed to integrate a statistical body model within a CNN, leveraging reliable bottom-up semantic body part segmentation and robust top-down body model constraints. Kanazawa \latinabbrev{et al} \cite{hmrKanazawa17} presented an end-to-end adversarial learning framework for recovering a full 3D mesh model of a human body by parameterizing the mesh in terms of 3D joint angles and a low dimensional linear shape space. Furthermore, this method employs the weak-perspective camera model to project the 3D joints onto the annotated 2D joints via an iterative error feedback loop~\cite{feedback16}. Similar to our proposed method, these approaches also regard the in-the-wild images with 2D ground-truth as the supervision to improve the model performance. The main difference is that our self-supervised learning method is more flexible and robust without relying on the assumption of the weak-perspective camera model.}
\begin{figure*}[t]
\centering
\includegraphics[width=0.85\linewidth]{framework_detail2}
\vspace{-5pt}
\caption{An overview of the proposed 3D human pose machine framework. Our model predicts the 3D human poses for the \keze{given} monocular image frames, and it \keze{progressively} refines its predictions with \keze{the proposed} self-supervised correction. Specifically, the estimated 2D pose \keze{$p_t^{2d}$} with the \keze{corresponding} pose representation \keze{$f_t^{2d}$} for \keze{each} frame of the input sequence \keze{is} first obtained and further passed into two neural network modules: i) a 2D-to-3D pose transformer module for transforming the pose representations from the 2D domain to the 3D domain to intermediately predict the human joints \keze{$p_t^{3d}$} in the 3D coordinates, and ii) a 3D-to-2D pose projector module \keze{to obtain the projected 2D pose \keze{$\hat{p}_t^{2d}$ after regressing $p_t^{3d}$ into $\hat{p}_t^{3d}$}. Through minimizing the difference between $p_t^{2d}$ and $\hat{p}_t^{2d}$, our model is capable of bidirectionally refining the regressed 3D poses \keze{$\hat{p}_t^{3d}$} via the proposed self-supervised correction mechanism}. Note that the parameters of the 2D-to-3D pose transformer module for all frames are shared to preserve the temporal motion coherence. \keze{$3K$ and $2K$ denotes the dimension of the vector for representing the 3D and 2D human pose formed by $K$ skeleton joints, respectively.}}\label{fig:framework_detail}
\vspace{-12pt}
\end{figure*}
\keze{Our approach is close to\cite{lfd17CVPR}, which also used the projection from the 3D space to the 2D space to improve the 3D pose estimation performance. However, there are two main differences between \cite{lfd17CVPR} and our model: i) The definition of the 3D-to-2D projection function and the optimization strategy. Rather than explicitly defining a concrete model, our 3D-to-2D projection is implicitly learned in a completely data-driven manner. However, the projection of 3D poses in \cite{lfd17CVPR} is explicitly modeled by using a weak perspective model, which consists of the orthographic projection matrix, a known external camera calibration matrix and an unknown rotation matrix. As claimed in \cite{lfd17CVPR}, this explicit model is prone to sticking in local minima during the training. Thus, the authors have to quantize over the space of possible rotations. Through this approximation, their model performance may suffer from the fixed choices of rotations; ii) The way of utilizing the projected 2D pose. In contrast to \cite{lfd17CVPR} which learns to weightily fuse the projected 2D and the estimated 2D poses for further regressing the final 3D pose, our model exploits the 3D geometric consistency between the projected 2D and the estimated 2D poses to bidirectionally refine the intermediate 3D pose predictions.
}
\keze{
\textbf{Self-supervised Learning.} Aiming at training the feature representation without relying on manual data annotation, self-supervised learning (SSL) has first been introduced in \cite{Pal_computerrecognition} for vowel class recognition, and further extended for object extraction in ~\cite{Ghosh93self-organizationfor}. Recently, plenty of SSL methods (e.g.,~\cite{MT_2017_ICCV,xl_2015_ICCV}) have been proposed. For instance, \cite{MT_2017_ICCV} investigated multiple self-supervised methods to encourage the network to factorize the information in its representation. In contrast to these methods that focus on learning an optimal visual representation, our work considers the self-supervision as an optimization guidance for 3D pose estimation.
}
Note that a preliminary version of this work \kezen{was} published in \cite{rpsm17CVPR}, which uses multiple stages to gradually refine the predicted 3D poses. The network parameters \kezen{in the} multiple stages are recurrently trained in a fully end-to-end manner. However, the multi-stage mechanism results in a heavy computational cost, and the stage-by-stage improvement \kezen{is} less significant as the number of stages increases. In this paper, we inherit its idea of integrating the 2D spatial relationship, temporal coherency as well as 3D geometry knowledge, and we further impose a novel self-supervised correction mechanism to further enhance our model by bridging the domain gap between the 3D and 2D human poses. Specifically, we develop a 3D-to-2D pose projector module to replace the multi-stage refinement to correct the intermediate 3D pose predictions by retaining the 3D geometric consistency between their 2D projections and the predicted 2D poses. Therefore, the imposed correction mechanism enables us to leverage the external large-scale 2D human pose data to boost 3D human pose estimation. Moreover, more comparisons with \kezen{competing} approaches and more detailed analyses of the proposed modules are included to further verify our statements.
\section{3D Human Pose Machine}
\label{sec:alg}
We propose a 3D human pose machine to resolve 3D pose sequence generation for monocular frames, and \kezen{we} introduce a concise \keze{self-supervised correction} mechanism to enhance our model by retaining the 3D geometric consistency. After extracting \kezen{the} 2D pose representation and estimating \kezen{the} 2D poses for each frame via a common 2D pose sub-network, our model employs two consecutive modules. \kezen{The first module is} {\em the 2D-to-3D pose transformer module} \kezen{for transforming} the 2D pose-aware features from the 2D domain to the 3D domain. This module is designed to estimate intermediate 3D poses for each frame by incorporating temporal dependency in the image sequence. \kezen{The second module} is {\em the 3D-to-2D pose projector module} \kezen{for} \keze{bidirectionally} \kezen{refining} the intermediate 3D pose prediction via our introduced \keze{self-supervised} correction mechanism. These two modules are combined in a unified framework to be optimized in a fully end-to-end manner.
\begin{figure*}[t]
\centering
\includegraphics[width=1 \textwidth]{3dto2d}
\vspace{-15pt}
\caption{Detailed sub-network architecture of our proposed 3D-to-2D pose projector module in the (a) training phase and (b) testing phase. The Fully Connected (FC) layers for the regression function are in blue, while those for the projection function are in yellow. The black arrows represent the forward data flow, while the dashed arrows denote the backward propagation \kezen{used} to update the network parameters and perform \keze{gradual} pose refinement in (a) and (b), respectively.}
\label{fig:3dto2d_detail}
\vspace{-10pt}
\end{figure*}
As illustrated in Fig.~\ref{fig:framework_detail}, our model performs the sequential refinement with self-supervised correction to generate the 3D pose sequence. Specifically, the $t$-th frame $I_t$ is passed into the 2D pose sub-network $\Psi_R$, the 2D-to-3D pose transformer module $\Psi_T$, and the 3D-to-2D projector module \keze{$\{\Psi_C, \Psi_P\}$} to predict the final 3D poses. The 2D pose sub-network is stacked by convolutional and fully connected layers, \kezen{and} the 2D-to-3D pose transformer module contains two LSTM layers to capture the temporal dependency over frames. \keze{Specifically}, given the input image sequence with $N$ frames, \kezen{the} 2D pose sub-network $\Psi_R$ is first employed to extract the 2D pose-aware features $f_{t}^{2d}$ and predict the 2D pose $p_{t}^{2d}$ for the $t$-th frame of the input sequence. Then, the extracted 2D pose-aware features $f_{t}^{2d}$ are further fed into the 2D-to-3D pose transformer module $\Psi_T$ to obtain the intermediate 3D pose $p_{t}^{3d}$ \keze{, where $\Psi_T$} is composed of the hidden states $H_{t-1}$ learned from the past frames. Finally, the predicted 2D poses $p_{t}^{2d}$ and intermediate 3D pose $p_{t}^{3d}$ are fed into the 3D-to-2D projector module with two functions, i.e., $\Psi_C$ and $\Psi_P$, to obtain the final 3D poses \keze{$\hat{p}_{t}^{*3d}$}. \kezen{Considering that} most existing 2D human pose data are \kezen{still images without temporal orders}, \keze{we additionally introduce a simple yet effective regression function $\Psi_C$ to transform the intermediate 3D pose vector $p_{t}^{3d}$ into a changeable prediction $\hat{p}_{t}^{3d}$.} The projection function $\Psi_P$ implies projecting the 3D coordinate $\hat{p}_{t}^{3d}$ into the image plane to obtain the projected 2D pose $\hat{p}_{t}^{2d}$. Formally, $f^{2d}_{t}$, $p_{t}^{3d}$, $\hat{p}_{t}^{3d}$, and $\hat{p}_{t}^{2d}$ are formulated as follows:
\begin{equation}
\begin{aligned}
\label{eq:opt}
\{ f^{2d}_{t}, p_{t}^{2d} \} &= \Psi_R(I_t; \omega_R), \\
p_{t}^{3d} &= \Psi_T(f^{2d}_{t}; \omega_T, H_{t-1}), \\
\hat{p}_{t}^{3d} &= \Psi_C(p_{t}^{3d}; \omega_C), \\
\hat{p}_{t}^{2d} &= \Psi_P(\hat{p}_{t}^{3d}; \omega_P), \\
\end{aligned}
\end{equation}
where $\omega_R$, $\omega_T$, $\omega_C$ and $\omega_P$ are parameters of $\Psi_R, \Psi_T, \Psi_C$ and $\Psi_P$, respectively. Note that, $H_0$ is initially set to be a vector of zeros. After obtaining the predicted 2D pose $p_{t}^{2d}$ via $\Psi_R$, and the projected 2D pose $\hat{p}_{t}^{2d}$ via $\Psi_P$ in Eq.~(\ref{eq:opt}), we consider minimizing the dissimilarity between $p_{t}^{2d}$ and $\hat{p}_{t}^{2d}$ as an optimization objective to obtain the optimal $\hat{p}_{t}^{*3d}$ for the $t$-th frame.
\begin{table*}[t]
\center
\caption{Details of the convolutional layers in the 2D pose sub-network.}
\label{table:shared_network_details}
\vspace{-5pt}
\begin{adjustbox}{max width=1.0\textwidth}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|}
\hline
& 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\ \hline
Layer Name & conv1\_1 & conv1\_2 & max\_1 & conv2\_1 & conv2\_2 & max\_2 & conv3\_1 & conv3\_2 & conv3\_3 \\ \hline
Channel (kernel-stride) & 64(3-1) & 64(3-1) & 64(2-2) & 128(3-1) & 128(3-1) & 128(2-2) & 256(3-1) & 256(3-1) & 256(3-1) \\ \hline
& 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 \\ \hline
Layer Name & conv3\_4 & max\_3 & conv4\_1 & conv4\_2 & conv4\_3 & conv4\_4 & conv4\_5 & conv4\_6 & conv4\_7 \\ \hline
Channel (kernel-stride) & 256(3-1) & 256(2-2) & 512(3-1) & 512(3-1) & 256(3-1) & 256(3-1) & 256(3-1) & 256(3-1) & 128(3-1) \\ \hline
\end{tabular}
\end{adjustbox}
\vspace{-10pt}
\end{table*}
In the following, we will introduce more details of our model and \kezen{provide} comprehensive clarifications to make \kezen{the work easier} to understand. The corresponding algorithm for jointly training these modules will also be discussed at the end.
\subsection{2D Pose Sub-network}
\label{sec:2d_pose_cnn}
The objective of the 2D pose sub-network is to encode each frame in \keze{a given} monocular sequence with a compact representation of the pose information, \latinabbrev{e.g}, the body shape of the human. \kezen{The} shallow convolution layers often extract the common low-level information, which is a very basic representation of the human image. \keze{We build our 2D pose sub-network by borrowing the architecture of the convolutional pose machines~\cite{wei2016convolutional}}. \keze{Please see Table~\ref{table:shared_network_details} for more details. Note that other state-of-the-art architectures for 2D pose estimation can be also utilized. As illustrated in Fig.~\ref{fig:framework_detail}, the 2D pose sub-network} takes the $368\times 368$ image as input, and it outputs the 2D pose-aware feature maps with a size of $128\times 46\times 46$ and the predicted 2D pose vectors \kezen{with 2$K$ entries being the argmax positions of these feature maps}.
\subsection{2D-to-3D Pose Transformer Module}
Based on the features extracted by the 2D pose sub-network, the 3D pose transformer module is employed to adapt the 2D pose-aware features in an adapted feature space for the later 3D pose prediction. As depicted in Fig.~\ref{fig:framework_detail} (a), two convolutional layers and one fully connected layer are leveraged. Each convolutional layer contains 128 different kernels with a size of $5\times5$ and a stride of 2, and a max pooling layer with a $2\times2$ kernel size and a stride of 2 is appended on the convolutional layers. Finally, the convolution features are fed to a fully connected layer with 1024 units to produce the adapted feature vector. In this way, the 2D pose-aware features are transformed into the 1024-dimensional adapted feature vector.
Given the adapted features for all frames, we employ LSTM to sequentially predict the 3D pose sequence by incorporating rich temporal motion patterns among frames as \cite{rpsm17CVPR}. Note that, LSTM \cite{Hochreiter1997Long} has been proven to \kezen{achieve} better performance \kezen{in} exploiting temporal correlations than a vanilla recurrent neural network in many tasks, \latinabbrev{e.g}, speech recognition \cite{graves2014towards} and video description \cite{donahue2015long}. In our model, we \kezen{use} the LSTM layers to capture the temporal dependency in the monocular sequence for refining the 3D pose prediction for each frame. As illustrated in Fig.~\ref{fig:framework_detail} (b), our model employs two LSTM layers with 1024 hidden cells and an output layer that predicts the locations of $K$ joint points of the human. In particular, the hidden states learned by the LSTM layers are capable of implicitly encoding the temporal dependency across different frames of the input sequence. As formulated in Eq.~(\ref{eq:opt}), incorporating the previous hidden states imparts our model with the ability to sequentially refine the pose predictions.
\subsection{3D-to-2D Projector Module}
As illustrated in Fig.~\ref{fig:3dto2d_detail} (a), this module consists of six fully connected (FC) layers \kezen{containing} ReLU and batch normalization operations. As one can see from left to right in Fig.~\ref{fig:3dto2d_detail}(a), the first two FC layers (denoted in blue)
\kezen{define} the regression function $\Psi_C$ in which the intermediate 3D pose predictions are regressed into the pose prediction $\hat{p}_{t}^{3d}$, and the remaining four FC layers (denoted in yellow) with 1024 units represent the projection function $\Psi_P$ that projects $\hat{p}_{t}^{3d}$ into the image plane to obtain the projected 2D pose $\hat{p}_{t}^{2d}$. Moreover, an identical mapping as ResNet~\cite{he2015deep} is used inside $\Psi_P$ to make the information pass through quickly to avoid overfitting. Therefore, our 3D-to-2D projector module is simple yet powerful for both regression and projection tasks. \kezen{Considering the self-corrected 3D pose may need to be discarded sometimes, we regard the regression function $\Psi_C$ as a copy to be corrected for the intermediate 3D poses.}
In the training phase, \keze{we first initialize the module parameters \{$\omega_C$, $\omega_P$\} for $\Psi_C$ and $\Psi_P$ via the supervision of the 3D and 2D ground-truth poses from 3D human pose data as illustrated in Fig.~\ref{fig:3dto2d_detail} (a), respectively. The optimization function is:
\begin{small}\begin{equation}
\label{eq:loss_proj}
\begin{gathered}
\min_{\{\omega_C, \omega_P\}} \sum_{t=1}^{N} \left \| \hat{p}_t^{3d} - p_t^{3d(gt)} \right \|_{2}^{2} +
\left \| \Psi_P(\hat{p}_t^{3d}; \omega_P) - p_{t}^{2d(gt)} \right \|_{2}^{2}, \\
\end{gathered}
\end{equation}\end{small}where $\hat{p}_t^{3d}$ is the regressed 3D pose via $\Psi_C$ in Eq.~(\ref{eq:opt}), and its 2D projection is $\hat{p}_t^{2d}=\Psi_P(\hat{p}_t^{3d}; \omega_P)$. Eq.~(\ref{eq:loss_proj}) forces $\Psi_C$ to regress $\hat{p}_t^{3d}$ from intermediate 3D poses $p_t^{3d}$ to the 3D pose ground-truth $p_t^{3d(gt)}$, and it further forces the output of $\Psi_P$, i.e., the projected 2D poses, to be similar to the 2D pose ground-truth $p_{t}^{2d(gt)}$. In this way, the 3D-to-2D pose projector module can learn the geometric consistency to correct intermediate 3D pose predictions.} After initialization, we substitute the predicted 2D poses and 3D poses for \kezen{the} 2D and 3D ground-truth to optimize $\Psi_C$ and $\Psi_P$ in a self-supervised fashion. Considering that the predictions for \kezen{certain} body joints (e.g., hand$_{left}$, hand$_{right}$, foot$_{left}$ and foot$_{right}$ defined in the Human3.6M dataset) may not be accurate and reliable due to the challenging \kezen{nature} of the rich flexibilities and occlusions of body joints, we employ the dropout trick~\cite{krizhevsky2012imagenet} \kezen{in} the intermediate 3D pose estimations $p_{t}^{3d}$ and the predicted 2D pose $p_{t}^{2d}$, i.e., the position for each body joint has a probability $\delta$ to be zero. This trick enables the regression function $\Psi_C$ and the project function $\Psi_P$ to be insensitive to the outliers inside $p_{t}^{3d}$ and $p_{t}^{2d}$. \kezen{As reported in~\cite{krizhevsky2012imagenet}, the dropout trick can significantly contribute to alleviating the overfitting of the fully connected layers inside $\Psi_C$ and $\Psi_P$.}
Meanwhile, we also \kezen{employ} the 3D pose ground-truth to encourage the regression function $\Psi_C$ to learn to regress the 3D pose estimation $\hat{p}_{t}^{3d}$. In our experiments, $\delta$ is empirically set to be 0.3.
\keze{
The inference phase of this module is also self-supervised. Specifically, given the predicted 2D pose $p_{t}^{2d}$, we can obtain the initial $\hat{p}_{t}^{3d}$ and the corresponding projected 2D pose $\hat{p}_{t}^{2d}$ via forward propagation, as indicated in Fig.~\ref{fig:3dto2d_detail} (b). According to the 3D geometric consistency that the projected 2D pose $\hat{p}_{t}^{2d}$ should be identical to the predicted 2D pose $p_{t}^{2d}$, we propose minimizing the dissimilarity between $\hat{p}_{t}^{2d}$ and $p_{t}^{2d}$ by optimizing its specific $\omega_P^t$ and $\omega_C^t$ as follows:
\kezen{\begin{equation}
\label{eq:inference}
\begin{split}
\{\omega_{P}^{*t}, \omega_{C}^{*t}\} &= \argmin_{\{\hat{p}_{t}^{3d}, \omega_P^t\}} \| p_{t}^{2d} - \hat{p}_{t}^{2d} \|_2^2 \\
&= \argmin_{\{\hat{p}_{t}^{3d}, \omega_P^t\}} \| p_{t}^{2d} - \Psi_P( \hat{p}_{t}^{3d}; \omega_P^t) \|_{2}^{2} \\
&= \argmin_{\{\omega_{P}^t, \omega_C^t\}} \| p_{t}^{2d} - \Psi_P( \Psi_C(p_{t}^{3d}; \omega_C^t); \omega_P^t) \|_{2}^{2}, \\
\end{split}
\end{equation}}where the parameters \{$\omega_P^{t}$, $\omega_C^{t}$\} are initialized from the \keze{well-optimized} \{$\omega_P$, $\omega_C$\} from the training phase. \keze{Note that, $\omega_C^{*t}$ and $\omega_P^{*t}$ are disposable and only valid for $I_t$.} Since $p_{t}^{2d}$ and $p_{t}^{3d}$ are fixed, we first perform forward propagation to obtain the initial prediction, and further employ the standard back-propagation algorithm~\cite{CNN1990} to obtain $\omega_C^{*t}$ and $\omega_P^{*t}$ via Eq.~(\ref{eq:inference}). Thus, the output 3D pose regression $\hat{p}_{t}^{3d}$ is bidirectionally refined to be the final 3D pose prediction during the the optimizing of $\omega_C^{t}$ and $\omega_P^{t}$ according to the proposed self-supervised correction mechanism.} At the end, the final 3D pose $\hat{p}_{t}^{*3d}$ is obtained according to Eq.~(\ref{eq:inference}) as follows:
\begin{equation}
\label{eq:final}
\hat{p}_{t}^{*3d} = \Psi_C(p_{t}^{3d}; \omega_C^{*t}).
\end{equation}
The hyperparameters (i.e., the iteration number and learning rate) for \kezen{$\omega_P^{*t}$} and \kezen{$\omega_C^{*t}$} play a crucial role in effectively and efficiently refining the 3D pose estimation. In fact, a large iteration number and small learning rate can ensure that the model is capable of converging to a satisfactory $\hat{p}_{t}^{*3d}$. However, this setting results in a heavy computational cost. Therefore, a small iteration number with large learning rate is preferred to achieve a trade-off between efficiency and accuracy. Moreover, although we can achieve high accuracy on 2D pose estimation, the predicted 2D poses may contain errors due to the heavy occlusion of human body parts. Treating these inaccurate 2D poses as optimization objectives to \keze{bidirectionally} refine the 3D pose prediction \keze{is prone to a decrease} in performance. To address this issue, we utilize a heuristic strategy to determine the optimal hyperparameters used for each frame in our implementation. Specifically, we can check the convergence of some robust skeleton joints (i.e., Pelvis, Shoulder$_{left}$, Shoulder$_{right}$, Hip$_{left}$ and Hip$_{right}$ defined in the Human3.6M dataset) in each iteration. In practice, we find that the predictions of these reliable joints are generally less flexible and have \kezen{lower} probabilities of being occluded than other joints. If the predicted 2D pose contains small errors, then these joints of the refined 3D pose $\hat{p}_{t}^{*3d}$ will have large \kezen{and} inconsistent changes \kezen{within} the self-supervised correction. Hence, we terminate the further refinement when the positions of these joints are converged (i.e., average changes $< \epsilon$mm), and discard the self-supervised correction when the average change \kezen{in} these joints are not within an empirical threshold $\tau$mm. In our experiments, we empirically set $\{\tau, \epsilon\}=\{20, 5\}$ and employ two back-propagation \kezen{operations} to update $\omega_P$ and $\omega_C$ before outputting the final 3D pose prediction $\hat{p}_{t}^{*3d}$.
\subsection{Model Training}
In the training phase, the optimization of our proposed model occurs in a fully end-to-end manner, and we have defined several types of loss functions to fine-tune the network parameters: $\omega_R, \omega_T$ and \{$\omega_C, \omega_P$\}, respectively. For the 2D pose sub-network, we build an extra FC layer upon the convolutional layers of the 2D pose sub-network to generate 2$K$ joint location coordinates. We leverage the Euclidean distances between the \kezen{predictions} for all $K$ \keze{body joints} and the corresponding ground-truth to train $\omega_R$. Formally, we have:
\begin{equation}
\label{eq:loss_2d}
\min_{\omega_R} \sum_{t=1}^{N} \left \| p_t^{2d}(gt) - \Psi_R(I_t; \omega_R) \right \|_2^2,
\end{equation}
where $p_t^{2d}(gt)$ denotes the 2D pose ground-truth for the $t$-th frame $I_t$.
For the 2D-to-3D pose transformer module, our model enforces the 3D pose sequence prediction loss for all frames, which is also defined as follows:
\begin{equation}
\label{eq:loss_trans}
\begin{split}
\min_{\omega_T} & \sum_{t=1}^{N} \left \| p_t^{3d} - p_t^{3d(gt)} \right \|_{2}^{2} \\
=& \sum_{t=1}^{N} \left \| \Psi_T( f_t^{2d}; \omega_T, H_{t-1} ) - p_t^{3d(gt)} \right \|_{2}^{2},
\end{split}
\end{equation}
where $p_t^{3d(gt)}$ is the 3D pose ground-truth for the $t$-th frame $I_t$. According to Eq.~(\ref{eq:loss_trans}), we integrally fine-tune the parameters of the 2D-to-3D pose transformer module and the convolutional layers of the 2D pose sub-network in an end-to-end optimization manner. Note that, to obtain sufficient samples to train the 3D pose transformer module, we propose decomposing one long monocular image sequence into several small equal clips with $N$ frames. In our experiments, we jointly feed our model with 2D and 3D pose data after all the network parameters \kezen{are} well initialized. \kezen{For} the 2D human pose data, this module regards their 3D pose sequence prediction loss as zero.
After \keze{initializing the 3D-to-2D projector module via Eq.~(\ref{eq:loss_proj})}, we fine-tune the whole network to jointly optimize the network parameters $\{\omega_R, \omega_T, \omega_C, \omega_P\}$ in a fully end-to-end manner as follows:
\begin{equation}
\label{eq:whole}
\begin{split}
& \min_{\{\omega_R, \omega_T, \omega_C, \omega_P\}} \| p_t^{2d} - \hat{p}_t^{2d} \|_2^2. \\
\end{split}
\end{equation}
\begin{algorithm}[t]
\caption{The Proposed Training Algorithm} \label{alg:alg_overview}
\begin{algorithmic}[1]
\REQUIRE 3D human pose data $\{\mathbf{I}_{t}^{3d}\}_{t=1}^{N}$ and 2D human pose data $\{\mathbf{I}_{i}^{2d}\}_{i=1}^{M}$
\STATE Pre-train the 2D pose sub-network with $\{\mathbf{I}_{i}^{2d}\}_{i=1}^{M}$ to initialize $\omega_R$ via Eq.~(\ref{eq:loss_2d}); \\
\STATE Fixing $\omega_R$, initialize $\omega_T$ with hidden variables $H$ with $\{\mathbf{I}_{t}^{3d}\}_{t=1}^{N}$ via Eq.~(\ref{eq:loss_trans});\\
\STATE Fixing $\omega_R$ and $\omega_T$, initialize \{$\omega_C$, $\omega_P$\} with $\{\mathbf{I}_{t}^{3d}\}_{t=1}^{N}$ via Eq.~(\ref{eq:loss_proj});\\
\STATE Fine-tune the whole model to further update \{$\omega_R$, $\omega_T$, $\omega_C$, $\omega_P$\} on $\{\mathbf{I}_{t}^{3d}\}_{t=1}^{N}$ and $\{\mathbf{I}_{i}^{2d}\}_{i=1}^{M}$ via Eq.~(\ref{eq:whole}).
\RETURN \{$\omega_R$, $\omega_T$, $\omega_C$, $\omega_P$\}.
\end{algorithmic}
\end{algorithm}
Since our model consists of two cascaded modules, the training phase can be divided into the following steps: (i) Initialize the 2D pose representation via pre-training. To obtain \kezen{a} satisfactory feature representation, the 2D pose sub-network is first pre-trained with the MPII Human Pose dataset \cite{andriluka14cvpr}, which \kezen{includes} a larger variety of 2D pose data. (ii) Initialize the 2D-to-3D pose transformer module. We fix the parameters of the 2D pose sub-network and optimize the network parameter $\omega_T$. (iii) Initialize the 3D-to-2D pose projector module. We fix the above optimized parameters and optimize the network parameter \{$\omega_C$, $\omega_P$\}. (iv) Fine-tune the whole model jointly to further update the network parameters \{$\omega_R$, $\omega_T$, $\omega_C$, $\omega_P$\} with the 2D pose and 3D pose training data. For each \kezen{of the} above-mentioned \kezen{steps}, the ADAM~\cite{Kingma2014Adam} strategy is employed for parameter optimization. The entire algorithm can then be summarized as Algorithm \ref{alg:alg_overview}. \kezen{Obviously,} this algorithm is in a good agreement with the pipeline of our model.
\subsection{Model Inference}
In the testing phase, every frame of the input image sequence is sequentially processed via Eq.~(\ref{eq:opt}). Note that each frame $I_t$ has its \keze{own} \{$\omega_C^t$, $\omega_P^t$\} in the 3D-to-2D projector module. \{$\omega_C^t$, $\omega_P^t$\} are initialized from the well trained \{$\omega_C$, $\omega_P$\}, and \kezen{they} will be updated by minimizing the difference between the predicted 2D poses $p_{t}^{2d}$ and projected 2D poses $\Psi_P( \hat{p}_{t}^{3d}; \omega_P)$ via Eq.~(\ref{eq:inference}). During the inference, the 3D pose estimation is \keze{bidirectionally} refined until convergence is \kezen{achieved} according to the hyperparameter \kezen{settings}. Finally, we output the final 3D pose estimation via Eq.~(\ref{eq:final}).
\begin{table*}[tp]
\caption{\textbf{Quantitative comparisons on the Human3.6M dataset} using 3D pose errors (in millimeters). The entries with the smallest 3D pose errors for each category are bold-faced. \kezen{A} method with ``*'' denotes that it is individually trained on each action category. Our model achieves a significant improvement over all compared approaches.}\label{table:h3m_res}
\vspace{-5pt}
\small
\setlength{\tabcolsep}{1pt}
\begin{center}
\begin{tabular}{c}
Protocol \#1 \\
\end{tabular}
\end{center}
\begin{adjustbox}{max width=1.0\textwidth}
\centering
\begin{tabular}{@{}l|ccccccccccccccc|c@{}}
\toprule
\hline
Method & Direction & Discuss & Eat & Greet & Phone & Pose & Purchase & Sit & SitDown & Smoke & Photo & Wait & Walk & WalkDog & WalkPair & Avg. \\ \midrule
\hline
Ionescu PAMI'14\cite{huamn3.6m}*& 132.71 & 183.55 & 132.37 & 164.39 & 162.12 & 150.61 & 171.31 & 151.57 & 243.03 & 162.14 & 205.94 & 170.69 & 96.60 & 177.13 & 127.88 & 162.14 \\
Li ICCV'15\cite{li2015maximum}* & - & 136.88 & 96.94 & 124.74 & - & - & - & - & - & - & 168.68 & - & 69.97 & 132.17 & - & - \\
Tekin CVPR'16 \cite{Tekin_2016_CVPR}* & 102.41 & 147.72 & 88.83 & 125.28 & 118.02 & 112.38 & 129.17 & 138.89 & 224.9 & 118.42 & 182.73 & 138.75 & 55.07 & 126.29 & 65.76 & 124.97 \\
Zhou CVPR'16 \cite{zhou2015sparseness}* & 87.36 & 109.31 & 87.05 & 103.16 & 116.18 & 106.88 & 99.78 & 124.52 & 199.23 & 107.42 & 143.32 & 118.09 & 79.39 & 114.23 & 97.70 & 113.01 \\
Zhou ECCVW'16 \cite{zhou2016deep}* & 91.83 & 102.41 & 96.95 & 98.75 & 113.35 & 90.04 & 93.84 & 132.16 & 158.97 & 106.91 & 125.22 & 94.41 & 79.02 & 126.04 & 98.96 & 107.26 \\
Du ECCV'16 \cite{DBLP:conf/eccv/DuWLHGWKG16}* & 85.07 & 112.68 & 104.90 & 122.05 & 139.08 & 105.93 & 166.16 & 117.49 & 226.94 & 120.02 & 135.91 & 117.65 & 99.26 & 137.36 & 106.54 & 126.47 \\
Chen CVPR'17 \cite{pem17CVPR}* & 89.87 & 97.57 & 89.98 & 107.87 & 107.31 & 93.56 & 136.09 & 133.14 & 240.12 & 106.65 & 139.17 & 106.21 & 87.03 & 114.05 & 90.55 & 114.18 \\
Tekin ICCV'17 \cite{Tekin_2017_ICCV}* & 54.23 & 61.41 & 60.17 & 61.23 & 79.41 & 63.14 & 81.63 & 70.14 & \bf 107.31 & 69.29 &\bf 78.31 & 70.27 & 51.79 &74.28 & 63.24 & 69.73 \\
\textbf{Ours}* &\bf 50.36 & \bf59.74 & \bf54.86 & \bf57.12 & \bf66.30 & \bf53.24 & \bf54.73 & \bf84.58 & 118.49& \bf 63.10 & 78.61 & \bf59.47& \bf 41.96& \bf 64.88 & \bf49.48& \bf 63.79 \\
\hline
Sanzari ECCV'16\cite{DBLP:conf/eccv/SanzariNP16} & \textbf{48.82} & \textbf{56.31} & 95.98 & 84.78 & 96.47 & 66.30 & 107.41 & 116.89 & 129.63 & 97.84 & 105.58 & 65.94 & 92.58 & 130.46 & 102.21 & 93.15 \\
Tome CVPR'17 \cite{lfd17CVPR} & 64.98 & 73.47 & 76.82 & 86.43 & 86.28 & 68.93 & 74.79 & 110.19 & 173.91 & 84.95 & 110.67 & 85.78 & 86.26 & 71.36 & 73.14 & 88.39\\
Moreno-Noguer CVPR'17\cite{DMR17CVPR} & 69.54 & 80.15 & 78.20 & 87.01 & 100.75 & 76.01 & 69.65 & 104.71 & 113.91 & 89.68 & 102.71 & 98.49 & 79.18 & 82.40 & 77.17 & 87.30 \\
Lin CVPR'17\cite{rpsm17CVPR} & 58.02 & 68.16 & 63.25 & 65.77 & 75.26 & 61.16 & 65.71 & 98.65 & 127.68 & 70.37 & 93.05 & 68.17 & 50.63 & 72.94 & 57.74 & 73.10 \\
Pavlakos CVPR'17\cite{pavlakos2017volumetric} & 67.38 & 71.95 & 66.70 & 69.07 & 71.95 & 65.03 & 68.30 & 83.66 &\bf 96.51 & 71.74 & 76.97 & 65.83 & 59.11 & 74.89 & 63.24 & 71.90 \\
Bruce ICCV'17~\cite{Nie_2017_ICCV} & 90.1 & 88.2 & 85.7 & 95.6 & 103.9 & 90.4 & 117.9 & 136.4 & 98.5 & 103.0 & 92.4 & 94.4 & 90.6 & 86.0 & 89.5 & 97.5 \\
Tekin ICCV'17~\cite{Tekin_2017_ICCV} & 53.91 & 62.19 & 61.51 & 66.18 & 80.12 & 64.61 & 83.17 &\bf 70.93 & 107.92 & 70.44 & 79.45 & 68.01 & 52.81 & 77.81 &63.11 & 70.81\\
Zhou ICCV'17\cite{weak17ICCV} & 54.82 & 60.70 & 58.22 & 71.41 &\bf 62.03 & 53.83 & 55.58 & 75.20 & 111.59 & 64.15 & \bf 65.53& 66.05 & 63.22 &\bf 51.43 & 55.33 & 64.90 \\
\textbf{Ours} & 50.03 & 59.96 & \bf54.66&\bf56.55&65.65&\bf52.74&\bf 54.81 & 85.85 & 117.98 &\bf62.48 &79.63&\bf 59.55&\bf 41.48& 65.21 &\bf48.52&\bf 63.67 \\
\hline
\hline
\end{tabular}
\end{adjustbox}
\begin{center}
\begin{tabular}{c}
Protocol \#2 \\
\end{tabular}
\end{center}
\begin{adjustbox}{max width=1.0\textwidth}
\begin{tabular}{@{}l|ccccccccccccccc|c@{}}
\hline
\hline
Method & Direction & Discuss & Eat & Greet & Phone & Pose & Purchase & Sit & SitDown & Smoke & Photo & Wait & Walk & WalkDog & WalkPair & Avg. \\
\hline
Akhter CVPR'15~\cite{pjal15CVPR} & 1199.20 & 177.60 & 161.80 & 197.80 & 176.20 & 195.40 & 167.30 & 160.70 & 173.70 & 177.80 & 186.50 & 181.90 & 198.60 & 176.20 & 192.70 & 181.56 \\
Zhou PAMI'16 \cite{zhou16pami} & 99.70 & 95.80 & 87.90 & 116.80 & 108.30 & 93.50 & 95.30 & 109.10 & 137.50 & 106.00 & 107.30 & 102.20 & 110.40 & 106.50 & 115.20 & 106.10 \\
Bogo ECCV'16 \cite{bogo2016keep} & 62.00 & 60.20 & 67.80 & 76.50 & 92.10 & 73.00 & 75.30 & 100.30 & 137.30 & 83.40 & 77.00 & 77.30 & 86.80 & 79.70 & 81.70 & 82.03 \\
Moreno-Noguer CVPR'17\cite{DMR17CVPR} & 66.07 & 77.94 & 72.58 & 84.66 & 99.71 & 74.78 & 65.29 & 93.40 &\bf 103.14 & 85.03 & 98.52 & 98.78 & 78.12 & 80.05 & 74.77 & 83.52 \\
Tome CVPR'17 \cite{lfd17CVPR} & - & - & - & - & - & - & - & - & - & - & - & - & - & - & - & 79.60 \\
Chen CVPR'17 \cite{pem17CVPR} & 71.63 & 66.60 & 74.74 & 79.09 & 70.05 & 67.56 & 89.30 & 90.74 & 195.62 & 83.46 & 93.26 & 71.15 & 55.74 & 85.86 & 62.51 & 82.72 \\
\textbf{Ours}& \bf 48.54&\bf 59.71& \bf56.12& \bf 56.12 &\bf67.68&\bf57.31&\bf55.57&\bf78.26 &115.85&\bf69.99&\bf71.47&\bf61.29 &\bf44.63&\bf62.22&\bf51.42&\bf63.74 \\
\hline
\hline
\end{tabular}
\end{adjustbox}
\begin{center}
\begin{tabular}{c}
Protocol \#3 \\
\end{tabular}
\end{center}
\begin{adjustbox}{max width=1.0\textwidth}
\begin{tabular}{@{}l|ccccccccccccccc|c@{}}
\hline
\hline
Method & Direction & Discuss & Eat & Greet & Phone & Pose & Purchase & Sit & SitDown & Smoke & Photo & Wait & Walk & WalkDog & WalkPair & Avg. \\
\hline
Yasin CVPR'16 \cite{ds16CVPR} & 88.40 & 72.50 & 108.50 & 110.20 & 97.10 & 81.60 & 107.20 & 119.00 & 170.80 & 108.20 & 142.50 & 86.90 & 92.10 & 165.70 & 102.00 & 110.18 \\
Moreno-Noguer CVPR'17\cite{DMR17CVPR} & 67.44 & 63.76 & 87.15 & 73.91 & 71.48 & 69.88 & 65.08 & 71.69 & 98.63 & 81.33 & 93.25 & 74.62 & 76.51 & 77.72 & 74.63 & 76.47 \\
Tome CVPR'17 \cite{lfd17CVPR} & - & - & - & - & - & - & - & - & - & - & - & - & - & - & - & 70.7 \\
Bruce ICCV'17~\cite{Nie_2017_ICCV} & 62.8 & 69.2 & 79.6 & 78.8 & 80.8 & 72.5 & 73.9 & 96.1 & 106.9 & 88.0 & 86.9 & 70.7 & 71.9 & 76.5 & 73.2 &79.5 \\
Sun ICCV'17\cite{Sun_2017_ICCV} & - & - & - & - & - & - & - & - & - & - & - &- &- &- &- & \bf 48.3 \\
\textbf{Ours} &\bf 38.69 &\bf 45.62 &\bf 54.77 &\bf 48.92 &\bf 54.65 &\bf 47.49 &\bf 47.17 &\bf 64.73 &\bf 94.30 &\bf 56.84 &\bf 78.85 &\bf 49.29 &\bf 33.07 &\bf 58.71 &\bf 38.96 &\bf 54.14 \\
\bottomrule
\end{tabular}
\end{adjustbox}
\end{table*}
\section{Experiments}
\label{sec:exper}
\subsection{Experimental Settings}
We perform extensive evaluations on two publicly available benchmarks: Human3.6M~\cite{huamn3.6m} and HumanEva-I~\cite{sigal2010humaneva}.
\textbf{Human3.6M dataset.} \kezen{The Human3.6M dataset} is a recently published dataset that provides 3.6 million 3D human pose images and corresponding annotations \kezen{from} a controlled laboratory environment. This dataset captures 11 professional actors performing in 15 scenarios under 4 different viewpoints. Moreover, there are three popular data partition protocols for this benchmark in the literature.
\begin{itemize}
\item {\em Protocol \#1:} The data from five subjects (S1, S5, S6, S7, and S8) are for training, and the data from two subjects (S9 and S11) are for testing. To increase the number of training samples, the sequences from different viewpoints of the same subject are treated as distinct sequences. \kezen{By} downsampling the frame rate from 50 FPS to 2 FPS, 62,437 human pose images (104 images per sequence) are obtained for training and 21,911 images are obtained for testing (91 images per sequence). This is the widely used evaluation protocol on Human3.6M, and it \kezen{was} followed by several works \cite{li2015maximum, Tekin_2016_CVPR, zhou2016deep, pem17CVPR}.
To be more general and make a fair comparison, our model is trained \kezen{both on} training samples from all 15 actions as previous works~\cite{li2015maximum, Tekin_2016_CVPR, zhou2016deep, pem17CVPR} and \kezen{by} exploiting individual \kezen{actions} as ~\cite{zhou2015sparseness,li2015maximum}.
\item {\em Protocol \#2:} \kezen{This protocol} only differs from Protocol \#1 in that only the frontal view is considered for testing, i.e., \kezen{testing is performed} on every 5-th frame of the sequences from the frontal camera (cam-3) from trial 1 of each activity with ground-truth cropping. The training data contain all actions and viewpoints.
\item {\em Protocol \#3:} Six subjects (S1, S5, S6, S7, S8 and S9) are used for training, and every 64-th frame of S11's video clips is used for testing. The training data contain all actions and viewpoints.
\end{itemize}
\textbf{HumanEva-I dataset.} \kezen{The HumanEva-I dataset} contains video sequences of four subjects performing six common actions (\latinabbrev{e.g}, walking, jogging, boxing\kezen{, etc.}), and it also provides 3D pose annotation for each frame in the video sequences. We train our model on \kezen{the} training sequences of subjects 1, 2 and 3 and test on the `validation' sequence \kezen{under} the same protocol as \cite{yasin2016dual,Tekin_2016_CVPR,simo2012single,SimoSerraCVPR2013,BMVC2880,bo2010twin,radwan2013monocular,wang2014robust}.
Similar to Protocol \#1 of the Human3.6M dataset, the data from different camera viewpoints are also regarded as different training samples. Note that we \kezen{did not downsample} the video sequences to obtain more samples for training.
\begin{table*}[tp]
\caption{Quantitative comparisons on the HumanEva-I dataset using 3D pose errors (in millimeters) for the ``walking'', ``jogging'' and ``boxing'' sequences. '-' indicates that the \kezen{author of the} corresponding method \kezen{did} not \kezen{report} the accuracy on that action. The entries with the smallest 3D pose errors for each category are bold-faced. Our model outperforms all the compared methods by a clear margin. }\label{table:hevai_res}
\centering
\scriptsize
\resizebox{\textwidth}{!}{%
\begin{tabular}{@{}l|cccc|cccc|cccc@{}}
\toprule
& \multicolumn{4}{c|}{Walking} & \multicolumn{4}{c|}{Jogging} & \multicolumn{4}{c}{Boxing} \\
Methods & S1 & S2 & S3 & Avg. & S1 & S2 & S3 & Avg. & S1 & S2 & S3 & Avg. \\ \midrule
Simo-Serra CVPR'12 \cite{simo2012single} & 99.6 & 108.3 & 127.4 & 111.8 & 109.2 & 93.1 & 115.8 & 108.9 & - & - & - & - \\
Radwan ICCV'13 \cite{radwan2013monocular} & 75.1 & 99.8 & 93.8 & 89.6 & 79.2 & 89.8 & 99.4 & 89.5 & - & - & - & - \\
Wang CVPR'14 \cite{wang2014robust} & 71.9 & 75.7 & 85.3 & 77.6 & 62.6 & 77.7 & 54.4 & 71.3 & - & - & - & - \\
Du ECCV'16 \cite{DBLP:conf/eccv/DuWLHGWKG16} & 62.2 & 61.9 & 69.2 & 64.4 & 56.3 & 59.3 & 59.3 & 58.3 & - & - & - & - \\
Simo-Serra CVPR'13 \cite{SimoSerraCVPR2013} & 65.1 & 48.6 & 73.5 & 62.4 & 74.2 & 46.6 & 32.2 & 56.7 & - & - & - & - \\
Bo IJCV'10 \cite{bo2010twin} & 45.4 & 28.3 & 62.3 & 45.3 & 55.1 & 43.2 & 37.4 & 45.2 & 42.5 & 64.0 & 69.3 & 58.6 \\
Kostrikov BMVC'14 \cite{BMVC2880} & 44.0 & 30.9 & 41.7 & 38.9 & 57.2 & 35.0 & 33.3 & 40.3 & - & - & - & - \\
Tekin CVPR'16 \cite{Tekin_2016_CVPR} & 37.5 & 25.1 & 49.2 & 37.3 & - & - & - & - & 50.5 & 61.7 & {57.5} & 56.6 \\
Yasin CVPR'16 \cite{yasin2016dual} & 35.8 & 32.4 & 41.6 & 36.6 & 46.6 & 41.4 & 35.4 & 38.9 & - & - & - & - \\
Lin CVPR'17\cite{rpsm17CVPR} & {26.5} & {20.7} & {38.0} & {28.4} & {41.0} & {29.7} & {29.1} & {33.2} & {39.4} & {57.8} & 61.2 & {52.8} \\
Pavlakos CVPR'17~\cite{pavlakos2017volumetric} & 22.3 & 19.5 & 29.7 & 23.8 & 28.9 & 21.9 & 23.8 & 24.9 &- &- &- &- \\
Moreno-Noguer CVPR'17 \cite{DMR17CVPR} & 19.7 & \bf 13.0 & 24.9 & 19.2 & 39.7 & 20.0 & 21.0 & 26.9 & - & - & - & - \\
Tekin ICCV'17 \cite{Tekin_2017_ICCV} & 27.2 & 14.3 & 31.7 & 24.4 & - & - & - & - & - & - & - & - \\
\bf Ours & \bf 17.2 & 13.4 & \bf20.5 & \bf17.0 &\bf 27.9 & \bf19.5 &\bf 20.9 &\bf 22.8& \bf 29.7&\bf 44.0&\bf 47.2&\bf 40.3\\
\bottomrule
\end{tabular}%
}
\end{table*}
\begin{table}[t]
\vspace{-5pt}
\caption{Comparison of the average running time (milliseconds per image) on the Human3.6M benchmark. As shown in this table, our model performs nearly three times faster than the fastest of the compared methods. Specifically, the 2D pose sub-network costs 19ms, the 2D-to-3D pose transformer module costs 19 ms, and the 3D-to-2D pose projector module \kezen{costs} 13 ms.}\label{table:efficiency}
\vspace{-10pt}
\center
\small
\setlength{\tabcolsep}{2.5pt}
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline
\hline
Method & Zhou & Pavlakos & Zhou & Tome & Ours \\
& et al.~\cite{zhou2015sparseness} & et al.~\cite{pavlakos2017volumetric} & et al.~\cite{weak17ICCV} & et al.~\cite{lfd17CVPR} & \\
\hline
Time & 880 & 174 & 311 & 444 & 51 \\
\hline
\hline
\end{tabular}
\vspace{-10pt}
\end{table}
\begin{figure*}[t]
\center
\includegraphics[width= 1 \textwidth]{visual_cmp}
\vspace{-15pt}
\caption{\kezen{Qualitative} comparisons on the Human3.6M dataset. The 3D poses are visualized from the side view, and the cameras are depicted. The results from Zhou \latinabbrev{et al}~\cite{zhou2015sparseness}, Pavlakos \latinabbrev{et al}~\cite{pavlakos2017volumetric}, Lin \latinabbrev{et al}~\cite{rpsm17CVPR}, Zhou \latinabbrev{et al}~\cite{weak17ICCV}, Tome \latinabbrev{et al}~\cite{lfd17CVPR}, our model and the ground truth are illustrated from left to right. Our model achieves considerably more accurate estimations than all the compared methods. Best viewed in color. Red and green indicate left and right, respectively.}
\vspace{-5pt}
\label{fig:h3m_vis}
\end{figure*}
\begin{figure*}[t]
\center
\includegraphics[width= 0.7 \textwidth]{self-correction}
\vspace{-5pt}
\caption{Qualitative comparisons of ours and ours w/o self-correction on the Human3.6M dataset. The input image, estimated 2D pose, ours w/o self-correction, ours and ground truth are listed from left to right, respectively. With the ground truth as reference, one can easily observe that the inaccurately predicted human 3D joints in ours w/o self-correction are effectively corrected in ours. Best viewed in color. Red and green indicate left and right, respectively.}
\vspace{-8pt}
\label{fig:ssr}
\end{figure*}
\begin{table*}[tpb]
\caption{Empirical comparisons \kezen{under} different settings for ablation study using Protocol \#1. The entries with the smallest 3D pose errors on the Human3.6M dataset for each category are bold-faced.}
\vspace{-5pt}
\centering
\setlength{\tabcolsep}{1.5pt}
\begin{adjustbox}{max width=1.0\textwidth}
\begin{tabular}{@{}c|ccccccccccccccc|c@{}}
\toprule
Method & Direction & Discuss & Eating & Greet & Phone & Pose & Purchase & Sitting & SitDown & Smoke & Photo & Wait & Walk & WalkDog & WalkPair & Avg. \\ \midrule
{Ours w/o SSC train+test} & 62.89 & 74.74& 67.86& 73.33 &79.76 & 67.48 &76.19& 100.21& 148.03 & 75.95& 100.26& 75.82& 58.03 & 78.74& 62.93& 80.15 \\
\keze{Ours w/o SSC test} & \keze{52.95} & \keze{63.82} & \keze{57.15} & \keze{59.42} & \keze{68.83} & \keze{55.81} & \keze{57.75} & \keze{95.44} & \keze{125.70} & \keze{66.23} & \keze{82.91} & \keze{64.22} & \keze{44.24} & \keze{69.49} & \keze{50.54} & \keze{67.63} \\
\keze{Ours w/o projection} & \keze{69.46} & \keze{81.86} & \keze{74.46} & \keze{78.46} & \keze{85.14} & \keze{72.50} & \keze{85.39} & \keze{112.12} & \keze{158.14} & \keze{80.37} & \keze{115.46} & \keze{77.10} & \keze{58.38} & \keze{87.60 } & \keze{65.54} & \keze{86.80} \\
{Ours w/o temporal} & 70.46 & 83.36 & 76.46 & 80.96 & 88.14 & 76.00 & 92.39 & 116.62 & 163.14 & 85.87 & 111.46 & 83.60 & 65.38 & 95.10 & 73.54 & 90.83 \\
{Ours w/ single frame} & 51.76 & 63.46 & 56.93 & 59.93 & 69.58 & 54.02 & 59.55 & 90.83 & 129.6 & 65.49 & 84.08 & 61.63 &45.07 & 70.33 & 53.21 & 67.70 \\
{Ours w/o external} & 91.58 &109.35&93.28&98.52&102.16&93.87&118.15&134.94 &190.6&109.39&121.49&101.82&88.69&110.14&105.56&111.3 \\
{Ours} &50.03& 59.96&54.66&56.55&65.65&52.74& 54.81&85.85&117.98&62.48 &79.63& 59.55& 41.48& 65.21 &48.52& 63.67 \\
\keze{Ours w/ HG features} & \keze{49.34} & \keze{59.09} & \keze{54.08} & \keze{56.26} & \keze{64.48} & \keze{51.89} & \keze{54.09} & \keze{83.85} & \keze{116.55} & \keze{61.47} & \keze{78.52} & \keze{58.68} & \keze{41.48} & \keze{64.49} & \keze{48.48} & \keze{62.85} \\
{Ours w/ 2D GT} & \bf 48.37& \bf 57.10& \bf 49.81& \bf 54.84& \bf 57.23& \bf 50.88& \bf 51.62& \bf 76.00& \bf 109.8 & \bf 55.28& \bf 74.52& \bf 56.98& \bf 40.16& \bf 61.29& \bf 47.15& \bf 59.41 \\
\bottomrule
\end{tabular}
\end{adjustbox}
\label{table:h3m_across_stages}
\label{tab:rpsm-rho3-ext}
\label{table:h3m_across_time}
\end{table*}
\begin{figure*}[t]
\center
\vspace{-10pt}
\includegraphics[width= 1 \textwidth]{2d_human_data}
\vspace{-15pt}
\caption{Some qualitative comparisons of our model and Zhou \latinabbrev{et al}~\cite{weak17ICCV} on two representative datasets in the wild, i.e., KTH Football II~\cite{kth_2013_BMVC} (first row) and MPII datasets~\cite{andriluka14cvpr} (the \kezen{remaining} rows). For each image, the original viewpoint and a better viewpoint are illustrated. Best viewed in color. Red and green indicate left and right, respectively.}
\vspace{-8pt}
\label{fig:2d_data}
\end{figure*}
\textbf{Implementation Details:}
\kezen{For} We follow \cite{graves2014towards} to build the LSTM memory cells, except that the peephole connections between cells and gates are omitted. Following~\cite{zhou2015sparseness,li2015maximum}, the input image is cropped around the human. To \kezen{maintain} the human width / height ratio, we crop a square image of the subject from the image according to the bounding box provided by the dataset. Then, we resize the image region inside the bounding box \kezen{to} 368$\times$368 before feeding it into our model. Moreover, we augment the training data \kezen{by simply performing} random scaling with factors in [0.9,1.1]. To transform the absolute locations of joint points into the [0,1] range, a $\text{max-min}$ normalization strategy is applied. In the testing phase, the predicted 3D pose is transformed to the origin scale according to the maximum and minimum values of the pose from the training frames. During the training, the Xavier initialization method \cite{glorot2010understanding} \kezen{is} used to initialize the weights of our model. \kezen{A} learning rate of $1e^{-5}$ is employed for training. The training phase \kezen{requires} approximately 2 days on a single NVIDIA GeForce GTX 1080.
\textbf{Evaluation metric.} Following \cite{zhou2015sparseness,DBLP:conf/eccv/DuWLHGWKG16,Tekin_2016_CVPR,rpsm17CVPR,weak17ICCV,pavlakos2017volumetric}, we employ the popular \emph{3D pose error} metric~\cite{simo2012single}, which calculates the Euclidean errors on all joints and all frames up to translation. In the following section, we report the 3D pose error metric for all the experimental comparisons and analyses.
\subsection{Comparisons with \kezen{Existing Methods}}
\textbf{Comparison on Human3.6M:}
\label{section:human3.6m_result}
We compare our model with the various \kezen{competing} methods on the Human3.6M \cite{huamn3.6m} and HumanEva-I \cite{sigal2010humaneva} datasets. For the fair comparison, we only consider the \kezen{competing} methods that do not need the intrinsic parameters of cameras for inference. This is reasonable for practical use under various scenarios. These methods are LinKDE~\cite{huamn3.6m}, Tekin \latinabbrev{et al} \cite{Tekin_2016_CVPR}, Li \latinabbrev{et al} \cite{li2015maximum}, Zhou \latinabbrev{et al} \cite{zhou2015sparseness}, Zhou \latinabbrev{et al} \cite{zhou2016deep}, Du \latinabbrev{et al} \cite{DBLP:conf/eccv/DuWLHGWKG16}, Sanzari \latinabbrev{et al} \cite{DBLP:conf/eccv/SanzariNP16}, Yasin \latinabbrev{et al}~\cite{ds16CVPR}, and Bogo \latinabbrev{et al}~\cite{bogo2016keep}. Moreover, we compare \kezen{other competing} methods, i.e., Moreno-Noguer \latinabbrev{et al}~\cite{DMR17CVPR}, Tome \latinabbrev{et al}~\cite{lfd17CVPR}, Chen \latinabbrev{et al}~\cite{pem17CVPR}, Pavlakos \latinabbrev{et al}~\cite{pavlakos2017volumetric}, Zhou \latinabbrev{et al}~\cite{weak17ICCV}, Bruce \latinabbrev{et al}~\cite{Nie_2017_ICCV}, Tekin \latinabbrev{et al}~\cite{Tekin_2017_ICCV} and our conference version, i.e., Lin \latinabbrev{et al}~\cite{rpsm17CVPR}. For those compared methods (i.e., \cite{huamn3.6m, Tekin_2016_CVPR, li2015maximum, zhou2016deep, DBLP:conf/eccv/DuWLHGWKG16, DBLP:conf/eccv/SanzariNP16, ds16CVPR, bogo2016keep, DMR17CVPR, pem17CVPR, Nie_2017_ICCV}) whose source codes are not publicly available, we directly obtain their results from their published papers. For the other methods (i.e., \cite{zhou2015sparseness, lfd17CVPR, weak17ICCV, pavlakos2017volumetric, rpsm17CVPR, Tekin_2017_ICCV}), we directly use their official implementations for comparisons.
The results under three different protocols are summarized in Table \ref{table:h3m_res}. \kezen{Clearly,} our model outperforms all the competing methods (including \kezen{those} trained from the individual action as \kezen{in} \cite{pem17CVPR,li2015maximum,Tekin_2016_CVPR} and \kezen{on} all 15 actions) under {\em Protocol \#1}. Specifically, under the training from individual action setting, our model achieves superior performance on all the action types, and it \kezen{outperforms the best} competing methods with the joint mean error reduced by approximately 8\% compared with Tekin \latinabbrev{et al}~\cite{Tekin_2017_ICCV} (63.79mm {\em vs} 69.73mm). Under the training from all 15 actions, our model still consistently performs better than the compared approaches and obtains \kezen{better} accuracy. Notably, our model achieves a performance gain of nearly 12\% compared with our conference version (63.67mm {\em vs} 73.10 mm).
\kezen{The similar} superior performance of our model over all the compared methods can also be observed under {\em Protocol \#2} and {\em Protocol \#3}. Specifically, our model outperforms the best of the competing methods with the joint mean error reduced by approximately 19\% (63.74mm {\em vs} 79.6mm) under {\em Protocol \#2} and 16\% (54.14mm {\em vs} 70.70mm) under {\em Protocol \#3}.
In summary, our proposed model significantly outperforms all compared methods under all protocols with the mean error reduced by a clear margin. Note that some compared methods, \latinabbrev{e.g}, \cite{li2015maximum,Tekin_2016_CVPR,DBLP:conf/eccv/DuWLHGWKG16,zhou2015sparseness,zhou2016deep,rpsm17CVPR,weak17ICCV,pavlakos2017volumetric,lfd17CVPR}, also employ deep learning techniques. In particular, Zhou \latinabbrev{et al}~\cite{zhou2016deep}'s method used the residual network~\cite{he2015deep}. Note that, the recently proposed methods all employ very deep network \kezen{architectures} (i.e., \cite{weak17ICCV} and \cite{pavlakos2017volumetric} proposed using Stacked Hourglass~\cite{newell2016stacked}, while \cite{rpsm17CVPR} and \cite{lfd17CVPR} employed CPM~\cite{wei2016convolutional}) to obtain satisfactory \kezen{accuracies}. This makes these methods time-consuming. In contrast to these methods, our model \kezen{achieves} a more lightweight architecture by replacing the multi-stage refinement in \cite{rpsm17CVPR} with the 3D-to-2D pose projector module. The superior performance achieved by our model demonstrates that our model is simple yet powerful in capturing complex contextual features within images, learning temporal dependencies within image sequences and preserving the geometric consistency within 3D pose predictions, which are critical for estimating 3D pose sequences. Some visual comparison results are presented in Fig.~\ref{fig:h3m_vis}.
\textbf{Comparison on HumanEva-I:}
We compare our model against \kezen{competing} methods, \kezen{including} discriminative regressions~\cite{bo2010twin,BMVC2880}, 2D pose detector-based methods \cite{simo2012single,SimoSerraCVPR2013,wang2014robust,yasin2016dual}, CNN-based approaches \cite{Tekin_2016_CVPR,yasin2016dual,pavlakos2017volumetric,DMR17CVPR,Tekin_2017_ICCV} and our preliminary version Lin \cite{rpsm17CVPR}, \kezen{on the HumanEva-I dataset}. For a fair comparison, our model also predicts the 3D pose consisting of 14 joints, i.e., left/right shoulder, elbow, wrist, left/right hip knee, ankle, head top and neck, as \cite{yasin2016dual}.
Table \ref{table:hevai_res} presents the performance comparisons of our model with all compared methods. \kezen{Clearly,} our model obtains substantially lower 3D pose errors than the compared methods on \keze{all} the \emph{walking, jogging and boxing} sequences. This result demonstrates the high generalization capability of our proposed model.
\subsection{Running \kezen{Time}}
\kezen{To compare} the efficiencies of our model and of the compared methods, we have conducted all the experiments on a desktop with an Intel 3.4GHz CPU and a single NVIDIA GeForce GTX 1080 \kezen{GPU}. In terms of time efficiency, compared with \cite{zhou2015sparseness} (880 ms per image), \cite{pavlakos2017volumetric} (170 ms per image), \cite{weak17ICCV} (311 ms per image), and \cite{lfd17CVPR} (444 ms per image), our model model only \kezen{requires} 51 ms per image. The detailed time analysis is presented in Table~\ref{table:efficiency}. Our model performs approximately 3 times faster than \cite{pavlakos2017volumetric}, which is the fastest of the compared methods. Moreover, although only performing slightly better than the best of the compared methods \cite{weak17ICCV} under {\em Protocol \#1}, our model runs nearly 6 times faster, thanks to the 3D-to-2D pose projector module \kezen{enabling a} lightweight architecture. This result validates the efficiency of our proposed model.
\subsection{\keze{Ablation Study}}
To perform a detailed component analysis, we conducted the experiments on the Human3.6M \keze{benchmark} under the {\em Protocol \#1} and our proposed model was trained on all \keze{actions} for a fair comparison.
\subsubsection{\keze{Self-supervised Correction} Mechanism}
\keze{To demonstrate the superiority of the proposed \keze{self-supervised} correction (SSC) mechanism, we conduct the following experiment: disabling this module in both training and inference phase by directly regarding the intermediate 3D pose predictions as the final output \keze{(denoted as ``ours w/o SSC train+test'')}. Moreover, we have also disabled the self-supervised correction mechanism during the inference phase and denote this version as “ours w/o SSC test".
The results in Table~\ref{tab:rpsm-rho3-ext} demonstrate that our w/o SSC test significantly outperforms ours w/o SSC train+test (67.63mm vs 80.15mm), and our model surpasses ours w/o SSC test by a clear margin (63.67mm vs. 67.63mm). These observations justify the contribution of the proposed SSC mechanism. This result demonstrates that the \keze{self-supervised correction} mechanism is highly beneficial for improving the performance both in the training and testing phase.} Qualitative comparison results on the Human3.6M dataset are shown in Fig.~\ref{fig:ssr}. As depicted in Fig.~\ref{fig:ssr}, the intermediate 3D pose predictions (i.e., ours w/o self-correction) contain several inaccurate joint locations compared with the \kezen{ground truth} because of the self-occlusion of body parts. However, the predicted 2D poses are of high accuracy \kezen{because of} the powerful CNN, which is trained from a large variety of 2D pose data. Because the estimated 2D poses are more reliable, our proposed 3D-to-2D pose projector module can utilize them as optimization objectives to \keze{bidirectionally} refine the 3D pose predictions. As shown in Fig.~\ref{fig:ssr}, the joint predictions are effectively corrected by our model. This experiment clearly demonstrates that our 3D-to-2D pose projector, utilizing these predicted 2D poses as guidance, can contribute to enhancing 3D human pose estimation by correcting the 3D pose predictions without additional 3D \keze{pose} annotations.
To further \kezen{upper bound the} performance of the proposed \keze{self-supervised correction} mechanism \keze{in the testing phase}, we directly \keze{employ the 2D pose ground-truth }to correct the intermediate predicted 3D poses. We denote this version of our model as ``ours w/ 2D GT''. Table~\ref{tab:rpsm-rho3-ext} demonstrates that ours w/ 2D GT achieves significantly better results than our model by reducing the mean joint error by approximately 6\% (59.41mm {\em vs} 63.67mm). \keze{Moreover, we have also implemented another 2D pose prediction model from the hourglass network with two stages for self-supervised correction (denoted as ``ours w/ HG features''). Our method w/ HG features performs slightly better than ours (62.85mm vs 63.67mm).} This result \kezen{evidences} the effectiveness of our designed 3D-to-2D pose projector module in \keze{bidirectionally} refining the intermediate 3D pose estimation.
\keze{
We have further compared our method with a multi-task approach that simultaneously estimates 3D and 2D pose without re-projection (denoted as ``ours w/o projection''). Specifically, ours w/o projection shares the same network architecture as our full model. The only difference is that ours w/o projection directly estimates both 2D and 3D poses during the training phase. Since it is quite difficult to directly train the network into convergence with huge 2D pose data and relatively small 3D pose data, we first optimize the network parameters by using the 2D pose data only from the MPII dataset, and further perform training with the 2D pose data and 3D pose data from the Human3.6M dataset.
As illustrated in Table~\ref{tab:rpsm-rho3-ext}, our full model performs substantially better than ours w/o projection (63.67mm vs 86.80mm). The reason may be that directly regressing the 2D pose may mislead the main learning task of the model, i.e., the network concentrates on improving the overall performance of both 2D and 3D pose prediction. This demonstrates the effectiveness of the proposed 3D-to-2D pose projector module.
}
\subsubsection{Temporal Dependency}
The model performance without temporal dependency in the training phase is also compared in Table~\ref{tab:rpsm-rho3-ext} (denoted as ``ours w/o temporal''). Note that the input of ours w/o temporal is only a single image rather than a sequence \kezen{in} the training and testing \kezen{phases}. Hence, the temporal information is ignored. Thus, the LSTM layer \kezen{for the} 3D pose errors is replaced \kezen{by} a fully connected layer with the same units as the LSTM layer. As illustrated in Table~\ref{tab:rpsm-rho3-ext}, ours w/o temporal has \kezen{suffered} considerably higher 3D pose errors than ours (90.83mm vs 63.67mm). Moreover, we have also analyzed the contribution of the temporal dependency in the testing phase. To discard the temporal dependency during the inference \keze{phase}, we \kezen{regarded} a single frame as input to evaluate the performance of our model, and we denote it as ``ours w/ single frame''. Table~\ref{tab:rpsm-rho3-ext} demonstrates that \keze{this variant} performs worse \kezen{compared to} ours by increasing the mean joint error by approximately 6\% (67.70mm {\em vs} 63.67mm). This result validates the contribution of temporal information for 3D human pose estimation during the training and testing \kezen{phases}.
\subsubsection{External 2D Human Pose Data}
To evaluate the performance without external 2D human pose data, we have only employed 3D pose data with 3D and 2D annotations from Human3.6M for training our model. We denote this version of our model as ``ours w/o external''. As shown in Table~\ref{tab:rpsm-rho3-ext}, \kezen{the} ours w/o external version performs quite worse than our model (63.67mm {\em vs} 111.30mm). This reason may be \kezen{that} the training samples \keze{from Human3.6M}, compared with the MPII dataset~\cite{andriluka14cvpr}, are less challenging\kezen{, therein having} fewer variations for our model to learn a rich and powerful 2D pose presentation. Thanks to the proposed self-supervised correction mechanism, our model can effectively leverage a large variety of 2D human pose data to improve the performance of the 3D human pose estimation.
Moreover, \keze{in terms of} estimating 3D human pose in the wild, our model advances the existing method~\cite{weak17ICCV} in leveraging more abundant 3D geometric knowledge for mining in-the-wild 2D human pose data. Instead of oversimplifying the 3D geometric constraint as the relative bone length in \cite{weak17ICCV}, our model introduces a \keze{self-supervised correction mechanism} to retain the 3D geometric consistency between the 2D projections of 3D poses and the estimated 2D poses. Therefore, our model can \keze{bidirectionally} refine the 3D pose predictions in a self-supervised manner. Fig.~\ref{fig:2d_data} presents qualitative comparisons for images taken from the KTH Football II~\cite{kth_2013_BMVC} and MPII dataset~\cite{andriluka14cvpr}, \keze{respectively}. As \keze{shown in} Fig.~\ref{fig:2d_data}, our model achieves 3D pose predictions of \kezen{superior accuracy compared to the competing} method~\cite{weak17ICCV}.
\section{Conclusion}
\label{sec:conclude}
This paper presented a 3D human \kezen{pose machine that} can learn to integrate rich spatio-temporal long-range dependencies and 3D geometry knowledge in an implicit and comprehensive manner. We further enhanced our model by developing a novel self-supervised correction mechanism, which involves two dual learning tasks, i.e., 2D-to-3D pose transformation and 3D-to-2D pose projection, under a \keze{self-supervised correction} mechanism. This mechanism retains the geometric consistency between the 2D projections of 3D poses and the estimated 2D poses, and it enables our model to utilize the estimated 2D human pose to \keze{bidirectionally} refine the intermediate 3D pose estimation. Therefore, our proposed self-supervised correction mechanism can bridge the domain gap between 3D and 2D human poses to leverage the external 2D human pose data without requiring additional 3D annotations. \kezen{Extensive} evaluations on two public 3D human pose datasets validate the effectiveness and \kezen{superiority} of our proposed model. In \keze{future work}, focusing on sequence-based human centric analyses (e.g., human action and activity recognition), we will extend our proposed \keze{self-supervised correction} mechanism for temporal relationship modeling, and design new self-supervision objectives to incorporating abundant 3D geometric knowledge for training models in a cost-effective \kezen{manner}.
\ifCLASSOPTIONcompsoc
\section*{Acknowledgments}
\else
\section*{Acknowledgment}
\fi
This work was supported in part by the National Key Research and Development Program of China under Grant No. 2018YFC0830103, in part by National High Level Talents Special Support Plan (Ten Thousand Talents Program), in part by National Natural Science Foundation of China (NSFC) under Grant No. 61622214, and 61836012, in part by the Ministry of Public Security Science and Technology Police Foundation Project No. 2016GABJC48, and in part by Guandong ``Climbing Program'' special funds under Grant pdjh2018b0013.
\ifCLASSOPTIONcaptionsoff
\newpage
\fi
\bibliographystyle{IEEEtran}
| {'timestamp': '2019-01-16T02:06:36', 'yymm': '1901', 'arxiv_id': '1901.03798', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03798'} | arxiv |
\section{Introduction}
\label{sec:introduction}
We focus on the problem of learning to generate
\emph{variations} of a given input in an intended way. Concretely, this means that
given some input element $x$, which can be considered as a \emph{template},
we want to generate some transformed versions of $x$ by only modifying its
high-level \emph{attributes}. The objective is that the link between
the original $x$ and its transformed version is preserved while the
difference between their attributes is patent.
Such a mechanism can be of great use in many
domains such as image edition since it allows to edit images using
more abstract controls and can be of crucial importance for creative usages since it
allows to generate new content in a controlled and meaningful way.
In a majority of the recent proposed methods tackling this problem such as
\cite{upchurch2016deep,DBLP:journals/corr/LampleZUBDR17,DBLP:journals/corr/abs-1812-04218}, the
attributes of interest that we want to control are assumed to be
given (often given as a discrete variable).
If these methods are indeed successful in generating meaningful
transformations of any input, we can nonetheless identify two shortcomings which can restrict their use:
1) Labeled data is not always available or can be costly to obtain;
2) Attributes which can be hard to specify in an absolute way cannot be
considered.
The novelty of our approach resides in the fact that it grants the possibility, under
the same framework, to control generations by modifying
user-specified attributes but also to
\emph{learn} some meaningful high-level attributes at the same time,
which can be used for control.
This problem may seem to be an ill-posed one on many aspects:
Firstly, in the case of specified attributes,
there is no ground truth for variations since there is no $x$ with two
different attributes. Secondly, it can be hard to determine if a
learned attribute is relevant. However, we provide empirical
evidence that our general approach is capable of learning such
relevant attributes and that they can be used for generating
meaningful variations.
This paper introduces the \emph{Variation Network} (VarNet), a
probabilistic neural network which provides means to manipulate an
input by changing its high-level attributes, which can be either
learned or provided.
Our model has a
sound probabilistic interpretation which makes the variations obtained
by changing the attributes statistically meaningful.
This architecture is general and provides a wide range of design
choices.
Our contributions are the following:
\begin{itemize}
\item A widely applicable encoder-decoder architecture which generalizes
existing approaches
\cite{2013arXiv1312.6114K,2018arXiv180203761R,DBLP:journals/corr/LampleZUBDR17,DBLP:journals/corr/abs-1812-04218}
on controlled input manipulation,
\item An easy-to-use framework: any encoder-decoder architecture can be easily
framed into our framework in order to provide it control over
generations, even in the case of unlabeled data,
\item Information-theoretic interpretation of our model providing a way to control the behavior of the learned attributes.
\end{itemize}
The plan of this paper is the following: Sect.~\ref{sec:model}
presents the VarNet architecture together with its training
algorithm. For better clarity, we introduce separately all the
components featured in our model and postpone the discussion about
their interplay and the motivation behind our modeling choices in
Sect.~\ref{sec:comments} We illustrate in
Sect.~\ref{sec:experiments} the possibilities offered by our
proposed model and show that its faculty to generate variations in an
intended way is of particular interest.
Finally, Sect.~\ref{sec:related-work} discusses
about the related works. In particular, we show that VarNet provides
an interesting solution to many constrained generation problems
already considered in the literature while bearing interesting
connections with the literature in fair representations
\cite{2015arXiv151100830L,DBLP:journals/corr/abs-1812-04218} and
disentangled representations
\cite{higgins2016beta,2018arXiv180403599B,locatello2018challenging}.
Our code is available at \url{https://github.com/Ghadjeres/VarNet}.
\section{Proposed model}
\label{sec:model}
We now introduce our novel encoder-decoder architecture which we name
\emph{Variation Network}. Our architecture borrows principles from the
traditional Variational AutoEncoder (VAE) architecture
\cite{2013arXiv1312.6114K} and from the Wasserstein AutoEncoder (WAE)
architecture \cite{2017arXiv171101558T,2018arXiv180203761R}.
It uses an adversarially learned regularization
\cite{2016arXiv160600704D,DBLP:journals/corr/LampleZUBDR17},
introduces a decomposition of the latent space into two parts, a
template $z$ and an \emph{attribute} $\psi$
\cite{pmlr-v80-adel18a} and decomposes the attributes on an adaptive
basis \cite{DBLP:journals/corr/abs-1803-09017}.
We detail in the following sections the different
parts involved in our model. In Sect.~\ref{sec:encdec}, we focus on the encoder-decoder part of
VarNet, in
Sect.~\ref{sec:disentangling}, we introduce the adversarially-learned
regularization whose aim is to disentangle attributes from templates
and in
Section~\ref{sec:attr-space}, we discuss about the special
parametrization that we adopted for the space of attributes.
\subsection{Encoder-decoder part}
\label{sec:encdec}
We consider a dataset $\mathcal{D} = \{(x^{(1)}, m^{(1)}), \dots,
(x^{(N)}, m^{(N)})\}$ of $N$ labeled elements $(x,m) \in \mathcal{X} \times
\mathcal{M}$, where $\mathcal{X}$ stands for the input space and
$\mathcal{M}$ for the metadata space. Here, metadata information
is optional as our architecture is also applicable in the totally
unsupervised case. We suppose that the $x$'s follow the data
distribution $\pi(x)$, that for each $x \in \mathcal{X}$ corresponds a unique
label $m$ and write $\pi(x, m)$ the distribution of the $x$'s together
with their metadata information.
Similar to the VAE architectures, we suppose that our data $x \in \mathcal{X}$ depends
on a couple of low-dimensional latent variable $z \in \mathcal{Z} \subset
\mathbf{R}^{d_z}$ and $\psi \in \Psi \subset \mathbf{R}^{d_\psi}$ through some decoder
$p(x|z,\psi)$ parametrized by a neural network. In this paper, we term the $z$
variables \emph{templates} and the $\psi$ variable
\emph{attributes}. More details about
the attribute space $\Psi$ are given in
Sect.~\ref{sec:attr-space}.
We introduce a factorized prior $p(z, \psi) = p(z)p(\psi)$
over this latent space so that the joint probability distribution is
expressed as
$p(x,z,\psi) = p(x|z,\psi)p(z)p(\psi)$. The objective is to maximize
the log-likelihood $\mathbf{E}_{(x,m) \sim \mathcal{D}} \log \pi(x)$ of
the data under the model.
Since the posterior distribution $p(z|x)$ is
usually intractable, an approximate posterior distribution $q(z|x)$
parametrized by a neural network is
introduced (for simplicity, we let the approximate posterior depend on
$x$ only, but considering $q(z|x,m)$ or even $q(z|x,\psi)$ is feasible). Concerning the computation of $\psi$ given $x$, we introduce a
\emph{deterministic} function $f(x,m)$ parametrized by a neural network, which can eventually rely on metadata
information $m$.
We then obtain the
following mean reconstruction loss:
\begin{equation}
\label{eq:re}
\mathrm{RE} := -\mathbf{E}_{(x,m) \sim \pi} \mathbf{E}_{z
\sim q(z| x)} \log p(x | z, f(x,m)),
\end{equation}
and regularize the latent space $\mathcal{Z}$ by
adding the usual Kullback-Leibler ($\mathrm{KL}$) divergence term appearing in the VAE Evidence
Lower Bound (ELBO) on $\mathcal{Z}$:
\begin{equation}
\label{eq:kl}
\mathrm{KL} := \mathbf{E}_{z \sim q(z|x)} \log \frac{q(z|x)}{p(z)}.
\end{equation}
\subsection{Disentangling attributes from templates}
\label{sec:disentangling}
Our decoder $p(x| z, \psi)$ thus depends exclusively on $z$ and on
features $\psi$.
However, there is no reason for a random
attribute $\psi \in \Psi \neq f(x, m)$ that $\hat{x} \sim p(.|z,\psi)$, where $z
\sim q(z|x)$, is a meaningful
variation of the original $x$. Indeed, all needed information for
reconstructing $x$ could
potentially be already contained in $z$ and changing $\psi$ could have
no effect on the reconstructions.
To enforce this property, we propose to add an adversarially-learned cost on the latent
variables $z$ and $\psi$ to force
the encoder $q$ to discard information about the attribute $\psi = f(x,m)$ of
$x$: Specifically, we train a discriminator neural network
$D:\mathcal{Z} \times \Psi \to [0, 1]$ whose role is to evaluate the
probability $D(z, \psi)$ that there exists a pair $(x, m) \in
\mathcal{D}$ such that $\psi = f(x, m)$ and $z \sim q(z|x)$. In
other words, the aim of the discriminator is to determine if the attributes
$\psi$ and the template code $z$ originate from the same $(x, m) \in
\mathcal{D}$ or if the features $\psi$ are sampled from the prior
$p(\psi)$.
The encoder-decoder architecture
presented in Sect.~\ref{sec:encdec} is trained to fool the
discriminator: this means that, for a given $(x, m) \in \mathcal{D}$, it tries to produce a template code
$z \sim q(z|x)$ and features $\psi = f(x,m)$ such that no information about
the features could be recovered from $z$.
In an optimal setting, i.e. when the discriminator is
unable to match any $z \in \mathcal{Z}$ with a particular feature $\psi \in
\Psi$, the space of template codes and the space of
attributes are decorrelated and the aggregated distribution of the
$\psi$'s $f_*(\pi)$ (the pushforward measure of $\pi$ by $f$)
matches the prior $p(\psi)$.
The discriminator is trained to maximize
\begin{equation}
\label{eq:disctrain}
\mathcal{L}_\mathrm{Disc} := \mathbf{E}_{(x,m) \sim \pi} \mathbf{E}_{z \sim q(z|x)} \mathbf{E}_{\psi \sim p(\psi)} \big[\log
D(z, \psi) + \log(1 - D(z, f(x, m)))
\big].
\end{equation}
while the encoder-decoder architecture is trained to minimize
\begin{equation}
\label{eq:4}
\mathcal{R}_\mathrm{Disc} := - \mathbf{E}_{(x,m) \sim \pi}
\mathbf{E}_{z \sim q(z|x)} \mathbf{E}_{\psi \sim p(\psi)} \big[ \log D(z, f(x, m)) + \log( 1 - D(z,\psi)) \big].
\end{equation}
This is the same setting as in
\cite{2016arXiv160600704D,2017arXiv171101558T} but other GAN training
methods could be considered
\cite{DBLP:journals/corr/abs-1902-05687}. Note the presence of two terms in
Eq.~(\ref{eq:4}), since the ``true'' examples depend on training
parameters.
The final objective we minimize for the encoder-decoder architecture is a combination of a reconstruction
loss Eq.~(\ref{eq:re}), a Kullback-Leibler penalty on $z$
Eq.~(\ref{eq:kl}) and the adversarially-learned loss
Eq.~(\ref{eq:4}).
Our final architecture is shown in
Fig.~\ref{fig:model} and the proposed training procedure in shown in
Alg.\ref{alg:1}. Estimators of Eq.~(\ref{eq:disctrain}), Eq.~(\ref{eq:re}) and (\ref{eq:4}) are given by
Eq.~(\ref{eq:3}), Eq.~(\ref{eq:6}) and (\ref{eq:rdisc}) respectively. The
the estimator $\mathrm{KL}_n$ of the KL term can be either sampled or computed in closed form.
\begin{figure}[t]
\centering
\includegraphics[width=0.4\textwidth]{Varnet}
\caption{VarNet architecture. The input $x$, and its reconstruction
$\hat{x}$ are in the input space $\mathcal{X}$, the metadata $m$ is
in the metadata space $\mathcal{M}$, the latent variable $z$ lies in
$\mathcal{Z}$ the latent template
space and the attributes $\psi$ are in the attribute space $\Psi$.
Dotted arrows represent identity mappings, filled arrows represent
neural networks and the circled plus sign represents the
concatenation of its two incoming arguments.
The
discriminator $D$ acts on $\mathcal{Z} \times \Psi$.
}
\label{fig:model}
\end{figure}
\begin{algorithm}[h!]
\caption{Variation Network training procedure}
\label{alg:1}
\begin{algorithmic}[1]
\REQUIRE Dataset $\mathcal{D} = \left\{(x^{(i)},
m^{(i)}\right\}_{i=1..N}$, reconstruction cost $c$,\\reproducing kernel $k$, batch size
$n$
\FOR{Fixed number of iterations}
\STATE Sample $x := (x_1, \dots, x_n)$ and $m := (m_1, \dots, m_n)$
where $(x_i, m_i)$ are i.i.d. samples from $\mathcal{D}$
\STATE Sample $z_i \sim q(z|x_i)$
\STATE Sample $\hat{x} := \{ \hat{x}_1, \dots, \hat{x}_n \}$ where $\hat{x}_i \sim p(x|z_i,f(x_i,m_i)$,
\STATE Sample random features $\{\psi_i\}_{i = 1..n} \sim p(\psi)$
\STATE \emph{Discriminator training phase}
\STATE Compute
\begin{equation}
\label{eq:3}
\mathcal{L}_{\textrm{Disc}, n} := \frac{1}{n}\sum_{i=1}^n \log D\left(z_i, \psi_i\right)
+ \log \left(1 - D(z_i, f(x_i, m_i))\right)
\end{equation}
\STATE Gradient ascent step on the discriminator parameters using
$\nabla \mathcal{L_\textrm{Disc}}$
\STATE \emph{Encoder-decoder training phase}
\STATE Compute
\begin{equation}
\label{eq:lenc}
\mathcal{L}_{\mathrm{EncDec}, n} := \mathrm{RE}_n + \beta
\mathrm{KL}_n + \gamma \mathcal{R}_{\mathrm{Disc}, n}
\end{equation} where
\begin{equation}
\label{eq:6}
\mathrm{RE}_n := - \frac{1}{n} \sum_{i=1}^n \log p (x_i|z_i,f(x_i,m_i)),
\end{equation}
\begin{equation}
\mathcal{R}_{\mathrm{Disc}, n} = - \frac{1}{n}\sum_{i=1}^n
\log D(z_i, f(x_i, m_i))
+ \log (1 - D(z_i, \psi_i)).
\label{eq:rdisc}
\end{equation}
\STATE Gradient ascent step on all parameters except on the discriminator parameters using
$\nabla \mathcal{L_\textrm{EncDec}}$
\ENDFOR
\end{algorithmic}
\end{algorithm}
\subsection{Parametrization of the attribute space}
\label{sec:attr-space}
We adopt a particular parametrization of our attribute function
$f: \mathcal{X} \times \mathcal{M}$. In the following, we make a distinction between
two different cases: the case of
continuous \emph{free attributes} and the case of fixed continuous or
discrete attributes.
\subsubsection{Free attributes}
\label{sec:free-attr}
In order to handle free attributes, which denote attributes that are
not specified \emph{a priori} but learned we introduce $d$ \emph{attribute vectors} $v_i$ of dimension $d_\psi$ together with an
\emph{attention module} $\alpha: \mathcal{X} \times \mathcal{M} \to [0,
1]^{d}$. By denoting $\alpha_i$ the coordinates of $\alpha$, we
then write our attribute function $f$ as
\begin{equation}
\label{eq:2}
f(x, m) = \sum_{i=1}^{d} \alpha_i(x, m) v_i.
\end{equation}
This approach is similar to the \emph{style tokens} approach presented
in \cite{DBLP:journals/corr/abs-1803-09017}. The $v_i$'s are global
and do not depend on a particular instance $(x, m)$. By varying the values of the
$\alpha_i$'s between $[0, 1]$, we can then span a $d$-dimensional
hypercube in $\mathbf{R}^{d_\psi}$ which stands for our
\emph{attribute space} $\Psi$. It is worth noting that the $v_i$'s are
also learned and thus constitute an adaptive basis of the attribute
space.
The prior $p(\psi)$ over $\Psi$ (note that
this subspace also varies during training) is obtained by pushing forward fixed
distribution $\nu_\alpha$ over $[0, 1]^{d}$ (often considered to be
the uniform distribution) using Eq.~(\ref{eq:sampling-psi}):
\begin{equation}
\label{eq:sampling-psi}
\psi \sim p(\psi) \quad \Longleftrightarrow \quad \psi =
\sum_{i=1}^{d}\alpha_i v_i \quad \textrm{where} \quad \alpha_i \sim \nu_\alpha.
\end{equation}
\subsubsection{Fixed attributes}
\label{sec:fixed-attr}
We now suppose that the metadata variable $m \in \mathcal{M}$ contains
attributes that we want to vary at generation time. For
simplicity, we can suppose that this metadata information can be
either continuous with values in $[0, 1]^M$ (with a natural order on
each dimension) or discrete with values in
$[|0, M|]$.
In the continuous case, we write our attribute function
\begin{equation}
\label{eq:cont-attr}
f(x, m) = \sum_{i=1}^M m_i v_i
\end{equation}
while in the discrete case, we just consider
\begin{equation}
\label{eq:disc-attr}
f(x, m) = e_m,
\end{equation}
where $e_m$ is a $d_\psi$-dimensional embedding of the symbol $m$. It
is important to note that even if the attributes are fixed, the
$v_i$'s or the embeddings $e_m$ are learned during training.
These two equations define a prior $p(\psi)$ via:
\begin{equation}
\psi \sim p(\psi) \quad \Longleftrightarrow \quad \psi = f(x, m) \quad
\textrm{where} \quad (x, m) \sim \mathcal{D}.\label{eq:nu-fixed}
\end{equation}
\section{Comments}
\label{sec:comments}
We now detail our objective (\ref{eq:lenc}) and notably
explicit connections in Sect.~\ref{sec:infotheory} with \cite{DBLP:journals/corr/abs-1812-04218}
which gives an information-theoretic interpretation of a similar
objective.
In Sect.~\ref{sec:attr-fun}, we further discuss about
the multiple possibilities that we have concerning the implementation of the
attribute function and list, in Sect.~\ref{sec:sampling-schemes},
the different sampling schemes of VarNet.
\subsection{Information-theoretic interpretation}
\label{sec:infotheory}
Our objective bears similarity the objective Eq.~(11) from
\cite{DBLP:journals/corr/abs-1812-04218} which is derived from the
following optimization problem
\begin{equation}
\label{eq:infoopt}
\max I(x;z|\psi) \quad \textrm{with} \quad I(z;\psi) < \epsilon,
\end{equation}
where $I(\cdot;\cdot)$ and $I(\cdot;\cdot|\cdot)$ denote the mutual
information and the conditional mutual information respectively (using
the joint distribution $q(x,z,f(x,m)) = \pi(x,m) q(z|x)$).
The differences between our work and
\cite{DBLP:journals/corr/abs-1812-04218} are the following:
First, our objective Eq.~(\ref{eq:lenc}) is motivated from a
generative point of view, while the motivation in
\cite{DBLP:journals/corr/abs-1812-04218} is to obtain fair
representations
(\cite{2015arXiv151100830L,xie2017controllable,moyer2018invariant}). This
allows us to consider attributes computed from both $x$ and $m$, while
in \cite{DBLP:journals/corr/abs-1812-04218} we have $\psi = f(x,m) =
m$ and the ``sensitive attributes'' $m$ must be provided.
A second difference is our formulation of the discriminator
function: \cite{DBLP:journals/corr/abs-1812-04218} considers training a discriminator to
predict $\psi$ given $z$. In our case, such a formulation would
prevent us to impose a prior distribution over $\Psi$.
The connection with the work of
\cite{DBLP:journals/corr/abs-1812-04218} thus provides an
interpretation of hyperparameters $\beta$ and $\gamma$ in Eq.~(\ref{eq:lenc}).
\subsection{Flexibility in the choice of the attribute function}
\label{sec:attr-fun}
In this section, we focus on the parametrization of the attribute
function $f: \mathcal{X} \times \mathcal{Z} \mapsto
\mathbf{R}^{d} $.
The formulation of Sect.~\ref{sec:attr-space} is in fact too restrictive
and considered only particular attribute functions. It is in fact
possible to mix different attribute functions by simply concatenating
the resulting vectors. By doing so, we can then
combine free and fixed attributes in a natural way but also consider
different attention modules $\alpha$
similarly to what is done in
\cite{DBLP:journals/corr/ChenKSDDSSA16}, but also consider different
distributions over the attention vectors $\alpha_i$.
It is important to note that the free attributes presented in
Sect.~\ref{sec:free-attr} can only capture \emph{global} attributes,
which are attributes that are relevant for \emph{all} elements of the
dataset $\mathcal{D}$. In the presence of discrete labels $m$, it can
be interesting to consider \emph{label-dependent free attributes},
which are attributes specific to a subset of the dataset. In this
case, the attribute function $f$ can be written as
\begin{equation}
\label{eq:label-dep-attr}
f(x, m) = \sum_{i=1}^{d} \alpha_i(x, m) e_{m, i},
\end{equation}
where $e_{m, i}$ designates the $i^{th}$ attribute vector of the label
$m$.
With all these possibilities at hand, it is possible to devise numerous
applications in which the notions of \emph{template} and
\emph{attribute} of an input $x$ may have diverse interpretations.
Our choice of using a discriminator over $\Psi$ instead of, for
instance, over the values of $\alpha$ themselves allow to encompass
within the same framework discrete and continuous fixed
attributes. This also makes the combinations of such attribute functions natural.
\subsection{Sampling schemes}
\label{sec:sampling-schemes}
We quickly review the different sampling schemes of VarNet. We believe
that this wide range of usages makes VarNet a promising model for a
wide range of applications. We can for instance:
\begin{itemize}
\item generate random samples $\hat{x}$ from the estimated dataset
distribution:
\begin{equation}
\label{eq:1}
\hat{x} \sim p(x|z, \psi) \quad \textrm{with} \quad z \sim p(z) \quad \textrm{and} \quad
\psi \sim p(\psi),
\end{equation}
\item sample $\hat{x}$ with given attributes $\psi$:
\begin{equation}
\label{eq:5}
\hat{x} \sim p(x|z, \psi) \quad \textrm{with} \quad z \sim p(z),
\end{equation}
\item generate variations of an input $x$ with attributes $\psi$:
\begin{equation}
\label{eq:8}
\hat{x} \sim p(x|z,\psi) \quad \textrm{with} \quad z \sim q(z|x),
\end{equation}
\item generate random variations of an input $x$:
\begin{equation}
\hat{x} \sim p(x|z,\psi) \quad \textrm{with} \quad z \sim q(z|x) \quad \textrm{and} \quad
\psi \sim p(\psi).\label{eq:9}
\end{equation}
\end{itemize}
In the case of continuous attributes of the form Eq.~(\ref{eq:2}) or
(\ref{eq:cont-attr}), VarNet also provides a new way to generate
interpolations, since we can perform interpolations either on $z$ or
on $\psi$.
\section{Experiments}
\label{sec:experiments}
\label{sec:mnist}
We now illustrate the different sampling schemes presented in
Sect.~\ref{sec:sampling-schemes} on different image
datasets. Section~\ref{sec:impl-details} is devoted to the
implementation details and our particular modeling choices,
Sect.~\ref{sec:generation-examples} and \ref{sec:underst-free-attr} showcase some applications of VarNet
ensuring that the learned attributes are meaningful and controllable.
Finally, Sect.~\ref{sec:inductive-biases} discusses the impact of the modeling choices.
\subsection{Implementation details}
\label{sec:impl-details}
In all these experiments, we choose to use a ResNet-50
\cite{he2016deep} for the encoder network. We also use a ResNet-50 for the attribute
function $f$ when the function $f$ depends on the input $x$ and not only on
metadata information $m$. For the decoder network, we use a
conditional transposed
ResNet-50 similar to the decoder used in
\cite{DBLP:journals/corr/abs-1806-01054}. The batch normalization
parameters \cite{ioffe2015batch} are conditioned by $\psi$ similarly
to what is done in \cite{dumoulin2018feature,perez2018film}.
Following \cite{dai2019diagnosing}, we consider a simple parametrization
for the encoder $q(z|x)$ and decoder $p(x|z,\psi)$ networks: the encoder $q(z|x)$ is a
diagonal Gaussian distribution
$\mathcal{N}(\mu_z(x), \textrm{diag}(\sigma_z(x)))$
and the decoder $p(x|z,\psi)$ is a diagonal Gaussian distribution with
scalar covariance matrix $\mathcal{N}(\mu_x(z,\psi), \sigma_x I)$, where $\sigma_x$ is a
learnable scalar parameter and where $I$ denotes the identity matrix.
\label{sec:results-sampl}
The prior $p(z)$ over $\mathcal{Z}$ is a unit centered Normal distribution.
For the sampling of the $\alpha$ values in the free attributes case, we considered $\nu_\alpha$ to
be a uniform
distribution over $[0,1]^{d}$. In the fixed attribute case, we
simply obtain a random sample $\{\psi_i\}_{i=1}^n$ by shuffling the
already computed batches of $\{f(x_i, m_i)\}_{i=1}^n$ (lines 4 and
6 in Alg.\ref{alg:1}).
The dimension of the template space $\mathcal{Z}$ is $d_z=16$ for
applications on the
MNIST \cite{lecun1998mnist}, KMNIST \cite{clanuwat2018deep},
Fashion-MNIST \cite{xiao2017/online} and
dSprites \cite{higgins2016beta,dsprites17} datasets; and is equal to
$d_z=64$ on the CelebA dataset \cite{liu2015faceattributes} with
resolution $64 \times 64$. The hyperparameter $\beta$ and $\gamma$ in
Eq.~(\ref{eq:lenc}) are chosen equal
to $1$ and $10$ respectively.
\subsection{Influence of the attribute function}
\label{sec:generation-examples}
We now apply VarNet on the different image datasets mentioned above in order to illustrate the different
sampling schemes presented in Sect.~\ref{sec:mnist} and the
influence of the choice of the
attribute functions (Sect.~\ref{sec:attr-fun}). We primarily focus on
sampling schemes Eq.~(\ref{eq:8}) and Eq.~(\ref{eq:9}) which help
understanding the effect of the learned attributes.
\subsubsection{Fixed discrete attributes}
\label{sec:fixattr}
We start by considering attribute functions $f$ depending exclusively
on discrete labels $m$
(Eq.~(\ref{eq:disc-attr})). Figure~\ref{fig:varslabel} shows the
effect of changing the attributes of a given input $x$ using
Eq.~(\ref{eq:8}) on the MNIST and KMNIST datasets. We observe consistency between all variations. In
these two cases, the template $z$ encompasses the handwriting and it is
interesting noting that characters with two distinct way of writing appear
in the generated variations.
\begin{figure}[h!]
\center
\subcaptionbox{ \label{fig:mnistlabel}}{\includegraphics[width=2.8in]{mnistlabel}}
\quad
\subcaptionbox{ \label{fig:1f1lvars2}}{\includegraphics[width=2.8in]{kmnistlabel}}
\caption{Visualization of the spanned \emph{space of variations} for
an attribute function on MNIST (a)
and KMNIST (b). The original input $x$ is shown on the bottom left of
each image and the reconstructions for all 10 labels are shown on
the upper line.}
\label{fig:varslabel}
\end{figure}
\subsubsection{Free continuous attributes}
\label{sec:free-attrs}
We now focus on the case where we let the network learn relevant
attributes of the data. Figure~\ref{fig:varsfree} displays typical
examples of variations obtained by considering free attributes of
dimension $d=2$ on different datasets. These plots are obtained by
varying the $\alpha_i$ in Eq.~(\ref{eq:sampling-psi}) at a constant
speed between 0 and 1.
\begin{figure}[h!]
\subcaptionbox{ \label{fig:mnistfree}}{\includegraphics[width=1.9in]{mnistfree}}
\hfill
\subcaptionbox{ \label{fig:dspritesfree}}{\includegraphics[width=1.9in]{dspritesfree}}
\hfill
\subcaptionbox{ \label{fig:celebafree}}{\includegraphics[width=1.9in]{celebafree}}
\caption{Visualization of the spanned \emph{space of variations}
obtained by
varying uniformly a 2-dimensional learned free attribute on
different datasets: (a) MNIST (b) dSprites (c) CelebA.
The initial input $x$ is displayed on the bottom left of each plot.}
\label{fig:varsfree}
\end{figure}
In all cases, the learned attributes are relevant to the dataset and
meaningful.
We find interesting to note that there is no disentanglement
\emph{between} the dimensions of the attributes and that the learned
attributes are highly dependent on the dataset at hand.
\subsubsection{Mixing attributes}
In this part, we give examples of attribute functions obtained
by combining the ones mentioned in the preceding sections. In
particular, we consider attribute functions created by combining
\begin{itemize}
\item several discrete fixed attributes,
\item discrete fixed attributes and continuous free attributes,
\item continuous free attributes conditioned by discrete fixed
attributes.
\end{itemize}
The objective is to showcase how the design of the
attribute functions influences the learned attributes and the ``meaning''
of the templates $z$.
\begin{figure}[h!]
\includegraphics[width=1.6in]{palesmiling}
\centering
\caption{Visualization of the spanned \emph{space of variations} for
an attribute function depending on 2 binary labels, ``Smiling''
(in lines)
and ``Pale Skin'' (in columns), on CelebA. The original input is
shown on the left.
}
\label{fig:celebalabel}
\end{figure}
Figure~\ref{fig:celebalabel} considers the case where two attribute
functions relying solely on binary labels are concatenated. We observe
that the resulting model allow to vary independently every label
during generation.
Such a design choice can be useful since concatenating two attributes
functions taking into account two different labels instead of choosing a unique attribute function
taking into account a Cartesian product of labels tends to make
generalization easier.
We now consider the case where the free attributes are combined with
fixed attributes. There are two different ways to do so: one is to
concatenate a attribute function on free attributes with one taking
into account fixed discrete attributes, the other is to make the free
attributes \emph{label-dependent} as in Eq.~(\ref{eq:label-dep-attr}).
\begin{figure}[h!]
\centering
\subcaptionbox{\label{fig:freefixed}}{
\includegraphics[width=3.4in]{1F1LVars1.png} \vspace{.2in}}
\quad \hfill
\subcaptionbox{\label{fig:addidas}}{\includegraphics[width=2.1in]{addidas}}
\caption{Visualization of the spanned \emph{space of variations}:
(a) for
attributes being the concatenation of a fixed discrete attribute
and a 1-dimensional free attribute on MNIST, (b) for
a 1-dimensional label-dependent attribute
Eq.\ref{eq:label-dep-attr}) on Fashion-MNIST.}
\end{figure}
Figure~\ref{fig:freefixed} displays one such example in the first
case. This corresponds to an attribute function $f$ as in
Eq.~(\ref{eq:label-dep-attr}), but where the dependence of $\alpha_i$ on
$m$ is dropped. This results in the fact that the learned free
attributes are global and possess the same ``meaning'' for all
classes. In Fig.~\ref{fig:addidas}, on the contrary, the dependence of
the $\alpha_i$'s on $m$ is kept. This has the effect that each class
possesses a ``local'' free attribute.
\subsection{Influence of the hyperparameters}
\label{sec:underst-free-attr}
From the preceding examples of Sect.~\ref{sec:generation-examples}, we saw that the fixed label
attributes have clearly been taken into account, but it can be hard to
guess a priori which
high-level attribute the free attribute function might
capture. However, for a given architecture, a given dataset and fixed hyperparameters,
we observed that the network tended to learn the same high-level
features across multiple runs. In this section, we show that the
information-theoretic interpretation from Sect.~\ref{sec:infotheory}
gives us an additional way to control what is learned by the free
attributes by modifying the hyperparameter $\beta$ and/or $\gamma$.
\begin{figure}[h!]
\centering
\subcaptionbox{\label{fig:vars2D1}}{\includegraphics[width=0.3\textwidth]{2Dvars1.png}}
\quad
\subcaptionbox{\label{fig:lowKL}}{\includegraphics[width=0.3\textwidth]{lowKL.png}
\caption{Figures \ref{fig:vars2D1} and \ref{fig:lowKL} display the
space of variations using a 2-dimensional free attribute on MNIST. Figure~\ref{fig:lowKL} was generated using a model
trained with a low KL penalty ($\beta=0.1$). The closest
generation from the input lies in the red square.}
\label{fig:vars2d}
\end{figure}
For some applications, variation spaces such as the one displayed in
Fig.~\ref{fig:vars2D1} are not
desirable because they may tend to move too ``far away'' from the
original input. As discussed in Sect.~\ref{sec:infotheory}, it is possible to reduce how ``spread''
the spaces of variation are by modifying the $\beta$ parameter multiplying the KL
term in the objective Eq.~(\ref{eq:lenc}). An example of such a variation space is
displayed in Fig.~\ref{fig:lowKL}. If the interpretation of the
high-level features
learned by the free attributes seems identical in both cases, the
variations spanned in \ref{fig:lowKL} are all more similar from the
original input.
\subsection{Inductive biases}
\label{sec:inductive-biases}
In order to check how crucial is the choice of the architecture for
the encoder and the decoder, we choose in this part to train a VarNet
on representations obtained from a pre-trained VAE, similarly to the
TwoStageVAE from \cite{dai2019diagnosing}. The first pre-trained VAE
has the same encoder as the one described in
Sect.~\ref{sec:impl-details} and a transposed VarNet-50 decoder. For
the encoder and decoder of the VarNet trained on these
representations, we use simple three-layered MLPs. The attribute
function network is, as in Sect.~\ref{sec:impl-details}, a
VarNet-50. The results in the case of a 2-dimensional free attribute
are displayed in Fig.~\ref{fig:indbias}. One striking observation is
the difference with Fig.~\ref{fig:celebafree} where changing the free
attributes corresponded to changing the background color. Such
difference is not surprising \cite{locatello2018challenging} and both
cases could be useful: removing information about background color in
$z$ could be of help for some downstream tasks where this piece of
information is irrelevant.
Here, in the case of \ref{fig:indbias}, the free attributes tend to learn the ``pose'' and ``skin
color'' high-level attributes. This seems to be consistent across
different runs (e.g. Fig.~\ref{fig:celeba1} and \ref{fig:celeba2})
and consistent on different inputs (e.g. Fig.~\ref{fig:celeba2} and \ref{fig:celeba3}).
\begin{figure}[h!]
\centering
\subcaptionbox{\label{fig:celeba1}}{\includegraphics[width=0.3\textwidth]{celebasecond1.png}}
\quad
\subcaptionbox{\label{fig:celeba2}}{\includegraphics[width=0.3\textwidth]{celebasecond2.png}}
\quad
\subcaptionbox{\label{fig:celeba3}}{\includegraphics[width=0.3\textwidth]{celebasecond3.png}}
\caption{Space of variations using a 2-dimensional free attribute on
CelebA. The Variation Network is trained on representations
obtained from a pre-trained VAE.
Figures (b) and (c) are generated using the same model.}
\label{fig:indbias}
\end{figure}
\section{Related work}
\label{sec:related-work}
The Variation Network generalizes many existing models used for
controlled input
manipulation by providing a unified probabilistic framework for this
task. We now review the related literature and discuss the connections
with VarNet.
The problem of controlled input manipulation has been considered in the \emph{Fader networks} paper
\cite{DBLP:journals/corr/LampleZUBDR17}, where the authors are able to
modify in a continuous manner the attributes of an input
image. Similar to us, this
approach uses an encoder-decoder architecture together with an
adversarial loss used to decouple templates and attributes. The
major difference with VarNet is that this model has a deterministic
encoder which limits the sampling possibilities as discussed in
Sect.~\ref{sec:underst-free-attr}. Also, this approach can only deal
with fixed attributes while VarNet is able to also learn meaningful free
attributes. In fact, VAEs \cite{2013arXiv1312.6114K}, WAEs
\cite{2017arXiv171101558T,2018arXiv180203761R} and Fader networks can
be seen as special cases of VarNet.
Recently, the \emph{Style Tokens} paper
\cite{DBLP:journals/corr/abs-1803-09017} proposed a solution to learn
relevant free attributes in the context of text-to-speech. The
similarities with our approach is that the authors condition an
encoder model on an adaptive basis of style tokens (what we called
attribute space in this work). VarNet borrows
this idea but cast it in a probabilistic framework, where a
distribution over the attribute space is imposed and where the encoder
is stochastic. Our approach also allows to take into account fixed
attributes, which we saw can help shaping the free attributes.
Traditional ways to explore the latent space of VAEs is by doing
linear (or spherical \cite{white2016sampling}) interpolations between
two points. However, there are two major caveats in this approach: the requirement of always needing two points in order to
explore the latent space is cumbersome and the interpolation scheme
is arbitrary and
bears no probabilistic interpretation.
Concerning the first point, a common approach is to find, a
posteriori,
directions in the latent space that accounts for a particular change
of the (fixed) attributes \cite{upchurch2016deep}. These directions
are then used to move in the latent space. Similarly,
\cite{DBLP:journals/corr/HadjeresNP17} proposes a model
where these directions of interest are given a priori. Concerning the
second point, \cite{laine2018feature-based} proposes to compute
interpolation paths minimizing some energy functional which result in
interpolation curves rather than interpolation straight
lines. However, this interpolation scheme is computationally demanding
since an optimization problem must be solved for each point of the interpolation path.
Another trend in controlled input manipulation is to make a
posteriori analysis on a trained generative model
\cite{DBLP:journals/corr/abs-1711-05772,pmlr-v80-adel18a,upchurch2016deep,2018arXiv180901859C}
using different means. One possible advantage of these methods compared to ours
is that different attribute manipulations can be devised after the
training of the generative model. But, these procedures are still
costly and so provide any real-time applications where a user could
provide on-the-fly the attributes they would like to modify.
One of these approaches \cite{2018arXiv180901859C} consists in using the trained
decoder to obtain a mapping $\mathcal{Z} \mapsto \mathcal{X}$ and
then performing
gradient descent on an objective which accounts for the constraints
or change of the attributes.
Another related approach proposed in
\cite{DBLP:journals/corr/abs-1711-05772} consists in training a
Generative Adversarial Network which learns to move in the vicinity of
a given point in the latent
space so that the decoded output enforces some constraints. The major
difference of these two approaches with our work is that these movements are done in a unique
latent space, while in our case we consider separate latent
spaces. But more importantly, these approaches implicitly consider
that the variation of interest lies in a neighborhood of the provided input.
In \cite{pmlr-v80-adel18a} the authors
introduce an additional latent space called \emph{interpretable lens}
used to interpret the latent space of a generative model. This space
shares similarity with our VarNet trained on VAE representations. The authors also
propose a joint optimization for their model, where the
encoder-decoder architecture and the interpretable lens are learned
jointly. The difference with our approach is that the authors optimize
an ``interpretability'' loss which requires labels and still need to
perform a posteriori analysis to find relevant directions in the
latent space.
\section{Conclusion and future work}
\label{sec:future-work}
We presented the Variation Network, a generative model able to vary
attributes of a given input. The novelty is that these attributes can
be fixed or learned and have a sound probabilistic
interpretation.
Many sampling schemes have been presented together
with a detailed discussion and examples. We hope that the flexibility in the design
of the attribute function and the simplicity, from an implementation
point of view, in transforming existing
encoder-decoder architectures (it
suffices to provide the encoder and decoder networks) will be of
interest in many applications.
We saw that our architecture is indeed capable of decoupling templates from
learned attributes and that we have three ways of controlling the
free attributes that are learned: by modifying the hyperparameter terms in the
objective Eq.~(\ref{eq:lenc}), by carefully devising the attribute
functions or by working on different input representations with
different encoder/decoder architectures.
For future work, we would like to extend our approach in two different ways:
being able to deal with partially-given fixed attributes and handling
discrete free attributes as in \cite{jeong2019learning}. We also want to investigate the use of
stochastic attribute functions $\phi$. Indeed, it appeared to us that
using deterministic attribute functions was crucial and we would like
to go deeper in the understanding of the interplay between
all VarNet components.
\bibliographystyle{abbrv}
| {'timestamp': '2019-09-17T02:28:24', 'yymm': '1901', 'arxiv_id': '1901.03634', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03634'} | arxiv |
\section{Introduction}
While machine learning algorithms based on deep neural networks (DNNs) have demonstrated human-like or even super-human performance in several complex cognitive tasks, a significant gap exists between the energy and efficiency of the computational systems that implement these algorithms compared to the human brain. Most of these algorithms run on conventional computing systems such as central processing units (CPUs), graphical processing units (GPUs) and field programmable gate arrays (FPGAs). Recently, digital or mixed-signal application specific integrated circuits (ASICs) have also been developed for machine learning acceleration. However, as Moore's law scaling is coming to an imminent end, the performance and power efficiency gains from technology scaling of these conventional approaches are diminishing. Thus, there are significant research efforts worldwide in developing a profoundly different approach to computing for artificial intelligence (AI) applications inspired by biological principles.
In the traditional von Neumann architecture, a powerful processing unit operates sequentially on data fetched from memory. In such machines, the von Neumann bottleneck is defined as the limitation on performance arising from the ``chokepoint'' between computation and data storage. Hence, the research focus has been not only on designing new AI algorithms, device technologies, integration schemes, and architectures but also on overcoming the CPU/memory bottleneck in conventional computers. Spiking neural networks (SNNs) are the third generation of artificial neuron models that leverage the key time-based information encoding and processing aspects of the brain. Neuromorphic computing platforms aim to efficiently emulate SNNs in hardware by distributing both computation and memory among large number of relatively simple computation units, viz. the neurons, each passing information, via asynchronous spikes, to hundreds or thousands of other neurons through synapses \cite{Mead-02}. The event-driven characteristics of SNNs have led to highly efficient computing architectures with collocated memory and processing units, significantly increased parallelism and reduced energy budgets. Such architectures have been demonstrated in neuromorphic implementations such as SpiNNaker from the University of Manchester \cite{SpiNNaker}, IBM's TrueNorth \cite{truenorth}, Intel's Loihi \cite{loihi}, BrainScaleS built by Heidelberg University \cite{Meier2015}, NeuroGrid from Stanford \cite{Y2014benjaminProcIEEE}, DYNAP from INI Zurich \cite{Moradi2018}, and ODIN from Catholic University Louvain \cite{Frenkel2019}. Moreover, breakthroughs in the area of nanoscale memristive devices have enabled further improvements in area and energy efficiency of mixed digital-analog implementations of synapses and spiking neurons \cite{Kuzum13,Y2016tumaNatNano}.
In this paper, we provide a high-level description of the design objectives and approaches that are currently being pursued for building energy efficient neuromorphic computing platforms. It is organized as follows: Section \ref{info} provides a brief overview of the information processing aspects of the human brain, which have motivated the design of artificial neuromorphic computing platforms. Section \ref{blocks} describes the objectives and specifications of the building blocks of neuromorphic platforms - hardware neurons, synapses, and architectures to provide connectivity between them. Section \ref{design} introduces several design choices and principles underlying non-von Neumann computing architectures. Section \ref{chips} covers the salient aspects of some of the state-of-the-art neuromorphic chips. Section \ref{devices} provides an overview of some of the research into developing computational memory units based on nanoscale memristive devices and how they can execute certain computations in place avoiding the von Neumann bottleneck and also naturally capture timing-based correlations in signals. In section \ref{apps}, we discuss some signal processing applications of these neuromorphic computing platforms and finally conclude the paper in Section \ref{Challenges} by reviewing the future outlook and important challenges for the field.
\section{Information processing in the brain}
\label{info}
``Computing'' in the brain follows a completely different paradigm than today's conventional computing systems. Whereas conventional systems are optimized to transmit and modify numerical representations of data, the brain operates on timed events called action potentials or \emph {spikes}. Neurons receive these spikes via synapses, which convert them into small changes in the cell's membrane potential. The neuron integrates these changes in potential over time, and under certain conditions, for instance, when many spikes arrive within a short time, the neuron emits a spike. Spikes can be considered messages in the computing sense, except that they carry no information other than their time of generation and their source. Computing in the brain can thus be described as fully event-driven, non-blocking and imperatively concurrent, with very lightweight compute nodes (the neurons), that communicate via tiny messages, the spikes.
There are about $10^{11}$ neurons in the human brain, and it {is} estimated that there are about $5,000-10,000$ synapses per neuron in the human neocortex. Thus, connectivity is sparse, with a neuron receiving input from $10^{-6} \%$ of all other neurons (probably even less, considering that an axon may form multiple synapses on the same dendrite). At the same time, the total number of connections is huge, in the order of $10^{15}$. This is vastly different from the low fan-out connectivity that is common in conventional computers.
\subsection{Signal encoding in the brain}
The event-driven nature of computing also applies to stimulus encoding by the sensory organs. Generally, sensory coding emphasizes \emph{changes} in the stimulus, rather than accurate coding of constant levels. These changes can be considered ``events'' that are translated into spikes for downstream processing. For example, ganglion cells in the retina transmit a spike if the change in local contrast in their receptive field exceeds a threshold. They then adapt to the new level of local contrast. More spikes are produced only when local contrast rises further. This encoding scheme has three advantages over uniformly-spaced signal sampling in conventional signal processing: first, it produces a sparse code that transmits information only when the input signal is changing; second, it is not limited by a fixed sample rate in the maximum frequency it can encode; third, it can lead to extremely reactive systems since the latency for feature extraction is not limited by the time between two samples, but only the minimum delay between two events, which is usually much shorter. In neuromorphic devices, this encoding scheme has been implemented via a set of thresholds that trigger events to be fired upon the signal crossing them (Fig. \ref{fig:brainComp}, right top~\cite{LiuBook15}).
\subsection{``Learning'' in the brain}
The connections in the brain are not fixed, but can change as a function of their activity; this process is often called ``learning''. Fundamental principles of synaptic changes have been uncovered that depend on the timing of spikes fired in the pre- and postsynaptic cells, thus termed Spike-Timing Dependent Plasticity or STDP \cite{BiPoo}. STDP implements a form of Hebbian learning, where a synapse gets strengthened (\emph{potentiated} in Neuroscience-lingo) if the presynaptic spike arrives within a certain time window preceding the spike of the post-synaptic cell, or weakened (\emph{depressed}) if the temporal order is reversed (Fig. \ref{fig:brainComp}, right bottom). Pre- and post-synaptic timing are thus two \emph{factors} that determine the change of a synaptic weight.
In biology, the amount and direction of weight change are often influenced by neuromodulators such as Dopamine or Noradrenaline which get released as a function of reward received by the organism. Neuromodulators are thus a third factor in models of synaptic learning. They allow for the construction of powerful spiking learning rules that, for example, implement reinforcement learning \cite{Urbanczik:2009cc}. Taken together, the brain's massively parallel, event-driven computing combined with its extraordinary connectivity probably is the basis for its extremely high efficiency in signal processing, inference, and control. Furthermore, the action potentials used for communication as well as the synaptic currents in the brain have much smaller magnitudes than that of the electrical signals in silicon computers, as signals in the brain are encoded by the flow of a relatively smaller number of charge carriers (such as Na, K and Ca ions) through ion channels with highly selective, stochastic, and non-linear conductance characteristics. As a result of all these contributing factors, the brain is estimated to consume about $20\,$W even during demanding tasks like mastering a multi-player online computer game, whereas a conventional platform has been reported to use about 128,000 CPUs and 256 GPUs to achieve competitive performance (see \url{https://blog.openai.com/openai-five}).
\begin{figure*}[!ht]
\centering
\includegraphics[width=0.7\linewidth]{Fig_BrainComp_v2.pdf}
\caption{The brain employs a massively parallel computational network comprising of $\sim10^{11}$ neurons and $\sim10^{15}$ synapses (left) using event-driven signal encoding (top right) and weight updates (bottom right). For details, see text.
}
\label{fig:brainComp}
\end{figure*}
This fundamental difference in computing architecture implies that porting algorithms from conventional machines to spike-based approaches can only have limited success. New algorithms are required that embrace the fundamentally event-based nature of sensing, learning, and inference in the brain, to leverage the full potential of spiking networks accelerated by neuromorphic hardware.
\section{Building blocks of neuromorphic systems}\label{blocks}
Although biological neurons and synapses exhibit a wide variety of complex dynamical behaviors, most hardware designs need to mimic only the key aspects that are essential for computation. At a high level, this includes the integrate-and-fire (I\&F) dynamics of neurons and spike-triggered communication and plasticity of synapses, which we describe below.
The central aspects of integrate-and-fire dynamics of neurons are described by the Hodgkin-Huxley equations which incorporate the voltage-dependent dynamics of sodium, potassium, and leak ion channels to determine the evolution of the membrane potential. While biological neurons exhibit more complex behaviors such as burst firing, chirping, post-inhibitory rebound, and spike-frequency adaptation, and though the computational significance of these has not been clearly established so far, there have been example hardware designs that mimic some of these behaviors using both digital CMOS and sub-threshold analog CMOS circuits. Model order reduction techniques have been used to reduce the complexity of the dynamical equations that describe these behaviors; some of the notable examples being the second order Izhikevich model, the adaptive exponential I\&F model, and the linear leaky I\&F (LIF) model. These are simpler to implement in hardware and are more commonly used in large scale neuromorphic designs. We describe the LIF model here as it is the most commonly used spiking neuron model. The membrane potential $V(t)$ evolves according to the differential equation:
\begin{align}
C \frac{dV(t)}{dt} &= -g_{L}(V(t)-E_L)+I_{syn}(t),&&
V(t)\leftarrow E_L, \text{ if } V(t)>V_T
\label{eq:lif}
\end{align}
i.e., the input synaptic current $I_{syn}(t)$ is integrated across a leaky capacitor until the voltage exceeds a threshold $V_T$, when a spike is issued and the membrane potential is reset to its resting value $E_L$. $C$ and $g_L$ model the membrane's capacitance and leak conductance, respectively. The refractory period seen in biological neurons can be implemented by holding the membrane potential at $V(t)=E_L$, preventing current integration during that period.
Synaptic communication is triggered by the arrival of a spike, causing a current to flow into downstream neurons. This is also a very complex process in the brain, involving the release of neurotransmitter molecules at the axon terminal, which then diffuses across the synaptic cleft, and binds with receptor molecules at the dendrite causing ionic currents to flow into the downstream neurons. These aspects are not modeled in most hardware implementations. Instead, the current through a synapse with strength $w$ is calculated as
\begin{align}
\scriptsize
I_{syn} (t) = w \times \sum_{{i}} \alpha( t-t^i)
\label{eq:Isyn}
\end{align}
where $t^i$ represents the time of arrival of spikes at the axon terminal and $\alpha(t)$ is a synaptic current kernel; $\alpha(t)=(e^{-t/\tau_1}-e^{-t/\tau_2})$, $\alpha(t)=(t/\tau)e^{-t/\tau}$, and $\alpha(t)=\tau\delta(t)$ are some commonly used synaptic kernels. Note that this form of synaptic transmission also assumes that the current is independent of the post-synaptic neuron's potential, unlike in biology. Finally, in order to implement synaptic plasticity, the weight $w$ is updated based on learning rules which are implemented in peripheral circuits, again in a spike-triggered fashion.
While the hardware design of neuronal and synaptic circuits involves a variety of trade-offs in area, power, reliability, and performance, the more challenging aspect of neuromorphic systems is supporting arbitrary connectivity patterns between spiking neurons. Since the computational advantage of neural networks emerges from the high fan-out, yet sparse, connectivity of neurons, hardware designs also need to support this crucial aspect. Furthermore, several forms of structural plasticity are observed in the brain where neurons can form (or remove) new synaptic connections based on activity. In the following section, we describe some of the architectural design choices that enable the realization of some of these aspects in silicon substrates.
\section{System design principles and approaches}\label{design}
Collocation of memory and computation mitigates the von Neumann bottleneck in neuromorphic processors. Thus, inspired by neuroscience, the state-of-the-art architectural framework of SNN accelerators or co-processors comprises a network of neurosynaptic cores \cite{truenorth,loihi} that can efficiently implement scale-out neural networks as shown in Fig. \ref{fig:arch}. Each core consists of a crossbar array with electronic synapses at each cross-point and peripheral circuitry including local SRAM-based look-up tables for routing information and storage of local data. The peripheral circuitry implements the neuronal functionality (typically the LIF neuron), the read/write electronics as well as the driver circuits that control the voltages on the input (axon, horizontal lines) and output (dendrites, vertical lines) wires. Thus, a neurosynaptic core represents a layer of the spiking neural network and the passing of information between layers (cores) is enabled by a time-multiplexed communication fabric.
\begin{figure*}[!ht]
\centering
\includegraphics[width=0.5\linewidth]{arch.pdf}
\caption{Architecture and communication protocols used in neuromorphic systems - a tiled array of neuromorphic cores with each core integrating neurons and synapses locally. Spikes are communicated between cores through a routing network using address event representation (AER) protocols. Adapted from \cite{truenorth, LiuBook15}. }
\label{fig:arch}
\end{figure*}
Since neuron spiking rates are orders of magnitude slower than digital electronics and jitter and delay through digital electronics (propagation and transition delay) is insignificant compared to axonal delays and neuron time constants, the networks typically used to multiplex information from one neurosynaptic core to another are packet-switched networks, using the so-called address event representation (AER) protocol. In this scheme, each neuron has a unique address which is transmitted to the destination axons when it spikes; the time of spiking is hence encoded implicitly (Fig. \ref{fig:arch}). Note that the AER protocol also allows efficient and flexible off-chip interconnect for large-scale multi-chip network platforms. The overall architecture is brain-inspired in the sense that the neurosynaptic core, via its crossbar array, mimics the dense local connectivity of neurons within the same layer, whereas the network interconnect topology with the AER protocol allows sparse long-range connections. From a pragmatic hardware-implementation-oriented viewpoint, such an SNN accelerator architecture with the appropriate core-to-core communications protocol is reminiscent of a dataflow engine, i.e., data flow from core-to-core in an asynchronous fashion. See \cite{LiuBook15} for a general review of neuromorphic design principles.
Although the core-to-core interconnect fabric is implemented with digital CMOS logic, the neurosynaptic core itself can be implemented by using analog/mixed-signal, digital, or memristive technologies. In its simplest form, the neuron membrane potential can be implemented in the analog domain as a voltage across a capacitor or as a multi-bit variable stored in digital latches. The analog design approaches have focused on two basic design methodologies: sub-threshold current-mode circuits and above-threshold circuits. The former approach suffers from higher inhomogeneities (e.g. device mismatch) than the latter one, however it offers lower noise energy (noise power times bandwidth) and better energy efficiency (bandwidth over power) \cite{LiuBook15}. Alternatively, digital neurons can be realized using CMOS logic circuits such as adders, multipliers, and counters \cite{Rajendran13}. From a circuit design point of view, the synapses modulate the input spikes and transform them into a charge that consequently create post-synaptic currents that are integrated at the membrane capacitance of the post-synaptic neuron \cite{LiuBook15}. The implementation of silicon synapses typically follows the mixed-signal methodology, though they can also be implemented in the digital domain by employing SRAM cells \cite{Rajendran13}. Neurons and synapses can also be implemented using memristive technologies, as described in section \ref{devices}.
\section{State-of-the-art neuromorphic hardware}\label{chips}
In this section, we describe the salient features of state-of-the-art Si CMOS based neuromorphic chips. Although research in this domain is more than three decades old, starting with the pioneering work of Carver Mead \cite{Mead-02}, the discussion in this paper is limited to some of the recent demonstrations of large scale neuromorphic platforms that integrate more than 1000 neurons.
\subsection{SpiNNaker}
SpiNNaker is a digital system that has been designed to efficiently simulate large spiking networks, approaching the complexity of the brain, in real time \cite{SpiNNaker}. Its building blocks are ARM9 cores that can access a small amount of local memory, plus some additional memory that is shared across one multi-core chip. No global memory exists. Nodes can communicate via a high-throughput fabric that is optimized towards routing small messages (not larger than 72 bit) with high efficiency. SpiNNaker's event-driven design manifests itself in the message handling paradigm. A message arriving at a core triggers an interrupt that queues the packet for processing by that core. The system is optimized for small packet handler code that processes messages quickly, keeping queues short (i.e., not much larger than 1). SpiNNaker thus implements fundamental concepts of the brain, such as event-driven computation, locality of information, high fan-in and fan-out connectivity, and communication with tiny messages.
The SpiNNaker system is constructed from processor cores, 18 of which are grouped on a die in a chip. 48 such chips, with up to 864 cores (depending on manufacturing yield) are assembled on one board. Chips on one board communicate using a custom protocol using direct connections, wired in a hexagonal topology. Larger systems can be built by connecting 48-chip boards with fast serial interconnects. The largest system in existence today consists of 1 million processors, housed in ten 19-inch racks at the University of Manchester.
While SpiNNaker can be programmed directly, its software stack provides several levels of abstractions, with spiking network implementation being facilitated by PyNN. PyNN is a Python library that supports portability of network designs between a variety of neuronal simulators and hardware, including the BrainScaleS system (described below). SpiNNaker's PyNN interface provides several standard neuron models such as LIF and Izhikevich's dynamical systems model, along with common algorithms for synaptic plasticity, including STDP.
The successor of this chip, named SpiNNaker 2, uses a more modern process technology, increases the number of cores per chip and adds linear algebra accelerators, and several other improvements. It has been used successfully for deep learning with sparse connectivity \cite{SpiNN2DeepR}.
\subsection{TrueNorth}
TrueNorth is a million neuron digital CMOS chip that IBM demonstrated using 28-nm process technology in 2014 \cite{truenorth}. The chip is configured as a tiled array of 4096 neurosynaptic cores, with each core containing $12.75\,$KB of local SRAM memory to store the synapse states, neuron states and parameters, destination addresses of fan-out neurons, and axonal delays. The digital neuron circuit in each core implements leaky-integrate-and-fire dynamics, and is time-multiplexed so as to emulate the operation of up to 256 neurons, which helps in amortizing the physical area and power budgets. Each core can support fan-in and fan-out of 256 or less, and this connectivity can be configured such that neurons in any core can communicate its spikes to one axon in any other core, and then to any neuron in that core. The spike-based communication and routing infrastructure also allow the integration of multiple chips; IBM has recently demonstrated the NS16e board that integrates 16 TrueNorth chips. The chip integrates 256 million SRAM synapses, with the synaptic connectivity programmable to two values - \{0,1\}, four programmable 9-bit signed integer weights per neuron, and programmable spike delivery time at the destination axon in the range of $1-15$ time steps. The spike routing is completed asynchronously in every time step, chosen to be $1\,$ms, so as to achieve real-time operation akin to biology, although faster synchronization clocks permit accelerated network emulation. The corelet programming environment is used to map network parameters from software training to the TrueNorth processor. Thanks to the event-driven custom design, the co-location of memory and processing units in each core, and the use of low-leakage silicon CMOS technology, TrueNorth can perform 46 billion synaptic operations per second (SOPS) per Watt for real-time operation, with $26\,$pico Joule per synaptic event; its power density of $20\,$mW/cm$^2$ is about 3 orders of magnitude smaller than that of typical CPUs.
\subsection{Loihi}
Loihi is a neuromorphic learning chip developed by Intel using their 14-nm FinFET process in 2018 \cite{loihi}. This multi-core chip supports the implementation of axonal and synaptic delays, neuronal spiking threshold adaptation, and programmable synaptic learning rules based on spike timing and reward modulation. The chip has 128 neural cores, with each core having 1024 spiking neurons and $2\,$Mb SRAM to store the connectivity, configuration, and dynamic state of all neurons within the core. The chip also includes three embedded x86 processors, and $16\,$MB of synaptic memory implemented in SRAM, supporting synaptic bit resolution from 1 to 9 bits. Thus, it supports roughly 130,000 neurons and 130 million synapses. Spikes are transported between the cores in the chip using packetized messages by an asynchronous network-on-chip (NoC) and allows connecting to 4096 on-chip cores and up to 16,384 chips via hierarchical addressing. To address the scaling of network connectivity to biological levels (i.e., fan-out of 1000), Loihi supports several features including core-to-core multicast and population-based hierarchical connectivity. The cores in the chip can be programmed using microcodes to implement several forms of neuromorphic learning rules such as pairwise STDP, triplet STDP, certain reinforcement learning protocols, and other rules that depend on spike rates as well as spike-timing. At nominal operating conditions, Loihi delivers 30 billion synaptic operations per second, consuming about $15\,$pico Joule per synaptic operation. A python package for the Nengo neural simulator allows users to study the implementation of spiking networks on Loihi without accessing the hardware.
\subsection{BrainScaleS-1}
The BrainScaleS system is a mixed-signal platform that combines analog neuron circuits with digital communication \cite{Meier2015}. Its unique feature is a speedup-factor of $10^3$ to $10^4$ for spiking network emulations, meaning that a network model running for $1\,$s wall-time on the hardware emulates up to $10,000\,$s of ``biological'' simulation time. BrainScaleS supports the adaptive exponential integrate-and-fire model that can be parameterized to exhibit diverse firing patterns. The BrainScaleS system's smallest unit of silicon is the HiCANN (High-Input Count Analog Neuronal Network) chip \cite{schemmel10}. The number of neurons per chip can be configured within wide limits, following a trade-off between the number of input synapses and the number of neurons. A single chip supports a maximum of 512 spiking neurons and up to about 14,000 synapses per neuron. Larger networks are supported by wafer-scale integration of HiCANN chips, which are wired directly on the silicon wafer, without cutting it into discrete elements. A single wafer supports $4\times10^7$ synapses, and up to 180,000 neurons.
Prototypes of the next BrainScaleS generation support programmable plasticity via general purpose processors embedded on the die alongside the neuromorphic circuitry \cite{brainscalesHybridRISC}. These processors have access to dedicated sensors at the synapses that measure the time interval between pre- and post-synaptic spikes. Arbitrary functions can be defined that compute updates to synaptic weights from this information. This enables highly flexible learning rules to be implemented on BrainScaleS, including reward-based learning. BrainScaleS, like SpiNNaker, leverages the PyNN API (\url{http://neuralensemble.org/PyNN}) to allow the user to specify spiking networks for emulation on the hardware.
\subsection{NeuroGrid/Braindrop}
The goal of the NeuroGrid platform is to implement large-scale neural models and to emulate their function in real time \cite{Y2014benjaminProcIEEE}. Hence, the system's memory and computing resources have time constants that are well matched to the signals that need to be processed. NeuroGrid employs analog/digital mixed-signal subthreshold circuits to model continuous time neural processing elements. The physics of field effect transistors operating in the subthreshold regime is used to directly emulate the various neuronal and synaptic functions.
Neurogrid comprises of a board with 16 standard CMOS NeuroCore chips connected in a tree network, with each chip consisting of a 256$\times$256 array of two compartmental neurons. Each neuron in the array can target multiple destinations by virtue of an asynchronous multicast tree routing digital infrastructure. The full NeuroGrid board can implement models of cortical networks of up to one million neurons and billions of synaptic connections with sparse long-range connections and dense local connectivity. A mixed-signal neurosynaptic core called Braindrop, with 4096 neurons and 64 KB of weight memory has also been recently demonstrated, leveraging the variability of analog circuits for performing useful computations \cite{Neckar2019}.
\subsection{DYNAP}
Dynamic neuromorphic asynchronous processors (DYNAP) is a family of mixed-signal neuromorphic chips from INI Zurich. DYNAP-SE is one such chip fabricated in $180\,$nm CMOS technology, integrating 1024 neurons and 64k synapses \cite{Moradi2018}. The chip is organized into 4 cores, with each core having 256 analog neurons. The temporal dynamics of neurons are implemented using ultra-low power (sub-threshold) analog circuits whereas the asynchronous digital circuits allow to program and re-program the network connectivity at run-time, enabling the configuration of recurrent networks, multi-layer networks, and any arbitrary network topology. The analog
circuits implement a wide range of features, including multiple types of synaptic and neural dynamics, including the spike-frequency adaptation mechanisms that have been recently shown to be crucial in implementing LSTM-like networks with spiking neurons. The asynchronous digital circuits implement a
hierarchical routing scheme that combines the best features of all previously proposed approaches (e.g. the tree-based scheme from NeuroGrid with the 2D-grid mesh scheme from SpiNNaKer) minimizing the memory requirements. Moreover, the device mismatch that is present in the analog circuits is exploited to implement neural sampling and reservoir-computing strategies that require variability.
\subsection{ODIN}
ODIN is a $28\,$nm digital neuromorphic chip demonstrated by Catholic University Louvain in 2019 supporting simple forms of on-chip spike-driven synaptic plasticity (SDSP) \cite{Frenkel2019}. The core supports $256$ neurons which can be configured to implement first-order LIF dynamics as well as the second-order Izikevich dynamics. The neuronal parameters are stored in a $4\,$kB SRAM array, and a global controller is used to time-multiplex the neuron logic circuit to implement the dynamics of the neurons in a sequential fashion. The core also integrates 3-bit $256^2$ synapses which are implemented as a $32\,$KB SRAM array. An additional bit is used per synapse to enable or disable online learning. Using a subset of pre-processed images from the MNIST dataset, the chip demonstrated on-chip learning achieving $84.5\%$ accuracy, and consuming $15\,$nJ per inference with rank-order coding.
Table \ref{table:1} summarizes the state-of-the-art neuromorphic chips today, along with some of their key attributes. Note that representative numbers are reported in the table, and in some instances, it is possible to exceed the performance metrics quoted here by operating the chip at higher frequencies or other operating conditions. Furthermore, newer generation prototype chips that form the building block for the larger systems have been recently reported as alluded to in the text (especially for BrainScaleS and SpiNNaker), although we have included the specifications of the full-scale systems in this table.
\begin{table}[h!]
\centering\caption{Comparison of state-of-the-art neuromorphic chips along with some performance attributes }\tiny
\begin{tabular}{|p{1.6cm}|p{1.9cm}|p{4cm}|p{5.5cm}| }
\hline
Chip & Technology&Integration density & Key functionality/performance metric \\
\hline\hline
SpiNNaker & ARM968, $130\,$nm CMOS (next-gen prototypes: ARM M4F, $28\,$nm CMOS) & Up to 1 K neurons/core, 1 M cores. & Programmable numerical simulations with 72-bit messages, for real-time simulation of spiking networks\\
\hline
TrueNorth & Digital ASIC at $28\,$nm CMOS&1 M neurons, 256 M Synapses; 1-bit synaptic state to represent a connection, with 4 programmable 9-bit weights per neuron &SNN emulation without on-chip learning; $26\,$pJ per synaptic operation.\\% \hl{ from SI of TrueNorth paper} \\
\hline
Loihi &Digital ASIC at $14\,$nm CMOS &130 k neurons, 130 M synapses with variable weight resolution (1-9 bits)&Supports on-chip learning with plasticity rules such as Hebbian, pair-wise, and triplet-STDP, $23.6\,$pJ per synaptic operation (at nominal operating conditions).\\%
\hline
BrainScaleS &Mixed signal waferscale system, $180\,$nm CMOS (next-gen prototype: $65\,$nm CMOS)&180 K neurons, 40 M synapses per wafer & $10^3 -10^4$ fold acceleration of spiking network emulations, with hardware-supported synaptic plasticity. Next-gen prototype: programmable plasticity. \\
\hline
Braindrop &Mixed signal $28\,$nm CMOS &4096 neurons, 64K programmable weights (with analog circuits that allow realization of all-to-all connectivity) & $0.38\,$pJ per synaptic update, implements the single core of a planned million-neuron chip.\\% \hl{from table 3 in Braindrop paper} \\
\hline
DYNAP-SE & Mixed signal $180\,$nm CMOS&1024 neurons, 64K synapses (12-bit CAM)&Hybrid analog/digital circuits for emulating synapse and neuron dynamics, $17\,$pJ per synaptic operation\\
\hline
ODIN & Digital ASIC at $28\,$nm CMOS&256 neurons, 64K synapses with $3$ bit weight and 1 bit to encode learning & $12.7\,$pJ per synaptic operation, implements on-chip spike-driven plasticity \\ \hline
\end{tabular}
\label{table:1}
\end{table}
\section{Neuromorphic computing with memristive devices}\label{devices}
\begin{figure}[ht!]
\centering
\includegraphics[width=0.8\columnwidth]{Figure3.pdf}
\caption{(a) Schematic illustration of memristive devices STT-MRAM, PCM, RRAM, CBRAM. (adapted from \cite{Y2015wongNatNano}). (b) Incremental programming of PCM conductance (adapted from \cite{Y2016tumaNatNano}).} \label{fig:memdev}
\end{figure}
Going beyond conventional CMOS, a new class of emerging nanoscale devices, namely, resistive memory or memristive devices with their non-volatile storage capability, is particularly well suited for developing computing substrates for SNNs. In these devices, information is stored in their resistance or conductance states. The four main types of memristive devices are phase change memory (PCM), metal oxide based resistive random access memory (RRAM), conductive bridge RAM (CBRAM) and spin-transfer-torque magnetic RAM (STT-MRAM) (see Fig. \ref{fig:memdev}{a}). The resistance values of these devices are altered by the application of appropriate electrical pulses through various physical mechanisms, such as phase transition, ionic drift, and spintronic effects. Besides this ability to achieve multiple resistance values, many of these devices also exhibit an accumulative behavior whereby the resistance values can be incrementally increased or decreased upon the application of successive programming pulses of the same amplitude. These attributes are key to their application in neuromorphic computing as illustrated in Fig. \ref{fig:memdev}{b} for PCM devices.
\begin{figure}[ht!]
\centering
\begin{tabular}{c}
\includegraphics[width=0.75\columnwidth]{Neuron_SPM.pdf}
\end{tabular}
\caption{(a) Schematic illustration of phase-change neuron that consists of
the dendrites, the soma and the axon. The key element is the neuronal membrane that stores the membrane potential in the phase configuration of a phase-change memory device. It is possible to connect the dendrites to plastic synapses interfacing the neuron with other neurons in a network. (b) The representation of high frequency signals via population coding of 500 slow-firing stochastic phase-change neurons. Also shown is the error in the representation of the stimulus by the population code. The population code captures the input signal despite the fact that all the neurons in the population have their actual spiking frequency less than twice the base frequency of the input. Adapted from \cite{Y2016tumaNatNano}.}
\label{fig:memneuron}
\end{figure}
The accumulative behavior of memristive devices can be exploited to emulate neuronal dynamics \cite{Y2016tumaNatNano}. In one approach using PCM devices, the internal state of the neuron is represented by the phase configuration of the device (Fig. \ref{fig:memneuron}{a}). By translating the neuronal input to appropriate electrical signals, the firing frequency can be tuned in a highly controllable manner proportional to the strength of the input signal. In addition to the deterministic neuronal dynamics, stochastic neuronal dynamics also play a key role in signal encoding and transmission in biological neural networks. One notable example is the use of neuronal populations to represent and transmit sensory and motor signals. The PCM-based neurons exhibit significant inter-neuronal as well as intra-neuronal randomness, thus mimicking this stochastic neuronal behavior at the device level. Hence, multiple integrate-and-fire cycles in a single phase-change neuron could generate a distribution of inter-spike intervals and this enables population-based computation. By exploiting this, fast signals were shown to be accurately represented by population coding, despite the rather slow firing rate of the individual neurons (Fig. \ref{fig:memneuron}{b}).
Memristive devices organized in a crossbar architecture can also be used to emulate the two essential synaptic attributes namely, synaptic efficacy and plasticity (Fig. \ref{fig:memsynapse}). Synaptic efficacy refers to the generation of a synaptic output based on the incoming neuronal activation; this can be realized using Ohm's law by measuring the current that flows through the device when an appropriate read voltage signal is applied. Synaptic plasticity, in contrast, is the ability of the synapse to change its weight, typically during the execution of a learning algorithm. The crossbar architecture is well suited to implement synaptic plasticity in a parallel and efficient manner by the application of suitable write pulses along the wires of the crossbar.
\begin{figure}[ht!]
\centering
\includegraphics[width=0.8\columnwidth]{Figure5.pdf}
\caption{Memristive devices organized in a crossbar configuration can be used to emulate synaptic communication and plasticity behaviors such as STDP by applying programming pulses from the periphery (adapted from \cite{Kuzum12}). Two devices, one for potentiation (LTP) and the other for depression (LTD) is used to represent the synapse in the array.} \label{fig:memsynapse}
\end{figure}
Although nanoscale devices offer exciting computational possibilities and scaling potential, several challenges need to be overcome to enable commercial products. PCM is based on the rapid and reversible phase transition of certain types of materials such as Ge$_2$Sb$_2$Te$_5$. However, it is necessary to reduce the programming current as well as improve the temporal stability of the achieved conductance states. RRAM and CBRAM typically rely on the formation and rupture of nanoscale filaments to achieve multiple conductance values. This filamentary mechanism is particularly prone to inter and intra-device variations which currently is the major technical hurdle. STT-MRAM devices consist of two magnetic layers separated by a tunnel barrier. These devices exhibit two resistive states depending on whether the magnetization of the two layers is in parallel or anti-parallel direction. These devices are expected to exhibit almost unlimited endurance, and faster switching compared to RRAM and PCM. However, the key challenge is a substantially lower dynamic range in programmable conductance states (typically a factor of 2-3) as opposed to PCM and RRAM (which exhibit a dynamic range exceeding 100). It is crucial that new circuits and architectures are
developed that can mitigate these non-idealities \cite{Y2018boybatNatComm}.
There are also circuit-level challenges such as the voltage drop across the long wires connecting the devices as well as the overhead introduced by data converters and other peripheral circuitry. These aspects would limit the size of memristive crossbars that could be realized. However, in spite of these challenges, it is expected that we could achieve significant gains in areal and power efficiency by employing nanoscale memristive devices in neuromorphic processors \cite{Rajendran15}.
\section{Signal processing applications}\label{apps}
Neuromorphic processors strive to balance the efficiency of computation with the energy needed for this computation, similar to the human brain. Systems enabled by such processors are expected to have the first impact on smart edge devices such as wearables, mobile devices, IoT sensors, and driver-less vehicles which have stringent constraints on size, weight, area, and power, and are required to intelligently interact with the world autonomously for extended periods of time. Neuromorphic approaches could result in highly power-efficient devices capable of responding quickly in an intelligent manner in dynamic environments for such applications.
\begin{figure*}[!ht]
\centering
\includegraphics[width=0.5\linewidth]{narafig_v2}
\caption{Sparse, event-triggered signal encoding which can be mapped efficiently to recurrent populations of spiking neurons with balanced spiking activity, i.e., between excitatory (blue) and inhibitory (red) neurons can enable efficient learning. In an illustrative example with this approach, fewer than 2000 spikes are needed to learn the features of an image that is conventionally represented using more than 100,000 pixels. Adapted from \cite{nara3}. } \label{fig:nara_02}
\end{figure*}
An illustrative example of this neuromorphic approach is the recent demonstration of a recurrent spiking neural network that learns directly from data streams while using only a limited number of training examples and a relatively small memory for learning \cite{nara2}. Real-world data, represented in the form of spikes, was used for event-triggered learning which was implemented in a microprocessor operating in the asynchronous mode \cite{nara3}. SNNs naturally enable sparse representations of data and can be efficiently implemented using asynchronous logic because data processing occurs only during spike events (Fig. \ref{fig:nara_02}). By implementing local learning rules on networks with sparse connectivity, both the memory required to store the network parameters and the time needed to train the model can be minimized significantly compared to traditional machine learning approaches \cite{nara2}. This approach that implements SNNs in asynchronous processors has huge potential to enable edge devices that can learn and infer efficiently in the field.
Concomitant to the development of neuromorphic processors, bio-inspired event-driven sensors have also emerged, which can further accelerate the development of intelligent edge devices \cite{LiuBook15}. The most notable among them is the dynamic vision sensor (DVS) camera inspired by the information processing mechanisms of the retina and the silicon cochlea chip inspired by how the inner ear encodes sound signals in the spike domain. These sensors have superior performance compared to conventional sensors in several aspects. For instance, the DVS camera has a $1000\times$ advantage in sampling rate compared to a conventional camera, which helps in capturing fast changing events in the visual scene \cite{Mueggler2014}. There are several demonstrations of systems that combine such event-driven sensors with efficient neuromorphic processors in recent years, some of which will be discussed below.
We now describe some of the proof-of-concept demonstrations targeting signal processing applications using the neuromorphic platforms discussed in section \ref{chips}. In a notable example using IBM's TrueNorth chip, deep neural networks were trained with a modified backpropagation rule, so that the weights and neuronal dynamics can be easily ported to the hardware which supports only low precision synaptic weights; software equivalent performance was achieved for several benchmark pattern classification tasks with this approach \cite{Esser2016}. In another instance, a convolutional network running on TrueNorth that receives video input from a DVS camera was able to identify the onset of hand gestures with a latency of $105\,$ms while consuming less than $200\,$mW \cite{Amir2017}. Intel's Loihi has demonstrated over three orders of magnitude improvement in energy-delay product compared to conventional solvers running on a CPU for LASSO optimization problems by using a spiking convolutional implementation of the Locally Competitive Algorithm \cite{loihi}.
Similarly, the SpiNNaker platform has already been used in several applications of spiking networks. A large spiking model of visual cortex from a neural simulator running on a conventional compute cluster was recently ported to SpiNNaker, demonstrating comparable accuracy and favorable speed and power consumption \cite{vanAlbadaSpinnvsNest}. Several neuromorphic applications have also been pioneered on the BrainScaleS system, in particular on Spikey, the predecessor of the HiCANN chip. These include several networks performing various tasks from computational neuroscience \cite{Pfeil1311}, and the first published assessment of pattern recognition on neuromorphic hardware \cite{Schmuker2014}.
Due to its ability to operate in real time with biological neuronal signals, NeuroGrid has been used in a closed-loop brain-machine interface (BMI) application \cite{Y2011dethierNIPS}. A Kalman-filter based decoder was implemented via an SNN and tested in BMI experiments with a rhesus monkey. The success of this closed-loop decoder shows the promise of neuromorphic chips for implementing signal processing algorithms in a power efficient manner, which is a major enabling factor for the clinical translation of neural motor prostheses. The DYNAP-SE chip was recently used for reservoir computing that presented the first steps toward the design of a neuromorphic event-based neural
processing system that can be directly interfaced to surface EMG (sEMG) sensors for the on-line classification of the motor neuron output activities \cite{Y2018donatiIEEEBioCAS}.
\begin{figure}[h!]
\centering
\begin{tabular}{c}
\includegraphics[width=0.7\columnwidth]{Fig_MemCorr.pdf}
\end{tabular}
\caption{(a) An SNN trained to perform the task of temporal correlation detection through unsupervised learning. (b) Synaptic weight
evolution as a function of time and the synaptic weight distribution at the end of the experiment. 10\% of the synapses receive correlated input data streams with a correlation coefficient of 0.75. Adapted from \cite{Y2018boybatNatComm}.} \label{fig:memcorr}
\end{figure}
In spite of being saddled with reliability and variability issues, memristive synapses have also demonstrated immense potential for signal processing applications. One noteworthy example was the demonstration of an SNN for detecting temporal correlations in an unsupervised fashion using plastic PCM synapses \cite{Y2018boybatNatComm}. (see Fig. \ref{fig:memcorr}). The network consists of a spiking neuron receiving an event-based data stream which is encoded as pre-synaptic input spikes arriving at PCM synapses; most of the data streams were temporally uncorrelated, but a small subset was chosen to be mutually correlated. Post-synaptic currents are generated at the synapses that received a spike and are integrated by the neuron which generates a spike when its membrane potential exceeds a threshold. An STDP rule was used to update the synaptic weights. Since the temporally correlated inputs are more likely to eventually govern the neuronal firing events, the conductance of synapses receiving correlated inputs should increase, whereas that of synapses whose input are uncorrelated should decrease. Hence, the final steady-state distribution of the weights should show a separation between synapses receiving correlated and uncorrelated inputs. In the experiment, 144,000 input streams were fed through more than one million PCM devices representing the synapses. As shown in Fig. \ref{fig:memcorr}(b), well-separated synaptic distributions were achieved in the network at the end of the experiment, even though the devices exhibited significant device-to-device variability, and drift in the programmed conductance states, demonstrating that nanoscale devices can enable complex computational capabilities in neuromorphic hardware platforms.
\section{Future Outlook}\label{Challenges}
It is widely believed that because of the added temporal dimension, SNNs should computationally be superior to, and thus transcend, the second generation deep neural networks. The energy-efficiency of neuromorphic systems based on SNNs makes them ideal candidates for embedded applications such as mobile phones, robotics, internet of things (IoT), and personalized medicine, which are subject to strict power and area constraints. Moreover, as Moore's law for CMOS scaling is coming to an end, these systems offer unique opportunities to leverage new materials and device structures going beyond standard CMOS processing.
Going forward, there are algorithmic as well as technological challenges. From an algorithmic perspective, despite considerable advances, SNNs are yet to conclusively demonstrate superior performance compared to conventional deep learning, both in terms of accuracy and in many cases in terms of energy-efficiency as well. This gap in performance could be attributed to the lack of efficient and scalable supervised SNN learning algorithms, the lack of efficient local learning rules that can reach the performance of backpropagation, as well as the reliance on rate coding as opposed to more energy efficient temporal coding. Very recently, promising alternatives to rate coding that enable efficient use of spike times have been introduced for SNNs \cite{Y2018kheradpishehNN}. Moreover, it was shown that recurrent SNNs with adaptive neurons can achieve classification performance comparable to state-of-the-art LSTM networks \cite{Bellec18}.
Furthermore, efficient strategies have been demonstrated for converting deep neural networks to spiking networks for complex problems with negligible loss in accuracy \cite{Sengupta2019}. Recently, a novel recurrent ANN unit called
Spiking Neural Unit (SNU) was introduced that directly incorporates spiking neurons in deep learning architectures and achieves competitive performance by using backpropagation through time \cite{Y2018wozniakArXiv}. Finally, it should be noted that some types of neuromorphic hardware support deep learning directly (i.e., without spikes), and powerful algorithms have been developed to leverage the specific advantages of the architectures \cite{SpiNN2DeepR}. Also, modifications of traditional deep learning algorithms have been proposed which enables their implementation in neuromorphic hardware using binary or ternary representations of neuronal activations and synaptic weights, although higher precision is required for gradient accumulation in these networks during training \cite{Courbariaux2015}.
From a technology perspective, there are also numerous challenges associated with the use of memristive devices for neurmorphic computing. One key challenge applicable to all memristive technologies is related to the variations in the programmed conductance states with time and ambient temperature. The non-linearity and stochasticity associated with the accumulative behavior also pose scaling challenges. Recent breakthroughs such as multi-cell architectures hold high promise to address these issues \cite{Y2018boybatNatComm}.
In summary, we believe that there will be two stages of innovations for the field of low-power brain-inspired computing platforms. The near term innovations will come from neuromorphic accelerators built with conventional low-power mixed-signal CMOS architectures, which is expected to lead to a period of transformative growth involving large neuromorphic platforms designed using ultra-low-power computational memories that leverage nanoscale memristive technologies. However, it has to be emphasized that the algorithmic exploration has to go hand-in-hand with advances in the hardware technologies.
{
\section{Authors and Bios}
\textit{Bipin Rajendran} is an Associate Professor of Electrical \& Computer Engineering at New Jersey Institute of Technology. Previously, he was a Master Inventor and Research Staff Member at IBM T. J. Watson Research Center in New York (2006-2012) and a faculty member in the Electrical Engineering department at I.I.T. Bombay (2012-2015). His research focuses on building algorithms, devices, and systems for brain-inspired computing. He has authored over 70 papers in peer-reviewed journals and conferences, and has been issued 59 U.S. patents.
\textit{Abu Sebastian} is a Principal Research Staff Member and Master Inventor at IBM Research – Zurich. He was a contributor to several key projects in the space of storage and memory technologies and currently leads the research effort on in-memory computing at IBM Research - Zurich. He is a co-recipient of the 2009 IEEE Control Systems Technology Award and the 2009 IEEE Transactions on Control Systems Technology Outstanding Paper Award. In 2015 he was awarded the European Research Council (ERC) consolidator grant.
\textit{Michael Schmuker} is a Reader in Data Science at the Department of Computer Science, University of Hertfordshire, UK. His research translates neurobiological principles of sensory computing into algorithms for data processing, inference and control, with a focus on neuromorphic olfaction and gas-based navigation. Michael has an MSc/Diploma in Biology, a PhD in Chemistry, and post-doctoral experience in Computational Neuroscience and Neuromorphic Computing. In 2014 Michael joined the University of Sussex on a Marie-Curie Fellowship (European Commission). In 2016 he joined the University of Hertfordshire as Senior Lecturer in Computer Science and promoted to Reader in Data Science in 2018.
\textit{Narayan Srinivasa} is currently the Director of Machine Intelligence Research Programs at Intel Labs. Prior to that, he was the Chief Technology Officer at Eta Compute focused on developing ultra low power AI solutions for audio applications. From 2016-17, he was Chief Scientist and Senior Principal Engineer at Intel Labs, leading the work on the 14 nm Loihi neuromorphic chip. Prior to that, as the Director for the Center for Neural and Emergent Systems at HRL Laboratories in California, he focused on machine intelligence research and served as the principal investigator for the DARPA SyNAPSE, Physical Intelligence and UPSIDE programs. He has authored over 90 papers in peer-reviewed journals and conferences, and has been issued 66 U.S. patents.
\textit{Evangelos S Eleftheriou} is currently responsible for the neuromorphic computing activities of IBM Research - Zurich. In 2002, he became a Fellow of the IEEE. He was also co-recipient of the 2003 IEEE Communications Society Leonard G. Abraham Prize and the 2005 Technology Award and of the Eduard Rhein Foundation. In 2009 he was a co-recipient of the IEEE Control Systems Technology Award and of the IEEE Transactions on Control Systems Technology Outstanding Paper Award. He was appointed an IBM Fellow in 2005 and was inducted into the US National Academy of Engineering (NAE) as Foreign Member in 2018.}
\section{Acknowledgements}
BR was supported in part by the US National Science Foundation grant 1710009 and the grant 2717.001 from the Semiconductor
Research Corporation. MS received funding from the European Commission H2020 within the Human Brain Project, grant agreement ID 785907. AS acknowledges support from the European Research Council through the European Union’s Horizon 2020 Research and
Innovation Program under grant number 682675.
\ifCLASSOPTIONcaptionsoff
\newpage
\fi
\bibliographystyle{IEEEtran}
| {'timestamp': '2019-08-06T02:24:48', 'yymm': '1901', 'arxiv_id': '1901.03690', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03690'} | arxiv |
\section{Introduction \label{section intro}}
Randomised control trials (RCTs) are considered to be the most reliable means of comparing the effects of multiple treatments or health interventions, sometimes including a control group (placebo or no treatment).
It is increasingly common to exploit the opportunities to conduct retrospective treatment interaction analysis (TIA)\footnote{Such analyses also go under the name of treatment effect heterogeneity (TEH) or treatment effect modifiers (TEM).} on predictor variables in RCT data \cite{altman:2015cl}.
In such cases, the expected effect of a treatment is dependent on the value of one or more predictor variables, for example if the effect of a treatment varies with the age of the subject.
Improvement in the volume of measurements obtainable from each patient (e.g. genomic profiling) leads to a myriad of candidate factors for interaction analysis.
Given the large costs associated with clinical trials, there is a natural desire to learn from the data as much as possible.
However, statistical power is not free and any treatment interaction analysis is certainly not immune from false positive rates.
These are the problems that underlay many challenges of performing a valid interaction analysis.
Our motivating example arises from a severe malaria trial, SEAQUAMAT \cite{dondorp:2005ar}, where investigating the treatment effect heterogeneity can provide valuable insight on the mechanism of the disease.
Moreover, if the utility of a treatment composes of other factors (e.g. costs, side effects etc) additional to the treatment effect, then information on treatment effect heterogeneity can help us make better decisions on medical resource management.
Clearly the power to detect an effect modifier is less than that to detect an overall treatment effect for an equivalent effect size \cite{brookes:2001su,brookes:2004su,rothwell:2005su,burke:2015th}.
In addition, for most interaction analyses the original trial will have been designed to detect an overall main treatment effect without tests for interactions taken into consideration \cite{dondorp:2005so,foster:2015ef,seymour:2007di}.
This can contribute to a lack of power for discovery unless the interaction is larger in magnitude than that assumed for the main effect in the study design \cite{altman:2015cl}, as for subgroups that benefit from a change in treatment the relative population size is smaller by definition.
If a large number of interaction tests are conducted, the study can also suffer from spurious false positives arising from multiple comparisons \cite{ioannidis:2005mi,kent:2010as,burke:2015th}.
On the other hand, false negatives arise due to inadequate power to withstand correction for multiple testing \cite{kent:2010as,burke:2015th}.
If the measurement covariates are dependent, further power can be lost when testing each variable interaction one at a time rather than in a joint analysis \cite{rothwell:2005su,kent:2010as}.
For the reasons above, several recommendations have been made on such analyses to increase the reliability of their findings and better investment of statistical power \cite{rothwell:2005su,kent:2010as,sun:2014us,burke:2015th}.
There is a strong emphasis on a pre-specified analysis plan, wherein the hypotheses are defined \textit{a priori}.
Of these hypotheses, the primary analyses must be distinguished from the secondary analyses and several authors suggest that the primary hypotheses be restricted to a small number (one to two analyses) supported by external theoretical and empirical evidence.
These recommendations send a common message that an interaction analysis plan should be formulated with care.
Careful expenditure of power also resonates with the rationale for using a single global test for interaction discovery, which provides a single p-value against the null hypothesis of ``no treatment interactions.''
It can be envisaged that such a test would require tools that can effectively and efficiently learn about the structure of and the patterns in the entire dataset, which is a challenging task when the dimension the variable space is high.
Machine learning (ML) and AI methods appear to be promising tools through their ability to learn about the data \cite{tibshirani:1996re,friedman:2001gr,friedman:2002st,anastasiadis:2005ne} and there has been increasing interest in employing machine learning methods in medical sciences for disease classification, prognosis and prediction \cite{selaru:2002ar,seligson:2005gl,gevaert:2006pr,akay:2009su,leblanc:2010bo}.
However, the issue remains that a large number of potential stratifying variables leads to an even larger search space for treatment-variable interactions.
Na\"{i}ve application of ML approaches fed with many irrelevant variables can lead to high dimensional models that can substantially diminish the power of a hypothesis test.
Careful selection of potential stratifiers before discovery can therefore improve the power to detect true associations for a given effect size.
In this article, we present a framework that facilitates the incorporation of ML algorithms for treatment interaction detection in RCT data.
We show that it is possible to use the clinical response (outcome variable) in an initial screening stage to reduce the number of stratifying variables without inflating the type-I (false positive) error rate at the interaction stage.
In this way the interaction analysis can be applied to a targeted subspace effectively reducing the multiple comparisons in the search for interactions.
The essence is to prioritise main effects for interaction testing over those covariates showing no evidence of association with variation in the clinical response.
We provide theoretical results to support our assertion, making use of the randomisation of treatments in the design.
Hence ML algorithms can informatively guide the interaction detection in order to achieve more careful expenditure of power, while ensuring that the false positive rate is controlled in a rigorous manner.
It has been proposed to use an internally developed risk model to discover TEH in RCT data \cite{burke:2014us} and it has been applied to retrospective analysis of TEH in several large RCT datasets \cite{kent:2016ri}.
This approach permits the inclusion of multiple baseline covariates to construct the internal risk model (IRM).
We provide theoretical support for this approach as it can be considered as a special case of our method.
In addition, conventional practice of the IRM approach for TEH discovery excludes the treatment variable to avoid potential biases \cite{kent:2016ri}.
This is shown to be unnecessary as a consequence of the same mathematical results that support the validity of our framework.
Furthermore, we illustrate that our framework can provide better resolution of TEH, and how that can be more sensitive to the TEH signal in certain scenarios.
\subsection{South East Asian Quinine Artesunate Malaria Trial (SEAQUAMAT)}
We demonstrate our TEH detection framework in the context of an analysis of a large anti-malaria drug trial, SEAQUAMAT \cite{dondorp:2005ar}.
The R notebooks of the interaction analyses are in the Supporting Information (SI).
SEAQUAMAT is a large randomised clinical trial that compared intravenous quinine to intravenous artesunate for treatment of severe \textit{Plasmodium falciparum} malaria.
The trial was conducted at multiple medical centers in Bangladesh, India, Indonesia, and Myanmar.
The findings of this trial provided strong evidence that intravenous artesunate had superior efficacy than intravenous quinine with one third reduction in mortality.
Severe malaria is a medical emergency with potentially a high rate of case fatality (10 -- 40\%), therefore it is of paramount interest to understand how the treatment effect of artesunate may vary in the patient population even though its superiority of overall efficacy is well established \cite{white:2014ma}.
\section{Screening for evidence of main-effects before testing for treatment effect heterogeneity}
\label{sec:methods}
We describe a two-stage approach to interaction discovery whereby in the first stage variables are ranked by their main-effect strength of association with the outcome response.
This is followed by an interaction discovery stage using only the $K$ leading covariates from Stage-1.
We show that outcome-driven screening at the first stage does not inflate the p-values obtained in the second stage testing for treatment interaction and moreover demonstrates the consistency property.
\subsection{Analysis scheme}\label{sec:analysisScheme}
For ease of exposition we restrict attention to a balanced two-arm clinical trial where individuals are randomised with equal probability onto a treatment arm $A$ versus a standard-of-care $B$.
\subsubsection{First stage: prognostic variable screening}\label{subsubsec:pvs}
We consider an additive generalised linear regression model (GLM) for the clinical outcome,
\begin{equation}
\E{\bm{y}} = g\left(\bm{\alpha} + \bm{X_\mathrm{S}}\bm{\beta} + \grpT{\mathbb{I}}\theta + \bm{X_\mathrm{C}}\bm{\beta_\mathrm{C}}\right),
\label{eq:main}
\end{equation}
where $\bm{y}$ denotes the clinical response for $n$ individuals recruited onto the trial, $\bm{\alpha}$ represents an intercept term, the $n \times p$ matrix $\bm{X_\mathrm{S}}$ contains $p$ interaction-candidate covariates so that $\bm{\beta}$ is a $p$-dimensional regression coefficient vector.
The term $\grpT{\mathbb{I}}$ denotes an indicator binary vector of the randomised treatment allocations with elements $\grpT{\mathbb{I}}^{(i)} = 1$ if the $i$'th individual received the treatment and $\grpT{\mathbb{I}}^{(i)} = 0$ otherwise, such that $\theta$ captures the causal average treatment effect.
The $n \times p_c$ matrix $\bm{X_\mathrm{C}}$ contains covariates, decided \textit{a priori} to be irrelevant to treatment interactions.
These could be variables that characterise the trial procedure (e.g. site of treatment) instead of the patients themselves.
The function $g\left(\cdot\right)$ is the link function that performs element-wise operation on the linear predictors.
To screen for main-effects the GLM (\ref{eq:main}) can be fit to the data to obtain a rank ordered set of variables, $\rank{X} = \left\{\rank{x_1}, ..., \rank{x_p}\right\}$, which is ordered from the most informative covariate $\rank{x_1}$ to the least informative $\rank{x_p}$.
Such ordering could be achieved through various ways, which we elaborate in section \ref{subsec:singleScreen} .
Following this, only the $K$-leading variables, $\bm{X_{\mathrm{S}_K}}$ an $n \times K$ matrix, are selected for inclusion in the interaction discovery stage.
Note that the dimension $K$ should be decided {\em{a priori}} based on considerations of power, and not using the results of fitting the GLM.
Setting $K$ adaptively based on the evidence in $\bm{\hat{\beta}}$ from the first stage induces p-values that are not uniformly distributed under H0.
Because in that situation the degrees of freedom (DF) of the test will be subjected to random sampling.
\subsubsection{Second stage: testing for treatment interactions}
The selected covariates $\bm{X_{\mathrm{S}_K}}$ can then be tested for treatment interactions via the following model
\begin{equation}
\E{\bm{y}} = g\left(\alpha + {\rm{diag}}(\grpT{\mathbb{I}}) \bm{X_{\mathrm{S}_K}}\bm{\beta_{\mathrm{A}_K}} + {\rm{diag}}(\bf{1} - \grpT{\mathbb{I}}) \bm{X_{\mathrm{S}_K}}\bm{\beta_{\mathrm{B}_K}} + \grpT{\mathbb{I}}\theta + \bm{X_\mathrm{C}}\bm{\beta_\mathrm{C}}\right),
\label{eq:interaction}
\end{equation}
where ${\rm{diag}}(\grpT{\mathbb{I}})$ is a $n \times n$ indicator matrix with $1$'s on the diagonal elements where the corresponding vector $\grpT{\mathbb{I}}$ has a 1, and 0's elsewhere, so that we have a separate regression coefficient vector for the treatment group $\bm{\beta_{\mathrm{A}_K}}$ to that of the standard-of-care $\bm{\beta_{\mathrm{B}_K}}$.
A test for interaction can then be derived by considering the standardised magnitude of the difference vector $\left(\widehat{\bm{\beta_{\mathrm{A}_K}}} - \widehat{\bm{\beta_{\mathrm{B}_K}}}\right)$ using a test (e.g. LRT) with a corresponding p-value that is uniform under the null hypothesis ${\rm{H0}}: (\bm{\beta_{\mathrm{A}_K}} - \bm{\beta_{\mathrm{B}_K}}) = {\bf{0}}$ regardless of the fact that the variable selection in Stage-1 uses information in the outcome-driven $\bm{\hat{\beta}}$.
As a test such as the LRT provide the single p-value to indicate the evidence for interaction with treatment, it provides our framework facilitates a global test for detecting TEH.
\subsection{On the flexibility of prognostic variable screening}\label{sec:screening}
In this section we discuss various possible options for screening prognostic variables in Stage-1 (section \ref{subsubsec:pvs}).
We begin with single-stage screening procedures (section \ref{subsec:singleScreen}), followed by multi-staging screening (section \ref{subsec:pcr}), which is more generalised.
We recommend using the multi-stage screening to make the most of supervised and unsupervised ML algorithms.
\subsubsection{Single-stage screening for prognostic variables}\label{subsec:singleScreen}
We first consider the situation where variable selection is only applied once.
Possible options are:
\begin{enumerate}
\item Fitting the full additive model \eqref{eq:main}, for example in R using {\tt{glm.R}}, and then ordering by the associated p-values assigned to the coefficients.
\item Running a LASSO model \cite{tibshirani:1996re} and then ranking by the order for which the variables enter into the LASSO path.
\item Fitting $p$ independent GLMs of the form (\ref{eq:main}) but where we include only a single variable (column) of $\bm{X_\mathrm{S}}$ at each time.
Then ranking covariates by the univariate p-values assigned to the columns of $\bm{X_\mathrm{S}}$ from each model.
\item Taking principle components (PCs) of $\bm{X_\mathrm{S}}$ to form a new basis design matrix $\bm{X_\mathrm{S}}^*$ with orthogonal columns made up of the PCs, and then using either option 1.\, or option 2.\, above to rank the leading PC regression coefficients.
\end{enumerate}
Option 1 is only suitable for datasets with a small or moderate number of variables, as \cite{sur:2017li} shows that in a logisitc regression, the $\chi^2$ distribution is a poor approximation of the LRT statistic when the number of variables is large in a finite dataset.
Option 2 is suitable for high-dimensional data especially when many of the covariates are not explanatory.
Option 3 is suitable for fast processing of high dimensional data, but because the selection is based on univariate regressions, it can lose power in the absence of other independent variables that can help to reduce the noise.
Option 3 has a flavour of (univariate) filter methods for feature selection \cite{battiti:1994us,guyon:2003in}.
All of the options 1–--3 do not resolve the problem of multi-collinearity.
Application of principal component analysis (PCA) in option 4 transforms the covariates into a set of orthogonal basis, it resolves the problem of multi-collinearity.
Hence this option is suitable for datasets having many highly correlated variables, which can occur when multiple covariates measure the same quantity.
Consequently, it enables the application of supervised methods that suffer in presence of multi-collinearity (e.g LASSO).
Although tree-based methods such as random forest can cope with multi-collinearity and therefore their performances are not affected, applying the supervised analysis on the PC scores can avoid mis-interpretation of variable importance resulted from multi-collinearity.
It is worth noting that PCA is an unsupervised approach to explain the variation in the covariates.
This means that while the most variable PC is the most informative of the shape of the covariate data cloud, it is not necessarily associated with the outcome of interest.
The advantage of our supervised approach is that it permits the variable selection to be guided by the outcome.
Thus, even if the most variable PCs are approximately noise variables, our approach is able to give priority to less variable PCs that demonstrate greater explanatory power.
There is a very interesting connection between our approach and the IRM approach \cite{burke:2014us}.
The IRM approach first constructs a regression model to explain the outcome by a set of baseline variables.
The treatment is excluded (blinded) and the model is fitted to the data from both treatment arms (instead of the control arm only).
\begin{equation}
\E{\bm{y}} = g\left(\bm{\alpha} + \bm{X_\mathrm{S}}\bm{\beta}\right),
\label{eq:irmbt}
\end{equation}
where the mathematical terms are defined the same as in equation \ref{eq:main}.
For each patient, one calculates a risk score, which defined by the linear predictor of equation \ref{eq:irmbt}.
Subsequently, another regression model is fitted containing the main effect of the treatment, the main effect of the risk scores and the effect of the interaction between the two.
The presence of TEH is suggested by a significant effect of treatment-risk-interaction.
Like the PC scores, a risk score is also a linear projection of the baseline variables.
If $K=1$, option 4 above suggests using a supervised approach to select the most explanatory linear projections provided by PCA.
On the other hand, the IRM approach can be interpreted as selecting the most explanatory linear projection from all possible linear projections.
There are two important differences between our framework and the IRM approach.
Firstly, the main effect of treatment is included in our framework.
The IRM approach excludes the treatment assignment indicator when developing the IRM due to concerns with the potential inflation of false positive risk-treatment-interaction.
Our mathematical argument for the validity of our framework also shows that this exclusion is unnecessary.
Secondly, our framework allows the strength of the interaction effect to vary across the selected variables, whereas in the risk score approach all variables composing the risks score share the same interaction effect.
Our method has the advantage of providing greater resolution of TEH.
Consider the scenario where a (selected) variable has a relatively small main effect but has major contribution to the effect of the interaction with treatment, while the variables with dominating main effects do not interact with the treatment.
Our method can detect this signal directly because it models the individual interaction effect between the treatment and each selected variable.
However, the IRM will suffer as the dominating variables in the risk score will largely determine the shared interaction effect.
Therefore if those dominating variables do not interact with treatment, then the overall signal of treatment-risk-interaction can be diminished.
\subsubsection{Multi-stage ML screening for prognostic variables}\label{subsec:pcr}
If the ML algorithm suggests that there are $M$ variables predictive of the outcome and $M > K$, then modelling with the $K$-leading covariates may not be sufficient and potentially discarding what powerful ML methods can offer.
This can be resolved by applying dimension reduction methods such as PCA to the subset of the covariates that are found via ML to be predictive of the response.
The $K$-leading PCs will encapsulate the information from the $M$ covariates.
Stage-1 can be expanded to have multiple substages of selection:
\begin{enumerate}
\item Substage-I: covariate selection with ML algorithm
\begin{enumerate}
\item An additive model is fitted to the whole dataset via a machine learning method, e.g LASSO \cite{tibshirani:1996re,zou:2005re,yuan:2006mo}, or boosting with stumps \cite{freund:1995de,friedman:2001gr}. \label{itm:mlFit}
\item The output of step \ref{itm:mlFit} is used to rank the explanatory power of the variables, and determines $\bm{X_\mathrm{M}}$, which is an $n \times M$ matrix that contains all the variables predictive of outcome\label{itm:MLsubset}. \label{itm:MLsubset}
\end{enumerate}
\item Substage-II: Selection of PCs
\begin{enumerate}
\item PCA is applied to $\bm{X_\mathrm{M}}$.
\item To produce $\bm{X_{\mathrm{S}_K}}$, the $K$-leading PCs can be selected based on their score variances or the strength of association with $\bm{y}$.
\end{enumerate}
\end{enumerate}
The positive integer $M$ can vary from sample to sample as long as $K$, is pre-defined given $n$.
This is because the subsetting by ML in Substage-Ib of Stage-1 is independent of the interaction (to be discussed in section \ref{sec:theory} and Web Appendix A).
Therefore the DF is still kept at $K$ for the LRT in Stage-2.
Here, the scheme is described with PCA, but it can be substituted with other (unsupervised) ordination methods.
\section{Theory}\label{sec:theory}
In order to justify the proposed scheme, it requires to show that the variable selection at Stage-1 does not influence the findings of interaction detection in Stage-2.
\begin{subgTh}
Let $\bm{\std{\hat{\beta}}}$ denote the standardised MLE of the main covariate effects in an additive GLM, while $\bm{\std{(\grpA{\hat{\beta}} - \grpB{\hat{\beta}})}}$ represents the standardised MLE of the difference in treatment-specific covariate effects in an interaction model with randomised treatments $A$ and $B$.
Under a null hypothesis of ``no difference in covariate effects across treatment arms'', $\bm{\std{\hat{\beta}}}$ is independent of $\bm{\std{(\grpA{\hat{\beta}} - \grpB{\hat{\beta}})}}$, such that $\bm{\std{\bm{\hat{\beta}}}} \perp \bm{\std{(\grpA{\hat{\beta}} - \grpB{\hat{\beta}})}}$.
Hence, dimension reduction via informative variable selection using $\bm{\std{\bm{\hat{\beta}}}}$ does not bias the subsequent findings of interaction discovery $\grpA{\hat{\beta}} \ne \grpB{\hat{\beta}}$.
\label{theorem:subg}
\end{subgTh}
Proof: The proof is contained in Web Appendix A.
The proof also shows that theorem 1 holds after a linear transformation on the covariates.
In practice, the requirement of prognostic screening at Stage-1 depends on the power we have in the test for interaction in Stage-2.
If there is sufficient power to perform a global test with all $p$ variables then Stage-1 can be bypassed and therefore $K = p$.
If the power at Stage-2 is insufficient to include all $p$ variables, then prognostic screening is performed to select $K$ variables.
$K$ should be a deterministic function of $n$ that is monotonic increasing with no upper bound, such as $\log(n)$ or power curve based on $n$ (but independent of the sampled covariate values $\bm{X}$ as they vary from sample to sample).
Permitting $K$ to increase with $n$ ensures the consistency of the procedure.
That is even with the worst case scenario where true interaction occurs at the least prognostic variable $\bm{x_j}$, as $n$ tends to infinity, $K$ will eventually reach $p$ to include $\bm{x_j}$.
The property of such a scheme relies on the test in Stage-2 to be consistent, such as the LRT.
Theoretically, this scheme can even withstand the cryptic interactions that leads from $\beta_{Aj} \ne \beta_{Bj}$ but $\beta_j = 0$.
In section \ref{subsec:pcr} we have discussed a screening procedure with two substages.
In Substage-I, a chosen supervised approach selects $M$ covariates, $\bm{X_\mathrm{M}}$, based on the evidence for their prognostic effect.
And subsequently in Substage-II, we select the $K$-leading PCs of $\bm{X_\mathrm{M}}$ from Substage-I.
If the selection of the PCs is based on the ranking of PC score variance, then it is independent of outcome.
Hence the outcome-driven dimension reduction is only executed in Substage-I to obtain $\bm{\beta_\mathrm{M}}$, and theorem 1 states this selection does not influence the subsequent interaction test.
If the PC selection is based on the ranking of their strength of association with the outcome, then the outcome-driven dimension reduction is performed in both substages.
The covariates $\bm{X_\mathrm{M}}$ are selected in Substage-I as above.
PCs of $\bm{X_\mathrm{M}}$ is a linear transformation.
Since theorem 1 holds after a linear transformation on the covariates, this means that the PCs of $\bm{X_\mathrm{M}}$ can be selected via a supervised approach to obtain $\bm{X_\mathrm{S}}$ in substage-II without biasing the test in Stage-2 that detects the interaction between treatment and $\bm{X_\mathrm{S}}$.
Lets consider all possible linear transformations.
Because theorem 1 is stable under linear transformation, if we select the most prognostic linear combination of the covariates, it will not induce bias the subsequent interaction test.
So a consequence of our proof is that if the treatment is included in a GLM risk model as in equation \ref{eq:main}, it will not inflate the false positive rate of risk-treatment-interaction.
In that case the GLM risk model would take the form in equation \eqref{eq:main}, and the risk score would be defined as $\bm{X_\mathrm{S}}\bm{\beta}$.
In fact, given a set of variables, one can perform any transformation or basis expansion to generate a new set of bases as the interaction candidates.
As long as these operations do not depend on a function of the treatment indicator, the new set of basis can be fed into our framework described in section \ref{sec:analysisScheme} without inflating the false positive rate.
This enables the accommodation of non-linearity, and moreover allows the employment of various powerful ML methods such as boosting \cite{friedman:2001gr}.
\section{Empirical study}
We demonstrate our proposed scheme for interaction detection on the RCT dataset from SEAQUAMAT \cite{dondorp:2005ar}.
Detailed description of the variables and the following analyses are in the R notebooks in SI.
We first describe the data preparation required for the analysis (section \ref{sec:processData}).
Subsequently we present the analysis including all the biological variables in the interaction test, and illustrate its lack of power, which motivates the development of our methodology.
As mentioned in section \ref{sec:screening}, we prefer the multi-stage screening procedure and therefore this screening procedure is chosen for our primary analyses presented in section \ref{sec:primaryAnalysis}.
There we demonstrate that power can be gained from adopting our framework for TEH discovery.
The full details of the analyses in this section can be found in R notebook S1: Empirical demonstration of interaction analysis on full malaria trial dataset.
\subsection{Pre-process of data}\label{sec:processData}
The dataset is first examined to determine any processing required prior to the analysis.
Missing values are imputed by the R package MICE \cite{buuren:2011mi} and 50 imputed datasets are created.
The analysis is performed on each imputed dataset to investigate whether the findings are consistent across imputation variation.
\subsection{Interaction analysis with GLM including all variables}
In this dataset there are 14 biological variables that serve as interaction-candidates.
While it is understandable that treatment site (country) may have an overall effect, it is not so intuitive to expect it to interact with treatment.
Therefore, country is included in the model for overall adjustments, but not included as an interaction-candidate.
We fit the full additive model $\mathcal{M}^\mathrm{(F)}_\mathrm{{A}}$ and the full interaction model $\mathcal{M}^\mathrm{(F)}_\mathrm{{I}}$.
So that $\mathcal{M}^\mathrm{(F)}_\mathrm{{A}}$ includes the main effect of all variables,
while $\mathcal{M}^\mathrm{(F)}_\mathrm{{I}}$ also includes all the interaction terms between treatment and the 14 biological variables.
For each imputed dataset, an LRT is performed to test whether $\mathcal{M}^\mathrm{(F)}_\mathrm{{A}}$ is an adequate approximation of $\mathcal{M}^\mathrm{(F)}_\mathrm{{I}}$.
The median LRT p-value is 0.115 (p-value range = [0.0775, 0.159], 3 s.f.\footnote{$x$ s.f. is short for rounding to $x$ significant figures.}), only 9 of the 50 imputed datasets have ANOVA p-values $<0.1$.
It is apparent that there is no evidence of treatment interaction in SEAQUAMAT dataset, which may be due to lack of power for testing all 14 variables simultaneously.
\subsection{Interaction discovery with PC-GLM after outcome-driven dimension reduction}\label{sec:primaryAnalysis}
After data preparation (section \ref{sec:processData}), we do not observe high correlations among the covariates.
(Further details are provided in the data preparation section in the R notebook S1.)
Therefore, it is more appropriate to perform the supervised variable selection on the covariates directly rather than the PCs.
This supports our choice of multi-stage screening.
Recall that multi-stage screening divides Stage-1 into substages.
Section \ref{sec:pavs} describes Substage-I, where we perform supervised variable selection to subset the variables.
Then in Substage-II, PCA is applied to this subset of variables.
We present two variants of this analysis, where the $K$-leading PCs are selected based on (i) their variances (section \ref{subsubsubsec:uspca}) and (ii) supervised selection guided by outcome (section \ref{sec:spca}).
\subsubsection{Supervised screening by the gradient boosting model}\label{sec:pavs}
To screen the covariates, an additive model is fitted by a gradient boosting model (GBM) \cite{friedman:2001gr,friedman:2002st} with stumps by using the R package gbm \cite{ridgeway:2017gb}.
The covariates are ranked according to the relative influence (RI) values.
Of the 50 imputed datasets, 37 supports a model with treatment, country and additional 10 biological covariates.
These biological covariates are consistent cross the 37 imputed datasets and these are coma, logged parasitaemia, age, heart rate, temperature ($^\circ\text{C}$), systolic blood pressure, haematocrit, weight, jaundice, duration of fever (days).
\subsubsection{Unsupervised PC selection}\label{subsubsubsec:uspca}
From the additive model fitted using GBM with stumps in section \ref{sec:pavs}, we have identified a subset of 10 biological variables that have the greatest explanatory power in the majority (37/50) of the imputed datasets.
PCA is subsequently performed on this subset and the PCs are ranked by their PC score variances.
Here, we test whether there are differences in PC effects between treatment groups.
Again, for the purpose of demonstrating our method, we iterate through values of $K$ from 1 to 10 for the LRT in the Stage-2.
The results from testing the interactions between treatment and the leading PCs exhibit a reasonably stable pattern as portrayed in figure \ref{fig:malariaPCARegDFs}.
There is generally no evidence of interactions between treatment and the $K$-leading PCs for $\mathrm{DF} = K = {1, ..., 5}$, where all of the imputed datasets have p-value $>$ 0.1.
The number of imputed datasets with p-value $<$ 0.1 is respectively 47, 50, 50, 50 and 34 for including the leading 6, 7, ..., 10 PCs.
The overall evidence for interactions is strongest when testing for interaction between treatment and the 7 leading PCs.
The evidence gradually weakens as more PCs are added, suggesting the minor PCs are not so informative of TEH.
\begin{figure}[ht]
\centering
\includegraphics[width=0.8\textwidth]{fullMalariaPCARegDFs.pdf}
\caption{The LRT p-values versus degrees of freedom ($K$) across 50 imputed datasets of all 1461 patients recruited onto the SEAQUAMAT trial.
Here, $K$ represents the number of most variables PCs included in test for interaction with treatment.}
\label{fig:malariaPCARegDFs}
\end{figure}
When including the 7 leading PCs in the interaction test, where the median p-value = 0.0435 (p-value range = [0.0221, 0.0638]) and p-value $<$ 0.05 for 39 of the 50 imputed dataset.
Moreover, figure \ref{fig:malariaPCAGLMLRTPvals} illustrates that the evidence for TEH is noticeably stronger (LRT p-value decreases) for every imputed dataset when we reduce the variables tested from all 14 biological variables to the 7 PCs representing the 10 variables selected by GBM (in section \ref{sec:pavs}).
\begin{figure}[ht]
\centering
\includegraphics[width=0.7\textwidth]{malariaPCAGLMLRTPvals.pdf}
\caption{Comparison of LRT P-values in a PC-GLM framework for the 1461-patient SEAQUAMAT data.
For every of the 50 imputed dataset, the LRT p-values for TEH are compared between the analysis with all 14 biological variables and that with the 7 leading PCs that represent all the variables picked by supervised-variable selection (GBM) in Substage-I of Stage 1.
The purple straight line goes through the origin and has a slope of 1.}
\label{fig:malariaPCAGLMLRTPvals}
\end{figure}
There is a notable increase in the strength of evidence for interactions when PC6 is included to test for interaction with treatment.
From inspecting the correlations between PC6 and biological variables, we find that PC6 is most strongly correlated with jaundice and then systolic blood pressure.
Furthermore, jaundice and systolic blood pressure have the largest absolute PC6 coefficients across all imputed datasets.
The signal for interactions attributed to jaundice and systolic blood pressure appears to be captured by PC6.
The variables identified here, jaundice and then systolic blood pressure, that seems to be responsible for TEH, are consistent with the results from the analysis with single-stage screening (B.1.1 of Web Appendix B), where the evidence for interactions strengthens when jaundice and systolic blood pressure are added in turn.
Comparing figure \ref{fig:malariaPCAGLMLRTPvals} with Web Figure B.2 (in Web Appendix B), the power to detect interactions appears to greater when using multi-stage screening than single-stage screening.
In summary, this analysis clearly demonstrates the how power can be gained after supervised selection of variables based on the evidence for the main effects without segregation by treatment arms.
\subsubsection{Supervised PC selection} \label{sec:spca}
For each imputed dataset, an additive LASSO model is constructed to explain the outcome by the treatment and the PCs obtained in PCA (described in \ref{subsubsubsec:uspca}).
This provides a ranking of the PCs by the explanatory power of their main effects.
Therefore, $K$ represents the most explanatory PCs informed by LASSO.
To explore the property of this analysis design, we iterate through values of $K$ from 1 to 10 when performing the interaction test in Stage-II.
Figure \ref{fig:malariaSupPCARegDFs} presents the LRT p-values obtained from each imputed datasets for $K = \left\{1, ..., 10\right\}$.
In general, it appears that the power is the strongest when we include the $K = 2$ most explanatory PCs in the interaction test.
In this case, 34/50 of the imputed datasets have LRT p-values $<$0.05, and 41/50 of those have LRT p-values $<$0.1.
For these 41 imputed datasets, PC6 is found in the $K = 2$ PCs selected for the interaction test.
This indicates that PC6 is most informative of TEH, which is consistent with the analysis presented in sections \ref{subsubsubsec:uspca}, which indicates that PC6 is most informative of TEH.
\begin{figure}[ht]
\centering
\includegraphics[width=0.8\textwidth]{fullMalariaSupPCARegDFs.pdf}
\caption{The LRT p-values versus degrees of freedom ($K$) across 50 imputed datasets of all 1461 patients recruited onto the SEAQUAMAT trial.
Here, $K$ represents the number of most variables PCs included in test for interaction with treatment.}
\label{fig:malariaSupPCARegDFs}
\end{figure}
The pattern of p-values across $K$ is much more noisy in figure \ref{fig:malariaSupPCARegDFs} than that in figure \ref{fig:malariaPCARegDFs}.
This is due to the variation in the LASSO ranking of PCs across imputed datasets.
Once we have included the most two explanatory PCs in the interaction test, inclusion of additional PCs generally leads to drop of power.
This is because, in this case PC6 is most informative of TEH and it is also (nearly) most explanatory.
However, it is important to note that this phenomenon is not necessarily the case as we have already explained in section \ref{sec:theory} and the proof in Web Appendix A.
\subsubsection{Supplementary analyses}
Aside from the primary analysis presented in section \ref{sec:primaryAnalysis}, we have also performed additional analyses on the same dataset to further explore our method.
These supplementary analyses are presented in Web Appendix B, containing two sections: B.1 and B.2.
In section B.1, we present a variant of the analysis in \ref{sec:primaryAnalysis}, where we employ single-stage screening instead of the preferred multi-stage screening.
In section B.2, we present the analyses on subsets of the SEAQUAMAT trial data to investigate the behaviour of our method when the sample size is substantially reduced.
\section{Discussion}
In this paper we present a framework that increases the power of interaction discovery by outcome-driven selection of variables without inflating the type I error rate.
Using the severe malaria trial data as a motivating study for our method, there appears to be TEH of artesuate.
While the interaction test we perform is global, we are still able to decompose the signal, which suggests that the TEH may be attributed to jaundice and systolic blood pressure.
Interaction discovery plays a key role in stratified medicine and is a challenging task as soon as the number of interaction candidate exceeds a handful of variables.
The limited power for interaction discovery forbids a carpet search for the interaction effects.
This conflicts with the desire to learn as much as possible from the data and stresses the need for global hypothesis testing tools for interaction discovery.
Our novel screening procedure is fairly flexible and hence can take advantage of powerful ML algorithms.
While we have focused on application to clinical trial data in this paper, our flexible framework can be applied to datasets from any equivalent randomised experiments for retrospective exploration of TEH.
ML algorithms themselves lack the statistical rigour required for hypothesis testing.
In spite of this, our mathematical results support the validity of how ML algorithms are incorporated in our hypothesis testing framework.
In line with the recommendations on interaction analyses that demands hypotheses to be pre-defined \cite{rothwell:2005su,kent:2010as,sun:2014us,burke:2015th}, our framework requires determining \textit{a priori} the degree of freedom ($K$) of the test for interaction effect in Stage-2.
This is an important reminder that there is no free power.
The decision on the degrees of freedom and the rest of the analysis would be recorded in a scientific notebook such as an R notebook \cite{allaire:2017rm}.
In contrast to the strictly hypothesis driven interaction analyses, our framework relaxes some of the stringencies as it does not require explicit specification of the (few) factors to be tested.
Instead we can initiate with a much larger pool of candidates, and then narrow it down by variable selection and dimension reduction by ML algorithms.
Furthermore, the highly flexible ML algorithms have much weaker assumptions on the properties of the underlying random process than traditional methodologies.
Therefore it allows the data to speak for itself.
We found that our approach can be considered as a generalisation of the internal risk model approach.
Because our framework facilitates TEH discovery with finer resolution by allowing the interactions between the treatment and the variables to be modelled individually.
Therefore it can better detect TEH when the variables driving TEH have weaker signal for main effect than dominating prognostic variables that do not contribute to TEH.
The statistical evidence for TEH provided by this method is at the global level and not for the variables individually.
If global signal is decomposed to pin down the potential set of variables responsible for treatment interaction, it should be treated with caution, specifically transformation has been applied.
In our demonstrations, PCA was employed for dimension reduction, which performs a linear transformation.
By examining the PC coefficients or the correlations between the PCs scores and variables of interest, it allows us to hypothesise which variables interact with the treatment.
However, if there are concerns regarding the interpretability of an analysis with a transformation, then the user need to design the analysis based on what is more important.
The user should always use the transformation that is most meaningful to the problem of interest.
If the purpose of the analysis is to purely indicate whether or not there is evidence for TEH, then the user only need to interpret the LRT p-value, so it might be more appropriate to choose a transformation that would achieve the most thorough exploration of the data.
However, if the aim of the analysis is to generate hypotheses on which specific variables contribute to TEH, then they should employ the transformation (including no transformation) that would be most helpful for deciding which variables to be tested in future experiments.
Of course, there is a trade-off---a simpler analysis would be easier to interpret but it can potentially miss the complex patterns and hence the signal in the data.
This is one of the examples of ``no-free-lunch'' in statistical analysis.
It is also important to note that if the user decomposes the global/aggregated interaction signal to obtain a suggested set of original variables driving the interaction with treatment, the identification of an interaction between the treatment and a specific variable should be viewed as hypothesis generation.
Our framework furnishes a more holistic exploration of the data while also provides rigorous evidence for potential interactions in retrospective interaction analyses.
Although the false positive rate is controlled in our approach, the findings from using this framework will still need to be replicated in other datasets for validation \cite{rothwell:2005su}.
However, our method can assist researchers to decide whether to further invest in exploring the heterogeneous effect of a treatment.
\section*{Acknowledgements}
C.-H. Wu is funded by Medical Research Council UK and Cancer-Research UK (Grant no.: ANR0031).
We thank Mahidol University Oxford Tropical Medicine Research Unit (MORU) for providing us with the data from the SEAQUAMAT trial. C. C. Holmes is supported by the Medical Research Council UK, the EPSRC, the Alan Turing Institute, and the Li Ka Shing Centre for Health Innovation and Discovery.
\bibliographystyle{unsrt}
| {'timestamp': '2019-01-14T02:12:29', 'yymm': '1901', 'arxiv_id': '1901.03531', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03531'} | arxiv |
\section{Self-Stabilizing Distributed Reset Algorithm}\label{sec:algo}
\subsection{Overview of the Algorithm}
In this section, we present our distributed cooperative reset
algorithm, called {\tt SDR}\xspace. The formal code of {\tt SDR}\xspace, for each process $u$, is
given in Algorithm~\ref{alg:A}. This algorithm aims at reinitializing
an input algorithm {\tt I} when necessary. {\tt SDR}\xspace is self-stabilizing in
the sense that the composition {\tt I} $\circ$ {\tt SDR}\xspace is self-stabilizing
for the specification of {\tt I}. Algorithm {\tt SDR}\xspace works in anonymous
networks and is actually is multi-initiator: a process $u$ can
initiate a reset whenever it locally detects an inconsistency in {\tt
I}, {\em i.e.}, whenever the predicate $\neg\mathbf{P\_ICorrect}\xspace(u)$ holds
({\em i.e.}, {\tt I} is locally checkable). So, several resets may
be executed concurrently. In this case, they are coordinated: a reset
may be partial since we try to prevent resets from overlapping.
\subsection{The Variables}
Each process $u$ maintains two variables in Algorithm {\tt SDR}\xspace: $\variable{st}_u
\in \{C,RB,RC\}$, the {\em status} of $u$ with respect to the reset,
and $\variable{d}_u \in \mathds{N}$, the {\em distance} of $u$ in a reset.
\paragraph{Variable $\variable{st}_u$.}
If $u$ is not currently involved into a reset, then it has status $C$,
which stands for {\em correct}. Otherwise, $u$ has status either $RB$
or $RF$, which respectively mean {\em reset broadcast} and {\em reset
feedback}. Indeed, a reset is based on a (maybe partial) {\em
Propagation of Information with Feedback (PIF)} where
processes reset their local state in {\tt I} (using the macro
$\variable{reset}$) during the broadcast phase. When a reset locally terminates
at process $u$ ({\em i.e.}, when $u$ goes back to status $C$ by
executing $\mathbf{rule\_C}\xspace(u)$), each member $v$ of its closed neighborhood
satisfies $\mathbf{P\_reset}\xspace(v)$, meaning that they are in a pre-defined initial
state of {\tt I}. At the global termination of a reset, every process
$u$ involved into that reset has a state in {\tt I} which is
consistent {\em w.r.t.} that of its neighbors, {\em i.e.},
$\mathbf{P\_ICorrect}\xspace(u)$ holds. Notice that, to ensure that $\mathbf{P\_ICorrect}\xspace(u)$
holds at the end of a reset and for liveness issues, we enforce each
process $u$ stops executing {\tt I} whenever a member of its closed
neighborhood (in particular, the process itself) is involved into a reset:
whenever $\neg \mathbf{P\_Clean}\xspace(u)$ holds, $u$ is not allowed to execute {\tt
I}.
\paragraph{Variable $\variable{d}_u $.}
This variable is meaningless when $u$ is not involved into a reset
({\em i.e.}, when $u$ has status $C$). Otherwise, the distance values
are used to arrange processes involved into resets as a {\em Directed
Acyclic Graph (DAG)}. This distributed structure allows to prevent
both livelock and deadlock. Any process $u$ initiating a reset (using
rule $\mathbf{rule\_R}\xspace(u)$) takes distance 0. Otherwise, when a reset is
propagated to $u$ ({\em i.e.}, when $\mathbf{rule\_RB}\xspace(u)$ is executed),
$\variable{d}_u$ is set to the minimum distance of a neighbor involved in a
broadcast phase plus 1; see the macro $\variable{compute}(u)$.
\subsection{Typical Execution}\label{sub:normalexec}
Assume the system starts from a configuration where, for every process
$u$, $\variable{st}_u = C$. A process $u$ detecting an inconsistency in {\tt
I} ({\em i.e.}, when $\neg\mathbf{P\_ICorrect}\xspace(u)$ holds) stops executing {\tt
I} and initiates a reset using $\mathbf{rule\_R}\xspace(u)$, unless one of its neighbors
$v$ is already broadcasting a reset, in which case it joins the
broadcast of some neighbor by $\mathbf{rule\_RB}\xspace(u)$.
To initiate a reset, $u$ sets $(\variable{st}_u,\variable{d}_u)$ to $(RB,0)$
meaning that $u$ is the root of a reset (see macro $\variable{beRoot}(u)$), and
resets its {\tt I}'s variables to an pre-defined state of {\tt I},
which satisfies $\mathbf{P\_reset}\xspace(u)$, by executing the macro $\variable{reset}(u)$.
Whenever a process $v$ has a neighbor involved in a broadcast phase of
a reset (status $RB$), it stops executing {\tt I} and joins an
existing reset using $\mathbf{rule\_RB}\xspace(v)$, even if its state in {\em I} is
correct, ({\em i.e.}, even if $\mathbf{P\_ICorrect}\xspace(v)$ holds). To join a
reset, $v$ also switches its status to $RB$ and resets its {\tt I}'s
variables ($\variable{reset}(v)$), yet it sets $\variable{d}_v$ to the minimum distance
of its neighbors involved in a broadcast phase plus 1; see the macro
$\variable{compute}(v)$. Hence, if the configuration of {\tt I} is not
legitimate, then within at most $n$ rounds, each process receives the
broadcast of some reset. Meanwhile, processes (temporarily) stop
executing {\tt I} until the reset terminates in their closed
neighborhood thanks to the predicate $\mathbf{P\_Clean}\xspace$.
When a process $u$ involved in the broadcast phase of some reset
realizes that all its neighbors are involved into a reset ({\em i.e.},
have status $RB$ or $RF$), it initiates the feedback phase by
switching to status $RF$, using $\mathbf{rule\_RF}\xspace(u)$. The feedback phase is
then propagated up in the DAG described by the distance value: a
broadcasting process $u$ switches to the feedback phase if each of its
neighbors $v$ has not status $C$ and if $\variable{d}_v > \variable{d}_u$, then $v$
has status $RF$. This way the feedback phase is propagated up into the
DAG within at most $n$ additional rounds. Once a root of some reset
has status $RF$, it can initiate the last phase of the reset: all
processes involves into the reset has to switch to status $C$, using
$\mathbf{rule\_C}\xspace$, meaning that the reset is done. The values $C$ are
propagated down into the reset DAG within at most $n$ additional
rounds. A process $u$ can executing {\tt I} again when all members of
its closed neighborhood (that is, including $u$ itself) have status
$C$, {\em i.e.}, when it satisfies $\mathbf{P\_Clean}\xspace(u)$.
Hence, overall in this execution, the system reaches a configuration
$\gamma$ where all resets are done within at most $3n$ rounds. In
$\gamma$, all processes have status $C$. However, process has not
necessarily kept a state satisfying $\mathbf{P\_reset}\xspace$ ({\em i.e.}, the initial
pre-defined state of {\tt I}) in this configuration. Indeed, some
process may have started executing {\tt I} again before
$\gamma$. However, the predicate $\mathbf{P\_Clean}\xspace$ ensures that no resetting
process has been involved in these latter (partial) executions of {\tt
I}. Hence, {\tt SDR}\xspace rather ensures that all processes are in {\tt I}'s
states that are coherent with each other from $\gamma$. That is,
$\gamma$ is a so-called {\em normal configuration}, where $\mathbf{P\_Clean}\xspace(u)
\And \mathbf{P\_ICorrect}\xspace(u)$ holds for every process $u$.
\subsection{Stabilization of the Reset}\label{err:corr}
If a process $u$ is in an incorrect state of Algorithm {\tt SDR}\xspace ({\em i.e.},
if $\mathbf{P\_R1}\xspace(u) \vee \mathbf{P\_R2}\xspace(u)$ holds), we proceed as for inconsistencies in Algorithm {\tt
I}. Either it joins an existing reset (using $\mathbf{rule\_RB}\xspace(u)$) because at
least one of its neighbors is in a broadcast phase, or it initiates its
own reset using $\mathbf{rule\_R}\xspace(u)$.
Notice also that starting from an arbitrary configuration, the system
may contain some reset in progress. However, similarly to the typical
execution, the system stabilizes within at most $3n$ rounds to a normal
configuration.
Algorithm {\tt SDR}\xspace is also efficient in moves. Indeed, in
Sections~\ref{sect:alliance} and~\ref{sect:unison} we will give two
examples of composition {\tt I} $\circ$ {\tt SDR}\xspace that stabilize in a
polynomial number of moves. Such complexities are mainly due to the
coordination of the resets which, in particular, guarantees that if a
process $u$ is enabled to initiate a reset ($\mathbf{P\_Up}\xspace(u)$) or the root of
a reset with status $RB$, then it satisfies this disjunction since the
initial configuration ({\em cf.}, Theorem~\ref{theo:pseudoRoots}, page
\pageref{theo:pseudoRoots}).
\subsection{Requirements on the Input Algorithm}\label{sect:require}
According to the previous explanation, Algorithm {\tt I} should satisfy the
following prerequisites:
\begin{enumerate}
\item Algorithm {\tt I} should not write into the variables of {\tt SDR}\xspace, {\em i.e.},
variables $\variable{st}_u$ and $\variable{d}_u$, for every process
$u$. \label{RQ1}
\item For each process $u$, Algorithm {\tt I} should provide the two input
predicates $\mathbf{P\_ICorrect}\xspace(u)$ and $\mathbf{P\_reset}\xspace(u)$ to {\tt SDR}\xspace, and the macro
$\variable{reset}(u)$. Those inputs should satisfy:
\begin{enumerate}
\item $\mathbf{P\_ICorrect}\xspace(u)$ does not involve any variable of {\tt SDR}\xspace and is closed
by Algorithm {\tt I}. \label{RQ2}
\item $\mathbf{P\_reset}\xspace(u)$ involves neither a variable of {\tt SDR}\xspace nor a variable of a neighbor of $u$. \label{RQ4}
\item If $\neg \mathbf{P\_ICorrect}\xspace(u) \vee \neg \mathbf{P\_Clean}\xspace(u)$ holds ({\em n.b.}
$\mathbf{P\_Clean}\xspace(u)$ is defined in {\tt SDR}\xspace), then no rule of Algorithm {\tt I} is enabled
at $u$. \label{RQ3}
\item If $\mathbf{P\_reset}\xspace(v)$ holds, for every $v \in \variable{N}[u]$, then
$\mathbf{P\_ICorrect}\xspace(u)$ holds.\label{RQ6}
\item If $u$ performs a move in $\gamma \mapsto \gamma'$, where, in
particular, it modifies its variables in Algorithm {\tt I} by
executing $\variable{reset}(u)$ (only), then $\mathbf{P\_reset}\xspace(u)$ holds in $\gamma'$.\label{RQ5}
\end{enumerate}
\end{enumerate}
\input{code}
\section{$(f,g)$-alliance}\label{sect:alliance}
\subsection{The Problem}
The $(f,g)$-alliance problem has been defined by Dourado {\em et
al.}~\cite{DouradoPRS11}.
Given a graph $G =(V,E)$, and two non-negative integer-valued
functions on nodes $f$ and $g$, a subset of nodes $A \subseteq V$ is
an {\em $(f,g)$-alliance} of $G$ if and only if every node $u\notin A$
has at least $f(u)$ neighbors in $A$, and every node $v\in A$ has at
least $g(v)$ neighbors in $A$.
The $(f,g)$-alliance problem is the problem of finding a subset of
processes forming an {\em $(f,g)$-alliance} of the network.
The {\em $(f,g)$-alliance} problem is a generalization of several
problems that are of interest in distributed computing. Indeed,
consider any subset $S$ of processes/nodes:
\begin{enumerate}
\item $S$ is a domination set~\cite{berge2001theory} if and
only if $S$ is a $(1,0)$-alliance;
\item more generally, $S$ is a $k$-domination
set~\cite{berge2001theory} if and only if $S$ is a
$(k,0)$-alliance;
\item $S$ is a $k$-tuple dominating set~\cite{LiaoC03} if
and only if $S$ is a $(k,k-1)$-alliance;
\item $S$ is a global offensive
alliance~\cite{Sigarreta2009219} if and only if $S$ is a
$(f,0)$-alliance, where $f(u) = \lceil \frac{\delta_u+1}{2} \rceil$
for all $u$;
\item $S$ is a global defensive alliance~\cite{SigarretaR06}
if and only if $S$ is a $(1,g)$-alliance, where $g(u) =
\lceil \frac{\delta_u+1}{2} \rceil$ for all $u$;
\item $S$ is a global powerful alliance~\cite{YahiaouiBHK13}
if and only if $S$ is a $(f,g)$-alliance, such that
$f(u) = \lceil \frac{\delta_u+1}{2} \rceil$ and
$g(u) = \lceil \frac{\delta_u}{2} \rceil$ for all $u$.
\end{enumerate}
We remark that $(f,g)$-alliances have applications in the fields of
population protocols~\cite{AngluinAER07} and server allocation in
computer networks~\cite{GuptaMOR05}.
Ideally, we would like to find a {\em minimum\/} $(f,g)$-alliance,
namely an $(f,g)$-alliance of the smallest possible cardinality.
However, this problem is $\mathcal{NP}$-hard, since the $(1,0)$-alliance ({\em i.e.}, the domination set problem) is known to be $\mathcal{NP}$-hard~\cite{GareyJ79}.
We can instead consider the problem of finding a {\em minimal\/}
$(f,g)$-alliance.
An {\em $(f,g)$-alliance} is {\em minimal} if no proper
subset of $A$ is an {\em $(f,g)$-alliance}.
Another variant is the {\em $1$-minimal} {\em $(f,g)$-alliance}.
$A$ is a {\em $1$-minimal} {\em $(f,g)$-alliance} if
deletion of just one member of $A$ causes $A$ to be no more an {\em
$(f,g)$-alliance}, {\em i.e.}, $A$ is an {\em $(f,g)$-alliance} but
$\forall u \in A$, $A \setminus \{u\}$ is not an {\em
$(f,g)$-alliance}. Surprisingly, a {\em $1$-minimal} {\em
$(f,g)$-alliance} is not necessarily a {\em minimal} {\em
$(f,g)$-alliance} \cite{DouradoPRS11}.
However, we
have the following property:
\begin{property}[Dourado {\em et al.}~\cite{DouradoPRS11}]
\label{prop:fga}
Given two non-negative integer-valued functions $f$ and $g$ on nodes
\begin{enumerate}
\item Every minimal {\em $(f,g)$-alliance} is a $1$-minimal {\em
$(f,g)$-alliance}, and
\item if $f(u) \geq g(u)$ for every process $u$, then every $1$-minimal {\em $(f,g)$-alliance} is a
minimal {\em $(f,g)$-alliance}.
\end{enumerate}
\end{property}
\subsection{Contribution}
We first propose a distributed algorithm called {\tt FGA}\xspace. Starting
from a pre-defined configuration, {\tt FGA}\xspace computes a $1$-minimal
$(f,g)$-alliance in any identified network where $\delta_u \geq
max(f(u), g(u))$, for every process $u$. Notice that this latter
assumption ensures the existence of a solution. {\tt FGA}\xspace is not
self-stabilizing, however we show that the composite algorithm {\tt FGA}\xspace $\circ$ {\tt SDR}\xspace is actually an efficient self-stabilizing
$1$-minimal $(f,g)$-alliance algorithm.
\subsection{Related Work}
Recall that the {\em $(f,g)$-alliance} problem has been introduced by
Dourado {\em et al.}~\cite{DouradoPRS11}. In that paper, the authors
give several distributed algorithms for that problem and its variants,
but none of them is self-stabilizing.
In~\cite{CDDLR15j}, Carrier {\em et al.} proposes a silent
self-stabilizing algorithm that computes a minimal {\em
$(f,g)$-alliance} in an asynchronous network with unique node IDs,
assuming that every node $u$ has a degree at least $g(u)$ and
satisfies $f(u) \geq g(u)$. Their algorithm is also {\em safely
converging} in the sense that starting from any configuration, it
first converges to a (not necessarily minimal) {\em $(f,g)$-alliance}
in at most four rounds, and then continues to converge to a minimal
one in at most $5n + 4$ additional rounds, where $n$ is the size of
the network. The algorithm is written in the locally shared memory
model with composite atomicity. It is proven assuming a distributed unfair
daemon and takes $O(n\cdot\Delta^3)$ moves to stabilize,
where $\Delta$ is the degree of the network.
There are several other self-stabilizing solutions for particular
instances of $(f,g)$-alliances proposed in the locally
shared memory model with composite atomicity, {\em
e.g.},~\cite{DingWS14,KakugawaM06,SrimaniX07,Turau07,PathanTXW12,YahiaouiBHK13}.
Algorithms given in ~\cite{SrimaniX07,PathanTXW12} work in anonymous
networks, however, they both
assume a central daemon. More precisely, Srimani and
Xu~\cite{SrimaniX07} give several algorithms which compute minimal
global offensive and $1$-minimal defensive
alliances in $O(n^3)$ moves. Wang {\em et al.}~\cite{PathanTXW12} give
a self-stabilizing algorithm to compute a minimal $k$-dominating set
in $O(n^2)$ moves.
All other solutions~\cite{DingWS14,KakugawaM06,Turau07,YahiaouiBHK13}
consider arbitrary identified networks. Turau~\cite{Turau07} gives a
self-stabilizing algorithm to compute a minimal dominating set in $9n$
moves, assuming a distributed unfair daemon. Yahiaoui {\em et
al.}~\cite{YahiaouiBHK13} give self-stabilizing algorithms to compute
a minimal global powerful alliance. Their solution assumes a distributed unfair
daemon and stabilizes in $O(n\cdot m)$ moves, where $m$ is
the number of edges in the network.
A safely converging self-stabilizing algorithm is given
in~\cite{KakugawaM06} for computing a minimal dominating set. The
algorithm first computes a (not necessarily minimal) dominating set in
$O(1)$ rounds and then safely stabilizes to a {\em minimal\/}
dominating set in $O(D)$ rounds, where $D$ is the diameter of
the network. However, a synchronous daemon is required.
A safely converging self-stabilizing algorithm
for computing minimal global offensive alliances
is given in~\cite{DingWS14}. This algorithm also assumes a synchronous daemon.
It first
computes a (not necessarily minimal) global offensive alliance within two
rounds, and then safely stabilizes to a {\em minimal\/} global
offensive alliance within $O(n)$ additional rounds.
To the best of our knowledge, until now there was no self-stabilizing
algorithm solving the 1-minimal $(f,g)$-alliance without any restriction
on $f$ and $g$.
\subsection{Algorithm {\tt FGA}\xspace}
\paragraph{Overview.}
\input{codeAlliance}
Recall that we consider any network where $\delta_u \geq max(f(u),
g(u))$, for every process $u$. Moreover, we assume that the
network is identified, meaning that each process $u$ can be
distinguished using a unique constant identifier, here noted $id_u$.
The formal code of {\tt FGA}\xspace is given in Algorithm \ref{alg:DAvar}.
Informally, each process $u$ maintains the following four variables.
\begin{description}
\item[$\variable{col}_u$:] a Boolean variable, the output of {\tt FGA}\xspace. Process $u$ belongs to the $(f,g)$-alliance if and only if $\variable{col}_u$.
\item[$\variable{scr}_u$:] a variable, whose domain is $\{-1,0,1\}$. $\variable{scr}_u \leq 0$
if and only if no $u$'s neighbor can quit the alliance.
\item[$\variable{canQ}_u$:] a Boolean variable. $\neg \variable{canQ}_u$ if $u$
cannot quit the alliance (in particular, if $u$ is out of
the alliance).
\item[$\variable{ptr}_u$:] a pointer variable, whose domain is $\variable{N}[u] \cup
\{ \bot \}$. Either $\variable{ptr}_u = \bot$ or $\variable{ptr}_u$ designates
the member of its closed neighborhood of smallest identifier such
that $\variable{canQ}_u$.
\end{description}
In the following, we assume that the system is initially in the configuration $\gamma_{init}$ where every process $u$ has the following local state:
\begin{center}
$\variable{col}_u = true$, $\variable{scr}_u =1$, $\variable{canQ}_u = true$,
$\variable{ptr}_u = \bot$, $\variable{st}_u$ = $C$.
\end{center}
In particular, this means that all processes are initially in the
alliance. Then, the idea of the algorithm is reduced the alliance
until obtaining a 1-minimal $(f,g)$-alliance. A process $u$ leaves
the alliance by executing $\mathbf{rule\_Clr}\xspace(u)$. To leave the alliance, $u$
should have enough neighbors in the alliance ($\#InAll\xspace(u) \geq
f(u)$), {\em approve} itself, and have
a {\em full} approval from all neighbors. Process $v$ approves $u$ if
$\variable{ptr}_v = u$. Moreover, the approval of $v$ is {\em full} if
$\variable{scr}_v = 1$. Notice that, the $\variable{ptr}$ pointers ensure
that removals from the alliance are locally central: in the closed
neighborhood of any process, at most one process leaves the alliance
at each step.
To ensure the liveness of the algorithm, a process $u$ gives its
approval (by executing $\mathbf{rule\_P2}\xspace(u)$, maybe preceded by $\mathbf{rule\_P1}\xspace(u)$)
to the member of its closed neighborhood
having the smallest identifier among the ones requiring an approval
({\em i.e.}, the processes satisfying $\variable{canQ}$).
To ensure that $realScr\xspace(v) \geq 0$ is a closed predicate,
a
process $v$ gives its approval to another process $u$ only if
$realScr\xspace(v) = 1$ and none of its neighbor can leave the alliance
({\em i.e.}, $\variable{ptr}_u \notin \variable{N}(v)$). This latter condition ensures
that no neighbor of $v$ leaves the alliance simultaneously to a new
approval of $v$. It is mandatory since otherwise the cause for which
$v$ gives its approval may be immediately outdated. Hence, any
approval switching is done either in one step when the process leaves
the alliance, or in two atomic steps where $\variable{ptr}_v$ first takes the value $\bot$ (rule $\mathbf{rule\_P1}\xspace(u)$) and then points to the suitable process,
(rule $\mathbf{rule\_P2}\xspace(u)$).
Finally, the rule $\mathbf{rule\_Q}\xspace(u)$ refreshes the values of
$\variable{scr}_u$, $\variable{ptr}_u$, and $\variable{canQ}_u$ after a neighbor
left the alliance or updated its $\variable{scr}$ variable.
\paragraph{Properties of {\tt FGA}\xspace.}
Below, we show some properties of Algorithm {\tt FGA}\xspace that will be
used for showing both its correctness and the self-stabilization of
its composition with Algorithm {\tt SDR}\xspace.
First, by checking the rules of {\tt FGA}\xspace, we can remark that each
time a process $u$ sets $\variable{scr}_u$ to a value other than 1, it
also sets $\variable{ptr}_u$ to $\bot$, in the same step. Hence, by
construction we have the following lemma.
\begin{lemma}
\label{lem:VSatisfaction}
$\variable{scr}_u=1$ $\vee$ $\variable{ptr}_u=\bot$ is closed by {\tt FGA}\xspace,
for every process $u$.
\end{lemma}
Since Algorithm {\tt FGA}\xspace does not modify any variable from Algorithm {\tt SDR}\xspace, we have
\begin{remark}\label{lem:PClean:clos}
$\mathbf{P\_Clean}\xspace(u)$ is closed by {\tt FGA}\xspace, for every process $u$.
\end{remark}
\begin{lemma}
\label{lem:satisfaction}
Let $u$ be any process. Let $\gamma$ be a configuration where
$\mathbf{P\_Clean}\xspace(u) \wedge \mathbf{P\_ICorrect}\xspace(u)$ holds. Let $\gamma'$ be any configuration such that $\gamma \mapsto \gamma'$.
In $\gamma'$, $realScr\xspace(u) \geq 0$.
\end{lemma}
\begin{proof}
By definition of $\mathbf{P\_toQuit}\xspace$, at most one process of $\variable{N}[u]$
executes $\mathbf{rule\_Clr}\xspace$ in $\gamma \mapsto \gamma'$. If no process of
$\variable{N}[u]$ executes $\mathbf{rule\_Clr}\xspace$, we are done. If
$\mathbf{rule\_Clr}\xspace(u)$ is executed, then $\#InAll\xspace(u) \geq f(u)$ in $\gamma$ (see
$\mathbf{P\_canQuit}\xspace(u)$) and so $\#InAll\xspace(u) \geq f(u)$ in $\gamma'$
too and thus $realScr\xspace(u) \geq 0$ in $\gamma'$. Otherwise, let $v \in \variable{N}(u)$ such that $\mathbf{rule\_Clr}\xspace(v)$ is executed in $\gamma \mapsto \gamma'$. In $\gamma$, $\variable{col}_v = true$ and
$\mathbf{P\_toQuit}\xspace(v)$ holds with, in particular, $\variable{ptr}_u = v \neq
\bot$, {\em i.e.}, $\variable{col}_{\variable{ptr}_u}$ holds. Hence,
$\mathbf{P\_ICorrect}\xspace(u)$, $\variable{ptr}_u \neq \bot$, and
$\variable{col}_{\variable{ptr}_u}$ imply $realScr\xspace(u) = 1$ in $\gamma$,
and so $realScr\xspace(u) \geq 0$ in $\gamma'$.
\end{proof}
By definition of {\tt FGA}\xspace, we have
\begin{remark} Let $u$ be any process. Let $\gamma$ be a configuration where
$\variable{ptr}_u=v$ with $v \neq u$. Let $\gamma'$ be any configuration such that $\gamma \mapsto \gamma'$.
In $\gamma'$, we have $\variable{ptr}_u \in \{ v, \bot \}$.
\end{remark}
\begin{lemma}\label{lem:PICorrect:clos:1}
Let $u$ be any process. Let $\gamma$ be a configuration where $\mathbf{P\_Clean}\xspace(u) \wedge \mathbf{P\_ICorrect}\xspace(u)$ holds. Let $\gamma'$ be any configuration such that $\gamma \mapsto \gamma'$ is a step
where $v \in \variable{N}(u)$ executes $\mathbf{rule\_Clr}\xspace(v)$.
$\mathbf{P\_ICorrect}\xspace(u)$ holds in $\gamma'$
\end{lemma}
\begin{proof}
Since $\mathbf{rule\_Clr}\xspace(v)$ is enabled in $\gamma$, we have $\variable{ptr}_u =
v$ and $\variable{scr}_u = 1$. So, if $u$ does not move in $\gamma
\mapsto \gamma'$, we have $\variable{ptr}_u \neq \bot$, $\variable{scr}_u
= 1$, and $\neg \variable{col}_{\variable{ptr}_u}$. Hence, $\mathbf{P\_ICorrect}\xspace(u)$ holds
in $\gamma'$ by Lemma \ref{lem:satisfaction}.
Otherwise, either $\mathbf{rule\_P1}\xspace(u)$ or $\mathbf{rule\_Q}\xspace(u)$ is executed
in $\gamma \mapsto \gamma'$. In the former case, $\variable{ptr}_u = \bot$
in $\gamma'$ and by Lemma \ref{lem:satisfaction}, $\mathbf{P\_ICorrect}\xspace(u)$
holds in $\gamma'$. In the latter case, in $\gamma'$ either
$\variable{ptr}_u = v \neq \bot$, $\variable{scr}_u = 1$ (by Lemma
\ref{lem:VSatisfaction}), and $\neg \variable{col}_{\variable{ptr}_u}$, or
$\variable{ptr}_u = \bot$. In either case, $\mathbf{P\_ICorrect}\xspace(u)$ holds in
$\gamma'$ by Lemma \ref{lem:satisfaction}, and we are done.
\end{proof}
\begin{lemma}\label{lem:PICorrect:clos:2}
Let $u$ be any process. Let $\gamma$ be a configuration where $\mathbf{P\_Clean}\xspace(u) \wedge \mathbf{P\_ICorrect}\xspace(u)$ holds. Let $\gamma'$ be any configuration such that $\gamma \mapsto \gamma'$ is a step
where $u$ executes an action and none of its neighbor executes $\mathbf{rule\_Clr}\xspace$.
$\mathbf{P\_ICorrect}\xspace(u)$ holds in $\gamma'$.
\end{lemma}
\begin{proof}
Since no neighbor of $u$ executes $\mathbf{rule\_Clr}\xspace$ in $\gamma \mapsto
\gamma'$, we have $\variable{scr}_u = realScr\xspace(u)$ in $\gamma'$,
and by Lemmas \ref{lem:VSatisfaction} and \ref{lem:satisfaction}, we
are done.
\end{proof}
By Remark~\ref{lem:PClean:clos} and Lemmas \ref{lem:PICorrect:clos:1}-\ref{lem:PICorrect:clos:2}, follows.
\begin{corollary}\label{coro:normal}
$\mathbf{P\_Clean}\xspace(u) \wedge \mathbf{P\_ICorrect}\xspace(u)$ is closed by {\tt FGA}\xspace, for
every process $u$.
\end{corollary}
Since $u$ is disabled in {\tt FGA}\xspace if $\neg \mathbf{P\_Clean}\xspace(u)$ holds. $\neg \mathbf{P\_Clean}\xspace(u)
\wedge \mathbf{P\_ICorrect}\xspace(u)$ is also closed by {\tt FGA}\xspace, for every process
$u$. Hence, follows.
\begin{corollary}\label{coro:normal2}
$\mathbf{P\_ICorrect}\xspace(u)$ is closed by {\tt FGA}\xspace, for
every process $u$.
\end{corollary}
\paragraph{Partial Correctness.}
As for Algorithm {\tt U}\xspace, we focus on configurations of {\tt FGA}\xspace satisfying
$\mathbf{P\_ICorrect}\xspace(u) \wedge \mathbf{P\_Clean}\xspace(u)$, every process $u$. Indeed, again,
$\gamma_{init}$ belongs to this class of configurations, and a
configuration of {\tt FGA}\xspace $\circ$ {\tt SDR}\xspace is normal if and only if $\mathbf{P\_Clean}\xspace(u)
\And \mathbf{P\_ICorrect}\xspace(u)$ holds for every process $u$. So, the properties we
exhibit now will be, in particular, satisfied at the completion of {\tt SDR}\xspace.
Consider any terminal configuration of {\tt FGA}\xspace where $\mathbf{P\_Clean}\xspace(u)
\wedge \mathbf{P\_ICorrect}\xspace(u)$ holds for every process $u$. By checking the
code of Algorithm {\tt FGA}\xspace, we can remark that every process $u$
satisfies \begin{center} $\variable{scr}_u = realScr\xspace(u)$ $\And$
$\variable{canQ}_u = \mathbf{P\_canQuit}\xspace(u)$ $\And$ \\
$\variable{ptr}_u = \variable{bestPtr}(u)$ $\And$ $\neg\mathbf{P\_toQuit}\xspace(u)$.
\end{center} Based on this, one can easily establish that in such a
terminal configuration, the set $A = \{u \in V\ |\ \variable{col}_u\}$ is a
1-minimal $(f,g)$ alliance of the network.
Indeed, for every process $u$, since $\mathbf{P\_ICorrect}\xspace(u)$ holds, $realScr\xspace(u) \geq 0$, which in turn implies that $A$ is an $(f,g)$ alliance.
Assume then, by the contradiction, that $A$ is not 1-minimal in some
terminal configuration of {\tt FGA}\xspace where $\mathbf{P\_Clean}\xspace(u) \wedge
\mathbf{P\_ICorrect}\xspace(u)$ holds for every process $u$. Let $m$ be the process of
minimum identifier such that $A - \{m\}$ is an $(f,g)$
alliance. First, by definition, $\variable{col}_m \wedge \#InAll\xspace(m) \geq
f(m)$ holds. Then, $\forall u \in \variable{N}[m]$, $\variable{scr}_u =
realScr\xspace(u) = 1$ since $A - \{m\}$ is an $(f,g)$ alliance. So,
$\mathbf{P\_canQuit}\xspace(m)$ holds, which implies that $\variable{canQ}_m =
true$. Finally, by minimality of the $m$'s identifier, $\forall u \in
\variable{N}[m]$, $\variable{ptr}_u = \variable{bestPtr}(u) = m$. Hence, $\mathbf{P\_toQuit}\xspace(m)$
holds, which in turn implies that $\mathbf{rule\_Clr}\xspace(m)$ is enabled, a
contradiction. Hence, follows.
\begin{theorem}\label{theo:term:alliance}
In any terminal configuration of {\tt FGA}\xspace where
$\mathbf{P\_Clean}\xspace(u) \wedge \mathbf{P\_ICorrect}\xspace(u)$ holds for every process $u$, the set
$A = \{u \in V\ |\ \variable{col}_u\}$ is a 1-minimal $(f,g)$ alliance of the
network.
\end{theorem}
Consider now any execution $e$ of {\tt FGA}\xspace starting from
$\gamma_{init}$. In $\gamma_{init}$, we have $\mathbf{P\_Clean}\xspace(u) \wedge
\mathbf{P\_ICorrect}\xspace(u)$ for every process $u$. Then, $\mathbf{P\_Clean}\xspace(u) \wedge
\mathbf{P\_ICorrect}\xspace(u)$, for every process $u$, is invariant in $e$, by
Corollary~\ref{coro:normal}. Hence, we have the following corollary.
\begin{corollary}\label{coro:term:alliance}
Let $e$ be any execution of {\tt FGA}\xspace starting from $\gamma_{init}$. If $e$
terminates, then the set $A = \{u \in V\ |\ \variable{col}_u\}$ is a 1-minimal
$(f,g)$ alliance of the network in the terminal configuration of $e$.
\end{corollary}
\paragraph{Termination.}
We now show that any execution of {\tt FGA}\xspace (starting from any
arbitrary configuration) eventually terminates.
Let $v$ be any process. Let $e$ be any execution of {\tt FGA}\xspace. First, $\mathbf{rule\_Clr}\xspace(v)$ switches $\variable{col}_v$
from true to false and no rule of {\tt FGA}\xspace sets $\variable{col}_v$ from
false to true. So,
\begin{itemize}
\item[(1)] $\mathbf{rule\_Clr}\xspace(v)$ is executed at most once in $e$.
\end{itemize}
Moreover, this implies that
\begin{itemize}
\item[(2)]
the value of the macro
$\#InAll\xspace(v)$ is monotonically
non-increasing in $e$.
\end{itemize}
If $realScr\xspace(u) < 0$ holds for some process $u$ in some configuration of $e$, then $\mathbf{P\_ICorrect}\xspace(u)$ does not hold and so $u$ is disabled. Moreover, by (2), $u$ is disabled forever in $e$. Assume, otherwise, that $realScr\xspace(u) \geq
0$. Then, $realScr\xspace(u)$ may increase at most once in $e$:
when $\mathbf{rule\_Clr}\xspace(u)$ is executed while $\#InAll\xspace(u) > f(u)$.
So,
\begin{itemize}
\item[(3)] Every process $u$ updates the value of $\variable{scr}_u$
at most $4$ times in $e$.
\end{itemize}
Hence, overall (by (1)-(3)),
the value of $\mathbf{P\_canQuit}\xspace(v)$ changes
at most $4\delta_v+2$ in $e$, and thus
\begin{itemize}
\item[(4)]
$v$ updates the value of $\variable{canQ}_v$ at most $4\delta_v+3$
in $e$.
\end{itemize}
By (3) and (4)
\begin{itemize}
\item[(5)]
$\mathbf{rule\_Q}\xspace(v)$ is executed at most
most $4\delta_v+7$ times in $e$.
\end{itemize}
The value of $\variable{bestPtr}(v)$ may change only when a process $u$ in the
closed neighborhood of $v$ changes the value of its variable
$\variable{canQ}_u$ or when $v$ updates $\variable{scr}_v$.
So, by (3) and (4),
the value of
$\variable{bestPtr}(v)$ changes at most $\delta_v.(4\Delta+3)+4\delta_v+7$ times.
So,
\begin{itemize}
\item[(6)]
$v$ executes $\mathbf{rule\_P1}\xspace$ and $\mathbf{rule\_P2}\xspace$ at most
$\delta_v.(4\Delta+3)+4\delta_v+8$ times each in $e$.
\end{itemize}
Overall (by (1), (5), and (6)), follows.
\begin{lemma}\label{lem:move:alliance}
A process $v$ executes at most $8\delta_v\Delta+18\delta_v+24$ moves in an execution of {\tt FGA}\xspace.
\end{lemma}
\begin{corollary}\label{coro:move:alliance} Any execution of {\tt FGA}\xspace contains at most $16.\Delta.m+36.m+24.n$ moves,
{\em i.e.}, $O(\Delta.m)$ moves.
\end{corollary}
By Corollaries~\ref{coro:term:alliance} and~\ref{coro:move:alliance} , we can conclude with the following
theorem.
\begin{theorem} {\tt FGA}\xspace is distributed (non self-stabilizing)
1-minimal $(f,g)$-alliance algorithm which terminates in at most
$O(\Delta.m)$ moves.
\end{theorem}
\paragraph{Round Complexity.}
We already know that in any execution of {\tt FGA}\xspace, each process
executes $\mathbf{rule\_Clr}\xspace$ at most once. So, along any execution there are
at most $n$ steps containing the execution of some
$\mathbf{rule\_Clr}\xspace$. We now say that a step is {\em $Color$-restricted}, if
no rule $\mathbf{rule\_Clr}\xspace$ is executed during that step. Similarly, we say
that a round is {\em $Color$-restricted} if it only consists of
$Color$-restricted steps. In the sequel, we show that any execution that
starts from a configuration where $\mathbf{P\_Clean}\xspace(u) \wedge \mathbf{P\_ICorrect}\xspace(u)$ holds for every process $u$
contains at most $4$ consecutive $Color$-restricted rounds. Hence, the
number of rounds in any execution starting from $\gamma_{init}$ is bounded by $5n+4$. To that goal,
we first specialize the notion of closure. A predicate $P$ over
configurations of {\tt FGA}\xspace is {\em $Color$-restricted closed} if for
every $Color$-restricted step $\gamma \mapsto \gamma'$, $P(\gamma)
\Rightarrow P(\gamma')$.
We then consider the following predicates over configurations of {\tt FGA}\xspace.
\begin{itemize}
\item $\mathcal{P}_5$ is true if and only if every process $u$
satisfies $\mathbf{P\_Clean}\xspace(u) \wedge \mathbf{P\_ICorrect}\xspace(u)$.
\item $\mathcal{P}_6$ is true if and only if $\mathcal{P}_5$ holds and every process $u$
satisfies $\variable{scr}_u = realScr\xspace(u)$.
\item
$\mathcal{P}_7$ is true if and only if $\mathcal{P}_6$ holds and
every process $u$ satisfies $\variable{canQ}_u = \mathbf{P\_canQuit}\xspace(u)$.
\item $\mathcal{P}_8$ is true if and only if $\mathcal{P}_7$ holds
and every process $u$ satisfies $\variable{ptr}_u \in
\{\variable{bestPtr}(u), \bot\}$.
\item $\mathcal{P}_9$ is true if and only if $\mathcal{P}_8$ holds
and every process $u$ satisfies $\variable{ptr}_u = \variable{bestPtr}(u)$.
\end{itemize}
\begin{lemma}
\label{lem:alliance-round1}
$\mathcal{P}_6$ is $Color$-restricted closed. Moreover, after one
$Color$-restricted round from any configuration satisfying $\mathcal{P}_5$, a configuration
satisfying $\mathcal{P}_6$ is reached.
\end{lemma}
\begin{proof}
Let $u$ be a process. The value of $realScr\xspace(u)$ stays
unchanged during a $Color$-restricted step. So, the predicate
$\variable{scr}_u = realScr\xspace(u)$ is $Color$-restricted closed,
and so $\mathcal{P}_6$ is. Let $\gamma$ be a configuration
satisfying $\mathcal{P}_5$. Recall that $\mathcal{P}_5$ is closed,
by Corollary~\ref{coro:normal}. So, $\mathbf{P\_Clean}\xspace(u) \wedge
\mathbf{P\_ICorrect}\xspace(u)$ holds forever from $\gamma$. If
$\variable{scr}_u \neq realScr\xspace(u)$ in $\gamma$, then $u$ is
enabled in {\tt FGA}\xspace. Now, if $u$ moves in a $Color$-restricted step, then
$\variable{scr}_u = realScr\xspace(u)$ in the reached
configuration. Hence, $\variable{scr}_u = realScr\xspace(u)$ holds,
for every process $u$, within at most one round from $\gamma$, and
we are done.
\end{proof}
\begin{lemma}
\label{lem:alliance-round2}
$\mathcal{P}_7$ is $Color$-restricted closed. Moreover, after one
$Color$-restricted round from any configuration satisfying
$\mathcal{P}_6$, a configuration satisfying $\mathcal{P}_7$ is
reached.
\end{lemma}
\begin{proof}
Let $u$ be a process. Let $\gamma_i \mapsto \gamma_{i+1}$ be a
$Color$-restricted step such that $\mathcal{P}_6(\gamma_i)$ holds.
For every process $v$, the value of $\variable{col}_v$, $\variable{scr}_v$,
and $\#InAll\xspace(v)$ stay unchanged during $\gamma_i \mapsto
\gamma_{i+1}$. Therefore, the value of $\mathbf{P\_canQuit}\xspace(u)$ stays
unchanged during $\gamma_i \mapsto \gamma_{i+1}$ for every process
$u$. So, the predicate $\mathcal{P}_6 \wedge \variable{canQ}_u =
\mathbf{P\_canQuit}\xspace(u)$ is $Color$-restricted closed, and so
$\mathcal{P}_7$ is.
%
Assume now that, $\variable{canQ}_u \neq \mathbf{P\_canQuit}\xspace(u)$ holds in
$\gamma_i$. Then, $u$ is enabled in $\gamma_i$ and if $u$ moves in
$\gamma_i \mapsto \gamma_{i+1}$, $\variable{canQ}_u = \mathbf{P\_canQuit}\xspace(u)$
holds in in $\gamma_{i+1}$. Indeed, the value of
$\mathbf{P\_canQuit}\xspace(u)$ stays unchanged during the step. Therefore,
after at most one $Color$-restricted round from $\gamma_i$, we have
$\variable{canQ}_u = \mathbf{P\_canQuit}\xspace(u)$ for every process $u$, and so
$\mathcal{P}_7$ holds.
\end{proof}
\begin{lemma}
\label{lem:alliance-round3}
$\mathcal{P}_8$ is $Color$-restricted closed. Moreover, after one
$Color$-restricted round from any configuration satisfying
$\mathcal{P}_7$, a configuration satisfying $\mathcal{P}_8$ is
reached.
\end{lemma}
\begin{proof}
Let $u$ be a process. Let $\gamma_i \mapsto \gamma_{i+1}$ be a
$Color$-restricted step such that $\mathcal{P}_7(\gamma_i)$ holds.
During that step, only rules $\mathbf{rule\_P1}\xspace$ or $\mathbf{rule\_P2}\xspace$ are
executed. Moreover, for every process $v$, the value of $\variable{col}_v$
and $\variable{canQ}_v$ stay unchanged during $\gamma_i \mapsto
\gamma_{i+1}$. So, the value of $\variable{bestPtr}(u)$ stays unchanged as
well. So, the predicate $\mathcal{P}_7 \wedge \variable{ptr}_u \in
\{\variable{bestPtr}(u), \bot\}$ is $Color$-restricted closed, and so
$\mathcal{P}_8$ is.
Assume now that, $\variable{ptr}_u \notin \{\variable{bestPtr}(u), \bot\}$ holds
in $\gamma_i$. Then, $u$ is enabled in $\gamma_i$ and if $u$ moves
in $\gamma_i \mapsto \gamma_{i+1}$, $\variable{ptr}_u \in
\{\variable{bestPtr}(u), \bot\}$ in $\gamma_{i+1}$. Indeed, the value of
$\variable{bestPtr}(u)$ stays unchanged during the step. Therefore, after
at most one $Color$-restricted round from $\gamma_i$, we have
$\variable{ptr}_u \in \{\variable{bestPtr}(u), \bot\}$ for every process $u$,
and so $\mathcal{P}_8$ holds.
\end{proof}
\begin{lemma}
\label{lem:alliance-round4}
$\mathcal{P}_9$ is $Color$-restricted closed. Moreover, after one
$Color$-restricted round from any configuration satisfying
$\mathcal{P}_8$, a configuration satisfying $\mathcal{P}_9$ is
reached.
\end{lemma}
\begin{proof}
Let $u$ be a process. Let $\gamma_i \mapsto \gamma_{i+1}$ be a
$Color$-restricted step such that $\mathcal{P}_8(\gamma_i)$ holds.
During that step, only rules $\mathbf{rule\_P2}\xspace$ are
executed. Moreover, for every process $v$, the value of $\variable{col}_v$
and $\variable{canQ}_v$ stay unchanged during $\gamma_i \mapsto
\gamma_{i+1}$. So, the value of $\variable{bestPtr}(u)$ stays unchanged as
well. So, the predicate $\mathcal{P}_8 \wedge \variable{ptr}_u =
\variable{bestPtr}(u)$ is $Color$-restricted closed, and so
$\mathcal{P}_9$ is.
Assume now that, $\variable{ptr}_u \neq \variable{bestPtr}(u)$ holds
in $\gamma_i$. Then, $u$ is enabled in $\gamma_i$ and if $u$ moves
in $\gamma_i \mapsto \gamma_{i+1}$, $\variable{ptr}_u =
\variable{bestPtr}(u)$ in $\gamma_{i+1}$. Indeed, the value of $\variable{bestPtr}(u)$
stays unchanged during the step. Therefore, after at most one
$Color$-restricted round from $\gamma_i$, we have $\variable{ptr}_u =
\variable{bestPtr}(u)$ for every process $u$, and so
$\mathcal{P}_8$ holds.
\end{proof}
\begin{theorem}
\label{theo:alliance-round}
Starting from any configuration satisfying $\mathcal{P}_5$, Algorithm {\tt FGA}\xspace terminates in at most $5n+4$ rounds.
\end{theorem}
\begin{proof}
According to Lemmas \ref{lem:alliance-round1}-\ref{lem:alliance-round4}, after any $4$ consecutive $Color$-restricted rounds, every process $u$ satisfies:
\begin{multline*}
\variable{scr}_u = realScr\xspace(u) ~\And~
\variable{canQ}_u = \mathbf{P\_canQuit}\xspace(u)~\And
\neg\mathbf{P\_updPtr}\xspace(u)
\end{multline*}
So only $\mathbf{rule\_Clr}\xspace(u)$ may be enabled at $u$. We conclude
that an execution of $\mathbf{rule\_Clr}\xspace$ occurs at least every $5$ rounds,
unless the system reaches a terminal configuration. Since, along any
execution, there are at most $n$ steps containing the execution of
some $\mathbf{rule\_Clr}\xspace$, the theorem follows.
\end{proof}
Since $\gamma_{init}$ satisfies $\mathcal{P}_5$, we have the following
corollary.
\begin{corollary} Starting from $\gamma_{init}$, Algorithm {\tt FGA}\xspace terminates in at most $5n+4$ rounds.
\end{corollary}
\subsection{Algorithm {\tt FGA}\xspace $\circ$ {\tt SDR}\xspace}
\paragraph{Requirements.} To show the self-stabilization of {\tt FGA}\xspace
$\circ$ {\tt SDR}\xspace, we should first establish that {\tt FGA}\xspace meets the requirements
~\ref{RQ1} to~\ref{RQ6}, given in Subsection~\ref{sect:require}.
\begin{enumerate}
\item From the code of {\tt FGA}\xspace, we can deduce that
Requirements~\ref{RQ1},~\ref{RQ4},~\ref{RQ3}, and ~\ref{RQ5} are satisfied.
\item Requirement~\ref{RQ2} is satisfied since $\mathbf{P\_ICorrect}\xspace(u)$ does
not involve any variable of {\tt SDR}\xspace and is closed by {\tt FGA}\xspace (Corollary~\ref{coro:normal2}).
\item Finally, recall that $\delta_u \geq max(f(u), g(u))$, for every
process $u$. So, if $\mathbf{P\_reset}\xspace(v)$ holds, for every $v \in \variable{N}[u]$, then $realScr\xspace(u) = 1$ and so
$\mathbf{P\_ICorrect}\xspace(u)$ holds, by definition. Hence, Requirement~\ref{RQ6}
holds.
\end{enumerate}
\paragraph{Partial Correctness.}
Let $\gamma$ be any terminal configuration of {\tt FGA}\xspace $\circ$
{\tt SDR}\xspace. Then, $\gamma_{|{\tt SDR}\xspace}$ is a terminal configuration of {\tt SDR}\xspace and, by
Theorem~\ref{theo:termA}, $\mathbf{P\_Clean}\xspace(u)
\And \mathbf{P\_ICorrect}\xspace(u)$ holds in $\gamma$, and so $\gamma_{|{\tt SDR}\xspace}$, for
every process $u$. Moreover, $\gamma_{|{\tt FGA}\xspace}$ is a terminal
configuration of {\tt FGA}\xspace. Hence, by
Theorem~\ref{theo:term:alliance}, follows.
\begin{theorem}\label{theo:term:alliance:2}
In any terminal configuration of {\tt FGA}\xspace $\circ$ {\tt SDR}\xspace. the set $\{u
\in V\ |\ \variable{col}_u\}$ is a 1-minimal $(f,g)$ alliance of the
network.
\end{theorem}
\paragraph{Termination and Self-Stabilization.}
Let $u$ be a process. Let $e$ be an execution of {\tt FGA}\xspace $\circ$ {\tt SDR}\xspace.
By Corollary \ref{cor:seg} (page \pageref{cor:seg}), the sequence of
rules executed by a process $u$ in a segment of $e$ belongs to the
following language:
$$(\mathbf{rule\_C}\xspace + \varepsilon)\ \mathbf{words\_I}\xspace\ (\mathbf{rule\_RB}\xspace + \mathbf{rule\_R}\xspace + \varepsilon)\ (\mathbf{rule\_RF}\xspace + \varepsilon)$$ where $\mathbf{words\_I}\xspace$ be any sequence of rules of {\tt FGA}\xspace.
Moreover, by Lemma~\ref{lem:transfert} (page \pageref{lem:transfert}) and
Lemma~\ref{lem:move:alliance}, $\mathbf{words\_I}\xspace$ is bounded by
$8\delta_u\Delta+18\delta_u+24$.
Thus, $u$ executes at most
$8\delta_u\Delta+18\delta_u+27$ moves in any segment of
$e$ and, overall each segment of $e$ contains at most
$16m\Delta+36m+27n$ moves. Since, $e$ contains at most $n+1$ segments
(Remark~\ref{rem:nbseg}, page \pageref{rem:nbseg}), $e$ contains at most
$(n+1).(16m\Delta+36m+27n)$ moves, and we have the following theorem.
\begin{theorem}\label{theo:move:ss}
Any execution of {\tt FGA}\xspace $\circ$ {\tt SDR}\xspace terminates in $O(\Delta.n.m)$ moves.
\end{theorem}
By Theorems~\ref{theo:term:alliance:2} and~\ref{theo:move:ss}, we can conclude:
\begin{theorem} {\tt FGA}\xspace $\circ$ {\tt SDR}\xspace is
self-stabilizing for the 1-minimal $(f,g)$-alliance problem. Its
stabilization time is in $O(\Delta.n.m)$ moves.
\end{theorem}
\paragraph{Round Complexity.}
Corollary \ref{cor:round} (page \pageref{cor:round}) establishes that
after at most $3n$ rounds a normal configuration of {\tt FGA}\xspace $\circ$ {\tt SDR}\xspace is
reached. Then, since the set of normal configuration is closed
(still by Corollary \ref{cor:round}), all rules of {\tt SDR}\xspace algorithm are
disabled forever from such a configuration, by Lemma~\ref{lem:a4:term}
(page \pageref{lem:a4:term}). Moreover, in a normal configuration,
$\mathbf{P\_Clean}\xspace(u) \And \mathbf{P\_ICorrect}\xspace(u)$ holds, for every process $u$ (still
by Corollary \ref{cor:round}). Hence, after at most $5n+4$ additional
rounds, a terminal configuration of {\tt FGA}\xspace $\circ$ {\tt SDR}\xspace is reached, by
Theorem \ref{theo:alliance-round}, and follows.
\begin{theorem}
The
stabilization time of {\tt FGA}\xspace $\circ$ {\tt SDR}\xspace is at most $8n+4$ rounds.
\end{theorem}
\section{Introduction}
In distributed systems, a {\em self-stabilizing} algorithm is able to
recover a correct behavior in finite time, regardless of the
\emph{arbitrary} initial configuration of the system, and therefore
also after a finite number of transient faults, provided that those faults
do not alter the code of the processes.
For more than 40 years, a vast literature on self-stabilizing
algorithms has been developed. Self-stabilizing solutions have been
proposed for many kinds of classical distributed problems, {\em e.g.},
token circulation~\cite{HuangC93}, spanning tree
construction~\cite{CYH91}, clustering~\cite{CaronDDL10},
routing~\cite{Dolev1997122}, propagation of information with
feedback~\cite{BuiDPV99}, clock synchronization~\cite{CouvreurFG92},
{\em etc}. Moreover, self-stabilizing algorithms have been designed to
handle various environments, {\em e.g.}, wired
networks~\cite{HuangC93,CYH91,CaronDDL10,Dolev1997122,BuiDPV99,CouvreurFG92},
WSNs \cite{BenOthman2013199,Telematik_SSS_2013_Neighborhood},
peer-to-peer
systems~\cite{DBLP:journals/ppl/CaronDPT10,Caron20131533}, {\em etc}.
Drawing on this experience, general methodologies for making
distributed algorithms self-stabilizing have been proposed. In
particular, Katz and Perry~\cite{KP93j} give a characterization of
problems admitting a self-stabilizing solution. Precisely, they
describe a general algorithm that transforms almost all algorithms
(specifically, those algorithms that can be self-stabilized) into their
corresponding stabilizing version. However, this so-called {\em
transformer} is, by essence, inefficient both in terms of space and
time complexities: actually, its purpose is only to demonstrate the feasibility
of the transformation.
Interestingly, many proposed general
methods~\cite{KP93j,APVD94c,AG94j,AO94c} are based on {\em reset}
algorithms. Such algorithms are initiated when an inconsistency is
discovered in the network, and aim at reinitializing the system to a
correct (pre-defined) configuration.
A reset algorithm may be centralized at a leader process ({\em e.g.},
see~\cite{AG94j}), or fully distributed, meaning multi-initiator (as
our proposal here). In the former case, either the reset is coupled
with a snapshot algorithm (which makes a {\em global checking} of the
network), or processes detecting an incoherence (using {\em local
checking}~\cite{APV91c}) should request a reset to the leader. In
the fully distributed case, resets are locally initiated by processes
detecting inconsistencies. This latter approach is considered as more
efficient when the concurrent resets are coordinated. In other words,
concurrent resets have to be {\em cooperative} (in the sense
of~\cite{YNKM18c}) to ensure the fast convergence of the system to a
consistent global state.
Self-stabilization makes no hypotheses on the nature ({\em e.g.},
memory corruption or topological changes) or extent of transient
faults that could hit the system, and a self-stabilizing system
recovers from the effects of those faults in a unified manner.
Now, such versatility comes at a price, {\em e.g.}, after transient
faults cease, there is a finite period of time, called the {\em
stabilization phase}, during which the safety properties of the
system are violated. Hence, self-stabilizing algorithms are mainly
compared according to their {\em stabilization time}, the maximum
duration of the stabilization phase.
General schemes and efficiency are usually understood as orthogonal
issues. We tackle this problem by proposing an efficient
self-stabilizing reset algorithm working in any anonymous connected
network. Our algorithm is written in the locally shared memory model
with composite atomicity, where executions proceed in atomic steps (in
which a subset of enabled processes move, {\em i.e.}, update their
local states) and the asynchrony is captured by the notion of {\em
daemon}. The most general daemon is the {\em distributed unfair
daemon}. So, solutions stabilizing under such an assumption are
highly desirable, because they work under any other daemon assumption.
The {\em stabilization time} is usually evaluated in terms of
rounds, which capture the execution time according to the speed of the
slowest processes. But, another crucial issue is the number of local
state updates, {\em i.e.} the number of {\em moves}. Indeed, the
stabilization time in moves captures the amount of computations an
algorithm needs to recover a correct behavior.
The daemon assumption and time complexity are closely related. To
obtain practical solutions, the designer usually tries to avoid strong
assumptions on the daemon, like for example, assuming all executions
are synchronous. Now, when the considered daemon does not enforce any
bound on the execution time of processes, the stabilization time
in moves can be bounded only if the algorithm works under an unfair
daemon. For example, if the daemon is assumed to be {\em distributed
and weakly fair} (a daemon stronger than the distributed unfair one)
and the studied algorithm actually requires the weakly fairness
assumption to stabilize, then it is possible to construct executions
whose convergence is arbitrarily long in terms of atomic steps (and so
in moves), meaning that, in such executions, there are processes whose
moves do not make the system progress in the convergence. In other
words, these latter processes waste computation power and so energy.
Such a situation should be therefore
prevented, making the unfair daemon more desirable than the weakly
fair one.
There are many self-stabilizing algorithms proven under the
distributed unfair daemon, {\em
e.g.},~\cite{ACDDP14,DLP11,GHIJ14}. However, analyzes
of the stabilization time in moves is rather unusual and this may be
an important issue.
Indeed, recently, several self-stabilizing algorithms which work under
a distributed unfair daemon have been shown to have an exponential
stabilization time in moves in the worst case, {\em e.g.}, the silent
leader election algorithms from~\cite{DLP11} (see~\cite{ACDDP14}) and the Breadth-First Search (BFS) algorithm of Huang
and Chen~\cite{HC92} (see~\cite{DJ16}).
\subsection{Contribution}
We propose an efficient self-stabilizing reset algorithm working in
any anonymous connected network. Our algorithm is written in the
locally shared memory model with composite atomicity, assuming a
distributed unfair daemon, {\em i.e.}, the most general scheduling
assumption of the model.
It is based on local checking and is fully distributed ({\em i.e.},
multi-initiator). Concurrent resets are locally initiated by processes
detecting inconsistencies, these latter being cooperative to gain
efficiency.
As a matter of fact, our algorithm makes an input algorithm
recovering a consistent global state within at most $3n$ rounds, where
$n$ is the number of processes. During a recovering, any process executes at most $3n+3$ moves.
Our reset algorithm allows to build efficient self-stabilizing
solutions for various problems and settings. In particular, it applies
to both static and dynamic specifications. In the static case, the
self-stabilizing solution we obtain is also {\em silent}~\cite{DolevGS96}: a
silent algorithm converges within finite time to a configuration from
which the values of the communication registers used by the algorithm
remain fixed.
Silence is a desirable property. Indeed, as noted
in~\cite{DolevGS96}, the silent property usually implies more
simplicity in the algorithm design. Moreover, a silent algorithm
may utilize less communication operations and communication
bandwidth.
To show the efficiency of our method, we propose two reset-based
self-stabilizing algorithms, respectively solving the unison problem in
anonymous networks and the 1-minimal
$(f,g)$-alliance in identified networks.
Our unison algorithm has a stabilization time in $O(n)$ rounds and
$O(\Delta.n^2)$ moves. Actually, its stabilization times in round
matches the one of the previous best existing solution~\cite{BPV04c}. However,
it achieves a better stabilization time in moves, since the algorithm
in~\cite{BPV04c} stabilizes in $O(D.n^3+\alpha.n^2)$ moves (as shown
in~\cite{DP12}), where $\alpha$ is greater than the length of
the longest chordless cycle in the network.
As explained before, our 1-minimal $(f,g)$-alliance algorithm is also
silent. Its stabilization time is $O(n)$ rounds and $O(\Delta.n.m)$
moves, where $D$ is the network diameter and $m$ is the number of
edges in the network. To the best of our knowledge, until now there
was no self-stabilizing algorithm solving that problem without any
restriction on $f$ and $g$.
\subsection{Related Work}
Several reset algorithms have been proposed in the literature. In
particular, several solutions, {\em e.g.},~\cite{APVD94c,APV91c}, have
been proposed in the I/O automata model. In this model, communications
are implemented using message-passing and assuming {\em weakly
fairness}. Hence, move complexity cannot be evaluated in that
model. In these papers, authors additionally assume links with known
bounded capacity. In \cite{APVD94c}, authors introduce the notion of
local checking, and propose a method that, given a self-stabilizing
global reset algorithm, builds a self-stabilizing solution of any {\em
locally checkable} problem ({\em i.e.}, a problem where
inconsistency can be locally detected) in an {\em identified}
network. The stabilization time in rounds of obtained solutions
depends on the input reset algorithm. In \cite{APV91c}, authors focus
on an restrictive class of locally checkable problems, those that are
also {\em locally correctable}. A problem is locally correctable if
the global configuration of the network can be corrected by applying
independent corrections on pair neighboring processes. Now, for
example, the 1-minimal $(f,g)$ alliance problem is not locally
correctable since there are situations in which the correction of a
single inconsistency may provoke a global correction in a domino
effect reaction. Notice also that processes are not assumed to be
identified in \cite{APV91c}, however the considered networks are {\em not
fully anonymous} either. Indeed, each link has one of its incident
processes designated as leader. Notice also that authors show a
stabilization time in $O(H)$ when the network is a tree, where $H$ is
the tree height.
Self-stabilization by power supply \cite{AB98j} also assumes
message-passing with links of known bounded capacity and process
{\em identifiers}. Using this technique, the stabilization time is in
$O(n)$ rounds in general. Now, only {\em static} problems, {\em e.g.}
leader election and spanning tree construction, are considered.
Fully anonymous networks are considered in \cite{AO94c} in
message-passing systems with unit-capacity links and assuming {\em weakly
fairness}. The proposed self-stabilizing reset has a memory requirement
in $O(\log^\star(n))$ bits per process. But this small complexity comes
at the price of a stabilization time in {\em $O(n\log n)$ rounds}.
Finally, Arora and Gouda have proposed a mono-initiator reset
algorithm in the locally shared memory model with composite
atomicity. Their self-stabilizing reset works in {\em identified} networks,
assuming a distributed {\em weakly fair} daemon. The stabilization time of
their solution is in {\em $O(n+\Delta.D)$ rounds}, where $\Delta$ is the
degree of the network.
\subsection{Roadmap}
The remainder of the paper is organized as follows. In the next
section, we present the computational model and basic definitions.
In Section~\ref{sec:algo}, we present, prove, and analyze the time
complexity of our reset algorithm. In the two last sections, we
propose two efficient instances of our reset-based method, respectively
solving the unison problem in anonymous networks and the 1-minimal
$(f,g)$-alliance in identified networks.
\section{Preliminaries}\label{model}
\subsection{Network}\label{sub:network}
We consider a distributed system made of $n$ interconnected processes.
Information exchanges are assumed to be
bidirectional. Henceforth, the communication network is conveniently
modeled by a simple undirected connected graph $G=(V,E)$, where $V$ is
the set of processes and $E$ a set of $m$ edges $\{u,v\}$ representing
the ability of processes $u$ and $v$ to directly exchange information
together. We denote by $D$ the diameter of $G$, {\em i.e.}, the
maximum distance between any two pairs of processes. For every edge
$\{u,v\}$, $u$ and $v$ are said to be {\em neighbors}. For every
process $u$, we denote by $\delta_u$ the degree of $u$ in $G$, {\em
i.e.}, the number of its neighbors. Let $\Delta = \max_{u \in V}
\delta_u$ be the (maximum) degree of $G$.
\subsection{Computational Model}
We use the {\em composite atomicity model of computation}~\cite{D74j}
in which the processes communicate using a finite number of locally
shared registers, simply called {\em variables}. Each process can
read its own variables and that of its neighbors, but can write only
to its own variables. The \textit{state} of a process
is defined by the values of its variables. A {\em
configuration} of the system is a vector consisting of the states of
each process.
Every process~$u$ can access the states of its neighbors using a {\em
local labeling}. Such labeling is called {\em indirect naming} in
the literature~\cite{Sloman:1987}. All labels of $u$'s neighbors are
stored into the set $\variable{N}(u)$. To simplify the design of our
algorithms, we sometime consider the {\em closed neighborhood} of a
process $u$, {\em i.e.}, the set including $u$ itself and all its
neighbors. Let $\variable{N}[u]$ be the set of labels local to $u$ designating
all members of its closed neighborhood, including $u$ itself. In
particular, $\variable{N}(u) \subsetneq \variable{N}[u]$. We assume that each process $u$
can identify its local label $\alpha_u(v)$ in the sets $\variable{N}(v)$ of each
neighbor $v$ and $\variable{N}[w]$ of each member $w$ of its closed
neighborhood. When it is clear from the context, we use, by an abuse
of notation,~$u$ to designate both the process $u$ itself, and its
local labels ({\em i.e.}, we simply use $u$ instead of~$\alpha_u(v)$
for~$v \in \variable{N}[u]$).
A \emph{distributed algorithm\/} consists of one local
program per process.
The \textit{program} of each process consists of a finite
set of \textit{rules} of the form\ $$\langle label \rangle\ :\ \langle guard \rangle\ \to\ \langle action \rangle$$
{\em Labels} are only used to identify rules in the reasoning. A
\textit{guard} is a Boolean predicate involving the state of the
process and that of its neighbors. The {\em action\/} part
of a rule updates the state of the process.
A rule can be executed only if its
guard evaluates to {\em true}; in this case, the rule is
said to be {\em enabled\/}.
A process is said to be enabled if at least one of
its rules is enabled. We denote by
$\mbox{\it Enabled}(\gamma)$ the
subset of processes that are enabled in configuration~$\gamma$.
When the configuration is $\gamma$ and $\mbox{\it Enabled}(\gamma)
\neq \emptyset$, a non-empty set $\mathcal X \subseteq \mbox{\it
Enabled}(\gamma)$ is {\em activated} by a so-called {\em daemon}; then every
process of $\mathcal X$ {\em atomically} executes one of its enabled
rules,\footnote{In case of several enabled actions at the activated
process, the choice of the executed action is nondeterministic.}
leading to a new configuration $\gamma^\prime$, and so on. The
transition from $\gamma$ to $\gamma^\prime$ is called a {\em step}.
The possible steps induce a binary relation over the set of
configurations, denoted by $\mapsto$. An {\em execution\/} is a
maximal sequence of configurations $e=\gamma_0\gamma_1\cdots
\gamma_i\cdots$ such that $\gamma_{i-1}\mapsto\gamma_i$ for all $i>0$.
The term ``maximal'' means that the execution is either infinite, or
ends at a {\em terminal\/} configuration in which no rule is enabled
at any process.
Each step from a configuration to another is driven by a daemon. We
define a daemon as a predicate $\mathfrak{D}$ over executions. A daemon $\mathfrak{D}$ may
restrain the set of possible executions (in particular, it may forbid
some steps), {\em i.e.}, only executions satisfying $\mathfrak{D}$ are possible.
We assume here the daemon is {\em distributed} and {\em unfair}.
``Distributed'' means that while the configuration is not terminal,
the daemon should select at least one enabled process, maybe
more. ``Unfair'' means that there is no fairness constraint, {\em
i.e.}, the daemon might never select an enabled process unless it is
the only enabled process. In other words, the distributed unfair
daemon is defined by the predicate {\em true} ({\em i.e.} it is the most
general daemon), and assuming that daemon, every execution is possible
and $\mapsto$ is actually the set of all possible steps.
\subsection{Self-Stabilization and Silence}
Let ${\tt A}$ be a distributed algorithm. Let $P$
and $P'$ be two predicates over configurations of ${\tt A}$. Let $C$ and
$C'$ be two subsets of $\mathcal C_{{\tt A}}$, the set of ${\tt A}$'s
configurations.
\begin{itemize}
\item $P$ (resp. $C$) is {\em closed by} ${\tt A}$ if for every step
$\gamma \mapsto \gamma'$ of ${\tt A}$, $P(\gamma) \Rightarrow
P(\gamma')$ (resp. $\gamma \in C \Rightarrow \gamma' \in C$).
\item ${\tt A}$ {\em converges from} $P'$ (resp. $C'$) {\em to} $P$
(resp. $C$) if each of its executions
starting from a configuration satisfying $P'$ (resp. in a
configuration of $C'$) contains a configuration satisfying $P$
(resp. a configuration of $C$).
\item $P$ (resp. $C$) is an {\em attractor} for ${\tt A}$ if $P$ (resp. $C$) is closed by ${\tt A}$
and ${\tt A}$ converges from $true$ (resp. from $\mathcal C_{{\tt
A}}$) to $P$ (resp. to $C$).
\end{itemize}
Let $SP$ be a specification, {\em i.e.}, a predicate over executions.
Algorithm ${\tt A}$ is {\em self-stabilizing} for $SP$ (under the
unfair daemon) if there exists a non-empty subset of its
configurations $\mathcal L$, called the {\em legitimate}
configurations, such that $\mathcal L$ is an attractor for ${\tt A}$
and every execution of ${\tt A}$ that starts in a configuration of
$\mathcal L$ satisfies $SP$. Configurations of $\mathcal C_{{\tt A}}
\setminus \mathcal L$ are called the {\em illegitimate}
configurations.
In our model, an algorithm is {\em silent}~\cite{DolevGS96} if and
only if all its possible executions are finite. Let $SP'$ be an
predicate over configurations of ${\tt A}$. Usually, silent
self-stabilization is (equivalently) reformulated as follows. ${\tt
A}$ is {\em silent and self-stabilizing} for the $SP'$ if all its
executions are finite and all its terminal configurations satisfy
$SP'$. Of course, in silent self-stabilization, the set of legitimate
configurations is chosen as the set of terminal configurations.
\subsection{Time Complexity}
We measure the time complexity of an algorithm using two notions: {\em
rounds}~\cite{DIM93,CDPV02c} and {\em moves}~\cite{D74j}.
We say that a process {\em moves} in
$\gamma_i\mapsto\gamma_{i+1}$ when it executes a rule in
$\gamma_i\mapsto\gamma_{i+1}$.
The definition of round uses the concept of {\em
neutralization}: a process~$v$ is \textit{neutralized} during a
step~$\gamma_i \mapsto \gamma_{i+1}$, if~$v$ is enabled in~$\gamma_i$
but not in configuration~$\gamma_{i+1}$, and it is not activated in the step~$\gamma_i \mapsto \gamma_{i+1}$.
Then, the rounds are
inductively defined as follows. The first round of an execution~$e =
\gamma_0\gamma_1\cdots$ is the minimal prefix~$e' = \gamma_0\cdots\gamma_j$, such that every process that is enabled
in~$\gamma_0$ either executes a rule or is neutralized during a step
of~$e'$. Let~$e''$ be the suffix $\gamma_j\gamma_{j+1}\cdots$
of~$e$. The second round of~$e$ is the first round of~$e''$, and so
on.
The {\em stabilization time} of a self-stabilizing algorithm is
the maximum time (in moves or rounds) over every possible execution (starting from any initial
configuration) to reach a legitimate configuration.
\subsection{Composition}
We denote by ${\tt A}$ $\circ$ ${\tt B}$ the composition of the two
algorithms ${\tt A}$ and ${\tt B}$ which is the distributed algorithm where
the local program (${\tt A}$ $\circ$ ${\tt B}$)($u$), for every process
$u$, consists of all variables and rules of both ${\tt A}$($u$) and
${\tt B}$($u$).
\section{Correctness and Complexity Analysis}
\subsection{Partial Correctness}
\begin{lemma}\label{lem:nonPRabc}
In any terminal configuration of {\tt SDR}\xspace, $\neg \mathbf{P\_R1}\xspace(u) \And \neg \mathbf{P\_R2}\xspace(u) \And \mathbf{P\_Correct}\xspace(u)$ holds for every process $u$.
\end{lemma}
\begin{proof}
Let $u$ be any process and consider any terminal configuration of
{\tt SDR}\xspace. Since $\mathbf{rule\_RB}\xspace(u)$ and $\mathbf{rule\_R}\xspace(u)$ are disabled, $\neg\mathbf{P\_RB}\xspace(u)$
and $\neg\mathbf{P\_Up}\xspace(u)$ hold. Since $\neg\mathbf{P\_RB}\xspace(u) \And \neg\mathbf{P\_Up}\xspace(u)$
implies $\neg \mathbf{P\_R1}\xspace(u) \And \neg \mathbf{P\_R2}\xspace(u) \And \mathbf{P\_Correct}\xspace(u)$, we are
done.
\end{proof}
Since $\neg \mathbf{P\_R2}\xspace(u) \equiv \variable{st}_u = C \vee \mathbf{P\_reset}\xspace(u)$, we have the
following corollary.
\begin{corollary}\label{coro:nonPRB}
In any terminal configuration of {\tt SDR}\xspace, $\variable{st}_u = C \vee \mathbf{P\_reset}\xspace(u)$
holds for every process $u$.
\end{corollary}
\begin{lemma}\label{lem:nonRB}
In any terminal configuration of {\tt SDR}\xspace, $\variable{st}_u \neq RB$ for every
process $u$.
\end{lemma}
\begin{proof}
Assume, by the contradiction, that some process $u$ satisfies
$\variable{st}_u = RB$ in a terminal configuration of {\tt SDR}\xspace. Without the loss
of generality, assume $u$ is a process such that $\variable{st}_u = RB$
with $\variable{d}_u$ maximum. First, $\mathbf{P\_reset}\xspace(u)$ holds by
Corollary~\ref{coro:nonPRB}.
Then, every neighbor $v$ of $u$ satisfies $\variable{st}_v \neq C$, since
otherwise $\mathbf{rule\_RB}\xspace(v)$ is enabled. So, every $v$ satisfies
$\variable{st}_v \in \{RB,RF\}$, $\variable{st}_v = RB \Rightarrow dist_v \leq
\variable{d}_u$ (by definition of $u$), and $\variable{st}_v = RF \Rightarrow
\mathbf{P\_reset}\xspace(v)$ (by Corollary~\ref{coro:nonPRB}). Hence, $\mathbf{rule\_RF}\xspace(u)$ is
enabled, a contradiction.
\end{proof}
\begin{lemma}\label{lem:nonRF}
In any terminal configuration of {\tt SDR}\xspace, $\variable{st}_u \neq RF$ for every
process $u$.
\end{lemma}
\begin{proof}
Assume, by the contradiction, that some process $u$ satisfies
$\variable{st}_u = RF$ in a terminal configuration of {\tt SDR}\xspace. Without the loss
of generality, assume $u$ is a process such that $\variable{st}_u = RF$
with $\variable{d}_u$ minimum. First, every neighbor $v$ of $u$ satisfies
$\variable{st}_v \neq RB$, by Lemma~\ref{lem:nonRB}. Then, every neighbor
$v$ of $u$ such that $\variable{st}_v = C$ also satisfies $\mathbf{P\_reset}\xspace(v)$,
since otherwise $\mathbf{P\_R1}\xspace(v)$ holds, contradicting then
Lemma~\ref{lem:nonPRabc}. Finally, by definition of $u$ and by
Corollary~\ref{coro:nonPRB}, every neighbor $v$ of $u$ such that
$\variable{st}_v = RF$ both satisfies $dist_v \geq \variable{d}_u$ and
$\mathbf{P\_reset}\xspace(v)$. Hence, $\mathbf{rule\_C}\xspace(u)$ is enabled, a contradiction.
\end{proof}
\begin{theorem}\label{theo:termA}
For every configuration $\gamma$ of {\tt SDR}\xspace, $\gamma$ is terminal if and
only if $\mathbf{P\_Clean}\xspace(u)
\And \mathbf{P\_ICorrect}\xspace(u)$ holds in $\gamma$, for every process $u$.
\end{theorem}
\begin{proof}
Let $u$ be any process and assume $\gamma$ is terminal. By
Lemmas~\ref{lem:nonRB} and~\ref{lem:nonRF}, $\variable{st}_u =C$ holds in
$\gamma$. So, $\mathbf{P\_Clean}\xspace(u)$ holds in $\gamma$. Moreover, since
$\mathbf{P\_Correct}\xspace(u)$ holds (Lemma~\ref{lem:nonPRabc}), $\mathbf{P\_ICorrect}\xspace(u)$ also
holds in $\gamma$, and we are done.
Assume now that for every process $u$, $\mathbf{P\_Clean}\xspace(u) \And
\mathbf{P\_ICorrect}\xspace(u)$ holds in $\gamma$. Then, $\variable{st}_u =C$ for every
process $u$, and so $\mathbf{rule\_C}\xspace(u)$, $\mathbf{rule\_RB}\xspace(u)$, and $\mathbf{rule\_RF}\xspace(u)$ are
disabled for every $u$. Then, since every process has status $C$,
$\neg \mathbf{P\_R1}\xspace(u) \And \neg \mathbf{P\_R2}\xspace(u)$ holds, moreover, $\mathbf{P\_ICorrect}\xspace(u)$ implies
$\mathbf{P\_Correct}\xspace(u)$, so $\mathbf{rule\_R}\xspace(u)$ is also disabled in $\gamma$. Hence $\gamma$ is
terminal, and we are done.
\end{proof}
\subsection{Termination}
From Requirements~\ref{RQ1} and~\ref{RQ2}, we know that Algorithm
{\tt I} does not write into $\variable{st}_u$ and $\mathbf{P\_ICorrect}\xspace(u)$ is closed
by {\tt I}, for every process $u$. Hence follows.
\begin{remark}\label{rem:cor:close:I}
For every process $u$, predicate $\mathbf{P\_Correct}\xspace(u)$ (defined in {\tt SDR}\xspace) is
closed by {\tt I}.
\end{remark}
Requirements~\ref{RQ1},~\ref{RQ4}, and~\ref{RQ3} ensures the
following property.
\begin{lemma}\label{lem:closedI}
For every process $u$, predicates $\neg\mathbf{P\_R1}\xspace(u)$, $\neg\mathbf{P\_R2}\xspace(u)$, and
$\mathbf{P\_RB}\xspace(u)$ are closed by {\tt I}.
\end{lemma}
\begin{proof}
Let $\gamma \mapsto \gamma'$ be any step of ${\tt I}$.
\begin{itemize}
\item Assume that $\neg\mathbf{P\_R1}\xspace(u)$ holds at some process $p$ in $\gamma$.
If $\variable{st}_u \neq C \vee (\forall v \in \variable{N}(u)\ \mid\ \variable{st}_v \neq
RF)$ in $\gamma$, then $\variable{st}_u \neq C \vee (\forall v \in \variable{N}(u)\
\mid\ \variable{st}_v \neq RF)$ still holds in $\gamma'$ by Requirement~\ref{RQ1}, and we are done.
Otherwise, $\variable{st}_u = C \And \mathbf{P\_reset}\xspace(u) \And (\exists v \in \variable{N}(u)\
\mid\ \variable{st}_v = RF)$ holds in $\gamma$.
In particular, $\neg
\mathbf{P\_Clean}\xspace(u)$ holds in $\gamma$. Hence,
no rule of {\tt I} is enabled at $u$ in $\gamma$, by
Requirement~\ref{RQ3}. Consequently, $\mathbf{P\_reset}\xspace(u)$ still holds in $\gamma'$. Since, $\mathbf{P\_reset}\xspace(u)$ implies $\neg\mathbf{P\_R1}\xspace(u)$, we are done.
\item Assume that $\neg\mathbf{P\_R2}\xspace(u)$ holds at some process $u$ in $\gamma$.
If $\variable{st}_u = C$ holds in $\gamma$, then $\variable{st}_u = C$ holds in
$\gamma'$ by Requirement~\ref{RQ1}, and so $\neg\mathbf{P\_R2}\xspace(u)$ still holds
in $\gamma'$. Otherwise, $\variable{st}_u \neq C \wedge \mathbf{P\_reset}\xspace(u)$ holds
in $\gamma$. In particular, $\neg \mathbf{P\_Clean}\xspace(u)$ holds in $\gamma$.
Hence, no rule of {\tt I} is enabled at $u$, by
Requirement~\ref{RQ3}, and by Requirement \ref{RQ4}, $\mathbf{P\_reset}\xspace(u)$,
and so $\neg\mathbf{P\_R2}\xspace(u)$, still holds in $\gamma'$.
\item By Requirement~\ref{RQ1}, $\mathbf{P\_RB}\xspace(u)$ is closed by {\tt I}.
\end{itemize}
\end{proof}
Recall that two rules are {\em mutually exclusive} if there is no
configuration $\gamma$ and no process $u$ such that both rules at
enabled $u$ in $\gamma$. Two algorithms are {\em mutually exclusive}
if their respective rules are pairwise mutually exclusive. Now,
whenever a process $u$ is enabled in {\tt SDR}\xspace, $\neg \mathbf{P\_ICorrect}\xspace(u) \vee \neg
\mathbf{P\_Clean}\xspace(u)$ holds and, by Requirement \ref{RQ3}, no rule of {\tt I} is
enabled at $u$. Hence, follows.
\begin{remark}\label{rem:mutex}
Algorithms {\tt SDR}\xspace and {\tt I} are mutually exclusive.
\end{remark}
\begin{lemma}\label{lem:mutex:2}
Rules of Algorithm {\tt SDR}\xspace are pairwise mutually exclusive.
\end{lemma}
\begin{proof}
Since $\mathbf{P\_RB}\xspace(u)$ implies $\variable{st}_u = C$, $\mathbf{P\_RF}\xspace(u)$ implies $\variable{st}_u
= RB$, and $\mathbf{P\_C}\xspace(u)$ implies $\variable{st}_u = RF$, we can conclude that
$\mathbf{rule\_RB}\xspace(u)$, $\mathbf{rule\_RF}\xspace(u)$, and $\mathbf{rule\_C}\xspace(u)$ are pairwise mutually
exclusive.
Then, since $\mathbf{P\_Up}\xspace(u)$ implies $\neg \mathbf{P\_RB}\xspace(u)$, rules $\mathbf{rule\_R}\xspace(u)$ and
$\mathbf{rule\_RB}\xspace(u)$ are mutually exclusive.
$\mathbf{P\_C}\xspace(u)$ implies $\mathbf{P\_Correct}\xspace(u) \wedge \mathbf{P\_reset}\xspace(u)$ which, in turn,
implies $\neg \mathbf{P\_Up}\xspace(u)$. Hence, $\mathbf{rule\_R}\xspace(u)$ and $\mathbf{rule\_C}\xspace(u)$ are
mutually exclusive.
$\mathbf{P\_RF}\xspace(u)$ implies $\variable{st}_u = RB \wedge \mathbf{P\_reset}\xspace(u)$. Now, $\mathbf{P\_Up}\xspace(u)$
implies $\variable{st}_u = C \vee \neg\mathbf{P\_reset}\xspace(u)$. Hence, $\mathbf{rule\_R}\xspace(u)$ and
$\mathbf{rule\_RF}\xspace(u)$ are mutually exclusive.
\end{proof}
\begin{lemma}
\label{lem:PRa}
For every process $u$, predicates $\neg\mathbf{P\_R1}\xspace(u)$ and $\neg\mathbf{P\_R2}\xspace(u)$ are
closed by {\tt I} $\circ$ {\tt SDR}\xspace.
\end{lemma}
\begin{proof}
By Remark~\ref{rem:mutex} and Lemma~\ref{lem:closedI}, to prove this
lemma it is sufficient to show that $\neg\mathbf{P\_R1}\xspace(u)$ and $\neg\mathbf{P\_R2}\xspace(u)$
are closed by {\tt SDR}\xspace, for every process $u$.
Predicate $\neg\mathbf{P\_R2}\xspace(u)$ only depends on variables of $u$ by
Requirement \ref{RQ4}. So, if $u$ does not move, $\neg\mathbf{P\_R2}\xspace(u)$ still
holds. Assume $\neg\mathbf{P\_R2}\xspace(u)$ holds in $\gamma$ and $u$ executes a
rule of {\tt SDR}\xspace in $\gamma \mapsto \gamma'$. If $u$ executes $\mathbf{rule\_RB}\xspace(u)$
or $\mathbf{rule\_R}\xspace(u)$, then $u$ modifies its variables in {\tt I} by executing
$\variable{reset}(u)$. Hence, in both cases, $\mathbf{P\_reset}\xspace(u)$ holds in $\gamma'$
by Requirement \ref{RQ5} and as $\mathbf{P\_reset}\xspace(u)$ implies $\neg\mathbf{P\_R2}\xspace(u)$,
we are done. Otherwise, $u$ executes $\mathbf{rule\_RF}\xspace(u)$ or
$\mathbf{rule\_C}\xspace(u)$. In both cases, $\mathbf{P\_reset}\xspace(u)$ holds in $\gamma$ and so in
$\gamma'$ by Requirement \ref{RQ4}, and we are done.
Assume now that the predicate $\neg\mathbf{P\_R1}\xspace(u)$ holds in $\gamma$ and
consider any step $\gamma \mapsto \gamma'$. Assume first that $u$
moves in $\gamma \mapsto \gamma'$. If $u$ executes $\mathbf{rule\_RB}\xspace(u)$,
$\mathbf{rule\_RF}\xspace(u)$, or $\mathbf{rule\_R}\xspace(u)$, then $\variable{st}_u \neq C$ in $\gamma'$,
hence $\neg\mathbf{P\_R1}\xspace(u)$ holds in $\gamma'$. If $u$ executes $\mathbf{rule\_C}\xspace(u)$
in $\gamma \mapsto \gamma'$, $u$ satisfies $\mathbf{P\_reset}\xspace(u)$ in $\gamma$,
and so in $\gamma'$ by Requirement \ref{RQ4}. Since $\mathbf{P\_reset}\xspace(u)$
implies $\neg\mathbf{P\_R1}\xspace(u)$, we are done. Assume now that $u$ does not
move in $\gamma \mapsto \gamma'$. In this case, $\mathbf{P\_R1}\xspace(u)$ may become
true only if at least a neighbor $v$ of $u$ switches to status $RF$,
by executing $\mathbf{rule\_RF}\xspace(v)$. Now, in this case, $\variable{st}_u \neq C$ in
$\gamma$, and so in $\gamma'$. Consequently, $\neg\mathbf{P\_R1}\xspace(u)$ still
holds in $\gamma'$.
\end{proof}
\begin{theorem}
\label{theo:correct}
For every process $u$, $\mathbf{P\_Correct}\xspace(u)$ $\vee$ $\mathbf{P\_RB}\xspace(u)$ is closed by {\tt
I} $\circ$ {\tt SDR}\xspace.
\end{theorem}
\begin{proof}
By Remarks~\ref{rem:cor:close:I} and~\ref{rem:mutex}, and
Lemma~\ref{lem:closedI}, to prove this lemma it is sufficient to
show that $\mathbf{P\_Correct}\xspace(u)$ $\vee$ $\mathbf{P\_RB}\xspace(u)$ is closed by {\tt SDR}\xspace, for every
process $u$.
Let $\gamma \mapsto \gamma'$ be any step of {\tt SDR}\xspace such that
$\mathbf{P\_Correct}\xspace(u)$ $\vee$ $\mathbf{P\_RB}\xspace(u)$ holds in $\gamma$.
\begin{itemize}
\item Assume $\mathbf{P\_Correct}\xspace(u)$ holds in $\gamma$. By
Requirement~\ref{RQ2}, if $\mathbf{P\_ICorrect}\xspace(u)$ holds in $\gamma$, then
$\mathbf{P\_ICorrect}\xspace(u)$ still holds in $\gamma'$, and as $\mathbf{P\_ICorrect}\xspace(u)$
implies $\mathbf{P\_Correct}\xspace(u)$, we are done.
Assume now $\neg \mathbf{P\_ICorrect}\xspace(u)$ holds in $\gamma$. Then,
$\mathbf{P\_Correct}\xspace(u) \wedge \neg \mathbf{P\_ICorrect}\xspace(u)$ implies $\variable{st}_u \neq C$
in $\gamma$. Since $\mathbf{P\_C}\xspace(u)$ implies $\mathbf{P\_ICorrect}\xspace(u)$ by
Requirement~\ref{RQ6}, $\mathbf{rule\_C}\xspace(u)$ is disabled in $\gamma$, and
Consequently, $\variable{st}_u \neq C$ in $\gamma'$, which implies that
$\mathbf{P\_Correct}\xspace(u)$ still holds in $\gamma'$.
\item Assume $\mathbf{P\_RB}\xspace(u)$ holds in $\gamma$. If $u$ moves in $\gamma
\mapsto \gamma'$, then $u$ necessarily executes $\mathbf{rule\_RB}\xspace(u)$; see
Lemma~\ref{lem:mutex:2}. In this case, $\variable{st}_u = RB$ in
$\gamma'$, which implies $\mathbf{P\_Correct}\xspace(u)$ in $\gamma'$.
If $u$ does not move, then at least one neighbor of $u$ should
switch its status from $RB$ to either $C$ or $RF$ so that $\neg
\mathbf{P\_RB}\xspace(u)$ holds in $\gamma'$. Any neighbor $v$ of $u$ satisfying
$\variable{st}_v = RB$ may only change its status by executing
$\mathbf{rule\_RF}\xspace(v)$ in $\gamma \mapsto \gamma'$. Now, $\mathbf{rule\_RF}\xspace(v)$ is
necessarily disabled in $\gamma$ since $\variable{st}_u = C$. Hence,
$\mathbf{P\_RB}\xspace(u)$ still holds in $\gamma'$ in this case.
\end{itemize}
\end{proof}
From Lemma \ref{lem:PRa} and Theorem \ref{theo:correct}, we can deduce
the following corollary.
\begin{corollary}
\label{cor:correct}
For every process $u$, $\neg\mathbf{P\_Up}\xspace(u)$ is closed by {\tt I} $\circ$ {\tt SDR}\xspace.
\end{corollary}
\subsubsection{Roots.}
If the configuration is illegitimate {\em w.r.t.} the initial
algorithm, then some processes locally detect the inconsistency by
checking their state and that of their neighbors (using Predicate
$\mathbf{P\_ICorrect}\xspace$). Such processes, called here {\em roots}, should
initiates a reset. Then, each root $u$ satisfies $\variable{st}_u \neq C$
all along the reset processing. According to its status, a root is
either {\em alive} or {\em dead}, as defined below.
\begin{definition} Let $\mathbf{P\_root}\xspace(u)$ $ \equiv $ $\variable{st}_u = RB$ $\And$ $(\forall v \in \variable{N}(u)$, $\variable{st}_v = RB \Rightarrow \variable{d}_v \geq \variable{d}_u)$.
\begin{itemize}
\item A process $u$ is said to be an {\em alive root} if $\mathbf{P\_Up}\xspace(u) \vee \mathbf{P\_root}\xspace(u)$.
\item A process $u$ is said to be an {\em dead root} if
$\variable{st}_u = RF \And (\forall v \in \variable{N}(u), status_v \neq C \Rightarrow \variable{d}_v \geq \variable{d}_u)$.
\end{itemize}
\end{definition}
By definition, follows.
\begin{remark}\label{rem:dead}
For every process $u$, if $\mathbf{P\_C}\xspace(u)$ holds, then $u$ is a dead root.
\end{remark}
The next theorem states that no alive root is created during an
execution.
\begin{theorem}
\label{theo:pseudoRoots}
For every process $u$, $\neg\mathbf{P\_root}\xspace(u) \And \neg\mathbf{P\_Up}\xspace(u)$ is closed by {\tt I} $\circ$ {\tt SDR}\xspace.
\end{theorem}
\begin{proof}
By Requirement~\ref{RQ1} and~Corollary~\ref{theo:correct},
$\neg\mathbf{P\_root}\xspace(u) \And \neg\mathbf{P\_Up}\xspace(u)$ is closed by {\tt I}. Hence, by
Remark~\ref{rem:mutex}, it is sufficient to show that $\neg\mathbf{P\_root}\xspace(u)
\And \neg\mathbf{P\_Up}\xspace(u)$ is closed by {\tt SDR}\xspace.
Let $\gamma \mapsto \gamma'$ be any step of {\tt SDR}\xspace such that
$\neg\mathbf{P\_root}\xspace(u) \And \neg\mathbf{P\_Up}\xspace(u)$ holds in $\gamma$.
By Corollary~\ref{theo:correct}, $\neg\mathbf{P\_Up}\xspace(u)$ holds in $\gamma'$.
To show that $\neg\mathbf{P\_root}\xspace(u)$ holds in $\gamma'$, we now consider the following cases:
\begin{description}
\item[$\variable{st}_u = RF$ in $\gamma$:] In this case, $\mathbf{rule\_RB}\xspace(u)$ and
$\mathbf{rule\_R}\xspace(u)$ are respectively disabled in $\gamma$ since $\variable{st}_u
\neq C$ and $\neg\mathbf{P\_Up}\xspace(u)$ hold in $\gamma$. So, $\variable{st}_u \neq
RB$ in $\gamma'$, which implies that $\neg\mathbf{P\_root}\xspace(u)$ still holds in
$\gamma'$.
\item[$\variable{st}_u = RB$ in $\gamma$:] Then, $\neg\mathbf{P\_root}\xspace(u)$ in
$\gamma$ implies that there is a neighbor $v$ of $u$ such that
$\variable{st}_v = RB \And \variable{d}_v < \variable{d}_u$ in $\gamma$. Let $\alpha$
be the value of $\variable{d}_v$ in $\gamma$. Since $\neg\mathbf{P\_Up}\xspace(u)$ holds
in $\gamma$, $u$ may only execute $\mathbf{rule\_RF}\xspace(u)$ in $\gamma \mapsto
\gamma'$ and, consequently, $\variable{d}_u > \alpha$ in $\gamma'$. Due to
the value of $\variable{d}_u$, $v$ may only execute $\mathbf{rule\_R}\xspace(v)$ in $\gamma
\mapsto \gamma'$. Whether or not $v$ moves, $\variable{st}_v = RB \wedge
\variable{d}_v \leq \alpha$ in $\gamma'$. Hence, $\variable{st}_v = RB \wedge
\variable{d}_v < \variable{d}_u$ in $\gamma'$, which implies that $\neg\mathbf{P\_root}\xspace(u)$
still holds in $\gamma'$.
\item[$\variable{st}_u = C$ in $\gamma$:] If $u$ does not moves in $\gamma
\mapsto \gamma'$, then $\neg\mathbf{P\_root}\xspace(u)$ still holds in
$\gamma'$. Otherwise, since $\neg\mathbf{P\_Up}\xspace(u)$ holds in $\gamma$, $u$
can only execute $\mathbf{rule\_RB}\xspace(u)$ in $\gamma \mapsto \gamma'$. In this
case, $\mathbf{P\_RB}\xspace(u)$ implies that there is a neighbor $v$ of $u$ such
that $\variable{st}_v = RB$ in $\gamma$. Without the loss of generality,
assume $v$ is the neighbor of $u$ such that $\variable{st}_v = RB$ with
the minimum distance value in $\gamma$. Let $\alpha$ be the value
of $\variable{d}_v$ in $\gamma$. Then, $\variable{st}_u = RB$ and $\variable{d}_u =
\alpha+1$ in $\gamma'$. Moreover, since $\variable{st}_u = C$ and
$\variable{st}_v = RB$ in $\gamma$, $v$ may only execute $\mathbf{rule\_R}\xspace(v)$ in
$\gamma \mapsto \gamma'$. Whether or not $v$ moves, $\variable{st}_v = RB
\wedge \variable{d}_v \leq \alpha$ in $\gamma'$. Hence, $\variable{st}_v = RB
\wedge \variable{d}_v < \variable{d}_u$ in $\gamma'$, which implies that
$\neg\mathbf{P\_root}\xspace(u)$ still holds in $\gamma'$.
\end{description}
\end{proof}
\subsubsection{Move Complexity.}
\begin{definition}[$AR$]
Let $\gamma$ be a configuration of {\tt I} $\circ$ {\tt SDR}\xspace. We denote by
$AR(\gamma)$ the set of alive roots in $\gamma$.
\end{definition}
By Theorem~\ref{theo:pseudoRoots}, follows.
\begin{remark}\label{rem:inclusion}
Let $\gamma_0\cdots\gamma_i\cdots$ be any execution of {\tt I} $\circ$ {\tt SDR}\xspace.
For every $i > 0$, $AR(\gamma_i) \subseteq AR(\gamma_{i-1})$.
\end{remark}
Based on the aforementioned property, we define below the notion of
{\em segment}.
\begin{definition}[Segment] Let $e = \gamma_0\cdots\gamma_i\cdots$ be any execution of {\tt I} $\circ$ {\tt SDR}\xspace.
\begin{itemize}
\item If for every $i > 0$, $|AR(\gamma_{i-1})| = |AR(\gamma_i)|$,
then the first {\em segment} of $e$ is $e$ itself, and there is no
other segment.
\item Otherwise, let $\gamma_{i-1} \mapsto \gamma_i$ be the first step
of $e$ such that $|AR(\gamma_{i-1})| > |AR(\gamma_i)|$. The {\em
first segment} of $e$ is the prefix $\gamma_0\cdots\gamma_i$ and
the {\em second segment} of $e$ is the first segment of the suffix
of $e$ starting in $\gamma_i$, and so forth.
\end{itemize}
\end{definition}
By Remark~\ref{rem:inclusion}, follows.
\begin{remark}\label{rem:nbseg}
Every execution of {\tt I} $\circ$ {\tt SDR}\xspace contains at most $n+1$
segments where $n$ is the number of processes.
\end{remark}
We now study how a reset propagates into the network. To that goal, we first define the notion of {\em reset parent}. Roughly speaking, the parents of $u$ in a reset are its neighbors (if any) that have caused its reset.
\begin{definition}[Reset Parent and Children]
$RParent(v,u)$ holds for any two processes $u$ and $v$ if $v \in
\variable{N}(u)$, $\variable{st}_u \neq C$, $\mathbf{P\_reset}\xspace(u)$, $\variable{d}_u > \variable{d}_v$, and
$(\variable{st}_u = \variable{st}_v \vee \variable{st}_v = RB)$.
Whenever $RParent(v,u)$ holds, $v$
(resp., $u$) is said to be a {\em reset parent} of $u$ in (resp., a
{\em reset child} of $v$).
\end{definition}
Remark that in a given configuration, a process may have several reset
parents. Below, we define the {\em reset branches}, which are the trails of
a reset in the network.
\begin{definition}[Reset Branch]
A \emph{reset branch} is a
sequence of processes~$u_1, \ldots ,u_k$ for some integer~$k \geq
1$, such that~$u_1$ is~an alive or dead root and, for every~$1
< i \leq k$, we have~$RParent(u_{i-1},u_i)$.
The process~$u_i$ is said to be at \emph{depth}~$i-1$ and $u_i, \cdots
,u_k$ is called a {\em reset sub-branch}. The process~$u_1$ is the {\em initial extremity} of the reset branch~$u_1, \ldots ,u_k$.
\end{definition}
\begin{lemma}\label{lem:trace}
Let $u_1, \ldots ,u_k$ be any reset branch.
\begin{enumerate}
\item $k \leq n$, \label{lem:trace:1}
\item If $\variable{st}_{u_1} = C$, then $k = 1$. Otherwise, $\variable{st}_{u_1}\cdots\variable{st}_{u_k} \in RB^*RF^*$.\label{lem:trace:2}
\item $\forall i \in \{2, \ldots, k\}$, $u_i$ is neither an alive, not
a dead root.\label{lem:trace:3}
\end{enumerate}
\end{lemma}
\begin{proof} Let $i$ and $j$ such that $1 \leq i < j \leq
k$. By definition, $\variable{d}_{u_i} < \variable{d}_{u_j}$ and so $u_i \neq
u_j$. Hence, in a reset branch, each node appears at most once, and
Lemma~\ref{lem:trace}.\ref{lem:trace:1} holds.
Let $i \in \{2, \ldots, k\}$. Lemma~\ref{lem:trace}.\ref{lem:trace:2} immediately
follows from the following three facts, which directly derive from
the definition of reset parent.
\begin{itemize}
\item $\variable{st}_{u_i} \neq C$.
\item $\variable{st}_{u_i} = RB \Rightarrow
\variable{st}_{u_{i-1}} = RB$.
\item $\variable{st}_{u_i} = RF \Rightarrow
\variable{st}_{u_{i-1}} \in \{RB,RF\}$.
\end{itemize}
Lemma~\ref{lem:trace}.\ref{lem:trace:3} immediately follows from those
two facts.
\begin{itemize}
\item {\em $u_i$ is not a dead root}, since $u_{i-1} \in \variable{N}(u_i) \wedge \variable{st}_{u_{i-1}} \neq C \wedge \variable{d}_{u_{i-1}} < \variable{d}_{u_i}$.
\item {\em $u_i$ is not an alive root}, indeed
\begin{itemize}
\item {\em $\neg \mathbf{P\_root}\xspace(u)$ holds}, since $u_{i-1} \in \variable{N}(u_i) \wedge (\variable{st}_{u_i} = RB \Rightarrow
\variable{st}_{u_{i-1}} = RB) \wedge \variable{d}_{u_{i-1}} < \variable{d}_{u_i}$.
\item {\em $\neg \mathbf{P\_Up}\xspace(u_i)$ holds} since $\neg \mathbf{P\_R1}\xspace(u) \And \neg
\mathbf{P\_R2}\xspace(u)$ holds because $\mathbf{P\_reset}\xspace(u)$ holds, and $\mathbf{P\_Correct}\xspace(u)$ holds
because $\variable{st}_u \neq C$.
\end{itemize}
\end{itemize}
\end{proof}
\begin{remark}\label{rem:unless}
In a configuration, a process $u$ may belong to several
branches. Precisely, $u$ belongs to at least one reset branch, unless
$\variable{st}_u = C \wedge \mathbf{P\_ICorrect}\xspace(u)$ holds.
\end{remark}
\begin{lemma}\label{still:alive}
Let $\gamma_x \mapsto \gamma_{x+1}$ be a step of {\tt I} $\circ$ {\tt SDR}\xspace. Let $u_1, \ldots, u_k$ be a reset branch in $\gamma_x$. If $u_1$ is an alive root in $\gamma_{x+1}$, then $u_1, \ldots, u_k$ is a reset branch in $\gamma_{x+1}$.
\end{lemma}
\begin{proof}
We first show the following two claims:
\begin{description}
\item[Claim 1:] {\em If $u_1$ moves in $\gamma_x \mapsto \gamma_{x+1}$, then $u_1$ necessarily executes $\mathbf{rule\_R}\xspace$ in $\gamma_x \mapsto \gamma_{x+1}$.}
{\em Proof of the claim:} Since $u_1$ is an alive root in
$\gamma_{x+1}$, $u_1$ is an alive root in $\gamma_x$, by
Theorem~\ref{theo:pseudoRoots}. Assume now, by the contradiction,
that $u_1$ moves, but does not execute $\mathbf{rule\_R}\xspace$ in $\gamma_x \mapsto
\gamma_{x+1}$. Then, $\neg \mathbf{P\_Up}\xspace(u_k)$ holds in $\gamma_x$, by
Remark~\ref{rem:mutex} and Lemma~\ref{lem:mutex:2}. So, by
definition of alive root, $\variable{st}_u = RB$ in $\gamma_x$ and, from
the code of {\tt SDR}\xspace and Requirement~\ref{RQ3}, $u_1$ executes $\mathbf{rule\_RF}\xspace$
in $\gamma_x \mapsto \gamma_{x+1}$. Consequently, $\variable{st}_u = RF$. Now, $\neg \mathbf{P\_Up}\xspace(u_k)$ still holds in $\gamma_{x+1}$, by
Corollary~\ref{cor:correct}. Hence, $u_1$ is not an alive root in
$\gamma_{x+1}$, a contradiction.
\item[Claim 2:] {\em For every $i \in \{2, \ldots, k\}$, if $u_i$ moves
$\gamma_x \mapsto \gamma_{x+1}$, then $u_i$ executes $\mathbf{rule\_RF}\xspace$ in
$\gamma_x \mapsto \gamma_{x+1}$ and in $\gamma_x$ we have
$\variable{st}_{u_i} = RB$ and $i < k \Rightarrow \variable{st}_{u_{i+1}} = RF$.}
{\em Proof of the claim:} We first show that only $\mathbf{rule\_RF}\xspace$ may be enabled at
$u_i$ in $\gamma_x$.
\begin{itemize}
\item By definition, $\variable{st}_{u_i} \neq C$ and so $\neg
\mathbf{P\_Clean}\xspace(u_i)$ holds in $\gamma_x$. Thus, by Requirement~\ref{RQ3}, all
rules of {\tt I} that are disabled at $u_i$ in $\gamma_x$.
\item $\mathbf{rule\_RB}\xspace(u_i)$ is disabled in $\gamma_x$ since
$\variable{st}_{u_i} \neq C$ (by definition).
\item The fact that $u_i$ is not a dead root in $\gamma_x$
(Lemma~\ref{lem:trace}) implies that $\mathbf{rule\_C}\xspace(u_i)$ is disabled
in $\gamma_x$ (Remark~\ref{rem:dead}).
\item $\mathbf{rule\_R}\xspace(u_i)$ is disabled in $\gamma_x$ since $u_i$ is not an alive root
(Lemma~\ref{lem:trace}).
\end{itemize}
Hence, $u_i$ can only executes $\mathbf{rule\_RF}\xspace$ in $\gamma_x \mapsto
\gamma_{x+1}$. In this case, $\variable{st}_{u_i} = RB$ in $\gamma_x$; see
the guard of $\mathbf{rule\_RF}\xspace(u_i)$. Moreover, if $i < k$, then
$\variable{st}_{u_i} = RB \wedge RParent(u_i,u_{i+1})$ implies that $u_{i+1} \in \variable{N}(u_i)$,
$\variable{st}_{u_{i+1}} \in \{RB,RF\}$, and $\variable{d}_{u_i} <
\variable{d}_{u_{i+1}}$. Now, if $u_{i+1} \in \variable{N}(u_i)$, $\variable{st}_{u_{i+1}} =
RB$, and $\variable{d}_{u_i} < \variable{d}_{u_{i+1}}$, then $\mathbf{rule\_RF}\xspace(u_i)$ is
disabled. Hence, if $u_i$ moves $\gamma_x \mapsto \gamma_{x+1}$ and $i
< k$, then $u_i$ executes $\mathbf{rule\_RF}\xspace$ and so $\variable{st}_{u_{i+1}} = RF$ in
$\gamma_x$.
\end{description}
Then, we proceed by induction on $k$. The base case ($k = 1$) is
trivial. Assume now that $k > 1$. Then, by induction hypothesis, $u_1,
\ldots, u_{k-1}$ is a reset branch in $\gamma_{x+1}$. Hence, to show
that $u_1, \ldots, u_k$ is a reset branch in $\gamma_{x+1}$, it is
sufficient to show that $RParent(u_{k-1},u_k)$ holds in
$\gamma_{x+1}$. Since, $RParent(u_{k-1},u_k)$ holds in
$\gamma_x$, we have $\variable{st}_{u_k} \neq C$ in $\gamma_x$. So, we now study the following two cases:
\begin{itemize}
\item $\variable{st}_{u_k} = RB$ in $\gamma_x$. By Claim 2, $u_k$ may only
execute $\mathbf{rule\_RF}\xspace$ in $\gamma_x \mapsto \gamma_{x+1}$. Consequently,
$\variable{st}_{u_k} \in \{RB,RF\} \wedge \mathbf{P\_reset}\xspace(u_k) \wedge \variable{d}_{u_k}
= d$ holds in $\gamma_{x+1}$, where $d > 0$ is the value of
$\variable{d}_{u_k}$ in $\gamma_x$.
Consider now process $u_{k-1}$. Since $\variable{st}_{u_k} = RB$ in
$\gamma_x$, $\variable{st}_{u_{k-1}} = RB$ too in $\gamma_x$
(Lemma~\ref{lem:trace}).
If $u_{k-1}$ does not move in $\gamma_x \mapsto \gamma_{x+1}$, then
$RParent(u_{k-1},u_k)$ still holds in $\gamma_{x+1}$, and we are
done.
Assume now that $u_{k-1}$ moves in $\gamma_x \mapsto \gamma_{x+1}$.
Then, we necessarily have $k = 2$ since otherwise, Claim 2 applies
for $i = k-1$: $u_{k-1}$ moves in $\gamma_x \mapsto \gamma_{x+1}$
only if $\variable{st}_{u_k} = RF$ in $\gamma_x$. Now, $k = 2$ implies
that $u_{k-1}$ executes $\mathbf{rule\_R}\xspace$ in $\gamma_x \mapsto \gamma_{x+1}$
(by Claim 1), so $\variable{st}_{u_{k-1}} = RB$ and $\variable{d}_{u_{k-1}} = 0 <
d$ in $\gamma_{x+1}$. Consequently, $RParent(u_{k-1},u_k)$ still
holds in $\gamma_{x+1}$, and we are done.
\item $\variable{st}_{u_k} = RF$ in $\gamma_x$.
By Claim 2, $u_k$ does not move in $\gamma_x \mapsto \gamma_{x+1}$.
So, $\variable{st}_{u_k} = RF \wedge \mathbf{P\_reset}\xspace(u_k) \wedge \variable{d}_{u_k} = d$ holds in $\gamma_{x+1}$, where $d > 0$ is the value of $\variable{d}_{u_k}$
in $\gamma_x$.
If $u_{k-1}$ does not move in $\gamma_x \mapsto \gamma_{x+1}$, we
are done. Assume, otherwise, that $u_{k-1}$ moves in $\gamma_x
\mapsto \gamma_{x+1}$.
Then, if $k = 2$, then $u_{k-1}$ executes
$\mathbf{rule\_R}\xspace$ in $\gamma_x \mapsto \gamma_{x+1}$ (by Claim 1), so
$\variable{st}_{u_{k-1}} = RB$ and $\variable{d}_{u_{k-1}} = 0 < d$ in
$\gamma_{x+1}$, and so $RParent(u_{k-1},u_k)$ still holds in
$\gamma_{x+1}$.
Otherwise ($k > 2$),
$u_{k-1}$ necessarily executes $\mathbf{rule\_RF}\xspace$ in $\gamma_x \mapsto
\gamma_{x+1}$ (by Claim 2): $\variable{st}_{u_{k-1}} = RF$ and $\variable{d}_{u_{k-1}} <
\variable{d}_{u_k}$ in $\gamma_{x+1}$ ({\em n.b.}, neither
$\variable{d}_{u_{k-1}}$ nor $\variable{d}_{u_k}$ is modified in $\gamma_x \mapsto
\gamma_{x+1}$). Hence, $RParent(u_{k-1},u_k)$ still holds in
$\gamma_{x+1}$, and we are done.
\end{itemize}
\end{proof}
\begin{lemma}\label{lem:rfSeg}
Let $u$ be any process. During a segment $S =
\gamma_i\cdots\gamma_j$ of execution of {\tt I} $\circ$ {\tt SDR}\xspace, if $u$
executes the rule~$\mathbf{rule\_RF}\xspace$, then $u$ does not execute any other
rule of {\tt SDR}\xspace in the remaining of $S$.
\end{lemma}
\begin{proof}
Let~$\gamma_x \mapsto \gamma_{x+1}$ be a step of $S$ in which $u$
executes~$\mathbf{rule\_RF}\xspace$. Let~$\gamma_y \mapsto \gamma_{y+1}$ (with $y >
x$) be the next step in which $u$ executes its next rule of {\tt SDR}\xspace. (If
$\gamma_x \mapsto \gamma_{x+1}$ or $\gamma_y \mapsto \gamma_{y+1}$
does not exist, then the lemma trivially holds.)
Then, since $\mathbf{rule\_RF}\xspace(u)$ is enabled in $\gamma_x$, $\neg \mathbf{P\_Up}\xspace(u)$
holds in $\gamma_x$, by Lemma~\ref{lem:mutex:2}. Consequently, $\neg
\mathbf{P\_Up}\xspace(u)$ holds forever from $\gamma_x$, by
Corollary~\ref{cor:correct}. Hence, from the code of {\tt SDR}\xspace and
Requirement~\ref{RQ3}, $u$ necessarily executes~$\mathbf{rule\_C}\xspace$ in
$\gamma_y \mapsto \gamma_{y+1}$ since $\variable{st}_u = RF \wedge \neg
\mathbf{P\_Up}\xspace(u)$ holds in $\gamma_y$.
In $\gamma_x$, since $\variable{st}_u = RB$, $u$ belongs to some reset branches (Remark~\ref{rem:unless}) and
all reset branches containing~$u$ have an alive root (maybe
$u$) of status $RB$ (Lemma~\ref{lem:trace}).
Let $v$ be any alive
root belonging to a reset branch containing~$u$ in $\gamma_x$.
In
$\gamma_y$, $u$ is the dead root, since $\mathbf{P\_C}\xspace(u)$ holds (Remark~\ref{rem:dead}).
By Lemma~\ref{lem:trace}, either $u = v$ or $u$ no more belong to a reset branch whose initial extremity is $v$.
By Lemma~\ref{still:alive} and Theorem~\ref{theo:pseudoRoots}, $v$ is no more an alive root in $\gamma_y$.
Still by Theorem~\ref{theo:pseudoRoots}, the number of alive roots
necessarily decreased between $\gamma_x$ and $\gamma_y$: $\gamma_x
\mapsto \gamma_{x+1}$ and $\gamma_y \mapsto \gamma_{y+1}$ belong to
two distinct segments of the execution.
\end{proof}
\begin{theorem}\label{theo:seg}
The sequence of rules of {\tt SDR}\xspace executed by a process $u$ in a
segment of execution of {\tt I} $\circ$ {\tt SDR}\xspace belongs to the following language:
$$(\mathbf{rule\_C}\xspace + \varepsilon)\ (\mathbf{rule\_RB}\xspace + \mathbf{rule\_R}\xspace + \varepsilon)\ (\mathbf{rule\_RF}\xspace + \varepsilon)$$
\end{theorem}
\begin{proof}
From the code of {\tt SDR}\xspace and Requirement~\ref{RQ3}, we know that after
any execution of $\mathbf{rule\_C}\xspace(u)$, the next rule of {\tt SDR}\xspace $u$ will execute
(if any), is either $\mathbf{rule\_RB}\xspace$ or $\mathbf{rule\_R}\xspace$. Similarly, immediately
after an execution of $\mathbf{rule\_RB}\xspace(u)$ (resp., $\mathbf{rule\_R}\xspace(u)$), $\variable{st}_u
= RB \wedge \mathbf{P\_reset}\xspace(u)$ holds (see Requirement~\ref{RQ5}) and
$\mathbf{P\_reset}\xspace(u)$ holds while $u$ does not switch to status $C$
(Requirements~\ref{RQ4} and \ref{RQ3}). So the next rule of {\tt SDR}\xspace $u$
will execute (if any) is $\mathbf{rule\_RF}\xspace$. Finally, immediately after any
execution of $\mathbf{rule\_RF}\xspace(u)$, $\variable{st}_u = RF \wedge \mathbf{P\_reset}\xspace(u)$ holds
until (at least) the next execution of a rule of {\tt SDR}\xspace since
$\mathbf{P\_reset}\xspace(u)$ holds while $u$ does not switch to status $C$
(Requirements~\ref{RQ4} and \ref{RQ3}). Then, the next rule of {\tt SDR}\xspace
$u$ will execute (if any) is $\mathbf{rule\_C}\xspace$. However, if this latter case
happens, $\mathbf{rule\_RF}\xspace(u)$ and $\mathbf{rule\_C}\xspace(u)$ are executed in different
segments, by Lemma~\ref{lem:rfSeg}.
\end{proof}
Since a process can execute rules of {\tt I} only if its status is
$C$, we have the following corollary.
\begin{corollary}\label{cor:seg}
The sequence of rules executed by a process $u$ in a segment of execution of {\tt I} $\circ$ {\tt SDR}\xspace belongs to the following language:
$$(\mathbf{rule\_C}\xspace + \varepsilon)\ \mathbf{words\_I}\xspace\ (\mathbf{rule\_RB}\xspace + \mathbf{rule\_R}\xspace + \varepsilon)\ (\mathbf{rule\_RF}\xspace + \varepsilon)$$
where $\mathbf{words\_I}\xspace$ is any sequence of rules of {\tt I}.
\end{corollary}
From Remark~\ref{rem:nbseg} and Theorem~\ref{theo:seg}, follows.
\begin{corollary}
Any process $u$ executes at most $3n+3$ rules of {\tt SDR}\xspace in any execution of {\tt I} $\circ$ {\tt SDR}\xspace.
\end{corollary}
Let $S = \gamma_0 \cdots \gamma_j \cdots$ be a segment of execution of
{\tt I} $\circ$ {\tt SDR}\xspace.
Let $c_{\tt I}^S$ be the configuration of {\tt I} in which every
process $u$ has the local state $c_{\tt I}^S(u)$ defined below.
\begin{enumerate}
\item $c_{\tt I}^S(u) = \gamma_{0|{\tt I}}(u)$, if $u$ never satisfies $\variable{st}_u =
C$ in $S$,
\item $c_{\tt I}^S(u) = \gamma_{i|{\tt I}}(u)$ where $\gamma_i$ is
the first configuration such that $\variable{st}_u = C$ in $S$, otherwise.
\end{enumerate}
The following lemma is a useful tool to show the convergence of {\tt
I} $\circ$ {\tt SDR}\xspace.
\begin{lemma}\label{lem:transfert}
Let $S = \gamma_0 \cdots \gamma_j \cdots$ be a segment of execution
of {\tt I} $\circ$ {\tt SDR}\xspace. For every process $u$, let $\mathbf{words\_I}\xspace(u)$ be
the (maybe empty) sequence of rules of {\tt I} executed by $u$ in
$S$. There is a prefix of execution of {\tt I} starting in $c_{\tt
I}^S$ that consists of the executions of $\mathbf{words\_I}\xspace(u)$, for every
process $u$.
\end{lemma}
\begin{proof}
For every process $u$, for every $i \geq 0$, let
$\mathbf{prewords\_I}\xspace(\gamma_i,u)$ be the prefix of $\mathbf{words\_I}\xspace(u)$ executed by
process $u$ in the prefix $\gamma_0 \cdots \gamma_i$ of $S$. For
every $i \geq 0$, let $\mathbf{cw\_I}\xspace(\gamma_i)$ be the configuration of
{\tt I} in which every process $u$ has the local state
$\mathbf{cw\_I}\xspace(\gamma_i)(u)$ defined below.
\begin{itemize}
\item $\mathbf{cw\_I}\xspace(\gamma_i)(u)= c_{\tt I}^S(u)$, if $\mathbf{prewords\_I}\xspace(\gamma_i,u)
= \emptyset$,
\item $\mathbf{cw\_I}\xspace(\gamma_i)(u) = s$ where $s$ is the state assigned to $u$
by the execution of its last rule of $\mathbf{prewords\_I}\xspace(\gamma_i,u)$ in the
prefix $\gamma_0 \cdots \gamma_i$ of $S$, otherwise.
\end{itemize}
The lemma is immediate from the following induction: for every $i\geq
0$, there is a possible prefix of execution of {\tt I} that starts
from $c_{\tt I}^S$, ends in $\mathbf{cw\_I}\xspace(\gamma_i)$, and consists of the
executions of $\mathbf{prewords\_I}\xspace(\gamma_i,u)$, for every process $u$.
The base case ($i = 0$) is trivial.
Assume the induction holds for
some $i\geq 0$ and consider the case $i+1$.
For every process $u$, either $u$ does not execute any rule of {\tt I}
in $\gamma_{i} \mapsto \gamma_{i+1}$ and $\mathbf{prewords\_I}\xspace(\gamma_{i+1},u) =
\mathbf{prewords\_I}\xspace(\gamma_{i},u)$, or $u$ executes some rule $R_u$ of {\tt I}
in $\gamma_{i} \mapsto \gamma_{i+1}$ and $\mathbf{prewords\_I}\xspace(\gamma_{i+1},u) =
\mathbf{prewords\_I}\xspace(\gamma_{i},u)\cdot R_u$.
If all processes satisfy the
former case, then, by induction hypothesis, we are done.
Otherwise, by induction hypothesis, it is sufficient to show the
transition from $\mathbf{cw\_I}\xspace(\gamma_i)(u)$ to $\mathbf{cw\_I}\xspace(\gamma_{i+1})(u)$
consisting of the execution of $R_u$ by every process $u$ such that
$\mathbf{prewords\_I}\xspace(\gamma_{i+1},u) = \mathbf{prewords\_I}\xspace(\gamma_{i},u)\cdot R_u$ is a
possible step of {\tt I}.
To see this,
consider any process $u$ such that $\mathbf{prewords\_I}\xspace(\gamma_{i+1},u) =
\mathbf{prewords\_I}\xspace(\gamma_{i},u)\cdot R_u$. Since $u$ executes $R_u$ in
$\gamma_{i} \mapsto \gamma_{i+1}$, $\mathbf{P\_Clean}\xspace(u)$ holds in $\gamma_{i}$
meaning that every member $v$ of $N[u]$ (in particular, $u$) satisfies
$\variable{st}_v = C$ in $\gamma_i$. Then, by Corollary \ref{cor:seg}, every $v$
(in particular, $u$) is in the state $\mathbf{cw\_I}\xspace(\gamma_i)(u)$. Hence, as
$R_u$ is enabled in $\gamma_i$, $R_u$ is enabled in $\mathbf{cw\_I}\xspace(\gamma_i)$
too, and we are done.
\end{proof}
\subsubsection{Round Complexity.}
Below, we use the notion of attractor, defined at the beginning of the section.
\begin{definition}[Attractors]$~$
\begin{itemize}
\item Let $\mathcal{P}_1$ a predicate over configurations of {\tt I}
$\circ$ {\tt SDR}\xspace which is true if and only if $\neg\mathbf{P\_Up}\xspace(u)$ holds, for
every process $u$.
\item Let $\mathcal{P}_2$ a predicate over configurations of {\tt I}
$\circ$ {\tt SDR}\xspace which is true if and only if (1) $\mathcal{P}_1$ holds
and (2) $\neg\mathbf{P\_RB}\xspace(u)$ holds, for every process $u$.
\item Let $\mathcal{P}_3$ a predicate over configurations of {\tt I}
$\circ$ {\tt SDR}\xspace which is true if and only if (1) $\mathcal{P}_2$ holds
and (2) $\variable{st}_u \neq RB$, for every process $u$.
\item $\mathcal{P}_4$ a predicate over configurations of {\tt I}
$\circ$ {\tt SDR}\xspace which is true if and only if (1) $\mathcal{P}_3$ holds
and (2) $\variable{st}_u \neq RF$, for every process $u$.
In the following, we call {\em normal configuration} any
configuration satisfying $\mathcal{P}_4$.
\end{itemize}
\end{definition}
\begin{lemma}
\label{lem:att1} $\mathcal{P}_1$ is an attractor for {\tt I} $\circ$
{\tt SDR}\xspace. Moreover, {\tt I} $\circ$ {\tt SDR}\xspace converges from $true$ to
$\mathcal{P}_1$ within at most one round.
\end{lemma}
\begin{proof}
First, for every process $u$, $\neg\mathbf{P\_Up}\xspace(u)$ is closed by {\tt I}
$\circ$ {\tt SDR}\xspace (Corollary \ref{cor:correct}). Consequently,
$\mathcal{P}_1$ is closed by {\tt I} $\circ$ {\tt SDR}\xspace. Moreover, to show
that {\tt I} $\circ$ {\tt SDR}\xspace converges from $true$ to $\mathcal{P}_1$ within at most
one round, it is sufficient to show that any process $p$ satisfies
$\neg\mathbf{P\_Up}\xspace(u)$ during the first round of any execution of {\tt I}
$\circ$ {\tt SDR}\xspace. This property is immediate from the following two claims.
\begin{description}
\item[Claim 1:] {\em If $\mathbf{P\_Up}\xspace(u)$, then $u$ is enabled.}
{\em Proof of the claim:} By definition of $\mathbf{rule\_R}\xspace(u)$.
\item[Claim 2:] {\em If $\mathbf{P\_Up}\xspace(u)$ holds in $\gamma$ and $u$ moves in the next step $\gamma \mapsto \gamma'$, then $\neg\mathbf{P\_Up}\xspace(u)$ holds in $\gamma'$.}
{\em Proof of the claim:} First, by Remark~\ref{rem:mutex},
Lemma~\ref{lem:mutex:2}, and the guard of $\mathbf{rule\_R}\xspace(u)$, $\mathbf{rule\_R}\xspace(u)$
is executed in $\gamma \mapsto \gamma'$. Then, immediately after
$\mathbf{rule\_R}\xspace(u)$, $\variable{st}_u = RB$ and $\mathbf{P\_reset}\xspace(u)$ holds (see
Requirement~\ref{RQ5}), now $\variable{st}_u = RB$ and $\mathbf{P\_reset}\xspace(u)$
implies $\neg\mathbf{P\_Up}\xspace(u)$.
\end{description}
\end{proof}
\begin{lemma}
\label{lem:att2-Closure}
$\mathcal{P}_2$ is closed by {\tt I} $\circ$ {\tt SDR}\xspace.
\end{lemma}
\begin{proof} By Requirement~\ref{RQ1}, $\neg\mathbf{P\_RB}\xspace(u)$ is closed by {\tt
I}, for every process $u$. So, by Lemma~\ref{lem:att1} and
Remark~\ref{rem:mutex}, it is sufficient to show that for every step
$\gamma \mapsto \gamma'$ of {\tt I} $\circ$ {\tt SDR}\xspace such that $\mathcal{P}_2$ holds in $\gamma$, for every process $u$, if $u$ executes a rule of {\tt SDR}\xspace in $\gamma \mapsto \gamma'$, then $\neg\mathbf{P\_RB}\xspace(u)$ still holds in $\gamma'$.
So, assume any such step $\gamma \mapsto \gamma'$ and any process $u$.
\begin{itemize}
\item If $\variable{st}_u = C$ in $\gamma$, then $\forall v \in \variable{N}(u)$, $\variable{st}_v \neq RB$ in $\gamma$, since $\gamma$ satisfies $\mathcal{P}_2$. Now, no rule $\mathbf{rule\_RB}\xspace$ or $\mathbf{rule\_R}\xspace$ can be executed in $\gamma \mapsto \gamma'$ since $\gamma$ satisfies $\mathcal{P}_2$. So, $\forall v \in \variable{N}(u)$, $\variable{st}_v \neq RB$ in $\gamma'$, and consequently $\neg\mathbf{P\_RB}\xspace(u)$ still holds in $\gamma'$.
\item If $\variable{st}_u \neq C$ in $\gamma'$, then $\neg\mathbf{P\_RB}\xspace(u)$ holds in $\gamma'$.
\item Assume now that $\variable{st}_u \neq C$ in $\gamma$ and $\variable{st}_u = C$ in $\gamma'$. Then, $u$ necessarily executes $\mathbf{rule\_C}\xspace$ in $\gamma \mapsto \gamma'$. In this case, $\forall v \in \variable{N}(u)$, $\variable{st}_v \neq RB$ in $\gamma$. Now, no rule $\mathbf{rule\_RB}\xspace$ or $\mathbf{rule\_R}\xspace$ can be executed in $\gamma \mapsto \gamma'$ since $\gamma$ satisfies $\mathcal{P}_2$. So, $\forall v \in \variable{N}(u)$, $\variable{st}_v \neq RB$ in $\gamma'$, and consequently $\neg\mathbf{P\_RB}\xspace(u)$ still holds in $\gamma'$.
\end{itemize}
Hence, in all cases, $\neg\mathbf{P\_RB}\xspace(u)$ still holds in $\gamma'$, and we are done.
\end{proof}
\begin{lemma}
\label{lem:att2} {\tt I} $\circ$ {\tt SDR}\xspace converges from $\mathcal{P}_1$
to $\mathcal{P}_2$ within at most $n-1$ rounds.
\end{lemma}
\begin{proof}
Let $u$ be any process of status $RB$. Then, $u$ belongs to at least
one reset branch (Remark~\ref{rem:unless}).
Let $md(u)$ be the maximum depth of $u$ in a reset branch it belongs
to. Then,
$md(u) < n$, by Lemma~\ref{lem:trace}.
Consider now any execution $e = \gamma_0 \cdots \gamma_i \cdots$ of {\tt I} $\circ$ {\tt SDR}\xspace such that $\gamma_0$ satisfies
$\mathcal{P}_1$. Remark first that from $\gamma_0$,
$\mathbf{rule\_R}\xspace(v)$ is disabled forever, for every process $v$, since
$\mathcal{P}_1$ is closed by {\tt I} $\circ$ {\tt SDR}\xspace
(Lemma~\ref{lem:att1}).
\begin{description}
\item[Claim 1:] {\em If some process $u$ satisfies $\variable{st}_{u} = RB$ in
some configuration $\gamma_i$ ($i \geq 0$), then from $\gamma_i$,
while $\variable{st}_{u} = RB$, $md(u)$ cannot decrease.}
{\em Proof of the claim:} Consider any $\gamma_i \mapsto
\gamma_{i+1}$ where $\variable{st}_{u} = RB$ both in $\gamma_i$ and
$\gamma_{i+1}$. This in particular means that $u$ does not move in
$\gamma_i \mapsto \gamma_{i+1}$. Let $u_1, \ldots, u_k=u$ be a
reset branch in $\gamma_i$ such that $k = md(u)$. $\forall x \in
\{1,\ldots,k-1\}$, $u_x$ has a neighbor ($u_{x+1}$) such that
$\variable{st}_{x+1} = RB \wedge \variable{d}_{x+1} > \variable{d}_u$ in $\gamma_i$, by
Lemma~\ref{lem:trace} and the definition of a reset branch. Hence,
every $u_x$ is disabled in $\gamma_i$. Consequently, $u$ is still at
depth at least $k$ in a reset branch defined in $\gamma_{i+1}$, and
we are done.
\item[Claim 2:] {\em For every process $u$ that executes $\mathbf{rule\_RB}\xspace(u)$ in
some step $\gamma_i \mapsto \gamma_{i+1}$ of the $j$th round of $e$, we have $\variable{st}_{u} = RB \wedge
md(u) \geq j$ in $\gamma_{i+1}$.}
{\em Proof of the claim:} We proceed by induction. Assume a process $u$ executes
$\mathbf{rule\_RB}\xspace(u)$ in some step $\gamma_i \mapsto \gamma_{i+1}$ of the
first round of $e$. In $\gamma_i$, there is some neighbor
$v$ of $u$ such that $\variable{st}_v = RB$. Since $\variable{st}_u = C$ in
$\gamma_i$, $v$ is disabled in $\gamma_i$. Consequently,
$RParent(v,u)$ holds in $\gamma_{i+1}$, and so $\variable{st}_{u} = RB
\wedge md(u) \geq 1$ holds in $\gamma_{i+1}$.
Hence, the claim holds for $j = 1$.
Assume now that the claim holds in all of the $j$ first rounds of $e$, with $j \geq 1$.
Assume, by the contradiction, that some process $u$ executes
$\mathbf{rule\_RB}\xspace$ in a step $\gamma_i \mapsto \gamma_{i+1}$ of the
$(j+1)^{th}$ round of $e$, and does not satisfy $\variable{st}_{u} = RB
\wedge md(u) \geq j+1$ in $\gamma_{i+1}$. Then, by definition of
$\mathbf{rule\_RB}\xspace(u)$, $\variable{st}_{u} = C$ in $\gamma_i$ and $\variable{st}_{u} = RB
\wedge md(u) < j+1$ in $\gamma_{i+1}$. Let $x$ be the value of
$md(u)$ in $\gamma_{i+1}$. We have $x < j+1$. Without the loss of
generality, assume that no process satisfies this condition before
$u$ in the $(j+1)^{th}$ round of $e$ and any process $v$ that
fulfills this condition in the same step as $u$ satisfies
$\variable{st}_{v} = RB \wedge x \leq md(v) < j+1$ in $\gamma_{i+1}$.
Then, by definition $md(u)$ and Lemma~\ref{lem:trace}, there is a
neighbor $v$ of $u$ such $\variable{st}_v = RB$ and $md(v) = x-1 < j$ in
$\gamma_{i+1}$. Moreover, by definition of $u$ and Claim 1,
$\variable{st}_v = RB$ and $md(v) \leq x-1 < j$ since (at least) the first
configuration of the $(j+1)$th round of $e$, which is also the last
configuration of the $j$th round of $e$. So, by induction
hypothesis, $\variable{st}_v = RB$ and $md(v) \leq x-1 < j$ since (at
least) the end of the $(x-1)$th round of $e$.
If $\variable{st}_u \neq C$ in the last configuration of the $(x-1)$th
round of $e$, then $\variable{st}_u \neq C$ continuously until $\gamma_i$
(included) since meanwhile $\mathbf{rule\_C}\xspace(u)$ is disabled because
$\variable{st}_v = RB$. Hence, $u$ cannot execute $\mathbf{rule\_RB}\xspace(u)$ in
$\gamma_i \mapsto \gamma_{i+1}$, a contradiction. Assume otherwise
that $\variable{st}_u = C$ in the last configuration of the $(x-1)$th
round of $e$. Then, $u$ necessarily executes $\mathbf{rule\_RB}\xspace$ during the
$x$th round of $e$, but not in the $(j+1)^{th}$ round of $e$ since
$\variable{st}_v = RB$ continuously until $\gamma_i$ (included), indeed,
after the execution of $\mathbf{rule\_RB}\xspace(u)$ in the $x$th round, the two next
rules executed by $u$ (if any) are necessarily $\mathbf{rule\_RF}\xspace$ followed by
$\mathbf{rule\_C}\xspace$, but $\mathbf{rule\_C}\xspace(u)$ is disabled while $\variable{st}_v = RB$. Hence,
$\mathbf{rule\_RB}\xspace(u)$ is not executed in $\gamma_i \mapsto \gamma_{i+1}$, a
contradiction.
\end{description}
By Claim 2, no process executes $\mathbf{rule\_RB}\xspace$ during the $n$th round of
$e$. Now, along $e$, we have:
\begin{itemize}
\item If $\mathbf{P\_RB}\xspace(u)$ holds, then $u$ is enabled (see $\mathbf{rule\_RB}\xspace(u)$), and
\item If $\mathbf{P\_RB}\xspace(u)$ holds in $\gamma_i$ (with $i \geq 0$) and $u$ moves
in the next step $\gamma_i \mapsto \gamma_{i+1}$, then $\neg\mathbf{P\_RB}\xspace(u)$
holds in $\gamma_{i+1}$.
Indeed, $u$ necessarily executes $\mathbf{rule\_RB}\xspace(u)$ in $\gamma_i \mapsto
\gamma_{i+1}$ (Remark~\ref{rem:mutex} and Lemma ~\ref{lem:mutex:2})
and, consequently, $\variable{st}_u = RB$ in $\gamma_{i+1}$, which implies
that $\neg\mathbf{P\_RB}\xspace(u)$ holds in $\gamma_{i+1}$.
\end{itemize}
Hence, we can conclude that the last configuration of the $(n-1)$th
round of $e$ satisfies $\mathcal{P}_2$, and we are done.
\end{proof}
\begin{lemma}
\label{lem:att3}
$\mathcal{P}_3$ is closed by {\tt I} $\circ$ {\tt SDR}\xspace.
Moreover, {\tt I} $\circ$ {\tt SDR}\xspace converges from $\mathcal{P}_2$
to $\mathcal{P}_3$ within at most $n$ rounds.
\end{lemma}
\begin{proof}
By Requirement \ref{RQ1}, no rule of {\tt I} can set the status of a
process to $RB$. Then, let $\gamma$ be a configuration of {\tt I}
$\circ$ {\tt SDR}\xspace such that $\mathcal{P}_3(\gamma)$ holds. Since
$\mathcal{P}_1(\gamma)$ and $\mathcal{P}_2(\gamma)$ also holds, no
rule $\mathbf{rule\_R}\xspace$ or $\mathbf{rule\_RB}\xspace$ is enabled in $\gamma$. Hence, after any
step from $\gamma$, there is still no process of status $RB$ and we
can conclude that $\mathcal{P}_3$ is closed by {\tt I} $\circ$ {\tt SDR}\xspace
since we already know that $\mathcal{P}_2$ is closed by {\tt I}
$\circ$ {\tt SDR}\xspace (Lemma~\ref{lem:att2-Closure}).
Let $\gamma$ be any configuration satisfying $\mathcal{P}_2$ but not
$\mathcal{P}_3$. To show the convergence from from $\mathcal{P}_2$
to $\mathcal{P}_3$ within at most $n$ rounds, it is sufficient to
show that at least one process $u$ switches from $\variable{st}_u = RB$ to
$\variable{st}_u \neq RB$ within the next round from $\gamma$, since we
already know that once $\variable{st}_u \neq RB$ after $\gamma$,
$\variable{st}_u \neq RB$ holds forever (recall that all configurations
reached from $\gamma$ satisfies $\mathcal{P}_2$;
see Lemma~\ref{lem:att2-Closure}).
Let $mu$ be a process of status $RB$ with a maximum distance value
in $\gamma$. Since $\neg\mathbf{P\_Up}\xspace(mu) \wedge \neg\mathbf{P\_RB}\xspace(mu) \wedge
\variable{st}_{mu} \neq C$ holds, $\mathbf{P\_reset}\xspace(mu)$ holds in $\gamma$. Let
$v$ be any neighbor of $mu$. Since $\neg\mathbf{P\_RB}\xspace(v) \wedge\variable{st}_{mu} =
RB$ holds, $\variable{st}_v \neq C$ in $\gamma$. Again, since
$\neg\mathbf{P\_Up}\xspace(v) \wedge \neg\mathbf{P\_RB}\xspace(v) \wedge \variable{st}_v \neq C$ holds,
$\mathbf{P\_reset}\xspace(v)$ holds in $\gamma$. According to the definition of
$mu$, we have $(\variable{st}_v = RB \wedge \variable{d}_v \leq \variable{d}_{mu}) \vee
\variable{st}_v = RF$. We can conclude that along any execution from
$\gamma$, $\mathbf{rule\_RF}\xspace(mu)$ is enabled until $mu$ executes this rule.
In this case, $\mathbf{rule\_RF}\xspace(mu)$ will be executed in the next move of
$mu$ by Remark~\ref{rem:mutex} and Lemma~\ref{lem:mutex:2}. So, during
the next round from $\gamma$, $\mathbf{rule\_RF}\xspace(mu)$ is executed, {\em i.e.},
$\variable{st}_{mu}$ is set to $RF$, and we are done.
\end{proof}
Let $\gamma$ by any configuration of {\tt I} $\circ$ {\tt SDR}\xspace. We denote by $\gamma_{|{\tt SDR}\xspace}$ the projection of $\gamma$ over variables of {\tt SDR}\xspace. By definition, $\gamma_{|{\tt SDR}\xspace}$ is a configuration of {\tt SDR}\xspace.
\begin{lemma}\label{lem:a4:term}
For every configuration $\gamma$ of
{\tt I} $\circ$ {\tt SDR}\xspace, $\gamma \in \mathcal{P}_4$ ({\em i.e.}, $\gamma$ is a normal configuration) if and only if $\gamma_{|{\tt SDR}\xspace}$ is a terminal configuration of {\tt SDR}\xspace.
\end{lemma}
\begin{proof}
Let $\gamma$ be a configuration of {\tt I} $\circ$ {\tt SDR}\xspace. By
definition of $\mathcal{P}_4$, if $\gamma \in \mathcal{P}_4$, then
$\gamma_{|{\tt SDR}\xspace}$ is a terminal configuration of {\tt SDR}\xspace. Then, if
$\gamma_{|{\tt SDR}\xspace}$ is a terminal configuration of {\tt SDR}\xspace, then $\gamma \in
\mathcal{P}_4$ by Lemmas~\ref{lem:nonPRabc}, \ref{lem:nonRB}, and
\ref{lem:nonRF}.
\end{proof}
\begin{lemma}
\label{lem:att4}
$\mathcal{P}_4$ is closed by {\tt I} $\circ$ {\tt SDR}\xspace.
Moreover, {\tt I} $\circ$ {\tt SDR}\xspace converges from $\mathcal{P}_3$
to $\mathcal{P}_4$ within at most $n$ rounds.
\end{lemma}
\begin{proof}
By Requirement \ref{RQ1}, no rule of {\tt I} can set the status of a
process to $RF$. So, by Lemma~\ref{lem:a4:term}, we can conclude
that $\mathcal{P}_4$ is closed by {\tt I} $\circ$ {\tt SDR}\xspace.
Let $\gamma$ be any configuration satisfying $\mathcal{P}_3$ but not
$\mathcal{P}_4$. To show the convergence from from $\mathcal{P}_3$
to $\mathcal{P}_4$ within at most $n$ rounds, it is sufficient to
show that at least one process $u$ switches from $\variable{st}_u = RF$ to
$\variable{st}_u \neq RF$ within the next round from $\gamma$, since we
already know that once $\variable{st}_u \neq RF$ after $\gamma$,
$\variable{st}_u \neq RF$ holds forever (recall that all configurations
reached from $\gamma$ satisfies $\mathcal{P}_3$ by Lemma~\ref{lem:att3}, and only process of status $RB$ may switch to status $RF$).
Let $mu$ be a process of status $RF$ with a minimum distance value
in $\gamma$. Since $\neg\mathbf{P\_Up}\xspace(mu) \wedge \neg\mathbf{P\_RB}\xspace(mu) \wedge
\variable{st}_{mu} \neq C$ holds, $\mathbf{P\_reset}\xspace(mu)$ holds in $\gamma$. Let
$v$ be any neighbor of $mu$. By definition of $\mathcal{P}_3$,
$\variable{st}_v \neq RB$ in $\gamma$. Moreover, since $\neg\mathbf{P\_Up}\xspace(v)
\wedge \neg\mathbf{P\_RB}\xspace(v)$ and $v$ has a neighbor of status $RF$ ($mu$),
$\mathbf{P\_reset}\xspace(v)$ holds in $\gamma$. According to the definition of
$mu$, we have $(\variable{st}_v = RF \wedge \variable{d}_v \geq \variable{d}_{mu}) \vee
\variable{st}_v = C$. We can conclude that along any execution from
$\gamma$, $\mathbf{rule\_C}\xspace(mu)$ is enabled until $mu$ executes this rule. In
this case, $\mathbf{rule\_C}\xspace(mu)$ will be executed in the next move of $mu$ by
Remark~\ref{rem:mutex} and Lemma~\ref{lem:mutex:2}. So, during the
next round from $\gamma$, $\mathbf{rule\_C}\xspace(mu)$ is executed, {\em i.e.},
$\variable{st}_{mu}$ is set to $C$, and we are done.
\end{proof}
By Lemmas~\ref{lem:att1}-\ref{lem:att4} and Theorem~\ref{theo:termA}, follows.
\begin{corollary}
\label{cor:round}
$\mathcal{A}_4$ is an attractor for {\tt I} $\circ$
{\tt SDR}\xspace. Moreover, {\tt I} $\circ$ {\tt SDR}\xspace converges from $true$ to
$\mathcal{P}_4$ within at most $3n$ rounds.
For every configuration $\gamma$ of {\tt I} $\circ$ {\tt SDR}\xspace, $\gamma$ satisfies $\mathcal{A}_4$ ({\em i.e.} $\gamma$ is a normal configuration) if and only if $\mathbf{P\_Clean}\xspace(u)
\And \mathbf{P\_ICorrect}\xspace(u)$ holds in $\gamma$, for every process $u$.
\end{corollary}
\section{Asynchronous Unison}\label{sect:unison}
\subsection{The Problem}
We now consider the problem of {\em asynchronous unison} (introduced
in ~\cite{CFG92c}), simply referred to as unison in the
following. This problem is a clock synchronization problem: each
process $u$ holds a variable (usually an integer variable) called
\emph{clock}, here noted $\variable{c}_u$. Then, the problem is specified as
follows:
\begin{itemize}
\item Each process should increment its clock infinitely often.
(liveness)
\item The difference between clocks of every two neighbors should be
at most one increment at each instant. (safety)
\end{itemize}
Notice that we consider here periodic clocks, {\em i.e.}, the clock
incrementation is modulo a so-called \emph{period}, here noted
$\variable{K}$.
\subsection{Related Work}
The first self-stabilizing asynchronous unison for general connected
graphs has been proposed by Couvreur {\em et al.}~\cite{CFG92c}. It is
written in the locally shared memory model with composite atomicity
assuming a central unfair daemon and a period $\variable{K} > n^2$. No
complexity analysis was given.
Another solution which stabilizes in $O(n)$ rounds has been proposed
by Boulinier {\em et al.} in \cite{BPV04c}. This solution is also
written in the locally shared memory model with composite atomicity,
however it assumes a distributed unfair daemon. In this solution, the
period $\variable{K}$ should satisfy $\variable{K} > C_G$ and another parameter
$\alpha$ should satisfy $\alpha\ge T_G-2$. $C_G$ is the {\em
cyclomatic characteristic\/} of the network and $T_G$ is the length
of the longest chordless cycle. Boulinier also proposed in his PhD
thesis~\cite{B07t} a parametric solution which generalizes both the
solutions of \cite{CFG92c} and \cite{BPV04c}. In particular, the study
of this parametric algorithm reveals that the solution of Couvreur
{\em et al.}~\cite{CFG92c} still works assuming a distributed unfair
daemon and has a stabilization time in $O(D.n)$ rounds, where $D$ is
the network diameter.
\subsection{Contribution}
We first propose a distributed algorithm, called {\tt U}\xspace. Starting from a
pre-defined configuration, {\tt U}\xspace implements the unison problem in
anonymous networks, providing that the period $\variable{K}$ satisfies $\variable{K}
> n$. {\tt U}\xspace is not self-stabilizing, however we show that the composite
algorithm {\tt U}\xspace $\circ$ {\tt SDR}\xspace is actually an efficient self-stabilizing
unison algorithm. Indeed, its stabilization times in round matches
the one of the best existing solution~\cite{BPV04c}. Moreover, it
achieves a better stabilization time in moves, since it stabilizes in
$O(D.n^2)$ moves, while the algorithm in~\cite{BPV04c} stabilizes in
$O(D.n^3+\alpha.n^2)$ moves; as shown in~\cite{DP12}.
\subsection{Algorithm {\tt U}\xspace}
\paragraph{Overview.}
We consider here anonymous (bidirectional) networks of arbitrary connected
topology. Moreover, every process has the period $\variable{K}$ as
input. $\variable{K}$ is required to be (strictly) greater than $n$, the
number of processes.
The formal code of Algorithm {\tt U}\xspace is given in Algorithm~\ref{alg:DU}.
Informally, each process maintains a single variable, its clock
$\variable{c}_u$, using a single rule $\mathbf{rule\_U}\xspace(u)$.
\input{codeUnison}
In the following, we assume that the system is initially in the
configuration $\gamma_{init}$ where every process $u$ satisfies
$\variable{c}_u = 0 \wedge \variable{st}_u = C$. Basically, starting from $\gamma_{init}$, a process $u$
can increment its clock $\variable{c}_u$ modulo $\variable{K}$ (using rule
$\mathbf{rule\_U}\xspace(u)$) if it is on time or one increment late with each of its
neighbors; see predicate $\mathbf{P\_Up}\xspace(u)$.
\paragraph{Correctness.}
Below, we focus on configurations of {\tt U}\xspace satisfying $\mathbf{P\_ICorrect}\xspace(u)
\wedge \mathbf{P\_Clean}\xspace(u)$, for every process $u$. Indeed, $\gamma_{init}$ belongs
to this class of configurations. Moreover, a configuration of {\tt U}\xspace $\circ$ {\tt SDR}\xspace
is normal if and only if $\mathbf{P\_Clean}\xspace(u) \And \mathbf{P\_ICorrect}\xspace(u)$ holds for
every process $u$. Hence, the properties we exhibit now will be, in
particular, satisfied at the completion of {\tt SDR}\xspace.
Consider any two neighboring processes $u$ and $v$ such that
$\mathbf{P\_Ok}\xspace(u,v)$ in some configuration $\gamma$, {\em i.e.}, $\variable{c}_v \in
\{(\variable{c}_u -1) \bmod \variable{K}, \variable{c}_u, (\variable{c}_u +1) \bmod \variable{K}\}$. Without
the loss of generality, assume that $\variable{c}_v \in \{\variable{c}_u, (\variable{c}_u +1)
\bmod \variable{K}\}$ (otherwise switch the role of $u$ and $v$). Let $\gamma
\mapsto \gamma'$ be the next step. If $\variable{c}_v = \variable{c}_u$ in $\gamma$,
then $\variable{c}_v \in \{(\variable{c}_u -1) \bmod \variable{K}, \variable{c}_u, (\variable{c}_u +1) \bmod
\variable{K}\}$ in $\gamma'$ since each clock increments at most once per
step, {\em i.e.}, $\mathbf{P\_Ok}\xspace(u,v)$ still holds in $\gamma'$. Otherwise,
$\variable{c}_v = (\variable{c}_u +1) \bmod \variable{K}\}$ in $\gamma$, and so $v$ is
disabled and only $u$ may move. If $u$ does not move, then $\variable{c}_v =
(\variable{c}_u +1) \bmod \variable{K}\}$ still holds in $\gamma'$, otherwise $\variable{c}_v
= \variable{c}_u$ in $\gamma'$. Hence, in both cases, $\mathbf{P\_Ok}\xspace(u,v)$ still
holds in $\gamma'$. Hence, follows.
\begin{lemma}\label{unison:agree}
$\mathbf{P\_ICorrect}\xspace(u)$ is closed by {\tt U}\xspace, for every process $u$.
\end{lemma}
Since Algorithm {\tt U}\xspace does not modify any variable from Algorithm {\tt SDR}\xspace, we have
\begin{remark}\label{lem:PClean:clos2}
$\mathbf{P\_Clean}\xspace(u)$ is closed by {\tt U}\xspace, for every process $u$.
\end{remark}
\begin{corollary}\label{unison:safety}
$\mathbf{P\_ICorrect}\xspace(u) \wedge \mathbf{P\_Clean}\xspace(u)$ is closed by {\tt U}\xspace, for every process $u$.
\end{corollary}
\begin{corollary}\label{u:safe}
Any execution of {\tt U}\xspace, that starts from a configuration where
$\mathbf{P\_ICorrect}\xspace(u) \wedge \mathbf{P\_Clean}\xspace(u)$ holds for every process $u$,
satisfies the safety of the unison problem.
\end{corollary}
\begin{lemma}\label{unison:noDL}
Any configuration where
$\mathbf{P\_ICorrect}\xspace(u) \wedge \mathbf{P\_Clean}\xspace(u)$ holds for every process $u$ is not terminal.
\end{lemma}
\begin{proof}
Assume, by the contradiction, a terminal configuration $\gamma$ where
$\mathbf{P\_ICorrect}\xspace(u) \wedge \mathbf{P\_Clean}\xspace(u)$ for every process $u$. Then, every process $u$ has at least one neighbor $v$ such that $\variable{c}_v = (\variable{c}_u -1) \bmod \variable{K}$. Since the number of processes is finite, in $\gamma$ there exist elementary cycles $u_1, \ldots, u_x$ such that
\begin{enumerate}
\item for every $i \in \{1, \ldots, x-1\}$, $u_i$ and $u_{i+1}$ are neighbors, and $\variable{c}_{u_i} =
(\variable{c}_{u_{i+1}} -1) \bmod \variable{K}$; and \label{cycle:case1}
\item $u_1$ and $u_x$ are neighbors and $\variable{c}_{u_x} =
(\variable{c}_{u_1} -1) \bmod \variable{K}$. \label{cycle:case2}
\end{enumerate}
By transitivity, Case \ref{cycle:case1} implies that $\variable{c}_{u_1} =
(\variable{c}_{u_x} -(x-1)) \bmod \variable{K}$. So, from Case 2, we obtain $\variable{c}_{u_x} =
(\variable{c}_{u_x} -x) \bmod \variable{K}$. Now, by definition $x \leq n$ and $\variable{K} > n$ so $\variable{c}_{u_x} \neq
(\variable{c}_{u_x} -x) \bmod \variable{K}$, a contradiction. Hence, $\gamma$ is not terminal.
\end{proof}
\begin{lemma}\label{u:fair}
Any execution of {\tt U}\xspace, that starts from a configuration where
$\mathbf{P\_ICorrect}\xspace(u) \wedge \mathbf{P\_Clean}\xspace(u)$ holds for every process $u$,
satisfies the liveness of the unison problem.
\end{lemma}
\begin{proof}
Let $e$ be
any execution of {\tt U}\xspace that starts from a configuration where
$\mathbf{P\_ICorrect}\xspace(u) \wedge \mathbf{P\_Clean}\xspace(u)$ holds for every process $u$. Assume, by the contradiction, that $e$ does not satisfy the liveness of unison. Then, $e$ contains a configuration $\gamma$ from which some processes (at least one) never more executes $\mathbf{rule\_U}\xspace$. Let $F$ be the non-empty subset of processes that no more move from $\gamma$. Let $I = V \setminus F$. By Lemma~\ref{unison:noDL}, $I$ is not empty too. Now, since the network is connected, there are two processes $u$ and $v$ such that $u \in I$ and $v \in F$. Now, after at most 3 increments of $u$ from $\gamma$, $\mathbf{P\_Ok}\xspace(u,v)$ no more holds, contradicting Lemma~\ref{unison:agree}.
\end{proof}
Consider now any execution $e$ of {\tt U}\xspace starting from
$\gamma_{init}$. In $\gamma_{init}$, we have $\mathbf{P\_Clean}\xspace(u) \wedge
\mathbf{P\_ICorrect}\xspace(u)$ for every process $u$. Hence, by Corollary~\ref{u:safe} and Lemma~\ref{u:fair}, follows.
\begin{theorem}\label{theo:u:correct}
{\tt U}\xspace is distributed (non self-stabilizing) unison.
\end{theorem}
\paragraph{Properties of {\tt U}\xspace.}
Consider any execution $e$ of {\tt U}\xspace starting from a configuration
$\gamma$ which does not satisfy $\mathbf{P\_Clean}\xspace(u) \wedge \mathbf{P\_ICorrect}\xspace(u)$ for
every process $u$. Then, there exists at least one process $u$
satisfying $\neg \mathbf{P\_Clean}\xspace(u) \vee \neg \mathbf{P\_ICorrect}\xspace(u)$ in $\gamma$, and
$u$ is disabled forever in $e$. Indeed, if $\neg \mathbf{P\_Clean}\xspace(u)$,
then $\neg \mathbf{P\_Clean}\xspace(u)$ holds forever since {\tt U}\xspace does not write into
{\tt SDR}\xspace's variables. If $ \neg \mathbf{P\_ICorrect}\xspace(u)$ holds, then there is a
neighbor $v$ such that $\neg \mathbf{P\_Ok}\xspace(u,v)$ holds, both $u$ and $v$ are
disabled, hence so $\neg \mathbf{P\_Ok}\xspace(u,v)$ holds forever, which implies
that $\neg \mathbf{P\_Up}\xspace(u)$ forever.
Now, since $u$ is disabled forever, each neighbor of $u$ moves at most
three times in $e$. Inductively, every node at distance $d$ from $u$
moves at most $3d$ times. Overall, we obtain the following lemma.
\begin{lemma}\label{lem:move:unison}
In any execution of {\tt U}\xspace starting from a configuration which does not
satisfy $\mathbf{P\_Clean}\xspace(u) \wedge \mathbf{P\_ICorrect}\xspace(u)$ for every process $u$, each
process moves at most $3D$ times, where $D$ is the network diameter.
\end{lemma}
\subsection{Algorithm {\tt U}\xspace $\circ$ {\tt SDR}\xspace}
\paragraph{Requirements.}
To show the self-stabilization of {\tt U}\xspace $\circ$ {\tt SDR}\xspace, we should first
establish that {\tt U}\xspace meets the requirements~\ref{RQ1} to~\ref{RQ6},
given in Subsection~\ref{sect:require}.
Requirement~\ref{RQ2} is satisfied since $\mathbf{P\_ICorrect}\xspace(u)$ does not
involve any variable of {\tt SDR}\xspace and is closed by {\tt U}\xspace
(Lemma~\ref{unison:agree}). All other requirements directly follow
from the code of {\tt U}\xspace.
\paragraph{Self-stabilization and Move Complexity.}
We define the legitimate configurations of {\tt U}\xspace $\circ$ {\tt SDR}\xspace as the set
of configurations satisfying $\mathbf{P\_Clean}\xspace(u) \wedge \mathbf{P\_ICorrect}\xspace(u)$ for
every process $u$. This set actually corresponds to the set of normal
configurations (see Corollary~\ref{cor:round}, page
\pageref{cor:round}) and
is closed by Algorithm {\tt U}\xspace $\circ$
{\tt SDR}\xspace, by Remark~\ref{rem:mutex} (page \pageref{rem:mutex}),
Theorem~\ref{theo:termA} (page \pageref{theo:termA}), and
Corollary~\ref{unison:safety}. Then, from any normal configuration,
the specification of the unison holds, by Corollary~\ref{u:safe} and
Lemma~\ref{u:fair}. So, it remains to show the convergence.
Let $u$ be a process. Let $e$ be an execution of {\tt U}\xspace $\circ$ {\tt SDR}\xspace.
By Corollary \ref{cor:seg} (page \pageref{cor:seg}), the sequence of
rules executed by a process $u$ in a segment of $e$ belongs to the
following language:
$$(\mathbf{rule\_C}\xspace + \varepsilon)\ \mathbf{words\_I}\xspace\ (\mathbf{rule\_RB}\xspace + \mathbf{rule\_R}\xspace +
\varepsilon)\ (\mathbf{rule\_RF}\xspace + \varepsilon)$$ where $\mathbf{words\_I}\xspace$ be any
sequence of rules of {\tt U}\xspace.
Let assume that $e$ contains $s$ segments. Recall that $s \leq n+1$;
see Remark~\ref{rem:nbseg}, page \pageref{rem:nbseg}. Let call {\em
regular} segment any segment that starts in a configuration
containing at least one abnormal alive root. A regular segment
contains no normal configuration, so, by Lemma~\ref{lem:transfert}
(page \pageref{lem:transfert}) and Lemma~\ref{lem:move:unison}, the
sequence $\mathbf{words\_I}\xspace$ of $u$ is bounded by $3D$ in $S$. Thus, $u$
executes at most $3D+3$ moves in $S$ and, overall a regular segment
contains at most $(3D+3).n$ moves and necessarily ends by a step where
the number of abnormal alive root decreases. Hence, all $s-1$ first
segments are regular and the last one is not.
Overall, the last segment $S_{last}$ starts after at most
$(3D+3).n.(s-1)$ moves. $S_{last}$ contains no abnormal alive root
and so, the sequence of rules executed by $u$ in $S_{last}$ belongs to
the following language: $(\mathbf{rule\_C}\xspace +
\varepsilon)\ \mathbf{words\_I}\xspace$.\footnote{Otherwise, $\variable{st}_u = RB$ in some
configuration of $S_{last}$, and that configuration contains an
abnormal root, by Lemma~\ref{lem:trace} (page \pageref{lem:trace}), a
contradiction.} If the initial configuration of $S_{last}$ contains
no process of status $RF$, then it is a normal configuration and so $s
= 1$, {\em i.e.}, $e$ is initially in a normal configuration.
Otherwise, let $v$ be a process such that $\variable{st}_v = RF$ in the initial
configuration of $S_{last}$ and no other process executes $\mathbf{rule\_C}\xspace$
later than $v$. Following the same reasoning as in
Lemma~\ref{lem:move:unison}, while $v$ does not execute $\mathbf{rule\_C}\xspace$, each
process other than $v$ can execute at most $3D$ rules of {\tt U}\xspace and one
$\mathbf{rule\_C}\xspace$. Hence, there are at most $(3D+1).(n-1)+1$ moves in
$S_{last}$ before the system reaches a normal configuration.
Since, in the worst case $s = n+1$, overall $e$ reaches a normal
configuration in at most $(3D+3).n^2+(3D+1).(n-1)+1$ moves, and we
have the following theorem.
\begin{theorem} {\tt U}\xspace $\circ$ {\tt SDR}\xspace is
self-stabilizing for the unison problem. Its stabilization time is
in $O(D.n^2)$ moves.
\end{theorem}
\paragraph{Round Complexity.}
By Corollary \ref{cor:round} (page~\pageref{cor:round}), follows.
\begin{theorem}
The
stabilization time of {\tt U}\xspace $\circ$ {\tt SDR}\xspace is at most $3n$ rounds.
\end{theorem}
| {'timestamp': '2019-04-23T02:01:31', 'yymm': '1901', 'arxiv_id': '1901.03587', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03587'} | arxiv |
\section{Introduction}
Many non-parametric estimation problems in econometrics and causal inference can be formulated as finding a parameter vector $\theta(x)\in \mathbb{R}^p$ that is a solution to a set of conditional moment equations:
\begin{equation}
\textstyle{\mathbf{E}[\psi(Z;\theta(x)) | X=x] = 0\,,}
\end{equation}
when given $n$ i.i.d. samples $(Z_1, \ldots, Z_n)$ from the distribution of $Z$, where $\psi: \mathcal{Z} \times \mathbb{R}^p \rightarrow \mathbb{R}^p$ is a known vector valued moment function, $\mathcal{Z}$ is an arbitrary data space, $X \in \mathcal{X} \subset \mathbb{R}^D$ is the feature vector that is included $Z$. Examples include non-parametric regression\footnote{$Z=(X,Y)$, where $Y\in \mathbb{R}^p$ is the dependent variable, and $\psi(Z;\theta(x))=Y-\theta(x)$.}, quantile regression\footnote{$Z=(X,Y)$ and $\psi(Z;\theta(x))=1\{Y\leq \theta(x)\} - \alpha$, for some $\alpha\in [0,1]$ that denotes the target quantile.}, heterogeneous treatment effect estimation\footnote{$Z=(X, T, Y)$, where $T\in\mathbb{R}^p$ is a vector of treatments, and $\psi(Z;\theta(x))= (Y - \ldot{\theta(x)}{T})\,T$.}, instrumental variable regression\footnote{$Z=(X,T,W,Y)$, where $T\in \mathbb{R}$ is a treatment, $W\in \mathbb{R}$ an instrument and $\psi(Z;\theta(x))= (Y - \theta(x)\,T)\,W$.}, local maximum likelihood estimation\footnote{Where the distribution of $Z$ admits a known density $f(z;\theta(x))$ and $\psi(Z;\theta(x)) = \nabla_{\theta} \log(f(Z; \theta(x))$.} and estimation of structural econometric models (see e.g., \cite{Reiss2007} and examples in \cite{Chernozhukov2016locally,Chernozhukov2018plugin}). The study of such conditional moment restriction problems has a long history in econometrics (see e.g., \cite{Newey1993,Ai2003,Chen2009,Chernozhukov2015}). However, the majority of the literature assumes that the conditioning variable $X$ is low dimensional, i.e. $D$ is a constant as the sample size $n$ grows (see e.g., \cite{athey2019generalized}). High dimensional variants have primarily been analyzed under parametric assumptions on $\theta(x)$, such as sparse linear forms (see e.g., \cite{chernozhukov2018double}).
There are some papers that address the fully non-parametric setup (see e.g., \cite{lafferty2008,dasgupta2008random,kpotufe2011k,Biau2012,scornet2015}) but those are focused on the estimation problem, and do not address inference (i.e., constructing asymptotically valid confidence intervals).
The goal of this work is to address estimation and inference in conditional moment models with a high-dimensional conditioning variable. As is obvious without any further structural assumptions on the problem, the exponential in dimension rates of approximately $n^{1/D}$ (see e.g., \cite{Stone1982}) cannot be avoided. Thereby estimation is in-feasible even if $D$ grows very slowly with $n$. Our work, follows a long line of work in machine learning \citep{dasgupta2008random,kpotufe2011k,kpotufe2013adaptivity}, which is founded on the observation that in many practical applications, even though the variable $X$ is high-dimensional (e.g. an image), one typically expects that the coordinates of $X$ are highly correlated. The latter intuition is formally captured by assuming that the distribution of $X$ has a small doubling measure around the target point $x$.
We refer to the latter notion of dimension, as the intrinsic dimension of the problem. Such a notion has been studied in the statistical machine learning literature, so as to establish fast estimation rates in high-dimensional kernel regression settings \citep{dasgupta2008random,kpotufe2011k,kpotufe2013adaptivity,Xue2018,Chen2018,Kim2018,jiang2017rates}. However, these works solely address the problem of estimation and do not characterize the asymptotic distribution of the estimates, so as to enable inference, hypothesis testing and confidence interval construction. Moreover, they only address the regression setting and not the general conditional moment problem and consequently do not extend to quantile regression, instrumental variable regression or treatment effect estimation.
From the econometrics side, pioneering works of \cite{wager2017estimation,athey2019generalized} address estimation and inference of conditional moment models with all the aforementioned desiderata that are required for the application of such methodologies to social sciences, albeit in the low dimensional regime. In particular, \cite{wager2017estimation} consider regression and heterogeneous treatment effect estimation with a scalar $\theta(x)$ and prove $n^{1/D}$-asymptotic normality of a sub-sampled random forest based estimator and \cite{athey2019generalized} extend it to the general conditional moment settings.
These results have been extended and improved in multiple directions, such as improved estimation rates through local linear smoothing \cite{friedberg2018local}, robustness to nuisance parameter estimation error \cite{oprescu2018orthogonal} and improved bias analysis via sub-sampled nearest neighbor estimation \cite{fan2018dnn}. However, they all require low dimensional setting and the rate provided by the theoretical analysis is roughly $n^{-1/D}$, i.e. to get a confidence interval of length $\epsilon$ or an estimation error of $\epsilon$, one would need to collect $O(\epsilon^{-D})$ samples which is prohibitive in most target applications of machine learning based econometrics.
Hence, there is a strong need to provide theoretical results that justify the success of machine learning estimators for doing inference, via their adaptivity to some low dimensional hidden structure in the data. \emph{Our work makes a first step in this direction and provides estimation and asymptotic normality results for the general conditional moment problem, where the rate of estimation and the asymptotic variance depend only on the intrinsic dimension, independent of the explicit dimension of the conditioning variable.}
Our analysis proceeds in four parts. First, we extend the results by \cite{wager2017estimation,athey2019generalized} on the asymptotic normality of sub-sampled kernel estimators to the high-dimensional, low intrinsic dimension regime and to vector valued parameters $\theta(x)$. Concretely, when given a sample $S=(Z_1, \ldots, Z_n)$, our estimator is based on the approach proposed in \cite{athey2019generalized} of solving a locally weighted empirical version of the conditional moment restriction
\begin{equation}
\hat{\theta}(x) \text{ solves}: \sum_{i=1}^n K(x, X_i, S)\, \psi(Z_i; \theta) = 0\,,
\end{equation}
where $K(x, X_i, S)$ captures proximity of $X_i$ to the target point $x$. The approach dates back to early work in statistics on local maximum likelihood estimation \citep{fan1998local,newey1994kernel,stone1977consistent,tibshirani1987local}. As in \cite{athey2019generalized}, we consider weights $K(x, X_i, S)$ that take the form of an average over $B$ base weights: $K(x, X_i, S) = \frac{1}{B}\sum_{b=1}^B K(x, X_i, S_b)\,1\{i\in S_b\}$, where each $K(x, X_i, S_b)$ is calculated based on a randomly drawn sub-sample $S_b$ of size $s<n$ from the original sample. We will typically refer to the function $K$ as the \emph{kernel}. In \cite{wager2017estimation,athey2019generalized} $K(x, X_i, S_b)$ is calculated by building a tree on the sub-sample, while in \cite{fan2018dnn} it is calculated based on the $1$-NN rule on the sub-sample.
Our main results are general estimation rate and asymptotic normality theorems for the estimator $\hat{\theta}(x)$ (see Theorems~\ref{thm:mse_rate} and \ref{thm:normality}), which
are stated in terms of two high-level assumptions, specifically an upper bound $\epsilon(s)$ on the rate at which the kernel ``shrinks'' and a lower bound $\eta(s)$ on the ``incrementality'' of the kernel.
Notably, the explicit dimension of the conditioning variable $D$ does not enter the theorem, so it suffices in what follows to show that $\epsilon(s)$ and $\eta(s)$ depend only on $d$ rather than $D$.
The shrinkage rate $\epsilon(s)$ is defined as the $\ell_2$-distance between the target point $x$ and the furthest point on which the kernel places positive weight $X_i$, when trained on a data set of $s$ samples, i.e.,
\begin{equation}
\epsilon(s) = \mathbf{E}\bb{\sup \{\|X_i-x\|_2: i\in S_b, K(x, X_i, S_b)>0, |S_b|=s\}}\,.
\end{equation}
The shrinkage rate of the kernel controls the bias of the estimate (small $\epsilon(s)$ implies low bias).
The sub-sampling size $s$ is a lever to trade off bias and variance; larger $s$ achieves smaller bias, since $\epsilon(s)$ is smaller, but increases the variance, since for any fixed $x$ the weights $K(x, X_i, S_b)$ will tend to concentrate on the same data points, rather than averaging over observations.
Both estimation and asymptotic normality results require the bias to be controlled through the shrinkage rate.
Incrementality of a kernel describes how much information is revealed about the weight of a sample $i$ solely by knowledge of $X_i$, and is captured by the second moment of the conditional expected weight
\begin{equation}
\label{eqn:incrementality}
\eta(s)=\mathbf{E}\bb{\mathbf{E}\bb{K(x, X_i, S_b) | X_i}^2}\,.
\end{equation}
The incrementality assumption is used in the asymptotic normality proof to argue that the weights have sufficiently high variance that all data points have some influence on the estimate.
From the technical side, we use the H\'{a}jek projection to analyze our $U$-statistic estimator. Incrementality ensures that there is sufficiently weak dependence in the weights across a sequence of sub-samples and hence the central limit theorem applies.
As discussed, the sub-sampling size $s$ can be used to control the variance of the weights, and so incrementality and shrinkage are related.
We make this precise, proving that incrementality can be lower bounded as a function of kernel shrinkage, so that having a sufficiently low shrinkage rate enables both estimation and inference.
These general results could be of independent interest beyond the scope of this work.
For the second part of our analysis, we specialize to the case where the base kernel is the $k$-NN kernel, for some constant $k$.
We prove that both shrinkage and incrementality depend only on the intrinsic dimension $d$, rather than the explicit dimension $D$.
In particular, we show that $\epsilon(s) = O(s^{-1/d})$ and $\eta(s) = \Theta(1/s)$. These lead to our main theorem \emph{that the sub-sampled $k$-NN estimate achieves an estimation rate of order $n^{1/(d+2)}$ and is also $n^{1/(d+2)}$-asymptotically normal.}
In the third part, we provide a closed form characterization of the asymptotic variance of the sub-sampled $k$-NN estimate, as a function of the conditional variance of the moments, which is defined as $\sigma^2(x) = \Var\bp{\psi(Z;\theta) \mid X=x}$. For example, for the $1$-NN kernel, the asymptotic variance is given by
\begin{equation*}
\Var(\hat{\theta}(x)) = \frac{\sigma^2(x) s^2}{n(2s-1)}\,.
\end{equation*}
This strengthens prior results of \cite{fan2018dnn} and \cite{wager2017estimation}, which only proved the existence of an asymptotic variance without providing an explicit form (and thereby relied on bootstrap approaches for the construction of confidence intervals). Our tight characterization enables an easy construction of plugin normal-based intervals that only require a preliminary estimate of $\sigma(x)$. Our Monte Carlo study shows that such intervals provide very good finite sample coverage in a high dimensional regression setup (see Figure \ref{fig:distribution})\footnote{See Appendix \ref{app:sim} for detailed explanation of our simulations.}.
Finally in the last part, we discuss an adaptive data-driven approach for picking the sub-sample size $s$ so as to achieve estimation or asymptotic normality with rates that only depend on the unknown intrinsic dimension. This allows us to achieve near-optimal rates while adapting to the unknown intrinsic dimension of data (see Propositions \ref{thm:est-adapt} and \ref{thm:normal-adapt}). Figure~\ref{fig:coverage1d} depicts the performance of our adaptive approach compared to two benchmarks, one constructed based on theory for intrinsic dimension $d$ which may be unknown, and the other one constructed na\"ively based on the known but sub-optimal extrinsic dimension $D$. As it can be observed from this figure, setting $s$ based on intrinsic dimension $d$ allows us to build more accurate and smaller confidence intervals, which is crucial for drawing inference in the high-dimensional finite sample regime. Our adaptive approach uses samples to pick $s$ very close to the value suggested by our theory and therefore leads to a compelling finite sample coverage\footnote{A preliminary implementation of our code is available via \href{http://github.com/khashayarkhv/np_inference_intrinsic}{http://github.com/khashayarkhv/np\_inference\_intrinsic}.}.
Our results shed some light on the importance of using adaptive machine learning based estimators, such as nearest neighbor based estimates, when performing estimation and inference in high-dimensional econometric problems. Such estimators address the curse of dimensionality by adapting to a priori unknown latent structure in the data. Moreover, coupled with the powerful sub-sampling based averaging approach, such estimators can maintain their adaptivity, while also satisfying asymptotic normality and thereby enabling asymptotically valid inference; a property that is crucial for embracing such approaches in econometrics and causal inference.
\begin{figure}[h]
\centering
\includegraphics[height = 14cm]{coverage_single_point_n_20000_sigma_1_00_mcsamples_1000.pdf}
\caption{Left: distribution of estimates over $1000$ Monte Carlo runs for $k=1,2,5$. Right: the quantile-quantile plot when comparing to the theoretical asymptotic normal distribution of estimates stemming from our characterization, whose means are $0.676, 0.676,$ and $0.676$ for $k=1,2,5$, respectively. Standard deviations are $0.058, 0.055,$ and $0.049$ for $k=1,2,5$ respectively. $n=20000$, $D=20$, $d=2$, $\mathbf{E}[Y|X] = \frac{1}{1+\exp\{-3 X[0]\}}$, $\sigma=1$. Test point: $x[0]\approx 0.245$, $\mathbf{E}[Y|X=x]\approx 0.676$.}
\label{fig:distribution}
\end{figure}
\begin{figure}
\centering
\includegraphics[height=14cm]{coverage_multiple_points_n_20000_n_test_100_sigma_1_00_mcsamples_1000.pdf}
\caption{Confidence interval and true values for $100$ randomly sampled test points on a single run for $k=1,2,5$ and when (1) left: $s=s_{\zeta}$ is chosen adaptively using Proposition \ref{thm:normal-adapt} with $\zeta=0.1$, (2) second from the left: $s=n^{1.05 d/(d+2)}$, and (3) middle: $s=n^{1.05 D/(D+2)}$. Second from the right: coverage over $1000$ runs for three different methods described. Right: average value of $s_{\zeta}$ chosen adaptively using Proposition \ref{thm:normal-adapt} for $\zeta = 0.1$ for different test points compared to the theoretical value $s=n^{1.05 d/(d+2)}$. Here $n=20000$, $D=20$, $d=2$, $\mathbf{E}[Y|X] = \frac{1}{1+\exp\{-3 X[0]\}}$, $\sigma=1$. Nominal coverage: $0.98$.}\label{fig:coverage1d}
\end{figure}
%
\paragraph{Structure of the paper.} The rest of the paper is organized as follows. In \S \ref{sec:prelim}, we provide preliminary definitions, in \S \ref{ssec:gen} and \S \ref{ssec:DNN} we explain our algorithms, in \S \ref{ssec:intrinsic-dimension} we explain doubling dimension (see Appendix \ref{ssec:examples} for examples). In \S \ref{sec:assumptions} we state our assumptions, in \S \ref{sec:subsamp-kernel} we provide general estimation and inference results for kernels that satisfy shrinkage and incrementality conditions, and in \S \ref{sec:main-thm} we apply such results to the $k$-NN kernel and prove estimation and inference rates for such kernels that only depend on intrinsic dimension. We defer a discussion on the extension to heterogeneous treatment effect estimation and also technical proofs to Appendices.
\section{Preliminaries}\label{sec:prelim}
Suppose we have a data set $M$ of $n$ observations $Z_1, Z_2, \ldots, Z_n$ drawn independently from some distribution $\mathcal{D}$ over the observation domain $\mathcal{Z}$. We focus on the case that $Z_i = (X_i, Y_i)$, where $X_i$ is the vector of covariates and $Y_i$ is the outcome. In Appendix \ref{sec:nuisance}, we briefly discuss how our results can be extended to the setting where nuisance parameters and treatments are included in the model.
Suppose that the covariate space $\mathcal{X} \subset \mathbb{R}^D$ is contained in a ball with unknown diameter $\Delta_\mathcal{X}$. Denote the marginal distribution of $X$ by $\mu$ and the empirical distribution of $X$ on $n$ sample points by $\mu_n$. Let $B(x,r) = \bc{z \in \mathbb{R}^D: \|x-z\|_2 < r}$ be the $\ell_2$-ball centered at $x$ with radius $r$ and denote the standard basis for $\mathbb{R}^p$ by $\bc{e_1,e_2,\ldots,e_p}$.
Let $\psi: \mathcal{Z} \times \mathbb{R}^p \to \mathbb{R}^p$ be a score function that maps observation $Z$ and parameter $\theta \in \mathbb{R}^p$ to a $p$-dimensional score $\psi(Z; \theta)$. For $x \in \mathcal{X}$ and $\theta \in \mathbb{R}^p$ define the expected score as
$m(x; \theta) = \mathbf{E}[\psi(Z; \theta) \mid X=x]$. The goal is to estimate the quantity $\theta(x)$ via local moment condition, i.e.
\begin{equation*}
\theta(x) \text{~solves:~} m(x; \theta) = \mathbf{E}[\psi(Z; \theta)\mid X=x] = 0.
\end{equation*}
\subsection{Sub-Sampled Kernel Estimation}\label{ssec:gen}
\paragraph{Base Kernel Learner.} Our learner $\mathcal{L}_k$ takes a data set $S$ containing $m$ observations as input and a realization of internal randomness $\omega$, and outputs a kernel weighting function $K_{\omega}:\mathcal{X} \times \mathcal{X} \times \mathcal{Z}^m \to [0,1]$. In particular, given any target feature $x$ and the set $S$, the weight of each observation $Z_i$ in $S$ with feature vector $X_i$ is $K_{\omega}(x,X_i,S)$. Define the weighted score on a set $S$ with internal randomness $\omega$ as
$\Psi_S(x; \theta) = \sum_{i\in S} K_{\omega}(x,X_i,S) \psi(Z_i; \theta)$. When it is clear from context we will omit $\omega$ from our notation for succinctness and essentially treat $K$ as a random function. For the rest of the paper, we are going to use notations $\alpha_{S,\omega}(X_i) = K_{\omega}(x,X_i,S)$ interchangeably.
\paragraph{Averaging over $B$ sub-samples of size $s$.} Suppose that we consider $B$ random and independent draws from all $\binom{n}{s}$ possible subsets of size $s$ and internal randomness variables $\omega$ and look at their average. Index these draws by $b=1,2,\ldots,B$ where $S_b$ contains samples in $b$th draw and $\omega_b$ is the corresponding draw of internal randomness. We can define the weighted score as
\begin{equation}
\label{eqn:incomp-u-stat}
\Psi(x; \theta) = \frac{1}{B} \sum_{b=1}^B \Psi_{S_b,\omega_b}(x; \theta) = \frac{1}{B} \sum_{b=1}^B \sum_{i\in S_b} \alpha_{S_b,\omega_b}(X_i) \psi(Z_i; \theta) \,.
\end{equation}
\paragraph{Estimating $\theta(x)$.} We estimate $\theta(x)$ as a vanishing point of $\Psi(x; \theta)$. Letting $\hat{\theta}$ be this point, then
$\Psi(x; \hat{\theta}) = \frac{1}{B} \sum_{b=1}^B \sum_{i=1}^n \alpha_{S_b,\omega_b}(X_i) \psi(Z_i; \hat{\theta}) = 0.$ This procedure is explained in Algorithm \ref{alg:gen}.
\subsection{Sub-Sampled $k$-NN Estimation}
\label{ssec:DNN}
We specially focus on the case that the weights are distributed across the $k$-NN of $x$. In other words, given a data set $S$, the weights are given according to $K_{\omega}(x,X_i,S) = \,1 \bc{X_i \in H_k(x,S)}/k$, where $H_k(x,S)$ are $k$-NN of $x$ in the set $S$. The pseudo-code for this can be found in Algorithm \ref{alg:DNN}.
\paragraph{Complete $U$-statistic.} The expression in Equation \eqref{eqn:incomp-u-stat} is an incomplete $U$-statistic. Complete $U$-statistic is obtained if we allow each subset of size $s$ from $n$ samples to be included in the model exactly once. In other words, this is achieved if $B=\binom{n}{s}$, all subsets $S_1, S_2, \ldots, S_B$ are distinct, and we also take expectation over the internal randomness $\omega$. Denoting this by $\Psi_0(x;\theta)$, we have
\begin{equation}\label{eqn:comp-u-stat}
\Psi_0(x;\theta) = \binom{n}{s}^{-1} \sum_{S \in [n]: |S|=s} \mathbf{E}_{\omega}\bb{\sum_{i\in S} \alpha_{S,\omega}(X_i) \psi(Z_i; \theta)}\,.
\end{equation}
Note in the case of $k$-NN estimator we can also represent $\Psi_0$ in terms of order statistics, i.e., $\Psi_0$ is an $L$-statistics (see e.g., \cite{serfling2009approximation}). By sorting samples in $\mathbf{X} = \bc{X_1,X_2,\ldots,X_n}$ based on their distance with $x$ as $\|X_{(1)}-x\| \leq \|X_{(2)}-x\| \leq \cdots \leq \|X_{(n)}-x\|$, we can write $\Psi_0(x; \theta) = \sum_{i=1}^n \alpha(X_{(i)})\, \psi(Z_{(i)};\theta)$ where the weights are given by
\[
\alpha(X_{(i)}) =
\begin{cases}
\frac{1}{k} \binom{n}{s}^{-1} \, \binom{n-i}{s-1} & \text{~if~} i \leq k \\
\frac{1}{k} \binom{n}{s}^{-1} \, \sum_{j=0}^{k-1} \binom{i-1}{j} \binom{n-i}{s-1-j} &\text{~if~} i \geq k+1 \,.
\end{cases}
\]
\vspace{-1mm}
\begin{minipage}{0.48\textwidth}
\begin{algorithm}[H]
\centering
\caption{Sub-Sampled Kernel Estimation}\label{alg:gen}
\begin{algorithmic}[1]
\State {\bf Input.} Data $\bc{Z_i=(X_i, Y_i)}_{i=1}^n$, moment $\psi$, kernel $K$, sub-sampling size $s$, number of iterations $B$
\State {\bf Initialize.} $\alpha(X_i) = 0, 1 \leq i \leq n$
\For{$b \gets 1, B$}
\State \textbf{Sub-sampling.} Draw set $S_b$ by sampling $s$ points from $Z_1,Z_2,\ldots,Z_n$ without replacement.
\State \textbf{Weight Updates.} $\alpha(X_i) \gets \alpha(X_i) + K_{\omega_b}(x,X_i,S_b)$
\EndFor
\State \textbf{Weight Normalization.} $\alpha(X_i) \gets \alpha(X_i)/B$
\State \textbf{Estimation.} Denote $\hat{\theta}$ as a solution of $\Psi(x;\theta)=\sum_{i=1}^n \alpha(X_i) \psi(Z_i;\theta)=0$
\end{algorithmic}
\end{algorithm}
\end{minipage}
\hfill
\begin{minipage}{0.48\textwidth}
\begin{algorithm}[H]
\centering
\caption{Sub-Sampled $k$-NN Estimation}\label{alg:DNN}
\begin{algorithmic}[1]
\State {\bf Input.} Data $\bc{Z_i=(X_i, Y_i)}_{i=1}^n$, moment $\psi$, sub-sampling size $s$, number of iterations $B$, number of neighbors $k$
\State {\bf Initialize.} $\alpha(X_i) \gets 0, 1 \leq i \leq n$
\For{$b \gets 1,B$}
\State \textbf{Sub-sampling.} Draw set $S_b$ by sampling $s$ points from $Z_1,Z_2,\ldots,Z_n$ without replacement
\State \textbf{Weight Updates.} $\alpha(X_i) \gets \alpha(X_i) + \,1 \bc{X_i \in H_k(x,S_b)}/k $
\EndFor
\State \textbf{Weight Normalization.} $\alpha(X_i) \gets \alpha(X_i)/B$
\State \textbf{Estimation.} Denote $\hat{\theta}$ as a solution of $\Psi(x;\theta)=\sum_{i=1}^n \alpha(X_i) \psi(Z_i;\theta)=0$
\end{algorithmic}
\end{algorithm}
\end{minipage}
\subsection{Local intrinsic dimension}\label{ssec:intrinsic-dimension}
We are interested in settings that the distribution of $X$ has some low dimensional structure on a ball around the target point $x$. The following notions are adapted from \cite{kpotufe2011k}, which we present here for completeness.
\begin{definition}\label{def:doubling-dim}
The marginal $\mu$ is called {\bf doubling measure} if there exists a constant $C_{db}>0$ such that for any $x \in \mathcal{X}$ and any $r>0$ we have $\mu(B(x,r)) \leq C_{db} \mu(B(x,r/2))$.
\end{definition}
An equivalent definition of this notion is that, the measure $\mu$ is doubling measure if there exist $C, d>0$ such that for any $x \in \mathcal{X}, r>0$, and $\theta \in (0,1)$ we have $\mu(B(x,r)) \leq C \theta^{-d} \mu(B(x,\theta r))$.
One example is given by Lebesgue measure on the Euclidean space $\mathbb{R}^d$, where for any $r>0, \theta \in(0,1)$ we have $\vol(B(x,\theta r)) = \vol(B(x,r)) \theta^d$. Building upon this, let $\mathcal{X} \in \mathbb{R}^D$ be a subset of $d$-dimensional hyperplane and suppose that for any ball $B(x,r)$ in $\mathcal{X}$ we have $\vol(B(x,r) \cap \mathcal{X})=\Theta(r^d)$. If $\mu$ is almost uniform, then we also have $\mu(B(x,\theta r))/\mu(B(x,r)) = \Theta(\theta^d)$.
Unfortunately, this global notion of doubling measure is restrictive and most probability measures are globally complex. Rather, once restricted to local neighborhoods, the measure becomes lower dimensional and intrinsically less complex. The following definition captures this intuition better.
\begin{definition}\label{def:hom-measure}
Fix $x \in \mathcal{X}$ and $r > 0$. The marginal $\mu$ is $(C,d)$-{\bf homogeneous on} $B(x,r)$ if for any $\theta \in (0,1)$ we have $\mu(B(x, r)) \leq C \theta^{-d} \mu(B(x, \theta r))$.
\end{definition}
Intuitively, this definition requires the marginal $\mu$ to have a local support that is intrinsically $d$-dimensional. This definition covers low-dimensional manifolds, mixture distributions, $d$-sparse data, and also any combination of these examples. These examples are explained in Appendix \ref{ssec:examples}.
\section{Assumptions}\label{sec:assumptions}
For non-parametric estimators the bias is connected to the kernel shrinkage, as noted by \cite{athey2019generalized, wager2017estimation, oprescu2018orthogonal}.
\begin{definition}[Kernel Shrinkage in Expectation]\label{def:ker-shrink}
The kernel weighting function output by learner $\mathcal{L}_k$ when it is given $s$ i.i.d. observations drawn from distribution $\mathcal{D}$ satisfies
\begin{equation*}
\mathbf{E} \bb{\sup \bc{\|x - X_i\|_2 : K(x,X_i,S)>0}} = \epsilon(s)\,.
\end{equation*}
\end{definition}
\begin{definition}[Kernel Shrinkage with High Probability]\label{def:ker-shrink-whp}
The kernel weighting function output by learner $\mathcal{L}_k$ when it is given $s$ i.i.d. observations drawn from distribution $\mathcal{D}$ w.p. $1-\delta$ over the draws of the $s$ samples satisfies
\begin{equation*}
\sup \bc{\|x - X_i\|_2: K(x,X_i,S)>0} \leq \epsilon(s,\delta)\,.
\end{equation*}
\end{definition}
As shown in \cite{wager2017estimation}, for trees that satisfy some regularity condition, $\epsilon(s) \leq s^{-c/D}$ for a constant $c$. We are interested in shrinkage rates that scale as $s^{-c/d}$, where $d$ is the local intrinsic dimension of $\mu$ on $B(x,r)$. Similar to \cite{oprescu2018orthogonal, athey2019generalized}, we rely on the following assumptions on the moment and score functions.
\begin{assumption}\label{ass:mse}
\begin{enumerate}
\item[]
\item The moment $m(x; \theta)$ corresponds to the gradient w.r.t. $\theta$ of a $\lambda$-strongly convex loss $L(x; \theta)$. This also means that the Jacobian $M_0= \nabla_\theta m(x; \theta(x))$ has minimum eigenvalue at least $\lambda$.
\item For any fixed parameters $\theta$, $m(x; \theta)$ is a $L_m$-Lipschitz function in $x$ for some constant $L_m$.
\item There exists a bound $\psi_{\max}$ such that for any observation $z$ and any $\theta$, $\|\psi(z; \theta)\|_{\infty}\leq \psi_{\max}$.
\item The bracketing number $N_{[]}({\cal F}, \epsilon, L_2)$ of the function class: ${ \cal F}=\{\psi(\cdot; \theta): \theta \in \Theta\}$, satisfies $\log(N_{[]}({\cal F}, \epsilon, L_2))= O(1 /\epsilon)$.
\end{enumerate}
\end{assumption}
\begin{assumption}\label{ass:normality}
\begin{enumerate}
\item[]
\item For any coordinate $j$ of the moment vector $m$, the Hessian $H_j(x; \theta)=\nabla^2_{\theta\theta} m_j(x;\theta)$ has eigenvalues bounded above by a constant $L_H$ for all $\theta$.
\item Maximum eigenvalue of $M_0$ is upper bounded by $L_J$.
\item Second moment of $\psi(x;\theta)$ defined as $\Var\bp{\psi(Z;\theta) \mid X=x}$ is $L_{mm}$-Lipschitz in $x$, i.e.,
\begin{equation*}
\|\Var\bp{\psi(Z;\theta) \mid X=x} - \Var\bp{\psi(Z;\theta) \mid X=x'}\|_F \leq L_{mm} \|x-x'\|_2\,.
\end{equation*}
\item Variogram is Lipschitz:
$\sup_{x\in \mathcal{X}} \|\Var(\psi(Z; \theta) - \psi(Z; \theta') \mid X=x)\|_F \leq L_{\psi} \|\theta - \theta'\|_2$.
\end{enumerate}
\end{assumption}
The condition on variogram always holds for a $\psi$ that is Lipschitz in $\theta$. This larger class of functions $\psi$ allows estimation in more general settings such as $\alpha$-quantile regression that involves a $\psi$ which is non-Lipschitz in $\theta$.
Similar to \cite{athey2016recursive, athey2019generalized}, we require kernel $K$ to be \emph{honest} and \emph{symmetric}.
\begin{assumption}\label{ass:honest}
The kernel $K$, built using samples $\bc{Z_1,Z_2,\ldots,Z_s}$, is {\bf honest} if the weight of sample $i$ given by $K(x,X_i,\bc{Z_j}_{j=1}^s)$ is independent of $Y_j$ conditional on $X_j$ for any $j \in [s]$.
\end{assumption}
\begin{assumption}\label{ass:sym}
The kernel $K$, built using samples $\bc{Z_1, Z_2, \ldots, Z_s}$, is {\bf symmetric} if for any permutation $\pi:[s] \to [s]$, the distribution of $K(x,X_i,\bc{Z_j}_{j=1}^s)$ and $K(x, X_{\pi(i)}, \bc{Z_{\pi(j)}}_{j=1}^s)$ are equal. In other words, the kernel weighting distribution remains unchanged under permutations.
\end{assumption}
For a deterministic kernel $K$, the above condition implies that $K(x,X_i,\{Z_j \}_{j=1}^s) = K(x, X_i, \{Z_{\pi(j)}\}_{j=1}^s)$, for any $i \in [s]$. In the next section, we provide general estimation and inference results for a general kernel based on the its shrinkage and incrementality rates.
\section{Guarantees for sub-sampled kernel estimators}\label{sec:subsamp-kernel}
Our first result establishes estimation rates, both in expectation and high probability, for kernels based on their shrinkage rates. The proof of this theorem is deferred to Appendix \ref{app:mse_rate}.
\begin{theorem}[Finite Sample Estimation Rate]\label{thm:mse_rate}
Let Assumptions \ref{ass:mse} and \ref{ass:honest} hold. Suppose that Algorithm \ref{alg:gen} is executed with $B \geq n/s$. If the base kernel $K$ satisfies kernel shrinkage in expectation, with rate $\epsilon(s)$, then w.p. $1-\delta$
\begin{equation}
\|\hat{\theta} - \theta(x)\|_2 \leq \frac{2}{\lambda}\left(L_m \epsilon(s) + O\left(\psi_{\max}\sqrt{\frac{p\, s}{n} \left(\log\log(n /s) + \log(p/\delta)\right)}\right)\right)\,.
\end{equation}
Moreover,
\begin{equation}
\sqrt{\mathbf{E}\bb{\|\hat{\theta} - \theta(x)\|_2^2}} \leq \frac{2}{\lambda}\left(L_m \epsilon(s) + O\left(\psi_{\max}\sqrt{\frac{p\, s}{n} \log\log(p\, n /s)}\right)\right)\,.
\end{equation}
\end{theorem}
The next result establishes asymptotic normality of sub-sampled kernel estimators. In particular, it provides coordinate-wise asymptotic normality of our estimate $\hat{\theta}$ around its true underlying value $\theta(x)$. The proof of this theorem is deferred to Appendix \ref{app:normality}.
\begin{theorem}[Asymptotic Normality]\label{thm:normality}
Let Assumptions \ref{ass:mse}, \ref{ass:normality}, \ref{ass:honest}, and \ref{ass:sym} hold. Suppose that Algorithm \ref{alg:gen} is executed with $B \geq (n/s)^{5/4}$ and the base kernel $K$ satisfies kernel shrinkage, with rate $\epsilon(s, \delta)$ in probability and $\epsilon(s)$ in expectation. Let $\eta(s)$ be the incrementality of kernel $K$ defined in Equation \eqref{eqn:incrementality} and $s$ grow at a rate such that $s\rightarrow \infty$, $n \eta(s) \rightarrow \infty$, and $\epsilon(s,\eta(s)^2) \rightarrow 0$. Consider any fixed coefficient $\beta\in \mathbb{R}^p$ with $\|\beta\|\leq 1$ and define the variance as
$$\sigma_{n,\beta}^2(x) = \frac{s^2}{n}\Var\bb{\mathbf{E}\bb{\sum_{i=1}^s K(x, X_i, \{Z_j\}_{j=1}^s) \ldot{\beta}{M_0^{-1} \psi(Z_i; \theta(x))}\mid Z_1}}.$$
Then it holds that $\sigma_{n,\beta}(x) = \Omega\left(s \sqrt{\eta(s)/n}\right)$. Moreover, suppose that
\begin{equation}
\label{eqn:rate-condition-normality}
\max \left(\epsilon(s), \epsilon(s)^{1/4} \bp{\frac{s}{n} \,\log\log(n/s) }^{1/2}, \bp{\frac{s}{n} \, \log\log(n/s)}^{5/8} \right) = o(\sigma_{n,\beta}(x))\,.
\end{equation}
Then,
\[
\frac{\ldot{\beta}{\hat{\theta} - \theta(x)}}{\sigma_{n,\beta}(x)} \rightarrow_d \mathsf{N}(0, 1)\,.
\]
\end{theorem}
Theorems \ref{thm:mse_rate} and \ref{thm:normality} generalize existing estimation and asymptotic normality results of \cite {athey2019generalized,wager2017estimation, fan2018dnn} to an arbitrary kernel that satisfies appropriate shrinkage and incrementality rates (see Remark \ref{rem:inc} in Appendix \ref{app:normality}).
The following lemma relates these two and provides a lower bound on the incrementality in terms of kernel shrinkage. The proof uses the Paley-Zygmund inequality and is left to Appendix \ref{app:incrementality}.
\begin{lemma}\label{lem:shrinkage_incrementality}
For any symmetric kernel $K$ (Assumption \ref{ass:sym}) and for any $\delta\in [0,1]$:
\begin{equation*}
\eta_s = \mathbf{E} \bb{\mathbf{E}\bb{K(x, X_1, \{Z_j\}_{j=1}^s) \mid X_1}^2} \geq \frac{\left(1-\delta\right)^2\,(1/s)^2}{\inf_{\rho>0} \left(\mu(B(x, \epsilon(s, \rho)))+\rho\,s/\delta\right)}\,.
\end{equation*}
Thus if $\mu(B(x, \epsilon(s, 1/(2s^2))))=O(\log(s)/s)$, then picking $\rho=1/(2s^2)$ and $\delta = 1/2$ implies that $\mathbf{E}[\mathbf{E}[K(x, X_1, \{Z_j\}_{j=1}^s) |X_1]^2] = \Omega(1/s\log(s)).$
\end{lemma}
\begin{corollary}\label{cor:incrementality}
If $\epsilon(s, \delta)=O((\log(1/\delta)/s)^{1/d})$ and $\mu$ satisfies a two-sided version of the doubling measure property on $B(x,r)$, defined in Definition \ref{def:hom-measure}, i.e., $c \theta^d \mu(B(x, r)) \leq \mu(B(x,\theta r)) \leq C \theta^d \mu(B(x,r))$
for any $\theta \in (0,1)$. Then, $\mathbf{E}[\mathbf{E}[K(x, X_1, \{Z_j\}_{j=1}^s) |X_1]^2] = \Omega(1/(s\log(s)))$.
\end{corollary}
Even without this extra assumption, we can still characterize the incrementality rate of the $k$-NN estimator, as we observe in the next section.
\section{Main theorem: adaptivity of $k$-NN estimator}\label{sec:main-thm}
In this section, we provide estimation guarantees and asymptotic normality of the $k$-NN estimator by using Theorems \ref{thm:mse_rate} and \ref{thm:normality}. We first establish shrinkage and incrementality rates for this kernel.
\subsection{Estimation guarantees for the $k$-NN estimator} \label{ssec:kNN-est}
In this section we provide shrinkage results for the $k$-NN kernel. As observed in Theorem \ref{thm:mse_rate}, shrinkage rates are sufficient for bounding the estimation error. The shrinkage result that we present in the following would only depend on the local intrinsic dimension of $\mu$ on $B(x,r)$.
\begin{lemma}[High probability shrinkage for the $k$-NN kernel]\label{lem:pb-kernel-shrink-kNN}
Suppose that the measure $\mu$ is $(C,d)$-homogeneous on $B(x,r)$. Then, for any $\delta$ satisfying $2 \exp \bp{-\mu(B(x,r))s/(8C)} \leq \delta \leq \frac{1}{2} \exp(-k/2),$ w.p. at least $1-\delta$ we have
\begin{equation*}
\|x - X_{(k)}\|_2 \leq \epsilon_k(s,\delta) = O \bp{\frac{\log(1/\delta)}{s}}^{1/d}\,.
\end{equation*}
\end{lemma}
We can turn this into a shrinkage rate in expectation as follows. In fact, by the very convenient choice of $\delta = s^{-1/d}$ combined with the fact that $\mathcal{X}$ has diameter $\Delta_{\mathcal{X}}$, we can establish $O\bp{(\log(s)/s)^{1/d}}$ rate on expected kernel shrinkage. However, a more careful analysis would help us to remove the $\log(s)$ dependency in the bound and is stated in the following corollary:
\begin{corollary}[Expected shrinkage for the $k$-NN kernel]\label{cor:exp-kernel-shrink-kNN}
Suppose that the conditions of Lemma \ref{lem:pb-kernel-shrink-kNN} hold. Let $k$ be a constant and $\epsilon_k(s)$ be the expected shrinkage for the $k$-NN kernel. Then, for any $s$ larger than some constant we have
$\epsilon_k(s)=\mathbf{E} \bb{\|x - X_{(k)}\|_2} = O \bp{\frac{1}{s}}^{1/d}$.
\end{corollary}
We are now ready to state our estimation result for the $k$-NN kernel, which is honest and symmetric. Therefore, we can substitute the expected shrinkage rate established in Corollary \ref{cor:exp-kernel-shrink-kNN} in Theorem \ref{thm:mse_rate} to derive estimation rates for this kernel.
\begin{theorem}[Estimation Guarantees for the $k$-NN Kernel]\label{thm:knn-mse}
Suppose that $\mu$ is $(C,d)$-homogeneous on $B(x,r)$, Assumption \ref{ass:mse} holds and that Algorithm \ref{alg:DNN} is executed with $B\geq n/s$. Then, w.p. $1-\delta$:
\begin{equation}
\|\hat{\theta} - \theta(x)\|_2 \leq \frac{2}{\lambda}\left(O \left(s^{-1/d} \right) + O\left(\psi_{\max}\sqrt{\frac{p\, s}{n} \left(\log\log(n /s) + \log(p/\delta)\right)}\right)\right)\,,
\end{equation}
and
\begin{equation}
\sqrt{\mathbf{E}\bb{\|\hat{\theta} - \theta(x)\|_2^2}} \leq \frac{2}{\lambda}\bp{O \bp{s^{-1/d}} + O \bp{\psi_{\max}\sqrt{\frac{s\, p\, \log \log(p\,n/s)}{n}}}} \,.
\end{equation}
By picking $s = \Theta \bp{n^{d/(d+2)}}$ and $B = \Omega \bp{n^{2/(d+2)}}$ we get $\sqrt{\mathbf{E}\bb{\|\hat{\theta} - \theta(x)\|_2^2}} = \tilde{O}\bp{n^{-1/(d+2)}}$.
\end{theorem}
\subsection{Asymptotic normality of the $k$-NN estimator}\label{ssec:kkN-normality}
In this section we prove asymptotic normality of $k$-NN estimator. We start by provide bounds on the incrementality of the $k$-NN kernel.
\begin{lemma}[$k$-NN Incrementality]\label{lem:kNN-inc}
Let $K$ be the $k$-NN kernel and let $\eta_k(s)$ denote the incrementality rate of this kernel. Then, the following holds:
\begin{equation*}
\eta_k(s)=\mathbf{E}\bb{\mathbf{E}\bb{K(x, X_1, \{Z_j\}_{j=1}^s) \mid X_1}^2} = \frac{1}{(2s-1)\,k^2} \bp{\sum_{t=0}^{2k-2}\frac{a_t}{b_t}}\,,
\end{equation*}
where sequences $\bc{a_t}_{t=0}^{2k-2}$ and $\bc{b_t}_{t=0}^{2k-2}$ are defined as
\begin{equation*}
a_t = \sum_{i=\max \bc{0, t-(k-1)}}^{\min \bc{t, k-1}} \binom{s-1}{i}\,\binom{s-1}{t-i} \quad \quad \text{and} \quad \quad
b_t = \sum_{i=0}^t \binom{s-1}{i}\,\binom{s-1}{t-i}
\end{equation*}
\end{lemma}
We can substitute $\eta_k(s)$ in Theorem \ref{thm:normality} to prove asymptotic normality of the $k$-NN estimator. Before that, we establish the asymptotic variance of this estimator $\sigma_{n,j}(x)$, up to the smaller order terms.
\begin{theorem}[Asymptotic Variance of $k$-NN]\label{thm:knn_var_range}
Let $j \in [p]$ be one of coordinates. Suppose that $k$ is constant while $s\rightarrow \infty$. Then, for the $k$-NN kernel
\begin{equation}
\label{eqn:knn-var}
\sigma_{n,j}^2(x) = \frac{s^2}{n}\frac{\sigma_{j}^2(x)}{k^2\,(2s-1)}\,\zeta_k + o(s/n)\,,
\end{equation}
where $\sigma_j^2(x)=\Var\bb{\ldot{e_j}{M_0^{-1}\psi(Z; \theta(x))}\mid X=x}$ and $\zeta_k = k + \sum_{t=k}^{2k-2} 2^{-t} \sum_{i=t-k+1}^{k-1} \binom{t}{i}.$
\end{theorem}
Combining results of Theorem \ref{thm:normality}, Theorem \ref{thm:knn_var_range}, Corollary \ref{cor:exp-kernel-shrink-kNN}, and Lemma \ref{lem:kNN-inc} we have:
\begin{theorem}[Asymptotic Normality of $k$-NN Estimator]\label{thm:knn-normality}
Suppose that $\mu$ is $(C,d)$-homogeneous on $B(x,r)$. Let Assumptions \ref{ass:mse}, \ref{ass:normality} hold and suppose that Algorithm \ref{alg:DNN} is executed with $B\geq (n/s)^{5/4}$ iterations. Suppose that $s$ grows at a rate such that $s \rightarrow \infty$, $n/s \rightarrow \infty$, and also $s^{-1/d} (n/s)^{1/2} \rightarrow 0$. Let $j \in [p]$ be one of coordinates and $\sigma^2_{n,j}(x)$ be defined in Equation \eqref{eqn:knn-var}. Then,
\begin{equation*}
\frac{\hat{\theta}_j(x)-\theta_{j}(x)}{\sigma_{n,j}(x)} \rightarrow \mathsf{N}(0,1)\,.
\end{equation*}
Finally, if $s = n^{\beta}$ and $B\geq n^{\frac{5}{4}(1-\beta)}$ with $\beta \in (d/(d+2),1)$. Then,
\begin{equation*}
\frac{\hat{\theta}_j(x)-\theta_{j}(x)}{\sigma_{n,j}(x)} \rightarrow \mathsf{N}(0,1)\,.
\end{equation*}
\end{theorem}
\paragraph{Plug-in confidence intervals.} Observe that the Theorem \ref{thm:knn_var_range} implies that if we define $\tilde{\sigma}_{n,j}^2(x)=\frac{s^2}{n}\frac{\sigma_j^2(x)}{2s-1}\,\frac{\zeta_k}{k^2}$ as the leading term in the variance, then $\frac{\sigma_{n,j}^2(x)}{\tilde{\sigma}_{n,j}^2(x)}\rightarrow_p 1$. Thus, due to Slutsky's theorem
\begin{equation}
\frac{\hat{\theta}_j-\theta_{j}}{\tilde{\sigma}_{n,j}^2(x)}=\frac{\hat{\theta}_j-\theta_{j}}{\sigma_{n,j}^2(x)}\frac{\sigma_{n,j}^2(x)}{\tilde{\sigma}_{n,j}^2(x)} \rightarrow_d \mathsf{N}(0,1)\,.
\end{equation}
Hence, we have a closed form solution to the variance in our asymptotic normality theorem. If we have an estimate $\hat{\sigma}_j^2(x)$ of the variance of the conditional moment around $x$, then we can build plug-in confidence intervals based on the normal distribution with variance $\frac{s^2}{n}\frac{\hat{\sigma}_j^2(x)}{2s-1}\,\frac{\zeta_k}{k^2}$. Note that $\zeta_k$ can be calculated easily for desired values of $k$. For instance, we have $\zeta_1 = 1, \zeta_2 = \frac{5}{2},$ and $\zeta_3 = \frac{33}{8}$ and for $k=1,2,3$ the asymptotic variance becomes $\frac{s^2}{n}\frac{\hat{\sigma}_j^2(x)}{2s-1}, \frac{5}{8}\frac{s^2}{n}\frac{\hat{\sigma}_j^2(x)}{2s-1},$ and $\frac{11}{24}\frac{s^2}{n}\frac{\hat{\sigma}_j^2(x)}{2s-1}$ respectively.
\subsection{Adaptive choice for $s$}\label{ssec:adapt}
According to Theorem \ref{thm:knn-mse}, picking $s = \Theta(n^{d/(d+2)})$ would trade-off between bias and variance terms. Also, according to Theorem \ref{thm:knn-normality}, picking $s = n^\beta$ with $d/(d+2) < \beta < 1$ would result in asymptotic normality of the estimator. However, both choices depend on the unknown intrinsic dimension of $\mu$ on the ball $B(x,r)$. Inspired by \cite{kpotufe2011k}, we explain a data-driven way for estimating $s$.
Suppose that $\delta >0$ is given. Let $C_{n,p,\delta} = 2 \log(2p n/\delta)$ and pick $\Delta \geq \Delta_{\mathcal{X}}$. For any $k \leq s \leq n$, let $H(s)$ be the $U$-statistic estimator for $\epsilon(s)$ defined as $H(s) = \sum_{S \in [n]: |S|=s} \max_{X_i \in H_k(x,S)} \|x-X_i\|_2 / \binom{n}{s} $. Each term in the summation computes the distance of $x$ to its $k$-nearest neighbor on $S$ and $H(s)$ is the average of these numbers over all $\binom{n}{s}$ possible subsets $S$ (see Remark \ref{rem:H} in Appendix \ref{app:missings} regarding to efficient computation of $H(s)$). Define $G_\delta(s) = \Delta \sqrt{C_{n,p,\delta} ps/n}$. Iterate over $s=n,\cdots,k$. Let $s_2$ be the smallest $s$ for which we have $H(s) > 2G_\delta(s)$ and let $s_1 = s_2+1$. Note that $\epsilon_k(s)$ is decreasing in $s$ and $G_\delta(s)$ is increasing in $s$. Therefore, there exists a unique $1 \leq s^* \leq n$ such that $\epsilon_k(s^*) \leq G_\delta(s^*)$ and $\epsilon_k(s^*-1) > G_\delta(s^*-1)$. We have following results.
\begin{proposition}[Adaptive Estimation]\label{thm:est-adapt}
Let Assumptions of Theorem \ref{thm:knn-mse} hold. Suppose that $s_1$ is the output of the above process. Let $s_* = 9s_1+1$ and suppose that Algorithm \ref{alg:DNN} is executed with $s=s_*$ and $B \geq n/s_*$. Then w.p. at least $1-2\delta$ we have $\|\hat{\theta} - \theta(x)\|_2 = O(G_{\delta}(s^*)) =O \bp{\bp{\frac{n}{p\log(2pn/\delta)}}^{-1/(d+2)}}$. Further, for $\delta = 1/n$ we have $\sqrt{\mathbf{E}\bb{\|\hat{\theta} - \theta(x)\|_2^2}} = \tilde{O}\bp{n^{-1/(d+2)}}$.
\end{proposition}
\begin{proposition}[Adaptive Asymptotic Normality]\label{thm:normal-adapt}
Let Assumptions of Theorem \ref{thm:knn-normality} hold. Suppose that $s_1$ is the output of the above process when $\delta = 1/n$ and $s_* = 9s_1+1$. For any $\zeta \in (0, (\log(n)-\log(s_1)-\log\log^2(n))/\log(n)))$ define $s_{\zeta} = s_* n^{\zeta}$. Suppose that Algorithm \ref{alg:DNN} is executed with $s=s_{\zeta}$ and $B \geq (n/s_{\zeta})^{5/4}$, then for any coordinate $j \in [p]$, we have
$\frac{\hat{\theta}_j(x)-\theta_{j}(x)}{\sigma_{n,j}(x)} \rightarrow \mathsf{N}(0,1)\,.$
\end{proposition}
\bibliographystyle{plainnat}
| {'timestamp': '2019-06-19T02:06:15', 'yymm': '1901', 'arxiv_id': '1901.03719', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03719'} | arxiv |
\section{Introduction}\label{sec:intro}
Suppose a sample $S$ of $n$ individuals is taken from a population $U$ of size $N$.
We assign indicators $\delta_i \in \{0,1\}$ to each individual with probability of selection $P(\delta_i = 1) = \pi_i$. Often the probabilities $\pi_i$ are related to the response of interest $y_i$. The balance of information of the observed sample $y_i \in S$ is different from the balance of information in the population $y_i \in U$. We call such a sampling design \emph{informative}. To account for this imbalance, survey weights $d_i = 1/\pi_i$ are used to reduce bias. For example, an unbiased and consistent estimate of the population mean is
$\hat{\mu} = \sum_{S} d_i y_i / \sum_{S} d_i$. Consistent estimation for more general models can be based on the exponentiated likelihood: $L^{\pi}(\theta) = \prod_{S}p(y_i|\theta)^{d_i}$. Use of this pseudo-likelihood provides for consistent estimation of $\theta$ for a broad class of population models \citep{Savitsky16}.
Without weights $\mathbf{d}$, estimates for $\mu$ and $\theta$ are often biased. However, direct use of weights $\mathbf{d}$ may be problematic. For example, not all sampled units may respond. This may lead to bias or at least under-estimation of totals. The use of sampling weights may also be inefficient, leading to larger variances, particularly for sub-population estimates. Some of these issues may be ameliorated if external population information is available (such as totals $\mathbf{t}_2$). Survey weights can then be adjusted to match population level information $\mathbf{d} \rightarrow \mathbf{w}$ such that $\mathbf{A}_2 \mathbf{w} = \mathbf{t}_2$. Finally, weights can be bounded to increase the stability of resulting estimates, $\mathbf{w} \in \{1,M\}$ for some bound $M$.
The focus of this work are insights and tools rooted in optimization, in particular the adjustment of survey sampling weights to meet equality constraints and range restrictions (bounds). However, we first consider the relationship between the optimization perspective presented here and the underlying goals of inference from surveys and statistical models. The current work is complementary as it seeks to provide tools to arrive at reasonable, usable weights, which can either be used directly or as an input to more complex estimation methods \citep[for example, see][]{Chen17}
\subsection{Combining Auxiliary Data with Survey Data}
\citet{Breidt17} provide a thorough review of model-assisted estimators which combine survey data and auxiliary information to estimate finite population parameters. Several methods can be reformulated as weight adjustments (independent of the survey response); however, response-specific adjustments (or collections of them) are often desirable. In both cases, variable selection may be needed, subsetting the auxiliary variables (e.g. population totals) for exclusion or for possible penalization \citep{Bocci08, Montanari09}.
Consider a population mean $\bar{y}_{N}$ and vectors of means of population auxiliary variables $\mathbf{\bar{x}}_{N}$ and a sample vector from the population $\mathbf{y}' = (y_1, \ldots, y_n)$ with corresponding sample weight vector $\mathbf{d}$ and matrix of auxiliary variables $\mathbf{X}$. Then a least squares estimator
$\hat{y}_{ls} = \mathbf{y'd + y'\Omega X (X'\Omega X)}^{\minus 1}(\mathbf{\bar{x}}_{N} - \mathbf{X'd})$ where $\mathbf{\Omega}$ is a scaling matrix.
This estimator can be formulated as a regression model \citep{Isaki82}:
$\hat{y}_{ls} = \bar{y}_{\pi} + (\mathbf{\bar{x}}_{N} - \mathbf{\bar{x}}_{\pi})' \hat{\boldsymbol{\beta}}_{ls}$ with $\bar{y}_{\pi} = \mathbf{y'd}$ and $\mathbf{\bar{x}}_{\pi} = \mathbf{X'd}$
or as a weight adjusted Horvitz-Thompson estimator \citep{Deville92}:
$\hat{y}_{ls} = \mathbf{y'w}$ with
\[
\mathbf{w} = \mathbf{d }+ \mathbf{\Omega X (X'\Omega X)}^{\minus 1}(\mathbf{\bar{x}}_{N} - \mathbf{X'd})
= \mathbf{d} + \boldsymbol{\eta}
= \mathbf{d} + \mathbf{\Omega X} \boldsymbol{\lambda}.
\]
Here $\boldsymbol{\eta} = \mathbf{\Omega X} \boldsymbol{\lambda}$ is an element-wise offset to the sampling weights and $\boldsymbol{\lambda}$ is the vector of Lagrange multipliers needed to ensure the simultaneous constraints $\mathbf{X'w} = \mathbf{\bar{x}}_{N}$ are met exactly.
While model-assisted estimation focuses on alternatives to the model
$(\mathbf{\bar{x}}_{N} - \mathbf{\bar{x}}_{\pi})' \hat{\boldsymbol{\beta}}_{ls}$ and inferences based on
$\hat{\boldsymbol{\beta}}_{ls} = \mathbf{y'\Omega X (X'\Omega X)}^{\minus 1}$
or difference estimators linked to $\bar{y}_{\pi}$ \citep{Breidt17}, an optimization perspective will focus on the Lagrange multipliers $\boldsymbol{\lambda} = \mathbf{(X'\Omega X)}^{\minus 1}(\mathbf{\bar{x}}_{N} - \mathbf{X'd})$
and offset $\boldsymbol{\eta}$ to address the complexities of constraints and restrictions on $\mathbf{w}$ and strategies for computation.
For example, \cite{Mcconville17} use a LASSO technique to shrink the $\hat{\boldsymbol{\beta}}_{ls}$ to $\mathbf{0}$, which leads to the \emph{exclusion} of variables (columns of $\mathbf{X}$) and is dependent on the response $\mathbf{y}$. We describe a method that shrinks the discrepancy $(\mathbf{\bar{x}}_{N} - \mathbf{X'd})$ to $\mathbf{0}$ which leads to the \emph{inclusion} of variables and is independent of $\mathbf{y}$.
As an alternative to model-assisted estimation, a predictive modeling approach may be used to motivate estimation of population quantities \citep{Little93}. Like model-assisted estimation, performance of methods and the need for weights in analyses are typically dependent on the response $\mathbf{y}$. Weight adjustment methods that are applied to all responses will lead to varied results, increasing the variance of estimates unrelated to the auxiliary information and decreasing the mean squared errors of estimates related to that information \citep{Little05}. \citet{Salgado12} advocate for loosening the multipurpose requirement (only one weight per observation, regardless of inference) but note several challenges to consider for official statistics.
\subsection{Modelling Concepts}
Outside of survey sampling, the methods presented in this work have connections to penalized likelihood and Bayesian formulations, which we briefly outline here. The linear calibrated weights
$\mathbf{w} = \mathbf{d }+ \mathbf{\Omega X (X'\Omega X)}^{\minus 1}(\mathbf{t} - \mathbf{X'd})$
are the solution to a minimization
$\lambda(\mathbf{w}) = (\mathbf{w} - \mathbf{d})' \mathbf{\Omega}^{\minus 1}(\mathbf{w} - \mathbf{d})$
within the constrained space $\mathbf{X'w} = \mathbf{t}$.
If we assume the very simple model for $\mathbf{z} = \mathbf{X}'\mathbf{w}$ with $\mathbf{z} \sim N(\mathbf{t}, \alpha \mathbf{\Sigma})$
and prior distribution $\mathbf{w} \propto N(\mathbf{d}, \mathbf{\Omega})$, then an estimate for $\mathbf{w}$ based on maximizing the posterior would be
\[
\mathbf{w}_{MAP} = \mathbf{d }+ \mathbf{\Omega X} (\mathbf{X'\Omega X} + \alpha\mathbf{\Sigma})^{\minus 1}(\mathbf{t} - \mathbf{X'd})
\]
Scaling the matrix $\mathbf{\Sigma}^{\minus 1}$ (or exponentiating the likelihood) by a factor $\alpha \in (1,\infty)$ is analogous to observing more data and thus increasing the importance of the likelihood relative to the prior. Since direct measurement of individual $w_i$ never occurs in the likelihood, the posterior distribution $p(\mathbf{w}|\mathbf{z})$ converges to a distribution on a simplex defined by $\mathbf{X}'\mathbf{w} = \mathbf{t}$ rather than to a degenerate point distribution. This is the basis of the method of data cloning \citep{Lele07} to evaluate which parameters are identifiable for maximum likelihood estimation by having distributions collapse to points where unidentifiable parameters collapse to non-degenerate distributions instead of points.
Alternatively, one could also propose that the distribution for $\mathbf{w}$ is the likelihood and the distribution for $\mathbf{z}$ is actually a penalty.
Then $\mathbf{w}_{MAP}$ is also a ridge estimator \citep{Rao97}. \citet{Tibshirani11} consider the case when $\mathbf{z}$ has a Laplace distribution centered at $\mathbf{t}=\mathbf{0}$ and formulate a generalized LASSO.
While methods exist for inference on compositional data \citep[see for example][]{Aitchison82} and benchmarked time series \citep{Pizzinga10}, results are based on linear projections and simple transformations. The optimization perspective in this current work supplements this by considering more complicated support $\mathbf{w} \in \mathbb{C} \subset \mathbb{R}^n$ which involves not only equality constraints, but also inequalities in the form of allowable ranges. While the working models (or objective functions) may be quite simple, the support or `feasible regions' are complex. In particular, this work explores what can be done when these regions are empty (i.e. no solution exists). Application of more sophisticated models could only follow after these complex regions are explored and understood via simpler working models.
\subsection{An Optimization Perspective}
For simplicity of presentation, we focus on survey weight adjustment and refer to it broadly as calibration. Calibration includes post-stratification and extreme-weight adjustment and may include certain types of non-response adjustments \citep{Sarndal05}.
A major difficulty in calibration could be referred to as constraint identifiability and compatibility with other restrictions. A collection of constraints may be internally inconsistent if the column rank of the predictor matrix is less than the number of predictors. For example, the sample data may not contain observations for every crossing of demographic control variables, such as Age by Race by State.
When including a restricted solution space such as $\mathbf{w} \in [\mathbf{l}, \mathbf{u}]$, even consistent constraints may lead to an empty feasible region in which no set of points can satisfy all constraints. As an example, consider the calibration of a set of sampling weights to meet a large number of targets such as demographic counts crossed with geographic variables.
Final weights are restricted to fall within a specified range or change a certain percentage from the original sample weights to reduce the impact of extreme values and the increase of variance due to unequal distribution of weights. The result of these additional restrictions is that the feasible region, which would otherwise contain weights satisfying all these restrictions and constraints, is likely to be empty. One approach is to ignore this issue and provide algorithms for achieving a solution when one exists \citep{Singh96}. Variations of relaxing constraints have been developed \citep{Rao97, Therberge00, Fetter05, Montanari09, Bocci08, Park09, Breidt17}. Another approach would be to relax the restrictions (weight ranges) or prioritize targets. This prioritization is then used to iteratively include targets or aggregate (collapse) variable levels \citep{Lamas15, MRB:PersonWeight:2014}.
Through a combination of insights from survey analysis and other areas of statistics such as path-algorithms \citep{Tibshirani11, Zhou13} and data-cloning \citep{Lele07, Lele10}, we present a new framework and accompanying tools for addressing the challenge of simultaneous optimization and constraint selection. The focus shifts from finding one optimal solution to finding one or more reasonable solutions which satisfy most of the constraints and restrictions. This framework provides the flexibility to compromise in a systematic but customizable way including the
\begin{itemize}
\item Use of the most popular deviance (distance) measures
\item Use of range restrictions for weights
\item Use of point and interval constraints (controls)
\item Ability to identify and target subsets of weights and constraints which may be driving non-existence of a solution
\end{itemize}
Results are produced without combinatoric operations such as brute force evaluations of all possible combinations of inclusion/exclusion of constraints and restrictions. Instead, the user is provided with both a partially constrained solution and diagnostics suggesting why a fully constrained solution is not possible.
In Section \ref{sec:motiv}, we establish notation and examine a post-stratification example from the National Survey on Drug Use and Health (NSDUH). Section \ref{sec:approach} describes the general approach as a synthesis of conceptual and computational tools. Section \ref{sec:app} revisits the NSDUH example in more detail. Section \ref{sec:guide} discusses experiences and suggestions for working with larger data sets. Section \ref{sec:ext} provides ideas for future work and points out areas where theory needs to be further developed. Section \ref{sec:conc} reiterates the conclusions for this work. Code for the implementation was created in R \citep{R17} and is available from the authors.
\section{Motivating Example: Post-stratification for the National Survey on Drug Use and Health}\label{sec:motiv}
The following provides baseline notation for optimization which can be modified according to whether our purpose is sample weight calibration:
\begin{itemize}
\item Let $\mathbf{y}$ represent the vector of original, unconstrained values ($\mathbf{y}=\mathbf{d}$ for sample weights). We wish to find the closest values $\mathbf{x}$ to $\mathbf{y}$ such that the linear constraints $\mathbf{A}_{1} \mathbf{x}=\mathbf{t}_{1}$ are satisfied (for non-linear constraints, see Section \ref{sec:ext}). We measure `closeness' by a deviance $\delta_{1} (\mathbf{x}|\mathbf{y},\mathbf{Q}_{1})$ with scaling matrix $\mathbf{Q}_{1}$. The simplest example is the quadratic deviance $(\mathbf{x}-\mathbf{y})'\mathbf{Q}_{1} (\mathbf{x}-\mathbf{y})$, but there are several other reasonable choices (see Section \ref{sec:approach}).
\item Additionally, we may impose a penalty to pull the linear combination $\mathbf{A}_{2} \mathbf{x}$ towards a `soft' target $\mathbf{t}_2$ which does not have to be met exactly. The penalty can conveniently take the form of $\alpha \delta_{2} (\mathbf{A}_{2} \mathbf{x}|\mathbf{t}_{2},\mathbf{Q}_{2})$, which is a deviance scaled by a penalty factor $\alpha >0$.
\item Finally, we impose restrictions on the solution $\mathbf{x}$. For example, we want $\mathbf{b}_{l} \le \mathbf{x} \le \mathbf{b}_{u}$ or more generally $\mathbf{R} \mathbf{x} \le \mathbf{b}$, where $\mathbf{b} = (\mathbf{b}_{l},\mathbf{b}_{u})$ are the lower and upper bounds and $\mathbf{R}$ is a matrix of indicators. This is common for calibration where final weights are often required to be at least 1 and less than some threshold to control for extreme values.
\end{itemize}
As an example, we examine the final weight adjustment step for the 2014 National Survey on Drug Use and Health (NSDUH), sponsored by the Substance Abuse and Mental Health Services Administration (SAMHSA). NSDUH is the primary source for statistical information on illicit drug use, alcohol use, substance use disorders (SUDs), mental health issues, and their co-occurrence for the civilian, non-institutionalized population of the United States. The final analysis weight is a product of five inverse probabilities of selection corresponding to the five stages of nested sampling (three geographic, household, individual) and weighting adjustments for non-response, post-stratification, and extreme weight trimming at different stages \citep{MRB:PersonWeight:2014}. The final weighting model is a post-stratification to population control totals and is performed separately for the nine US Census divisions.
For illustration, we focus on one model for the New England division. Table \ref{tab:analwt} summarizes the demographic variables used for the adjustment including the number of levels proposed and those achieved. The comments for each variable set indicate all the deviations from the proposed variables due to convergence problems (i.e. no solution) and enforcing a hierarchy of constraints (e.g. two-factor levels only included for corresponding one-factor levels included). The process of performing this adjustment was iterative, involving several adjustments when convergence or singularity issues were encountered. Out of 267 possible population controls, 196 constraints were used. If we look at the rank of the observed variables in the sample, the $\mathbf{A}$ matrix is 267 by 5791 and has an estimated rank of 257. Thus we expect to miss at least 10 constraints. Four predictors are not observed in the sample data. Then there are essentially 6 more variables than needed in the sample data. However, reducing the dimension any further is not straight-forward. One reason why the number of achieved targets is lower than 257 is because each weight was restricted to lay within a range of values, bounded away from 0. This additional restriction reduces the number of possible constraints. After discussing the methods and general principles, we will revisit this example to demonstrate that more constraints can be achieved while still maintaining the range restrictions for the weights. Furthermore, this process can be performed in a minimally supervised way without stopping and restarting to drop or collapse variables.
\begin{table}
\begin{center}
\caption{Covariates for 2014 NSDUH Person Weights (res.per.ps), Model Group 1: New England \citep[see][Exhibit D1.5]{MRB:PersonWeight:2014}.
\emph{Coll.} Levels collapsed together; \emph{ Conv.} Model not convergent; \emph{Drop.} Levels collapsed into reference set; \emph{ Sing./zero.} Levels removed due to singularities or zero sample size; \emph{ Keep.} Levels kept and the remainder dropped.}
{\scriptsize
\begin{tabular}{|lrrrl|}
\hline
{\bf Variables}&{\bf Levels}&{\bf Proposed}&{\bf Final}&{\bf Comments}\\ \hline
\emph{One-Factor Effects}&&\emph{20}&\emph{20}&\\ \hline
Intercept&1&1&1&All levels present.\\
State&6&5&5&All levels present.\\
Quarter&4&3&3&All levels present.\\
Age&6&5&5&All levels present.\\
Race (5 levels)&5&4&4&All levels present.\\
Gender&2&1&1&All levels present.\\
Hispanicity&2&1&1&All levels present.\\ \hline
\emph{Two-Factor Effects}&&\emph{95}&\emph{90}&\\ \hline
Age x Race (3 levels)&6 x 3&10&10&All levels present.\\
Age x Hispanicity&6 x 2&5&5&All levels present.\\
Age x Gender&6 x 2&5&5&All levels present.\\
Race (3 levels) x Hispanicity&3 x 2&2&2&All levels present.\\
Race (3 levels) x Gender&3 x 2&2&2&All levels present.\\
Hispanicity x Gender&2 x 2&1&1&All levels present.\\
State x Quarter&6 x 4&15&15&All levels present.\\
State x Age&6 x 6&25&25&All levels present.\\
State x Race (5 levels)&6 x 5&20&15& Coll. (2,3), (2,4) \& (2,5), repeat\\
& & & & VT, coll. (4.3) \& (4,4); conv. \\
State x Hispanicity&6 x 2&5&5&All levels present.\\
State x Gender&6 x 2&5&5&All levels present.\\ \hline
\emph{Three-Factor Effects}&&\emph{152}&\emph{86}&\\ \hline
Age x Race (3 levels) x Hispanicity&6 x 3 x 2&10&8& Drop (5,2/3,1); conv.\\
Age x Race (3 levels) x Gender&6 x 3 x 2&10&8& Drop (5,2/3,1); conv.\\
Age x Hispanicity x Gender&6 x 2 x 2&5&5&All levels present.\\
Race (3 levels) x Hispanicity x Gender&3 x 2 x 2&2&2&All levels present.\\
State x Age x Race (3 levels)&6 x 5 x 3&50&12& Coll. (1,1,2) \& (1,1,3), repeat age\\
& & & &levels 2, 3, and 4, coll. (2,1,2) \&\\
& & & & (2,1,3), coll. (3,1,2) \& (3,1,3), repeat \\
& & & & age levels 2 and 3, coll. (4,1,2) \& \\
& & & & (4,1,3), repeat age levels 2 and 3, \\
& & & & coll. (5,1,2) \& (5,2,3); sing./zero/conv.\\
State x Age x Hispanicity&6 x 6 x 2&25&12& Drop (1,5,1), (2,*,1), (3,4/5,1), \\
& & & & (4,5,1), (5,2/3/4/5,1); \\
& & & & sing./zero/conv.\\
State x Age x Gender&6 x 6 x 2&25&25&All levels present.\\
State x Race (3 levels) x Hispanicity&6 x 3 x 2&10&4& Coll. (1,2,1) \& (1,3,1), coll. (3,2,1) \& \\
& & & &(3,3,1), keep (4,2,1), (4,3,1), \\
& & & &drop others; conv.\\
State x Race (3 levels) x Gender&6 x 3 x 2&10&6& Drop (2,2/3,1), (5,2/3,1); conv.\\
State x Hispanicity x Gender&6 x 2 x 2&5&4& Drop (5,1,1); conv.\\ \hline
\emph{Total}&&\emph{267}&\emph{196}&\\ \hline
\end{tabular}
\label{tab:analwt}
}
\end{center}
\end{table}
\FloatBarrier
\section{General Approach}\label{sec:approach}
This section breaks the framework into individual components. We first discuss the conceptual formulation and the versatility of the deviance measure (Section \ref{sec:dev}). We then discuss computational strategies for solving a simplified optimization without penalties (Section \ref{sec:solver}). We next demonstrate how to extend this functionality to include penalization (Section \ref{sec:penalty}). Lastly, we combine all components (Section \ref{sec:synth}) to create a general strategy demonstrated in more detail for the NSDUH example (Section \ref{sec:app}).
\subsection{Choices for Deviances}\label{sec:dev}
First, consider penalization and equality constraints without the additional restrictions on ranges or rounding. The objective function would take the form:
\begin{equation}
\label{eq:optim}
\min_{\mathbf{x}_1} \left\{ \delta_1(\mathbf{x}_1|\mathbf{y},\mathbf{Q}_1) + \alpha \delta_2(\mathbf{A}_2 \mathbf{x}_1|\mathbf{t}_2, \mathbf{Q}_2) \right\},
\text{ s.t. } \mathbf{A}_1 \mathbf{x}_1 = \mathbf{t}_1.
\end{equation}
We can make the following connections:
\begin{itemize}
\item $\alpha \delta_2$ can be seen as a deviance on the transformed variables $\mathbf{x}_2 = \mathbf{A}_2 \mathbf{x}_1$, with scaling matrix $\alpha \mathbf{Q}_2$.
\item The equality constraint $\mathbf{A}_1 \mathbf{x}_1 = \mathbf{t}_1$ is equivalent to having another penalty $\beta \delta_3(\mathbf{A}_1 \mathbf{x}_1|\mathbf{t}_1, \mathbf{Q}_3)$ with $\beta \rightarrow \infty$
\end{itemize}
Thus each of the three pieces in the optimization above is related to a deviance $\delta$.
We highlight the quadratic and three other popular choices of smooth deviances and describe the critical non-smooth absolute difference deviance and its extensions. The smooth deviances are differentiable at 0 and can all be considered as members of a general class corresponding to adjustments which take the unconstrained value $\mathbf{y}$ and apply element-wise adjustments $\boldsymbol{\eta}(\mathbf{A,t})$ to obtain the constrained $\mathbf{x} = h[\boldsymbol{\eta}]$ where $[.]$ signifies element-wise operations inside. \citet{Deville92} formulate the adjustment as multiplicative: $h[\boldsymbol{\eta}] = [\mathbf{y} g[\boldsymbol{\eta}]]$. However this is awkward for some deviances, such the quadratic whose adjustment is clearly additive: $h[\boldsymbol{\eta}] = \mathbf{y} + \boldsymbol{\eta}$ vs. $g[\boldsymbol{\eta}] = 1 + [\boldsymbol{\eta}/\mathbf{y}]$. Instead, we generalize slightly by removing this multiplicative formulation and working with $h[\boldsymbol{\eta}]$ directly instead of $g[\boldsymbol{\eta}]$. The non-smooth deviances are critical for regression coefficient and constraint selection \citep{Zhou13, Nocedal06}. They are not differentiable at 0, making computation and analytical properties more complex. However, they can be expressed as the limit of iteratively rescaling members of the smooth deviance class (See Section \ref{sec:penalty}).
\subsubsection{Smooth Deviances}\label{sec:smoothdev}
The four most popular smooth deviances are (i) the quadratic deviance, (ii) the Poisson deviance, (iii) the discrimination information deviance, and (iv) the logistic deviance.
The quadratic deviance has the simplest form $\delta(\mathbf{x|y,Q}) = \mathbf{(x-y)'Q(x-y)}$ with symmetric, invertible, and usually positive definite or semi-definite scaling matrix $\mathbf{Q}$. Final solutions $\mathbf{x}$ can be expressed as the element-wise additive adjustment $\mathbf{x} = \mathbf{y} + \boldsymbol{\eta}$ with $\mathbf{x,y} \in \mathbb{R}^{n}$. The quadratic deviance is used to obtain the restricted least squares estimator \citep{Greene00}, the generalized regression estimator \citep{Isaki82}, and the ridge estimator \citep{Rao97} when used as a penalty.
The Poisson deviance corresponds to the pseudo empirical likelihood \citep{Chen99, Chen02} with $\delta(\mathbf{x|y,Q}) = \mathbf{1'\left< q\right>\left[y \log[y/x] - y + x\right]}$ where $\left< \mathbf{q}\right>$ is a diagonal matrix, usually positive definite and full rank. The solution $\mathbf{x}$ is a product of the unconstrained $\mathbf{y}$ and a multiplicative adjustment $\mathbf{x} = [\mathbf{y}/(\mathbf{1}-\boldsymbol{\eta})]$ with $\mathbf{x,y} \in \mathbb{R}_{+}^{n}$. This is sometimes referred to as the Likelihood approach.
The discrimination information deviance \citep{Ireland68} is also known as the Kullback-Leibler divergence and is sometimes referred to as exponential tilting \citep{Kim10}. It is the measure being minimized by the procedure known as iterative proportional fitting or `raking' \citep{Deming40}. Raking has many applications, including the adjustment of vector-valued cells \citep{Peitzmeier88}. This deviance measure is very similar to the Poisson deviance with the roles of $\mathbf{x}$ and $\mathbf{y}$ switched: $\delta(\mathbf{x|y,Q}) = \mathbf{1'\left< q\right>\left[x \log[x/y] - x + y\right]}$. This leads to an appealing element-wise multiplicative adjustment $\mathbf{x} = [\mathbf{y}\exp[\boldsymbol{\eta}]]$ with $\mathbf{x,y} \in \mathbb{R}_{+}^{n}$. Combining the Poisson and the discrimination deviances, a symmetric deviance is achieved: $\delta(\mathbf{x|y,Q}) = \mathbf{1'\left< q\right>\left[(x-y) \log[x/y] \right]}$.
The logistic deviance was presented by \citet{Deville92} as one approach to keep weights within specified bounds:
\[
\delta(\mathbf{x|y,Q},\mathbf{b}_l,\mathbf{b}_u) = \mathbf{1'\left< q\right>} \left[(\mathbf{x}-\mathbf{b}_l) \log[(\mathbf{x}-\mathbf{b}_l)/(\mathbf{y}-\mathbf{b}_l)] + (\mathbf{b}_u - \mathbf{x}) \log[(\mathbf{b}_u - \mathbf{x})/(\mathbf{b}_u - \mathbf{y})] \right]
\]
with limits $\mathbf{x,y} \in [\mathbf{b}_l, \mathbf{b}_u]$. Often, the logistic deviance is parameterized in terms of a ratio adjustment to $\mathbf{y}$ with bounds $\mathbf{b}_{l}^{*} \le \mathbf{1} \le \mathbf{b}_{u}^{*}$ \citep{Deville92, Folsom00}. Starting from $\delta(\mathbf{x|y,Q},\mathbf{b}_l,\mathbf{b}_u)$, the logistic deviance could be motivated as a combination of shifted and reflected discrimination information deviances. However its name and purpose are more obvious when viewing the relationship between the final $\mathbf{x}$ and the adjustments to $\mathbf{y}$: $\mathbf{x} = \Phi_{log}\left[\boldsymbol{\eta} + \Phi^{\minus 1}_{log}\left[(\mathbf{y} - \mathbf{b}_l)/(\mathbf{b}_u - \mathbf{b}_l) \right] \right](\mathbf{b}_u - \mathbf{b}_l) + \mathbf{b}_l$ where $\Phi_{log}$ is the probability function for a logistic random variable, $\Phi^{\minus 1}_{log}$ is the quantile function, and $\phi_{log}$ is the density function.
The solution $\mathbf{x}$ is a scaled, shifted, and re-centered probability function. Evaluating the logistic distribution functions:
\[
\mathbf{x}=\left(\frac{(\mathbf{y}-\mathbf{b}_l ) e^{\boldsymbol{\eta}}}{(\mathbf{b}_u-\mathbf{y})+(\mathbf{y}-\mathbf{b}_l )} e^{\boldsymbol{\eta}} \right)(\mathbf{b}_u-\mathbf{b}_l )+\mathbf{b}_l= \frac{\mathbf{b}_l (\mathbf{b}_u-\mathbf{y})+\mathbf{b}_u (\mathbf{y}-\mathbf{b}_l ) e^{\boldsymbol{\eta}}}{(\mathbf{b}_u-\mathbf{y})+(\mathbf{y}-\mathbf{b}_l ) e^{\boldsymbol{\eta}}}
\]
The formulation on the right \citep{Deville92} tends to obscure the connection to distribution functions. However, retaining the connection has benefits: (i) It suggests trying alternative symmetric distributions such as Gaussian, Laplace, student’s t, etc. Asymmetric distributions might also be used. This would be analogous to alternatives to logistic regression such as probit regression. In practice, there may be little difference in results, but some distributions might lead to computational efficiencies or increased stability. (ii) Using distribution functions directly in computation is more stable, because they are defined on the extended real numbers. For example, the expression $e^{\eta}/(1+e^{\eta})$ yields `not a number' results for software when $\eta = \infty$ and unstable results when $\eta$ is very large. In contrast, statistical software correctly maps $\Phi_{log} (-\infty)= 0$ and $\Phi_{log} (\infty)= 1$ and tolerates large finite inputs. The same is true for density functions. Therefore some scaling and centering tricks needed to stabilize the computation using the formulation of \citet{Deville92} become unnecessary when using the distributional formulation.
\subsubsection{Non-smooth Deviances}\label{sec:absdev}
We now consider non-smooth deviances based on the absolute difference function. The absolute difference measure and its variants are used for quantile estimation \citep{Koenker01} and controlled rounding problems \citep{Cox82}. It is particularly useful as a non-smooth penalty in LASSO regression \citep{Tibshirani96} and constrained optimization \citep{Nocedal06}, because non-smooth functions can achieve subset selection (such as forcing regression coefficients to zero) for finite penalties $(\alpha)$. The deviance $\delta(\mathbf{x|y,Q}) = \mathbf{1'\left< q\right>|x-y|}$ is simple, but the expression for $\mathbf{x}$ is more complicated. Fortunately, we can solve for $\mathbf{x}$ by iteratively rescaling a quadratic deviance \citep{Fan01, Lange00, Hunter04}. Then $\mathbf{x}^k=\mathbf{y}+\boldsymbol{\eta}(\mathbf{x}^{k-1})$, for iterations $k=1,2,\ldots$
It can happen that the input $\mathbf{y}$ is specified as an interval $[\mathbf{y}_l,\mathbf{y}_u]$ rather than a point. The most useful case occurs when we use the penalty deviance $\delta_2(\mathbf{A}_2 \mathbf{x}_1|\mathbf{t}_2, \mathbf{Q}_2)$ from system \ref{eq:optim}. For example, we may want to loosen the bounds on the total number of people reporting two or more race categories for a state by specifying an acceptable range rather than a specific target: $\mathbf{t}_2 \in [\mathbf{t}_l,\mathbf{t}_u]$.
Then any final weights $\mathbf{x}_1$ which leads to an estimate $\mathbf{A}_2 \mathbf{x}_1 \in [\mathbf{t}_l,\mathbf{t}_u]$ will be equally acceptable by having the same minimum value for the penalty function $\delta_2(\mathbf{A}_2 \mathbf{x}_1|\mathbf{t}_2, \mathbf{Q}_2)$. In order to implement this, we can extend the absolute difference measure centered on the point $\mathbf{y}$ to a measure centered at intervals:
$\delta(\mathbf{x}|\mathbf{y}_l,\mathbf{y}_u,\mathbf{Q}) = \mathbf{1'\left< q\right>} \left[|\mathbf{x}-\mathbf{y}_l | + |\mathbf{x}-\mathbf{y}_u | - |\mathbf{y}_{u} - \mathbf{y}_{l} | \right]$. The last term is fixed with respect to $\mathbf{x}$, so we can equivalently use:
\[
\delta(\mathbf{x}|\mathbf{y}_l,\mathbf{y}_u,\mathbf{Q}) = \mathbf{1'\left< q\right>}[|\mathbf{x}-\mathbf{y}_l | + |\mathbf{x}-\mathbf{y}_u |] =
\delta(\mathbf{x}|\mathbf{y}_l,\mathbf{Q}) + \delta(\mathbf{x}|\mathbf{y}_u,\mathbf{Q}),
\]
which is equal to the sum of two absolute difference deviances centered at points $\mathbf{y}_l$ and $\mathbf{y}_u$ with common scaling $\left< \mathbf{q} \right>$. As $\alpha$ increases, the penalty outside $[\mathbf{y}_l,\mathbf{y}_u]$ becomes steeper, forcing values closer to the interval (Figure \ref{fig:int_pen}). In contrast, using a two-piece quadratic penalty at $\mathbf{y}_l$ and $\mathbf{y}_u$ will not achieve the desired effect. It is equivalent to using a single quadratic penalty at midpoint $\mathbf{y} = (\mathbf{y}_l + \mathbf{y}_u)/2$, with rate $2 \alpha$ vs. the usual $\alpha$. For this `interval deviance', there is clearly not a unique minimizer $\mathbf{x}$. This is not a problem if used as a penalty $\alpha \delta_2$ as proposed above instead of the base measure $\delta_1$. For our example, we can stack
$\delta_2(\mathbf{A}_2 \mathbf{x}_1|\mathbf{t}_l,\mathbf{Q}_2)$ and $\delta_2(\mathbf{A}_2 \mathbf{x}_1|\mathbf{t}_u,\mathbf{Q}_2)$, doubling the number of penalty terms (See Section \ref{sec:penalty}).
The analogy would be to have a flat ridge in the likelihood $\delta_2$, but have identifiability of parameters maintained due to the prior distribution $\delta_1$. In this case, a unique maximizer of the likelihood would not exist, but a unique maximizer of the posterior distribution would exist.
\begin{figure}
\centering
\includegraphics[width = 0.45\textwidth,
page = 1,clip = true, trim = 0in 0.25in 0in 0.25in]{Interval_Penalties.pdf}
\includegraphics[width = 0.45\textwidth,
page = 3,clip = true, trim = 0in 0.25in 0in 0.25in]{Interval_Penalties.pdf}\\
\includegraphics[width = 0.45\textwidth,
page = 2,clip = true, trim = 0in 0.25in 0in 0.25in]{Interval_Penalties.pdf}
\includegraphics[width = 0.45\textwidth,
page = 4,clip = true, trim = 0in 0.25in 0in 0.25in]{Interval_Penalties.pdf}
\caption{Non-smooth absolute difference (left) and smooth quadratic (right) penalties. One-piece centered a $x=1$ (top) and two-piece centered at $x = 0.5, 1.5$ (bottom) for
$\alpha = 1,2,4,8,16,32$ (blue to yellow).}
\label{fig:int_pen}
\end{figure}
In addition to using the deviances mentioned, we can also partition $\mathbf{x}'=[\mathbf{x}'_1,\mathbf{x}'_2]$ and apply distinct deviances to each partition (for example logistic to $\mathbf{x}_1$ and quadratic to $\mathbf{x}_2$). The adjustment vector $\boldsymbol{\eta}$ is applied element-wise to the unconstrained value $\mathbf{y}$ to obtain $\mathbf{x}$. \emph{This does not mean that each element of the $\boldsymbol{\eta}$ adjustment vector is independent of each other or of $\mathbf{y}$}. It means that the \emph{final} step of solving for $\mathbf{x}$ is an element-wise operation, so we can compartmentalize the process to create “mixed” deviances. In other words, we can use distinct deviance families $\delta_1 (\mathbf{x}_1)$ and $\delta_2 (\mathbf{x}_2)$ but treat them in abstract for computation as $\delta (\mathbf{x})$. The real benefit here is the computational compartmentalization, where the first partition is the weights and the second are the controls (linear combinations of weights). The mixed deviance formulation allows us to implement different families of deviance measures for these two pieces. For example, we can now use a logistic deviance on the weights $\delta_1$ and a quadratic (or absolute difference) penalty on the controls $\delta_2$.
\subsection{Solution Equations and Solvers}\label{sec:solver}
The four smooth deviances each have the following properties: The derivatives
$\mathbf{\partial_{x} \delta(x|y,Q)} = \mathbf{Q} \delta^{(1)}(\mathbf{x|y})$
can be decomposed into a scaling matrix ($\mathbf{Q}$ or $\left< \mathbf{q} \right>$) times a vector of element-wise functions on $\mathbf{x}$ and $\mathbf{y}$. In particular, we define $\boldsymbol{\eta}=\delta^{(1)}(\mathbf{x|y})$. Then we have $\mathbf{x} = h[\boldsymbol{\eta}|\mathbf{y}]$ where $h$ is the element-wise inverse of $\delta^{(1)}(\mathbf{x|y})$. Next we consider the simplified optimization:
\begin{equation}
\label{eq:opsimp}
\min_\mathbf{x} \left\{ \delta(\mathbf{x|y,Q}) \right\}, \text{ s.t. } A \mathbf{x} = \mathbf{t}
\end{equation}
Using the method of Lagrange Multipliers \citep[see, for example][]{Stewart11}, a solution $\mathbf{x}$ will satisfy the condition that the derivatives of the objective function are parallel (equal up to a set of scaling factors $\boldsymbol{\lambda}$ to the derivatives of the constraint function:
$\mathbf{Q} \delta^{(1)}(\mathbf{x|y}) = \mathbf{A}'\boldsymbol{\lambda}$
then
$\delta^{(1)}(\mathbf{x|y}) = \mathbf{Q}^{\minus 1} \mathbf{A}' \boldsymbol{\lambda}$.
Then applying $h[.]$ and $\mathbf{A}$ to each side, we arrive at solution equations for $\mathbf{x}$ and $\boldsymbol{\lambda}$:
\begin{equation}
\label{eq:est}
\begin{array}{r@{=}l}
\mathbf{x} & h[\mathbf{Q}^{\minus 1} \mathbf{A}' \boldsymbol{\lambda}]\\
\mathbf{t} & \mathbf{A} h[\mathbf{Q}^{\minus 1} \mathbf{A}' \boldsymbol{\lambda}]
\end{array}
\end{equation}
For the quadratic deviance, $h[\boldsymbol{\eta}] = \mathbf{y} + \boldsymbol{\eta}$, so the solution is closed form
\begin{equation}
\label{eq:quad.sol}
\mathbf{x} = \mathbf{y} + \mathbf{Q}^{\minus 1}\mathbf{A}'( \mathbf{A}\mathbf{Q}^{\minus 1}\mathbf{A}')^{\minus 1}(\mathbf{t} - \mathbf{Ay}).
\end{equation}
Otherwise, a solution can be found via iterative methods. From the set of equations (\ref{eq:est}), it can be shown that the solution $\mathbf{x}$ is invariant to full rank rotations of the rows of $\mathbf{A}$. For example, changing the reference levels for categorical variables within $\mathbf{A}$ will lead to identical results, as one might expect. It also can be shown that the solution $\mathbf{x}$ is invariant to multiplication by a finite scalar. Thus differential scaling by a vector is needed to produce alternative values for $\mathbf{x}$. There is an equivalence between replacing rows and columns in $\mathbf{Q}$ with zeros and adding equality constraints of the form $x_i = y_i$ to the $\mathbf{A}$ matrix \citep{Williams13}, which can also be used to produce modified solutions $\mathbf{x}$ (See Section \ref{sec:penalty}).
To solve for $\mathbf{x}$ in (\ref{eq:est}), we can apply Newton's Method to solve for $\boldsymbol{\lambda}$ \citep{Stewart11}. After convergence, we then evaluate $\mathbf{x} = h[\boldsymbol{\eta}^{j}]$ directly. For the four smooth deviances, the Newton step will be:
\begin{equation}
\label{eq:Newt}
\boldsymbol{\lambda}^{j+1} = \boldsymbol{\lambda}^{j} + \left[ \mathbf{A} \mathbf{Q}^{\minus 1}
\left< h^{(1)} [\boldsymbol{\eta}^{j}] \right>
\mathbf{A}' \right]^{\minus 1}
\times \left( \mathbf{t} - \mathbf{A} h[\boldsymbol{\eta}^{j}] \right)
\end{equation}
with $\boldsymbol{\eta}^{j} = \mathbf{Q}^{\minus 1} \mathbf{A}' \boldsymbol{\lambda}^{j}$ and
$\partial_{\boldsymbol{\eta}} h(\boldsymbol{\eta}) = \left< h^{(1)}[\boldsymbol{\eta}]\right>$ is diagonal.
This is a direct application of Newton's method and is essentially the same as in \citet{Deville92}, with the matrix operations expressed more explicitly. It can also be expanded to a two-level method when constraints are non-linear \citep{Williams13}. Functions $h$ and $h^{(1)}$ for each of the smooth deviances are provided in Table \ref{tab:h}, which extends Table 1 in \citet{Deville92} by providing $h^{(1)}$ needed for computation and including explicit expressions for the logistic deviance in terms of the distribution functions.
\begin{table}
\centering
\caption{Mappings $\mathbf{x} = h[\boldsymbol{\eta}|\mathbf{y}]$ and derivatives $h^{(1)}[\boldsymbol{\eta}|\mathbf{y}]$ for four smooth deviances.}
\begin{tabular}{|l|c|c|}
\hline
{\bf Deviance} & $h[\boldsymbol{\eta}|\mathbf{y}]$ & $h^{(1)}[\boldsymbol{\eta}|\mathbf{y}]$\\ \hline
Quadratic & $ \mathbf{y} + \boldsymbol{\eta}$ & $\mathbf{1}$ \\ \hline
Poisson & $ \mathbf{y}[\mathbf{1}- \boldsymbol{\eta}]^{\minus 1}$ & $ \mathbf{y}[\mathbf{1}- \boldsymbol{\eta}]^{\minus 2}$\\ \hline
Discrimination & $ \mathbf{y} \exp[\boldsymbol{\eta}]$ & $ \mathbf{y} \exp[\boldsymbol{\eta}]$ \\ \hline
Logistic & $\Phi_{log}\left[\boldsymbol{\eta} + \boldsymbol{\mu} \right](\mathbf{b}_{u} - \mathbf{b}_{l}) + \mathbf{b}_{l}$ &
$\phi_{log}\left[\boldsymbol{\eta} + \boldsymbol{\mu} \right](\mathbf{b}_{u} - \mathbf{b}_{l})$\\
&\multicolumn{2}{c|}{$\boldsymbol{\mu} = \Phi^{\minus 1}_{log}\left[(\mathbf{y} - \mathbf{b}_{l})/(\mathbf{b}_u - \mathbf{b}_l)\right]$} \\ \hline
\end{tabular}
\label{tab:h}
\end{table}
Range restrictions of the form $\mathbf{b}_{l} \le \mathbf{x} \le \mathbf{b}_{u}$ can be incorporated in at least two ways.
(i) We could choose the quadratic deviance and use quadratic programming approaches. The general quadratic program solves the following:
\begin{equation}
\label{eq:qp}
\min_\mathbf{x} \left\{\mathbf{x'Qx/2+x'c } \right\}, \text{ s.t. } \mathbf{A}_{1} \mathbf{x} = \mathbf{t} \text{ and } \mathbf{A}_{2} \mathbf{x} \ge \mathbf{b}
\end{equation}
In our case $\mathbf{c}= -\mathbf{Qy}$ would correspond to the quadratic deviance. One major drawback for the application of weight adjustment is that inequalities for each $x_i$ need to be added as rows of $\mathbf{A}_{2}$.
For more technical details and a variety of methods to solve for $\mathbf{x}$, see Chapter 16 of \citet{Nocedal06}.
(ii) Alternatively, we can choose the logistic deviance which automatically enforces $\mathbf{b}_{l} \le \mathbf{x} \le \mathbf{b}_{u}$. In contrast to quadratic programming, it does not increase the number of equations needed. We recommend Newton’s method for the applications discussed here due to its speed and flexibility and the availability of good starting points (Section \ref{sec:guide}). Modifications to the Newton method, such as the line search or trust region methods, may improve stability and convergence at the cost of reduced speed and added complexity \citep{Nocedal06}. The techniques in the remainder of this section manipulate equation systems \ref{eq:opsimp} and \ref{eq:est} and therefore apply to both the Newton method and quadratic programming methods.
\subsection{Augmentation, Scaling, and Rescaling}\label{sec:penalty}
A key insight from system \ref{eq:optim} is that all three pieces of the optimization (deviance, penalty, and equality constraints) are related. We can now reparameterize the original objective \ref{eq:optim} as a much simpler form \ref{eq:opsimp} which does not have explicit penalty terms (note labels $\mathbf{x}_1$ and $\mathbf{x}_2$):
\begin{equation}\label{eq:aug}
\begin{array}{rll}
\min_{\mathbf{x}_{1}} \left\{ \delta_1(\mathbf{x}_{1}|\mathbf{y}_{1},\mathbf{Q}_{1}) \right.
&+ \ \left. \alpha \delta_2(\mathbf{A}_{2} \mathbf{x}_{1}|\mathbf{t}_{2}, \mathbf{Q}_{2}) \right\}, &
\text{ s.t. } \mathbf{A}_{1} \mathbf{x}_{1} = \mathbf{t}_{1},\\
&\equiv \min_\mathbf{x} \left\{ \delta(\mathbf{x|d,Q}) \right\} & \text{ s.t. } \mathbf{A x} = \mathbf{t}.
\end{array}
\end{equation}
We first parameterize $\mathbf{x}_{2} = \mathbf{A}_{2} \mathbf{x}_{1}$ centered at $\mathbf{y}_{2} = \mathbf{t}_{2}$. We then stack $\mathbf{x}' = [\mathbf{x}_{1}', \mathbf{x}_{2}']$ and $\mathbf{y}' = [\mathbf{y}_{1}', \mathbf{y}_{2}']$. Next we define the block-diagonal scaling matrix $\mathbf{Q} = \left< \mathbf{Q_1}, \alpha \mathbf{Q}_{2}\right>$.
We incorporate the constraints $\mathbf{A}_{1} \mathbf{x}_{1}=\mathbf{t}_{1}$ and $\mathbf{A}_{2} \mathbf{x}_{1} - \mathbf{x}_{2} =\mathbf{0}$ with constraint matrix $\mathbf{A} =
\left[\begin{array}{cc}
\mathbf{A}_{1} &\mathbf{0} \\
\mathbf{A}_{2} & \minus \mathbf{I}
\end{array} \right]$
, targets $\mathbf{t}' = [\mathbf{t}_{1}', \mathbf{0}']$, and multipliers $\boldsymbol{\lambda}' = [\boldsymbol{\lambda}_{1}', \boldsymbol{\lambda}_{2}']$.
Here we note that if $\mathbf{A}_{1}$ is full (row) rank, then $\mathbf{A}$ will also be.
This is the basis of the ridge stabilization method for the quadratic \citep{Rao97, Montanari09} and other deviances \citep{Bocci08} and the related mixed model formulation \citep{Park09, Breidt17}. Ridge stabilization has $\mathbf{t}_1$ empty with all controls in $\mathbf{t}_2$. The mixed model formulation has `fixed' controls in $\mathbf{t}_1$ and `random' controls in $\mathbf{t}_2$. By distributing the penalty term into the augmented base measure and the augmented equality constraints, the objective function is now parameterized as the simplified second line of equation \ref{eq:aug} and the optimization methods in Section \ref{sec:solver} can be directly applied. Like other augmented or latent-variable methods, such as the Expectation Maximization algorithms \citep{Dempster77} and the Gibbs sampler for probit regression \citep{Albert93}, this approach trades an increase in dimension for simplicity and more direct computation. If we require additional range restrictions we have at least two ways to generate solutions for system \ref{eq:opsimp}; the Newton method for logistic deviance and quadratic programming for the quadratic deviance. These would also provide reasonable starting points when using the other deviances both in terms of initial values for $\mathbf{x}$ and in identification of active constraints to include in $\mathbf{t}_1$ vs. $\mathbf{t}_2$.
The augmented form \ref{eq:aug} also allows for direct manipulation of the scaling factors $\mathbf{Q}_2$ corresponding to targets.
Although typically thought of as weights (e.g. weighted least squares), we refer to $\mathbf{Q}$ and its diagonal version $\left< \mathbf{q} \right>$ as scaling factors to avoid confusion when working with sampling weights ($\mathbf{y = d}$ and $\mathbf{x = w}$).
There are often default choices for $\mathbf{Q}$ such as the identity matrix or the inverse of a variance-covariance matrix. In addition, we can manipulate and rescale portions of $\mathbf{Q}$ to introduce additional functionality into our original system $\ref{eq:est}$.
To see how the scaling matrix $\mathbf{Q}$ relates to other system components, we first partition $\mathbf{x}' = [\mathbf{x}'_{A}, \mathbf{x}'_{C}]$.
The corresponding scale matrix is then
$\mathbf{Q} = \left[\begin{array}{cc}
\mathbf{Q}_{A} & \mathbf{Q}_{B} \\
\mathbf{Q}_{B}' & \mathbf{Q}_{C}
\end{array}\right]$.
Next we define
$\mathbf{Q}_{0} = \left[\begin{array}{cc}
\mathbf{Q}_{A} & \mathbf{0}\\
\mathbf{0}' & \mathbf{0}
\end{array}\right]$
and
$\mathbf{Q}_{\alpha} = \left[\begin{array}{cc}
\mathbf{Q}_{A} & \alpha^\rho \mathbf{Q}_{B} \\
\alpha^\rho \mathbf{Q}_{B}' & \alpha \mathbf{Q}_{C}
\end{array}\right]$ for $\alpha > 0$ and $\rho < 1/2$.
Based on these alternative $\mathbf{Q}$ matrices, we have two very useful properties: (i)
Using the Moore-Penrose generalized inverse
$\mathbf{Q}_{0}^{\minus} = \left[\begin{array}{cc}
\mathbf{Q}_{A}^{\minus 1} & \mathbf{0}\\
\mathbf{0}' & \mathbf{0}
\end{array}\right]$
in place of $\mathbf{Q}^{\minus 1}$ in the solution equations (\ref{eq:est}) is \emph{equivalent} to adding the equality constraint $\mathbf{x}_{C} = \mathbf{y}_{C}$ \citep{Williams13}.
(ii) Replacing $\mathbf{Q}^{\minus 1}$ with $\mathbf{Q}_{\alpha}^{\minus 1}$ in system \ref{eq:est} penalizes $\mathbf{x}_{C} \ne \mathbf{y}_{C}$ by a factor $\alpha$. As $\alpha \rightarrow \infty$, $\mathbf{Q}_{\alpha}^{\minus 1} \rightarrow \mathbf{Q}_{0}^{\minus}$ (See Appendix \ref{app:limits}). Thus the limit of penalized equations is equality constrained equations.
As mentioned in Section \ref{sec:absdev}, the non-smooth deviances may be considered extensions of the smooth deviances. Since the absolute difference deviance is not differentiable at $\mathbf{x=y}$, it does not fit directly into the simple derivative-based approach \ref{eq:est}. However, we can solve this system iteratively by using a smooth deviance and rescaling $\mathbf{Q}$. In particular, we can use the quadratic deviance
$\delta(\mathbf{x^{i + 1}|y,Q}) =
(\mathbf{x}^{i + 1}-\mathbf{y})'\left<\boldsymbol{\kappa}^i \right>^{\minus 1}
\left<\mathbf{q} \right> (\mathbf{x}^{i + 1}-\mathbf{y})$
where we update $\boldsymbol{\kappa}^i =|\mathbf{x}^{i}-\mathbf{y}|$ and solve for $\mathbf{x}^{i + 1}$ until convergence. This can be justified analogously to the implementation of penalized least squares as local quadratic approximations \citep{Fan01} or more generally as minimizing a local bounding function \citep{Lange00, Hunter04}. Here the absolute difference deviance is iteratively bounded locally by a quadratic deviance $\delta(\mathbf{x}^{i}|\mathbf{y,Q})$, which is then minimized and replaced by an updated bounding deviance $\delta(\mathbf{x}^{i + 1}|\mathbf{y,Q})$. Although a value of $\boldsymbol{\kappa}^{0}=\mathbf{1}$ is a good starting point, if we repeat the process for slightly different values of $\mathbf{Q}=\alpha_{k} \left< \mathbf{q} \right>$, using values of $\mathbf{x}$ (and $\boldsymbol{\lambda}$) from similar values of $\alpha_{k-1}$, then convergence may occur more rapidly and iterations would be more stable for large $\alpha$ (See Section \ref{sec:guide}).
\subsection{Synthesis}\label{sec:synth}
Combining the conceptual and computational components of the previous sections, we propose a general strategy which caters to exploratory investigations but can be adjusted for operational production.
\subsubsection*{Identify Conflicting Targets and Plausible Ranges for Weights}
A common starting point for a new weight calibration process is to first use the quadratic deviance and all targets of interest without any range restrictions. \citep{Chen02} suggests using the original weights and initial solutions along with a bisection type approach to relax targets while trying to achieve more range restrictions. However, there may be problems with even getting a solution $(\alpha = \infty)$ if too many targets are specified or corresponding cell counts are small. We can construct a more informative path from $\mathbf{y}=\mathbf{d}$ to $\mathbf{x} = \mathbf{w}$, and explore trade-offs between how close a target needs to be versus how many boundaries are crossed and the increase in dispersion of the weights for a given $\alpha$.
In particular, we start with a quadratic deviance $\delta_1$ and quadratic penalty $\delta_2$. Using the augmentation and scaling techniques of Section \ref{sec:penalty}, we set $\mathbf{A}=[\mathbf{A}_{1}, \minus \mathbf{I}]$ with $\mathbf{A}_{2}=\mathbf{A}_{1}$, $\mathbf{y}_{2}=\mathbf{t}_{1}$ and $\mathbf{t}=\mathbf{0}$. Thus all targets $\mathbf{t}_{1}$ are set to penalties. If we wanted to enforce some constraints exactly, such as the sum of the weights, we could use the more general form of $\mathbf{A}$. As a default, we might choose $\mathbf{Q}_{1} \propto \left< \mathbf{y}_{1} \right>^{\minus 1}$ and $\mathbf{Q}_{2} \propto \mathbf{I}$ which puts the weights on a relative scale and controls on an absolute scale. We select $\alpha$ from a grid of $2^k$ with $k \in \{-m,\ldots,m\}$. We then set $\mathbf{Q} = \left< \mathbf{Q}_{1}, \alpha \mathbf{Q}_{2} \right>$ and solve \ref{eq:aug} for each $\alpha$. Evaluating $\mathbf{A}_{1} \mathbf{x}(\alpha)$ scaled by $\mathbf{t}_1$ and $\mathbf{x}(\alpha)$ vs. $\alpha$ provides useful representations of how weights change and targets are approached as the penalty increases. They indicate when targets cannot be met and when boundaries for weights are crossed. Evaluating weight dispersion vs. $\alpha$ also provides an indication of potential increase in variances of estimates. When not all targets are met, iteratively rescaling $\mathbf{Q}_{2}$ by $\mathbf{\kappa}^{i}=|\mathbf{x}_{2}^{i}-\mathbf{t}_{1} |$ will provide an alternative path in which a subset of these targets can be met at the expense of pushing others farther away.
\subsubsection*{Enforce Range Restrictions}
After using the quadratic deviance to explore the relationship between the targets and weights, we should have a better idea of which weight ranges are plausible. As noted in Section \ref{sec:solver} we can use either the logistic deviance or quadratic programming. For quadratic programming, we use the augmented equations with both the deviance and the penalty as quadratic. We use the same $\mathbf{A}$, $\mathbf{y}$, $\mathbf{t}$, and $\mathbf{Q}_{2}$ inputs. For the Newton method, we use a mixed deviance by combining a logistic deviance for the weights with a quadratic penalty for the targets and choose $\mathbf{Q}_{1} \propto \mathbf{I}$.
\subsubsection*{Replace point targets with interval targets}
In addition to range restrictions, interval targets of the form $\mathbf{t}_{l} \le \mathbf{A}_{2} \mathbf{x} \le \mathbf{t}_{u}$ may be applicable. For example, the estimate of farm land in a county must be between 0 and the total size of the county. Alternatively, controls for small domains often have non-negligible measurement error. Enforcing these inequalities exactly can be accommodated directly with quadratic programming. However, this approach may lead to an empty feasible region. Instead, we can enforce a set of interval penalties. As described in Section \ref{sec:dev}, an absolute difference penalty on the interval $[\mathbf{t}_{l},\mathbf{t}_{u}]$ can be enforced by applying an absolute difference penalty at each of the end-points with a common scaling factor for both. Analogous to the point version, this will pull non-compliant targets towards control bounds.
\section{NSDUH Post-stratification}\label{sec:app}
We revisit the example from Section \ref{sec:motiv}, the 2014 NSDUH final post-stratification step for the New England division. Of the 267 potential controls, Table \ref{tab:analwt} shows that 196 were met, missing 71 controls. However, this count is too low, because some control categories were collapsed. In a strict sense, 105 controls were missed. Table \ref{tab:compare} shows that virtually all these missed controls involved Race, either as a 5-level or 3-level recode. As mentioned in Section \ref{sec:motiv}, the rank of the predictor matrix $\mathbf{A}$ is estimated as 257, so we expect that a solution that misses more than 10 but fewer than 105 controls is possible. The current NSDUH analysis weights (AW) are obtained by fitting a logistic deviance with specified upper and lower bounds based on the distribution of the weights from previous adjustment steps and the need to control for extreme weights. For simplicity and comparability, we use the same bounds for the alternatives presented here. Since this is an annual survey rather than a new data collection, the first step in Section \ref{sec:synth}, identifying conflicting targets (Race) and plausible ranges for weights, has already been done for us. We compare several alternatives which all enforce the provided range restrictions for every weight:
\begin{itemize
\item LL1: Logistic deviance base measure for the weights with absolute difference penalty for the targets.
\item LL1N: Same as LL1, with interval penalties used for all Race factors and interactions. Intervals are $\pm 5$\% of the Census control total.
\item LL2: Logistic deviance base measure for the weights with quadratic penalty for the targets
\item QPL2: Quadratic deviance base measure for the weights with quadratic penalty for the targets with equal scaling and additional restrictions for weights enforced by augmenting the constraint matrix and using quadratic programming methods.
\end{itemize}
For simplicity, comparisons in Table \ref{tab:compare} are based on the number of targets missed, defined in terms of being (i) within rounding (nearest 1,000) of the Census total, or (ii) within 5\% of the target. As discussed in Section \ref{sec:intro}, there are other ways to evaluate weights and the impact on estimation; however, the purpose of this example is identify the space of achievable models (controls) rather than to compare the performance of models, which is a natural next step in an analysis. The LL1 appears to achieve many more controls than AW, missing only 53 in total. If we also include targets that are within 5\% of their Census controls, than all but 34 constraints are met. LL1N provides a small improvement over LL1 leading to 30 constraints being outside of 5\% of the target. Figure \ref{fig:iterationLL1} displays the solution paths for the constraints related to race for both LL1 and LL1N. Both have similar results; however, where race controls using LL1N are collapsed exactly to their targets at 100\% (when achieved), race controls using LL1N are less restricted, often collapsing only to the boundary values of 95\% and 105\%. This allows for some additional flexibility leading to some missed controls moving a little closer to their target values. Figure \ref{fig:iterationLL1} also reveals that some race by age by state controls are fixed at 0. These controls have no observations in the sample, but have population level targets that are non-zero. They represent unachievable targets (rank deficient $\mathbf{A}$) which could be removed. However, it is comforting that the procedure is robust to a certain amount of these inconsistencies and can easily identify them graphically.
Both the LL2 and QPL2 methods lead to very similar results with the same number of targets being missed per variable. They do much worse than the L1 methods in terms of exactly meeting targets, missing 142, but do well keeping targets within 5\% of the control, with only 44 falling outside this range. The main advantage of the L2 methods are that they are simpler to implement. However, the L1 methods are just modified L2 methods (as in Section \ref{sec:approach}), so they are also relatively simple. For a relative speed comparison, the LL1 and LL1N methods each took under 30s to run on a personal computer using sparse matrices with the `Matrix' library \citep{RMatrix} in R \citep[version x64 3.4.2,][]{R17} and a single processor thread using values $\alpha=2^k$ with $k \in \{-14,\ldots,15\}$. The added RAM used was negligible to the overhead from loading R and the data set. The LL2 method ran in about 4s over the same $\alpha$ values. The QPL2 method took around 4 \emph{hours} to run using `solve.QP' from the `quadprog' package \citep{RQP}, requiring an extra 1 to 2GB of RAM depending on the $\alpha$ iteration. The QP method could only use dense matrices and required over 11,000 additional constraints, two for every weight.
We note that all the alternatives presented in Table \ref{tab:compare} have one level of the one-factor Race variable which missed its target. The final weights (AW) do hit this target, because the NSDUH models are fit in succession with the one-factor models, followed by the two- and three-factor. Hierarchical rules are enforced for AW, so models with higher level interactions are forced to include the same levels as the previous lower level models. In contrast, the alternatives presented here are direct simultaneous implementations. Forcing some constraints to be met exactly can be implemented by using distinct $\mathbf{A}_1$ and $\mathbf{A}_2$ matrices as presented in general in Section \ref{sec:approach}, rather than the special case of $\mathbf{A}_2=\mathbf{A}_1$ used here for simplicity of discussion.
\begin{table}
\begin{center}
\caption{Demographic variables for final post-stratification for New England for the 2014 NSDUH.
\emph{AW.} Final analysis weight. \emph{LL1.} Logistic deviance and absolute difference penalty \emph{LL1IN.} Same as LL1 with interval penalty for all Race variables ($\pm 5\%$) \emph{LL2.} Logistic deviance and quadratic penalty \emph{QPL2.} Quadratic programming with quadratic penalty. $^1$ Variables with weighted totals more than 1 unit (1,000’s) different from Census total. LL1N race categories are missed if weighted totals are more than 1 unit outside the ($\pm 5\%$) interval. $^2$ Variables with weighted totals more than $5\%$ different from Census totals.}
{\scriptsize
\begin{tabular}{|lr|*{5}{r}|*{5}{r}|}
\hline
& & \multicolumn{5}{c|}{{\bf Missed}$^1$} & \multicolumn{5}{c|}{{\bf Missed by} $\mathbf{> 5\%}^2$} \\
{\bf Variable} & {\bf Levels} & {\bf AW} & {\bf LL1} & {\bf LL1IN} & {\bf LL2} & {\bf QPL2} & {\bf AW} & {\bf LL1} & {\bf LL1IN} & {\bf LL2} & {\bf QPL2} \\ \hline
\emph{One-Factor Effects} & \emph{20} & \emph{0} & \emph{1} & \emph{1} & \emph{6} & \emph{6} & \emph{0} & \emph{1} & \emph{1} & \emph{1} & \emph{1}\\ \hline
Intercept & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\
State & 5 & 0 & 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 & 0\\
Quarter & 3 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\
Age & 5 & 0 & 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 & 0\\
Race (5 levels) & 4 & 0 & 1 & 1 & 4 & 4 & 0 & 1 & 1 & 1 & 1\\
Gender & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\
Hispanicity & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\ \hline
\emph{Two-Factor Effects} & \emph{95} & \emph{11} & \emph{14} & \emph{8} & \emph{50} & \emph{50} & \emph{11} & \emph{6} & \emph{5} & \emph{12} & \emph{12}\\ \hline
Age x Race (3 levels) & 10 & 0 & 5 & 2 & 10 & 10 & 0 & 4 & 2 & 2 & 2\\
Age x Hispanicity & 5 & 0 & 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 & 0\\
Age x Gender & 5 & 0 & 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 & 0\\
Race (3 levels) x Hispanicity & 2 & 0 & 0 & 0 & 2 & 2 & 0 & 0 & 0 & 0 & 0\\
Race (3 levels) x Gender & 2 & 0 & 0 & 0 & 2 & 2 & 0 & 0 & 0 & 0 & 0\\
Hispanicity x Gender & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\
State x Quarter & 15 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\
State x Age & 25 & 0 & 2 & 3 & 11 & 11 & 0 & 0 & 0 & 0 & 0\\
State x Race (5 levels) & 20 & 11 & 7 & 3 & 20 & 20 & 11 & 2 & 3 & 10 & 10\\
State x Hispanicity & 5 & 0 & 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 & 0\\
State x Gender & 5 & 0 & 0 & 0 & 2 & 2 & 0 & 0 & 0 & 0 & 0\\ \hline
\emph{Three-Factor Effects} & \emph{152} & \emph{94} & \emph{38} & \emph{29} & \emph{86} & \emph{86} & \emph{58} & \emph{27} & \emph{24} & \emph{44} & \emph{44}\\ \hline
Age x Race (3 levels) x Hispanicity & 10 & 4 & 5 & 2 & 10 & 10 & 2 & 4 & 2 & 2 & 2\\
Age x Race (3 levels) x Gender & 10 & 4 & 3 & 1 & 7 & 7 & 2 & 1 & 1 & 3 & 3\\
Age x Hispanicity x Gender & 5 & 0 & 0 & 0 & 1 & 1 & 0 & 0 & 0 & 0 & 0\\
Race (3 levels) x Hispanicity x Gender & 2 & 0 & 0 & 0 & 2 & 2 & 0 & 0 & 0 & 0 & 0\\
State x Age x Race (3 levels) & 50 & 50 & 20 & 18 & 39 & 39 & 48 & 20 & 18 & 31 & 31\\
State x Age x Hispanicity & 25 & 20 & 7 & 5 & 11 & 11 & 1 & 0 & 0 & 0 & 0\\
State x Age x Gender & 25 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\
State x Race (3 levels) x Hispanicity & 10 & 8 & 3 & 2 & 10 & 10 & 1 & 2 & 2 & 5 & 5\\
State x Race (3 levels) x Gender & 10 & 6 & 0 & 1 & 4 & 4 & 4 & 0 & 1 & 3 & 3\\
State x Hispanicity x Gender & 5 & 2 & 0 & 0 & 2 & 2 & 0 & 0 & 0 & 0 & 0\\ \hline
\emph{TOTAL} & \emph{267} & \emph{105} & \emph{53} & \emph{38} & \emph{142} & \emph{142} & \emph{69} & \emph{34} & \emph{30} & \emph{57} & \emph{57} \\ \hline
\end{tabular}
\label{tab:compare}
}
\end{center}
\end{table}
\begin{figure}
\centering
\includegraphics[width = 0.90\textwidth,
page = 1,clip = true, trim = 0in 0.5in 0in 0.75in]{Log_L1_All_race_comb.pdf}\\
\includegraphics[width = 0.90\textwidth,
page = 1,clip = true, trim = 0in 0.5in 0in 0.75in]{Log_L1_All_state_by_race_comb.pdf}\\
\includegraphics[width = 0.90\textwidth,
page = 1,clip = true, trim = 0in 0.25in 0in 0.75in]{Log_L1_All_state_by_age_by_race_comb.pdf}
\caption{Solution path for race controls $\mathbf{Ax}$ relative to target values $\mathbf{t}$ across increasing penalty $\alpha$ (left to right). Race (top), race by state (middle), race by age by state (bottom). Comparing LL1 (point controls, solid black) and LL1N (5\% interval controls, dashed blue). Exact achievement and achievement within 5\% tolerance (dotted grey and red lines).}
\label{fig:iterationLL1}
\end{figure}
\FloatBarrier
\section{Practical Guidance}\label{sec:guide}
From the previous section, we have seen that the Newton solver approach works well for a moderate sized data set (5,000+ records, and 250+ constraints). It also scales up well to larger data sets. For example a more complex version of LL1 and LLN ran on 100,000+ records with 200+ controls in about 15 min on a single processor thread with less than 1 GB of available RAM \citep{Lamas15}. To reiterate, the two main reasons for this scalability are (i) the use of the logistic deviance to automatically enforce (hundreds of) thousands of range inequalities and (ii) the direct incorporation of sparse matrix manipulations, particularly sparse matrix multiplication. Thus the effective sizes of the system of equations and the matrix operations are much smaller than their nominal sizes. Since many of these controls are for sub-domains based on categorical variables, the $\mathbf{A}$ matrix is relatively sparse. Using sparse matrix structures can save memory and speed up computation significantly. In principle, quadratic programming could also make use of this sparsity, but its incorporation is more complex. Additionally, the (hundreds of) thousands of range restrictions would greatly increase the dimension of the system of equations.
In some applications, such as coverage adjustments for a census \citep{Lamas15}, the required range restrictions are quite narrow. In practice, a quadratic penalty $\delta_2$ performs poorly in this setting. It attempts to balance all the controls at once and leads to weights that quickly (small $\alpha$) hit their range boundaries without much progress being made toward selecting individual controls. In contrast, the absolute difference penalty is able to discriminate between competing controls and can thus progress much farther (large $\alpha$) before a large enough fraction of weights hit their range boundaries to cause numerical instability.
For any large scale system of equations, numerical stability is critical. Good starting values are especially important for Newton methods. Thus we recommend using the solution $\mathbf{x}(\alpha_{k-1})$ and Lagrange multiplier $\boldsymbol{\lambda}(\alpha_{k-1})$ from the previous iteration with $\alpha_{k-1}=2^{k-1}$ as starting values for the next step $\alpha_k$. In the examples discussed here, a simple doubling of $\alpha$ seems sufficient; however, more sophisticated rules for increasing the penalty are available \citep{Nocedal06}. For simplicity, our stopping rule was fixed $(\alpha =2^m)$. In practice, we may keep increasing $\alpha$ until the procedure reaches numeric instability and fails. Alternatively, we could stop if our current solution $\mathbf{x}(\alpha)$ is a stationary point of the penalty function $\delta_2$ (within a tolerance). Definitions of stationary points for both quadratic and absolute difference functions are available \citep{Nocedal06} and might be extended to this setting. We might also consider informally assessing stationarity with plots of parameters $\boldsymbol{\lambda}$, $\mathbf{x}$, and $\mathbf{Ax}$ vs. $\alpha$, stopping when slopes are close to 0 for large $\alpha$. For example, Figure \ref{fig:iterationLL1} shows that controls have stabilized for the last several iterations of $\alpha$.
Another useful tool to increase stability is to set some minimum thresholds below which weights are exactly equal to one of their boundaries and targets exactly equal to their controls. Setting weights and targets can be done in several ways \citep{Williams13, Pizzinga10} including setting the corresponding scaling factors to 0, augmenting the equality constraints, and reducing the system of equations. For large data sets, there is a trade-off. Creating new matrices in memory and copying values from the old at each $\alpha$ iteration may not be trivial in terms of computation time, even if the resulting system is smaller and more stable. Likely a hybrid approach that sets a criterion for when to trim down the system would be needed.
\section{Extensions and Future Work}\label{sec:ext}
While the above discussion and examples focus on a single step adjustment, multiple steps of sample weight adjustment are common (e.g. NSDUH). One alternative to consider is to simultaneously adjust for all of these components rather than using a series of adjustments \citep{Slud13}. While the work presented here focused on sampling weight adjustments, many of the developments and ideas overlap with the benchmarking of model-based estimates. For example, multiple levels of benchmarking for model-based estimates \citep{Ghosh13} may be represented by multiple penalty terms added to the objective function in equation \ref{eq:optim}. Furthermore, recasting equality constraints as penalties can also be viewed as dealing with external calibration or benchmarking targets which are measured with error \citep{Bell12}. It is our hope the techniques presented here can also be used to enhance benchmarking methods.
The Lagrange system \ref{eq:est} extends naturally to include differentiable non-linear constraints such as ratios \citep{Williams13} and variances \citep{Ghosh92, Datta11}, sometimes with closed form solutions. The Newton method from Section \ref{sec:solver} can be extended by iteratively updating $\mathbf{x}=h[\boldsymbol{\eta}(\mathbf{x})]$ which is now a function of $\mathbf{x}$. Alternatively, we can iteratively apply linear constraints which approximate non-linear ones \citep[see][ch 12]{Knottnerus03}. One example would be to model non-response propensities directly as $\mathbf{x} = \boldsymbol{\rho} \in [0,1]$ with non-linear constraints $g(\mathbf{x})= \mathbf{A}\mathbf{x}^{\minus 1}=\mathbf{t}$, which could be solved with a two-level Newton method iterating both $\mathbf{x}$ and $\boldsymbol{\lambda}$ \citep{Williams13}. These non-linear methods seem to work well for simple functions such as variances and ratios, but there is much room for investigation and improvement.
The methods developed here and the extensions mentioned above fit into the general framework of constrained optimization \citep{Nocedal06}. Although the deviances considered here are convex and the equality constraints are linear, a formal exploration of the Karush-Kuhn-Tucker (KKT) stationarity conditions may be fruitful, especially if we expand to some non-linear functions like variances and ratios. It may be straight forward to show that for a given $\alpha$, the stationary point $\mathbf{x}(\alpha)$ is a local (or even global) solution for the augmented system \ref{eq:aug}, but it is less clear how to interpret these conditions when evaluating the limit of this approach $(\alpha \rightarrow \infty)$, since the original fully constrained and restricted system typically has no solution.
Our approach implicitly assumes that the solution path $\mathbf{x}(\alpha)$ is a continuous function of $\alpha$. For the special case when all constraints can be achieved, it is clearly true for quadratic deviances and penalties \ref{eq:quad.sol} and could be extended to other deviances. However, it is unclear what happens in the case where no solution exists for the original problem. It is uncertain that a unique, continuous solution path $\mathbf{x}(\alpha)$ is guaranteed to exist. But it seems plausible that the approximate path generated by the procedure we develop here can still be useful as a partial or suboptimal solution.
There are connections between these issues and path algorithms for constrained regression \citep{Tibshirani11, Zhou13} and data-cloning methods for evaluating parameter identifiability \citep{Lele07, Lele10}. In addition, the similarity in results for using the logistic deviance and quadratic programming also suggest that large quadratic programming systems might be efficiently approximated with the use of a logistic deviance for simple inequalities and interval penalties for more complex inequalities. More work is needed at the intersection of these areas.
\section{Conclusions}\label{sec:conc}
Even with the need for more research, the framework and supporting methods developed in this paper show extensive applicability. This framework provides the flexibility to compromise in a systematic but customizable way including the
\begin{itemize}
\item Use of all the popular deviance (distance) measures
\item Use of range restrictions for weights
\item Use of point and interval constraints (controls)
\item Ability to identify and target subsets of weights and constraints which may be driving non-existence of a solution
\end{itemize}
As discussed in Section \ref{sec:guide}, the methods scale up well to realistic data requirements.
While unique and optimal solutions are ideal, it is often desirable to consider alternatives that give useful solutions when unique ones are not available. This distinction is relevant when applying these algorithms to the regular production of official statistics. Having an efficient method that reduces dimensions and points the analyst towards a manageable number of alternatives should be competitive with the current methods in the field which often entail highly specific prioritization of targets or complex `guess and check' heuristics.
As we note in the introduction, optimization for weight construction and adjustment is only one component of the process of making inferences from survey data. Therefore an efficient, automated process may be preferred to time-consuming iteratively-constructed customizations. Although the working models (deviances) described here are used extensively for survey weight adjustments, they are very simple and may not seem adequate for other statistical modeling applications. However, this simplicity allows us to explore the solution space and can later be replaced by more complex models once the insights from active constraints and restrictions are better understood.
\vskip 0.2in
\noindent%
{\it Acknowledgements:}
Special thanks to Lanting Dai and RTI International for assistance with the NSDUH files.
\vfill
| {'timestamp': '2019-01-15T02:04:40', 'yymm': '1901', 'arxiv_id': '1901.03791', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03791'} | arxiv |
\section{Introduction}
For a directed graph $G=(V,E)$, with $n = |V|, m=|E|$, the Strongly-Connected Components (SCCs) of $G$ are the sets of the unique partition of the vertex set $V$ into sets $V_1, V_2, .. , V_k$ such that for any two vertices $u \in V_i, v \in V_j$, there exists a directed cycle in $G$ containing $u$ and $v$ if and only if $i=j$. In the Single-Source Reachability (SSR) problem, we are given a distinguished source $r \in V$ and are asked to find all vertices in $V$ that can be reached from $r$. The SSR problem can be reduced to finding the SCCs by inserting edges from each vertex in $V$ to the distinguished source $r$.
Finding SCCs in static graphs in $O(m+n)$ time is well-known since 1972\cite{tarjan1972depth} and is commonly taught in undergraduate courses, also appearing in CLRS\cite{cormen2009introduction}.
In this paper we focus on maintaining SCCs in a dynamic graph. The most general setting is the fully dynamic one, where edges are being inserted and deleted into the graph. While many connectivity problems for undirected graphs have been solved quite efficiently \cite{holm2001poly, wulff2013faster, thorup2000near, thorup2007fully, huang2017fully, nanongkai2017dynamic}, in fully-dynamic graphs, the directed versions of these problems have proven to be much harder to approach.
In fact, Abboud and Vassilevska\cite{abboud2014popular} showed that any algorithm that can maintain whether there are more than 2 SCCs in a fully-dynamic graph with update time $O(m^{1-\epsilon})$ and query time $O(m^{1-\epsilon})$, for any constant $\epsilon > 0$, would imply a major breakthrough on SETH. The same paper also suggests that $O(m^{1-\epsilon})$ update time and query time $O(n^{1-\epsilon})$ for maintaining the number of reachable vertices from a fixed source would imply a breakthrough for combinatorial Matrix Multiplication.
For this reason, research on dynamic SCC and dynamic single-source reachability has focused on the partially dynamic setting (decremental or incremental). In this paper we study the \emph{decremental} setting, where the original graph only undergoes edge deletions (no insertions). We note that both lower bounds above extend to decremental algorithms with \emph{worst-case} update time $O(m^{1-\epsilon})$, so all existing results focus on the amortized update time.
The first algorithm to maintain SSR faster than recomputation from scratch achieved total update time $O(mn)$\cite{shiloach1981line}. The same update time for maintaining SCCs was achieved by a randomized algorithm by Roddity and Zwick\cite{roditty2008improved}. Their algorithm also establishes that any algorithm for maintaining SSR can be turned into a randomized algorithm to maintain the SCCs incurring only an additional constant multiplicative factor in the running time. Later, Łącki\cite{lkacki2013improved} presented a simple deterministic algorithm that matches $O(mn)$ total update time and that also maintains the transitive closure.
For several decades, it was not known how to get beyond total update time $O(mn)$, until a recent breakthrough by Henzinger, Krinninger and Nanongkai\cite{henzinger2014sublinear, henzinger2015improved} reduced the total update time to expected time $O(\min(m^{7/6}n^{2/3}, m^{3/4}n^{5/4+o(1)}, m^{2/3}n^{4/3+o(1)} + m^{3/7}n^{12/7+o(1)})) = O(mn^{0.9+o(1)})$. Even more recently, Chechik et. al.\cite{chechik2016decremental} showed that a clever combination of the algorithms of Roditty and Zwick, and Łącki can be used to improve the expected total update time to $\tilde{O}(m \sqrt{n})$. We point out that all of these recent results rely on randomization and in fact no deterministic algorithm for maintaining SCCs or SSR beyond the $O(mn)$ bound is known for general graphs. For planar graphs, Italiano et. al.\cite{italiano2017decremental} presented a deterministic algorithm with total update time $\tilde{O}(n)$.
Finally, in this paper, we present the first algorithm for general graphs to maintain SCCs in $\tilde{O}(m)$ expected total update time with constant query time, thus presenting the first near-optimal algorithm for the problem. We summarize our result in the following theorem.
\begin{theorem}
\label{thm:SCCmain}
Given a graph $G=(V,E)$ with $m$ edges and $n$ vertices, we can maintain a data structure that supports the operations:
\begin{itemize}
\item $\textsc{Delete}(u,v)$: Deletes the edge $(u,v)$ from the graph $G$,
\item $\textsc{Query}(u,v)$: Returns whether $u$ and $v$ are in the same SCC in $G$,
\end{itemize}
in total expected update time $O(m \log^4 n)$ and with worst-case constant query time. The same time bounds apply to answer for a fixed source vertex $s \in V$ queries on whether a vertex $v \in V$ can be reached from $s$. The bound holds against an oblivious adaptive adversary.
\end{theorem}
Our algorithm makes the standard assumption of an oblivious adversary which does not have access to the coin flips made by the algorithm. But our algorithm does NOT require the assumption of a non-adaptive adversary, which is ignorant of answers to queries as well: the reason is simply that SCC and SSR information is unique, so the answers to queries do not reveal any information about the algorithm. One key exception is that for SSR, if the algorithm is expected to return a witness path, then it does require the assumption of a non-adaptive adversary.
A standard reduction described in appendix \ref{sec:fullyReach} also implies a simple algorithm for maintaining reachability from some set $S \subseteq V$ to $V$ in a fully-dynamic graph with vertex set $V$ that is a data structure that answers queries for any $s \in S, v \in V$ on whether $s$ can reach $v$. The amortized expected update time is $\tilde{O}(|S|m/t)$ and query time $O(t)$ for every $t \in [1, |S|]$. We allow vertex updates, i.e. insertions or deletions of vertices with incident edges, which are more general than edge updates. This generalizes a well-known trade-off result for All-Pairs Reachability\cite{roditty2016fully, lkacki2013improved} with $\tilde{O}(nm/t)$ amortized update time and query time $O(t)$ for every $t \in [1, n]$.
Finally, we point out that maintaining SCCs and SSR is related to the more difficult (approximate) shortest-path problems. In fact, the algorithms \cite{shiloach1981line, henzinger1995fully, henzinger2014sublinear,henzinger2015improved} can also maintain (approximate) shortest-paths in decremental directed graphs. For undirected graphs, the decremental Single-Source Approximate Shortest-Path problem was recently solved to near-optimality\cite{henzinger2014decremental}, and deterministic algorithms\cite{bernstein2016deterministic, bernstein2017deterministic} have been developed that go beyond the $O(mn)$ barrier. We hope that our result inspires new algorithms to tackle the directed versions of these problems.
\section{Preliminaries}
\label{sec:prelim}
In this paper, we let a graph $H = (V,E)$ refer to a directed multi-graph where we allow multiple edges between two endpoints and self-loops but say that a cycle contains at least two distinct vertices. We refer to the vertex set of $H$ by $V(H)$ and the edge set by $E(H)$. We denote the input graph by $G$, let $V= V(G)$ and $E = E(G)$ and define $n = |V|$ and $m = |E|$. If the context is clear, we simply write sets $X$ instead of their cardinality $|X|$ in calculations to avoid cluttering.
We define a subgraph of $H$ to be a graph $H'$ with $V(H') = V(H)$ and $E(H') \subseteq E(H)$. Observe that this deviates from the standard definition of subgraphs since we require the vertex set to be equivalent. We write $H \setminus E'$ as a shorthand for the graph $(V(H), E(H) \setminus E')$ and $H \cup E'$ as a shorthand for $(V(H), E(H) \cup E')$. For any $S \subseteq V(H)$, we define $E^H_{out}(S)$ to be the set $(S \times V(H)) \cap E(H)$, i.e. the set of all edges in $H$ that emanate from a vertex in $S$; we analogously define $E^H_{in}(S)$ and $E^H(S) = E^H_{in}(S) \cup E^H_{out}(S)$. If the context is clear, we drop the superscript and simply write $E_{in}(S), E_{out}(S), E(S)$.
For any graph $H$, and any two vertices $u,v \in V(H)$, we denote by $\mathbf{dist}_H(u,v)$ the distance from $u$ to $v$ in $H$. We also define the notion of $S$-distances for any $S \subseteq V(H)$ where for any pair of vertices $u,v \in V(H)$, the $S$-distance $\mathbf{dist}_H(u,v, S)$ denotes the minimum number of vertices in $S \setminus \{v\}$ encountered on any path from $u$ to $v$. Alternatively, the $S$-distance corresponds to $\mathbf{dist}_{H'}(u,v)$ where $H'$ is a graph with edges $E_{out}(S)$ of weight $1$ and edges $E \setminus E_{out}(S)$ of weight $0$. It therefore follows that for any $u,v \in V(H)$, $\mathbf{dist}_H(u,v) = \mathbf{dist}_H(u,v,V)$.
We define the diameter of a graph $H$ by $\mathbf{diam}(H) = \max_{u,v \in V} \mathbf{dist}_H(u,v)$ and the $S$-diameter by $\mathbf{diam}(H, S) = \max_{u,v \in V(H)} \mathbf{dist}_H(u,v,S)$. Therefore, $\mathbf{diam}(H) = \mathbf{diam}(H, V)$. For convenience, we often omit the subscript on relations if the context is clear and write $\mathbf{dist}(u,v,S)$
We denote that a vertex $u$ \textit{reaches} $v$ in $H$ by $u \leadsto_H v$, and if $u \leadsto_H v$ and $v \leadsto_H u$, we simply write $u \rightleftarrows_H v$ and say $u$ and $v$ are \textit{strongly-connected}. We also use $\leadsto$ and $\rightleftarrows$ without the subscript if the underlying graph $H$ is clear from the context. We say that $H$ is strongly-connected if for any $u,v \in V(H)$, $u \rightleftarrows v$. We call the maximal subgraphs of $H$ that are strongly-connected, the strongly-connected components (SCCs). We denote by $\textsc{Condensation}(H)$ the \textit{condensation} of $H$, that is the graph where all vertices in the same SCC in $H$ are contracted. To distinguish we normally refer to the vertices in $\textsc{Condensation}(H)$ as \textit{nodes}. Each node in $\textsc{Condensation}(H)$ corresponds to a vertex set in $H$. The node set of a condensation $\textsc{Condensation}(H)$ forms a partition of $V(H)$. For convenience we define the function $\textsc{Flatten}(X)$ for a family of sets $X$ with $\textsc{Flatten}(X) = \bigcup_{x \in X} x$. This is useful when discussing condensations. Observe further that $\textsc{Condensation}(H)$ can be a multi-graph and might also contain self-loops. If we have an edge set $E'$ with all endpoints in $H$, we let $\textsc{Condensation}(H) \cup E'$ be the multi-graph obtained by mapping the endpoints of each vertex in $E'$ to their corresponding SCC node in $\textsc{Condensation}(H)$ and adding the resulting edges to $\textsc{Condensation}(H)$.
Finally, for two partitions $P$ and $P'$ of a set $U$, we say that partition $P$ is a \textit{melding} for a partition $P'$ if for every set $X \in P'$, there exists a set $Y \in P$ with $X \subseteq Y$. We also observe that \textit{melding} is transitive, thus if $P$ is a melding for $P'$ and $P'$ a melding for $P''$ then $P$ is a melding for $P''$.
\section{Overview}
\label{subsec:overview}
We now introduce the graph hierarchy maintained by our algorithm, followed by a high-level overview of our algorithm.
\paragraph{High-level overview of the hierarchy.} Our hierarchy has levels $0$ to $\lfloor \lg n \rfloor + 1$ and we associate with each level $i$ a subset $E_i$ of the edges $E$.
The sets $E_i$ form a partition of $E$; we define the edges that go into each $E_i$ later in the overview but point out that we maintain $E_{\lfloor \lg n \rfloor + 1} = \emptyset$. We define a graph hierarchy $\hat{G} = \{\hat{G}_0, \hat{G}_1, .. ,\hat{G}_{\lfloor \lg n \rfloor + 1}\}$ such that each graph $\hat{G}_i$ is defined as
\[
\hat{G}_i = \textsc{Condensation}((V, \bigcup_{j < i} E_j)) \cup E_{i}
\]
That is, each $\hat{G}_i$ is the condensation of a subgraph of $G$ with some additional edges. As mentioned in the preliminary section, we refer to the elements of the set $\hat{V}_i = V(\hat{G}_i)$ as \textit{nodes} to distinguish them from \textit{vertices} in $V$. We use capital letters to denote nodes and small letters to denote vertices. We let $X_i^v$ denote the node in $\hat{V}_i$ with $v \in X_i^v$. Observe that each node $X$ corresponds to a subset of vertices in $V$ and that for any $i$, $\hat{V}_i$ can in fact be seen as a partition of $V$. For $\hat{G}_0 = \textsc{Condensation}((V, \emptyset)) \cup E_{0}$, the set $\hat{V}_0$ is a partition of singletons, i.e. $\hat{V}_0 = \{ \{v\} | v \in V\}$, and $X_0^v = \{ v\}$ for each $v \in V$.
Observe that because the sets $E_i$ form a partition of $E$ and $E_{\lfloor \lg n \rfloor + 1} = \emptyset$, the top graph $\hat{G}_{\lfloor \lg n \rfloor + 1}$ is simply defined as
\[
\hat{G}_{\lfloor \lg n \rfloor + 1} = \textsc{Condensation}((V, \bigcup_{j < \lfloor \lg n \rfloor + 1} E_j)) \cup E_{\lfloor \lg n \rfloor + 1} = \textsc{Condensation}((V,E)).
\]
Therefore, if we can maintain $\hat{G}_{\lfloor \lg n \rfloor + 1} $ efficiently, we can answer queries on whether two vertices $u,v \in V$ are in the same SCC in $G$ by checking if $X_{\lfloor \lg n \rfloor + 1}^u$ is equal to $X_{\lfloor \lg n \rfloor + 1}^v$.
Let us offer some intuition for the hierarchy. The graph $\hat{G}_0$ contains all the vertices of $G$, and all the edges of $E_0 \subseteq E$. By definition of $\textsc{Condensation}(\cdot)$, the nodes of $\hat{G}_1$ precisely correspond to the SCCs of $\hat{G}_0$. $\hat{G}_1$ also includes the edges $E_0$ (though some of them are contracted into self-loops in $\textsc{Condensation}((V, E_0))$), as well as
the additional edges in $E_1$. These additional edges might lead to $\hat{G}_1$ having larger SCCs than those of $\hat{G}_0$; each SCC in $\hat{G}_1$ then corresponds to a node in $\hat{G_2}$. More generally, the nodes of $\hat{G}_{i+1}$ are the SCCs of $\hat{G}_{i}$.
As we move up the hierarchy, we add more and more edges to the graph, so the SCCs get larger and larger. Thus, each set $\hat{V}_i$ is a \textit{melding} for any $\hat{V}_j$ for $j \leq i$; that is for each node $Y \in \hat{V}_j$ there exists a set $X \in \hat{V}_i$ such that $Y \subseteq X$. We sometimes say we \textit{meld} nodes $Y, Y' \in \hat{V}_j$ to $X \in \hat{V}_{i}$ if $Y, Y' \subseteq X$ and $j < i$. Additionally, we observe that for any SCC $Y \subseteq \hat{V}_i$ in $\hat{G}_i$, we meld the nodes in SCC $Y$ to a node in $X \in \hat{V}_{i+1}$, and $X$ consists exactly of the vertices contained in the nodes of $Y$. More formally, $X = \textsc{Flatten}(Y)$.
To maintain the SCCs in each graph $\hat{G}_i$, our algorithm employs a bottom-up approach. At level $i+1$ we want to maintain SCCs in the graph with all the edges in $\bigcup_{j \leq i+1} E_j$, but instead of doing so from scratch, we use the SCCs maintained at level $\hat{G}_i$ as a starting point. The SCCs in $\hat{G}_i$ are precisely the SCCs in the graph with edge set $\bigcup_{j \leq i} E_j$; so to maintain the SCCs at level $i+1$, we only need to consider how the sliver of edges in $E_{i+1}$ cause the SCCs in $\hat{G}_{i}$ to be melded into larger SCCs (which then become the nodes of $\hat{G}_{i+2}$).
If the adversary deletes an edge in $E_i$, all the graphs $\hat{G}_{i-1}$ and below remain unchanged, as do the nodes of $\hat{G}_{i}$. But the deletion might split apart an SCC in $G_i$, which will in turn cause a node of $\hat{G}_{i+1}$ to split into multiple nodes. This split might then cause an SCC of $\hat{G}_{i+1}$ to split, which will further propagate up the hierarchy.
In addition to edge deletions caused by the adversary, our algorithm will sometimes move edges from $E_i$ to $E_{i+1}$. Because the algorithm only moves edges \emph{up} the hierarchy, each graph $\hat{G}_i$ is only losing edges, so the update sequence remains decremental from the perspective of each $\hat{G}_i$. We now give an overview of how our algorithm maintains the hierarchy efficiently.
\paragraph{ES-trees.} A fundamental data structure that our algorithm employs is the ES-tree\cite{shiloach1981line, henzinger1995fully} that for a directed unweighted graph $G=(V,E)$ undergoing edge deletions, and a distinguished source $r \in V$ maintains the distance $\mathbf{dist}_G(r, v)$ for each $v \in V$. In fact, the ES-tree maintains a shortest-path tree rooted at $r$. We refer to this tree subsequently as ES out-tree. We call the ES in-tree rooted at $r$ the shortest-path tree maintained by running the ES-tree data structure on the graph $G$ with reversed edge set, i.e. the edge set where each edge $(u,v) \in E$ appears in the form $(v,u)$. We can maintain each in-tree and out-tree decrementally to depth $\delta > 0$ in time $O(|E| * \delta)$; that is we can maintain the distances $\mathbf{dist}_G(r, v)$ and $\mathbf{dist}_G(v, r)$ exactly
until one of the distances $\mathbf{dist}_G(r, v)$ or $\mathbf{dist}_G(v, r)$ exceeds $\delta$.
\paragraph{Maintaining SCCs with ES-trees.} Consider again graph $\hat{G}_0$ and let $X \subseteq \hat{V}_0$ be some SCC in $\hat{G}_0$ that we want to maintain. Let some node $X'$ in $X$ be chosen to be the \textit{center} node of the SCC (In the case of $\hat{G}_0$, the node $X'$ is just a single-vertex set $\{ v \}$). We then maintain an ES in-tree and an ES out-tree from $X'$ that spans the nodes in $X$ in the induced graph $\hat{G}_0[X]$. We must maintain the trees up to distance $\mathbf{diam}(\hat{G}_0[X])$, so the total update time is $O(|E(\hat{G}_0[X])|* \mathbf{diam}(\hat{G}_0[X]))$.
Now, consider an edge deletion to $\hat{G}_0$ such that the ES in-tree or ES out-tree at $X'$ is no longer a spanning tree. Then, we detected that the SCC $X$ has to be split into at least two SCCs $X_1, X_2, .., X_k$ that are node-disjoint with $X = \bigcup_i X_i$. Then in each new SCC $X_i$ we choose a new center and initialize a new ES in-tree and ES out-tree.
\paragraph{Exploiting small diameter.} The above scheme clearly is quite efficient if $\mathbf{diam}(\hat{G}_0)$ is very small. Our goal is therefore to choose the edge set $E_0$ in such a way that $\hat{G}_0$ contains only SCCs of small diameter. We therefore turn to some insights from \cite{chechik2016decremental} and extract information from the ES in-tree and out-tree to maintain small diameter. Their scheme fixes some $\delta > 0$ and if a set of nodes $Y \subseteq X$ for some SCC $X$ is at distance $\Omega(\delta)$ from/to $\textsc{Center}(X)$ due to an edge deletion in $\hat{G}_0$, they find a node separator $S$ of size $O(\min\{|Y|, |X \setminus Y|\}\log n / \delta)$; removing $S$ from $\hat{G}_0$ causes $Y$ and $X \setminus Y$ to no longer be in the same SCC. We use this technique and remove edges incident to the node separator $S$ from $E_0$ and therefore from $\hat{G}_0$. One subtle observation we want to stress at this point is that each node in the separator set appears also as a single-vertex node in the graph $\hat{G}_1$; this is because each separator node $\{ s\}$ for some $s \in V$ is not \textit{melded} with any other node in $\hat{V}_0$, as it has no edges in $\hat{G}_0$ to or from any other node.
For some carefully chosen $\delta = \Theta(\log^2 n)$, we can maintain $\hat{G}_0$ such that at most half the nodes in $\hat{V}_0$ become separator nodes at any point of the algorithm. This follows since each separator set is small in comparison to the smaller side of the cut and since each node in $\hat{V}_0$ can only be $O(\log n)$ times on the smaller side of a cut.
\paragraph{Reusing ES-trees.} Let us now refine our approach to maintain the ES in-trees and ES out-trees and introduce a crucial ingredient devised by Roditty and Zwick\cite{roditty2008improved}. Instead of picking an arbitrary center node $X'$ from an SCC $X$ with $X' \in X$, we are going to pick a vertex $r \in \textsc{Flatten}(X) \subseteq V$ uniformly at random and run our ES in-tree and out-tree $\mathcal{E}_{r}$ from the node $X_0^r$ on the graph $\hat{G}_0$. For each SCC $X$ we denote the randomly chosen root $r$ by $\textsc{Center}(X)$. In order to improve the running time, we \textit{reuse} ES-trees when the SCC $X$ is split into SCCs $X_1, X_2, .. , X_k$, where we assume wlog that $r \in \textsc{Flatten}(X_1)$, by removing the nodes in $X_2, .., X_k$ from $\mathcal{E}_{r}$ and setting $\textsc{Center}(X_1) = r$. Thus, we only need to initialize a new ES-tree for the SCC $X_2, .. , X_k$. Using this technique, we can show that each node is expected to participate in $O(\log n)$ ES-trees over the entire course of the algorithm, since we expect that if a SCC $X$ breaks into SCCs $X_1, X_2, .. , X_k$ then we either have that every SCC $X_i$ is of at most half the size of $X$, or with probability at least $1/2$ that $X_1$ is the new SCC that contains at least half the vertices, i.e. that the random root is containing in the largest part of the graph. Since the ES-trees work on induced graphs with disjoint node sets, we can therefore conclude that the total update time for all ES-trees is $O(m \log n* \mathbf{diam}(\hat{G}_0))$.
We point out that using the ES in-trees and out-trees to detect node separators as described above complicates the analysis of the technique by Roditty and Zwick\cite{roditty2008improved} but a clever proof presented in \cite{chechik2016decremental} shows that the technique can still be applied. In our paper, we present a proof that can even deal with some additional complications and that is slightly simpler.
\paragraph{A contrast to the algorithm of Chechik et al \cite{chechik2016decremental}.}
Other than our hierarchy, the overview we have given so far largely comes from the algorithm of Chechik et al \cite{chechik2016decremental}. However, their algorithm does not use a hierarchy of graphs. Instead, they show that for any graph $G$, one can find (and maintain) a node separator $S$ of size $\tilde{O}(n/\delta)$ such that all SCCs in $G$ have diameter at most $\delta$. They can then use ES-trees with random sources to maintain the SCCs in $G \setminus S$ in total update time $\tilde{O}(m\delta)$. This leaves them with the task of computing how the vertices in $S$ might meld some of the SCCs in $G \setminus S$. They are able to do this in total update time $\tilde{O}(m|S|) = \tilde{O}(mn/\delta)$ by using an entirely different technique of \cite{lkacki2013improved}. Setting $\delta = \tilde{O}(\sqrt{n})$, they achieve the optimal trade-off between the two techniques: total update time $\tilde{O}(m\sqrt{n})$ in expectation.
We achieve our $\tilde{O}(m)$ total update time by entirely avoiding the technique of \cite{lkacki2013improved} for separately handling a small set of separator nodes, and instead using the graph hierarchy described above, where at each level we set $\delta$ to be polylog rather than $\tilde{O}(\sqrt{n})$.
We note that while our starting point is the same as \cite{chechik2016decremental}, using a hierarchy of separators forces us to take a different perspective on the function of a separator set. The reason is that it is simply not possible to ensure that at each level of the hierarchy, all SCCs have small diameter. To overcome this, we instead aim for separator sets that decompose the graph into SCCs that are small with respect to a different notion of distance. The rest of the overview briefly sketches this new perspective, while sweeping many additional technical challenges under the rug.
\paragraph{Refining the hierarchy.} So far, we only discussed how to maintain $\hat{G}_0$ efficiently by deleting many edges from $E_0$ and hence ensuring that SCCs in $\hat{G}_0$ have small diameter. To discuss our bottom-up approach, let us define our graphs $\hat{G}_i$ more precisely.
We maintain a separator hierarchy $\mathcal{S} = \{S_0, S_1, .. , S_{\lfloor \lg{n} \rfloor + 2}\}$ where $\hat{V}_0 = S_0 \supseteq S_1 \supseteq .. \supseteq S_{\lfloor \lg{n} \rfloor + 1} = S_{\lfloor \lg{n} \rfloor + 2} = \emptyset$, with $|S_i| \leq n/2^i$, for all $i \in [0, \lfloor \lg{n} \rfloor + 2]$ (see below that for technical reasons we need to define $S_{\lfloor \lg{n} \rfloor + 2}$ to define $\hat{G}_{\lfloor \lg{n} \rfloor + 1}$). Each set $S_i$ is a set of single-vertex nodes -- i.e. nodes of the form $\{ v \}$ -- that is monotonically increasing over time.
We can now more precisely define each edge set $E_i = E(\textsc{Flatten}(S_{i} \setminus S_{i+1}))$. To avoid clutter, we abuse notation slightly referring henceforth to $\textsc{Flatten}(X)$ simply as $X$ if $X$ is a set of singleton sets and the context is clear. We therefore obtain
\[
\hat{G}_i = \textsc{Condensation}((V, \bigcup_{j < i} E_j)) \cup E_{i} = \textsc{Condensation}(G \setminus E(S_{i})) \cup E(S_{i} \setminus S_{i+1})).
\]
In particular, note that $\hat{G}_i$ contains all the edges of $G$ except those in $E(S_{i+1})$; as we move up to level $\hat{G}_{i+1}$, we add the edges incident to $S_{i+1} \setminus S_{i+2}$. Note that if $s \in S_{i} \setminus S_{i+1}$, and our algorithm then adds $s$ to $S_{i+1}$, this will remove all edges incident to $s$ from $E_{i}$ and add them to $E_{i+1}$. Thus the fact that the sets $S_i$ used by the algorithm are monotonically increasing implies the desired property that edges only move up the hierarchy (remember that we add more vertices to $S_i$ due to new separators found on level $i-1$).
At a high-level, the idea of the hierarchy is as follows. Focusing on a level $i$, when the ``distances'' in some SCC of $\hat{G}_i$ get too large (for a notion of distance defined below), the algorithm will add a carefully chosen set of separator nodes $s_1, s_2, ..$ in $S_i$ to $S_{i+1}$. By definition of our hierarchy, this will remove the edges incident to the $s_i$ from $\hat{G}_i$, thus causing the SCCs of $\hat{G}_i$ to decompose into smaller SCCs with more manageable ``distances''. We note that our algorithm always maintains the invariant that nodes added to $S_{i+1}$ were previously in $S_i$, which from the definition of our hierarchy, ensures that at all times the separator nodes in $S_{i+1}$ are single-vertex nodes in $\hat{V}_{i+1}$; this is because the nodes of $\hat{V}_{i+1}$ are the SCCs of $\hat{G}_i$, and $\hat{G}_i$ contains no edges incident to $S_{i+1}$.
\paragraph{Exploiting $S$-distances.} For our algorithm, classic ES-trees are only useful to maintain SCCs in $\hat{G}_0$; in order to handle levels $i > 0$ we develop a new generalization of ES-trees that use a different notion of distance. This enables us to detect when SCCs are split in graphs $\hat{G}_i$ and to find separator nodes in $\hat{G}_i$ as discussed above more efficiently.
Our generalized ES-tree (GES-tree) can be seen as a combination of the classic ES-trees\cite{shiloach1981line} and a data structure by Italiano\cite{italiano1988finding} that maintains reachability from a distinguished source in a directed acyclic graph (DAG), and which can be implemented in total update time $O(m)$.
Let $S$ be some feedback vertex set in a graph $G = (V,E)$; that is, every cycle in $G$ contains a vertex in $S$. Then our GES-tree can maintain
$S$-distances and a corresponding shortest-path tree up to $S$-distance $\delta > 0$ from a distinguished source $X_i^r$ for some $r \in V$ in the graph $G$. (See Section \ref{sec:prelim} for the definition of $S$-distances.) This data structure can be implemented to take $O(m\delta)$ total update time.
\paragraph{Maintaining the SCCs in $\hat{G}_i$.} Let us focus on maintaining SCCs in $\hat{G}_i = \textsc{Condensation}(G \setminus E(S_{i})) \cup E(S_{i} \setminus S_{i+1})$. Since the condensation of any graph forms a DAG, every cycle in $\hat{G}_i$ contains at least one edge from the set $E(S_{i} \setminus S_{i+1})$. Since $E(S_{i} \setminus S_{i+1})$ is a set of edges that is incident to $S_i$, we have that $S_i$ forms a feedback node set of $\hat{G}_i$. Now consider the scheme described in the paragraphs above, but instead of running an ES in-tree and out-tree from each center $\textsc{Center}(X)$ for some SCC $X$, we run a GES in-tree and out-tree on $\hat{G}_i[X]$ that maintains the $S_i$-distances to depth $\delta$. Using this GES, whenever a set $Y \subseteq X$ of nodes has $S_i$-distance $\Omega(\delta)$, we show that we can find a separator $S$ of size $O(\min\{|S_i \cap Y|, |S_i \cap (X \setminus Y)|\}\log n / \delta)$ that only consists of nodes that are in $\{\{s\} | s \in S_i\}$; we then add the elements of set $S$ to the set $S_{i+1}$, and we also remove the nodes $Y$ from the GES-tree, analogously to our discussion of regular ES-trees above. Note that adding $S$ to $S_{i+1}$ removes the edges $E(S)$ from $\hat{G}_i$; since we chose $S$ to be a separator, this causes $Y$ and $X \setminus Y$ to no longer be part of the same SCC in $\hat{G}_i$. Thus, to maintain the hierarchy, we must then split nodes in $\hat{G}_{i+1}$ into multiple nodes corresponding to the new SCCs in $\hat{G}_i$: $X \setminus (Y \cup S)$, $Y \setminus S$ and every single-vertex set in $S$ ($Y$ might not form a SCC but we then further decompose it after we handled the node split). This might cause some self-loops in $\hat{G}_{i+1}$ to become edges between the newly inserted nodes (resulting from the split) and needs to be handled carefully to embed the new nodes in the GES-trees maintained upon the SCC in $\hat{G}_{i+1}$ that $X$ is part of. Observe that this does not result in edge insertions but only remaps the endpoints of edges. Further observe that splitting nodes can only increase $S_{i+1}$-distance since when they were still contracted their distance from the center was equivalent. Since $S_{i+1}$-distance still might increase, the update to might trigger further changes in the graph $\hat{G}_{i+1}$.
Thus, overall, we ensure that all SCCs in $\hat{G}_i$ have $S_i$-diameter at most $O(\delta)$, and can hence be efficiently maintained by GES-trees. In particular, we show that whenever an SCC exceeds diameter $\delta$, we can, by moving a carefully chosen set of nodes in $S_i$ to $S_{i+1}$, remove a corresponding set of edges in $\hat{G}_i$, which breaks the large-$S_i$-diameter SCC into SCCs of smaller $S_i$-diameter.
\paragraph{Bounding the total update time.} Finally, let us sketch how to obtain the total expected running time $O(m \log^4 n)$. We already discussed how by using random sources in GES-trees (analogously to the same strategy for ES-trees), we ensure that each node is expected to be in $O(\log n)$ GES-trees maintained to depth $\delta = O(\log^2 n)$.
Each such GES-tree is maintained in total update time $O(m\delta) = O(m\log^2n)$, so we have $O(m \log^3 n)$ total expected update time for each level, and since we have $O(\log n)$ levels, we obtain total expected update time $O(m\log^4 n)$. We point out that we have not included the time to compute the separators in our running time analysis; indeed, computing separators efficiently is one of the major challenges to building our hierarchy. Since implementing these subprocedures efficiently is rather technical and cumbersome, we omit their description from the overview but refer to section \ref{subsec:separators} for a detailed discussion.
\section{Generalized ES-trees}
\label{subsec:EStree}
Even and Shiloach\cite{shiloach1981line} devised a data structure commonly referred to as ES-trees that given a vertex $r \in V$ in a graph $G=(V,E)$ undergoing edge deletions maintains the shortest-path tree from $r$ to depth $\delta$ in total update time $O(m \delta)$ such that the distance $\mathbf{dist}_G(r,v)$ of any vertex $v \in V$ can be obtained in constant time. Henzinger and King\cite{henzinger1995fully} later observed that the ES-tree can be adapted to maintain the shortest-path tree in directed graphs.
For our algorithm, we devise a new version of the ES-trees that maintains the shortest-path tree with regard to $S$-distances. We show that if $S$ is a \textit{feedback vertex set} for $G$, that is a set such that every cycle in $G$ contains at least one vertex in $S$, then the data structure requires only $O(m\delta)$ total update time. Our fundamental idea is to combine classic ES-trees with techniques to maintain Single-Source Reachability in DAGs which can be implemented in linear time in the number of edges\cite{italiano1988finding}. Since $\mathbf{dist}_G(r, v) = \mathbf{dist}_G(r, v, V)$ and $V$ is a trivial feedback vertex set, we have that our data structure generalizes the classic ES-tree. Since the empty set is a feedback vertex set for DAGs, our data structure also matches the time complexity of Italiano's data structure. We define the interface formally below.
\begin{definition}
\label{def:GES}
Let $G=(V,E)$ be a graph and $S$ a feedback vertex set for $G$, $r \in V$ and $\delta > 0$. We define a generalized ES-tree $\mathcal{E}_r$ (GES) to be a data structure that supports the following operations:
\begin{itemize}
\item $\textsc{InitGES}(r, G, S, \delta)$: Sets the parameters for our data structure. We initialize the data structure and return the GES.
\item $\textsc{Distance}(r ,v )$: $\forall v \in V$, if $\mathbf{dist}_G(r ,v, S) \leq \delta$, $\mathcal{E}_r$ reports $\mathbf{dist}_G(r ,v, S)$, otherwise $\infty$.
\item $\textsc{Distance}(v ,r )$: $\forall v \in V$, if $\mathbf{dist}_G(v ,r, S) \leq \delta$, $\mathcal{E}_r$ reports $\mathbf{dist}_G(v ,r, S)$, otherwise $\infty$.
\item $\textsc{Delete}(u,v)$: Sets $E \gets E \setminus \{(u,v)\}$.
\item $\textsc{Delete}(V')$: For $V' \subseteq V$, sets $V \gets V \setminus V'$, i.e. removes the vertices in $V'$ and all incident edges from the graph $G$.
\item $\textsc{GetUnreachableVertex}()$: Returns a vertex $v \in V$ with $\max\{ \mathbf{dist}_G(r ,v, S), \mathbf{dist}_G(v, r, S)\} > \delta$ or $\bot$ if no such vertex exists.
\end{itemize}
\end{definition}
\begin{lemma}
\label{lma:SimpleGES}
The GES $\mathcal{E}_r$ as described in definition \ref{def:GES} can be implemented with total initialization and update time $O(m \delta)$ and requires worst-case time $O(1)$ for each operation $\textsc{Distance}(\cdot)$ and $\textsc{GetUnreachableVertex}()$.
\end{lemma}
We defer the full prove to the appendix \ref{sec:proofsimpleges} but sketch the proof idea.
\begin{proof} (sketch)
Consider a classic ES-tree with each edge weight $w(u,v)$ of an edge $(u,v)$ in $E_{out}(S)$ set to $1$ and all other edges of weight $0$. Then, the classic ES-tree analysis maintains with each vertex $v \in V$ the distance level $l(v)$ that expresses the current distance from $s$ to $v$. We also have a shortest-path tree $T$, where the path in the tree from $s$ to $v$ is of weight $l(v)$. Since $T$ is a shortest-path tree, we also have that for every edge $(u,v) \in E$, $l(v) \leq l(u) + w(u,v)$. Now, consider the deletion of an edge $(u,v)$ from $G$ that removes an edge that was in $T$. To certify that the level $l(v)$ does not have to be increased, we scan the in-going edges at $v$ and try to find an edge $(u', v) \in E$ such that $l(v) = l(u') + w(u', v)$. On finding this edge, $(u',v)$ is added to $T$. The problem is that if we allow $0$-weight cycles, the edge $(u',v)$ that we use to reconnect $v$ might come from a $u'$ that was a descendant of $v$ in $T$. This will break the algorithm, as it disconnects $v$ from $s$ in $T$. But we show that this bad case cannot occur because $S$ is assumed to be a feedback vertex set, so at least one of the vertices on the cycle must be in $S$ and therefore the out-going edge of this vertex must have weight $1$ contradicting that there exists any $0$-weight cycle. The rest of the analysis follows closely the classic ES-tree analysis.
\end{proof}
To ease the description of our SCC algorithm, we tweak our GES implementation to work on the multi-graphs $\hat{G}_i$. We still root the GES at a vertex $r \in V$, but maintain the tree in $\hat{G}_i$ at $X_i^r$. The additional operations and their running time are described in the following lemma whose proof is straight-forward and therefore deferred to appendix \ref{sec:proofAugmentedGES}. Note that we now deal with nodes rather than vertices which makes the definition of $S$-distances ambitious (consider for example a node containing two vertices in $S$). For this reason, we require $S \subseteq \{\{v\} | v \in V\} \cap \hat{V}$ in the lemma below, i.e. that the nodes containing vertices in $S$ are single-vertex nodes. But as discussed in the paragraph ``Refining the hierarchy" in the overview, our hierarchy ensures that every separator node $X \in S_i$ is always just a single-vertex node in $\hat{G}_i$. Thus this constraint can be satisfied by our hierarchy.
\begin{lemma}
\label{lma:AugmentedGES}
Say we are given a partition $\hat{V}$ of a universe $V$ and the graph $\hat{G}=(\hat{V}, E)$, a feedback node set $S \subseteq \{\{v\} | v \in V\} \cap \hat{V}$, a distinguished vertex $r \in V$, and a positive integer $\delta$. Then, we can run a GES $\mathcal{E}_{r}$ as in definition \ref{def:GES} on $\hat{G}$ in time $O(m\delta + \sum_{X \in \hat{V}} E(X) \log X)$ supporting the additional operations:
\begin{itemize}
\item $\textsc{SplitNode}(X)$: the input is a set of vertices $X$ contained in node $Y \in \hat{V}$, such that either $E \cap (X \times Y \setminus X)$ or $E \cap (Y \setminus X \times X)$ is an empty set, which implies $X \not\rightleftarrows_{\hat{G} \setminus S} Y \setminus X$. We remove the node $Y$ in $\hat{V}$ and add node $X$ and $Y \setminus X$ to $\hat{V}$.
\item $\textsc{Augment}(S')$: This procedure adds the nodes in $S'$ to the feedback vertex set $S$. Formally,
the input is a set of single-vertex sets $S' \subseteq \{\{v\} | v \in V\} \cap \hat{V}$. $\textsc{Augment}(S')$ then adds every $s \in S'$ to $S$.
\end{itemize}
\end{lemma}
We point out that we enforce the properties on the set $X$ in the operation $\textsc{SplitNode}(X)$ in order to ensure that the set $S$ remains a feedback node set at all times.
\section{Initializing the \texorpdfstring{the graph hierarchy $\hat{\mathcal{G}}$}{the graph hierarchy}}
\label{subsec:Preprocessing}
We assume henceforth that the graph $G$ initially is strongly-connected. If the graph is not strongly-connected, we can run Tarjan's algorithm\cite{tarjan1972depth} in $O(m+n)$ time to find the SCCs of $G$ and run our algorithm on each SCC separately.
\begin{algorithm}
\caption{$\textsc{Preprocessing}(G, \delta)$}
\label{alg:preprocessing}
\KwIn{A strongly-connected graph $G=(V,E)$ and a parameter $\delta > 0$.}
\KwOut{A hierarchy of sets $\mathcal{S} = \{ S_0, S_1, .., S_{\lfloor \lg{n} \rfloor + 2}\}$ and graphs $\hat{\mathcal{G}} = \{\hat{G}_0, \hat{G}_1, .. , \hat{G}_{\lfloor \lg{n} \rfloor + 1}\}$ as described in section \ref{subsec:overview}. Further, each SCC $X$ in $\hat{G}_i$ for $i \leq \lfloor \lg n \rfloor + 2$, has a center $\textsc{Center}(X)$ such that for any $y \in X$, $\mathbf{dist}_{\hat{G}_{i}}(\textsc{Center}(X),y, S_{i}) \leq \delta/2$ and $\mathbf{dist}_{\hat{G}_{i}}(y,\textsc{Center}(X), S_{i}) \leq \delta/2$. }
\BlankLine
$ S_0 \gets V$\;
$ \hat{V}_0 \gets \{\{v\} | v \in V\}$\;
$ \hat{G}_0 \gets (\hat{V}_0, E)$\label{lne:G0Init}\;
\For{ $i = 0 $ \KwTo $ \lfloor \lg{n} \rfloor$}{
\tcc{Find separator $S_{Sep}$ such that no two vertices in the same SCC in $\hat{G}_{i}$ have $S_i$-distance $\geq \delta/2$. $P$ is the collection of these SCCs.}
$ (S_{Sep}, P) \gets \textsc{Split}(\hat{G}_i, S_{i}, \delta/2)$ \;
$ S_{i+1} \gets S_{Sep} $\;
$\textsc{InitNewPartition}(P, i, \delta)$\;
\tcc{Initialize the graph $\hat{G}_{i+1}$}
$ \hat{V}_{i+1} \gets P$\;
$ \hat{G}_{i+1} \gets (\hat{V}_{i+1}, E)$\label{lne:GIInit}\;
}
$S_{\lfloor \lg{n} \rfloor + 2} \gets \emptyset$\;
\end{algorithm}
Our procedure to initialize our data structure is presented in pseudo-code in algorithm \ref{alg:preprocessing}. We first initialize the level $0$ where $\hat{G}_0$ is simply $G$ with the vertex set $V$ mapped to the set of singletons of elements in $V$.
Let us now focus on an iteration $i$. Observe that the graph $\hat{G}_i$ initially has all edges in $E$ (by initializing each $\hat{G}_i$ in line \ref{lne:G0Init} or line \ref{lne:GIInit}). Our goal is then to ensure that all SCCs in $\hat{G}_i$ are of small $S_i$-diameter at the cost of removing some of the edges from $\hat{G}_i$. Invoking the procedure $\textsc{Split}(\hat{G}_i, S_i, \delta/2)$ provides us with a set of separator nodes $S_{Sep}$ whose removal from $\hat{G}_i$ ensure that the $S_i$ diameter of all remaining SCCs is at most $\delta$. The set $P$ is the collection of all these SCCs, i.e. the collection of the SCCs in $\hat{G}_i \setminus E(S_{Sep})$.
Lemma \ref{lma:split} below describes in detail the properties satisfied by the procedure $\textsc{Split}(\hat{G}_i, S_i, \delta/2)$. In particular, besides the properties ensuring small $S_i$-diameter in the graph $\hat{G}_i \setminus E(S_{Sep})$ (properties \ref{prop:1} and \ref{prop:2}), the procedure also gives an upper bound on the number of separator vertices (property \ref{prop:3}). Setting $\delta = 64 \lg^2 n$, clearly implies that $|S_{Sep}| \leq |S_i|/2$ and ensures running time $O(m \log^3 n)$.
\begin{lemma}
\label{lma:split}
$\textsc{Split}(\hat{G}_i, S_i, \delta/2)$ returns a tuple $(S_{Sep}, P)$ where $P$ is a partition of the node set $\hat{V}_i$ such that
\begin{enumerate}
\item for $X \in P$, and nodes $u,v \in X$ we have $\mathbf{dist}_{G \setminus E(S_{Sep})}(u,v,S) \leq \delta/2$, and \label{prop:1}
\item for distinct $X, Y \in P$, with nodes $u \in X$ and $v \in Y$, $u \not\rightleftarrows_{G \setminus E(S_{Sep})} v$, and \label{prop:2}
\item
$|S_{Sep}| \leq \frac{32 \lg^2 n}{\delta} |S_i|$. \label{prop:3}
\end{enumerate}
The algorithm runs in time $O\left(\delta m \lg n\right)$.
\end{lemma}
We then set $S_{i+1} = S_{Sep}$ which implicitly removes the edges $E(S_{i+1})$ from the graph $\hat{G}_i$. We then invoke the procedure $\textsc{InitNewPartition}(P, i, \delta)$, that is presented in algorithm \ref{alg:newPart}. The procedure initializes for each $X \in P$ that corresponds to an SCC in $\hat{G}_i$ the GES-tree from a vertex $r \in \textsc{Flatten}(X)$ chosen uniformly at random on the induced graph $\hat{G}_i[X]$. Observe that we are not explicitly keeping track of the edge set $E_i$ but further remove edges implicitly by only maintaining the induced subgraphs of $\hat{G}_i$ that form SCCs. A small detail we want to point out is that each separator node $X \in S_{Sep}$ also forms its own single-node set in the partition $P$.
\begin{algorithm}
\caption{$\textsc{InitNewPartition}(P, i, \delta)$\;}
\label{alg:newPart}
\KwIn{A partition of a subset of the nodes $V$, and the level $i$ in the hierarchy.}
\KwResult{Initializes a new ES-tree for each set in the partition on the induced subgraph $\hat{G}_i$.}
\BlankLine
\ForEach{$ X \in P $}{
Let $r$ be a vertex picked from $\textsc{Flatten}(X)$ uniformly at random. \;
$\textsc{Center}(X) \gets r$\;
\tcc{Init a generalized ES-tree from $\textsc{Center}(X)$ to depth $\delta$.}
$\mathcal{E}_r^i \gets \textsc{InitGES}(\textsc{Center}(X), \hat{G}_i[X], S_i, \delta)$\;
}
\end{algorithm}
On returning to algorithm \ref{alg:preprocessing}, we are left with initializing the graph $\hat{G}_{i+1}$. Therefore, we simply set $\hat{V}_{i+1}$ to $P$ and use again all edges $E$. Finally, we initialize $S_{\lfloor \lg n \rfloor + 2}$ to the empty set which remains unchanged throughout the entire course of the algorithm.
Let us briefly sketch the analysis of the algorithm which is more carefully analyzed in subsequent sections. Using again $\delta = 64 \lg^2 n$ and lemma \ref{lma:split}, we ensure that $|S_{i+1}| \leq |S_i|/2$, thus $|S_i| \leq n/2^i$ for all levels $i$. The running time of executing the $\textsc{Split}(\cdot)$ procedure $\lfloor \lg n \rfloor + 1$ times incurs running time $O(m \log^4 n)$ and initializing the GES-trees takes at most $O(m \delta)$ time on each level therefore incurring running time $O(m \log^3 n)$.
\section{Finding Separators}
\label{subsec:separators}
Before we describe how to update the data structure after an edge deletion, we want to explain how to find good separators since it is crucial for our update procedure. We then show how to obtain an efficient implementation of the procedure $\textsc{Split}(\cdot)$ that is the core procedure in the initialization.
Indeed, the separator properties that we want to show are essentially reflected in the properties of lemma \ref{lma:split}. For simplicity, we describe the separator procedures on simple graphs instead of our graphs $\hat{G}_i$; it is easy to translate these procedures to our multi-graphs
$\hat{G}_i$ because the separator procedures are not dynamic; they are only ever invoked on a fixed graph, and so we do not have to worry about node splitting and the like.
To gain some intuition for the technical statement of our separator properties stated in lemma \ref{lma:sep}, consider that we are given a graph $G=(V,E)$, a subset $S$ of the vertices $V$, a vertex $r \in V$ and a depth $d$. Our goal is to find a separator $S_{Sep} \subseteq S$, such that every vertex in the graph $G \setminus S_{Sep}$ is either at $S$-distance at most $d$ from $r$ \emph{or} cannot be reached from $r$, i.e. is separated from $r$.
We let henceforth $V_{Sep} \subseteq V$ denote the set of vertices that are still reachable from $r$ in $G \setminus S_{Sep}$ (in particular there is no vertex $S_{Sep}$ contained in $V_{Sep}$ and $r \in V_{Sep}$). Then, a natural side condition for separators is to require the set $S_{Sep}$ to be small in comparison to the smaller side of the cut, i.e. small in comparison to $\min\{|V_{Sep}|, |V \setminus (V_{Sep} \cup S_{Sep})|\}$.
Since we are concerned with $S$-distances, we aim for a more general guarantee: we want the set $S_{Sep}$ to be small in comparison to the number of $S$ vertices on any side of the cut, i.e. small in comparison to $\min\{|V_{Sep} \cap S|, |(V \setminus (V_{Sep} \cup S_{Sep})) \cap S|\}$. This is expressed in property \ref{prop:balanceS} of the lemma.
\begin{lemma}[Balanced Separator]
\label{lma:sep}
There exists a procedure $\textsc{OutSeparator}(r, G, S, d)$ (analogously $\textsc{InSeparator}(r, G, S, d)$) where $G=(V,E)$ is a graph, $r \in V$ a root vertex, $S \subseteq V$ and $d$ a positive integer. The procedure computes a tuple $(S_{Sep}, V_{Sep})$ such that
\begin{enumerate}
\item $S_{Sep} \subseteq S$, $V_{Sep} \subseteq V$, $S_{Sep} \cap V_{Sep} = \emptyset$, $r \in V_{Sep}$,
\item \label{step:separator-distance} $\forall v \in V_{Sep} \cup S_{sep}$, we have $\mathbf{dist}_G(r,v,S) \leq d$ (analogously $\mathbf{dist}_G(v,r,S) \leq d$ for $\textsc{InSeparator}(r, G, S, d)$),
\item \[
|S_{Sep}| \leq \frac{\min\{|V_{Sep}\cap S|, | (V \setminus (S_{Sep} \cup V_{Sep})) \cap S|\} 2\log{n}}{d},\] \label{prop:balanceS}
and
\item for any $x \in V_{Sep}$ and $y \in V \setminus (S_{Sep} \cup V_{Sep})$, we have $u \not\leadsto_{G \setminus E(S_{Sep})} v$ (analogously $v \not\leadsto_{G \setminus E(S_{Sep})} u$ for $\textsc{InSeparator}(r, G, S, d)$).
\end{enumerate}
The running time of both $\textsc{OutSeparator}(\cdot)$ and $\textsc{InSeparator}(\cdot)$ can be bounded by $O(E(V_{Sep}))$.
\end{lemma}
Again, we defer the proof of the lemma \ref{lma:sep} to the appendix \ref{sec:ProofLemmaSep}, but sketch the main proof idea.
\begin{proof}
To implement procedure $\textsc{OutSeparator}(r, G, S, d)$, we start by computing a BFS at $r$. Here, we assign edges in $E_{out}(S)$ again weight $1$ and all other edges weight $0$ and say a layer consists of all vertices that are at same distance from $r$. To find the first layer, we can use the graph $G \setminus E_{out}(S)$ and run a normal BFS from $r$ and all vertices reached form the first layer $L_0$. We can then add for each edge $(u,v) \in E_{out}(S)$ with $u \in L_0$ the vertex $v$ to $L_1$ if it is not already in $L_0$. We can then contract all vertices visited so far into a single vertex $r'$ and repeat the procedure described for the initial root $r$. It is straight-forward to see that the vertices of a layer that are also in $S$ form a separator of the graph. To obtain a separator that is small in comparison to $|V_{Sep} \cap S|$, we add each of the layers $0$ to $d/2$ one after another to our set $V_{Sep}$, and output the index $i$ of the first layer that grows the set of $S$-vertices in $V_{Sep}$ by factor less than $(1+\frac{2 \log n}{d})$. We then set $S_{Sep}$ to be the vertices in $S$ that are in layer $i$. If the separator is not small in comparison to $| (V \setminus (S_{Sep} \cup V_{Sep})) \cap S|$, we grow more layers and output the first index of a layer such that the separator is small in comparison to $| (V \setminus (S_{Sep} \cup V_{Sep})) \cap S|$. This layer must exist and is also small in comparison to $|V_{Sep} \cap S|$. Because we find our separator vertices $S_{Sep}$ using a BFS from $r$, a useful property of our separator is that all the vertices in $S_{Sep}$ and $V_{Sep}$ are within bounded distance from $r$.
Finally, we can ensure that the running time of the procedure is linear in the size of the set $E(V_{Sep})$, since these are the edges that were explored by the BFS from root $r$.
\end{proof}
Let us now discuss the procedure $\textsc{Split}(G,S,d)$ that we already encountered in section \ref{subsec:Preprocessing} and whose pseudo-code is given in algorithm \ref{alg:split}. Recall that the procedure computes a tuple $(S_{Split}, P)$ such that the graph $G \setminus E(S_{Split})$ contains no SCC with $S$-diameter larger $d$ and where $P$ is the collection of all SCCs in the graph $G \setminus E(S_{Split})$.
\begin{algorithm}
\caption{$\textsc{Split}(G, S, d)$}
\label{alg:split}
\KwIn{A graph $G=(V,E)$, a set $S \subseteq V$ and a positive integer $d$.}
\KwOut{Returns a tuple $(S_{Split}, P)$, where $S_{Split} \subseteq S$ is a separator such that no two vertices in the same SCC in $G \setminus E(S)$ have $S$-distance greater than $d$. $P$ is the collection of these SCCs.}
\BlankLine
$S_{Split} \gets \emptyset; P \gets \emptyset; G' \gets G;$\;
\While{$G' \neq \emptyset$}{
Pick an arbitrary vertex $r$ in $V$.\;
Run in parallel $\textsc{OutSeparator}(r, G', S, d/16)$ and $\textsc{InSeparator}(r, G', S, d/16)$ and let $(S_{Sep}, V_{Sep})$ be the tuple returned by the first subprocedure that finishes.\label{lne:sepTwoWay}\;
\lIf(\label{lne:sepTwoWayIf}){$|V_{Sep}| \leq \frac{2}{3}|V|$}{
$(S'_{Sep}, V'_{Sep}) \gets (S_{Sep}, V_{Sep})$
}\Else(\label{lne:sepTwoWayElse}){
Run the separator procedure that was aborted in line \ref{lne:sepTwoWay} until it finishes and let the tuple returned by this procedure be $(S'_{Sep}, V'_{Sep})$.
}
\If(\label{line:split-if-case}){$|V'_{Sep}| \leq \frac{2}{3}|V|$} {
$(S_{Small}, P_{Small}) \gets \textsc{Split}(G'[V'_{Sep}], V'_{Sep} \cap S, d)$\label{lne:splitRecurseIf} \;
$S_{Split} \gets S_{Split} \cup S_{Small} \cup S'_{Sep}$\label{lne:addtoS1}\;
$P \gets P \cup P_{Small} \cup \{ \{s\} | s \in S'_{Sep}\})$\label{lne:addToPSep}\;
$G' \gets G'[V \setminus (V'_{Sep} \cup S'_{Sep})]$
}\Else(\label{line:split-else-case}){
\tcc{Init a generalized ES-tree from $r$ to depth $d/2$.}
$\mathcal{E}_r^i \gets \textsc{InitGES}(r, G', S, d/2)$\;
\tcc{Find a good separator for every vertex that is far from $r$.}
\While(\label{line:split-else-while}) { $(v \gets \mathcal{E}_r^i.\textsc{GetUnreachableVertex}()) \neq \bot$} {
\If{$\mathcal{E}_r^i.\textsc{Distance}(r,v) > d/2$}{
$(S''_{Sep}, V''_{Sep}) \gets \textsc{InSeparator}(v,G', S, d/4)$\;
}\Else(\tcp*[h]{If $\mathcal{E}_r^i.\textsc{Distance}(v,r) > d/2$}){
$(S''_{Sep}, V''_{Sep}) \gets \textsc{OutSeparator}(v,G', S, d/4)$\;
}
$\mathcal{E}_r.\textsc{Delete}(S''_{Sep} \cup V''_{Sep})$\;
$(S'''_{Sep}, P''') \gets \textsc{Split}( G[V''_{Sep}] , V''_{Sep} \cap S , d)$\label{lne:splitRecurse}\;
$S_{Split} \gets S_{Split} \cup S''_{Sep} \cup S'''_{Sep}$\label{lne:addtoS2}\;
$P \gets P \cup P''' \cup \{ \{s\} | s \in S''_{Sep}\})$\label{lne:addToP1}\;
}
$P \gets P \cup \{\mathcal{E}_r.\textsc{GetAllVertices}()\}$\label{lne:addToP2}\;
$G' \gets \emptyset$\;
}
}
\Return $(S_{Split}, P)$\;
\end{algorithm}
Let us sketch the implementation of the procedure $\textsc{Split}(G,S,d)$. We first pick an arbitrary vertex and invoke the procedures $\textsc{OutSeparator}(r, G', S, d/4)$ and $\textsc{InSeparator}(r, G', S, d/4)$ to run in parallel, that is the operations of the two procedures are interleaved during the execution. If one of these subprocedures returns and presents a separator tuple $(S_{Sep}, V_{Sep})$, the other procedure is aborted and the tuple $(S_{Sep}, V_{Sep})$ is returned. If $|V_{Sep}| \leq \frac{2}{3}|V|$, then we conclude that the separator function only visited a small part of the graph. Therefore, we use the separator subsequently, but denote the tuple henceforth as $(S'_{Sep},V'_{Sep})$. Otherwise, we decide the separator is not useful for our purposes. We therefore return to the subprocedure we previously aborted and continue its execution. We then continue with the returned tuple $(S'_{Sep}, V'_{Sep})$.
From there on, there are two possible scenarios. The first scenario is that the subprocedure producing $(S'_{Sep}, V'_{Sep})$ has visited a rather small fraction of the vertices in $V$ (line \ref{line:split-if-case}); in this case, we have pruned away a small number of vertices $V'_{Sep}$ while only spending time proportional to the smaller side of the cut, so we can simply recurse on $V'_{Sep}$. We also have to continue pruning away vertices from the original set $V$, until we have either removed all vertices from $G$ by finding these separators and recursing, or until we enter the else-case (line \ref{line:split-else-case}).
The else-case in line \ref{line:split-else-case} is the second possible scenario: note that in this case we must have entered the else-case in line \ref{lne:sepTwoWayElse} and had both the $\textsc{InSeparator}(\cdot)$ \emph{and} $\textsc{OutSeparator}(\cdot)$ explore the large side of the cut. Thus we cannot afford to simply recurse on the smaller side of the cut $V \setminus V'_{sep}$, as we have already spent time $|V'_{sep}| > |V \setminus V'_{sep}|$. Thus, for this case we use a different approach. We observe that because we entered the else-case in line \ref{lne:sepTwoWayElse} and since we entered the else-case \ref{line:split-else-case}, we must have had that $|V_{Sep}| \geq \frac{2}{3}|V|$ \textit{and} that $|V'_{Sep}| \geq \frac{2}{3}|V|$. We will show that in this case, the root $r$ must have small $S$-distance to and at least $\frac{1}{3}|V|$ vertices. We then show that this allows us to efficiently prune away at most $\frac{2}{3}|V|$ vertices from $V$ at large $S$-distance to or from $r$. We recursively invoke $\textsc{Split}(\cdot)$ on the induced subgraphs of vertex sets that we pruned away.
We analyze the procedure in detail in multiple steps, and summarize the result in lemma \ref{lma:splitFull} that is the main result of this section. Let us first prove that if the algorithm enters the else-case in line \ref{line:split-else-case} then we add an SCC of size at least $\frac{1}{3}|V|$ to $P$.
\begin{claim}
\label{clm:largeSCCifEStree}
If the algorithm enters line \ref{line:split-else-case} then the vertex set returned by $\mathcal{E}_r.\textsc{GetAllVertices}()$ in line \ref{lne:addToP2} is of size at least $\frac{1}{3}|V|$.
\end{claim}
\begin{proof}
Observe first that since we did no enter the if-case in line \ref{lne:splitRecurseIf}, that $|V_{Sep}| > \frac{2}{3}|V|$ and $|V'_{Sep}| > \frac{2}{3}|V|$ (since we also cannot have entered the if case in line \ref{lne:sepTwoWayIf}).
Since we could not find a sufficiently good separator in either direction, we certified that the $S$-out-ball from $r$ defined
\[
B_{out}(r) = \{ v \in V | \mathbf{dist}_G(r , v, S) \leq d/16\}
\]
has size greater than $\frac{2}{3}|V|$, and that similarly, the $S$-in-ball $B_{in}(r)$ of $r$ has size greater than $\frac{2}{3}|V|$. This implies that
\[
|B_{out}(r) \cap B_{in}(r)| > \frac{1}{3}|V|.
\]
Further, we have that every vertex on a shortest-path between $r$ and a vertex $v \in B_{out}(r) \cap B_{in}(r)$ has a shortest-path from and to $r$ of length at most $d/16$. Thus the $S$-distance between any pair of vertices in $B_{out}(r) \cap B_{in}(r)$ is at most $d/8$. Now, let $SP$ be the set of all vertices that are on a shortest-path w.r.t. $S$-distance between two vertices in $B_{out}(r) \cap B_{in}(r)$. Clearly, $B_{out}(r) \cap B_{in}(r) \subseteq SP$, so $|SP| \geq |V|/3$. It is also easy to see that $G[SP]$ has $S$-diameter at most $d/4$.
At this point, the algorithm repeatedly finds a vertex $v$ that is far from $r$ and finds a separator from $v$. We will now show that the part of the cut containing $v$ is always disjoint from $SP$; since $|SP| > |V|/3$, this implies that at least $|V|/3$ vertices remain in $\mathcal{E}_r$.
Consider some vertex $v$ chosen in line \ref{line:split-else-while}. Let us say that we now run $\textsc{InSeparator}(v,G',S,d/4)$; the case where we run $\textsc{OutSeparator}(v,G',S,d/4)$ is analogous. Now, by property \ref{step:separator-distance} in lemma \ref{lma:sep}, every $s \in S_{Sep}$ has $\mathbf{dist}(s,v,S) \leq d/4$. Thus, since we only run the \textsc{InSeparator} if we have $\mathbf{dist}(r,v,S) > d/2$, we must have $\mathbf{dist}(r,s,S) > d/4$.
\end{proof}
We point out that claim \ref{clm:largeSCCifEStree} implies that $\textsc{Split}(\cdot)$ only recurses on disjoint subgraphs containing at most a $2/3$ fraction of the vertices of the given graph. To see this, observe that we either recurse in line \ref{lne:splitRecurseIf} on $G'[V'_{Sep}]$ after we explicitly checked whether $|V'_{Sep}| \leq \frac{2}{3}|V|$ in the if-condition, or we recurse in line \ref{lne:splitRecurse} on the subgraph pruned from the set of vertices that $\mathcal{E}_r$ was initialized on. But since by claim \ref{clm:largeSCCifEStree} the remaining vertex set in $\mathcal{E}_r$ is of size at least $|V|/3$, the subgraphs pruned away can contain at most $\frac{2}{3}|V|$ vertices.
We can use this observation to establish correctness of the $\textsc{Split}(\cdot)$ procedure.
\begin{claim}
\label{clm:SplitCorrectness}
$\textsc{Split}(G, S, d)$ returns a tuple $(S_{Sep}, P)$ where $P$ is a partition of the vertex set $V$ such that
\begin{enumerate}
\item for $X \in P$, and vertices $u,v \in X$ we have $\mathbf{dist}_{G \setminus E(S_{Sep})}(u,v,S) \leq d$, and
\item for distinct $X, Y \in P$, with vertices $u \in X$ and $v \in Y$, $u \not\rightleftarrows_{G \setminus E(S_{Sep})} v$, and
\item
$|S_{Split}| \leq \frac{32 \log n}{d} \sum_{X \in P} \lg (n - |X \cap S|) |X \cap S|$. \label{prop:splitcorrect3}
\end{enumerate}
\end{claim}
\begin{proof}
Let us start with the first two properties which we prove by induction on the size of $|V|$ where the base case $|V|=1$ is easily checked. For the inductive step, observe that each SCC $X$ in the final collection $P$ was added to $P$ in line \ref{lne:addToPSep}, \ref{lne:addToP1} or \ref{lne:addToP2}. We distinguish by 3 cases:
\begin{enumerate}
\item a vertex $s$ was added as singleton set after appearing in a separator $S_{Sep}$ but then $\{s\}$ is strongly-connected and $s$ cannot reach any other vertex in $G \setminus E(S_{Sep})$ since it has no out-going edges, or
\item an SCC $X$ was added as part of a collection $P'''$ in line \ref{lne:addToP1}. But then we have that the collection $P'''$ satisfies the properties in $G[V''_{Sep}]$ by the induction hypothesis and since $V''_{Sep}$ was a cut side and $S''_{Sep}$ added to $S_{out}$, we have that there cannot be a path to \emph{and} from any vertex in $G \setminus E(S_{out})$, or
\item we added the non-trivial SCC $X$ to $P$ after constructing an GES-tree from some vertex $r \in X$ and after pruning each vertex at $S$-distance to/from $r$ larger than $d/2$ (see the while loop on line \ref{line:split-else-while}). But then each vertex that remains in $X$ can reach $r$ within $S$-distance $d/2$ and is reached from $r$ within distance $d/2$ implying that any two vertices $u,v \in X$ have a path from $u$ to $v$ of $S$-distance at most $d$.
\end{enumerate}
Finally, let us upper bound the number of vertices in $S_{Split}$. We use a classic charging argument and argue that each time we add a separator $S_{Sep}$ to $S_{Split}$ with sides $V_{Sep}$ and $V \setminus (V_{Sep} \cup S_{Sep})$ at least one of these sides contains at most half the $S$-vertices in $V \cap S$. Let $X$ be the smaller side of the cut (in term of $S$-vertices) then by property \ref{prop:balanceS} from lemma \ref{lma:sep}, we can charge each $S$ vertex in $X$ for $\frac{32 \log{n}}{d}$ separator vertices (since we invoke $\textsc{OutSeparator}(\cdot)$ and $\textsc{InSeparator}(\cdot)$ with parameter at least $d/16$).
Observe that once we determined that a separator $S_{Sep}$ that is about to be added to $S_{Split}$ in line \ref{lne:addtoS1} or \ref{lne:addtoS2}, we only recurse on the induced subgraph $G'[V_{Sep}]$ and let the graph in the next iteration be $G'[V \setminus (V_{Sep} \cup S_{Sep})$.
Let $X$ be an SCC in the final collection $P$. Then each vertex $v \in X$ can only have been charged at most $\lg (n - |X \cap S|)$ times. The lemma follows.
\end{proof}
It remains to bound the running time. Before we bound the overall running time, let us prove the following claim on the running time of invoking the separator procedures in parallel.
\begin{claim}
\label{clm:twowaysep}
We spend $O(E(V'_{Sep} \cup S'_{Sep}))$ time to find a separator in line \ref{lne:sepTwoWayIf} or \ref{lne:sepTwoWayElse}.
\end{claim}
\begin{proof}
Observe that we run the subprocedures $\textsc{OutSeparator}(r, G', S, d/16)$ and $\textsc{InSeparator}(r, G', S, d/16)$ in line \ref{lne:sepTwoWay} in parallel. Therefore, when we run them, we interleave their machine operations, computing one operation from $\textsc{OutSeparator}(r, G', S, d/16)$ and then one operation from $\textsc{InSeparator}(r, G', S, d/16)$ in turns. Let us assume that $\textsc{OutSeparator}(r, G', S, d/16)$ is the first subprocedure that finishes and returns tuple $(S_{Sep}, V_{Sep})$. Then, by lemma \ref{lma:sep}, the subprocedure used $O(E(V_{Sep} \cup S_{Sep}))$ time. Since the subprocedure $\textsc{InSeparator}(r, G', S, d/16)$ ran at most one more operation than $\textsc{OutSeparator}(r, G', S, d/16)$, it also used $O(E(V_{Sep} \cup S_{Sep}))$ operations. A symmetric argument establishes the same bounds, if $\textsc{InSeparator}(r, G', S, d/16)$ finishes first. The overhead induced by running two procedures in parallel can be made constant.
Since assignments take constant time, the claim is vacuously true by our discussion if the if-case in line \ref{lne:splitRecurseIf} is true. Otherwise, we compute a new separator tuple by continuing the execution of the formerly aborted separator subprocedure. But by the same argument as above, this subprocedure's running time now clearly dominates the running time of the subprocedure that finished first in line \ref{lne:sepTwoWay}. The time to compute $(S'_{Sep}, V'_{Sep})$ is thus again upper bounded by $O(E(V'_{Sep}))$ by lemma \ref{lma:sep}, as required.
\end{proof}
Finally, we have established enough claims to prove lemma \ref{lma:splitFull}.
\begin{lemma}[Strengthening of lemma \ref{lma:split}]
\label{lma:splitFull}
$\textsc{Split}(G, S, d)$ returns a tuple $(S_{Split}, P)$ where $P$ is a partition of the vertex set $V$ such that
\begin{enumerate}
\item for $X \in P$, and vertices $u,v \in X$ we have $\mathbf{dist}_{G \setminus E(S_{Split})}(u,v,S) \leq d$, and
\item for distinct $X, Y \in P$, with vertices $u \in X$ and $v \in Y$, $u \not\rightleftarrows_{G \setminus E(S_{Split})} v$, and
\item
$|S_{Split}| \leq \frac{32 \log n}{d} \sum_{X \in P} \lg (n - |X \cap S|) |X \cap S|$
\end{enumerate}
The algorithm runs in time $O\left(d \sum_{X \in P} (1 + \lg( n - |X|)) E(X) \right)$.
\end{lemma}
\begin{proof}
Since correctness was established in lemma \ref{clm:SplitCorrectness}, it only remains to bound the running time of the procedure. Let us first bound the running time without recursive calls to procedure $\textsc{Split}(G, S,d)$. To see that we only spend $O(|E(G)| d)$ time in $\textsc{Split}(G, S,d)$ excluding recursive calls, observe first that we can find each separator tuple $(S'_{Sep}, V'_{Sep})$ in time $O(E(V'_{Sep}))$ by claim \ref{clm:twowaysep}. We then, either recurse on $G'[V'_{Sep}])$ and remove the vertices $V'_{Sep} \cup S'_{Sep}$ with their incident edges from $G'$ or we enter the else-case (line \ref{line:split-else-case}). Clearly, if our algorithm never visits the else-case, we only spend time $O(|E(G)|)$ excluding the recursive calls since we immediately remove the edge set that we found in the separator from the graph.
We further observe that the running time for the GES-tree can be bounded by $O(|E(G)| d)$. The time to compute the separators to prune vertices away from the GES-tree is again combined at most $O(|E(G)|)$ by lemma \ref{lma:sep} and the observation that we remove edges from the graph $G$ after they were scanned by one such separator procedure.
We already discussed that claim \ref{clm:largeSCCifEStree} implies that we only recurse on disjoint subgraphs with at most $\frac{2}{3}|V|$ vertices. We obtain that each vertex in a final SCC $X$ in $P$ participated in at most $O(\log( n - |X|))$ levels of recursion and so did its incident edges hence we can then bound the total running time by $O\left(d \sum_{X \in P} (1 + \log( n - |X|)) E(X) \right)$.
\end{proof}
\section{Handling deletions}
\label{subsec:delete}
Let us now consider how to process the deletion of an edge $(u,v)$ which we describe in pseudo code in algorithm \ref{alg:delete}. We fix our data structure in a bottom-up procedure where we first remove the edge $(u,v)$ if it is contained in any induced subgraph $\hat{G}_i[X]$ from the GES $\mathcal{E}_{\textsc{Center}(X)}$.
\begin{algorithm}
\caption{$\textsc{Delete}(u,v)$}
\label{alg:delete}
\KwIn{An edge $(u,v) \in E$.}
\KwResult{Updates the data structure such that queries for the graph $G \setminus \{ (u,v)\}$ can be answered in constant time.}
\BlankLine
\For{ $i = 0 $ \KwTo $ \lfloor \log{n} \rfloor$}{
\If{If there exists an $X \in \hat{V}_{i+1}$ with $u,v \in X$}{
$\mathcal{E}_{\textsc{Center}(X)}.\textsc{Delete}(u,v)$\;
}
\While{there exists an $X \in \hat{V}_{i+1}$ with $\mathcal{E}_{\textsc{Center}(X)}.\textsc{GetUnreachable}() \neq \bot$}{
$X' \gets \mathcal{E}_{\textsc{Center}(X)}.\textsc{GetUnreachable}()$\;
\tcc{Find a separator from $X'$ depending on whether $X'$ is far to reach from $r$ or the other way around.}
\If{$\mathcal{E}_{\textsc{Center}(X)}.\textsc{Distance}(\textsc{Center}(X),X') > \delta$}{
$(S_{Sep}, V_{Sep}) \gets \textsc{InSeparator}(X', \hat{G}_i[X], X \cap S_i, \delta/2)$ \label{lne:DelSepIn}
}
\Else(\tcp*[h]{$\mathcal{E}_{\textsc{Center}(X)}.\textsc{Distance}(X', \textsc{Center}(X)) > \delta$}){
$(S_{Sep} , V_{Sep}) \gets \textsc{OutSeparator}(X' , \hat{G}_i[X] , X \cap S_i , \delta/2)$\label{lne:DelSepOut}
}
\tcc{If the separator is chosen such that $V_{Sep}$ is small, we have a good separator, therefore we remove $V_{Sep}$ from $\mathcal{E}_r$ and maintain the SCCs in $\hat{G}_{i}[V_{Sep}]$ separately. Otherwise, we delete the entire GES $\mathcal{E}_{\textsc{Center}(X)}$ and partition the graph with a good separator.}
\If{$|\textsc{Flatten}(V_{Sep})| \leq \frac{2}{3}|\textsc{Flatten}(X)|$}{
$\mathcal{E}_{\textsc{Center}(X)}.\textsc{Delete}(V_{Sep}\cup S_{Sep})$\;
$(S'_{Sep}, P') \gets \textsc{Split}(\hat{G}[V_{Sep}], V_{Sep} \cap S_i, \delta/2)$\label{lne:DelSplit1}\;
$S''_{Sep} \gets S_{Sep} \cup S'_{Sep}$\;
$P'' \gets P' \cup S_{Sep}$\;
}
\Else{
$\mathcal{E}_{\textsc{Center}(X)}.\textsc{Delete}()$\label{lne:ESdelete}\;
$(S''_{Sep}, P'') \gets \textsc{Split}(\hat{G}_i[X], X \cap S_i, \delta/2)$\label{lne:DelSplit2}\;
}
\tcc{After finding the new partitions, we init them, execute the vertex splits on the next level and add the separator vertices.}
$\textsc{InitNewPartition}(P'', i, \delta)$\;
\ForEach{$Y \in P''$}{
$\mathcal{E}_{\textsc{Center}(X)}.\textsc{SplitNode}(Y)$\;
}
$\mathcal{E}_{\textsc{Center}(X)}.\textsc{Augment}(S''_{Sep})$\label{lne:augmentInDelete}\;
$S_{i+1} \gets S_{i+1} \cup S''_{Sep}$\;
}
}
\end{algorithm}
Then, we check if any GES $\mathcal{E}_{\textsc{Center}(X)}$ on a subgraph $\hat{G}_i[X]$ contains a node that became unreachable due to the edge deletion or the fixing procedure on a level below. Whilst there is such a GES $\mathcal{E}_{\textsc{Center}(X)}$, we first find a separator $S_{Sep}$ from $X'$ in lines \ref{lne:DelSepIn} or \ref{lne:DelSepOut}. We now consider two cases based on the size of the set $\textsc{Flatten}(V_{Sep})$. Whilst focusing on the size of $\textsc{Flatten}(V_{Sep})$ instead of the size of $V_{Sep}$ seems like a minor detail, it is essential to consider the underlying vertex set instead of the node set, since the node set can be further split by node split updates from lower levels.
Now, let us consider the first case, when the set $V_{Sep}$ separated by $S_{Sep}$ is small (with regard to $\textsc{Flatten}(V_{Sep})$); in this case, we simply prune $V_{Sep}$ from our tree by adding $S_{Sep}$ to $S_{i+1}$, and then invoke $\textsc{Split}(\hat{G}_i[V_{Sep}], V_{Sep} \cap S_i, \delta/2)$ to get a collection of subgraphs $P'$ where each subgraph $Y \in P'$ has every pair of nodes $A, B \in Y$ at $S_{i}$-distance $\delta/2$. (We can afford to invoke $\textsc{Split}$ on the vertex set $V_{Sep}$ because we can afford to recurse to on the smaller side of a cut.)
The second case is when $V_{Sep}$ is large compared to the number of vertices in node set of the GES-tree. In this case we do not add $S_{Sep}$ to $S_{i+1}$. Instead we we declare the GES-tree $\mathcal{E}_{\textsc{Center}(X)}$ invalid, and delete the entire tree. We then partition the set $X$ that we are working with by invoking the $\textsc{Split}$ procedure on all of $X$. (Intuitively, this step is expensive, but we will show that whenever it occurs, there is a constant probability that the graph has decomposed into smaller SCCs, and we have thus made progress.)
Finally, we use the new partition and construct on each induced subgraph a new GES-tree at a randomly chosen center. This is done by the procedure $\textsc{InitNewPartition}(P', i, \delta)$ that was presented in subsection \ref{subsec:Preprocessing}. We then apply the updates to the graph $\hat{G}_{i+1}$ using the GES-tree operations defined in lemma \ref{lma:AugmentedGES}. Note, that we include the separator vertices as singleton sets in the partition and therefore invoke $\mathcal{E}_X.\textsc{SplitNode}(\cdot)$ on each singleton before invoking $\mathcal{E}_X.\textsc{Augment}(S''_{Sep})$ which ensures that the assumption from lemma \ref{lma:AugmentedGES} is satisfied. As in the last section, let us prove the following two lemmas whose proofs will further justify some of the details of the algorithm.
We start by showing that because we root the GES-tree for SCC $X$ at a \emph{random} root $r$, if the GES-tree ends up being deleted in \ref{lne:ESdelete} in algorithm \ref{alg:delete}, this means that with constant probability $X$ has decomposed into smaller SCCs, and so progress has been made.
\begin{lemma}[c.f. also \cite{chechik2016decremental}, Lemma 13]
\label{lma:EStreeprob}
Consider an GES $\mathcal{E}_r = \mathcal{E}_{\textsc{Center}(X)}$ that was initialized on the induced graph of some node set $X_{Init}$, with $X \subseteq X_{Init}$, and that is deleted in line \ref{lne:ESdelete} in algorithm \ref{alg:delete}. Then with probability at least $\frac{2}{3}$, the partition $P''$ computed in line \ref{lne:DelSplit2} satisfies that each $X' \in P''$ has $|\textsc{Flatten}(X')| \leq \frac{2}{3}|\textsc{Flatten}(X_{Init})|$.
\end{lemma}
\begin{proof}
Let $i$ be the level of our hierarchy on which $\mathcal{E}_{r}$ was initialized, i.e. $\mathcal{E}_{r}$ was initialized on graph $\hat{G}_i[X_{Init}]$, and went up to depth $\delta$ with respect to $S_i$-distances (see Algorithm \ref{alg:newPart}).
Let $u_1, u_2, ..$ be the sequence of updates since the GES-tree $\mathcal{E}_r$ was initialized that were either adversarial edge deletions, nodes added to $S_i$ or node splits in the graph $\hat{G}_i[X_{Init}]$. Observe that this sequence is independent of how we choose our random root $r$, since they occur at a lower level, and so do not take any GES-trees at level $i$ into account. Recall, also, that the adversary cannot learn anything about $r$ from our answers to queries because the SCCs of the graph are objective, and so do not reveal any information about our algorithm. We refer to the remaining updates on $\hat{G}_i[X_{Init}]$ as \textit{separator} updates, which are the updates adding nodes to $S_{i+1}$ and removing edges incident to $S_{i+1}$ or between nodes that due to such edge deletions are no longer strongly-connected. We point out that the separator updates are heavily dependent on how we chose our random source. The update sequence that the GES-tree undergoes up to its deletion in line \ref{lne:ESdelete} is a mixture of the former updates that are independent of our chosen root $r$ and the separator updates.
Let $G^j$ be the graph $\hat{G}_i$ after the update sequence $u_1, u_2, ..., u_j$ is applied. Let $X_{max}^j$ be the component of $S_i$-diameter at most $\delta/2$ that maximizes the cardinality of $\textsc{Flatten}(X_{max}^j)$ in $G^j$. We choose $X_{max}^j$ in this way because we want to establish an upper bound on the largest SCC of $S_i$-diameter at most $\delta/2$ in $G^j$. We then show that that if a randomly chosen source deletes a GES-tree (see line \ref{lne:ESdelete}) after $j$ updates, then there is a good probability that $X_{max}^j$ is small. Then by the guarantees of lemma \ref{lma:split}, the $\textsc{Split}(\cdot)$ procedure in line \ref{lne:DelSplit2} partitions the vertices into SCCs $X'$ of $S_i$-diameter at most $\delta/2$, which all have small $|\textsc{Flatten}(X')|$ because $X_{max}^j$ is small.
More precisely, let $G^j_r$, be the graph is obtained by applying \emph{all} updates up to update $u_j$ to $\hat{G}_i[X_{Init}]$; here we include the updates $u_1, ..., u_j$, as well as all separator updates up to the time when $u_j$ takes place. (Observe that $G^j$ is independent from the choice of $r$, but $G^j_r$ is not.) Let $X_{max, r}^j$ be the component of $S_i$-diameter at most $\delta/2$ that maximizes the cardinality of $\textsc{Flatten}(X^j_{max, r})$ in this graph $G^j_r$. It is straight-forward to see that since $S_i$-distances can only increase due to separator updates, we have $|\textsc{Flatten}(X_{max, r}^j)| \leq |\textsc{Flatten}(X_{max}^j)|$ for any $r$. Further $|\textsc{Flatten}(X_{max, r}^j)|$ upper bounds the size of any component $X' \in P''$, i.e. $|\textsc{Flatten}(X')| \leq |\textsc{Flatten}(X_{max, r}^j)|$ if the tree $\mathcal{E}_r$ is deleted in line \ref{lne:ESdelete} while handling update $u_j$; the same bound holds if $\mathcal{E}_r$ is deleted after update $u_j$, because the cardinality of $\textsc{Flatten}(X_{max, r}^j)$ monotonically decreases in $j$, i.e. $|\textsc{Flatten}(X_{max, r}^{j})| \leq |\textsc{Flatten}(X_{max, r}^{j-1})|$ since updates can only increase $S_i$-distances.
Now, let $k$ be the index, such that
\[
|\textsc{Flatten}(X_{max}^k)| \leq \frac{2}{3}|\textsc{Flatten}(X_{Init})| < |\textsc{Flatten}(X_{max}^{k-1})|.
\]
i.e. $k$ is chosen such that after the update sequence $u_1, u_2,..., u_{k}$ were applied to $\hat{G}_i[X_{Init}]$, there exists no SCC $X$ in $G^k$ of diameter at most $\delta/2$ with $|\textsc{Flatten}(X)| > \frac{2}{3}|\textsc{Flatten}(X_{Init})|$.
In the remainder of the proof, we establish the following claim: if we chose some vertex $r \in \textsc{Flatten}(X^{k-1}_{max})$, then the GES-tree would not be been deleted before update $u_k$ took place. Before we prove this claim, let us point out that this implies the lemma: observe that by the independence of how we choose $r$ and the update sequence $u_1, u_2, ..$, we have that
\[
Pr[r \in X_{max}^{k-1} | u_1, u_2, ..] = Pr[r \in X_{max}^{k-1}] = \frac{|\textsc{Flatten}(X_{max}^{k-1})|}{|\textsc{Flatten}(X_{Init})} > \frac{2}{3}
\]
where the before-last equality follows from the fact that we choose the root uniformly at random among the vertices in $\textsc{Flatten}(X_{Init})$. Thus, with probability at least $\frac{2}{3}$, we chose a root whose GES-tree is deleted during or after the update $u_k$ and therefore the invoked procedure $\textsc{Split}(\cdot)$ ensures that every SCC $X' \in P''$ satisfies $|\textsc{Flatten}(X')| \leq |\textsc{Flatten}(X_{max}^k)| \leq \frac{2}{3}|\textsc{Flatten}(X_{Init})|$, as required.
Now, let us prove the final claim. We want to show that if $r \in X^{k-1}_{max}$, then the GES-tree would not have been deleted before update $u_k$. To do so, we need to show that even if we include the separator updates, the SCC containing $r$ continues to have size at least $\frac{2}{3}|\textsc{Flatten}(X_{Init})|$ before update $u_k$. In particular, we argue that before update $u_k$, none of the separator updates decrease the size of $X^{k-1}_{max}$. The reason is that the InSeparator computed in Line
\ref{lne:DelSepIn} of Algorithm \ref{alg:delete} is always run from a node $X$ whose $S_i$-distance from $r$ is at least $\delta$. (The argument for an OutSeparator in Line \ref{lne:DelSepOut} is analogous.)
Now, the InSeparator from $X$ is computed up to $S_i$-distance $\delta/2$, so by Property \ref{step:separator-distance} of Lemma \ref{lma:sep}, we have that all nodes pruned away from the component have $S_i$-distance at most $\delta/2$ to $X$; this implies that these nodes have $S_i$-distance more than $\delta/2$ from $r$, and so cannot be in $X^{k-1}_{max}$, because $X^{k-1}_{max}$ was defined to have $S_i$-diameter at most $\delta/2$. Thus none of the separator updates affect $X^{k-1}_{max}$ before update $u_k$, which concludes the proof of the lemma.
\end{proof}
Next, let us analyze the size of the sets $S_i$. We analyze $S_i$ using the inequality below in order to ease the proof of the lemma. We point out that the term $\lg(n -|X \cup S_i|)$ approaches $\lg n$ as the SCC $X$ splits further into smaller pieces. Our lemma can therefore be stated more easily, see therefore corollary \ref{cor:SisSmall}.
\begin{lemma}
\label{lma:setS}
During the entire course of deletions our algorithm maintains
\begin{align}
|S_0| &= n & \\
|S_{i+1}| &\leq \frac{32 \log n}{\delta} \sum_{X \in \hat{V}_{i}} \lg (n - |X \cap S_{i}|) |X \cap S_{i}| & \text{for }i \geq 0
\end{align}
\end{lemma}
\begin{proof}
We prove by induction on $i$. It is easy to see that $S_0$ has cardinality $n$ since we initialize it to the node set in procedure \ref{alg:preprocessing}, and since each set $S_i$ is an increasing set over time.
Let us therefore focus on $i > 0$. Let us first assume that the separator nodes were added by the procedure $\textsc{OutSeparator}(\cdot)$ (analogously $\textsc{InSeparator}(\cdot)$). Since the procedure is invoked on an induced subgraph $\hat{G}_i[X]$ that was formerly strongly-connected, we have that either $V_{Sep}$ or $X \setminus (V_{Sep} \cup S_{Sep})$ (or both) contain at most half the $S_i$-nodes originally in $X$. Let $Y$ be such a side. Since adding $S_{Sep}$ to $S_i$ separates the two sides, we have that RHS of the equation is increased by at least $\frac{32 \log n}{\delta} |Y \cap S_i|$ since $\lg( n - |Y \cap S_i|) |Y \cap S_i| - \lg( n - |X \cap S_i|) |Y \cap S_i| \geq |Y \cap S_i|$. Since we increase the LHS by at most $\frac{4 \log n}{\delta} |Y \cap S_i|$ by the guarantees in lemma \ref{lma:sep}, the inequality is still holds.
Otherwise, separator nodes were added due to procedure $\textsc{Split}(\cdot)$. But then we can straight-forwardly apply lemma \ref{lma:splitFull} which immediately implies that the inequality still holds.
Finally, the hierarchy might augment the set $S_i$ in line \ref{lne:augmentInDelete}, but we observe that $f(s) = \lg(n - s) * s$ is a function increasing in $s$ for $s \leq \frac{1}{2} n$ which can be proven by finding the derivative. Thus adding nodes to the set $S_i$ can only increase the RHS whilst the LHS remains unchanged.
\end{proof}
\begin{corollary}
\label{cor:SisSmall}
During the entire course of deletions, we have $|S_{i+1}| \leq \frac{16 \lg^2 n}{\delta} |S_{i}|$, for any $i \geq 0$.
\end{corollary}
\section{Putting it all together}
\label{sec:alltogether}
By corollary \ref{cor:SisSmall}, using $\delta = 64 \lg^2 n$, we enforce that each $|S_i| \leq n/2^i$, so $\hat{G}_{\lfloor \lg{n} \rfloor + 1}$ is indeed the condensation of $G$. Thus, we can return on queries asking whether $u$ and $v$ are in the same SCC of $G$, simply by checking whether they are represented by the same node in $\hat{G}_{\lfloor \lg{n} \rfloor + 1}$ which can be done in constant time.
We now upper bound the running time of our algorithm by $O(m \log^5 n)$ and then refine the analysis slightly to obtain the claimed running time of $O(m \log^4 n)$.
By lemma \ref{lma:EStreeprob}, we have that with probability $\frac{2}{3}$, that every time a node leaves a GES, its induced subgraph contains at most a fraction of $\frac{2}{3}$ of the underlying vertices of the initial graph. Thus, in expectation each vertex in $V$ participates on each level in $O(\log n)$ GES-trees. Each time it contributes to the GES-trees running time by its degree times the depth of the GES-tree which we fixed to be $\delta$. Thus we have expected time $O(\sum_{v \in V} \mathbf{deg}(v) \delta \log n) = O(m \log^3 n)$ to maintain all the GES-trees on a single level by lemma \ref{lma:AugmentedGES}. There are $O(\log n)$ levels in the hierarchy, so the total expected running time is bounded by $O(m \log^4 n)$.
By lemmas \ref{lma:splitFull}, the running time for invoking $\textsc{Split}(G[X], S, \delta/2)$ can be bounded by $O(E(X) \delta \log n) = O(E(X) \log^3 n)$. After we invoke $\textsc{Split}(G[X], S, \delta/2)$ in algorithm \ref{alg:delete}, we expect with constant probability again by lemma \ref{lma:EStreeprob}, that each vertex is at most $O(\log n)$ times in an SCC on which the $\textsc{Split}(\cdot)$ procedure is invoked upon. We therefore conclude that total expected running time per level is $O(m \log^4 n)$, and the overall total is $O(m \log^5 n)$.
Finally, we can bound the total running time incurred by all invocations of $\textsc{InSeparator}(\cdot)$ and $\textsc{OutSeparator}(\cdot)$ outside of $\textsc{Split}(\cdot)$ by the same argument and obtain total running time $O(m \log^2 n)$ since each invocation takes time $O(E(G))$ on a graph $G$.
This completes the running time analysis, establishing the total expected running time $O(m \log^5 n)$. We point out that the bottleneck of our algorithm are the invocations of $\textsc{Split}(\cdot)$. We can reduce the total expected cost of these invocations to $O(m \log^4 n)$ by using the more involved upper bound on the running time of $\textsc{Split}(\cdot)$ of
\[
O\left(\delta E(X) + \delta \sum_{X \in P} \log( n - |\textsc{Flatten}(X)|) E(X) \right)
\]
where we use $|\textsc{Flatten}(X)|$ instead of $|X|$ to capture node splits. Then, we can bound the costs incurred by the first part of the bound by $O(m \log^4 n)$; for the second part we also get a bound $O(m \log^4 n)$ by using a telescoping sum argument on the size of the graph.
This concludes our proof of theorem \ref{thm:SCCmain}.
\section{Conclusion}
In this article, we presented the first algorithm that maintains SCCs or SSR in decremental graphs in almost-linear expected total update time $\tilde{O}(m)$. Previously, the fastest algorithm for maintaining the SCCs or SSR achieved expected total update time $\tilde{O}(m \sqrt{n})$. Three main open questions arise in the context of our new algorithm:
\begin{itemize}
\item Can the complexity of the Single-Source Shortest-Path problem in decremental directed graphs be improved beyond total expected update time of $O(mn^{0.9 + o(1)})$\cite{henzinger2014sublinear, henzinger2015improved} and can it even match the time complexity achieved by our algorithm?
\item Does there exist a \textit{deterministic} algorithm to maintain SCCs/SSR in a decremental graph beyond the $O(mn)$ total update time complexity?
\item And finally, is there a algorithm that solves All-Pairs Reachability in fully-dynamic graphs with update time $\tilde{O}(m)$ and constant query time? Such an algorithm is already known for dense graphs\cite{demetrescu2004new} but is still unknown for graphs of sparsity $O(n^{2-\epsilon})$.
\end{itemize}
\paragraph{Acknowledgements}
The second author of the paper would like to thank Jacob Evald for some helpful comments on organization and correctness.
\pagebreak
\printbibliography[heading=bibintoc]
\pagebreak
| {'timestamp': '2019-03-15T01:07:44', 'yymm': '1901', 'arxiv_id': '1901.03615', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03615'} | arxiv |
\section{Introduction}\vspace{-1mm}
Finding products that look similar to a particular product is an important feature for a modern e-commerce platform. The visual appearance of a product captures a user’s intent and choices. This information when utilized correctly can boost up a user’s experience and purchase conversions. Collaborative filtering recommends products based on similar user behavior on the platform, but it ignores the product features and also faces the cold-start problem. Retrieval of images using Gabor filters, HOG \cite{c1} and SIFT \cite{c2} are well discovered previously, but are noted to less effective, especially in the case of fashion apparel category, since the performance of these methods largely depend on the representation power of the handcrafted features which are difficult to create. A robust solution here would be the one which can capture fine-grained visual details like shape, pattern, type of print, etc. CNN aids here by converting a product image to an array of numerical embeddings giving the intensity of learned features which differentiates a product. After obtaining this feature vector, a distance matrix can be used to get the visually similar products.
Our approach called RankNet uses a multi-scale siamese network shown in Fig 1. to identify similar images and retrieve them in order of their rank which is a function of the distance between two embeddings in the multi-dimensional space. This distance is calculated using a fractional distance matrix \cite{c3}, unlike the traditional Euclidean distance. Our extensive evaluation has verified that using the fractional distance matrix instead of Euclidean distance not only improves the model accuracy in ranking the images but also in jointly learning the features. Therefore by using supervised similarity information, we can achieve more efficient deep ranking models.
Here, we also address the problems of retrieving a list of visually similar images to a particular query image, both belonging to the same catalog (Visual Recommendations) as well as of retrieving a list of images belonging to the catalog similar to a user-uploaded wild image (Visual Search). The core task addressed by both problems in our work is the quantitative estimation of visual similarity. There are several challenges in dealing with these problems which we have mentioned in this paper. Our image ranking algorithm determines whether a given set of images are visually similar to a particular image by evaluating an image on both higher level and fine-grained visual features. The major progress in image ranking field is in two broad areas: \\
1. Metric learning based \\
2. Image embeddings \\
Each image can be considered a compact feature vector, embedded in a multidimensional space. In recent years many known typical image descriptors like SIFT, HOG and local binary patterns (LBP) \cite{c48} were replaced by some state of the art image CNN which generates feature descriptors. The CNN learns on its own by undergoing supervised training. In order to learn a distance metric, metric-based learning is used which learns from a set of marked training images, plotted in a multi-dimensional embedding space that captures the notion of image similarity. A multi-scale deep Convolutional Neural Network is used by RankNet in form of a Siamese network in order to learn a 4096-dimensional embedding of the query image. In order to project images pairs into a 4096-dimensional space, the network has to learn a set of hierarchical nonlinear transformations during which the network tries to gradually minimize proximity between the positive pair and similarity gradually maximize the proximity for the negative pair. \\
In order to achieve a good model performance and better model convergence, it is really important to choose the right pair of positive images (visually similar images) and negative images (visually non-similar images) for training as a siamese network trains on pairs of images. For consistently fetching the right pair of images, we propose a pair sampling strategy inspired by curriculum learning.
Thus the three major contributions of this paper are:
\vspace{-2mm}
\begin{itemize}
\item A Siamese network consisting of a multi-scale deep CNN that learns a 4096-dimensional embedding of the image to capture the notion of visual similarity.
\item A fractional distance matrix to calculate the embedding distance between two images in an n-dimensional space instead of the conventional Euclidean distance.
\item Implementation of an angular loss equation to train a multi-scale CNN to capture fine-grained image similarity between sample images.
\end{itemize}
To determine the performance, we measured the fraction of the correct ordering done by our model. We also compare our proposed RankNet with other state-of-the-art methods for different datasets. The conducted experiments show how RankNet outperforms not only the hand-crafted visual feature-based approaches but also deep ranking models by a considerable margin. \\
We used VGG19 pretrained on Imagenet dataset at the base of our model to get better-initialized weight matrix for training RankNet.
\begin{figure}[htp]
\centering
\includegraphics[width=8cm]{1.jpg}
\caption{Siamese Network Architecture}
\label{fig:captioning}
\end{figure}
\vspace{-2mm}
\section{Related work}
\vspace{-1mm}
A Broad exploration of image similarity has been done using : \\
1. Image content to find similar images \\
2. Text describing the image \\
3. Semantic \\
4. Sketches which help in retrieving similar images \\
5. Approaches based on annotation \cite{c5} \\
All the above approaches use a common computation approach, i.e collect an image database and store it for reference during the inference phase. They aim to compute a similarity function which when given a new image, retrieves similar images from the storage. Earlier image similarity models focused on ways to efficiently crawl and gather reference image data in order to compute similarity. These traditional approaches were little efficient and fast. They use local visual features and other global features [8-11] like color, texture, and shape to design heuristic functions. Some popular ways to compute image similarity were SURF, SIFT, and ORB \cite{c6}. Later in 2005 LeCun et al explored image similarity using convolutional neural networks on a task to retrieve/recognize Handwritten data by using Siamese architecture \cite{c7}.\\
In \cite{c12,c13,c14} the authors have studied image similarity making the models learn on traditional computer vision features like SIFT and HOG. However, the expressive power of these computer vision features makes these model limited. Recently researchers who used deep convolutional neural networks for object recognition have reported great success \cite{c15,c16,c17}. In a deep CNN, the convolutional layers learn a representation of the image with an increasing abstraction level. The descriptor vector which the final layer learns from the image is robust to scale variations and other factors such as viewpoint differences, occlusion, and location of entities within an image. However, when it comes to visual similarity, these descriptors are not much useful since visual similarity is a composite function of both high-level and low-level abstract features/details. The lower-level features are learned to be ignored by an object detection network because for a network need not worry about the color/model of the car to detect it, it simply tries to locate a car shaped object (high-level feature) within the image. This shows that object recognition models learn features common to all the samples in the category, overlooking the details or lower level features which are very important for capturing the notion of visual similarity, thus reducing their effectiveness in the use case of similarity estimation.\\
We compare the results of using features learned in AlexNet \cite{c15}, VGG16 \cite{c4} , and VGG19 \cite{c4}in section four (9). Apart from conventional feedforward networks, siamese networks \cite{c7} are also used for visual similarity assessment. Siamese networks use a contrastive loss function to evaluate the input batch and generate a gradient to optimize the network made up of two CNN's with shared weights. The input to a siamese network is a pair of images which are either similar or dissimilar depending on the ground truth label. Although a Siamese network trains to tackle the very problem of visual similarity which we are addressing, its final prediction being binary (similar/dissimilar) fails the objective of capturing fine-grained visual similarity. Therefore in our approach RankNet, we tackle this architectural bottleneck of binary classification and modify it to learn the fine-grained similarity with the help of densely connected embedding layers.
\vspace{-2mm}
\section{Data Used}
\vspace{-1mm}
In this research, we explored four datasets to train and test our model. Although the performance of our model is evaluated only on Exact Street2Shop dataset.
1. \textbf{Fashion-MNIST} \cite{c18} is Zalando's article image dataset. It has a training set of 60,000 samples and a test set of 10,000 samples. All the sample images of Fashion-MNIST are 28x28 in size and grayscale. All the samples of the dataset belong to 10 object classes namely - top, trouser, pullover, dress, coat, sandal, shirt, sneaker, bag, and ankle boot.
2. \textbf{CIFAR10} \cite{c19} is the second dataset we chose for training RankNet. CIFAR10 is an established dataset used in computer vision for object detection. It has a training set of 50,000 samples and a test set of 10,000 images. All the image samples in CIFAR10 are three channeled colored images and 32x32 in size. Each class of CIFAR10 contains exactly 6000 samples and the test set consists of 1000 randomly-selected images per class. The training images are randomly ordered and each batch of training data contains exactly 5000 samples per class. As CIFAR10 is a publicly available dataset, the class distribution of the dataset is ensured in the train and test subsets.
3. \textbf{Exact Steet2Shop} \cite{c20} is the third dataset we used. The street2shop dataset contains 20,000 images under the wild subset (street images) and 4,00,000 images under the catalog subset (shop images). These photos are categorized across eleven fashion categories that have 39,000 pairs of exact matching products between the shop and the street.
4. The fourth dataset used was published by the authors of the paper \cite{c21} in June 2014. The images in the dataset are hand labeled high-quality triplets. The positive(“p”) and negative(“n”) images belong to the same query text as the query(“q”) image. This dataset provides ranking information for similar images belonging to the same text query. The dataset contains 1599 images which group up to become 5033 triplet pairs. We don't have all the 14000 triplets which are stated in the paper \cite{c21} because the publisher of the data cannot retrieve the public URL links for those images.
The model hyper-parameter and training was optimized by using five-fold cross-validation and the final trained models are evaluated on the basis of accuracy and recall. The test set is only used once at end of the training phase to record the performance of the final model.
\vspace{-2mm}
\section{Architecture}\vspace{-1mm}
\subsection{Deep Ranking Siamese Network}
We see the problem as one of image visual similarity and chose to use a Siamese architecture for learning the embeddings of the data. The siamese network consists of two convolutional neural networks with shared weights which are optimized during training by minimizing a loss function. In our approach, a siamese network is treated as a function f which estimates a particular embedding position for an image I by mapping the sample into an embedding space. The x position in the embedding space can be stated as, given certain parameter $\theta$, x = f(I;$\theta$) , where I stands for the input of the network (image) and $\theta$ denotes the vector representing all the parameters of the neural network which contains all the biases and neuron weights for the convolution layers as well as the inner product layers. The number of parameters is typically in a range of one million to one-fifty million depending on the architecture and size of the feed-forward network. The aim of the experiment is to produce an embedding with desirable properties by solving for the $\theta$ parameter through the function f such that it places similar images together and dissimilar images apart. The network takes two images as input (see Fig.1) i.e. consider an input pair that contains two different visual views of the same image made using data augmentation or two visual variations within the same apparel category, such a pair is called a positive pair (I\textsubscript{q}, I\textsubscript{p}) and another pair which contain images from different categories, such a pair is called a negative pair (I\textsubscript{q}, I\textsubscript{n}). The input images are then mapped by the network into an embedding space. If the input is (I\textsubscript{q}, I\textsubscript{p}, I\textsubscript{n}) then we can assume the embedding positions to be (X\textsubscript{q}, X\textsubscript{p}, X\textsubscript{n}) and if (X\textsubscript{q}, X\textsubscript{p}) area nearby while (X\textsubscript{q}, X\textsubscript{n}) are further apart then the network has learned a good embedding. A deep convolutional neural network generates these image embeddings. There are Y layers in a deep CNN and Z\textsubscript{y} neurons in the y\textsuperscript{th} layer, where y = 1, 2, 3, ..., Y. When an image x is fed to the network, the y\textsuperscript{th} layer processes it to give an output of the form H\textsubscript{y} = S ( W\textsubscript{y} . x + B\textsubscript{y} ) where B\textsubscript{y} denotes the bias vector and W\textsubscript{y} denotes the weights of a projection matrix to be learned by the y\textsuperscript{th} layer. s denotes a non-linear activation function here rectified linear unit \cite{c22}. Ultimately we get a non-linear polynomial parametric method f that accurately maps an i dimensional input image to an embedding subspace of e dimensions in the y\textsuperscript{th} layer. The property of this subspace is that it keeps similar images together and dissimilar images further apart. The loss of the network is formalized using the contrastive loss function \cite{c23} which is employed to the parameters of a parameterized function in such a way that the neighbors are embedded together and the non-neighbors are pushed apart.
\begin{equation}
L(\theta) = \frac{( 1 - Y)}{2}D(X_q,X_p)^2 + \frac{Y}{2}(max(0,m - D(X_q,X_n)^2)
\end{equation}
\textbf{Eq.1}: L is the contrastive loss function. The equation calculates loss per sample during training. Any change in m has no affect on the learning as distance matrix simply scales accordingly, m = 1.\\
Eq. 1 defines the training loss for one training pair, where m = 1. It is logically clear that changing the value of m would not impact the learning of the network as the distance metric would simply scale accordingly. In the loss equation, label Y = 1 is assigned to dissimilar or negative image pairs whereas Y = 0 is alloted to similar or positive image pairs. Lastly the deep Convolutional neural networks of the siamese network shares weights which are iteratively optimized using gradient descent by the contrastive loss function L.\\
\begin{figure}[htp]
\centering
\includegraphics[width=8cm]{2.jpg}
\caption{In the above illustration positive and negative pairs are fed as input during the training phase. After training, the network tends to embed dissimilar class/category images further as compared to similar/positive images in the 4096 dimensional embedding subspace}
\label{fig:captioning}
\end{figure}
\vspace{-2mm}
\subsection{Contrastive loss function}
Contrastive loss function (L) \cite{c23} is a distance-based Loss function as opposed to prediction error-based loss functions like logistic loss or hinge loss used in classification. Like any other distance-based loss function, it tries to ensure that semantically similar examples are embedded close together. It is calculated on pairs (other popular distance-based Loss functions are Triplet \& Centre Loss, calculated on triplets and point-wise respectively).\\
When similar image pair (label Y = 0) is fed to the network, the right-hand additive section of Eq.1 nullifies and the loss becomes equal to the part containing the positive pair distance between the embeddings of two similar images. Thus if two images are visually similar, the gradient descent reduces the distance between them which is learned by the network. On the other hand, when two dissimilar images(label Y = 1) are fed to the network, the left-hand additive section goes away and the remaining additive section of the equation basically works as a hinge loss function. If the image pair is completely dissimilar and the network outputs a pair of embedding whose proximity is greater than m, then the value of the loss function is maximized to zero else if the images are somewhat similar then we trigger the proximity minimization by optimizing the weights as there is an error. The value m is the margin of seperation between negative and positive samples and is decided empirically. When m is large, it pushes dissimilar and similar images further apart thus acting as a margin. In our work, we have used m = 1.
\subsection{Fractional Distance matrix}
To compute the distance between two embeddings, we used a fractional distance matrix. It has been observed that the Manhattan distance metric provides the best discrimination in high dimensional data spaces. The curse of high dimensionality has a great effect on problems such as nearest neighbor search, indexing, and clustering because in higher dimensional spaces the data metrics become sparser, and the conventional algorithmic and indexing methods fail from an efficiency perspective. The basic concept of proximity or distance is no longer qualitatively meaningful. It has also been observed that under certain reasonable assumptions on the distribution of data, the ratio of the distances of the nearest and farthest point from a given referential point in a high dimensional space approaches 1 for various distance functions and data distributions. Thus in such a case, the problem of nearest neighbor becomes ill-defined as the contrast which distinct two different data points does not exist. Thus in our research, we view the dimensionality curse from an angle of the distance metrics which are used to evaluate the similarity between different subjects. We specifically focused on the use of L\textsubscript{k} norm and inferred that in higher dimensions, the qualitative meaning of proximity is sensitive to the value of k in an L\textsubscript{k} norm. This motivated us to use distance metrics where the value of k is less than 1 ( here 0.2 to 0.3). As stated in \cite{c3}, we will call this distance metrics as fractional distance metrics.
\subsection{Angular Loss}
We also did a lot of experimentation with the loss function employed in our architecture and came to another optimum loss calculation method for training RankNet. In this section we would explain the reason for considering a second loss calculation function for RankNet, which also showed a comparative performance is optimizing the neural network weight matrix.\\
In recent years many forms of deep learning metric have been introduced, but still the major focus of all these forms are either minimizing the Contrastive loss in a Siamese network or the hinge loss in a triplet network. However, it is clearly observed that directly optimizing a distance oriented objective in machine learning is not easy and requires the application of many practical tricks such as hard negative mining and multi-task learning. Recently some work on the N-pair loss and the lifted structure has proposed a better strategy for effectively mining the relation within a mini-batch. But all these studies and works revolves around a common distance based learning between negative and positive pair of images. In our work, we hypothesize that for effectively training deep metric based learning, we must overcome these difficulty by redefining and solving the limitation for the objective in terms of distance. The first limitation of using distance metric is that it is sensitive to scale change. Other than this, it is also noted that the gap between dissimilar clusters is constrained by using the traditional triplet loss methodology. In the above mentioned techniques, different clusters in different scales of intra-class variation are assigned a same absolute margin value, which is logically inappropriate. Also a sub-optimal convergence is achieved in a high-order solution space when we optimize distance-based objectives using stochastic training.\\
In order resolve these issues, we implement a novel angular loss equation proposed by Baidu researchers in \cite{c49} to enhance conventional distance metric learning. The approach is to include the angle formed on the negative anchor by encoding it as a representation of third-order relation existing inside the triplets. Our implemented method pushes the negative sample away from the centroid of the positive cluster by constraining the upper bound of the angle and similarity drags the positive samples towards the centre as the training progresses. The idea behind this implementation is similar to the utilization of high-order details for augmenting pair-wise compulsions in the field of Markov random fields and graph matching. Therefore the implemented angular loss enhances the traditional distance-based loss metric in two ways. Firstly its rotational-invariant and scale-invariant by nature unlike the conventional distance-based metric. This makes our objective of replacing distance-based metric more robust and invariant of the local feature map.\\
However, constraining the angle at the anchor between the the negative and positive sample is more reasonable as it is proportional to the relative ratio among the proximity calculated between the embeddings. Also the angle defines this third-order triangulation within the three samples embedded in the multi-dimensional space. Therefore, given a triplet, the angular loss encodes the local structure of the triplet more accurately than the distance-based triplet loss. Our implementation is broad and can be potentially merged with any other metric learning framework also. In this version of the paper we have not published the results of angular loss implementation.
\begin{equation}
L_{A}(\theta) = max(0, D(X_a,X_p)^2 - 4 tan^2 \alpha D(X_a,X_c)^2)
\end{equation}
\textbf{Eq.2}: L is the angular loss function which calculates the loss per sample triplet during the traing. X\textsubscript{a} is the embedding of the query image, X\textsubscript{p} is the positive image embedding, X\textsubscript{c} is the mean embedding of query and positive and X\textsubscript{n} is the negative image embedding. Alpha is the angle between the negative and positive embedding with query as the anchor point.\\
\vspace{-2mm}
\section{Training Data}\vspace{-1mm}
The training data which is used to train RankNet consists of two type of pair of images - (1) Positive Pair ( Similar images ) and (2) Negative Pair (Dissimilar Images). Before the training, in order to generate these pairs, a query image is randomly sampled from the dataset. After sampling the query image, a set of positive candidate images are programmatically selected from the datset in a bootstrapping fashion with the help of some image similarity scoring techniques. A BISS or basic image similarity scorer need not to be highly accurate or good at recalling. It need not have a good precision ( gets only the similar images), rather it should identify and retrieve the most reasonably alike images that are visually similar to the query image. Thus a basic image similarity scorer should focus on a sub-aspect of visual similarities like color or pattern. Our scorer programmatically selects 100 nearest neighbors from the same class to the query image from the dataset, and create a sample space of the positive images from the retrieved data points. Similarly, negative images are also sampled programmatically by the scorer into two groups, out-of-class samples and in-class samples. The former refers to samples from the same category as that of the query image whereas the latter refers to the samples from some other category as that of the query image. In-class samples teach fine-grained image similarity \cite{c21} to the network as they are not very different from the query image. On the other hand, out-of-class samples teach coarse distinction to the network as they are very different from the query image. In our research, we retrieved the in-class samples from the set union of all the basic image similarity scorers whereas the out-of-class samples were retrieved from the remaining data distribution but within the sample query category / class set. The final sampling was biased so that the data slices contains a ratio of 3:7, which means 30 percent in-class negative samples and 70 percent out-of-class negative samples. We used multiple basic image similarity scorers like ColorHist, AlexNet, and PatternNet. In AlexNet and PatterNet, basic pre-trained model are used and the FC7 layer features of these network are extracted for encoding the image into a multi-dimensional vector. The foreground of the image is segmented in ColorHist (LAB histogram), and then after that, the skin is removed.\\
To show the superiority of our methodology, we also explored and compare our approach to a naïve approach of using curriculum learning where the positive and negative images pairs are sampled randomly.
\vspace{-2mm}
\section{Multi-scale Convolutional Neural Network}\vspace{-1mm}
Our aim was to have a high-precision embedding of the images, therefore we used a deep convolutional neural network that incorporates different levels of invariance at various scales \cite{c26,c27}. Deep CNN easily learns to encode strong invariance into their architecture during training, which makes them achieve a good performance for image classification. The strong invariance encoded in the CNN generally grows higher towards the top layers but this growing invariance makes it hard to learn the fine-grained image visual similarity. The final embedding of the image might not be able to capture the simpler sub-aspects of the data sample like colors, pattern and shape. The architecture is shown in Fig. 3 comprises mainly of three CNN's, out of which CNN1 has an architecture similar to that of VGG19's convolutional neural network \cite{c4}. This CNN is used to encode strong invariance and capture the semantics present in the image because it has 19 convolutional layers. Among the 19 layers, the top layers are good at encoding complex representation of image features. The other two CNN's (CNN2 and CNN3 respectively) use a shallower network architecture to capture the down-sampled images. Due to the shallower architecture, these CNN's have less invariance and are used to capture simpler aspects like shapes, pattern, and color which makes the visual appearance of an image. Thus employing three different convolution neural networks instead of a single CNN and making them share lower level layers, makes each CNN independent of the other two. At last, the embeddings from the three convolutional neural networks are normalized and combined with a 4096-dimensional linear embedding layer which encodes and represents an input image as a 4096-dimensional vector. In order to prevent overfitting, we used L2 normalization. Final results show that our multi-scale convolutional neural network outperforms single scale convolutional neural networks on the image similarity task. A major factor responsible for the result is that we combined the embeddings across multiple sub-spaces. The VGG19 \cite{c4} like CNN has a high entropic capacity because of its 4096-dimensional final layer which allows the network to effectively encode the information into the subspaces. Whereas the shallower networks(CNN1 and CNN2) emphasis on fewer dimensions(512 and 1024 dimensions respectively) due to the sparsity of the higher dimensional subspaces.
\begin{figure}[htp]
\centering
\includegraphics[width=8cm]{3.jpg}
\caption{Multi-scale convolutional neural network}
\label{fig:captioning}
\end{figure}
\vspace{-2mm}
\section{Implementation}\vspace{-1mm}
Here we shortly demonstrate our observations and implementation details for training a multi-scale CCN like RankNet end-to-end. RankNet is a complex system and our main concerns were preventing and detecting overfitting of the model, especially when employing our training data generation strategy where we do not expose all the possible pairs to the model.
\vspace{-1mm}
\subsection{Deep Ranking Siamese Network}
We fine-tuned pre-trained models using transfer learning \cite{c28}, in order to achieve a faster model convergence. We used a VGG19 like CNN which was initially pre-trained on the ImageNet dataset and fine-tuned the model using a very slow learning rate and RMSProp optimizer which has an adaptive learning rate \cite{c29} instead of an non-adaptive optimizer like stochastic gradient descent \cite{c27}. This gives us more control over the magnitude of the generated updates. We also experimented with the learning rate, decay rate, and optimizer momentum so that the optimizer can continue to make updates towards the global minimum of the loss when the learning rate starts to shrink to smaller numbers. These factors also prevent the network from getting stuck in local minima. We also kept in mind that while fine-tuning a pre-trained model, the updates of the weights using the calculated gradient should be very minute so as not to completely wreck the pre-learned weights, therefore setting the right learning rate is very crucial for convergence. Learning rate can be defined as the step size by which the gradient is multiplied for the network to update itself during backward propagation. It is also noted that if the training loss does not fall very rapidly at the beginning of the initial epoch, then it is advisable to stop the training and adjust the learning rate accordingly. Due to the presence of noise in the training set, selecting the correct number of epochs for training is very necessary for the neural network to converge without overfitting on data. Also the difference between the validation loss of two adjacent epochs give valuable insights into the training phase of the model during cross-validation. Therefore by employing correct number of training epochs and an optimum learning rate, we observe a decreasing trend in the validation loss. The decreasing trend also shows some minor fluctuations throughout it's cycle. We experimented with the hyperparameters like the number of convolutional filters, stride dimensions, padding parameter, learning rate, optimizer and number of layers to get the best fitting solution. Our training set was preprocessed and the data was shifted to unit mean and normalized to speed up the process of convergence.\\
The architecture was implemented in Keras \cite{c32}. The model training was done on a cluster of a nVidia machine, 1 CPU with 16 cores and 4 NVIDIA Tesla K80 GPUs with 2 x 2496 cores and 12 GB and 4 GB RAM respectively. Each epoch (\textgreater10000 iterations) took roughly 5 hours to complete.
\vspace{-1mm}
\subsection{Overfitting}
We augmented the image data with random transformations so that no image appears twice. This helped RankNet to become more robust and prevented overfitting. We also employed dropout in our architecture to prevent overfitting because dropout not only prevents the learning of a redundant pattern by a layer but also acts analogously to data augmentation. Therefore both image augmentation and dropout help to disrupt any random correlations existing in our dataset. It has also been observed that dropout \cite{c30} and L1 norm \cite{c31} are essentially equivalent to prevent overfitting. This fact helped us while merging the embeddings across different convolutional sub-spaces in our multiscale neural network. We also monitored the number of layers to be trained in the pre-trained CNN because fine-tuning a pre-trained convolutional network is tricky sometimes and it depends on the volume of data. As fine-tuning a pre-trained model using less amount of data can result in an overfitted model [33, 34], so in our case, we only fine-tuned the top two convolutional layers.
\vspace{-1mm}
\subsection{Testing}
The test split of the data was used only once for testing at the completion of training to generate a generalized performance report for our model. Our test set was populated for hyper-parameter tuning and we used five fold cross-validation for selecting our hyperparameters. The test results are reported in the next section of this paper.
\section{Results \& Conclusion
We evaluated our models on test sets which were split apart from the complete dataset in the beginning. The test sets contain the same number of categories as that in the training set and also the class distribution was similar to that of the training data. The similar distribution also ensures that a generalized performance of the model is being measured.
\begin{figure}[htp]
\centering
\includegraphics[width=8cm]{5.png}
\caption{Image Retrieval of Ranknet}
\label{fig:captioning}
\end{figure}
\subsection{Embedding space visualization}
In Fig.5 we visualized the embedding space. The embedding space represents the final 4096 dimensions to which an image is mapped. Here we have projected the embedding space to 2D using t-SNE [35]. t-SNE is a distributed stochastic neighbor embedding algorithm used for dimensionality reduction and visualization of high-dimensional datasets. It is implemented using Barnes-Hut approximations which allows it to become applicable on large real-world datasets.
In our visualization, the different category of images can be seen grouped nearby. Thus showing that in general RankNet performs optimally in projecting similar images close by in the embedding space.
\begin{figure}[htp]
\centering
\includegraphics[width=8cm]{tsne.png}
\caption{t-SNE Visualisation on last layer of RankNet for Street2Shop Test Data - catalog images}
\label{fig:captioning}
\end{figure}
\subsection{Evaluation Metric}
We evaluated all the trained models in terms of accuracy and top-20 recall. The top-20 recall evaluation metric is inspired from \cite{c20}. In top-20 recall it is calculated that in what percent of the cases the correct catalog item matching the query sample in wild image was present in the top-k similar items returned by the model. We employed the contrastive loss function to train the network loss as described in section 4. Baseline model was AlexNet CNN pre-trained on Imagenet. We have shown the evaluaton metric results from the trained models in Table 1 and 2.
\begin{table}[h]
\caption{Validation Accuracy (\%) at Triplet Recall on Exact Street2Shop}
\label{table_example}
\begin{center}
\begin{tabular}{|c||c|}
\hline
Model & Accuracy (\%)\\
\hline
\hline
Ranknet & 94.98\\
\hline
AlexNet & 90.8\\
\hline
Visnet & 93.39\\
\hline
\end{tabular}
\end{center}
\end{table}
\begin{table}[h]
\caption{ Top-20 Recall {\%} on Exact Street2Shop Test Data}
\label{table_example}
\begin{center}
\begin{tabular}{|c||c|}
\hline
Model & Recall (\%)\\
\hline
\hline
Ranknet & 88.576\\
\hline
AlexNet & 14.400\\
\hline
Visnet & 87.914\\
\hline
\end{tabular}
\end{center}
\end{table}
\section{Summary}
In this paper, we presented our architecture known as RankNet to achieve image visual similarity on a given query/reference image. For training, we employed a multi-scale convolutional neural network in a siamese architecture to capture the notion of fine-grained image similarities better than the traditional convolutional neural networks and other deep ranking models which train on triplets \cite{c36} . We also presented a fractional distance matrix to calculate the distance between two data points in a multi-dimensional embedding space, which outperforms the traditional technique of euclidean distance in capturing the idea of proximity in a multi-dimensional space.
{\small
| {'timestamp': '2019-01-14T02:13:38', 'yymm': '1901', 'arxiv_id': '1901.03546', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03546'} | arxiv |
\section{Evading Malconv by Manipulating the File Header}
\label{sec:attack}
We showed that MalConv bases its classifications upon unreliable and spurious features, as also indirectly shown by state-of-the-art attacks against the same network, which inject bytes in specific regions of the malware sample without even altering the embedded malicious code~\cite{kolosnjaji2018adversarial,kreuk2018adversarial}.
In fact, these attacks can not alter the semantics of the malware sample, as it needs to evade the classifier while preserving its malicious functionality. Hence, not all the bytes in the input binary can be modified, as it is easy to alter a single instruction and break the behavior of the original program.
As already mentioned in Section~\ref{sec:intro}, the only bytes that are allowed to be perturbed are those placed in unused zones of the program, such as the space that is left by the compiler between sections, or at the end of the sample.
Even though these attacks have been proven to be effective, we believe that it is not necessary to deploy such techniques as the network under analysis is not learning what the developers could have guessed during training and test phases.
Recalling the results shown in Section~\ref{sec:what_learns}, we believe that, by perturbing only the bytes inside the DOS header, malware programs can evade MalConv.
There are two constraints: the \texttt{MZ} magic number and the value at offset $0x3c$ can not be modified, as said in Section~\ref{sec:what_learns}.
Thus, we flag as editable all the bytes inside the DOS header that are contained in that range.
Of course, one may also manipulate more bytes, but we just want to highlight the severe weaknesses anticipated in Section~\ref{sec:interpretation}.
\myparagraph{Attack Algorithm} Our attack algorithm is given as Algorithm~\ref{alg:algo1}.
It first computes the representation of each byte of the input file $\vct x$ in the embedded space, as $\mat Z \leftarrow \phi(\vct x)$.
The gradient $\mat G$ of the classification function $f(\vct x)$ is then computed w.r.t. the embedding layer.
Note that we denote with $\vct g_i, \vct z_i \in \mathbb R^8$ the $i^{\rm th}$ row of the aforementioned matrices.
For each byte indexed in $I$, {i.e.}\xspace, in the subset of header bytes that can be manipulated, our algorithm follows the strategy implemented by Kolosnjaji et al.~\cite{kolosnjaji2018adversarial}.
This amounts to selecting the closest byte in the embedded space which is expected to maximally increase the probability of evasion.
The algorithm stops either if evasion is achieved or if it reaches a maximum number of allowed iterations.
The latter is imposed since, depending on which bytes are allowed to be modified, evasion is not guaranteed.
The result of the attack applied using an example can be appreciated in Figure~\ref{fig:evading}: the plot shows the probability of being recognized as malware, which is the curve coloured in blue.
Each iteration of the algorithm is visualized as black vertical dashed lines, showing that we need to interpret the gradient different times to produce an adversarial example.
This is only one example of the success of the attack formalized above, as we tested it on 60 different malware inputs, taken from both \textit{The Zoo}\footnote{\url{https://github.com/ytisf/theZoo}} and \textit{Das Malverik}.\footnote{\url{http://dasmalwerk.eu/}}
Experimental results confirm our doubts: 52 malware programs over 60 evade MalConv by only perturbing the DOS header.
Note that a human expert would not be fooled by a similar attack, as the DOS header can be easily stripped and replaced with a normal one without perturbed bytes.
Accordingly, \emph{MalConv} should have learned that these bytes are not relevant to the classification task.
\begin{minipage}[c]{\textwidth}
\begin{minipage}{0.55\textwidth}
\begin{algorithm}[H]
\SetKwInOut{Input}{input}
\SetKwInOut{Given}{given}
\SetKwInOut{Output}{output}
\caption{Evasion algorithm}
\label{alg:algo1}
\SetAlgoLined
\Input{$\vct x$ input binary, $I$ indexes of bytes to perturb, $f$ classifier, $T$ max iterations.}
\Output{Perturbed code that should achieve evasion against $f$.}
\BlankLine
$t \leftarrow 0$\;
\While{ $f(\vct x) \geq 0.5 \wedge t < T$ }{
$\mat Z \leftarrow \phi(\vct x)\in \mathbb{R}^{d \times 8}$\;
$\mat G \leftarrow -\nabla_{\phi} f(\vct x) \in \mathbb{R}^{d \times 8}$\;
\ForAll{$i \in I$}{
$\vct g_i \leftarrow \vct g_i / \| \vct g_i \|_2$\;
$\vct s \leftarrow \vct 0 \in \mathbb{R}^{256}$\;
$\vct d \leftarrow \vct 0 \in \mathbb{R}^{256}$\;
\ForAll{$b \in 0,...,255$}{
$\vct z_b \leftarrow \phi(b)$\;
$s_b \leftarrow \vct g_i^\ensuremath{\top} \cdot (\vct z_b - \vct z_i)$\;
$d_b \leftarrow \| \vct z_b - (\vct z_i + s_b \cdot \vct g_i) \|$\;
}
$x_i \leftarrow \operatornamewithlimits{\arg\,\min}_{j:s_j > 0} d_j$\;
}
$t \leftarrow t+1$\;
}
\end{algorithm}
\end{minipage}
\begin{minipage}{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{plots/evasion.png}
\captionof{figure}{Evading MalConv by perturbing only few bytes in the DOS header.
The black dashed lines represent the iterations of the algorithm. In each iteration, the algorithm manipulates $58$ header bytes (excluding those that can not be changed).
The blue curve shows the probability of the perturbed sample being classified as malware across the different iterations.}
\label{fig:evading}
\end{minipage}
\end{minipage}
\section{Deep Learning for Malware Detection in Binary Files}
\label{sec:classifiers}
\label{subsec:malconv}
Raff et al.~\cite{raff2017malware} propose \textit{MalConv}, a deep learning model which discriminates programs based on their byte representation, without extracting any feature.
The intuition of this approach is based on spatial properties of binary programs: ($i$) code, and data may be mixed, and it is difficult to extract proper features; ($ii$) there is correlation between different portions of the input program; ($iii$) binaries may have different length, as they are strings of bytes.
Moreover, there is no clear metrics that can be imposed on bytes: each value represents an instruction or a piece of data, hence it is difficult to set a distance between them.
To tackle all of these issues, Raff et al. develop a deep neural network that takes as input a whole program, whose architecture is represented in Fig.~\ref{fig:malconv}.
First, the input file size is bounded to $d=2^{21}$ bytes, i.e., $2$ MB.
Accordingly, the input file $\vct x$ is padded with the value $256$ if its size is smaller than $2$ MB; otherwise, it is cropped and only the first $2$ MB are analyzed. Notice that the padding value does not correspond to any valid byte, to properly represent the absence of information.
The first layer of the network is an embedding layer, defined by a function $\phi : \{0, 1, \ldots, 256\} \rightarrow \mathbb{R}^{d \times 8}$ that maps each input byte to an $8$-dimensional vector in the embedded space. This representation is learned during the training process and allows considering bytes as unordered categorical values.
The embedded sample $\mat Z$ is passed through two one-dimensional convolutional layers and then shrunk by a temporal max-pooling layer, before being passed through the final fully-connected layer.
The output $f(\vct x)$ is given by a softmax function applied to the results of the dense layer, and classifies the input $\vct x$ as malware if $f(\vct x)\geq 0.5$ (and as benign otherwise).
\begin{figure}[t]
\centering
\includegraphics[width=\textwidth]{plots/malconv.pdf}
\caption{Architecture of MalConv~\cite{raff2017malware}, adapted from~\cite{kolosnjaji2018adversarial}.}
\label{fig:malconv}
\end{figure}
We debate the robustness of this approach, as it is not clear the rationale behind what has been learned by MalConv.
Moreover, we observe that the deep neural network focuses on the wrong sequences of bytes of an input binary.
\section{Conclusions and Future Work}
We have shown that, despite the success of deep learning in many areas, there are still uncertainties regarding the precision of the output of these techniques.
In particular, we use \textit{integrated gradients} to explain the results achieved by MalConv, highlight the fact that the deep neural network attributes wrong non-zero weights to well known useless features, that in this case are locations inside a Windows binary.
To further explain these weaknesses, we devise an algorithm inspired by recent papers in adversarial machine learning, applied to the malware detection.
We show that perturbing few bytes is enough for evading MalConv with high probability, as we applied this technique on a concrete set of samples taken from the internet, achieving evasion on most of all the inputs.
Aware of this situation, we are willing to keep investigating the weaknesses of these deep learning malware classifiers, as they are becoming more and more important in the cybersecurity world.
In particular, we want to devise attacks that can not be easily recognized by a human expert: the perturbations in the DOS header are easy to detect, as mentioned in Section~\ref{sec:attack} and it may be patched without substantial effort.
Instead, we are studying how to hide these modifications in an unrecognizable way, like filling bytes between functions: compilers often leave space between one function and the other to align the function entry point to multiple of $32$ or $64$, depending on the underlying architecture.
The latter is an example we are currently investigating.
Hence, all classifiers that rely on raw byte features may be vulnerable to such attacks, and our research may serve as a proposal for a preliminary penetration testing suite of attacks that developers could use for establishing the security of these new technologies.
In conclusion, we want to emphasize that these intelligent technologies are far from being considered secure, as they can be easily attacked by aware adversaries.
We hope that our study may focus the attention on this problem and increase the awareness of developers and researchers about the vulnerability of these models.
\section{What Does MalConv Learn?}
\label{sec:what_learns}
We applied the integrated gradient technique for trying to grasp the intuition of what is going on under the hood of MalConv deep network.
For our experiments we used a simplified version of MalConv, with an input dimension shrunk to $2^{20}$ instead of $2^{21}$, that is 1 MB instead of 2 MB, trained by Anderson et al.~\cite{2018arXiv180404637A} and publicly available on GitHub~\footnote{\url{https://github.com/endgameinc/ember/tree/master/malconv}}.
To properly comment the result generated by the attribution method, we need to introduce the layout of the executables that run inside Windows operating system.
\myparagraph{Windows Portable Executable format}
The Windows Portable Executable format\footnote{\url{https://docs.microsoft.com/en-us/windows/desktop/debug/pe-format}} (PE) describes the structure of a Windows executable.
Each program begins with the DOS header, which is left for retro-compatibility issues and for telling the user that the program can not be run in DOS.
The only two useful information contained into the DOS header are the DOS magic number \texttt{MZ} and the value contained at offset \texttt{0x3c}, that is an offset value that point to the real PE header.
If the first one is modified, Windows throws an error and the program is not loaded, while if the second is perturbed, the operating system can not find the metadata of the program.
The PE header consists of a Common Object File Format (COFF) header, containing metadata that describe which Windows Subsystem can run that file, and more.
If the file is not a library, but a standalone executable, it is provided with an Optional Header, which contains information that are used by the loader for running the
executable. As part of the optional header, there are the section headers.
The latter is composed by one entry for each section in the program.
Each entry contains meta-data used by the operating system that describes how that particular section needs to be loaded in memory.
There are other components specified by the Windows PE format, but for this work this information is enough to understand the output of the integrated gradients algorithm applied to MalConv.
\myparagraph{Integrated gradients applied to malware programs} The integrated gradients technique works well with image and text files, but we need to evaluate it on binary programs.
First of all, we have to set a baseline: since the choice of the latter is crucial for the method to return accurate results, we need to pick a sample that satisfies the constraints\footnote{\url{https://github.com/ankurtaly/Integrated-Gradients/blob/master/howto.md}} highlighted by the authors of the method: (i) the baseline should be an empty signal with null response from the network; (ii) the entropy of the baseline should be very low.
If not, that point could be an adversarial point for the network and not suitable for this method.
Hence, we have two possible choices: (i) the empty file, and (ii) a file filled with zero bytes.
For MalConv, an empty file is a vector filled by the special padding number $256$, as already mentioned in Section~\ref{subsec:malconv}.
While both these baselines satisfy the second constraint, only the empty file has a null response, as the zero vector is seen as malware with the 20\% of confidence.
Hence, the empty file is more suitable for being considered the ground truth for the network.
The method returns a matrix that contains all the attributions, feature per feature, $\mat V \in \mathbb{R}^{d \times 8}$, where the second dimension is produced by the embedding layer.
We compute the mean for each row of $\mat V$ to obtain a signed scalar number for each feature, resulting in a point $\vct v' \in \mathbb{R}^{d}$ and it may be visualized in a plot.
\begin{figure}
\centering
\includegraphics[width=\textwidth]{plots/attr_headers.png}
\caption{Attribution given by MalConv to the header of a malware sample.}
\label{fig:header_malw0}
\end{figure}
Figure~\ref{fig:header_malw0} highlights the importance attributed by MalConv to the header of an input malware example using the empty file as baseline, marking with colours each byte's contribution.
We can safely state that a sample is malware if it is scored as such by VirusTotal\footnote{\url{https://www.virustotal.com}} which is an online service for scanning suspicious files.
The cells colored in red symbolize that MalConv considered them for deciding whether the input sample is malware.
On the contrary, cells with blue background are the ones that MalConv retains representative of benign programs.
Regarding our analysis, we may notice that MalConv is giving importance to portions of the input program that are not related to any malicious intent: some bytes in the DOS header are colored both in red and blue, and a similar situation is found for the other sections.
Notably, the DOS header is not even read by modern operating systems, as the only important values are the magic number and the value contained at offset \texttt{0x3c}, as said in the previous paragraph.
All the other bytes are repeated in every Windows executable, and they are not peculiar neither for goodware nor malware programs.
We can thus say that this portion of the program should not be relevant for discriminating benign from malicious programs. Accordingly, one would expected MalConv to give no attribution to these portions of bytes.
We can observe the attribution assigned by integrated gradients to every byte of the program, aggregated for each component of the binary, in Figure~\ref{fig:aggr_contributions}.
Each entry of the histogram is the sum of all the contributions given by each byte in that region.
The histogram is normalized using the $l1$ norm of its components.
The color scheme is the same as the one described for Figure~\ref{fig:header_malw0}.
MalConv puts higher weights at the beginning of the file, and this fact has been already formalized by Kolosnjaji et al.~\cite{kolosnjaji2018adversarial} in the discussion of the results of the attack they have developed.
\begin{figure}
\centering
\includegraphics[height=0.3\textheight]{plots/attr_headers_aggr_sum_l1.png}
\caption{Sum of contributions expressed in percentage.}
\label{fig:aggr_contributions}
\end{figure}
It is clear that the \textit{.text} section has a large impact on the classification, as it is likely that the maliciousness of the input program lies in that portion of the malware.
However, the contribution given by the COFF and optional headers outmatch the other sections.
This further implies that the locations that are learned as important for classification are somewhat misleading.
We can state that among all the correlations that are present inside a program, MalConv surely learned something that is not properly relevant for classification of malware and benign programs.
By knowing this fact, an adversary may perturb these portions of malware and sneaking behind MalConv without particular effort: all she or he has to do is to compute the gradient of the model w.r.t. to the input.
Hence, we describe how a malicious user can deliver an attack by perturbing bytes contained into an input binary to evade the classifier.
\section{Explaining Machine Learning}
\label{sec:interpretation}
We address the problem mentioned at the end of Section~\ref{subsec:malconv} by introducing techniques aimed to explain the decisions of machine-learning models.
In particular, we will focus on techniques that explain the local predictions of such models, by highlighting the most influential features that contribute to each decision.
In this respect, linear models are easy to interpret: they rank each feature with a weight proportional to their relevance. Accordingly, it is trivial to understand which feature caused the classifier to assign a particular label to an input sample.
Deep-learning algorithms provide highly non-linear decision functions, where each feature may be correlated at some point with many others, making the interpretation of the result nearly impossible and leading the developers to naively trust their output.
Explaining predictions of deep-learning algorithms is still an open issue. Many researchers have proposed different techniques to explain what a model learns and which features mostly contribute to its decisions.
Among the proposed explanation methods for machine learning, we decided to focus on a technique called \textit{integrated gradients}~\cite{sundararajan2017axiomatic}, developed by Sundararajan et al., for two main reasons. First, it does not use any learning algorithm to explain the result of another machine learning model; and, second, it is more efficient w.r.t. the computations that are required by the other methods in the state-of-the-art.
\myparagraph{Integrated gradients} We introduce the concept of \textit{attribution methods}: algorithms that compute the contribution of each feature for deciding which label needs to be assigned to a single point.
Contributions are calculated w.r.t. a \textit{baseline}.
A baseline is a point in the input space that corresponds to a null signal: for most image classifiers it may be identified as a black image, it is an empty sentence for text recognition algorithms, and so on.
The baseline serves as ground truth for the model: each perturbation to the baseline should increase the contributions computed for the modified features.
Hence, each contribution is computed w.r.t. the output of the model on the baseline.
The integrated gradients technique is based on two axioms and upon the concept of baseline.
\myparagraph{Axiom I: Sensitivity}
The first axiom is called \textit{sensitivity}: an attribution method satisfies sensitivity if, for every input that differ in one feature from the baseline but they are classified differently, then the attribution of the differing feature should be non-zero.
Moreover, if the learned function does not mathematically depend on a particular feature, the attribution should be zero.
On the contrary, if sensitivity is not satisfied, the model is focusing on irrelevant features, as the attribution method fails to weight the contribution of each variable.
Authors state that gradients violate the sensitivity axioms, hence using them during the training phase by applying back-propagation implies attributing wrong importance to the wrong features.
\myparagraph{Axiom II: Implementation Invariance}
The second axiom is called \textit{implementation invariance}, and it is built on top of the notion of \textit{functional equivalence}: two networks are functionally equivalent if their outputs are equal on all inputs, despite being implemented in different ways.
Thus, an attribution method satisfies implementation invariance if it produces the same attributions for two functionally equivalent networks.
On the contrary, if this axiom is not satisfied, the attribution method is sensitive to the presence of useless aspects of the model.
On top of these two axioms, Sundararajan et al. propose the integrated gradient method that satisfies both sensitivity and implementation invariance.
Hence, this algorithm should highlight the properties of the input model and successfully attributing the correct weights to the feature believed relevant by the model itself.
\myparagraph{Integrated Gradients}
Given the input model $f$, a point $\vct x$ and baseline $\vct x^\prime$, the attribution for the $i^{\rm th}$ feature is computed as follows:
\begin{equation}
\begin{split}
IG_i(\vct x) = (x_i - x_i') \int_0^1 \frac{\partial f(\vct x' + \alpha( \vct x - \vct x'))}{\partial x_i}d\alpha
\end{split} \, .
\label{eq:int0}
\end{equation}
This is the integral of the gradient computed on all points that lie on the line passing through $\vct x$ and $\vct x'$.
If $\vct x'$ is a good baseline, each point in the line should add a small contribution to the classification output.
This method satisfies also the \textit{completeness} axiom: the attributions add up to the difference between the output of the model at the input $\vct x$ and $\vct x'$.
Hence, the features that are important for the classification of $\vct x$ should appear by moving on that line.
Since we can only compute discrete quantities, the integral can be approximated using a summation, adding a new degree of freedom to the algorithm, that is the number of points to use in the process: Sundararajan et al. state that the number of steps could be chosen between 20 and 300, as they are enough to approximate the integral within the 5\% of accuracy.
\section{Introduction}
\label{sec:intro}
Despite their impressive performance in many different tasks, deep-learning algorithms have been shown to be easily fooled by \emph{adversarial examples}, {i.e.}\xspace, carefully-crafted perturbations of the input data that cause misclassifications~\cite{biggio2013evasion,szegedy14-iclr,goodfellow6572explaining,papernot2016limitations,carlini2017towards,biggio2018wild}.
The application of deep learning to the cybersecurity domain does not constitute an exception to that. Recent classifiers proposed for malware detection, including the case of PDF, Android and malware binaries, have been indeed shown to be easily fooled by well-crafted adversarial manipulations~\cite{biggio2013evasion,demontis17-tdsc,grosse2016adversarial,kolosnjaji2018adversarial,kreuk2018adversarial,srndic14}.
Despite the sheer number of new malware specimen unleashed on the Internet (more than 8 millions in 2017 according to GData\footnote{\url{https://www.gdatasoftware.com/blog/2018/03/30610-malware-number-2017}}) demands for the application of effective automated techniques, the problem of adversarial examples has significantly questioned the suitability of deep-learning algorithms for these tasks. Nevertheless, it is not yet clear why such algorithms are easily fooled also in the particular application domain of malware detection.
In this work, we take a first step towards understanding the behavior of deep-learning algorithms for malware detection. To this end, we argue that explainable machine-learning algorithms, originally developed to interpret the black-box decisions of deep neural networks~\cite{sundararajan2017axiomatic,lime,guo2018lemna,koh17-icml}, can help unveiling the main characteristics learned by such algorithms to discriminate between benign and malicious files. In particular, we rely upon an explainable technique known as \emph{feature attribution}~\cite{sundararajan2017axiomatic} to identify the most influential input features contributing to each decision.
We focus on a case study related to the detection of Windows Portable Executable (PE) malware files, using a recently-proposed convolutional neural network named \emph{MalConv}~\cite{raff2017malware}. This network is trained directly on the raw input bytes to discriminate between malicious and benign PE files, reporting good classification accuracy. Recently, concurrent work~\cite{kolosnjaji2018adversarial,kreuk2018adversarial} has shown that it can be easily evaded by adding some carefully-optimized padding bytes at the end of the file, {i.e.}\xspace, by creating \emph{adversarial malware binaries}.
However, no explanation has been clearly given behind the surprising vulnerability of this deep network. To address this problem, in this paper we adopt the aforementioned feature-attribution technique to provide meaningful explanations of the classification of malware binaries. Our underlying idea is to extend feature attribution to aggregate information on the most relevant input features at a higher semantic level, in order to highlight the most important instructions and sections present in each classified file.
Our empirical findings show that \emph{MalConv} learns to discriminate between benign and malware samples mostly based on the characteristics of the file header, i.e., almost ignoring the data and text sections, which instead are the ones where the malicious content is typically hidden. This means that also depending on the training data, \emph{MalConv} may learn a spurious correlation between the class labels and the way the file headers are formed for malware and benign files.
To further demonstrate the risks associated to using deep learning ``as is'' for malware classification, we propose a novel attack algorithm that generates adversarial malware binaries by only changing few tens of bytes in the file header.
With respect to the other state-of-the-art attack algorithms in~\cite{kolosnjaji2018adversarial,kreuk2018adversarial}, our attack does not require injecting any padding bytes at the end of the file (it \emph{modifies} the value of some existing bytes in the header), and it is much more efficient, as it requires manipulating much fewer bytes.
The structure of this paper is the following: in \refToSection{classifiers} we introduce how to solve the problem of malware detection using machine learning techniques, and we present the architecture of MalConv; (ii) we introduce the integrated gradient technique as an algorithm that extracts which features contributes most for the classification problem; (iii) we collect the result of the method mentioned above applied on MalConv, highlighting its weaknesses, and (iv) we show how an adversary may exploit this information to craft an attack against MalConv.
\section{Related Work}
We discuss here some approaches that leverage deep learning for malware detection, which we believe may exhibit similar problems to those we have highlighted for \emph{MalConv} in this work.
We continue with a brief overview of the already proposed attacks that address vulnerabilities in the MalCon architecture.
Then, we discuss other explainable machine-learning techniques that may help us to gain further insights on what such classifiers effectively learn, and potentially whether and to which extent we can make them more reliable, transparent and secure.
\myparagraph{Deep Malware Classifiers} Saxe and Berlin~\cite{saxe2015deep} use a deep learning system trained on top of features extracted from Windows executables, such as byte entropy histograms, imported functions, and meta-data harvested from the header of the input executable.
Hardy et al.~\cite{hardy2016dl4md} propose DL4MD, a deep neural network for recognizing Windows malware programs.
Each sample is characterized by its API calls, hence they are passed to a stacked auto-encoders network.
David et al.~\cite{david2015deepsign} use a similar approach, by exploiting de-noising auto-encoders for classifying Windows malware programs.
The features used by the author are harvested from dynamic analysis.
Yhuan et al.~\cite{yuan2016droiddetector} extract features from both static and dynamic analysis of an Android application, like the requested permissions, API calls, network usage, sent SMS and so on, and samples are given in input to a deep neural network.
McLaughlin et al.~\cite{mclaughlin2017deep} propose a convolutional neural network which takes as input the sequence of the opcodes of an input program.
Hence, they do not extract any features from data, but they merely extract the sequence of instructions to feed to the model.
\myparagraph{Evasion attacks against MalConv} Kolosnjaji et al.~\cite{kolosnjaji2018adversarial} propose an attack that does not alter bytes that correspond to code, but they append bytes at the end of the sample, preserving its semantics.
The padding bytes are calculated using the gradient of the cost function w.r.t. the input byte in a specific location in the malware, achieving evasion with high probability.
The technique is similar to the one developed by Goodfellow et al.~\cite{goodfellow6572explaining}, the so-called Fast Sign Gradient Method (FSGM).
Similarly, Kreuk et al.~\cite{kreuk2018adversarial} propose to append bytes at the end of the malware and fill unused bytes between sections. %
Their algorithm is different: they work in the embedding domain, and they translate back in byte domain after applying the FSGM to the malware, while Kolosnjaji et al. modify one padding byte at the time in the embedded domain, and then they translate it back to the byte domain.
\myparagraph{Explainable Machine Learning} Riberio et al.~\cite{lime} propose a method called LIME, which is an algorithm that tries to explain which features are important w.r.t. the classification result.
It takes as input a model, and it learns how it behaves locally around an input point, by producing a set of artificial samples.
The algorithm uses LASSO to select the top K features, where K is a free parameter.
As it may be easily noticed, the dimension of the problem matters, and it may become computational expensive on high dimensional data.
Guo et al.~\cite{guo2018lemna} propose LEMNA, which is an algorithm specialized on explaining deep learning results for security applications.
As said in Section~\ref{sec:classifiers}, many malware detectors exploit machine learning techniques in their pipeline.
Hence, being able to interpret the results of the classification may be helpful to analysts for identifying vulnerabilities.
Guo et al. use a Fused LASSO or a mixture Regression Model to learn the decision boundary around the input point and compute the attribution for $K$ features, where $K$ is a free parameter.
Another important work that may help us explaining predictions (and misclassifications) of deep-learning algorithms for malware detection is that by Koh and Liang~\cite{koh17-icml}, which allows identifying the most relevant training prototypes supporting classification of a given test sample. With these technique, it may be possible to associate or compare a given test sample to some known training malware samples and their corresponding families (or, to some relevant benign file). | {'timestamp': '2019-01-25T02:08:48', 'yymm': '1901', 'arxiv_id': '1901.03583', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03583'} | arxiv |
\section{Introduction}
In natural languages, mappings between meaning and
utterance may be many-to-many.
Just as ambiguity allows for multiple semantic interpretations of a single sentence, a single meaning can be realized by
different sentences.
The ability to identify and generate \emph{paraphrases} has been pursued in the context of many natural language processing (NLP) tasks, e.g., semantic similarity, plagiarism detection, translation evaluation, monolingual transduction tasks such as text simplification and style transfer, textual entailment, and short-answer grading.
\begin{figure}
\centering
\includegraphics[width=0.47\textwidth]{itookit}
\caption{Contrasting prior work (e.g., \textsc{ParaNMT}\xspace) on building sentential paraphrase collections via translation, {\sc ParaBank} conditions on both the source and \emph{target} side of a translation pair, employing positive and negative lexical constraints derived from the reference to result in \emph{multiple}, \emph{diverse} paraphrases.}
\label{fig:i-took-it}
\end{figure}
Paraphrastic resources exist at many levels of granularity, e.g., WordNet \citep{miller1995wordnet} for word-level and the Paraphrase Database (PPDB) \citep{ganitkevitch2013ppdb} for phrase-level. We are interested in building a large resource for \textit{sentence}-level paraphrases in English.
In this work, we introduce \textsc{ParaBank}\xspace, the largest publicly-available collection of English paraphrases we are aware of to date.
We follow and extend the approach of \citet{paranmt}, who generate a set of 50 million English paraphrases, under the name {\textsc{ParaNMT-50M}, via neural machine translation (NMT).
A part of \textsc{ParaBank}\xspace is trained and decoded on the same Czech-English parallel corpus \citep{czeng16:2016} as \textsc{ParaNMT}\xspace.
However, \textsc{ParaBank}\xspace not only contains more reference sentences but also more paraphrases per reference than \textsc{ParaNMT}\xspace with overall improvements in lexical diversity, semantic similarity, and fluency.
We are able to obtain a larger number of paraphrases per sentence by applying explicit lexical constraints to the NMT decoder, requiring specific words to appear (\textit{positive constraint}) or not to appear (\textit{negative constraint}) in the decoded sentence. Using \textsc{ParaBank}\xspace, we train, and release to the public, a monolingual sentence re-writing system, which may be used to paraphrase unseen English sentences with lexical constraints.
The main contributions of this work are:
\begin{itemize}
\item A novel approach to translation-based generation of monolingual bitext;
\item The largest and highest quality English-to-English bitext resource to date with 79.5 million references and predicted human-judgment scores;
\item Manual assessment of candidate paraphrases on semantic similarity, across a variety of generation strategies;
\item A trained and freely released model for English-to-English rewriting, supporting positive and negative lexical constraints.
\end{itemize}
\textsc{ParaBank}\xspace is available for download at:
\url{http://nlp.jhu.edu/parabank}.
\section{Background}
The following summarizes key background in approaches to monolingual paraphrasing with regard to \textsc{ParaBank}\xspace, along with the essential prior efforts that enable \textsc{ParaBank}\xspace to improve on related work. We first discuss work on sub-sentential resources that may be: hand-curated, automatically expanded from hand-curated, or fully automatically created. We then describe efforts at gathering or creating monolingual sentential bitexts, or otherwise sentence-to-sentence paraphrastic rewriting.~\nocite{juri} For additional background, we refer readers to \citet{madnani2010generating}.
\subsection{Paraphrasing Resources}
\paragraph{Lexical Resources}
WordNet~\citep{miller1995wordnet} includes manually-curated sub-sentential paraphrases. It groups single words or short-phrases with similar meanings into synonym sets (\textit{synsets}).
Each synset is related to other synsets through semantic relations (e.g., hypernym, entailment)
to allow the construction of hierarchies and entailment relations.
VerbNet~\citep{verbnet} is a manually-constructed lexicon of English verbs. It is augmented with syntactic and semantic usage of its verb sense members. As a paraphrase resource, VerbNet groups verb senses into classes like ``say-37.7-1" or ``run-51.3.2". Members under the same class share a general meaning as noted by the class name.
FrameNet~\citep{framenet} contains
manually annotated sentences classified into
semantic frames. Though designed as a readable reference and as training data for semantic role labeling, FrameNet can be used to construct sub-sentential paraphrases, owing to rich semantic contents like semantic types and frame-to-frame relations.
Many efforts have aimed to automatically expand gold resources, for example: \citet{semantic_taxonomy} augmented WordNet by combining existing semantic taxonomies in WordNet with hypernym predictions and coordinate term classifications;
and ~\citet{framenet+} tripled the lexical coverage of FrameNet by substituting words through PPDB, with verification of quality via crowdsourcing.
\paragraph{Larger Paraphrases}
There is a rich body of work in automatically inducing phrasal, syntactic or otherwise structural paraphrastic resources.
Some examples include: DIRT~\citep{DIRT}, which extracts paraphrastic expressions over paths in dependency trees, based on an extension of the distributional hypothesis, which states that words that occur in the same contexts tend to have similar meanings~\citep{dist_hypo}; \citet{verb_inf_rules} explored learning inference relations between verbs through broader scopes (document or corpus level), resulting in a richer set of cues for verb entailment detections; and PPDB~\citep{ganitkevitch2013ppdb}, a multi-lingual effort to construct paraphrase pairs by linking words or phrases that share the same translation in another language. Related to the human scoring pursued here for ParaBank evaluation, in PPDB 2.0~\citep{pavlick2015ppdb}, the authors collected annotations via Mechanical Turk to measure the quality of the induced paraphrases, in order to train a model for scoring all the entries in PPDB for semantic adequacy.
\subsection{Monolingual Bitexts}
\paragraph{Manually Created}
Some monolingual bitexts are created for research in text generation~\citep{pang2003syntax,Robin1995generation} where models benefit from exposure to multiple elicitations of the same concept. The utility of these resources is largely limited by their scale, as the cost of creation is high. Other sources include different translations of the same foreign text, which exist for many classic readings. Work has been done on identifying and collecting sub-sentential paraphrases from such sources~\citep{barzilay2001extracting}. However, the artistic nature of literature could result in various interpretations, often rendering this type of resource unreliable.
\paragraph{\textsc{ParaNMT}\xspace}
\citet{paranmt} leverage the relative abundance of bilingual bitext to generate sentence-level paraphrases through machine translation. This approach trains a neural machine translation (NMT) model from a non-English source language to English over the entire bitext (Czech-English)~\citep{czeng16:2016}, and decodes the source to obtain outputs that are semantically close to the training target. Decoding in \textsc{ParaNMT}\xspace solely depends on the trained model and the source text with no inputs derived from the target English sentences. The approach in \textsc{ParaNMT}\xspace exhibits little control over the diversity and adequacy of its paraphrastic sentence pairs: the application of lexical constraints during decoding is a key distinction between \textsc{ParaNMT}\xspace and the approach described herein.
\input{example}
\subsection{Lexically Constrained Decoding} \label{sec:lexdec}
Lexically constrained decoding~\citep{hokamp-liu:2017:lexical_constraint} is a modification to beam search for neural machine translation that allows the user to specify tokens and token sequences that must (or must not) appear in the decoder output.
A lexical constraint can be either \emph{positive} or \emph{negative}.
A positive constraint requires the model to \textit{include} the constrained token or tokens in the output.
Negative constraints, on the other hand, require the model to \textit{avoid} certain token or tokens in the output.
The effect of constraints is to cause the system to generate the best decoding (translation or paraphrase) under those constraints.
Recently, \citet{fast_lexical} proposed a variant of lexically constrained decoding that reduced complexity from linear to constant-time (in the number of constraints).
This allows us to decode hundreds of millions of sentences with constraints in a reasonable amount of time, and forms a key enabling technology for \textsc{ParaBank}\xspace.
An implementation of it is included in Sockeye~\citep{sockeye}, which we use for this work.
\subsection{Efficient Annotation of Scalar Labels (EASL)}
\citet{easl} propose an efficient and accurate method of collecting scalar-valued scores from human annotators, called EASL, by combining pairwise ranking aggregation and direct assessment.
In manually evaluating the quality of our system's paraphrases, we adopt an annotator interface based on EASL.
Human annotators are asked to assess paraphrases' semantic similarity to the reference sentence through a combination of direct numerical assessment and pairwise comparison. This mode of evaluation is akin to the method employed by the Workshop on Statistical Machine Translation (WMT) evaluation through an adaptation of TrueSkill\texttrademark{}~\citep{efficient_elicitation}.
\section{Approaches}
\subsection{Training the model}
We use Sockeye~\citep{sockeye} to train the machine translation model, with which we generate paraphrases under different constraint systems. The training data, CzEng 1.7~\citep{czeng16:2016}, is tokenized\footnote{We used spaCy~\citep{spacy2} to tokenize English text, and MorphoDiTa~\citep{morphodita} to tokenize Czech text.}
and processed through Byte Pair Encoding (BPE)~\citep{bpe}.
To reduce the vocabulary size, we tokenized all numbers to digit-level.
The model's encoder and decoder are both 6-layer LSTMs with a hidden size of 1024 and an embedding size of 512. Additionally, the model has one dot-attention layer.
We trained the model on 2 Nvidia GTX 1080Ti for two weeks.
\subsection{Selection of Lexical Constraints}
\label{sec:selection}
Lexical constraints (\S \ref{sec:lexdec}) can directly influence the diversity and sufficiency of the NMT decoder output (i.e., the translation).
We generate paraphrases of English translations of Czech sentences using different sets of constraints obtained from the English side of the bitext.
These constraints may be positive or negative, and multiple constraints of either type may be combined simultaneously (provided they are consistent).
The tokens on which we base these constraints are the tokens that appear in the reference sentence (or are morphological variants thereof), though in principle any token could be used as a constraint.
To select the constraints from this pool, we experiment with different ways of selecting these constraints from the reference, resulting in 37 experimental system configurations (\tabref{tab:system_description}): one baseline system with no constraints, three with tokens selected positionally, 30 with positive and negative constraints selected via inverse document frequency (IDF), and three additional systems based on PPDB lookups. Here we describe these selection criteria in detail.
\paragraph{IDF Criteria} We compute each token's inverse document frequency (IDF) from the training data. To avoid constraints with misspelled or overly-specialized words, we exclude tokens with an IDF above 17.0 from consideration as lexical constraints.
We also avoid constraints based on the most frequent English words by setting a minimum IDF threshold of 7.0.
These thresholds are heuristics and we leave optimizations to future works. Among the remaining candidates, the constraint token may be selected by the highest IDF, lowest IDF, or randomly.
\paragraph{Prepositions} We make one exception to the minimum IDF threshold in the case of prepositions, which we found fruitful as diversity-promoting constraints (see \figref{fig:i-took-it}). The allowed prepositions are:
\textit{about}, \textit{as}, \textit{at}, \textit{by}, \textit{for}, \textit{from}, \textit{in}, \textit{into}, \textit{of}, \textit{on}, \textit{onto}, \textit{over}, \textit{to}, and \textit{with}.
\begin{table}[t!]
\centering
\small
\begin{tabular}{|c|c||c|c|}
\hline
{\bf Token} & {\bf IDF} & {\bf Token} & {\bf IDF} \\
\hline
proud & 11.1 & told & 7.9 \\
work & 7.4 & them & 6.2 \\
her & 5.8 & was & 4.3 \\
for & 3.6 & to & 2.3 \\
\hline
\end{tabular}
\caption{Tokens assessed, along with their IDFs, of the sentence \textit{``I told her I was proud to work for them.''}}
\label{tab:IDF_example}
\end{table}
\paragraph{Morphological Variants} To discourage trivial paraphrases, some negative constraint systems include morphological variants of the word, and all negative constraint systems exclude capitalization. For positive constraints, we only consider morphological variants for verbs\footnote{We POS-tagged the reference sentence using SpaCy.}, and only one variant of the selected token is used. For all constraints, only lowercased alphabetical tokens are considered.
\paragraph{Positional Constraints} It has been observed that RNN decoders in dialogue systems can be nudged toward producing more diverse outputs by modifying decoding for only the first few tokens \citep{li-EtAl:2016:N16-11}. Motivated by this observation, we include \textbf{positional constraints}, which require that a given constraint apply only at the \textit{beginning} of the sentence (denoted as $\langle$BOS$\rangle$ in Table \ref{tab:system_description}). In particular, we require the first one, two, or three tokens \textit{not} to match the reference translation (i.e., a \textit{negative} constraint).
\paragraph{PPDB Constraints} We also use PPDB 2.0 \citep{pavlick2015ppdb} as a source for introducing \textit{positive} lexical constraints. For each token in the original English sentence that passes the IDF filter (above), we look up its paraphrases in PPDB\footnote{We use the \texttt{ppdb-2.0-lexical-xl} packet downloaded from \url{paraphrase.org}.}. We randomly select up to three lexical paraphrases, one each of the type \texttt{Equivalence}, \texttt{ForwardEntailment}, and \texttt{ReverseEntailment}, if present. We further require the selected lexical paraphrases to coarsely match the original token's POS tag (e.g., any form of verb, etc.) A negative constraint is then added for the original token, and a positive constraint is added for the lexical paraphrase from PPDB. These negative-positive constraint pairs are applied one at a time (i.e., one pair per decoding).
\paragraph{Example of constraint selection} Here we work through the process of selecting lexical constraints to produce a new paraphrase of the sentence \textit{``I told her I was proud to work for them.''}. We follow the rules of system number 18 (as designated in \tabref{tab:system_description}).
First, tokens with only lower-cased alphabetical letters are assessed; they are listed in \tabref{tab:IDF_example} along with their IDF values. After applying the IDF thresholds and exception for prepositions, the following tokens are in the candidate pool, from which we choose tokens to constrain on (listed in descending order of IDF values): \textit{proud}, \textit{told}, \textit{work}, \textit{for}, and \textit{to}.
Under the configuration of \textsc{ParaBank}\xspace System 18 (\tabref{tab:system_description}), which avoids tokens with the lowest and the second lowest IDF, a negative constraint is generated for the tokens \textit{for}, \textit{For}, \textit{to}, and \textit{To}.
With these constraints applied, the resulting decoded paraphrase is: \textit{``I told her I was really proud of working with them.''}.
More examples are shown in \tabref{tab:example}.
\begin{table}[t!]
\centering
\small
\begin{tabular}{|c|c|c|c|}
\hline
No. & $\oplus/\ominus$ & Token(s) Selected & Lex. \\
\hline
1,2,3 & $\ominus$ & 1\textsuperscript{st}, 2\textsuperscript{nd}, 3\textsuperscript{rd}~ highest IDF\tablefootnote{Highest within the token pool. Same for lowest.} & None \\
4,5,6 & $\ominus$ & (1\textsuperscript{st}, 2\textsuperscript{nd}), (2\textsuperscript{nd}, 3\textsuperscript{rd}), (1\textsuperscript{st}, 3\textsuperscript{rd}) IDF & None \\
7 & $\ominus$ & (1\textsuperscript{st}, 2\textsuperscript{nd}, 3\textsuperscript{rd}) highest IDF & None \\
\hline
8,9,10 & $\ominus$ & 1\textsuperscript{st}, 2\textsuperscript{nd}, 3\textsuperscript{rd}~ highest IDF & All \\
11,12,13 & $\ominus$ & (1\textsuperscript{st}, 2\textsuperscript{nd}), (2\textsuperscript{nd}, 3\textsuperscript{rd}), (1\textsuperscript{st}, 3\textsuperscript{rd}) IDF & All \\
14 & $\ominus$ & (1\textsuperscript{st}, 2\textsuperscript{nd}, 3\textsuperscript{rd}) highest IDF & All \\
\hline
15,16,\textbf{17} & $\ominus$ & 1\textsuperscript{st}, 2\textsuperscript{nd}, \textbf{3\textsuperscript{rd}~ lowest IDF} & None \\
18,19,20 & $\ominus$ & (1\textsuperscript{st}, 2\textsuperscript{nd}), (2\textsuperscript{nd}, 3\textsuperscript{rd}), (1\textsuperscript{st}, 3\textsuperscript{rd}) low & None \\
\textbf{21} & $\ominus$ & \textbf{(1\textsuperscript{st}, 2\textsuperscript{nd}, 3\textsuperscript{rd}) lowest IDF} & None \\
\hline
22,23,24 & $\ominus$ & 1, 2, 3 random tokens & None \\
25,26,27 & $\ominus$ & 1, 2, 3 random tokens & All \\
\hline
\textbf{28} & & \textbf{no constraints} & \\
\hline
29,30,\textbf{31} & $\oplus$ & 1\textsuperscript{st}, 2\textsuperscript{nd}, \textbf{3rd highest IDF} & Verb\tablefootnote{If the token is a verb, we pick a random lexical variation to include. E.g., we might constrain on one of "taken", "taking", "takes", or "take" if the original token is "took".} \\
\hline
32,33,\textbf{34} & $\ominus$ & positional $\langle$BOS$\rangle$: 1, 2, \textbf{3 tokens} & None \\
\hline
\textbf{35},\textbf{36},\textbf{37} & $\ominus\oplus$ & \textbf{PPDB equ, fwd, rev entailment} & None \\
\hline
\end{tabular}
\caption{Different system configurations to generate paraphrases. $\oplus$/$\ominus$ designates the type of constraint we impose on the model: \textit{negative} constraints ($\ominus$) are sets of tokens or ngrams which the decoder must \textit{not} include in its output, while \textit{positive} constraints ($\oplus$) are sets of tokens or ngrams \textit{required} in the output. Additional constraints may be included for lexical variations of the selected token(s), as indicated by the Lex. column. Systems in bold fonts are presented here for evaluation. Evaluations of all systems will be made available with the resource.}
\label{tab:system_description}
\end{table}
\section{Extension to other bilingual corpora}
Our methods are independent of the source bilingual corpora. We apply the same pipeline to the $10^9$ word French-English parallel corpus (Giga) \citep{WMT2009}, which has different domain coverage than CzEng. This adds an additional 22.4 million English references, resulting in a total of 79.5 million reference sentences for \textsc{ParaBank}\xspace. We conducted manual evaluation on paraphrases generated from both CzEng and Giga, and included the additional PPDB constraint systems for Giga.
\section{Evaluation}
\input{mega}
We evaluate the quality of paraphrases by both semantic similarity and lexical diversity. A good paraphrase should strive to preserve as much meaning as possible while using lexically diverse expression. Otherwise, the result is either a trivial re-write or fails to convey the original meaning. We understand these two metrics as interdependent and sometimes conflicting -- a high lexical diversity likely sacrifices semantic similarity. The goal of \textsc{ParaBank}\xspace is to offer not only a balance between the two, but also options across the spectrum for different applications. Of course, good paraphrases should also be fluent in their expression, so we also evaluate paraphrases for grammaticality and meaningfulness, independent of their reference.
For brevity, we picked 5 \textsc{ParaBank}\xspace systems (bold in \tabref{tab:system_description}) to cover negative, positive, positional, and no constraint. We also include system 21 (3 lowest IDF tokens) to show that too many constraints might significantly hurt semantic similarity.
Full evaluations on all proposed systems will be included with the release of the resource.
\subsection{Scoring \textsc{ParaBank}\xspace paraphrases}
Following the approach of PPDB 2.0 \citep{pavlick2015ppdb}, we trained a supervised model on the human annotations we collected. We extracted several features from reference-paraphrase pairs to predict human judgments of semantic similarity on all paraphrases, with the exception of those whose reference contains more than 100 tokens post-BPE. The regression model achieves reasonable correlation with human judgment on the test data with a Spearman's $\rho$ of 0.53 on CzEng and 0.63 on Giga.
\subsection{Baseline comparison} \label{sec:baseline}
Our baseline system with no lexical constraints applied shows substantial improvement compared to \textsc{ParaNMT}\xspace. This could be a combination of improved training data and NMT framework. \textsc{ParaNMT}\xspace is trained on a 51.4M subset of CzEng1.6, while \textsc{ParaBank}\xspace used CzEng1.7, a 57.0M subset of CzEng1.6. We also switched to \textsc{Sockeye} as our training framework.
This baseline improvement gives us more flexibility to pursue explicit lexical diversity with reasonable compromise in semantic similarity.
\subsection{Semantic similarity} \label{sec:mturk}
Human judgment remains the gold standard of semantic similarity. We randomly sampled 100 Czech-English sentence pairs from each of the four English token lengths: 5, 10, 20, and 40. We translate 400 sentences from CzEng under 34 \textsc{ParaBank}\xspace systems (without PPDB constraints) and 400 sentences from Giga under 37 \textsc{ParaBank}\xspace systems. Then, we merge identical outputs and add in the corresponding \textsc{ParaNMT}\xspace entries to the CzEng evaluation.
We randomize the paraphrase pool and formulate them into Mechanical Turk Human Intelligence Tasks. Inspired by the interface of EASL \citep{easl}, we ask workers to assign each paraphrase a score between 0 and 100 by adjusting a slider bar. Each worker is presented with one reference sentence and five attempted paraphrases at the same time. Occasionally, we present workers the reference sentence itself as a candidate paraphrase and expect it to receive a perfect score. Workers who fail to do so more than 10\% of all times are disqualified for inattentiveness.
In total, we incorporated the annotations of 44 workers who contributed at least 25 judgments.
Each paraphrase receives independent judgments from at least 3 different workers.
We then calculate the average score for each sentence pair, before averaging over all pairs from each \textsc{ParaBank}\xspace system (or \textsc{ParaNMT}\xspace). The final score for each system is a number between 0 and 100.
The top half of \tabref{tab:mega} shows the average human judgment over 100 sentences per reference length for \textsc{ParaBank}\xspace systems and \textsc{ParaNMT}\xspace, grouped by sentence length.
Best performing \textsc{ParaBank}\xspace systems from each reference length outperform \textsc{ParaNMT}\xspace relatively by 5.0\%, 6.6\%, 10.2\%, and 14.0\% in terms of semantic similarity (corresponding to 5, 10, 20, 40 tokens per reference sentence).
\subsection{Lexical diversity}
We used a modified BLEU score to evaluate lexical diversity and \textbf{a lower score suggests a higher lexical diversity}. Specifically, we concatenate\footnote{After switching all tokens to lowercase and stripping punctuation to avoid rewarding trivial re-writes.}
multiple paraphrastic sentence pairs into one reference paragraph and one paraphrase paragraph, and calculate the associated BLEU score \textbf{without brevity penalty}. This modification ensures that we don't reward shorter paraphrases. We compared the result with a naive unigram precision metric and they show a strong correlation with a Spearman's $\rho$ of 0.98.
The bottom half of \tabref{tab:mega} shows this modified BLEU score for each \textsc{ParaBank}\xspace system and \textsc{ParaNMT}\xspace, grouped by reference length. For every length, there is at least one \textsc{ParaBank}\xspace system that exhibits higher lexical diversity than \textsc{ParaNMT}\xspace; unsurprisingly, the \textsc{ParaBank}\xspace systems that apply the greatest number of lexical constraints tend to yield the greatest lexical diversity (e.g., system 21).
\subsection{Meaningfulness and grammaticality}
We ask annotators to comment on each paraphrase's fluency by flagging sentences that are completely nonsensical or indisputably ungrammatical. We consider a sentence nonsensical or ungrammatical when at least one independent annotator flags it as so.
We then calculate the percentage of sentences that are deemed both meaningful and grammatical for each \textsc{ParaBank}\xspace system and \textsc{ParaNMT}\xspace.
The result is shown in \tabref{tab:fluency}. System 34 (avoid first 3 tokens) shows a 12.6\% improvement over \textsc{ParaNMT}\xspace. In all, 21 out of 34 proposed \textsc{ParaBank}\xspace systems contain a smaller proportion of nonsensical or ungrammatical sentences than \textsc{ParaNMT}\xspace. The full set of annotations are available with the resource.
\input{fluency}
\section{Constrained monolingual rewriting}
\cite{joshua_rewriter} explored sentential rewriting with machine translation models. Inspired by their work, we use a subset of \textsc{ParaBank}\xspace, with more than 50 million English paraphrastic sentence pairs (English text from CzEng as source, \textsc{ParaBank}\xspace outputs as target), to train a monolingual NMT model, and decode with the same types of constraint systems.
We present the following result as a proof of concept that highlights the potential for and problems with the most straightforward instantiation of the model. A thorough investigation of building such a monolingual model is outside the scope of this work.
We decide to use the same LSTM model instead of more advanced self-attention models to contrast between the bilingual and monolingual models. After training for one epoch, we decode the model with the same 5 constraint systems (no. 17, 21, 28, 31, 34) evaluated for the bilingual model, and ask human annotators\footnote{Same setup as \S \ref{sec:mturk}. The result includes 8 workers who contributed more than 25 judgments.} to compare their semantic similarity to the reference sentence in the same way. We sampled 100 sentences across the same 4 lengths (25 sentences per length); each sentence receives at least 3 independent judgments. The semantic similarity scores for this monolingual system are reported in \tabref{tab:mono} (``Monolingual'') alongside lexical diversity scores (modified BLEU).
\input{mono}
Outputs from the monolingual model show a significant boost in semantic similarity compared to bilingual counterparts, system 28 (no constraint) shows an improvement of 16.7\%. This is accompanied by an increase in BLEU score, a sign of less lexical diversity. Example outputs from the monolingual model can be found in \tabref{tab:mono_examples}.
\begin{table}[t!]
\centering
\small
\begin{tabular}{|c|}
\hline
{\bf Reference} \\
\textit{Hey, it's nothing to be ashamed of.} \\
\hline
\hline
{\bf Paraphrases from the monolingual model} \\
\textit{Hey, it's nothing to be embarrassed.} \\
\textit{Hey, it's nothing to be ashamed.} \\
\textit{Hey, it's not like you're ashamed of.} \\
\textit{Hey, you don't have to worry about that.} \\
\textit{Hey, you don't have to be ashamed.} \\
\textit{Hey, there's nothing you can be ashamed of.} \\
\textit{You don't have to be ashamed of it.} \\
\textit{Hey, there's nothing you can do about it.} \\
\textit{Oh, hey, it's no big deal.} \\
\hline
\end{tabular}
\caption{Example paraphrases generated from the monolingual rewriting model, after applying the same set of lexical constraints described in \tabref{tab:system_description} and merging duplicates.}
\label{tab:mono_examples}
\end{table}
As evidenced in our examples, some monolingual systems may generate slightly more nonsensical or ungrammatical sentences than their bilingual counterparts: future work will pursue more extensive model training and data filtering for the monolingual model. Our intent here is to foremost illustrate the quality of {\sc ParaBank} as a resource, while illustrating the feasibility of training and employing a monolingual sentence rewriting model built atop the {\sc ParaBank} artifact.
\section{Conclusions and Future Work}
We created \textsc{ParaBank}\xspace by decoding a neural machine translation (NMT) model with lexical constraints. We applied our methods to CzEng 1.7 and Giga, leading to a large collection of paraphrases with 79.5 million references and on average 4 paraphrases per reference, which we make available for download at \url{http://nlp.jhu.edu/parabank}. Via large-scale crowdsourced annotations, we found the overall best performing \textsc{ParaBank}\xspace system exhibits an 8.5\% relative improvement in terms of semantic similarity over prior work. Analysis on lexical diversity showed the potential of \textsc{ParaBank}\xspace as a more diverse and less noisy paraphrastic resource. In addition to releasing hundreds of millions of English sentential paraphrases, we also release a free, pre-trained, model for monolingual sentential rewriting, as trained on {\sc ParaBank}.
With the existence of {\sc ParaBank} and an initial monolingual rewriting model, future work can investigate how more advanced NMT models, such as those with self-attention structures, can lead to better rewriting. One may also investigate the automatic expansion of resources for a variety of NLP tasks. For example, in Machine Translation one might create sentential paraphrases from the English side of bitexts for low-resource languages: cases where only small numbers of gold translations exist in English, and are expensive or otherwise problematic to expand by hand. In Information Extraction, one may rewrite sentences with structured annotations such as for Named Entity Recognition (NER), with positive constraints that phrases representing known NER spans be preserved while some tokens of the remainder be negatively constrained, thereby providing additional novel sentential contexts for IE system training. In educational NLP technology, one might wish to rewrite a sentence that includes or excludes target vocabulary words a language learner does not understand or is trying to acquire. There are many other such examples in NLP where the ability to rewrite existing datasets with lexical constraints could lead to significantly larger and more diverse training sets, with no additional human labor.
To pursue such work may require a large, high quality monolingual bitext to train a rewriting model, and an NMT decoder supporting both positive and negative constraints, such as we have introduced here.
\section*{Acknowledgments}
We thank Chu-Cheng Lin and three anonymous reviewers for their thoughtful feedback. This research was supported in part by DARPA AIDA. The views and conclusions contained in this publication are those of the authors and should not be interpreted as representing official policies or endorsements of DARPA or the U.S. Government.
| {'timestamp': '2019-01-14T02:20:40', 'yymm': '1901', 'arxiv_id': '1901.03644', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03644'} | arxiv |
\section{Introduction}\label{sec:introduction}}
\else
\section{Introduction}
\label{sec:introduction}
\fi
\IEEEPARstart{T}{his} demo file is intended to serve as a ``starter file''
for IEEE Computer Society journal papers produced under \LaTeX\ using
IEEEtran.cls version 1.8b and later.
I wish you the best of success.
\hfill mds
\hfill August 26, 2015
\subsection{Subsection Heading Here}
Subsection text here.
\subsubsection{Subsubsection Heading Here}
Subsubsection text here.
\section{Conclusion}
The conclusion goes here.
\appendices
\section{Proof of the First Zonklar Equation}
Appendix one text goes here.
\section{}
Appendix two text goes here.
\ifCLASSOPTIONcompsoc
\section*{Acknowledgments}
\else
\section*{Acknowledgment}
\fi
The authors would like to thank...
\ifCLASSOPTIONcaptionsoff
\newpage
\fi
\section{Introduction}
\IEEEPARstart{T}{his} demo file is intended to serve as a ``starter file''
for IEEE \textsc{Transactions on Magnetics} journal papers produced under \LaTeX\ using
IEEEtran.cls version 1.8b and later.
I wish you the best of success.
\hfill mds
\hfill August 26, 2015
\subsection{Subsection Heading Here}
Subsection text here.
\subsubsection{Subsubsection Heading Here}
Subsubsection text here.
\section{Conclusion}
The conclusion goes here.
\appendices
\section{Proof of the First Zonklar Equation}
Appendix one text goes here.
\section{}
Appendix two text goes here.
\section*{Acknowledgment}
The authors would like to thank...
\ifCLASSOPTIONcaptionsoff
\newpage
\fi
\section{Introduction}\label{sec:introduction}}
\IEEEPARstart{T}{his} demo file is intended to serve as a ``starter file''
for IEEE Computer Society journal papers produced under \LaTeX\ using
IEEEtran.cls version 1.8b and later.
I wish you the best of success.
\hfill mds
\hfill August 26, 2015
\subsection{Subsection Heading Here}
Subsection text here.
\subsubsection{Subsubsection Heading Here}
Subsubsection text here.
\section{Conclusion}
The conclusion goes here.
\appendices
\section{Proof of the First Zonklar Equation}
Appendix one text goes here.
\section{}
Appendix two text goes here.
\ifCLASSOPTIONcompsoc
\section*{Acknowledgments}
\else
\section*{Acknowledgment}
\fi
The authors would like to thank...
\ifCLASSOPTIONcaptionsoff
\newpage
\fi
\section{Introduction}
\IEEEPARstart{T}{his} demo file is intended to serve as a ``starter file''
for IEEE journal papers produced under \LaTeX\ using
IEEEtran.cls version 1.8b and later.
I wish you the best of success.
\hfill mds
\hfill August 26, 2015
\subsection{Subsection Heading Here}
Subsection text here.
\subsubsection{Subsubsection Heading Here}
Subsubsection text here.
\section{Conclusion}
The conclusion goes here.
\appendices
\section{Proof of the First Zonklar Equation}
Appendix one text goes here.
\section{}
Appendix two text goes here.
\section*{Acknowledgment}
The authors would like to thank...
\ifCLASSOPTIONcaptionsoff
\newpage
\fi
\section{Introduction}
This demo file is intended to serve as a ``starter file''
for IEEE conference papers produced under \LaTeX\ using
IEEEtran.cls version 1.8b and later.
I wish you the best of success.
\hfill mds
\hfill August 26, 2015
\subsection{Subsection Heading Here}
Subsection text here.
\subsubsection{Subsubsection Heading Here}
Subsubsection text here.
\section{Conclusion}
The conclusion goes here.
\section*{Acknowledgment}
The authors would like to thank...
\section{Introduction}
This demo file is intended to serve as a ``starter file''
for IEEE Computer Society conference papers produced under \LaTeX\ using
IEEEtran.cls version 1.8b and later.
I wish you the best of success.
\hfill mds
\hfill August 26, 2015
\subsection{Subsection Heading Here}
Subsection text here.
\subsubsection{Subsubsection Heading Here}
Subsubsection text here.
\section{Conclusion}
The conclusion goes here.
\ifCLASSOPTIONcompsoc
\section*{Acknowledgments}
\else
\section*{Acknowledgment}
\fi
The authors would like to thank...
\section{Introduction}
\IEEEPARstart{T}{his} demo file is intended to serve as a ``starter file''
for IEEE Communications Society journal papers produced under \LaTeX\ using
IEEEtran.cls version 1.8b and later.
I wish you the best of success.
\hfill mds
\hfill August 26, 2015
\subsection{Subsection Heading Here}
Subsection text here.
\subsubsection{Subsubsection Heading Here}
Subsubsection text here.
\section{Conclusion}
The conclusion goes here.
\appendices
\section{Proof of the First Zonklar Equation}
Appendix one text goes here.
\section{}
Appendix two text goes here.
\section*{Acknowledgment}
The authors would like to thank...
\ifCLASSOPTIONcaptionsoff
\newpage
\fi
\section{Introduction}\label{sec:introduction}}
\else
\section{Introduction}
\label{sec:introduction}
\fi
\IEEEPARstart{T}{his} demo file is intended to serve as a ``starter file''
for IEEE Computer Society journal papers produced under \LaTeX\ using
IEEEtran.cls version 1.8b and later.
I wish you the best of success.
\hfill mds
\hfill August 26, 2015
\subsection{Subsection Heading Here}
Subsection text here.
\subsubsection{Subsubsection Heading Here}
Subsubsection text here.
\section{Conclusion}
The conclusion goes here.
\appendices
\section{Proof of the First Zonklar Equation}
Appendix one text goes here.
\section{}
Appendix two text goes here.
\ifCLASSOPTIONcompsoc
\section*{Acknowledgments}
\else
\section*{Acknowledgment}
\fi
The authors would like to thank...
\ifCLASSOPTIONcaptionsoff
\newpage
\fi
\section{Introduction}
\IEEEPARstart{T}{his} demo file is intended to serve as a ``starter file''
for IEEE \textsc{Transactions on Magnetics} journal papers produced under \LaTeX\ using
IEEEtran.cls version 1.8b and later.
I wish you the best of success.
\hfill mds
\hfill August 26, 2015
\subsection{Subsection Heading Here}
Subsection text here.
\subsubsection{Subsubsection Heading Here}
Subsubsection text here.
\section{Conclusion}
The conclusion goes here.
\appendices
\section{Proof of the First Zonklar Equation}
Appendix one text goes here.
\section{}
Appendix two text goes here.
\section*{Acknowledgment}
The authors would like to thank...
\ifCLASSOPTIONcaptionsoff
\newpage
\fi
\section{Introduction}\label{sec:introduction}}
\IEEEPARstart{T}{his} demo file is intended to serve as a ``starter file''
for IEEE Computer Society journal papers produced under \LaTeX\ using
IEEEtran.cls version 1.8b and later.
I wish you the best of success.
\hfill mds
\hfill August 26, 2015
\subsection{Subsection Heading Here}
Subsection text here.
\subsubsection{Subsubsection Heading Here}
Subsubsection text here.
\section{Conclusion}
The conclusion goes here.
\appendices
\section{Proof of the First Zonklar Equation}
Appendix one text goes here.
\section{}
Appendix two text goes here.
\ifCLASSOPTIONcompsoc
\section*{Acknowledgments}
\else
\section*{Acknowledgment}
\fi
The authors would like to thank...
\ifCLASSOPTIONcaptionsoff
\newpage
\fi
\section{Introduction}
\IEEEPARstart{T}{his} demo file is intended to serve as a ``starter file''
for IEEE journal papers produced under \LaTeX\ using
IEEEtran.cls version 1.8b and later.
I wish you the best of success.
\hfill mds
\hfill August 26, 2015
\subsection{Subsection Heading Here}
Subsection text here.
\subsubsection{Subsubsection Heading Here}
Subsubsection text here.
\section{Conclusion}
The conclusion goes here.
\appendices
\section{Proof of the First Zonklar Equation}
Appendix one text goes here.
\section{}
Appendix two text goes here.
\section*{Acknowledgment}
The authors would like to thank...
\ifCLASSOPTIONcaptionsoff
\newpage
\fi
\section{Introduction}
This demo file is intended to serve as a ``starter file''
for IEEE conference papers produced under \LaTeX\ using
IEEEtran.cls version 1.8b and later.
I wish you the best of success.
\hfill mds
\hfill August 26, 2015
\subsection{Subsection Heading Here}
Subsection text here.
\subsubsection{Subsubsection Heading Here}
Subsubsection text here.
\section{Conclusion}
The conclusion goes here.
\section*{Acknowledgment}
The authors would like to thank...
\section{Introduction}
This demo file is intended to serve as a ``starter file''
for IEEE Computer Society conference papers produced under \LaTeX\ using
IEEEtran.cls version 1.8b and later.
I wish you the best of success.
\hfill mds
\hfill August 26, 2015
\subsection{Subsection Heading Here}
Subsection text here.
\subsubsection{Subsubsection Heading Here}
Subsubsection text here.
\section{Conclusion}
The conclusion goes here.
\ifCLASSOPTIONcompsoc
\section*{Acknowledgments}
\else
\section*{Acknowledgment}
\fi
The authors would like to thank...
\section{Introduction}
\IEEEPARstart{T}{his} demo file is intended to serve as a ``starter file''
for IEEE Communications Society journal papers produced under \LaTeX\ using
IEEEtran.cls version 1.8b and later.
I wish you the best of success.
\hfill mds
\hfill August 26, 2015
\subsection{Subsection Heading Here}
Subsection text here.
\subsubsection{Subsubsection Heading Here}
Subsubsection text here.
\section{Conclusion}
The conclusion goes here.
\appendices
\section{Proof of the First Zonklar Equation}
Appendix one text goes here.
\section{}
Appendix two text goes here.
\section*{Acknowledgment}
The authors would like to thank...
\ifCLASSOPTIONcaptionsoff
\newpage
\fi
\subsection{RQ1: Effectiveness of prioritization in identifying erroneous behavior}
\label{subsec:rq1}
\begin{figure*}[h]
\centering
\hfill
\subfloat[MNIST-A]{
\includegraphics[width=0.31\textwidth]{figures/mnist_a.png}
\label{fig:mnist_a}
}
\hfill
\subfloat[MNIST-B]{
\includegraphics[width=0.31\textwidth]{figures/mnist_b.png}
\label{fig:mnist_b}
}
\hfill
\subfloat[MNIST-C]{
\includegraphics[width=0.31\textwidth]{figures/mnist_c.png}
\label{fig:mnist_c}
}
\hfill
\null
\hfill
\subfloat[MNIST-D]{
\includegraphics[width=0.31\textwidth]{figures/mnist_d.png}
\label{fig:mnist_d}
}
\hfill
\subfloat[TaxiNet-MobileNet]{
\includegraphics[width=0.31\textwidth]{figures/taxinet_mobile.png}
\label{fig:taxinet-mobile}
}
\hfill
\subfloat[TaxiNet-SimpleNet]{
\includegraphics[width=0.31\textwidth]{figures/taxinet_simple.png}
\label{fig:taxinet-simple}
}
\hfill
\null
\caption{
The cumulative sum of the error revealing inputs by test inputs of
decreasing priority:
%
The x-axis represents the test cases sorted in a decreasing order of
priority.
%
The y-axis shows the cumulative sum of error-revealing inputs.
%
An ideal prioritization should sort every error-revealing inputs to the
front, drawing a highly convex curve.
%
A poor prioritization, on the other hand, will produce a curve with lower
convexity.
}
\label{fig:aucs}
\end{figure*}
The effectiveness of prioritization in identifying misbehavior is illustrated
in Figure~\ref{fig:aucs} and summarized in Table~\ref{tbl:auc}.
For each model we present the validation accuracy, test accuracy, and the score
of prioritization in Average Percentage of Faults Detected (APFD) as described
in Section~\ref{subsec:efficacy}.
The accuracy of classification is presented as the percentage of correct
classification, and the accuracy of regression is presented as mean absolute
error (MAE).
The MAE for TaxiNet is defined as $\frac{1}{n} \Sigma_{i=1}^n |{\bf f}^{\bf
W}({\bf x})_i - {\bf y}_i|$ where $n$---the length of the output vector---is
two for TaxiNet.
The output of TaxiNet is normalized to be between $-1$ and $1$, so the MAE is
always between $0.0$ and $1.0$ where a lower error is more desirable.
We also present the accuracy as a percentage; the correctness of an output is
determined by a fixed error threshold on MAE of $0.25$.
\begin{figure}
\centering
\hfill
\subfloat[High priority input]{
\includegraphics[width=0.23\textwidth]{figures/bad.jpg}
\label{fig:bad}
}
\hfill
\subfloat[Low priority input]{
\includegraphics[width=0.23\textwidth]{figures/good.jpg}
\label{fig:good}
}
\caption{
Representative inputs of high vs. low priority: high utility score was
assigned to inputs that produce high uncertainty---in this case, due to
the lack of visible center line in the runway image taken around an
intersection.
}
\label{fig:taxinet}
\end{figure}
\begin{table*}[t]
\caption{
The efficacy of test input prioritization in misbehavior identification
}
\centering
\input{tables/auc.tex}
\label{tbl:auc}
\end{table*}
The efficacy of prioritization presented as APFD scores ranged from $74.91$ to
$94.80$ over the different models, which suggests that test input prioritization
works in highlighting error-revealing inputs, regardless of the type of task
and the structure of the network.
Among different techniques, the efficacy of softmax, dropout Bayesian, and DSA
were all similar for the same model, but the efficacy of the dropout Bayesian
method was higher with more samples as larger samples can be used to more accurately
depict the posterior distribution.
An interesting observation is that the efficacy of the prioritization metrics
is correlated with the test accuracy of the model, or more precisely, the
difference of the validation accuracy and the test accuracy of the model.
The APFD was consistently high for the well-performing models and consistently
low for the worse-performing models, regardless of the choice of sentiment
measure.
One plausible cause for this phenomenon is covariate
shift~\cite{sugiyama2012machine}, which is a situation when the distribution
of the input data shifts from training dataset to test dataset.
A stark decrease in the test accuracy for some models suggests that the
distribution of the data shifted from the training data to test data, and some
models (such as A and B) are relatively robust to the shift while the others
are not.
Model A, for instance, implements batch normalization, a technique known to
reduce the internal covariate shift~\cite{sergey2015batch} and was more robust
to the covariate shift in input distribution, which contributed to a higher
prioritization effectiveness.
\begin{comment}
As an analogy, the phenomenon of the good model is analogous to a good student
who not only knows well what she knows but also knows what she does not know.
A mediocre student (or a model), on the other hand, is not aware of what she
does not not know and not adequately surprised, uncertain.
\end{comment}
In conclusion to our first research question:
\begin{tcolorbox}
Prioritized inputs can effectively identify erroneous behavior in a trained
model.
%
The prioritization is more effective when the model has higher test accuracy.
\end{tcolorbox}
\subsection{RQ2: Effectiveness of prioritization in retraining}
\label{subsec:rq2}
We assess the utility of the prioritized inputs when a model is retrained with
the training dataset augmented with the prioritized inputs.
This evaluation is similar to the active learning scenario but different in
that the model under test is already well-trained.
We only sample 1\% of the amount of training data from the test set, which
equals to 600 for the MNIST models and 400 for the TaxiNet models.
The baseline approach we compare against is random selection with the same
sample size---we hypothesize that prioritization techniques perform better
than the random selection.
Hyper-parameters other than the augmented training data were kept constant
in retraining runs.
\begin{comment}
Due to the non-deterministic nature of the stochastic gradient-descent
algorithm used for optimization, one should ideally perform a statistical test
such as Welch's T-test to establish a statistically-grounded comparison.
However, we compromised to retrain three times each for the same retraining
dataset due to the prohibitive computational cost of retraining.
The average mean accuracy of the retrained models should thus be interpreted
with caution.
\end{comment}
\begin{table*}[ht]
\caption{
The efficacy of input prioritization in retraining
}
\centering
\input{tables/retraining.tex}
\label{tbl:retrain}
\end{table*}
Table~\ref{tbl:retrain} shows that the relative efficacy of retraining follows
a similar trend to the error-revealing efficacy presented in Table~\ref{tbl:auc}.
The prioritized inputs could improve the accuracy of the retrained models more
effectively than randomly sampled inputs in most cases, and the efficacy was
more pronounced for MNIST model A and B than in model C and D.
When model B and C are compared, model B consistently performed better when
retrained with prioritized inputs while model C almost always performed worse
when retrained with with randomly sampled inputs.
One hypothetical explanation could be that a well-architectured DNN model with
a better generalization benefits more from learning the corner-cases, whereas
an unoptimal DNN learns more from general cases.
However, the exact reason for this phenomenon cannot be drawn from the limited
experiment---a future investigation is necessary.
In conclusion to the second research question:
\begin{tcolorbox}
Sentiment measures can prioritize inputs that can augment the training
dataset with which a better accuracy can be achieved.
%
But random sampling was found more effective for the models that achieve
low test accuracy.
\end{tcolorbox}
\subsection{Threats to Validity}
In the experiment, we evaluated the sentiment measures with both an image
classification task and an image regression task, and configured several
DNNs with various structural features.
Despite our effort, the representativeness of the configured DNNs were
inevitably limited in number and variety, and our empirical findings
might not generalize to other types of DNNs such as recurrent neural
nets.
Nevertheless, the DNNs we evaluated are of realistic sizes and implement
some of the most widely used techniques that are applied in practical deep
learning practices~\cite{goodfellow2016deep}.
The second experiment for answering RQ2 was performed without the
statistical rigor required for hypothesis testing due to the prohibitive
cost of retraining a large model multiple times.
We present the result and the finding as a preliminary assessment of the
sentiment measures in the context of testing which calls for more rigorous
empirical assessment in future work.
\begin{comment}
\item
Our findings may not generalize to other types of neural networks such as
recurrent neural nets, or other types of neural net architecture.
\item
Since the accuracy of a neural network model depends on many factors, most
significantly on the training data and the test data used to assess, the result
might be different when the models are trained or tested with different input
datasets.
\end{comment}
\subsection{Model Validation is Not Enough}
Although it is tempting to extrapolate the validation accuracy as the test
accuracy, the generalization is bound by how well the validation dataset
represents the real input distribution, which is hard to know.
We demonstrate this fallacy with a small experiment, which shows a wide gap
between validation accuracy and test accuracy.
We designed four models of different structures and trained each of them with
MNIST dataset~\cite{lecun1998mnist}, a well-known dataset for hand-written
digit recognition task that is comprised of 70,000 data points; we used 60,000
data points for training and held out 10,000 for validation.
We fixed the batch size to 32, used ADAM optimizer~\cite{kingma2014adam},
check-pointed the epoch with the lowest validation loss, and stopped the
training when the validation loss did not improve for 20 consecutive epochs.
For testing the model with unseen data, we used EMNIST
dataset~\cite{cohen2017emnist}, which is another digit-recognition dataset that
consists of 280,000 data points designed to be compatible with MNIST.
\end{comment}
Table~\ref{tbl:generalization} shows the wide gap in the validation accuracy
and test accuracy.
While all of the four model achieved fairly high accuracies of $98.16\%$ to
$99.37\%$, the test accuracy varied dramatically from $77.39\%$ to $94.73\%$.
The result also shows that the validation accuracy alone can mislead us when
deciding which model is better.
Model C, for instance, achieved a higher validation accuracy than Model B,
while the test accuracy shows that Model B is better than Model C.
These mixed result suggests that validation testing alone is not a good-enough
measure of the real performance and that additional testing should be performed
comprehensively with more data in order to assess the generalization of the
trained model.
\begin{comment}
\subsection{Model Validation vs. User Validation}
\sanjai{This has to be shortened if at all it should be included}
From the perspective of Software Engineering, a program is verified against the
specification---to check if the program is {\it correct} with respect to how it
is designed---and validated against the requirement---to check if we developed
the {\it right} program that addresses the needs (of the
customers/users)~\cite{}.
Likewise, we argue that the learning-enabled component shall be verified and
validated in the same manner.
The difference, however, is that the traditional notion, mental framework,
techniques and tools may not directly portable to learning-enabled component
due to the distinct ways in which the learning-enabled components are
developed.
For instance, specification in a traditional sense translates {\it
"what"s}---the requirement---into {\it "how"s}~\cite{} so that the
implementation can be checked against the it.
For learning-enabled components, however, it is hard to refine the requirement
of the system into tangible {\it "how"s} since we rely on learning algorithms
to figure out the {\it "how"s} rather than coming up with rules to solve the
problem.
A digit classification task can be a good example; the requirement, although
vaguely, can be captured as "given an image of a digit between 0 and 9, assign
a correct label", while we cannot specify the {\it "how"} the system can
achieve it, any more clearly than "if it looks like 7, label it as 7. ...".
In the traditional software development life-cycle, testing activity could
address both of the two V\&V activities---verification was done by checking if
the program upholds the specification, and validation was done by checking if
the program meets the user requirement~\cite{}.
From this point of view, what is called validation testing in the deep learning
community is more like the verification in the traditional point of view when
we think of the training and validation data as capturing the specification
instance-by-instance.
This (model) validation testing is usually iterated multiple times while
adjusting the hyper-parameters to the model, just like the regression testing
is performed iteratively during development for checking the correctness of the
implementation.
The other testing---the testing for assessing the generalization of the
model---is much like the validation testing in a sense that it is performed
after the program is (almost) fully developed, and as it serves the purpose of
validating the program against the user requirement.
To avoid confusion with the term {\it validation testing} in the deep-learning
community, we call this process {\it user validation testing} and argue that
the main goal of user validation testing is to assess the generalization of the
model, and this is where we should focus our testing effort.
In the context of developing a deep-learning model, the user validation testing
would involve testing the generalization of the system with diverse range of
real inputs that are gathered from the operational environment.
The performance or the generalization of the model can then be analyzed and
{\it validated} against the system-level requirement.
\end{comment}
\subsection{Mitigating the Oracle Problem with Test Prioritization}
When it comes to testing for assessing generalization to large amount of unseen
data, the biggest bottleneck comes from labeling.
While it is relatively easy to obtain more test input, it is much more
difficult to obtain the expected output because the label cannot be created
automatically in most of the tasks that neural networks deal with.
For instance, consider a situation of testing an object detection model
designed for a self-driving car.
It is relatively cheap to collect more road image data, since a few vehicles
driven around the road can easily collect thousands of images every minute.
Labeling those images is much more expensive, however, since it inevitably
involves human effort of annotating the image with the objects recognized by
human.
If we assume that it takes 30 seconds for a person to label an image and the
frame rate of a camera is 30 FPS (frames per second), then it takes 15
man-hours for crafting the label for only an hour of driving data, which is
very costly ($3,600$ secs $\times$ $30$ FPS / $7,200$ images per hour).
From a software testing perspective, the difficulty of obtaining labeled data
is analogous to the difficulty of oracle construction known as the oracle
problem~\cite{barr2015oracle}.
However, due to characteristics unique to learning-enabled systems, many
of the solutions to the oracle problem studied by the software engineering
community cannot be applied directly.
For instance, one of the most straight-forward and natural way of producing an
oracle is to harness the specification, which is an artifact that specifies the
behavior of a software.
When available, formal or informal specification, state transition system,
assertions, and contracts can directly or indirectly be used to construct test
oracles.
We cannot obtain this type of oracle for most of the tasks that machine
learning deals with.
Object detection is one of such problem of perception---it is not possible to
unambiguously specify what an object looks like, let alone creating an
automated oracle.
This work attempts to tackle the oracle problem by reducing the cost of
labeling.
First, we assume that not every test input is of the same value.
For the most practical goal of testing is to find as many bugs as possible, an
input that reveals a misbehavior of the model is more valuable than an input
that does not.
Second, we hypothesize that the relative value of each test input---or the
likelihood of each input of triggering a erroneous behavior---can be
automatically estimated by a systematic measure.
We introduce three measures of uncertainty based on white-box analysis of the
neural network which can assign relative value of utility to the unlabeled test
input.
\begin{comment}
If these assumptions hold, we can reduce the cost of neural network testing
dramatically, by having to label only a fraction of the test inputs that are
most likely to reveal faults.
For instance, one can run a million test inputs and get a similar amount of
insight, or catch a similar number of bugs only by inspecting a thousand inputs
manually instead of a million.
\end{comment}
\subsection{Systems Under Test}
To simulate a realistic testing scenario where a trained model is scrutinized
with additional test data, we chose two representative systems for image
classification and image regression.
The first system is a digit classification system trained with the 60,000
MNIST~\cite{lecun1998mnist} training dataset.
We test the system with the EMNIST~\cite{cohen2017emnist} dataset, an extension of
MNIST which is compatible to its predecessor.
The second system is called TaxiNet, which is designed for an aircraft in
ground operation to predict the distance to a center line and the heading
angle deviation from a center line while taxiing.
It is designed and developed by our industrial partner as a research prototype
to assess the applicability of learning-enabled components in the
safety-critical domain.
The data collection and training was done by ourselves.
To avoid the high cost of operating an actual aircraft in the real environment,
we collected the dataset in the X-Plane 11 simulation environment wherein the
graphics and the dynamics of the environment and the aircraft are accurately
modeled.
For a preliminary assessment, we fixed the runway to KMWH-04 and the aircraft
to be Cessna 208B Grand Caravan, while varying the position and the angle of
the aircraft together with the weather condition.
We used 40,000 samples for training with some realistic image
augmentations---such as brightness, contrast, blur, vertical affine
transformation---turned on in order to maximize the utility of the training
data and create a more robust model.
\subsection{Model Configuration}
The accuracy of a neural network depends on many factors including the amount
and quality of training data, the structure of the network, and the training
process.
As the performance of our proposed prioritization techniques may also depend on
these factors, we treated the structural configuration as an independent
variable.
However, since it is infeasible to compare the effect of all the independent
variables to the prioritization techniques, we configured a number of
representative neural networks with different structures.
We controlled the other hyper-parameters---such as learning rate and mini-batch
size---to be constant across different configurations so that the effect of the
structure alone can be studied.
The hyper-parameters are configured according to the known good practices at
the time of writing this paper so that we can objectively simulate a realistic
testing scenario.
\begin{table*}[ht]
\centering
\caption{
Four digit classification models trained with the MNIST dataset~\cite{lecun1998mnist}
and tested with the EMNIST dataset~\cite{cohen2017emnist}.
%
}
\input{tables/mnistemnist.tex}
\label{tbl:mnistemnist}
\end{table*}
For the digit classification task, we configured four networks as described in
Table~\ref{tbl:mnistemnist}.
For all layers except the last one, ReLu (rectified linear unit) was used as an
activation function, and L2 kernel regularization was applied to prevent the
parameters from over-fitting.
During training, we check-pointed the epoch only when the validation accuracy
(with the 10,000 validation set) improved over the previous epochs, and stopped
the training when the validation accuracy did not improve for more than twenty
consecutive epochs.
For the taxiing task, we compare two different networks named MobileNet and
SimpleNet, supplied by our industry partner.
MobileNet is a convolutional neural network inspired by
MobileNetV2~\cite{mobilenetv2}.
The structure of the network is similar to what is described in Table~2 in
Sandler~{\it et~al}.'s paper, and it is relatively compact in size, with 2,358,642
trainable parameters.
SimpleNet is also a convolutional neural network, with a simpler
structure, but with 4,515,338 trainable parameters.
It has five sets of convolution, batch normalization, and activation layers
back-to-back, followed by a dropout layer and four dense layers.
Both of the networks implement L2 regularization, and trained with stochastic
gradient-descent algorithm with weight decay.
\subsection{Efficacy Measure}
\label{subsec:efficacy}
An ideal prioritization technique would consistently assign high scores to all
the error-revealing inputs and low scores to all the rest.
For example, if there were 20 prioritized test inputs among which 5 were
error-revealing, the first five inputs should all reveal errors and the rest
should not.
If we draw a graph of the cumulative sum that represents the cumulative number
of errors revealed by executing each prioritized input, the graph will be monotonically increasing until it hits 5, which is the total number of
error-revealing inputs in the given test suite (the orange line in
Figure~\ref{fig:ideal}).
A test suite without prioritization would produce a line like the blue line.
In practice, the efficacy of a prioritization technique will be somewhere
between random selection and an ideal prioritization, since it is undecidable
to predict whether the prediction is correct or not, producing a curve that
looks like the green line in Figure~\ref{fig:ideal}.
The efficacy of a prioritization technique can then be captured by computing
the area under curve for each technique and computing the ratio of each to the
area under the curve of the idea prioritization criterion.
This is a slight modification to Average Percentage of Fault Detected (APFD)
measure, which is typically used for measuring the efficacy of test
prioritization~\cite{rothermel1999test}.
\begin{figure}[h]
\centering
\includegraphics[width=0.7\columnwidth]{figures/demo.png}
\caption{
Cumulative sum of the errors found by test suites prioritized by each
technique ({\it ideal}, {\it poor}, {\it technique1}).
%
The x-axis corresponds to the test case, where the priority is higher for
the former ones.
%
The y-axis is the total number of errors found by executing the test cases
up to $x$ test cases.
%
The efficacy score of {\it technique1} is the ratio of its area under curve
to the area under the {\it ideal} curve: $83 / 90 = 92.23$.
}
\label{fig:ideal}
\end{figure}
\subsection{Implementation and Experiment Environment}
We implemented the three prioritization techniques---softmax, dropout Bayesian,
and Surprise Adequacy---in Python on top of Keras~\cite{keras}, which is one of
the most popular machine-learning libraries.
Our tool is thus compatible with any trained model that abides by Keras' Model
interface.
The surprise adequacy measurement part is implemented in C++ to better utilize
lower-level performance optimizations and thread-based parallelization.
Every feature is integrated seamlessly and provided as a Python API.
The tool is publicly available on GitHub at
\url{http://www.github.com/bntejn/keras-prioritizer}.
The experiments are performed on Ubuntu 16.04 running on an Intel i5 CPU, 32GB
DDR3 RAM, an SSD, and a single NVIDIA GTX 1080-Ti GPU.
\subsubsection{Constraint-based techniques}
Sun~{\it et~al}.~\cite{sun2018testing} explored white-box coverage criteria even
further and introduced MC/DC-inspired coverage criteria for testing neural
networks with which new test inputs are synthesized.
Test generation was achieved by encoding the entire neural network into
linear-programming (LP) constraints, encoding the coverage criteria as
constraints over the encoded network, and by querying the LP solver for the
constraint satisfiability.
Their following work~\cite{sun2018concolic} defined a generic concolic testing
framework which can handle multiple model encoding schemes and multiple
coverage criteria.
However, their approach is limited by the scalability of the solver--the
time complexity of the solver is exponential to the size of the model, which
makes it infeasible to generate test inputs for modern neural networks, the
size of which easily exceeds millions of neurons.
\subsubsection{Testing Neural Networks}
Pioneering work by Xie~{\it et~al}.~\cite{xie2011testing}: metamorphic testing.
DeepMutation~\cite{ma2018deepmutation}.
DeepGuage~\cite{ma2018deepguage}.
Techniques for guiding testing.
Fuzzing for finding arithmetic faults was introduced by Odena and
Goodfellow~\cite{odena2018tensorfuzz}.
Another fuzzing + coverage to find faulty (synthetic) inputs (affine
transformation + metamorphic relation oracle)~\cite{xie2018coverage}.
Kim~{\it et~al}.~\cite{kim2018guiding} introduced Surprise Adequacy which can
determine the rarity of the input data with respect to the training data.
\subsubsection{Test Generation}
Test generation works:
DeepXplore~\cite{pei2017deepxplore}: first paper on white-box testing of neural
network. Introduced neuron coverage. Differential testing. (gradient)
search-based test generation.
{\it Test generation in the simulation environment}:
Simulation-based adversarial~\cite{tuncali2018simulation}.
Counterexample-guided data augmentation in the simulation
environment~\cite{dreossi2018counterexample}.
Language-based scene (test/training data) generation~\cite{fremont2018scenic}.
\end{comment}
\subsection{Uncertainty}
The key idea of test input prioritization is to capture
information available from a DNN that represents sentiments such
as confidence, uncertainty or surprise on an input presented
to the DNN.
The relative value of each test input can be judged based on the model's
sentiment, and higher priority can be assigned to uncertain or surprising inputs,
since those may more likely reveal erroneous behaviors in the model.
Although the sentiments such as uncertainty usually not provided by a
typical DNN unless explicitly modeled, multiple techniques exist that captures
the sentiments by inspecting the internal computation of the neural network.
This section introduces three such techniques.
\subsection{Softmax Output as Confidence Prediction}
Softmax is a logistic function that squashes a $K$-dimensional vector $\bf{z}$
of real values to a $K$-dimensional vector $\sigma({\bf z})$ of real values
where each entry of $\sigma({\bf z})$ is in the range $[0, 1]$ and the entries
add up to $1$: $\sigma({\bf z})_j = {e^{z_j}} / {\sum_{k=1}^{K} e^{z_k}}$, $j =
1, ..., K$.
It is typically used as the last layer of a neural network for a multi-class
classification task so that the output can represent the categorical
probability distribution of the $K$ classes.
When available, the priority score can be computed directly from the softmax
output while incurring a minimal computational overhead.
As an instantiation of the scoring function, we borrow the notion of entropy to
summarize the distribution and assign a single score to an unseen test input
${\bf x}_i$:
\begin{equation}
{\mathit score}({\bf x}_i) = - \sum_{c=1}^{C} p_{i,c} \log p_{i,c}
\end{equation}
where $C$ is the number of output classes.
Intuitively speaking, the score is lower for a certain classification where
only one $p_{i,c}$ is high, and higher for an uncertain classification where
the predicted distribution is spread out, thus assigning high scores to inputs
that are more uncertain.
An obvious limitation of softmax-based prioritization is that it can be applied
only to classification models where a softmax layer is used.
However, a more fundamental limitation is that the predicted probability does
not reflect the model's confidence, as demonstrated by Gal and
Ghahramani~\cite{gal2016dropout} and also shown in the case of adversarial
input attacks~\cite{nguyen2014deep, goodfellow2014explaining,
subramanya2017confidence}.
For instance, an adversarially perturbed input that looks just like an ostrich
to human eyes can be classified as a panda with 99\% confidence.
These limitations call for prioritization techniques that are more reliable and
also apply to regression models.
\subsection{Bayesian Uncertainty}
Model uncertainty is the degree to which a model is uncertain about its
prediction for a given input.
An uncertain prediction can be due to a lack of training data---known as
epistemic uncertainty---or due to the inherent noise in the input data---known
as aleatoric uncertainty~\cite{kendall2017what}; but we do not distinguish the
two in this paper because they cannot be distinguished unless a neural network
is explicitly modeled to predict them as outputs~\cite{kendall2017what}.
As it is practically impossible for a machine-learning model to achieve 100\%
accuracy, model uncertainty is immensely useful for engineering a more robust
learning-enabled component.
In order to obtain model's uncertainty along with the prediction, we need
mathematically grounded techniques based on Bayesian probability theory.
We briefly introduce Bayesian neural network and a technique to approximate it using existing neural networks.
The uncertainty estimated by these techniques can then be used as scores to
prioritize test inputs.
\subsubsection{Bayesian Neural Network}
A typical (non-Bayesian) neural network has deterministic parameters that are
optimized to have fixed values.
A Bayesian neural network (BNN)~\cite{richard1991neural}, on the other hand,
treats parameters as random variables which can encode distributions.
For training, Bayesian inference~\cite{neal2012bayesian} is used to update the
posterior over the weights ${\bf W}$ given the data ${\bf X}$ and ${\bf Y}$:
$p({\bf W} | {\bf X}, {\bf Y}) = {p({\bf Y} | {\bf X}, {\bf W}) \times p({\bf W})} / {
p({\bf Y} | {\bf X}) }$, which captures the set of plausible model parameters
given the data.
To make the training of the weights tractable, the weights are often
fitted to a simple distribution such as the Gaussian, and the parameters
(mean and variance in the case of the Gaussian distribution) of the distributions
are optimized during training~\cite{graves2011practical}.
The likelihood of the prediction is often defined as a Gaussian with mean given
by the model output: $p({\bf y} | {\bf f}^{\bf W}({\bf x})) = \mathcal{N}({\bf
f}^{\bf W}({\bf x}))$ where ${\bf f}^{\bf W}({\bf x})$ denotes random
output of the BNN~\cite{kendall2017what} for an input ${\bf x}$ and $\mathcal{N}$ a normal distribution.
\subsubsection{Uncertainty in Bayesian Neural Networks}
For a classification task, the likelihood of predicting an output $c$ for an
input ${\bf x}$ is defined as:
\begin{equation} \label{eq:softmax}
p(y = c | {\bf x}, {\bf X}, {\bf Y}) \approx \frac{1}{T} \sum_{t=1}^{T}{
{\mathit Softmax}({\bf f}^{\bf W}({\bf x}))}
\end{equation}
with $T$ samples.
The uncertainty of the probability vector ${\bf p}$ is then summarized as the
entropy of the probability vector: $H({\bf p}) = - \sum_{c=1}^{C} p_c
\log{p_c}$.
For regression, the uncertainty is captured by the predictive variance which is
approximated as:
\begin{equation} \label{eq:var}
{\mathit Var}({\bf y}) \approx \frac{1}{T} \sum_{t=1}^{T} {\bf f}^{\bf
W}({\bf x})^T {\bf f}^{\bf W}({\bf x}) - E({\bf y})^T E({\bf y})
\end{equation}
with $T$ samples and the predicted mean $E({\bf y}) \approx \frac{1}{T}
\sum_{t=1}^{T} {\bf f}^{\bf W}({\bf x})$~\cite{kendall2017what}.
In other words, the predictive variance is obtained by passing the input ${\bf
x}$ $T$ times to the model ${\bf f}^{\bf W}$ and by computing the variance
among $T$ sampled outputs.
\subsubsection{Monte-Carlo Dropout as a Bayesian Approximation}
Dropout is a simple regularization technique that prevents neural network
models from over-fitting to training data~\cite{srivastava2014dropout}.
It works during the training phase by randomly dropping out some neurons in
specified layers with a given probability, so that the model parameters are
changed only for the sampled neurons.
Since the model parameters are adjusted only by an infinitesimal amount in each
iteration, the cost converges after sufficient training iterations, even with
the variance introduced by random selection of neurons.
At test time, the dropout is disabled so that every neuron participates in
making a deterministic prediction.
This simple technique is shown to be very effective in improving the
performance of neural networks on supervised learning tasks.
It was later discovered by Gal and Ghahramani~\cite{gal2016dropout} that a dropout
network can approximate a Gaussian Process~\cite{damianou2012deep}.
They proved that an arbitrary neural network with dropout applied before every
weight layer is mathematically equivalent to an approximation of a
probabilistic Gaussian process.
They also showed that any deep neural network that uses dropout layers can be
changed to produce uncertainty estimations by simply turning on the dropout at
test time (unlike the typical use case where dropout is turned off), and the
likelihood can be approximated with Monte Carlo integration.
The uncertainty of the model can then be estimated in a same way as in
Equation~\ref{eq:softmax} and~\ref{eq:var}; the only difference being that the
weight ${\bf W}$ varies by sample $t$ and follows the dropout distribution such
that $\widehat{{\bf W}}_t \sim q^{*}_{\theta}(\bf{W})$ where
$q_{\theta}(\bf{W})$ is the dropout distribution.
We refer more curious readers to the works by Gal and
Ghahraman~\cite{gal2016dropout} and Kendall and Gal~\cite{kendall2017what}.
\subsection{Input Surprise}
Surprise Adequacy (SA, in short) is a test adequacy criterion defined by
Kim~{\it et~al}.~\cite{kim2018guiding} to assess the adequacy of a test suite for
testing deep learning systems.
Informally, SA is achieved when a set of test inputs demonstrates varying
degrees of model's {\it surprise}, measured by the likelihood or distance
function, relative to the training data.
The rationale is that a good test suite shall demonstrate a diverse and
representative behavior of a trained model, and that the {\it surprise} can be
a good representation of such diversity in behavior.
Unlike other coverage criteria introduced for testing neural network so
far, such as neuron coverage~\cite{pei2017deepxplore}, MC/DC-inspired
criteria~\cite{sun2018testing}, or other structural
criteria~\cite{ma2018deepguage}, SA is more fine-grained and unique in that it
can assess the quality of each input individually.
For example, SA can measure the relative surprise of an input to the training
data and give it a numeric score---the higher the score is, the more surprising
it is to the model.
Our take of SA is that a surprising input may more likely reveal an erroneous
behavior in the trained model, since a high surprise may indicate that the
model is not {\it well prepared} for the input, and thus should be given a
high score.
Kim~{\it et~al}.~\cite{kim2018guiding} defined two ways of measuring the surprise.
Both ways make use of the activation trace of a neural network during a
classification.
For the classification of every input, each neuron in the neural network gets
activated with a certain value.
The vector of activation values seen when classifying every
input can then be termed as the \textit{activation trace} of that input.
Given a set of activation traces, $A_N(T)$ for a known set of inputs $T$,
the surprise of a new input ${\bf x}$ with respect to known inputs
$T$ can be computed by comparing the activation trace of the new input
$\alpha({\bf x})$ with those from known inputs $A_N(T)$.
Kim~{\it et~al}. proposed two ways of making such comparisons.
\begin{enumerate}
\item
A probability density function can be computed for the set of activation traces
for known inputs.
For a new input, we can compute the sum of differences between its estimated
density and densities of known inputs.
The higher this sum, the more surprising the new input is.
This method is termed the \textit{Likelihood-based Surprise Adequacy~(LSA)}.
\item
Another method for comparing activation traces is to use a distance function
to create another surprise adequacy criterion called \textit{Distance-based
Surprise Adequacy~(DSA)}.
Given the set of known inputs and a new input ${\bf x}$, DSA computation
first finds the input ${\bf x_a}$ that is the closest neighbor of ${\bf x}$
with the same predicted class as ${\bf x}$ respectively.
Next, it finds the input, ${\bf x_b}$, that is closest to $x_a$, but has a predicted
class different from the one predicted for $x$.
Next $dist_a$ and $dist_b$ is computed as:
\begin{equation} dist_a = ||\alpha_N(x) - \alpha_N(x_a)|| \end{equation}
\begin{equation} dist_b = ||\alpha_N(x_a) - \alpha_N(x_b)|| \end{equation}
with $x_a$ and $x_b$ defined as:
\begin{equation}
x_a = \min_{\bf{D}(x_i)=c_x}||\alpha_N(x) - \alpha_N(x_i)||
\end{equation}
\begin{equation}
x_b = \min_{\bf{D}(x_i)\in C\backslash\{c_x\}}||\alpha_N(x_a) - \alpha_N(x_i)||
\end{equation}
Finally, a value of DSA for the new input $x$ can be computed as:
\begin{equation}
DSA(x) = \frac{dist_a}{dist_b}
\end{equation}
\end{enumerate}
LSA is computationally more expensive and requires more parameter tuning than DSA.
One parameter is the small set of layers that needs to be chosen for LSA.
Activation traces for LSA will then only consist of activation values of neurons in these selected layers.
Another parameter is the value for variance used to filter out neurons whose activation values were below a certain threshold.
DSA, while still being sensitive to layer selection, benefits more than LSA from choosing deeper layers in the network
and has fewer parameters that need to be tuned.
For these reasons, we implemented DSA and compared it with techniques mentioned in the previous two subsections.
\section{Introduction}
\input{sections/intro.tex}
\section{Related Work}
\input{sections/related.tex}
\section{White-box Test Input Prioritization}
\label{sec:prioritization}
\input{sections/prioritization.tex}
\section{Experiment}
\label{sec:experiment}
\input{sections/experiment.tex}
\section{Results and Discussion}
\label{sec:result}
\input{sections/result.tex}
\section{Conclusion and Future Work}
\input{sections/conclusion.tex}
\section*{Acknowledgment}
This work is supported by AFRL and DARPA under contract FA8750-18-C-0099.
\bibliographystyle{IEEEtran}
| {'timestamp': '2019-01-15T02:03:07', 'yymm': '1901', 'arxiv_id': '1901.03768', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03768'} | arxiv |
\section{INTRODUCTION}
Dolphin photo-identification (photo-ID) studies involve photographing dolphin dorsal fins during field work and then having a human categorise images into unique individual animals and matching them with an existing catalogue of known individuals. Individuals are identified by natural features that can be observed on the fins---these features vary between species, but typically include the pattern of nicks and notches on the trailing edge of the fin, the scratches/rake marks/scars on the fin and (for some species) the pigmentation patterns \cite{Wursig1977photographic}.
Matching of new images from the field against a large catalogue is time consuming, because it requires a human to compare each candidate image to every fin in the catalogue, taking $\mathcal{O}(mn)$ average time (where $m$ is the number of new images and $n$ is the number of catalogued individuals). Moreover, as $n$ increases over time as more individuals are added to the catalogue, so does the likelihood of making a mistake, putting catalogue integrity at risk. Consequently, photo-ID studies don't easily scale to large populations or long periods of time \cite{Pawley2018ExaminingDelphinids, Hupman2018ChallengesDelphinids}.
The use of machine learning methods to automate the catalogue process (by automatically clustering and/or classifying images) has the potential to make the study of large populations viable; however this is not a trivial task. Training a robust classifier is challenging due to the presence of major variation in appearance (due to variable illumination and pose, out-of-focus blurring, motion blurring, occlusions and specular highlights), discriminative features between individual animals being relatively subtle and a low sample per class rate for many classes in the existing datasets.
Over the past decade, deep learning methods [DL] (with sufficient training data) have consistently outperformed previous state-of-the-art machine learning techniques in the field of computer vision. Convolutional Neural Networks (CNNs) were inspired by the human visual system \cite{LeCun2015DeepLearning} and have been extremely successful in applications such as object recognition \cite{Krizhevsky2012ImageNetNetworks} and detection \cite{Ren2017FasterNetworks}.
Animal photo-id \cite{Kuhl2013AnimalAppearance} is closely related to facial recognition and person re-identification tasks \cite{Zheng2016PersonFuture}, in that it is also an open set recognition problem \cite{Scheirer2013TowardRecognition}. Unlike standard classification, these tasks must generalise to identities outside the training set. DL approaches that have been used to this end include training a multi-class classifier with available identities, whilst using an intermediate bottleneck layer as a generalised representation \cite{Taigman2014DeepFace:Verification,Sun2015DeeplyRobust}, and various metric (embedding) learning approaches \cite{Schroff2015FaceNet:Clustering,Tadmor2016LearningMethod,Hermans2017InRe-Identification,Parkhi2015DeepRecognition}. Of these approaches, a form of metric learning based on triplet loss is of most interest, as it has worked exceptionally well for facial recognition \cite{Schroff2015FaceNet:Clustering} and person re-id tasks \cite{Hermans2017InRe-Identification}, demonstrating state-of-the-art performance on standard datasets. The resulting models showed robustness to variation in pose, lighting, occlusion and camera angle. Another advantage of this approach is that it has given good results despite the training data having strong class imbalances (a common occurrence in some ecological datasets).
\begin{figure}
\centering
\includegraphics[width=\columnwidth]{images/val_set_tsne.png}
\caption{Visualisation of the evaluation set embeddings, projected into two dimensions using t-SNE shows good correspondence between clusters and dolphin identities (best viewed zoomed in).}
\label{fig:t-sne}
\end{figure}
The main challenge with applying these methods, and DL methods in general, to animal photo-id is the scarcity of training data. For example, Google's FaceNet \cite{Schroff2015FaceNet:Clustering} was trained on 200M images containing 8M identities. Parkhi et al. \cite{Parkhi2015DeepRecognition} achieved comparable results with 2.6M images containing 2.6K identities; however, the size of that training data is still several orders of magnitude greater than the number of images stored within even large dolphin photo-id catalogues \cite{Pawley2018ExaminingDelphinids}.
To investigate how computer vision and DL can be used to assist ecologists when creating a catalogue in photo-id studies, we have methodically collected dolphin images from available sources and built a medium-sized dataset that could potentially be used to train DL models.
This paper presents our preliminary work trying to answer the following questions:
\begin{itemize}
\item Can a triplet-loss based CNN learn robust discriminative features of dolphin fins that generalise to new identities? %
\item What sort of test accuracy can we expect and what effect does the training set size have on it?
\end{itemize}
\section{METHODS}
\subsection{Dataset}
Image catalogues from photo-id studies are rarely made publicly available and collecting large amounts of training data from different sources can be a challenging task. We were able to collect a dataset containing 3544 images of 185 individual New Zealand common dolphins ($Delphinus$ spp). A further 1,200 singleton images (i.e. of 1,200 different individuals) were also collected. The distribution of images per individual is highly imbalanced in this dataset (see Fig. \ref{fig:image_count_hist}). Moreover, strong correlations are also present between images of the same individual taken during the same encounter (on the same day).
\begin{figure}[h!]
\centering
\includegraphics[width=0.95\columnwidth,trim={10px 10px 15px 10px},clip]{images/count_hist.png}
\caption{Distribution of images per dolphin.}
\label{fig:image_count_hist}
\end{figure}
\subsection{Fin Detector}
Consistent with how this method would be used in practice, we cropped fins from images of dolphins using an automated method, available from PhotoId.Ninja \cite{PhotoApplication}: an object detector based on GoogLeNet (v3) \cite{Szegedy2016RethinkingVision} backbone network. This method typically extracts tight crops of fins as shown in Fig. \ref{fig:fin-rankings}.
\subsection{Learning an embedding}
Our approach uses a deep convolutional neural network to learn a Euclidean embedding of cropped dolphin fin images (see Fig. \ref{fig:t-sne} for an example of such an embedding). With each layer, the network transforms the image data, creating a new, more abstract, representation of the data and finally mapping it into a more compact embedding space, such that the Euclidean distances in this space corresponds to fin similarity. The objective is to learn to map pairs of fins from the same dolphin to be spatially close and fins from other dolphins to be spatially far.
Learning such an embedding has many useful advantages over a more traditional classification workflow in photo-id studies, where multiple images are often captured of the same individual during an encounter in the field, including:
\begin{enumerate}
\item new images from the field can be automatically grouped by individual by running a clustering algorithm, such as \textit{k}-means, on their embedding vectors;
\item new images from the field can be automatically matched to large catalogues of known individuals with a simple \textit{k}-NN classifier, or a similarity ranking can be computed and presented to the user for final verification;
\item sightings database can be efficiently checked for consistency;
\item population catalogues can be built from unlabelled images via active learning with a human-in-the-loop.
\end{enumerate}
Unlike methods that use manually engineered features \cite{Gilman2016Computer-assistedPigmentations}, our approach is completely data-driven; the model learns discriminative features that are useful at differentiating between classes (dolphin individuals), whilst being robust to intra-class variations. We posited that, given a sufficiently large and diverse training dataset, the features' discriminative power will generalise to individuals that are not present in the training data. We attempt to quantify what `sufficiently large' actually means for this kind of data.
\subsection{Triplet Loss}
\emph{Triplet loss} refers to a family of objective functions defined over triplets of images (i) an anchor, $a$, (ii) a positive example of the same class as the anchor, $p$, and (iii) a negative example of a different class, $n$. Triplet losses are typically used to optimise an embedding function $f_{\theta}(x)\! : \mathbb{R}^{data} \rightarrow \mathbb{R}^D$ that maps data points from the original high-dimensional space to a lower dimensional embedding space ($D$), such that the anchor, $a$, will be positioned closer to the positive example, $p$, than to the negative example, $n$, in $\mathbb{R}^D$, for every possible triplet $(a,p,n)$ in the training set, $X$, effectively imposing a relative distance constraint:
\begin{align*}
\begin{split}
D\left(f_\theta(x_a), f_\theta(x_p)\right) \; \leq \; D\left(f_\theta(x_a), f_\theta(x_n)\right)
\\ \quad \forall \; (x_a,x_p,x_n) \in X
\end{split}
\end{align*}
A distance function $D(e_1, e_2)\! : \mathbb{R}^D \times \mathbb{R}^D \rightarrow \mathbb{R}_{+}$, defined on the embedding space (Euclidean or cosine distance are frequently used) can then be used as a measure of semantic similarity of the data that embedding vectors $e_1$ and $e_2$ represents.
This motivated the triplet loss presented in \cite{Schroff2015FaceNet:Clustering}, which is the most commonly used variant:
\begin{align*}
\begin{split}
& L(\theta; X) = \\
& \sum_{(x_a, x_p, x_n) \in X}
\big[
D(f_\theta(x_a), f_\theta(x_p)) - D(f_\theta(x_a), f_\theta(x_n)) + m
\big]^+
\end{split}
\end{align*}
Where $[x]^+\! :=\! \max(x, 0)$ and $m$ is an arbitrary positive scalar that defines the margin size. This loss function has a \emph{hard margin}: triplets with the positive example embedded significantly closer to the anchor than the negative example do not contribute to the loss. This triplet loss allows different instances of a class to lie within a local neighbourhood of the embedding space (instead of being driven to a single point) and encourages large gaps between the neighbourhoods of different classes.
A significant drawback of the triplet loss is that it can be difficult to optimise. After some training, the model learns to map most trivial triplets in a way that they fall within the margin and stop contributing to the loss, significantly slowing down convergence. Consequently, it is important to mine for `hard' triplets that violate the hard-margin distance constraint and thereby ensure convergence (see \cite{Schroff2015FaceNet:Clustering} for more detail).
We adopt \emph{batch-hard triplet loss} proposed by Hermans et al.~\cite{Hermans2017InRe-Identification} that samples $K$ images from each of $P$ individuals, stacking them into a batch of size $PK$, and uses each image as an anchor, selecting only the hardest possible triplet for each anchor to contribute to the loss.
The results presented in \cite{Hermans2017InRe-Identification} provide evidence that this hard triplet mining over a small batch, (such as $P\! =\! 21$, $K\! =\! 4$) can have the same effect on optimisation as soft triplet mining over a medium sized batch, such as that performed by FaceNet \cite{Schroff2015FaceNet:Clustering}, but is much more efficient. A key advantage is that the small batches can fit in GPU memory, allowing for both, hard triplet mining and training using stochastic gradient descent to be performed on a single machine.
Following the original work, we also replaced the hard margin with a \emph{soft margin}, by changing the hinge function, $[x]^+$, to it's smooth approximation: the softplus function $\zeta(x) = \log(1+e^x)$. Soft margin has been empirically shown to work better than hard margin over a range of different values of $m$ and it's use also removes one hyperparameter. Our loss function can be expressed as:
\begin{align*}\label{eq:loss_bh}
L(\theta; X) = \overbrace{\sum\limits_{i=1}^{P} \sum\limits_{a=1}^{K}}^{\textnormal{all anchors}}
\zeta
\Big(& \hspace*{-1pt} \overbrace{\max\limits_{p=1 \dots K} \hspace*{-5pt} D\left(f_\theta(x^i_a), f_\theta(x^i_p)\right)}^{\textnormal{hardest positive}} \\
& - \hspace*{-5pt} \underbrace{\min\limits_{\substack{j=1 \dots P \\ n=1 \dots K \\ j \neq i}} \hspace*{-5pt} D\left(f_\theta(x^i_a), f_\theta(x^j_n)\right)}_{\textnormal{hardest negative}} \Big),\nonumber
\end{align*}
\subsection{Backbone Network Architecture}
He et al. \cite{He2016DeepRecognition} present a family of convolutional neural networks that use skip layer connections to help alleviate the vanishing gradients problem; thus, allowing very deep neural networks to be trained. While deeper and wider networks with more expressive power may achieve better performance in classification, they also have a higher memory footprint, which limits the size of the mini-batch that can fit in GPU memory. Larger batch size, however, can lead to better optimisation of the triplet loss, as it allows harder triplets to be found, so there is a trade-off between model expressiveness and triplet loss optimisation. We posited that the ResNet-50 \cite{He2016DeepRecognition}, a deep residual network with 50 layers, offered a good trade-off, and used it as the backbone architecture for our experiments.
Following the work of Hermans et al. \cite{Hermans2017InRe-Identification}, we add a 1024-unit fully connected layer with the rectified linear unit (ReLU) activation function and batch normalisation \cite{Ioffe2015BatchShift}, followed by a 128 unit fully connected layer (with no activation) as the output. Projecting images onto a relatively low dimensional (128D) space has two key advantages: it helps avert the curse of dimensionality \cite{Hastie2009TheLearning} and it speeds up computation of pairwise distances on large datasets.
\subsection{Training}
All images were resized to $224 \times 224$ pixels. We used $P=21$ and $K=4$ for batch-hard triplet loss and stopped training after 2000 batches. We used the Adam optimiser \cite{Kingma2015Adam:Optimization} with the TensorFlow default hyper-parameters ($\beta_1=0.9$, $\beta_2=0.999$ $\epsilon=10^{-8}$) to train the network. We started training with a learning rate of $3\times10^{-4}$ for 640 batches and then exponentially decayed the learning rate. Euclidean distance was used for $D(e_1, e_2)$. All training was performed on an NVIDIA GTX-1080ti GPU.
Previous research has shown that initialising a network with parameters learned from another task can improve generalisation relative to a random initialisation \cite{Yosinski2014HowNetworks}. This has been key to many of the successes of DL applied to image recognition in recent years, particularly on smaller datasets such as ours.
We attempted to transfer learning by initialising the network weights from models pre-trained on other tasks: (i) an image classification task trained on ImageNet dataset and (ii) a person re-id task trained on Market-1501 dataset. In the second scenario, we initialised from a pre-trained model using not only the Resnet-50 weights, but also the fully connected layers that performed the embedding mapping. We considered whether a network pre-trained with triplet loss as a Euclidean embedding function may transfer better for a metric learning task on another (larger) dataset than a network pre-trained as a classifier.
\subsection{Data Augmentation}
We attempted to reduce over-fitting by performing standard data augmentation. Image hue was adjusted by a random value between 0 and 0.1 and saturation was adjusted by a factor between 0.9 and 1.1 with both values sampled from a uniform distribution. We also randomly rotated each image in the batch by an angle in degrees sampled from a truncated normal distribution with $\mu=0$ and $\sigma=5$ and maximum angle of 10.
All training-time augmentation was performed online and no test-time augmentation was performed.
\section{EVALUATION}
Scientific studies that use photo-id depend on the accuracy of the method. Computer vision algorithms, such as the one proposed here, can be used to assist researchers in their cataloguing task, but the final verification must be performed by a human. So the problem can be formulated as image retrieval: given a query image of an unknown individual, an algorithm matches it to existing images in the catalogue of known individuals and returns the top $k$ identities, ranked by similarity; a human can then assess these and pick the correct match. A good algorithm will have a high chance of returning the correct identity as the most likely (top-1) result; however, even having the correct identity in the top 5 results will still significantly reduce the number of comparisons a human would need to perform.
To evaluate the ranking performance of our model, we split the evaluation/test set (described in \ref{sec:cv}) into a query image and a gallery set. We ranked gallery images by similarity to the query image and computed top-$k$ accuracy (for $k\in\{1,5\}$) and mean average precision (mAP) across all the query/gallery set combinations.
Many of the dolphins in our dataset have multiple images of them taken on the same day. These images have very strong correlations (due to the same camera being used under similar lighting and weather conditions) which can lead to artificially inflated performance figures. To mitigate this, we excluded from the gallery set, all images of the query individual that were taken on the same day as the query image. Additionally, we did not perform multiple queries from the same day/individual combination, instead we randomly selected a single query image from all images of the same individual taken on the same day.
\subsection{Data}
Results are based on 3544 cropped and labelled images from 185 individual dolphins. Images were collected over multiple years (between 2002 and 2014) under a wide variety of weather/lighting conditions. No alignment of any kind was performed at any stage.
\label{sec:cv}
\subsection{Cross-validation}
We ran 5-fold cross-validation after the dataset was sorted by dolphin identity and ordered using the number of images-per-dolphin. Each fold was created by systematically selecting every $5^{th}$ dolphin (with a different starting position). As a result, each fold consisted of 37 individuals with approximately the same distribution of images-per-dolphin. One fold was used as the evaluation set, with the remaining four as the training set.
We computed the mean and standard error for every metric across each fold being used as the evaluation set.
\subsection{Distractors}
To show how performance metrics scaled to large catalogues containing hundreds or even thousands of unique individuals, we progressively added distractor images to the gallery. The gallery set for each query contained, on average, 700 images and we added up to 1200 distractors, for a maxmimum total of 1900 images.
\subsection{Training set size}
Knowing how the size of the training set affects performance is useful because it gives an idea of how much adding more labelled dolphins will improve performance. It may also shed light on the amount of labelled data required to train a useful embedding for new species. We picked a single fold of 37 individuals to be a fixed evaluation set for this investigation and repeatedly trained our model on random subsets of dolphins from the remaining four folds.
We performed two experiments using the ResNet-50 model pre-trained on ImageNet with data augmentation: (i) we systematically reduced the number of individuals in the training set and (ii) we used all 148 individuals, but systematically reduced the maximum number of images per individual.
\section*{Results \& Discussion}
We visualised and examined the clustering of embedding vectors using t-SNE \cite{Maaten2008VisualizingT-SNE}. Tight clusters, corresponding closely to dolphin identity, could be observed in the training set. However, the evaluation set (pictured in Fig. \ref{fig:t-sne}) exhibited (relatively) less correspondence between clusters and identities, suggesting that the model may have been overfitting. The model seem to be able to extract discriminative features that generalise to new identities, but a better augmentation strategy (such as incorporating perspective or affine transformation) may be required to reduce overfitting even further.
\begin{table}[!h]
\caption{5-fold cross-validation results. Mean $\pm$ SE}
\label{tab:results}
\centering
\begin{tabular}{|l|l|l|l|}
\hline
& mAP & Top 1 & Top 5 \\ \hline
Market-1501 init & $64.9\pm1$ & $80.8 \pm 4$ & $90.1 \pm 1$ \\ \hline
ImageNet init & $76 \pm 1$ & $85.2 \pm 2$ & $92.9 \pm 2$ \\ \hline
ImageNet + Augment & $80.8 \pm 1$ & $90.6 \pm 2$ & $93.6 \pm 1$ \\ \hline
\end{tabular}
\end{table}
Table \ref{tab:results} shows results for ResNet-50 pre-trained on ImageNet, and ResNet-50 pre-trained on a person re-id task on Market-1501 dataset with triplet loss. Both performed better than completely random initialisation. ImageNet initialisation achieved significantly better performance than Market-1501 (76 vs 65 mAP), even though it was trained as a softmax classifier with cross-entropy loss and fully connected embedding mapping layers were initialised randomly, in contrast to all layers initialised using a model pre-trained using triplet-loss on Market-1501. Better performance of ImageNet initialisation over random was expected, as it contains many visually similar images to our data, such as whales and sharks---so ImageNet features should be useful for dolphin recognition tasks. However, it was surprising that Market-1501 trained model did not perform as well, considering that it was itself initialised with ImageNet-trained weights, prior to being trained on Market-1501 with triplet-loss. We hypothesise that catastrophic forgetting plays a role in this performance degradation, but investigating it further was outside the scope of this work.
A model, initialised from ImageNet, and trained with data augmentation gives us the best results for every metric: $80.8\pm1$ mAP, $90.6\pm2$ percent top-1 accuracy and $93.6\pm1$ percent top-5 accuracy. Fig \ref{fig:fin-rankings} shows a random selection of query images and their returned results.
In the presence of distractors, we observe an approximately linear degradation in performance (see Fig. \ref{fig:distractors}). The performance of this model drops to $64.8\pm2$ mAP, $80\pm2$ top-1 and $91\pm2$ top-5 in the presence of 1200 distractors. A model with such accuracy would still be very useful in practice: being able to pick the correct match out of a list of 5 individuals (instead of a list of 1237) in 9 out of 10 times would be a great improvement for the photo-id workflow.
\begin{figure}
\centering
\includegraphics[width=\columnwidth]{images/distractors_different_runs.jpg}
\caption{Performance vs number of distractor images in the evaluation set. The shaded area represents the standard error calculated across different folds.
Note that the validation set before adding distractors had an average size of around 700.}
\label{fig:distractors}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=\columnwidth]{images/dolphin_day_query_excluded_perf_size_curve.jpg}
\caption{Performance vs number of individual dolphins in the training set.}
\label{fig:reduced_individuals_training_set}
\end{figure}
\begin{figure}
\centering
\vspace*{-0.5cm}
\includegraphics[width=\columnwidth]{images/images_per_pid_curve.jpg}
\caption{Performance vs mean number of images per individual in training set.}
\label{fig:reduced_images_training_set}
\end{figure}
\begin{figure*}[t!]
\centering
\vspace*{-.3cm}
\includegraphics[width=0.66\textwidth]{images/rankings_with_exclusion.jpg}
\vspace*{-.2cm}
\caption{A random sample of similarity rankings. Each column contains the query image at the top and returned results below it. Images are ranked by decreasing similarity top to bottom. A green border indicates correct match and red indicates a mismatch.}
\vspace*{-.2cm}
\label{fig:fin-rankings}
\end{figure*}
Fig. \ref{fig:reduced_individuals_training_set} shows the result of varying the number of individuals in the training set. It appears that adding more individuals to the training set improves generalisation albeit with diminishing returns. We can still achieve reasonable top-5 accuracy of ~90 percent with only 60 individuals.
Fig. \ref{fig:reduced_images_training_set} shows the result of capping the maximum number of images per individual in the training set. The results appear to have high variance, due to our method of selecting a random subset of images that are used in the training set for each dolphin, instead of using a random subset of the training set with larger cap. However, the general trend is visible; we need at least 8--10 images per individual to get reasonable top-5 performance ($>$80\% accuracy).
We suspect diminishing improvements are exacerbated by the presence of multiple images of the same dolphin captured during the same encounter (same day) in the training set and believe that including more images captured under different conditions would improve the results even further.
We also hypothesise that there is a cross-dependence between number of individuals and number of images per individual, however, we did not have the resources to verify this claim, but will attempt this in the future.
\section{CONCLUSIONS}
Our approach of using a deep convolutional network to learn an embedding provided classification success rates that were substantially higher than attempts that utilised hand-engineered features of common dolphin images \cite{Pawley2018ExaminingDelphinids, Gilman2016Computer-assistedPigmentations}. Moreover, the previous attempts also required considerable pre-processing of the images, including manual segmentation of the fin from the background and alignment of each fin to a canonical exemplar using the ICP algorithm \cite{Gilman2013DolphinPhoto-identification}. The use of an embedding naturally generalises to images of new dolphins, since it makes no \textit{a priori} assumption that all classses are known. Future work aims to generalise the model to include other dolphin species (e.g. bottlenose dolphins) and produce an application that will ease the ecologists' catalogue workflow.
| {'timestamp': '2019-01-14T02:21:37', 'yymm': '1901', 'arxiv_id': '1901.03662', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03662'} | arxiv |
\section{Introduction}\label{sec:ld_reals}
In this paper, we study communication in presence of a power-constrained adversary.
This is a point-to-point communication problem where a sender wants to communicate a message of $ nR $ bits $ m\in\{0,1\}^{nR} $ to a reciever through a real-valued channel corrupted by a malicious \emph{omniscient} adversary. The transmitter uses $ n $ channel uses to send a signal $ \vx\in\bR^n $ across the channel.
The adversary can corrupt the transmitted signal by adding a noise vector $ \vs\in\bR^n $, which is allowed to be any noncausal function of the transmitted signal and the transmission protocol. The sender and the adversary have power constraints of $ P $ and $ N $ respectively, i.e., we impose the restriction that $ \Vert\vx\Vert\leq \sqrt{nP} $ and $ \Vert\vs\Vert\leq \sqrt{nN} $. The goal is to design a transmission scheme that provides a high data rate $ R $ while ensuring an arbitrarily low probability of error of decoding at the receiver. This problem turns out to be equivalent to the sphere packing problem, which asks for the maximum $ R $ such that there is a set of $ 2^{nR} $ points within a ball of radius $ \sqrt{nP} $ such that every pair of points is spaced $ 2\sqrt{nN} $ apart. Finding the capacity of this channel remains an open problem, but nonmatching upper and lower bounds are known~\cite{kabatiansky-1978, blachman-1962}.
We study a slight variant of this problem,
where instead of uniquely decoding the transmitted message $ m $, the receiver attempts to recover a list of $ L $ codewords with the guarantee that the transmitted codeword lies in this list. This is called the list decoding problem, also known as multiple packing, which is well studied at least in the context of binary adversarial channels~\cite{guruswami-lncs}. In this paper, we attempt to systematically study upper and lower bounds on achievable list sizes for various ensembles of random codes for the real channel.
List decoding for adversarial channels is an interesting problem in its own right, but can also be a very useful tool in several other problems. For instance, Langberg~\cite{langberg-focs2004} showed that if there exists a coding scheme that achieves a list size that is at most polynomial in the blocklength $ n $, then even a small amount of shared secret key (just about $ \Theta(\log n) $ bits kept secret from the adversary) between the sender-receiver pair suffices to ensure that the true message can be uniquely decoded by the receiver. List decoding can also serve as a useful proof technique for studying other adversarial channels~\cite{dey-sufficiently-2015,zhang-quadratic-arxiv}.
For the quadratically constrained adversarial channel, it is known that if the transmission rate $ R $ is greater than $ \frac{1}{2}\log\frac{P}{N} $, then no coding scheme can achieve subexponential (in $ n $) list sizes. On the other hand, it is also known that random spherical codes of rate $ R<\frac{1}{2}\log\frac{P}{N} $ can achieve constant (in $ n $) list sizes. We can therefore call $ \frac{1}{2}\log\frac{P}{N} $ to be the \emph{list decoding capacity} of this channel. Once this is established, it is of interest to find the least possible list sizes that are achievable as a function of $ \delta \coloneqq \frac{1}{2}\log\frac{P}{N}-R $. In this paper, we will show that it suffices to only study spherical codes, where all codewords $ \vx $ have norm $ \Vert\vx \Vert = \sqrt{nP} $. It is known that random spherical codes have list sizes upper bounded by $ \cO(\frac{1}{\delta}\log\frac{1}{\delta}) $. We show that ``typical'' random spherical codes have list sizes which grow as $ \Omega(1/\delta) $.
In an attempt to devise more ``practical'' coding schemes that achieve the list decoding capacity, we look for structured codes that can guarantee small list sizes. Specifically, we investigate a class of nested lattice codes and find lower bounds on the list size. We show that random nested Construction-A lattices achieve list sizes $ 2^{\cO(\frac{1}{\delta}\log\frac{1}{\delta})} $. To the best of our knowledge, this is the first such result which shows that lattice codes can achieve constant list sizes. However, the list sizes are exponentially worse than the list sizes for random spherical codes. We conjecture that there exist lattice codes that achieve list sizes of $ \cO(\frac{1}{\delta}\log\frac{1}{\delta}) $ and provide some heuristic calculations which suggest this.
We then relax the power constraint of the transmitter and study the list decodability of infinite constellations. Infinite constellations (ICs) generalize lattices, and to the best of our knowledge, were first studied systematically in the context of channel coding by Poltyrev~\cite{poltyrev1994coding}. Poltyrev showed that there exist ICs that are good codes for the additive white Gaussian noise channel. In this paper, we introduce an ensemble of periodic infinite constellations and study upper and lower bounds on the list size of typical ICs. A list decodable code for the power-constrained (for both the transmitter and the adversary) adversarial channel can be obtained by taking the intersection of the IC with a ball of radius $ \sqrt{nP} $. We show that the code obtained by taking this intersection achieves list size $ \cO(\frac{1}{\delta}\log\frac{1}{\delta}) $.
\section{Overview of our results}\label{sec:results}
Let us now formally describe the problem.
The sender encodes a message $ \bfm\in \{0,1\}^{nR} $ into a codeword $ \vx $ in $ \bR^n $ which is intended for the receiver. The sender has a transmit power constraint, which is modeled by demanding that the $ L^2 $ norm $ \Vert\vx\Vert $ must be less than $ \sqrt{nP} $ for some $ P>0 $. The transmission is observed noncausally by an adversary who corrupts the transmitted vector by adding a noise vector $ \vs $ to $ \vx $. The adversary has a power constraint of $ nN $, which means that $ \Vert\vs\Vert\leq \sqrt{nN} $ for some $ N>0 $. However, $ \vs $ is allowed to otherwise be any function of $ \vx $ and the codebook. The receiver obtains $ \vy=\vx+\vs $.
The list decoder takes $ \vy $ as input and outputs a list of $ L $ messages, and an error is said to have occurred if the true message $ \bfm $ is not in this list.
\begin{definition}[List decodability over $\bR$]
Let $ P,N\in \bR_{>0} $ and $ L\in\bZ_{>0} $.
We say that a code $ \cC\subset \bR^n $ is $ (P,N,L) $-list decodable if
\begin{itemize}
\item The code satisfies a maximum power constraint of $ P $, i.e., we have $ \Vert \vx \Vert_2^2\leq nP $ for all $ \vx\in\cC $.
\item An omniscient adversary with power $ N $ cannot enforce a list size greater than $ L $, i.e., for all $ \vx\in\cC $ and all $ \vs\in \cB(0,\sqrt{nN}) $, we have $ |\cC\cap \cB(\vx+\vs,\sqrt{nN})|\leq L $.
\end{itemize}
The rate of $ \cC $ is defined as $ R(\cC)\coloneqq \frac{1}{n}\log |\cC| $.
A rate $ R\in\bR $ is said to be achievable for $ (P,N,L) $ list decoding if for all sufficiently large $ n $, there exist codes $ \cC\subset \bR^n $ having rate $ R(\cC)\geq R $ that are $ (P,N,L) $ list decodable.
\label{defn:PNLlistdecoding}
\end{definition}
In the definition above, we do not prohibit $ L $ from being a function of $ n $. In many applications, it suffices to have list sizes that grow as $ \cO(n^{\gamma}) $ for a suitably small $ \gamma $. However, in this paper, we aim for constant list sizes.
\begin{definition}[List decoding capacity]
Fix any $ P,N>0 $.
We say that $ C(P,N) $ is the list decoding capacity if for every $ \delta>0 $, there exists an $ \gamma>0 $ such that $ C(P,N)-\delta $ is achievable for $ (P,N,\cO(n^{\gamma})) $ list decoding, and for every $ \delta>0 $, there exist no codes of rate $ C(P,N)+\delta $ which are $ (P,N,2^{o(n)}) $-list decodable.
\end{definition}
The following result is folklore, and a proof can be found in~\cite{zhang-quadratic-arxiv}.
\begin{theorem}[Folklore]
For any $ P,N>0 $,
\[
C(P,N) = \left[ \frac{1}{2}\log\frac{P}{N} \right]^+.
\]
\end{theorem}
Again, we are in search of structured ensembles of codes achieving ideally the same list decoding performance as random codes. This problem is not as extensively studied as in the finite field case.
The class of problems that we are interested in is the following:
\begin{itemize}
\item Suppose that we desire a target rate $ R=C(P,N)-\delta $, for some small $ \delta>0 $. Then what is the smallest list size $ L $ that we can achieve? Specifically, we are interested in the dependence of $ L $ on $ \delta $.
\item What are the fundamental lower bounds on the list size for a fixed $ \delta $?
\item If we restrict ourselves to structured codes, e.g., nested lattice codes, then what list sizes are achievable?
\end{itemize}
It was shown in~\cite{zhang-quadratic-arxiv} that $ \cO\left(\frac{1}{\delta}\log\frac{1}{\delta}\right) $ list sizes are achievable using random spherical codes.
If we define $ \cS^{n-1}(0,\sqrt{nP})\coloneqq \{ \vx\in\bR^n:\Vert\vx\Vert=\sqrt{nP} \} $ to be the $ (n-1) $-dimensional sphere of radius $ \sqrt{nP} $, then
\begin{lemma}[\cite{zhang-quadratic-arxiv}]
Let $ P>N>0 $. Fix any $ \delta>0 $, and define $ R\coloneqq C(P,N)-\delta $. Let $ \cC $ be the random codebook obtained by choosing the codewords independently and uniformly over $ \cS^{n-1}(0,\sqrt{nP}) $, then
\[
\Pr\left[\cC \text{ is not }\left(P,N,\cO\left(\frac{1}{\delta}\log\frac{1}{\delta}\right)\right)\text{-list decodable}\right] \leq 2^{-\Omega(n)}.
\]
\label{lemma:achievablelistsize_spherical}
\end{lemma}
Our contributions for $ (P,N,L) $ list decoding can be summarized as follows:
\begin{itemize}
\item We derive lower bounds on the list size of random spherical codes. We show that if $ R=C(P,N)-\delta $, then $ L $ grows as $ \Omega(1/\delta) $ with high probability.
\item We then investigate the achievable list sizes for random nested lattice codes, and show that $ R=C(P,N)-\delta $ and $ L=2^{\cO\left(\frac{1}{\delta}\log\frac{1}{\delta}\right)} $ is achievable using Construction-A lattices.
\item Based on a known conjecture for random lattices, we provide some heuristic calculations which suggest that lattice codes might achieve list sizes that grow as $ \cO(\mathrm{poly}(1/\delta)) $.
\end{itemize}
We then perform a systematic study of list decoding infinite constellations in $ \bR^n $. An infinite constellation is defined as a countable subset of $ \bR^n $.
\begin{definition}\label{def:ic}
An infinite constellation $ \cC \subset \bR^n$ is said to be $ (N,L) $-list decodable if for every $ \vy\in\bR^n $, we have
\[
|\cC\cap \cB(\vy,\sqrt{nN})|\leq L.
\]
The density of the constellation is defined as
\[ \Delta(\cC)\coloneqq \limsup_{a\to\infty}\frac{|\cC\cap [0,a]^n|}{a^n}. \]
The normalized logarithmic density, defined as $ \frac{\log\Delta(\cC)}{n} $ is a measure of the ``rate'' of the infinite constellation. The effective volume of $ \cC $ is defined as $ V(\cC)=1/\Delta(\cC) $, and the effective radius
$\reff(\cC)$ is defined as the radius of a ball having volume equal to $ V(\cC) $.
\end{definition}
Clearly, every lattice is an infinite constellation. We show that if $ \Lf $ is a random Construction-A lattice with $ \reff(\Lf)\geq \sqrt{nN}2^{\delta} $, then $ \Lf $ is $ (N,2^{\cO(\frac{1}{\delta}\log\frac{1}{\delta})}) $ list decodable. We also introduce a class of random periodic infinite constellations $ \cC $ with $ \reff(\cC)= \sqrt{nN}2^{\delta} $ which have list sizes that grow as $ \cO(\frac{1}{\delta}\log\frac{1}{\delta}) $.
Additionally, we show a matching lower bound on the list size for these random infinite constellations.
\begin{remark}
Definition~\ref{defn:PNLlistdecoding} satisfies the requirements for list decoding in presence of an omniscient adversary with a maximum probability of error constraint. The reason being that we want small list sizes for every $ \vx\in\cC $ and every attack vector $ \vs\in\cB(0,\sqrt{nN}) $. For $ L=1 $, our problem reduces to one of packing nonintersecting balls of radius $ \sqrt{nN} $ such that their centers lie within $ \cB(0,\sqrt{nP}) $.
We could relax the problem by assuming that messages are picked uniformly at random and the adversary knows only the codebook but not the transmitted codeword. This model of an oblivious adversary was studied by Hosseinigoki and Kosut~\cite{hosseinigoki-kosut-2018-oblivious-gaussian-avc-ld} who showed that the list decoding capacity for this problem is $ \frac{1}{2}\log(1+P/N)\one{L>N/P} $.
An intermediate model that lies between the omniscient and oblivious list decoding problems is that of a ``myopic'' adversary who sees a noncausal noisy version of the transmitted codeword. This problem was studied in~\cite{zhang-quadratic-arxiv}.
\end{remark}
\section{Organization of the paper}\label{sec:org}
In Sec. \ref{sec:finitefield_prior_work}, we survey the literature of list decoding over finite fields. In Sec. \ref{sec:results}, we formally define the problem and give a brief overview of our results. Notation and prerequisite facts and lemmas are listed in Sec \ref{sec:notation} and Sec. \ref{sec:prelim}, respectively. A table of frequently used notation can be found in Appendix \ref{sec:tab_notation}. A lower bound on list sizes of random spherical codes is provided in Sec. \ref{sec:lb_ls_spherical} while some of the calculations are deferred to Appendix \ref{sec:calc_prop_lbound_randomspherical}. In Sec. \ref{sec:ld_constr_a}, we turn to study list decodability of random nested Construction-A lattice codes. For the benefit of readers who are not familiar with lattices, a quick primer is provided in Appendix \ref{sec:primer_lattices}. We define infinite constellations in Sec. \ref{sec:ic}, and give matching upper and lower bounds on list sizes of an ensemble of regular infinite constellations in Sec. \ref{sec:regular_ic}. Finally we give some heuristic results on the list sizes achieved by lattice codes. We recall the Haar distribution on the space of lattices in Sec. \ref{sec:haar_meas_on_lattices}, then introduce two important integration formulas by Siegel and Rogers in Sec. \ref{sec:siegel_rogers_avg_formulas} and their improvements in Sec. \ref{sec:improvement_on_rogers}. We prove a list size lower bound conditioned on a conjecture in Sec. \ref{sec:cond_ld_haar}. We conclude the paper in Sec. \ref{sec:rk_open_prob} with several open problems.
\section{A survey of list decoding over finite fields}\label{sec:finitefield_prior_work}
Consider the following question. Given a prime power $ q $ and $ R\in (0,1) $, how do we construct a subset $\cC$ of $\bF_q^n$ of size $q^{nR}$ such that the points in $ \cC $ are as far apart as possible? This question is motivated by the prototypical communication model studied in coding theory under different notions of distance and points being ``far apart''. Consider a transmitter who wishes to convey any $nR$ symbols of a $q$-ary message to a receiver through a noisy channel. To get the information through, the transmitter can add some redundancy and send a coded version of the message through the channel to protect against the noise. Classical coding theory is dedicated to the study of the situation where the codeword is a length-$n$ vector over $\bF_q$ and the adversary who has access to the transmitted codeword is allowed to change any $np$ symbols where $0<p<1$ is a constant. The receiver is then required to figure out the original message given such a maliciously corrupted word. For fixed $q$, $n$ and $p$, the goal is to design an as-large-as-possible set of codewords so as to get as-much-as-possible information through in $n$ uses of the channel, while ensuring the receiver can decode the message correctly under any legitimate attack by the adversary. We are interested in the asymptotic behaviour of the throughput in the blocklength $n$.
It is not hard to see that this question is equivalent to the question of determining the optimal density of packing Hamming ball of radius $np$ in $\bF_q^n$. The best possible rate $R$ is widely open for several decades. People thus turn to a relaxation. Instead of asking the receiver to output a unique correct message, we allow him to output a list of $L$ messages which is guaranteed to contain the correct one. There is a tradeoff between the three quantities $R$, $p$ and $L$. The question is nontrivial only when $L$ is required to be small, otherwise outputting all $q^{nR}$ messages is always a valid scheme. This is called the list decoding problem, sometimes also referred to as multiple packing where balls are allowed to overlap but there are no more than $L$ balls on top of any point in the space. Let $ d_H $ denote the Hamming distance and $ \bham^n(\vy,np) = \{ \vx\in\bF_q^n: d_H(\vy,\vx)\leq np \} $ denote the Hamming ball of radius $ np $ centered at $ \vy $.
\begin{definition}[List decodability over $\bF_q$]\label{def:list_dec_fq}
A code $\cC\subseteq\bF_q^n$ is said to be $(p,L)$-list decodable if for any $\vy\in\bF_q^n$, $\card{\cC\cap\bham^n(\vy,np)}\le L$.
\end{definition}
It turns out that such a relaxation indeed gains us something. In this case, we entirely understand the information-theoretic limit of list decoding. It is a folklore that
\begin{theorem}[List decoding capacity over $\bF_q$]\label{thm:list_dec_cap_fq}
For any small constant $\delta>0$, any $0<p<1-1/q$ and any $n$ large enough, there exists a $(p,1/\delta)$-list decodable code $\cC$ of blocklength $n$ and rate $1-H_q(p)-\delta$; on the other hand, any code of rate $1-H_q(p)+\delta$ is $(p,q^{\Omega(n\delta)})$-list decodable.
\end{theorem}
The sharp threshold $1-H_q(p)$ around which the list size exhibits a phase transition is known as the list decoding capacity, denoted $C$. The stunning point of the above folklore theorem is that the list size can be made down to a constant, independently of $n$, while the list decoding capacity is still achieved.
Throughout the paper, we use $\delta$ to denote the gap between the rate that the code is operating at and the list decoding capacity, i.e., $R=C-\delta$.
\subsection{Known results for list decoding over finite fields}\label{sec:ld_finite}
Let $\tau$ denote the gap between the adversary's power and the list decoding radius $1-1/q$, i.e., $p=1-1/q-\tau$.
First note that expressing the rate as a function of the list size is equivalent to expressing the list size as a function of the gap to capacity. Lower (upper) bounds on the rate naturally translate to upper (lower) bounds on the list size and vice versa. Indeed, for any increasing function $f$, claiming that the rate $R\ge C-\frac{1}{f(L)}$ can be achieved by a $(p,L)$-list decodable code is equivalent to claiming the existence of a rate $R=C-\delta$ code whose list size is at most $L\le f^{-1}(1/\delta)$ under an adversary with power budget $p$. We will state prior results and our results only in the second form.
The aforementioned list decoding capacity theorem \ref{thm:list_dec_cap_fq} is obtained via standard random coding argument. Indeed, it is well-known and easy to show that the list size of a random code (of which each codeword is sampled uniformly and independently) of rate $1-H_q(p)-\delta$ against a power-$p$ adversary is at most $1/\delta$ with high probability (whp). It also turns out \cite{guruswami2013combinatorial, li-wootters-2018-ld-rand-lin} that $1/\delta$ is the correct scaling for the list size of a random code. Namely, there is an essentially matching\footnote{Actually, Li and Wootters \cite{li-wootters-2018-ld-rand-lin} showed that for any constant $\gamma>0$, the list size of a random code is bounded from \emph{below} by $\frac{1-\gamma}{\delta}$ whp.} lower bound $1/\delta$ via second moment method.
Note that $1-H_q(p)$ is also equal to the Shannon's channel capacity of a Binary Symmetric Channel with crossover probability $p$ (BSC($p$)). This seems to be a general phenomenon over finite fields. However, as we will elaborate in the subsequent sections, this is not the case over the reals.
The above list decoding capacity theorem pinpointed the information-theoretic limit of list decoding and is attained by random codes. In computer science, we are generally interested in finding structured or even explicit ensembles of objects with the same asymptotic behavior as uniformly random ensembles. In the setting of list decoding, given the threshold up to which constant-in-$n$ list size is possible, the ultimate goal is to construct explicit\footnote{Rigorously, there are two commonly used definitions of explicitness in the literature. To give an explicit linear code, it suffices to
\begin{enumerate}
\item construct its generator matrix in $\poly(n)$ time deterministically; or
\item compute each entry of its generator matrix in $\poly\log(n)$ time deterministically.
\end{enumerate}
} codes with the same list decoding performance as random codes. As an intermediate step which is also interesting in its own right, we aim to reduce the amount of randomness used in the construction and shoot for more ``structured" ensembles of codes. A natural candidate is linear codes. However, sadly, even if we restrict our attention to linear codes, its list decodability is still not completely understood. Specifically, a random linear code over $\bF_q$ of rate $R$ refers to a random subspace of $\bF_q^n$ uniformly sampled from all subspaces of a fixed dimension $nR$.
\begin{conjecture}\label{conj:list-dec-rand-lin}
For any $\delta>0$, prime power $q$ and $0<p<1-1/q$, a random linear code of rate $1-H_q(p)-\delta$ over $\bF_q$ is $(p,1/\delta)$-list decodable whp.
\end{conjecture}
The conjecture is known to be true over $\bF_2$ \cite{li-wootters-2018-ld-rand-lin}. However, it is open in other cases
if we insist the universal constant in the list size to be one. In particular, the conjecture becomes more challenging when we work in large fields and in the high-noise low-rate regime. For instance, consider the following scenario, the adversary's power $p$ is so large that close to $1-1/q$, say $p=1-1/q-\tau$ for a very small $\tau>0$ which can even scale with $\delta$. Then by the continuity of the entropy function, the capacity is very low and can be a vanishing function of $\delta$ as $\delta\to0$. In this case, many existing list decodability results for random linear codes degenerate in the sense that the list size blows up as a function of $\delta\to0$. Another extreme case which is tricky to handle is when the field size $q$ is very large and can be an increasing function of $\delta\to0$. In this case, many techniques in the literature also fails.
From now on, when we talk about large $q$ (i.e., the large field size regime), we refer to $q$ which can scale with $1/\delta$ or $n$; when we talk about large $p$ or small rate (i.e., the high-noise low-rate regime), we refer to $\tau$ which can be a function of $\delta$.
Now we survey a (potentially non-exhaustive) list of work regarding the combinatorial list decoding performance of random linear codes.
\begin{enumerate}
\item It is a folklore that a random linear code of rate $1-H_q(p)-\delta$ is $(p,q^{\cO(1/\delta)})$-list decodable whp. (See, e.g., \cite{guruswami-hastad-kopparty-2010-ld-rand-lin} for a proof sketch.)
\item Guruswami, H\aa stad, Sudan and Zuckerman \cite{ghsz-2002} showed the \emph{existence} of a \emph{binary} linear code of rate $1-H(p)-\delta$ which is $(p,1/\delta)$-list decodable. They defined a potential function as a witness of non-list-decodability and analyzed its evolving dynamics during the process of sampling a basis of the random linear code.
\item Guruswami, H\aa stad and Kopparty \cite{guruswami-hastad-kopparty-2010-ld-rand-lin} showed that a random linear code of rate $1-H_q(p)-\delta$ is $(p,C_{p,q}/\delta)$-list decodable whp. However $C_{p,q}$ blows up when $p$ gets close to $1-1/q$ or $q$ is large. They used Ramsey-theoretic tools to control low-rank lists. As for high-rank lists, naive bounds suffice.
\item Cheraghchi, Guruswami and Velingker \cite{cheraghchi-guruswami-velingker-2013-rip-ld-rand-lin} showed that a random linear code of rate $\Omega\paren{\frac{\tau^2}{\log^3(q/\tau)\log q}}$ is $((1-1/q)(1-\tau),\cO(1/\tau^2))$-list decodable with \emph{constant} probability. These parameters are optimal in the low-rate regime \emph{up to polylog factors in $1/\tau$ and $q$}. In their paper, ideas such as average-radius relaxation, connections to restricted isometry property (RIP) and chaining method were brought into view. These techniques were later extensively explored and significantly developed.
\item Wootters \cite{wootters-2013-ld-rand-lin-low-rate} showed that a random linear code of rate $\Omega(\tau^2/\log q)$ is $((1-1/q)(1-\tau),\cO(1/\tau^2))$-list decodable whp. This is an improvement on \cite{cheraghchi-guruswami-velingker-2013-rip-ld-rand-lin} via similar techniques and also fills in the gap in \cite{guruswami-hastad-kopparty-2010-ld-rand-lin} for large $p$.
\item Rudra and Wootters \cite{rudra-wootters-2014-puncturing, rudra-wootters-2015-rand-op, rudra-wootters-2018-avg-rad-lr-rand-lin} employed heavy machinery of generic chaining to provide improved bounds when the field size is very large, say, allowed to scale with $1/\delta$ and even $n$. The parameter regimes become complicated in this situation and we do not copy them here.
\item Li and Wootters \cite{li-wootters-2018-ld-rand-lin} showed that a random \emph{binary} linear code of rate $1-H(p)-\delta$ is $(p,H(p)/\delta+2)$-list decodable whp for \emph{any} $p\in(0,1/2)$ and $\delta>0$. They did so by lifting the existential result in \cite{ghsz-2002} to a whp one.
\end{enumerate}
One can find a summary of the above mentioned results in Table \ref{tab:ld_rand_lin_state_of_the_art}.
\begin{table}
\centering
\begin{tabular}{|p{0.07\textwidth}|p{0.15\textwidth}|p{0.17\textwidth}|p{0.12\textwidth}|p{0.16\textwidth}|p{0.07\textwidth}|}
\hline
\textbf{Field size} & \textbf{Noise level} & \textbf{Rate} & \textbf{List size} & \textbf{whp / with constant probability / existential} & \textbf{Reference} \\\hline
$q\ge2$ & $p\in(0,1-1/q)$ & $R=1-H_q(p)-\delta$ & $L=q^{\cO(1/\delta)}$ & whp &Folklore \\\hline
$q=2$ & $p\in(0,1/2)$ & $R=1-H(p)-\delta$ & $L\le1/\delta$ & existential &\cite{ghsz-2002} \\\hline
$q\ge2$ & $p\in(0,1-1/q)$ & $R=1-H_q(p)-\delta$ & $L\le C_{p,q}/\delta$ & whp &\cite{guruswami-hastad-kopparty-2010-ld-rand-lin} \\\hline
$q\ge2$ & $p=(1-1/q)(1-\tau)$ & $R=\Omega\paren{\frac{\tau^2}{\log^3(q/\tau)\log q}}$ & $L=\cO(1/\tau^2)$ & with constant probability &\cite{cheraghchi-guruswami-velingker-2013-rip-ld-rand-lin} \\\hline
$q\ge2$ & $p=(1-1/q)(1-\tau)$ & $R=\Omega(\tau^2/\log q)$ & $L=\cO(1/\tau^2)$ & whp &\cite{wootters-2013-ld-rand-lin-low-rate} \\\hline
$q=2$ & $p\in(0,1/2)$ & $R=1-H(p)-\delta$ & $L\le H(p)/\delta+2$ & whp &\cite{li-wootters-2018-ld-rand-lin} \\\hline
\end{tabular}
\caption{A non-exhaustive list of the state of the art of list decodability of random linear codes.}
\label{tab:ld_rand_lin_state_of_the_art}
\end{table}
Although there is a long line of research regarding list decoding, we are far from a complete understanding. Besides attempts towards Conjecture \ref{conj:list-dec-rand-lin}, from the negative side, it turns out there is a matching $\Omega(1/\delta)$ lower bound on the list size of random linear codes. Namely, if we sample a linear code uniformly at random, its list size is $\Omega(1/\delta)$ \emph{whp}. Nonetheless, in general, the best lower bound on list size for \emph{any} code is still $\Omega(\log(1/\delta))$ \cite{blinovsky-1986-ls-lb-binary, blinovsky-2005-ls-lb-qary, blinovsky-2008-ls-lb-qary-supplementary,guruswami-vadhan-2005-ls-lb, guruswami2013combinatorial} -- there is an exponential gap between the best upper and lower bounds even over $\bF_2$. Closing this gap is also a long standing open problem.
Similar questions can also be posed under the erasure model. In this case, the adversary is allowed to replace any $np$ coordinates of the codeword with question marks.
\begin{definition}[List decodability under erasures over $\bF_q$]\label{def:list_dec_erasure}
A code $\cC\subseteq\bF_q^n$ is said to be $(p,L)$-erasure list decodable if for any $\cT\subseteq[n]$ of cardinality $(1-p)n$ and any $\vy\in\bF_q^{(1-p)n}$, $\card{\curbrkt{\vx\in\cC\colon \vx|_\cT=\vy}}\le L$.
\end{definition}
It is known that the erasure list decoding capacity is $1-p$, coinciding with the capacity of a Binary Erasure Channel with erasure probability $p$ (BEC($p$)).
\begin{theorem}[List decoding capacity under erasures over $\bF_q$, \cite{guruswami-lncs}, Theorem 10.3, 10.8]\label{thm:list_dec_cap_erasure}
For any small constant $\delta>0$, any $0<p<1$ and any $n$ large enough, there exists a $(p,\cO(1/\delta))$-erasure list decodable code $\cC$ of blocklength $n$ and rate $1-p-\delta$; on the other hand, any code of rate $1-p+\delta$ is $(p,q^{\Omega(n\delta)})$-erasure list decodable.
\end{theorem}
The achievability part again follows from a random coding argument and the scaling $\Theta(1/\delta)$ of the list size of a random code is tight whp via a second moment computation \cite{guruswami2013combinatorial}. For general codes, it can be shown that the list size is at least $\Omega(\log (1/\delta))$ using an erasure version of the punctured Plotkin-type bound (see, e.g., \cite{guruswami-lncs}, Theorem 10.8).
On the other hand, if we restrict our attention to \emph{linear} codes, the situation seems a little worse. The list size of a random linear code turns out to be $2^{\Theta(1/\delta)}$ whp (see, e.g., \cite{guruswami-lncs}, Theorem 10.6 for an upper bound and \cite{guruswami2013combinatorial} for a matching lower bound). Intuitively, for a linear code $\cC$, the list $\curbrkt{\vx\in\cC\colon \vx|_\cT=\vy|_\cT}$ corresponding to a received word $\vy\in(\bF_q\cup\curbrkt{?})^{n}$ with $(1-p)n$ unerased locations in $\cT\subseteq[n]$ forms an affine subspace. The list size has to be exponential in the rank of the list in some sense. For general linear codes, it can be shown that the list size is at least $\Omega(1/\delta)$ using a connection to generalized Hamming weights \cite{cohen-etal-it1994}. Although we do not have a provable separation working uniformly in all parameter regimes, it is believed that linear codes are {``less"} erasure list decodable than nonlinear codes.
Narrowing down the exponential gap for either general codes or linear codes seems to be a particularly tricky task.
Upper and lower bounds on list sizes of ensembles of random codes and arbitrary codes are listed in Table \ref{tab:ld_error_erasure} for comparison.
\begin{table}
\centering
\begin{tabular}{|p{0.12\textwidth}|p{0.20\textwidth}|p{0.16\textwidth}|p{0.16\textwidth}|}
\hline
\textbf{Channel model} & \textbf{Code} & \textbf{List size} & \textbf{Reference} \\\hline
\multirow{3}{0.12\textwidth}{Error} & Random codes & $L\le1/\delta$ whp & Folklore \\\cline{2-4}
& Random binary codes & $L\ge\frac{1-2^{-\Omega_p(1/\delta)}}{\delta}$ whp & \cite{li-wootters-2018-ld-rand-lin} \\\cline{2-4}
& Random binary linear codes & $L\le H(p)/\delta+2$ whp & \cite{li-wootters-2018-ld-rand-lin} \\\cline{2-4}
& Random linear codes & $L=\cO_{p,q}(1/\delta)$ whp & \cite{guruswami-hastad-kopparty-2010-ld-rand-lin} \\\cline{2-4}
& Arbitrary codes & $L=\Omega_{p,q}(\log(1/\delta))$ & \cite{blinovsky-1986-ls-lb-binary, blinovsky-2005-ls-lb-qary, blinovsky-2008-ls-lb-qary-supplementary,guruswami-vadhan-2005-ls-lb, guruswami2013combinatorial} \\\hline
\multirow{3}{0.12\textwidth}{Erasure} & Random {binary} codes & $L\le \frac{1-p+H(p)}{\delta}-1$ whp & \cite{guruswami-lncs}, Theorem 10.9 \\\cline{2-4}
& Random codes & $L\ge\frac{1-p}{2\delta}$ whp & \cite{guruswami2013combinatorial} \\\cline{2-4}
& Arbitrary {binary} codes & $L\ge\log(1+p/\delta)$ & \cite{guruswami-lncs}, Theorem 10.14 \\\cline{2-4}
& Random {binary} linear codes & $L\le 2^{H(p)/\delta}-1$ whp & \cite{guruswami-lncs}, Theorem 10.11 \\\cline{2-4}
& Random linear codes & $L\ge\frac{1}{q}2^{\frac{p(1-p)}{16\delta}}$ whp &\cite{guruswami2013combinatorial} \\\cline{2-4}
& Arbitrary {binary} linear codes & $L\ge1+p/\delta$ & \cite{cohen-etal-it1994} \\\hline
\end{tabular}
\caption{Upper and lower bounds on list sizes of ensembles of random codes and arbitrary codes.}
\label{tab:ld_error_erasure}
\end{table}
As we saw, the list size problem is not well understood under the adversarial model. However, it is completely characterized if we are willing to further relax the problem by limiting the adversary to be \emph{oblivious}. Specifically, we call the adversary \emph{omniscient} if the error pattern is a function of the transmitted codeword, i.e., the adversary sees the codeword before he designs the attack vector. Otherwise, an adversary is said to be \emph{oblivious} if the error pattern is independent of the transmitted codewords, i.e., the adversary knows nothing more than the codebook and has to design the attack vector before the codeword is transmitted. The list size-vs.-rate tradeoff is known to a fairly precise extent for \emph{general} discrete memoryless oblivious adversarial channels. This line of work is pioneered by information theorists.
For a general oblivious discrete memoryless Arbitrarily Varying Channel (AVC) $W(\vy|\vx,\vs)$, Hughes \cite{hughes-1997-list-avc} completely characterized its capacity. Specifically, a discrete memoryless AVC is specified by a collection of stochastic matrices \[\cW\coloneqq\curbrkt{W(\cdot|\cdot,\vs)\in\bR^{|\cY|\times|\cX|}\colon \vs\in\cS}.\] The transition probability for $n$ channel uses is hence defined as
\begin{equation*}
W(\vy|\vx,\vs)\coloneqq\prod_{i=1}^nW(\vy_i|\vx_i,\vs_i),
\end{equation*}
Hughes provided a formula for the list-$L$ capacity. We need some definitions to state his result. A channel $V(y|x_1,\cdots,x_k)$ is \emph{symmetric} in $x_1,\cdots,x_k$ if it is invariant over all permutations of $x_1,\cdots,x_k$ for all $y,x_1,\cdots,x_k$. An AVC $\cW$ is \emph{$m$-symmetrizable} if there exists a stochastic matrix $U\in\bR^{|\cS|\times|\cX|^m}$ such that
\[V(y|x,x_1,\cdots,x_m)\coloneqq\sum_sU(s|x_1,\cdots,x_m)W(y|x,s)\]
is symmetric in $x,x_1,\cdots,x_m$. The \emph{symmetrizability} of $\cW$ is defined as
\begin{equation}
M\coloneqq
\begin{cases}
\max\curbrkt{m\in\bZ_{\ge0}\colon \cW\text{ is }m\text{-symmetrizable}},&C_{\text{rand}}(\cW)>0\\
\infty,&C_{\text{rand}}(\cW)=0
\end{cases},
\label{eqn:sym}
\end{equation}
where $C_{\text{rand}}$ is the random code capacity of $\cW$ defined as
\begin{equation*}
C_{\text{rand}}\coloneqq\max_P\min_{P_{\bfx\bfs\bfy}=P_\bfx P_\bfs W_{\bfy|\bfx\bfs}\colon P_\bfx=P}I(\bfx;\bfy).
\end{equation*}
Now, the list-$L$ capacity of $\cW$ is given by
\begin{equation}
C(L)=
\begin{cases}
C_{\text{rand}},&L>M\\
0,&L\le M
\end{cases}.
\label{eqn:list_l_cap}
\end{equation}
It is worth mentioning that recently there are several breakthroughs towards explicit constructions of ``good" codes in the high-noise low-rate regime using tools from pseudorandomness. Ta-Shma \cite{ta-shma-2017-explicit-gv} constructed an \emph{explicit} $\delta$-balanced\footnote{A binary linear code is said to be $\delta$-balanced if the weight of each codeword is between $\frac{1-\delta}{2}n$ and $\frac{1+\delta}{2}n$.} binary linear code of rate $\Omega(\delta^{2+\gamma})$ where $\gamma=\Theta\paren{\paren{\frac{\log\log\frac{1}{\delta}}{\log\frac{1}{\delta}}}^{1/3}}=o(1)$, \emph{almost} matching the Gilbert--Varshamov bound in this regime. Ta-Shma's beautiful and ingenious construction is done by casting the problem in the language of $\delta$-balanced set and analyzing a \emph{long} random walk on a carefully constructed expander graph. His result is concerned with explicit codes with good distances. A more relevant result to our topic is an explicit construction of a \emph{near-optimal} erasure list decodable code \cite{ben-aroya-doron-ta-shma-2018-explicit-erasure-ld}. The authors viewed the problem as constructing explicit dispersers and managed to construct an explicit binary \emph{nonlinear} $(1-\tau,\poly\log\frac{1}{\tau})$-erasure list decodable code of rate $\tau^{1+\gamma}$ (for any small constant $\gamma>0$) borrowing tools from the theory of extractors. The list size and the rate they got are both near-optimal.
Going beyond combinatorial bounds and constructions, there is also research regarding efficient list decoding algorithms. For instance, recently Dinur et al. \cite{dinur-harsha-kaufman-navon-ta-shma-2018-eff-ld} showed how \emph{double samplers} give rise to a generic way of amplifying distance so as to enable efficient list decoding algorithms.
{Anyway, in this paper, we will focus on combinatorial/information-theoretic limits of list decoding various ensembles of random codes over $\bR$ against omniscient adversaries.} In next section, we will briefly recall what is known about list decoding over the reals. As we will see, it is much less studied and understood, which motivates this work.
\section{Notation}\label{sec:notation}
\noindent\textbf{General notation.}
We use standard Bachmann-Landau (Big-Oh) notation for asymptotic functions.
For any $q\in\bR_{>0}$, we write $\log_q(\cdot)$ for the logarithm to the base $q$. In particular, let $\log(\cdot)$ denotes logarithm to the base two and let $\ln(\cdot)$ denotes logarithm to the base $e$.
\noindent\textbf{Sets.}
For any two sets $\cA$ and $\cB$ with additive and multiplicative structures, let $\cA+\cB$ and $\cA\cdot\cB$ denote the Minkowski sum and Minkowski product of them which are defined as
\[\cA+\cB\coloneqq\curbrkt{a+b\colon a\in\cA,b\in\cA},\quad\cA\cdot\cB\coloneqq\curbrkt{a\cdot b\colon a\in\cA,b\in\cB}.\]
If $\cA=\{x\}$ is a singleton set, we write $x+\cB$ and $x\cB$ for $\{x\}+\cB$ and $\{x\}\cdot\cB$.
For any finite set $\cX$ and any integer $0\le k\le |\cX|$, we use $\binom{\cX}{k}$ to denote the collection of all subsets of $\cX$ of size $k$.
\[\binom{\cX}{k}\coloneqq\curbrkt{\cY\subseteq\cX\colon\card{\cY}=k}.\]
For $M\in\bZ_{>0}$, we let $[M]$ denote the set of first $M$ positive integers $\{1,2,\cdots,M\}$.
For a subset $\cT=\curbrkt{i_1,\cdots,i_t}\subseteq[n]$ of $t$ coordinates and a vector $\vx\in\cX^n$ over some alphabet $\cX$, we use $\vx|_\cT$ to denote the vector obtained by restricting $\vx$ to the coordinates in $\cT$, i.e.,
\[\vx|_\cT\coloneqq[\vx_{i_1},\cdots,\vx_{i_t}]^\top.\]
Similar notation can be defined for a subset $\cA$ of $\cX^n$
\[\cA|_\cT\coloneqq\curbrkt{\vx|_\cT\colon \vx\in\cA}.\]
For any $\cA\subseteq\Omega$, the indicator function of $\cA$ is defined as, for any $x\in\Omega$,
\[\ind{\cA}(x)=\begin{cases}1,&x\in \cA\\0,&x\notin \cA\end{cases}.\]
At times, we will slightly abuse notation by saying that $\ind{\mathsf{A}}$ is $1$ when event $\mathsf{A}$ happens and zero otherwise.
Let $\|\cdot\|_2$ denote the Euclidean/$L^2$-norm. Specifically, for any $\vx\in\bR^n$,
\[\|\vx\|_2\coloneqq\paren{\sum_{i=1}^n\vx_i^2}^{1/2}.\]
For brevity, we also write $\|\cdot\|$ for the $L^2$-norm.
Let $\vol_n(\cdot)$ denote the $n$-dimensional Lebesgue volume of an Euclidean body. Specifically, for any Euclidean body $\cA\subseteq\bR^n$,
\[\vol_n(\cA)=\int_\cA\diff \vx=\int_{\bR^n}\ind{\cA}(\vx)\diff\vx,\]
where $\diff\vx$ denotes the differential of $\vx$ with respect to (wrt) the Lebesgue measure on $\bR^n$. When the dimension $n$ is obvious from the context, we will also use the shorthand notation $|\cdot|$ for $\vol_n(\cdot)$. For convenience, the dimension subscript will be dropped without causing confusion. If $\cA\subseteq\bR^n$ is an $n$-dimensional body with nonempty interior, we write $\vol(\cA)$ for $\vol_n(\cA)$; if $\cA\subseteq\bR^n$ is an $(n-1)$-dimensional hypersurface, we write $\area(\cA)$ for $\vol_{n-1}(\cA)$.
Sets are denoted by capital letters in calligraphic typeface, e.g., $\cC,\cI$, etc. In particular, let $\cS_2^{n-1}$ denote the $(n-1)$-dimensional unit Euclidean sphere wrt $L^2$-norm.
\[\cS_2^{n-1}\coloneqq\curbrkt{\vy\in\bR^n\colon \|\vy\|_2=1}.\]
Let $\cB_2^n$ denote the $n$-dimensional unit Euclidean ball wrt $L^2$-norm.
\[\cB_2^n\coloneqq\curbrkt{\vy\in\bR^n\colon \|\vy\|_2\le1}.\]
An $(n-1)$-dimensional Euclidean sphere centered at $\vx$ of radius $r$ is denoted by
\[\cS_2^{n-1}(\vx,r)=\vx+r\cS_2^{n-1}=\{\vy\in\bR^n:\|\vy\|_2=r\}.\]
An $n$-dimensional Euclidean ball centered at $\vx$ of radius $r$ is denoted by
\[\cB_2^n(\vx,r)=x+r\cB_2^n=\{\vy\in\bR^n:\|\vy\|_2\le r\}.\]
For any $\vx\in\bF_q^n$, let $\wth{\vx}$ denote the Hamming weight of $\vx$, i.e., the number of nonzero entries of $\vx$.
\[\wth{\vx}\coloneqq\curbrkt{i\in[n]\colon \vx_i\ne0}.\]
For any $\vx,\vy\in\bF_q^n$, let $\disth(\vx,\vy)$ denote the Hamming distance between $\vx$ and $\vy$, i.e., the number of locations where they differ.
\[\disth(\vx,\vy)\coloneqq\wth{\vx-\vy}=\curbrkt{i\in[n]\colon \vx_i\ne\vy_i}.\]
We can define balls and spheres in $\bF_q^n$ centered around some point of certain radius wrt Hamming metric as well.
\[\bham^n(\vx,r)\coloneqq\curbrkt{\vy\in\bF_q^n\colon \disth(\vx,\vy)\le r},\quad\sham^n(\vx,r)\coloneqq\curbrkt{\vy\in\bF_q^n\colon \disth(\vx,\vy)=r}.\]
We will drop the subscript and superscript for the associated metric and dimension when they are clear from the context.
\noindent\textbf{Probability.}
Random variables are denoted by lower case letters in boldface or capital letters in plain typeface, e.g., $\bfm,\bfx,\bfs,U,W$, etc. Their realizations are denoted by corresponding letters in plain typeface, e.g., $m,x,s,u,w$, etc. Vectors of length $n$, where $n$ is the block-length, are denoted by lower case letters with an underline, e.g., $\vbfx,\vbfs,\vx,\vs$, etc. The $i$th entry of a vector is denoted by a subscript $i$, e.g., $\vbfx_i,\vbfs_i,\vx_i,\vs_i$, etc. Matrices are denoted by capital letters in boldface, e.g., $\bfI,\mathbf{\Sigma}$, etc.
The probability mass function (pmf) of a discrete random variable $\bfx$ or a random vector $\vbfx$ is denoted by $p_{\bfx}$ or $p_{\vbfx}$. Here with a slight abuse of notation, we use the same to denote the probability density function (pdf) of $\bfx$ or $\vbfx$ if they are continuous.
If every entry of $\vbfx$ is independently and identically distributed (iid) according to $p_{\bfx}$, then we write $\vbfx\sim p_{\bfx}^{\tn}$. In other words,
\[p_{\vbfx}(\vx)=p_{\bfx}^{\tn}(\vx)\coloneqq\prod_{i=1}^np_{\bfx}(\vx_i).\]
Let $\cU(\Omega)$ denote the uniform distribution over some probability space $\Omega$. Let $\cN(\underline{\mu},\mathbf\Sigma)$ denote the $n$-dimensional Gaussian distribution with mean vector $\underline{\mu}$ and covariance matrix $\mathbf\Sigma$.
We use $H(\cdot)$ to denote interchangeably Shannon entropy and differential entropy; the exact meaning will usually be clear from context.
In particular, if $p_{\vbfx}\colon \bR^n\to\bR_{\ge0}$ is a pdf of a random vector $\vbfx$ in $\bR^n$ , $H(\vbfx)$ denotes the differential entropy of $\vbfx\sim p_{\vbfx}$,
\[H(\vbfx)=-\int_{\bR^n} p_{\vbfx}(\vx)\log p_{\vbfx}(\vx)\diff \vx.\]
For any $p\in[0,1]$, $H(p)$ denotes the binary entropy
\[H(p)=p\log\frac{1}{p}+(1-p)\log\frac{1}{1-p}.\]
For any $q\in\bZ_{\ge2}$ and any $p\in[0,1]$, $H_q(p)$ denotes the $q$-ary entropy
\[H_q(p)=p\log_q(q-1)+p\log_q\frac{1}{p}+(1-p)\log_q\frac{1}{1-p}.\]
\noindent\textbf{Algebra.}
For any field $F$, we use $\speclin(n,F)$ and $\genlin(n,F)$ to denote the special linear group and the general linear group over $F$ of degree $n$.
\[\speclin(n,F)\coloneqq\curbrkt{\bfM\in F^{n\times n}\colon \det(\bfM)=1},\quad \genlin(n,F)\coloneqq\curbrkt{\bfM\in F^{n\times n}\colon \det(\bfM)\ne 0}.\]
For any vector space $V$ of dimension $n$ and any integer $0\le k\le n$, the Grassmannian $\gr(k,V)$ is the collection of all $k$-dimensional subspace of $V$.
\[\gr(k,V)\coloneqq\curbrkt{U\le V\text{ subspace}\colon \dim U=k}.\]
\section{Preliminaries}\label{sec:prelim}
\noindent\textbf{Probability.} The following lemma is an easy corollary of Chebyshev inequality.
\begin{lemma}\label{lem:cheb_cor}
For any nonnegative random variable $X$, $\prob{X=0}\le\var{X}/\expt{X}^2$.
\end{lemma}
Recall two facts about the moments of Gaussian and Poisson random variables.
\begin{fact}\label{fact:gaussian_mmt}
Let $\bfg\sim\cN(0,1)$, then
\[\expt{\bfg^k}=\begin{cases}
0,&k\text{ odd}\\
(k-1)!!,&k\text{ even}
\end{cases},\]
where $\ell!!\coloneqq \ell(\ell-2)(\ell-4)\cdots3\cdot 1$ denotes the double factorial of $\ell$.
\end{fact}
\begin{fact}\label{fact:pois_mmt}
Let $\bfp\sim\pois(\lambda)$, then
\[\expt{\bfp^k}=e^{-\lambda}\sum_{i=0}^\infty\frac{i^k}{i!}\lambda^i.\]
\end{fact}
Poisson random variables are additive.
\begin{fact}\label{fact:pois_add}
If $\bfp_1\sim\pois(\lambda_1)$ and $\bfp_2\sim\pois(\lambda_2)$ are independent, then $\bfp_1+\bfp_2\sim\pois(\lambda_1+\lambda_2)$.
\end{fact}
We know the following tail bound for Poisson random variables.
\begin{lemma}\label{lem:pois_tail}
Let $\bfp\sim\pois(\lambda)$ and $\ell>\lambda,m<\lambda$, then
\begin{align*}
\prob{\bfp> \ell}<& {\frac {e^{-\lambda }(e\lambda )^{\ell}}{\ell^{\ell}}},\\
\prob{\bfp<m}<& {\frac {e^{-\lambda }(e\lambda )^{m}}{m^{m}}}.
\end{align*}
\end{lemma}
\noindent\textbf{Geometry.}
It is well-known that Stirling's approximation gives an asymptotic expression for factorials.
\begin{lemma}\label{lem:stirling}
For any $n\in\bZ_{>0}$, $n!=\sqrt{2\pi n}(n/e)^n(1+o(1))$.
\end{lemma}
We can use the above lemma to obtain the asymptotic behaviour of binomial coefficients. At times, we also resort to the following cheap yet convenient bounds.
\begin{lemma}\label{lem:bd_binom_coeff}
For any $n\in\bZ_{>0}$ and $0\le k\le n$, $(n/k)^k\le\binom{n}{k}\le(en/k)^k$.
\end{lemma}
Recall the formulas and asymptotics of the volume of a unit Euclidean ball and the area of a unit Euclidean sphere.
\begin{fact}\label{fact:vol_ball}
$V_n\coloneqq\vol(\cB^n_2)=\frac {\pi ^{\frac {n}{2}}}{\Gamma ({ {n}/{2}}+1)}= \frac{1}{\sqrt{\pi n}}\paren{\frac{2\pi e}{n}}^{n/2}(1+o(1))$.
\end{fact}
\begin{fact}\label{fact:area_sphere}
$A_{n-1}\coloneqq\area( \cS^{n-1}_2)={\frac {n\pi ^{\frac {n}{2}}}{\Gamma ({ {n}/{2}}+1)}}= \sqrt{\frac{n}{\pi}} \paren{\frac{2\pi e}{n}}^{n/2}(1+o(1)))$.
\end{fact}
\section{Lower bounds on list sizes of random spherical codes}\label{sec:lb_ls_spherical}
We now investigate lower bounds on the list size $ L $ for codes that operate at rate $ R=C(P,N) -\delta$.
\subsection{A reduction from any code to a spherical code}
We first show that it suffices to prove a lower bound on list size for spherical codes.
\begin{lemma}
Suppose there exists a $ (P,N,L) $-list decodable code $ \cC \subset\cB_2^n(0,\sqrt{nP}) $ of rate $ R $. Then, there exists a $\paren{P,N,\frac{P}{4N}L}$-list decodable code $ \cC' \subset \cS_2^{n-1}(0,\sqrt{nP})$ of the same rate.
\label{lemma:reduction_balltospherecode}
\end{lemma}
\begin{proof}
Given any $\paren{P,N,L}$-list decodable (ball) code $\cC$ in $\cB_2^n(0,\sqrt{nP})$, we can construct a $\paren{P,N,\frac{P}{4N}L}$-list decodable spherical code $\cC'$. Indeed, we just project all codewords radially onto $\cS^{n-1}\paren{0,\sqrt{nP}}$. Then we know that
\[\card{\cC'\cap\C^{n-1}(\sqrt{nN})}\le\card{\cN}L,\]
where
$\C^{n-1}(\sqrt{nN})$ is a cap of radius $\sqrt{nN}$ sitting somewhere on the sphere
\[\C^{n-1}(\sqrt{nN})\coloneqq\curbrkt{\vx\in\cS^{n-1}(0,\sqrt{nP})\colon \inprod{\vx}{\vtheta}\ge\sqrt{n(P-N)}}\]
for some direction $\vtheta\in\cS^{n-1}$ and
$\cN$ is a covering of the cone
\[\curbrkt{\lambda\vx\colon \vx\in\C^{n-1}(\sqrt{nN}),\lambda\in[0,1]}\]
induced by the cap using $\cB^n\paren{\cdot,\sqrt{nN}}$. Crudely, we can upper bound $\card{\cN}$ by $\frac{\sqrt{P-N}}{2d}$. This can be seen by staring at the geometry of a covering as shown in Figure \ref{fig:cone_covering}. By symmetry, the distance between the centers $O_1$ and $O_2$ of the first two balls is equal to $2d$ where $d\coloneqq{SO_1}={SO_2}$. Since the triangles $\Delta OSQ'$ and $\Delta OO_1Q$ are similar, $d$ is given by the following equation
\begin{equation}
\frac{\card{OS}}{\card{OO_1}}=\frac{\card{OQ'}}{\card{OQ}} \iff \frac{\sqrt{P-N}-d}{\sqrt{P-N}}=\frac{\sqrt{P}-d'}{\sqrt{P}},
\label{eqn:sim_tri}
\end{equation}
where $d'\coloneqq Q'Q$. On the other hand, the triangle $\Delta O_1Q'Q$ is isosceles with side length $O_1Q'=O_1Q=\sqrt{nN}$. It is immediate that $d'=2\sqrt{N}\cos\theta=2N/\sqrt{P}$ since $\cos\theta=QO_1/QO=\sqrt{N/P}$ in $\Delta QO_1O$.
Plugging it into Eqn. \ref{eqn:sim_tri} and solving $d$, we have $d=2\frac{N}{P}\sqrt{P-N}$. Hence $\card{\cN}\le\frac{P}{4N}$.
\begin{figure}
\centering
\includegraphics{cone_covering.pdf}
\caption{A covering of the cone using balls.}
\label{fig:cone_covering}
\end{figure}
In fact, since we are covering a cone rather than a cylinder, the most economical way of covering is not to align the balls with consecutive distance $2d$. Indeed, the optimal covering $\cN^*$ has strictly increasing distances $2d=d_{1}<d_{2}<\cdots<d_{|\cN^*|-1}$, where $d_{i}$ is the distance between the centers $O_i$ and $O_{i+1}$ of the $i$-th and the $(i+1)$-th balls. One can compute each $d_i$ explicitly. Although our bound is crude, it is still a valid and simple upper bound and is tight for covering a cylinder.
\end{proof}
\subsection{List size lower bound for uniformly random spherical codes}
Although we are not able to obtain a lower bound on arbitrary spherical codes, we can obtain a lower bound on uniformly random spherical codes.
\begin{proposition}
Fix $ P>N>0 $, and let $ C=\frac{1}{2}\log\frac{P}{N} $. If $ \cC $ is a random spherical code in $ \cS^{n-1}(0,\sqrt{nP}) $ of rate $ C-\delta $, then
\[
\Pr\left[\cC\text{ is }\paren{P,N,\frac{c'}{\delta}}\text{-list decodable}\right] \leq 2^{-\Theta(n)}.
\]
for every $ c'<C $.
\label{prop:lbound_randomspherical}
\end{proposition}
\begin{proof}
The proof follows a second-moment method as in Guruswami and Narayanan~\cite{guruswami2013combinatorial} for binary codes.
Choose a $\sqrt{n\eps}$-net $\cY$ for $\cS^{n-1}\paren{0,\sqrt{n\paren{P-N}}}$. In other words, $ \cY\subset \cS^{n-1}\paren{0,\sqrt{n\paren{P-N}}} $ and for all $ \vy\in \cS^{n-1}\paren{0,\sqrt{n\paren{P-N}}} $, we have $ \min_{\vu\in \cY}\Vert\vy-\vu\Vert \leq \sqrt{n\epsilon} $.
For any spherical code $ \cC $, define
\begin{equation}
W\coloneqq\sum_{\vy\in\cY}\sum_{\curbrkt{m_1,\cdots,m_L}\in\binom{\cM}{L}}\one{\psi\paren{m_1},\cdots,\psi\paren{m_L}\in\cB^n\paren{\vy,\sqrt{nN}}},
\label{eqn:w_spherical}
\end{equation}
where $\cM\coloneqq\curbrkt{0,1,\cdots,2^{nR}-1}$ is the set of messages and $\psi\paren{m}$ denotes the codeword corresponding to $m$. Let $M\coloneqq\card{\cM}=2^{nR}$. Clearly, $ W=0 $ if and only if (iff) $\cC$ is $ (P,N,L) $-list decodable.
\begin{align}
\prob{\cC\text{ is }(P,N,L-1)\text{-list decodable}}&=\prob{\bigcap_{\vy\in\cB^n\paren{0,\sqrt{nP}+\sqrt{nN}}\setminus\cB^n\paren{0,\sqrt{nP}-\sqrt{nN}}}\curbrkt{\card{\cC\cap\cB^n\paren{\vy,\sqrt{nN}}}<L}}\notag\\
&\le\prob{\bigcap_{\vy\in\cY}\curbrkt{\card{\cC\cap\cB^n\paren{\vy,\sqrt{nN}}}<L}}\notag\\
&=\prob{W=0}\notag\\
&\le\var{W}/\expt{W}^2,\label{eq:p_ld_bound1}
\end{align}
where the last inequality \ref{eq:p_ld_bound1} follows from Lemma \ref{lem:cheb_cor}.
Let
\[\mu\coloneqq\frac{\area\paren{\C^{n-1}\paren{\sqrt{nN}}}}{\area\paren{\cS^{n-1}\paren{\sqrt{nP}}}}.\]
Then, we show that
\[
\bE(W) \geq \paren{{M}/{L}}^L |\cY|\mu^L,
\]
and
\[
\var{W} \leq |\cY|^2LM^L\mu^{L+1}.
\]
See Sec.~\ref{sec:lbound_EW} and~\ref{sec:ubound_varW} for the details.
Plugging these in (\ref{eq:p_ld_bound1}), we get
\begin{align}
\prob{\cC\text{ is }(P,N,L-1)\text{-list decodable}}&\leq L^{2L+1}\mu^{-L+1}M^{-L}.\label{eqn:bound}
\end{align}
Note that
\begin{align}
\mu&\ge \frac{\vol\paren{\cB^{n-1}\paren{0,\sqrt{nN}}}}{\area\paren{\cS^{n-1}\paren{0,\sqrt{nP}}}}\notag\\
&=c_22^{-n\left(\frac{1}{2}\log\frac{P}{N}+o(1)\right)},\label{eqn:mu_lb}
\end{align}
for some absolute constant $ c_2 $.
The probability \ref{eqn:bound} we want to upper bound is at most
\begin{align}
\prob{\cC\text{ is }(P,N,L-1)\text{-list decodable}}&\leq L^{2L+1}c_2^{-L+1}2^{-n\paren{-L+1}\frac{1}{2}\log\frac{P}{N}-nRL}\notag\\ &=L^{2L+1}c_2^{-L+1}2^{n\paren{\delta L-\frac{1}{2}\log\frac{P}{N}+o(1)}}.\notag
\end{align}
The constant-in-$n$ terms are not important. The probability that $\cC$ is list decodable vanishes in $n$ when $L<\frac{\frac{1}{2}\log\frac{P}{N}}{\delta}$. That is to say, for a uniformly random spherical code to be $\paren{P,N,L-1}$-list decodable with high probability, the list size has to be at least $C/\delta$, where $C=\frac{1}{2}\log\frac{P}{N}$.
\end{proof}
We would like to emphasize that the above result only implies that a typical random code is not $ (P,N,c'/\delta) $ list decodable with high probability. This does not claim the non-existence of $ (P,N,c'/\delta) $ list decodable codes of rate $ C-\delta $.
\section{List decoding nested Construction-A lattice codes}\label{sec:ld_constr_a}
\subsection{Nested lattice codes}
Recall that a lattice $ \Lf $ is a discrete subgroup of $ \bR^n $, and can be written as $\bfG\bZ^n$ where $\bfG$ is called a generator matrix of $\Lf$. For a quick introduction to lattices and related definitions, see Appendix~\ref{sec:primer_lattices}. The concepts we use are quite standard in the literature on lattices.
We say that the lattice $ \Lc $ is nested in $ \Lf $ if $ \Lc\subsetneq \Lf $. Let $ Q_{\Lf}(\vx) $ denote the closest point in $ \Lf $ to $ \vx $, and $ [\vx]\bmod\Lf\coloneqq \vx-Q_{\Lf}(\vx) $. Let $ \cV(\Lc) \coloneqq Q_{\Lf}^{-1}(0) $ denote the fundamental Voronoi region of $ \Lc $. Further, let $ \rcov(\Lf) ,\reff(\Lf),\rpack(\Lf)$ respectively denote the covering, effective, and packing radii of the lattice $ \Lf $. The determinant (or covolume) of $ \Lf $ is equal to the volume of $\cV(\Lf) $ and denoted $ \det \Lf $.
Our goal is to construct good nested lattice pairs $ \Lf,\Lc $ with $ \Lc\subset \Lf $, and our nested lattice code will be defined as $ \cC \coloneqq \Lf\cap\cV(\Lc) $. The nested lattice code satisfies the power constraint if $ \rcov(\Lc)\leq \sqrt{nP} $.
We now prove an upper bound on the list size for nested lattice codes.
Our goal is to show the following:
\begin{theorem}
Let $0<\delta<0.9$ and $P>N$.
There exist nested lattice codebooks of rate $\frac{1}{2}\log_2\frac{P}{N}-\delta$ that are $(P,N,2^{\cO(\frac{1}{\delta}\log_2^2\frac{1}{\delta})})$-list decodable.
\label{thm:nestedconstructiona_listsize}
\end{theorem}
\subsection{List decodability of nested lattice codes}\label{sec:nestedlatticeensemble}
We start with a (full rank) coarse lattice $\Lc$ that satisfies
\begin{equation}
\frac{\rcov(\Lc)}{\reff(\Lc)}\leq 2^{\delta/8}
\label{eq:rcov_condition}
\end{equation}
and
\begin{equation}
\frac{\rpack(\Lc)}{\reff(\Lc)} > \frac{1}{4}.
\label{eq:rpack_condition}
\end{equation}
Such lattices are guaranteed to exist (for sufficiently large $n$) by~\cite{erez2005lattices} (See Appendix~\ref{sec:primer_lattices}).
The lattice is suitably scaled so that $\rcov(\Lc) = \sqrt{nP}$ and this will ensure that the codebook satisfies the power constraint.
Note that scaling the lattice by a constant factor scales $\rpack,\reff$ and $\rcov$ by the same amount, and the ratios in (\ref{eq:rcov_condition}) and (\ref{eq:rpack_condition}) remain unchanged.
Let $\bfG_{\Lc}$ be a generator matrix for $\Lc$, and $q$ be the smallest prime number
that satisfies
\begin{equation}
1+\frac{\sqrt{P}}{q\sqrt{N}} \leq 2^{\delta/8}.
\label{eq:prime_condition}
\end{equation}
Note that $q$ is independent of $n$.
Bertrand's postulate guarantees that for every positive integer $m$, there exists a prime number between $m$ and $2m$.
Therefore,
\begin{equation}
\frac{\sqrt{P/N}}{2^{\delta/8}-1} \leq q\leq 2\frac{\sqrt{P/N}}{2^{\delta/8}-1} +2.
\label{eq:primecondition_2}
\end{equation}
Let $R = \frac{1}{2}\log_2\frac{P}{N}-\delta$, and $\kappa$ be an integer such that\footnote{More accurately, $\kappa$ is the integer closest to $nR/\log_2q$. But we assume that $\kappa$ is an integer so that our proofs are cleaner.} $\frac{\kappa}{n}\log_2 q = R$.
We define an ensemble of fine lattices as follows: Choose an $n\times \kappa$ generator matrix $\bfG_\lin$ uniformly over $\bFq^{n\times \kappa}$. This defines a linear code $\cC(\bfG_\lin)$ over $\bFq$.
Let $\Lf'\coloneqq \frac{1}{q}\Phi(\cC(\bfG_\lin)) + \bZ^n$, where $ \Phi $ is the natural embedding of $ \bFq^n $ into $ \bR^n $. In other words, $ \Phi $ operates componentwise on vectors, and maps $ 0,1,\ldots,q-1\in\bF_q $ to $ 0,1,\ldots,q-1\in\bR $. Our fine lattice is $\Lf \coloneqq \bfG_{\Lc}\Lf'$. It is easy to verify that $\Lf$ is always a sublattice of $\Lc$.
Our nested lattice codebook is then $\Lf\cap\cV(\Lc)$.
We will show the following result, which implies Theorem~\ref{thm:nestedconstructiona_listsize}.
\begin{theorem}
If $P>N$, then
\[
\Pr[\Lf\cap \cV(\Lc) \text{ is not }(P,N,2^{\cO((\log_2^2\delta)/\delta)})\text{-list decodable}] = 2^{-\Omega(n)}.
\]
\label{thm:nestedlattice_listdecoding}
\end{theorem}
Note that the only randomness involved is in the choice of the generator matrix $\bfG_\lin$ that is used to construct the fine lattice.
We now discuss some intermediate lemmas which will be used to prove Theorem~\ref{thm:nestedconstructiona_listsize}. The formal proof will be given in Sec.~\ref{sec:prf_constructiona_list}.
Fix any $\vy\in\bR^n$.
Fundamental to the proof is counting the number of lattice points within a ball of radius $r$ around $\vy$.
We will want bounds on $\card{\frac{1}{q}\Lc\cap \cB(\vy,r)}$. We can write this as $\card{\curbrkt{ \vx\in\bZ^n: \normtwo{ \vy-\frac{1}{q}\bfG_{\Lc}\vx }\leq r }}$.
A simple argument generalizing~\cite[Lemma 1]{ordentlich2016simple} can be used to show that this is upper bounded by a suitable constant times the volume of a certain ellipsoid.
This can be formally stated as follows:
\begin{lemma}
Let $V_n$ denote the volume of the unit ball in $\bR^n$, and $\Lc$ be a full-rank lattice in $\bR^n$. Then, for any $r>\rcov(\Lc)/q$ and $\vy\in\bR^n$, we have
\[
\frac{q^n V_n}{\vol(\cV(\Lc))}\left( r-\frac{\rcov(\Lc)}{q} \right)^n\leq \left|\frac{1}{q}\Lc\cap \cB(\vy,r)\right| \leq \frac{q^n V_n}{\vol(\cV(\Lc))}\left( r+\frac{\rcov(\Lc)}{q} \right)^n.
\]
\label{lemma:count_latticepoints}
\end{lemma}
Observe that there is a bijection between $ \bFq^\kappa $ and $ \Lf\cap\cV(\Lc) $.
The encoder maps $u\in \bFq^\kappa$ to a nested lattice codeword (with slight abuse of notation\footnote{Here, we use the natural embedding of $\bFq^n$ in $\bZ^n$ to identify $\bfG_\lin m$ as a point in $\bZ^n$.})
$$\psi(m)\coloneqq\left[ \frac{1}{q}\bfG_{\Lc}\big([\bfG_\lin m]\bmod(q\bZ^n)\big) \right]\bmod\Lc.$$
\begin{lemma}
Fix $m\in\bFq^\kappa\backslash\{ {0}\}$ and $\vy\in\bR^n$.
\begin{equation}
\Pr[\psi(m)\in \cB(\vy,r)] \leq \left(\frac{r}{\sqrt{nP}} 2^{\delta/8}\left( 1+\frac{\rcov(\Lc)}{qr} \right)\right)^n. \label{eq:prf1}
\end{equation}
\end{lemma}
\begin{proof}
Since the codeword $\psi(m)$ is guaranteed to be in $\cV(\Lc)$, we have
\begin{align}
\Pr[\psi(m)\in \cB(\vy,r)] &\leq \Pr\left[ \psi(m)\in [\cB(\vy,r)]\bmod\Lc \right]&\notag\\
&= \frac{1}{q^n}\left| \frac{1}{q}\Lc\cap [\cB(\vy,r)]\bmod\Lc \right|&\notag\\
&\leq \frac{1}{q^n}\left| \frac{1}{q}\Lc\cap \cB(\vy,r) \right|&\notag\\
&\leq \frac{V_n}{\vol(\cV(\Lc))} \left( r+\frac{\rcov(\Lc)}{q} \right)^n&\notag
\end{align}
using Lemma~\ref{lemma:count_latticepoints}. Simplifying this, we get
\begin{align}
\Pr[\psi(m)\in \cB(\vy,r)] &\leq \frac{r^n}{(\reff(\Lc))^n} \left( 1+\frac{\rcov(\Lc)}{qr} \right)^n &\notag \\
& \leq \frac{r^n}{(\rcov(\Lc))^n} 2^{n\delta/8}\left( 1+\frac{\rcov(\Lc)}{qr} \right)^n &\notag \\
& = \left(\frac{r}{\sqrt{nP}} 2^{\delta/8}\left( 1+\frac{\rcov(\Lc)}{qr} \right)\right)^n, &\notag
\end{align}
where we have used (\ref{eq:rcov_condition}) in the second step.
\end{proof}
\subsection{Proof of Theorem~\ref{thm:nestedlattice_listdecoding}}\label{sec:prf_constructiona_list}
If $ m_1,\ldots, m_\ell$ are linearly independent vectors in $\bFq^\kappa$, then $\psi( m_1),\ldots,\psi( m_\ell)$ are statistically independent and hence,
\begin{equation}
\Pr[\psi( m_1),\ldots,\psi( m_\ell)\in \cB(\vy,r)] \leq \left( \Pr[\psi(m)\in \cB(\vy,r)] \right)^\ell.
\label{eq:prf2}
\end{equation}
Every set of $L+1$ distinct vectors $ m_1,\ldots m_{L+1}$ in $\bFq^\kappa$ contains a subset of $\ell\coloneqq\log_q(L+1)$ linearly independent vectors.
\begin{align}
&\Pr[\psi( m_1),\ldots,\psi( m_{L+1})\in \cB(\vy,r)\text{ for some distinct } m_1,\ldots m_{L+1}]&\notag\\
\leq& \Pr[\psi( m_1),\ldots,\psi( m_{\ell})\in \cB(\vy,r)\text{ for some linearly independent } m_1,\ldots m_{\ell}]&\notag\\
\leq& \begin{pmatrix}2^{nR}\\ \ell\end{pmatrix} \Pr[\psi( m_1),\ldots,\psi( m_\ell)\in \cB(\vy,r)] &\label{eq:prf3}\\
\leq& 2^{nR\ell} \Pr[\psi( m_1),\ldots,\psi( m_\ell)\in \cB(\vy,r)],&\notag
\end{align}
where in (\ref{eq:prf3}), $ m_1,\ldots, m_\ell$ is a fixed (but arbitrary) set of linearly independent vectors in $\bFq^\kappa$. Using (\ref{eq:prf1}) and (\ref{eq:prf2}) in the above, we get
\begin{align}
&\Pr[\psi( m_1),\ldots,\psi( m_{L+1})\in \cB(\vy,r)\text{ for some distinct } m_1,\ldots m_{L+1}]&\notag\\
\leq& 2^{nR\ell}\left(\frac{r}{\sqrt{nP}} 2^{\delta/8}\left( 1+\frac{\rcov(\Lc)}{qr} \right)\right)^{n\ell},&\notag
\end{align}
and hence,
\begin{align}
&\frac{1}{n}\log_2\Pr[\psi( m_1),\ldots,\psi( m_{L+1})\in \cB(\vy,r)\text{ for some distinct } m_1,\ldots m_{L+1}]&\notag\\
\leq& \ell \left( R -\log_2\left(\frac{\sqrt{nP}}{r}\right) +\frac{\delta}{8}+\log_2\left( 1+\frac{\rcov(\Lc)}{qr} \right)\right).&\label{eq:prf4}
\end{align}
This suggests that if $R$ and $r$ are not too large, then for any fixed but arbitrary $\vy$, the probability that there are more than $L$ lattice points within distance $r$ of $\vy$ is small.
We want to show that this happens for every $\vy\in\bR^n$. First, observe that if $\vy\notin \cV(\Lc)+\cB(0,\sqrt{nN})$, then all codewords are at least $\sqrt{nN}$-away from $\vy$.
Therefore, it is enough to consider only those $\vy$ in $\cV(\Lc)+\cB(0,\sqrt{nN})$. A second observation is that if (for a positive integer $\alpha$) $Q(\vy)$ denotes the closest point in $\frac{1}{\alpha}\Lc$ to $\vy$,
then
\begin{align}
&\Pr[\psi( m_1),\ldots,\psi( m_{L+1})\in \cB(\vy,\sqrt{nN})\text{ for some distinct } m_1,\ldots m_{L+1}] &\notag\\
\leq& \Pr\left[\psi( m_1),\ldots,\psi( m_{L+1})\in \cB\left(Q(\vy),\sqrt{nN}+\frac{\rcov(\Lc)}{\alpha}\right)\text{ for some distinct } m_1,\ldots m_{L+1}\right].&\notag
\end{align}
The idea here is to quantize the $\vy$'s using $\frac{1}{\alpha}\Lc$ and then use a union bound. We want to make sure that $\alpha$ is sufficiently large, but not too large.
Specifically, $\alpha$ is the smallest integer greater than $\sqrt{P/N}/(2^{\delta/8}-1)$. Therefore, $\alpha$ satisfies
\begin{equation}
1+\frac{1}{\alpha}\sqrt{\frac{P}{N}} < 2^{\delta/8},
\label{eq:alphacondition_1}
\end{equation}
and
\begin{equation}
\alpha < \frac{\sqrt{P/N}}{(2^{\delta/8}-1)} + 2.
\label{eq:alphacondition_2}
\end{equation}
Letting $r=\sqrt{nN}+\frac{\rcov(\Lc)}{\alpha}$, we have
\begin{align}
&\Pr[\psi( m_1),\ldots,\psi( m_{L+1})\in \cB(\vy,\sqrt{nN})\text{ for some distinct } m_1,\ldots m_{L+1} \text{ and } \vy\in\bR^n] &\notag\\
=&\Pr[\psi( m_1),\ldots,\psi( m_{L+1})\in \cB(\vy,\sqrt{nN})\text{ for some distinct } m_1,\ldots m_{L+1} \text{ and } \vy\in\cV(\Lc)+\cB(0,\sqrt{nN})] &\notag\\
\leq& \Pr\left[\psi( m_1),\ldots,\psi( m_{L+1})\in \cB(\vy,r)\text{ for some distinct } m_1,\ldots m_{L+1} \text{ and } \vy\in\frac{1}{\alpha}\Lc\cap (\cV(\Lc)+\cB(0,\sqrt{nN}))\right]. &\notag
\end{align}
From (\ref{eq:rpack_condition}) and the fact that $P>N$, we have $\sqrt{nN}\leq \sqrt{nP}=\rcov(\Lc)\leq 4\rpack(\Lc)$. Therefore, $\cB(0,\sqrt{nN})\subset \cV(4\Lc)=4\cV(\Lc)$.
We can therefore take a union bound over $\frac{1}{\alpha}\Lc\cap(4\cV(\Lc))$ which gives us
\begin{align}
&\Pr[\Lf\cap\cV(\Lc)\text{ is not }(P,N,L)-\text{ list decodable}] &\notag \\
=&\Pr[\psi( m_1),\ldots,\psi( m_{L+1})\in \cB(\vy,\sqrt{nN})\text{ for some distinct } m_1,\ldots m_{L+1} \text{ and } \vy\in\bR^n] &\notag\\
\leq& \Pr\left[\psi( m_1),\ldots,\psi( m_{L+1})\in \cB(\vy,r)\text{ for some distinct } m_1,\ldots m_{L+1} \text{ and } \vy\in\frac{1}{\alpha}\Lc\cap (4\cV(\Lc))\right]. &\notag
\end{align}
Using (\ref{eq:prf4}) and applying the union bound over $\vy$'s, we have
\begin{align}
&\frac{1}{n}\log_2\Pr[\Lf\cap\cV(\Lc)\text{ is not }(P,N,L)-\text{ list decodable}] &\notag \\
\leq& \frac{1}{n}\log_2\left| \frac{1}{\alpha}\Lc\cap (4\cV(\Lc))\right| +\ell \left( R -\log_2\left(\frac{\sqrt{nP}}{r}\right) +\frac{\delta}{8}+\log_2\left( 1+\frac{\rcov(\Lc)}{qr} \right)\right).&\notag
\end{align}
Since $\left| \frac{1}{\alpha}\Lc\cap (4\cV(\Lc))\right|=(4\alpha)^n$ and $\frac{\rcov(\Lc)}{qr}=\frac{\sqrt{nP}}{qr}\leq \frac{\sqrt{nP}}{q\sqrt{nN}}$, we get
\begin{align}
&\frac{1}{n}\log_2\Pr[\Lf\cap\cV(\Lc)\text{ is not }(P,N,L)-\text{ list decodable}] &\notag \\
\leq& \log_2(4\alpha) +\ell \left( R -\log_2\left(\frac{\sqrt{nP}}{\sqrt{nN}+\rcov(\Lc)/\alpha}\right) +\frac{\delta}{8}+\log_2\left( 1+\frac{\sqrt{P}}{q\sqrt{N}} \right)\right)&\notag\\
\leq& \log_2(4\alpha) +\ell \left( R -\frac{1}{2}\log_2\left( \frac{P}{N} \right)+\log_2\left(1+\frac{\sqrt{P}}{\alpha\sqrt{N}}\right) +\frac{\delta}{8}+\log_2\left( 1+\frac{\sqrt{P}}{q\sqrt{N}} \right)\right)&\notag\\
\leq& \log_2(4\alpha) + \ell \left( -\delta +\log_2\left(1+\frac{\sqrt{P}}{\alpha\sqrt{N}}\right) +\frac{\delta}{8}+\log_2\left( 1+\frac{\sqrt{P}}{q\sqrt{N}} \right)\right).&\notag
\end{align}
Using (\ref{eq:alphacondition_1}) and (\ref{eq:prime_condition}),
\begin{align}
&\frac{1}{n}\log_2\Pr[\Lf\cap\cV(\Lc)\text{ is not }(P,N,L)-\text{ list decodable}] &\notag \\
\leq& \log_2(4\alpha) + \ell \left( -\delta +\frac{\delta}{8} +\frac{\delta}{8}+\frac{\delta}{8} \right)&\notag\\
=& \log_2(4\alpha) - 5\ell\frac{\delta}{8}. &\label{eq:prf5}
\end{align}
From (\ref{eq:prf5}), we can say that if $\ell>c_1\log_2(\alpha)/\delta$, the probability that a random lattice code is not list decodable goes to zero exponentially in $n$.
For $0<\delta<0.9$, there exist positive constants $c_2,c_3$ (that could depend on $P,N$ but not on $\delta$) so that $c_2\delta<2^{\delta/8}-1<c_3\delta$ and using (\ref{eq:alphacondition_2}), we can see that $\log_2(\alpha)\leq c_4\log_2\frac{1}{\delta}$
for some positive $c_4$. Likewise, using (\ref{eq:primecondition_2}), we can show that there exist $c_5,c_6$ such that $ c_5\log_2\frac{1}{\delta}\leq \log_2q\leq c_6\log_2\frac{1}{\delta}$
for $\delta\in (0,0.9)$. This implies that we can choose $L=q^{\ell}-1=2^{\ell\log_2q}-1$ to be less than $2^{\frac{c}{\delta}\log_2^2\frac{1}{\delta}}$ for a sufficiently large constant $c$, so that
the probability that a random nested lattice code is not $(P,N,L)$ list decodable goes to zero as $2^{-\Omega(n)}$. This concludes the proof of Theorem~\ref{thm:nestedlattice_listdecoding}. \qed
\section{Infinite constellations}\label{sec:ic}
We now direct our attention to infinite constellations. Recall that an infinite constellation $ \cC $ is a countably infinite subset of $ \bR^n $.
The effective radius of the infinite constellation is defined as the radius of the $n$-dimensional ball having volume equal to $ 1/\Delta(\cC) $.
\[ \reff(\cC) \coloneqq \left(\frac{1}{V_n\Delta(\cC)}\right)^{1/n} \]
where $ V_n $ denotes the volume of a unit $n$-ball.
Let $ \alpha>0 $. We allow $ \alpha $ to be a function of $ n $. Define $ \cA\coloneqq [0,\alpha)^n $.
We will study infinite constellations of the form $ \cC = \cC'+\alpha\bZ^n $ for finite sets $ \cC'\subset \cA $.
In other words, $ \cC $ is obtained by tiling a finite subset of points from within a cube. See Fig. \ref{fig:ic} for a pictorial illustration of the construction of such an IC ensemble. Since the IC is a tiling, it suffices to study finite sets of points in the space $ \bR^n\bmod \cA $.~\footnote{Since $ \alpha \bZ^n $ is a lattice, the definition of $ [\cdot]\bmod\cA $ makes sense.}
For any set $ \cD\subset\bR^n $, define $ \cD^*\coloneqq \cD\bmod\cA $.
Note that if $ \cC' $ forms a group with respect to addition modulo $ \cA $, then the resulting IC is a lattice. Construction-A lattices are essentially obtained by taking $ \cC' $ as an embedding of a linear code over a finite field into $ \cA $.
\begin{figure}
\begin{center}
\includegraphics[width=9cm]{infinite_constellation.pdf}
\caption{Illustration of the class of infinite constellations studied in this paper.}
\label{fig:ic}
\end{center}
\end{figure}
\subsection{List decodability of random Construction-A lattices}~\label{sec:listdecoding_infiniteconstA}
We claim that list decodability of nested Construction-A lattice codes implies a list decoding result for infinite Construction-A lattices.
\begin{lemma}
Let $ (\Lc,\Lf) $ be a pair of nested lattices with $ \Lc\subset\Lf $. Suppose that the nested lattice code $ \Lf\cap\cV(\Lc) $ is $ (P,N,L) $-list decodable. Then, the infinite lattice $ \Lf $ is $ (N,L) $-list decodable.
\label{lemma:nestedld_implies_ldlattice}
\end{lemma}
\begin{proof}
The infinite lattice $ \Lf $ is $ (N,L) $-list decodable if for every $ \vy\in\bR^n $, we have $ \Lf\cap\cB(\vy,\sqrt{nN})\leq L $. Due to the periodic structure of $ \Lf $, we have the property that $\{\vx+\cV(\Lf):\vx\in\Lf\} $ forms a partition of $ \bR^n $. Therefore, it suffices to show that $ \Lf\cap\cB(\vy,\sqrt{nN})\leq L $ for all $ \vy\in\cV(\Lf) $ in order to prove $ (N,L) $ list decodability of $ \Lf $.
But we already have this from the list decodability of $ \Lf\cap\cV(\Lc) $. Since $ \cV(\Lf)\subset\cV(\Lc) $, $(P,N,L)$-list decodability of $ \Lf\cap\cV(\Lc) $ implies $ (N,L) $-list decodability of $ \Lf $.
\end{proof}
Using Lemma~\ref{lemma:nestedld_implies_ldlattice} and Theorem~\ref{thm:nestedconstructiona_listsize}, we have
\begin{theorem}
Let $ \Lf $ be a random Construction-A lattice drawn from the ensemble of Sec.~\ref{sec:nestedlatticeensemble} with $ \Lc $ having covering radius $ 2\sqrt{nN} $. Then, there exists a constant $ c>0 $ independent of $ n,\delta $ such that as long as $ \reff(\Lf)>\sqrt{nN}2^{\delta} $,
\[
\Pr[\Lf \text{ is not }(N,2^{c\frac{1}{\delta}\log^2\frac{1}{\delta}})\text{-list decodable}] = o(1).
\]
\end{theorem}
\begin{proof}
Fix $ P=2\sqrt{nN}$. Since $ \Lc $ is good for covering, we have $ \reff(\Lc)\geq \rcov(\Lc)2^{\delta/8}=2^{1+\delta/8}\sqrt{nN} $.
We know that $ \Lf\cap\cV(\Lc) $ is $ (P,N,2^{\cO(\frac{1}{\delta}\log^2\frac{1}{\delta})}) $-list decodable, where the implied constant can only depend on $ N $. From Lemma~\ref{lemma:nestedld_implies_ldlattice}, we know that $ \Lf $ is also $ (N,2^{\cO(\frac{1}{\delta}\log^2\frac{1}{\delta})}) $-list decodable. To complete the proof, it suffices to show that $ \reff(\Lf)\geq \sqrt{nN}2^{\Theta(\delta)} $.
The rate of the nested lattice code
\begin{align*}
R=& \frac{1}{n}\log\frac{\vol(\cV(\Lc))}{\vol(\cV(\Lf))}\\
=&\frac{\reff(\Lc)}{\reff(\Lf)}\\
\geq& \log\frac{2^{1+\delta/8}\sqrt{nN}}{\reff(\Lf)}.
\end{align*}
Using the fact that $ R=\frac{1}{2}\log\frac{P}{N}-\delta=\frac{1}{2}-\delta $ and substituting in the above, we get
\[
\frac{1}{2}-\delta \geq \log\frac{2^{1+\delta/8}\sqrt{nN}}{\reff(\Lf)},
\]
or
\[
\reff(\Lf) \geq \sqrt{nN}2^{7\delta/8}.
\]
This completes the proof.
\end{proof}
\subsection{Remark}
We proved the above theorem for the random infinite lattice $ \bfG_{\Lc}\Lf'(\cC_\lin) $, where $ \Lf'(\cC_\lin) $ is the ``standard'' Construction-A lattice obtained from a random linear code $ \cC_\lin $, and $ \bfG_{\Lc} $ is a generator matrix of the coarse lattice. We could have instead proved a similar list decoding result for $ \Lf'(\cC_\lin) $ by following the same approach as in Sec.~\ref{sec:ld_constr_a}, but instead taking a union bound on $ \vy $'s within $ q\bZ^n $. Doing so would also give a list size of $ 2^{\cO(\frac{1}{\delta}\log^2\frac{1}{\delta})} $ for all $ \sqrt{nN}\leq\reff(\Lf'(\cC_\lin))2^{-\delta} $.
Similarly, for lattice codes, via essentially the same arguments, it can be shown that nested random Construction-A lattice codes ${\frac{1}{\alpha}\Lambda'(\cC_\lin)\cap\Lambda'(\cC_\lin)}$ and random Construction-A lattices with ball shaping $\frac{1}{\alpha}\Lambda'(\cC_\lin)\cap\cB(0,\sqrt{nP})$ for proper scaling $1/\alpha$ so as to achieve rate $\frac{1}{2}\log\frac{P}{N}-\delta$ are also $(P,N,2^{\cO\paren{\frac{1}{\delta}\log^2\frac{1}{\delta}}})$-list decodable whp.
\section{An ensemble of regular infinite constellations}~\label{sec:regular_ic}
Having established a list decoding result for infinite lattices, we now turn to the problem of determining optimal list sizes for infinite constellations. Do there exist ICs $ \cC $ for which the list size is at most $ \cO(\poly(1/\delta)) $ for all $ \sqrt{nN}\leq 2^{-\delta}\reff(\cC) $?
To study this, we define an ensemble of periodic infinite constellations. We call this an $ (\alpha, M) $ infinite constellation (IC). An $(\alpha,M)$ random IC $ \cC $ is obtained by selecting $ M $ points $ \cC'=\{\vbfx_1,\ldots,\vbfx_M\} $ independently and uniformly at random from $\cA= [0,\alpha)^n $ and then tiling. Therefore, $ \cC = \cC'+\alpha \bZ^n $.
The reason why we introduce this new class of ICs is because it is very simple to work with. We can very easily prove several nice properties that would be otherwise complicated for random lattices. We feel that this is a natural counterpart of uniformly random codes over finite fields. Moreover, we can obtain a code for the power-constrained channel by taking the intersection of the IC with $ \cB(0,\sqrt{nP}) $.
The following is a simple application of Chernoff bound, and can be used to tightly concentrate the rate of a power-constrained code.
\begin{lemma}
Let $ \alpha>2\sqrt{nN} $. Let $ \cC $ be an $ (\alpha, M) $ random IC, where $ M $ is chosen so that $ \reff(\cC) =\Theta(\sqrt{nN})$. Then, for every $ \delta>0 $,
\[
\Pr\left[|\cC\cap \cB(0,\sqrt{nP})|<\left(\frac{\sqrt{nP}}{\reff(
\cC)}\right)^{n}(1-\delta)\right] < 2^{-\Omega(\delta^2 n)}.
\]
\label{lemma:randomic_ball}
\end{lemma}
\subsection{List decoding: upper bound on list size}
We now study list decodability properties of $ (\alpha, M) $ random ICs.
An infinite constellation $\cC$ is $ (N,L) $ list decodable if for every $ \vy\in\bR^n $, we have $ |\cC\cap\cB(\vy,\sqrt{nN})|\leq L $.
\begin{proposition}
Fix $ \delta>0 $ small. For any $ N>0$, a random $ (4\sqrt{nN}, M) $ constellation with $ M $ chosen so as to satisfy $ \reff/\sqrt{nN}>2^{\delta} $ is $ (N,\cO(\frac{1}{\delta}\log\frac{1}{\delta})) $-list decodable with probability $ 1-2^{-\Theta(n)} $.
\label{prop:ic_listupperbound}
\end{proposition}
\begin{proof}
Fix $ \alpha=4\sqrt{nN} $. We will show that random ICs are list decodable with constant list sizes as long as $ \reff/\sqrt{nN}>1 $.
The proof is quite standard so we only give a brief outline. Fix an $ \delta>0 $, and choose $ M $ such that $ \reff = \sqrt{nN}2^{\delta} $. Choose $ \eps=\sqrt{nN}\delta/3 $, and define $\cY=\cA\cap\eps\bZ^n$. This will be used to define an epsilon net for the centers of the noise ball.
Fix any $ \vy\in\cY $, and let $ \cB^*(\vy,r)= [\cB(\vy,r)]\bmod\alpha\bZ^n $.
\begin{align*}
\Pr[\exists L+1 \text{ codewords in }\cB^*(\vy,\sqrt{nN}+\eps)] &\leq \begin{pmatrix}
M\\L+1
\end{pmatrix} \left(\frac{\vol(\cB(0,\sqrt{nN}+\eps))}{\alpha^n}\right)^{L+1} \\
&\leq \left(M\frac{\vol(\cB(0,\sqrt{nN}+\eps))}{\alpha^n}\right)^{L+1}\\
&=\left(\frac{\sqrt{nN}+\eps}{\reff}\right)^{n(L+1)}\\
&=\left(\frac{1+\eps/\sqrt{nN}}{2^{\delta}}\right)^{n(L+1)}\\
&=\left(\frac{1+\delta/3}{2^{\delta}}\right)^{n(L+1)}.
\end{align*}
We now take a union bound on $\vy $.
\begin{align*}
\Pr[\text{The IC is not } (L,N)\text{ list-decodable} ] &\leq \Pr[\exists L+1 \text{ codewords in }\cB^*(\vy,\sqrt{nN}+\eps) \text{ for some }\vy]\\
&\leq \sum_{\vy}\Pr[\exists L+1 \text{ codewords in }\cB^*(\vy,\sqrt{nN}+\eps)]\\
&\leq \left( \frac{\alpha}{\eps} \right)^n\left(\frac{1+\delta/3}{2^{\delta}}\right)^{n(L+1)}\\
&=\left( \frac{3}{\delta} \right)^n\left(\frac{1+\delta/3}{2^{\delta}}\right)^{n(L+1)}\\
&\leq \exp_2\left(-n\left( (L+1)\delta -(L+1)\log_2(1+\delta/3) +\log_2(\delta/12) \right)\right)\\
&\leq \exp_2\left(-n\left( (L+1)\delta/3 + \log_2(\delta/12) \right)\right),
\end{align*}
where in the last step, we have used the fact that $\log(1+x)\leq 2x$ for $ x\in(0,1) $. Therefore, the random IC is list decodable with probability $1-2^{-\Theta(n)}$ as long as
\[
(L+1)\frac{\delta}{3} +\log_2\frac{\delta}{12} >0,
\]
or
\[
L+1>\frac{3}{\delta}\log_2\frac{12}{\delta}.
\]
This completes the proof.
\end{proof}
\subsection{List size lower bound for random infinite constellations}
\begin{lemma}
Let $ \cC $ be an $(\alpha, M)$ random IC chosen so as to satisfy $ \reff(\cC)/\sqrt{nN}=2^{\delta} $. Then,
\[
\prob{\cC\text{ is }\cO\paren{\frac{1}{\delta}\log\frac{1}{\delta}}\text{-list decodable}} = o(1).
\]
\label{lemma:randomic_listlowerbound}
\end{lemma}
\begin{proof}
The proof is almost identical to that of Proposition~\ref{prop:lbound_randomspherical}. We only outline the difference here.
Define $\cC\coloneqq\cC'+\alpha\bZ^n$, where $\cA\coloneqq[0,\alpha)^n$ and $\cC'\subset\cA$ is a set of $M$ uniformly random and independent points $\vbfx_1,\cdots,\vbfx_M$ in $\cA$. Let
\begin{equation}
\reff/\sqrt{nN}=\paren{V_nM/\alpha^n}^{-1/n}/\sqrt{nN}=2^\delta,
\label{eqn:reff}
\end{equation}
for some small positive $\delta$.
Define the random variable
\begin{equation}
W\coloneqq\sum_{\vy\in\cA\cap\eps\bZ^n}\sum_{\curbrkt{m_1,\cdots,m_L}\in\binom{\cM}{L}}\one{\vbfx_{m_1},\cdots,\vbfx_{m_L}\in\cB^*\paren{\vy,\sqrt{nN}}},
\label{eqn:w_ic}
\end{equation}
where we use the following notation
\[\cB^*\paren{\cdot,\cdot}\coloneqq[\cB\paren{\cdot,\cdot}]\bmod\alpha\bZ^n.\]
We will upper bound
\begin{align}
\prob{\cC\text{ is not list decodable}}\le&\prob{\bigcap_{\vy\in\eps\bZ^n}\curbrkt{\card{\cC\cap\cB\paren{\vy,\sqrt{nN}}}\le L}}\notag\\
=&\prob{\bigcap_{\vy\in\cA\cap\eps\bZ^n}\curbrkt{\card{\cC'\cap\cB^*\paren{\vy,\sqrt{nN}}}\le L}},\notag\\
\le&\var{W}/\expt{W}^2.\notag
\end{align}
\subsubsection{Lower bounding $\expt{W}$}
It turns out that the expectation
\begin{align}
\expt{W}=&\sum_{\vy\in\cA\cap\eps\bZ^n}\sum_{\cL\in\binom{\cM}{L}}\prob{\vbfx_{\cL}\subset\cB^*\paren{\vy,\sqrt{nN}}},\label{eqn:expectation_ic}
\end{align}
where $\vbfx_\cL\coloneqq\curbrkt{\vbfx_m\colon m\in\cL}$, can be computed precisely.
Note that
\[\card{\cA\cap\eps\bZ^n}=\paren{\alpha/\eps}^n,\]
and the number of $\cL$ of size $L$ is
\[\binom{M}{L}\ge\paren{M/L}^L.\]
The probability in the summand of the right-hand side (RHS) of \ref{eqn:expectation_ic} is exactly
\begin{align}
\mu^L\coloneqq\paren{\frac{\vol\paren{\cB^*\paren{\vy,\sqrt{nN}}}}{\vol\paren{\cA}}}^L=\paren{\frac{\vol\paren{\cB^n\paren{\sqrt{nN}}}}{\alpha^n}}^L.\notag
\end{align}
Overall the expectation in Eqn. \ref{eqn:expectation_ic} is equal to
\begin{align}
\expt{W}=&\paren{\alpha/\eps}^n\paren{M/L}^L\paren{\frac{\vol\paren{\cB^n\paren{\sqrt{nN}}}}{\alpha^n}}^L\notag\\
=&\paren{\alpha/\eps}^nL^{-L}\paren{\frac{M\vol\paren{\cB^n\paren{\sqrt{nN}}}}{\alpha^n}}^L\notag\\
=&\paren{\alpha/\eps}^nL^{-L}\paren{\sqrt{nN}/\reff}^{nL}\notag\\
=&\paren{\alpha/\eps}^nL^{-L}2^{-n\delta L}.\notag
\end{align}
\subsubsection{Upper bounding $\var{W}$}
$\cE_1,\cE_2$ and $\cE_3$ are similarly defined and their probabilities are similarly bounded.
\begin{align}
\prob{\cE_1}=&\paren{\frac{\card{\cB^*\paren{\vbfx_{m},\sqrt{nN}}\cap\eps\bZ^n}}{\card{\cA\cap\eps\bZ^n}}}^2\eqqcolon\eta^2,\notag\\
\prob{\cE_2\cap\cE_3|\cE_1}\le&\mu^{2L-\ell-1}.\notag
\end{align}
To estimate $\eta$, we invoke the following well-known bounds \cite{ordentlich-erez-2016} on the number of integer points in a ball.
\begin{lemma}[\cite{ordentlich-erez-2016}, Lemma 1]
For any $\vy\in\bR^n$ and $r>\sqrt{n}/2$,
\[\paren{r-\sqrt{n}/2}^nV_n\le\card{\cB^n\paren{\vy,r}\cap\bZ^n}\le\paren{r+\sqrt{n}/2}^nV_n.\]
\end{lemma}
Applying the above lemma to $\eta$, we have
\begin{align}
\eta\le&\frac{\card{\cB^n\paren{\sqrt{nN}}\cap\eps\bZ^n}}{\card{\cA\cap\eps\bZ^n}}\notag\\
\le&\frac{\paren{\sqrt{nN}/\eps+\sqrt{n}/2}^nV_n}{\paren{\alpha/\eps}^n}\notag\\
=&\paren{\frac{\sqrt{nN}+\sqrt{n}\eps/2}{\alpha}}^nV_n.\notag
\end{align}
Overall we have
\begin{align}
\var{W}\le&\card{\cA\cap\eps\bZ^n}^2\sum_{\ell=1}^LM^{2L-\ell}\eta^2\mu^{2L-\ell-1}\notag\\
=&\paren{\alpha/\eps}^{2n}\sum_{\ell=1}^LM\eta^2\paren{M\mu}^{2L-\ell-1}\notag\\
=&\paren{\alpha/\eps}^{2n}\sum_{\ell=1}^LM\eta^22^{-n\delta\paren{2L-\ell-1}}\notag\\
\le&\paren{\alpha/\eps}^{2n}LM\eta^22^{-n\delta\paren{L-1}}.\notag
\end{align}
\subsubsection{Wrapping things up}
Set $\alpha=4\sqrt{nN}$ and $\eps=\sqrt{cN}n^{1/4}$ for some positive constant $c$ to be specified in a moment. Then $M=2^{\paren{2-\delta}n}/V_n$ by Eqn. \ref{eqn:reff}. The probability that a random infinite constellation is list decodable is at most
\begin{align}
\frac{LM\eta^22^{-n\delta\paren{L-1}}}{L^{-2L}2^{-2n\delta L}}=&L^{2L+1}\frac{2^{\paren{2-\delta}n}}{V_n}\paren{\frac{\sqrt{nN}+\sqrt{n}\eps/2}{\alpha}}^{2n}V_n^22^{n\delta\paren{L+1}}\notag\\
\asymp&\frac{L^{2L+1}}{\sqrt{\pi n}}\sqrbrkt{\frac{\sqrt{2\pi e}}{\sqrt{n}}\paren{\frac{\sqrt{nN}+\sqrt{n}\eps/2}{\alpha}}^2}^n2^{n\paren{\delta L+2}}\notag\\
=&\frac{L^{2L+1}}{\sqrt{\pi n}}\sqrbrkt{\frac{\sqrt{2\pi e}}{16\sqrt{n}}\paren{1+\sqrt{c}n^{1/4}/2}^2}^n2^{n\paren{\delta L+2}}\notag\\
\le&\frac{L^{2L+1}}{\sqrt{\pi n}}\paren{\frac{\sqrt{2\pi e}}{16}c}^n2^{n\paren{\delta L+2}}\notag\\
=&\frac{L^{2L+1}}{\sqrt{\pi n}}2^{n\paren{\delta L+\log\delta}},\label{eqn:set_const}
\end{align}
where in Eqn. \ref{eqn:set_const}, we set $c=4\delta/\sqrt{2\pi e}$. Now we see that if $L<\frac{1}{\delta}\log\frac{1}{\delta}$, $\cC$ is list decodable with vanishing probability. We get the desired lower bound on list size $L=\Omega\paren{\frac{1}{\delta}\log\frac{1}{\delta}}$ which matches the achievability result.
\end{proof}
\subsection{Other goodness properties}
The random ICs defined in this section have other interesting geometric properties which are much harder to prove for lattices \cite{erez2005lattices}, for instance, packing goodness and AWGN goodness. See Appendix \ref{sec:ic_goodness} for statements and proofs.
\section{Conditional upper bounds on the list sizes of Haar lattices}\label{sec:haar_cond_results}
\subsection{Haar measure on $\sL_n$}\label{sec:haar_meas_on_lattices}
Let us back up a little bit and ask ourselves: what do we mean by a \emph{random} lattice? To sample a random lattice from certain ensemble, we need to define a distribution on the set of all lattices. As we know, a lattice is specified by its generator matrix and thus it suffices to define a distribution over matrices. There are several ensembles of matrices extensively studied in the literature of random matrix theory. Such ensembles including Gaussian ensemble, Bernoulli ensemble, etc., \cite{tao-2012-rand-mat-thy} are mostly defined by sampling entries iid from simple distributions. However, we believe that such ensembles will \emph{not} give rise to interesting lattices, in the sense that the resulting lattices are not likely to have nontrivial packing and covering efficiency simultaneously.
Let us give some heuristic arguments to support our statement.
Suppose that we sample an $n$ by $n$ random matrix $\bfG$ over $\bR$ by sampling each entry iid according to $\cN(0,\sigma^2)$ for some fixed constant deviation $\sigma>0$. By the high-dimensional geometry of Gaussian random vectors, each column of $\bfG$ has 2-norm highly concentrated around $\sqrt{n\sigma^2}$ and is approximately orthogonal to other columns. That is to say, the columns $\{\vbfg_1,\cdots,\vbfg_n\}$ are basically a mildly perturbed version of the standard orthonormal basis $\{\ve_1,\cdots,\ve_n\}$ scaled by $\sqrt{n\sigma^2}$ (and also potentially rotated, which does not affect most goodness properties we are interested in of the resulting lattices). The lattice $\bfG\bZ^n$ cannot be good for packing whp since we know $\bZ^n$ (and also its scaling and rotation) has vanishing packing efficiency $\asymp\sqrt{\frac{\pi e}{2n}}$ as the dimension $n$ tends to infinity. Indeed, there is not much study on lattices resulting from those canonical matrix ensembles. One can find related results along this direction in \cite{neelamani-dash-sanjeeb-baraniuk-2007-nearly-ortho-rand-lattice}. Not surprisingly, it boils down to understanding the singular value spectrum of $\bfG$.
In the case of finite fields, it is known that a \emph{uniformly random} linear code has good list decoding properties. It would therefore be a natural choice to study a random lattice drawn uniformly over the set of all lattices of a fixed determinant. This has been studied in the literature and has several useful properties, but can be quite complicated to analyze.
In the following section, we introduce the Haar distribution over lattices, and survey some of the important results. For small enough subsets $ \cB $ of $ \bR^n $, we conjecture that the distribution of the number of lattice points (which is a random variable if the lattice is drawn according to the Haar distribution) in $ \cB $ looks like a Poisson distribution. Expressions for the first $ o(n) $ moments of the number of points have been derived in the literature, and we use these results to make a conjecture about the first $\cO(n)$ moments. We then show that if this conjecture is true, then Haar lattices achieve $ \poly(1/\delta) $ list sizes.
\section{A survey of results on the Haar distribution over unit determinant lattices}\label{sec:haarlattice_introduction}
Let us first recall the relevant background with an introduction to Haar distribution on the set of all lattices.
A more detailed exposition of this material can be found in the thesis of Kim~\cite{kim2015thesis}.
For the convenience of illustration, let us collect all lattices $\Lambda\subset\bR^n$ with covolume normalized to one into a set $\sL_n$.
\[\sL_n\coloneqq\curbrkt{\Lambda\le\bR^n\text{ lattice}\colon \det(\Lambda)=1}.\]
A lattice in $\sL_n$ is specified by its generator matrix $\bfG\in\speclin(n,\bR)$. However, one lattice $\Lambda$ can have multiple different generator matrices. Indeed, two matrices $\bfG$ and $\wt \bfG$ give rise to the same lattice iff they differ by a $\speclin(n,\bZ)$ matrix, i.e., $\bfG \bfG'=\wt \bfG$ where $\bfG'\in\speclin(n,\bZ)$. Hence $\sL_n$ can be identified with the quotient space $\speclin(n,\bR)$ by $\speclin(n,\bZ)$.
\[\sL_n=\speclin(n,R)/\speclin(n,\bZ).\]
Crucial to us is Haar's seminal result on the existence of \emph{Haar measure} on any locally compact topological group. Specialized to our setting, it was shown by Siegel \cite{siegel-1945-first-order-avg-formula-haar} the existence and finiteness of certain nicely-behaving distribution on $\sL_n$.
\begin{theorem}[\cite{siegel-1945-first-order-avg-formula-haar}]\label{thm:haar_slnr}
There is a unique (up to a multiplicative constant factor) measure $\mu$ (called \emph{Haar} measure) on $\speclin(n,\bR)$ which satisfies the following properties.
\begin{enumerate}
\item\label{itm:haar_inv} $\mu$ is left-$\speclin(n,\bR)$-invariant. For any Borel subset $\cK\subseteq\speclin(n,\bR)$ and any $\bfG\in\speclin(n,\bR)$, $\mu(\cK)=\mu(\bfG\cK)$.
\item\label{itm:haar_finite} $\mu$ is finite. For any compact subset $\cK\subseteq\speclin(n,\bR)$, $\mu(\cK)<\infty$.
\end{enumerate}
\end{theorem}
Note that we can normalize the Haar measure $\mu$ to make it a probability distribution, i.e., $\mu(\speclin(n,\bR))=1$. In this paper we always refer to the normalized one when talking about $\mu$ or Haar measure. The Haar distribution on the quotient space naturally inherits that on $\speclin(n,\bR)$. We do not specify measure-theoretic details which can be found in, e.g., \cite{quint-2013-dynamical-sys-on-homo-sp}. With abuse of notation we use the same notation $\mu$ for Haar measure on $\speclin(n,\bR)$ and the induced Haar measure on its quotient. Most of the time we refer to the former one which will be clear from the context.
The above result only provides the existence and features of the Haar measure but does not provide an explicit form of this measure. What does the Haar measure $\mu$ on $\speclin(n,\bR)$ look like? It can be checked that the Lebesgue measure on $\bR^{n^2}$ already satisfies the properties \ref{itm:haar_inv} and \ref{itm:haar_finite} required in the definition of Haar measure. Given any measure, besides that we can use it to measure a compact subset of the space, we can also integrate functions on the same space against this measure. Since Haar measure is unique, we know that for $\bfG\in\speclin(n,\bR)$, \[\diff\mu(\bfG)=\diff\vect{\bfG}.\] Namely, the Haar measure of a matrix in $\speclin(n,\bR)$ is the equal to the Lebesgue measure of it when viewed as a vector in $\bR^{n^2}$.
As a byproduct of the above reasoning, we also know that the Haar measure on $\genlin\paren{n,\bR}$ is just the normalized Lebesgue measure on $\bR^{n^2}$. For $\bfG\in\genlin\paren{n,\bR}$,
\[\diff\mu\paren{\bfG}=\frac{\diff {\vect{\bfG}}}{\det\paren{\bfG}^{1/n}}.\]
It is a valid definition since
\[\det\paren{\frac{\bfG}{\det(\bfG)^{1/n}}}=\paren{\frac{1}{\det(\bfG)^{1/n}}}^n\det(\bfG)=1,\]
and the definition is reduced to the one on $\speclin(n,\bR)$.
Here with a bit of abuse of notation, we use the same notation for Haar measure on special linear group and general linear group.
One may resort to Iwasawa (KAN) decomposition \cite{quint-2013-dynamical-sys-on-homo-sp} for a more explicit characterization of Haar measure.
\subsection{Siegel's and Rogers' averaging formulas}\label{sec:siegel_rogers_avg_formulas}
Let us first recall two fundamental averaging formulas which are heavily used in the literature for understanding the distribution of short vectors of a random lattice drawn from Haar distribution.
In the same seminal paper \cite{siegel-1945-first-order-avg-formula-haar} in which Siegel showed the existence and uniqueness of Haar distribution on the space of unit-covolume lattices, he also proved the following averaging formula.
\begin{theorem}[\cite{siegel-1945-first-order-avg-formula-haar}]\label{thm:first-order-avg-formula}
Let $\rho:\bR^n\to\bR$ be a bounded, measurable, compactly supported function. Then
\begin{equation}
\exptover{\Lambda\sim\mu}{\sum_{\vx\in\Lambda\setminus\{0\}}\rho(\vx)}=\int_{\sL_n}\sum_{\vx\in\Lambda\setminus\{0\}}\rho(\vx)\diff \mu(\Lambda)=\int_{\bR^n}\rho(\vx)\diff \vx.
\label{eqn:first-order-avg-formula}
\end{equation}
\end{theorem}
\begin{remark}
The requirement that we are allowed to evaluate the function $\rho$ only at nonzero lattice points could potentially be problematic. One can drop this condition by paying an extra term, i.e., the value of $\rho$ at the origin, on the RHS of \ref{eqn:first-order-avg-formula} and the formula becomes
\begin{equation}
\exptover{\Lambda\sim\mu}{\sum_{\vx\in\Lambda}\rho(\vx)}=\int_{\sL_n}\sum_{\vx\in\Lambda}\rho(\vx)\diff \mu(\Lambda)=\rho(0)+\int_{\bR^n}\rho(\vx)\diff \vx.
\label{eqn:first-order-avg-formula-alternate}
\end{equation}
These two forms are completely equivalent and we will state only one of them but potentially use any of them depending on whichever is convenient without further explanation.
\end{remark}
The identity holds in large generality for any reasonably nice function $\rho$'s. Perhaps the most important consequence of this formula is that it gives a way to estimate the number of lattice points in a measurable set, which is in turn an ubiquitous primitive in applications. Specifically, for our list decoding purposes, essentially the only thing we need to control is the number of lattice points in a ball. If we take
\[\rho(\vx)\coloneqq\one{\vx\in\cB(\vy,r)}\] to be the indicator function of an Euclidean ball centered at $\vy$ of radius $r$ which obviously satisfies the conditions required by the theorem, then the left-hand side (LHS) of \ref{eqn:first-order-avg-formula} is nothing but the expected number of nonzero Haar lattice points in the ball. Siegel's formula tells us that this is equal to the RHS of \ref{eqn:first-order-avg-formula} which is actually the volume of the ball. This matches our intuition that roughly speaking the number of lattice points in any measurable $\cB$ set should be roughly the ratio between the volume of the set and the volume of a Voronoi cell of the lattice which is $\vol(\cB)/\det(\Lambda)=\vol(\cB)$ since we consider normalized lattices. Siegel's formula indicates that Haar distribution on $\sL_n$ behaves typically in a sense that such intuition is indeed true in expectation.
For a lattice $ \Lf\sim\sL_n $, if we define the lattice code $ \cC $ to be $ \Lf\cap \cB(0,\sqrt{nP}) $, then the above theorem lets us conclude that the average rate
\[
\bE_{\Lf}\left[\frac{1}{n}\log|\cC|\right] = \frac{1}{2}\log P +o(1).
\]
It turns out there is a higher order generalization of Siegel's formula due to Rogers \cite{rogers-1955-haar-equiv-ensemble} which we introduce now.
\begin{theorem}[\cite{rogers-1955-haar-equiv-ensemble}, Theorem 4]\label{thm:higher-order-avg-formula}
Let $k<n$ be a positive integer. Let
\begin{equation*}
\begin{array}{rlll}
\rho\colon & (\bR^n)^k & \to & \bR
\end{array}
\end{equation*}
be a {bounded Borel measurable} function {with compact support}. Then
\begin{align}\label{eqn:higher-order-avg-formula}
\exptover{\Lambda\sim\mu}{\sum_{\vx_1,\cdots,\vx_k\in\Lambda}\rho(\vx_1,\cdots,\vx_k)}=&\int_{\sL_n}\sum_{\vx_1,\cdots,\vx_k\in\Lambda}\rho\paren{\vx_1,\cdots,\vx_k}\diff\mu\paren{\Lambda}\\\notag
=&\rho\paren{0,\cdots,0}+\int_{\bR^n}\cdots\int_{\bR^n}\rho\paren{\vx_1,\cdots,\vx_k}\diff \vx_1\cdots\diff \vx_k+\cE,\notag
\end{align}
where $\cE$ is some crazy-looking error term.
\begin{align*}
\cE\coloneqq\sum_{(\alpha,\beta)}\sum_{\ell=1}^\infty\sum_{\bfD}\paren{\frac{e_1}{\ell}\cdots\frac{e_m}{\ell}}^n\int_{\bR^n}\cdots\int_{\bR^n}\rho\paren{\sum_{i=1}^m\frac{\bfD_{i1}}{\ell}\vx_i,\cdots,\sum_{i=1}^m\frac{\bfD_{ik}}{\ell}\vx_i}\diff \vx_1\cdots\diff\vx_m.
\end{align*}
Here the first sum is over all partitions $(\alpha,\beta)=(\alpha_1,\cdots,\alpha_m;\beta_1,\cdots,\beta_{k-m})$ of the numbers $1,\cdots,k$ into two sequences $1\le\alpha_1<\cdots<\alpha_m\le k$ and $1\le\beta_1<\cdots<\beta_{k-m}\le k$ with $1\le m\le k-1$; of course $\alpha_i\ne\beta_j$ for any $i,j$. The third sum is taken over all integral $m\times k$ matrices $\bfD\in\bZ^{m\times k}$ such that
\begin{enumerate}
\item no column of $\bfD$ vanishes;
\item the greatest common divisor of all entries is 1;
\item for all $i\in[m],s\in[m],t\in[k-m]$, $\bfD_{i\alpha_s}=\ell\one{i=s}$ and $\bfD_{i\beta_t}=0$ if $\beta_t<\alpha_i$.
\end{enumerate}
Finally, $e_i=(\gamma_i,\ell)$, where $\gamma_1,\cdots,\gamma_m$ are the elementary divisors of $\bfD$.
\end{theorem}
However, once again,
if we take
\[\rho\paren{\vx_1,\cdots,\vx_k}\coloneqq\one{\vx_1\in\cB}\cdots\one{\vx_k\in\cB},\]
where $\cB\coloneqq\cB(\vy,r)$ is a ball, then Rogers' formula is precisely computing \[\exptover{\Lambda\sim\mu}{\card{\Lambda\cap\cB}^k}\] for $1\le k\le n-1$.
The proof of Rogers' averaging formula is highly nontrivial and can be divided into three steps. Since the proof contains several ingenious ideas and can be guiding for other purposes, we sketch it below.
\noindent\textbf{Step I.} Consider any real-valued bounded Borel measurable function of bounded support on unit-covolume lattices,
\[\begin{array}{rlll}
f:&\sL_n&\to &\bR.
\end{array}\]
We will interchangeably think $f$ as a function on $\speclin\paren{n,\bR}$,
\[\begin{array}{rlll}
f:&\speclin\paren{n,\bR}&\to &\bR.
\end{array}\]
We will interchangeably think $\Lambda$ as a lattice or its generator matrix. $f$ can be naturally extended from $\speclin\paren{n,\bR}$ to $\genlin\paren{n,\bR}$ by defining, for $\Lambda\in\genlin\paren{n,\bR}$,
\begin{equation}
f\paren{\Lambda}\coloneqq f|_{\speclin(n,\bR)}\paren{\det\paren{\Lambda}^{-1/n}\Lambda}.
\label{eqn:def_extension}
\end{equation}
Note that $\det\paren{\Lambda}^{-1/n}\Lambda$ always has determinant one.
Fix $\omega\in\bR_{>0}$. Let $\bfTheta=\bfTheta\paren{\theta_1,\cdots,\theta_{n-1},\omega}\in \bR^{n\times n}$ be drawn from the following ensemble
\begin{equation}
\begin{bmatrix}
\omega&&&&\\
&\omega&&&\\
&&\ddots&&\\
&&&\omega&\\
\omega^{-(n-1)}\theta_1&\omega^{-(n-1)}\theta_2&\cdots&\omega^{-(n-1)}\theta_{n-1}&\omega^{-(n-1)}
\end{bmatrix},
\label{eqn:rogers_ensemble}
\end{equation}
where each ${\theta}_i\sim \cU\paren{[0,1]}$. Note that any matrix of the above form has determinant one.
\begin{remark}
The reason behind the choice of this simple-looking ensemble has connections to number theory. This is well beyond the scope of this paper and refer interested readers to \cite{einsiedler-ward-ergodic-thy-number-thy, goldstein-mayer-2003-equidist-hecke-pts} for relevant background.
\end{remark}
Let $\vec\theta\coloneqq(\theta_1,\cdots,\theta_{n-1})$. The average of $f$ wrt such an ensemble can be written as
\[\exptover{\theta}{f\paren{\bfTheta(\vec\theta,\omega)\bZ^n}}=\int_0^1\cdots\int_0^1f\paren{\bfTheta(\vec\theta,\omega)\bZ^n}\diff\theta_1\cdots\diff\theta_{n-1}.\]
Let \[M\paren{f}\coloneqq\lim_{\omega\to0+}\exptover{\theta}{f\paren{\bfTheta(\vec\theta,\omega)\bZ^n}}.\]
Rogers \cite{rogers-1955-haar-equiv-ensemble} showed the following (perhaps surprising) identity.
\begin{theorem}[\cite{rogers-1955-haar-equiv-ensemble}, Theorem 1]\label{thm:rogers_equality}
Let $\rho:\sL_n\to\bR$ be a bounded, measurable, compactly supported function. Suppose the limit $M\paren{f}$ exists.
Then
\[\exptover{\Lambda\sim\mu}{f(\Lambda)}=\int_{\sL_n}f\paren{\Lambda}\diff\mu\paren{\Lambda}=M\paren{f}.\]
\end{theorem}
A similar averaging result holds for Construction-A lattices. See Loeliger~\cite{loeliger-1997-avg-formula-constr-a-lin-codes}.
\noindent\textbf{Step II.} Equipped with the powerful Theorem \ref{thm:rogers_equality}, computation regarding expectations wrt Haar distribution can be turned into computation wrt the aforedefined concrete ensemble. Rogers then gave a formula for the expectation of functions of a particular by computing $M(\cdot)$. It can be shown Equation \ref{eqn:higher-order-avg-formula} holds exactly without error term if we only sum up \emph{linearly independent/full-rank} $k$-tuples.
\begin{theorem}[\cite{rogers-1955-haar-equiv-ensemble}, Theorem 2, Lemma 1 and Theorem 3]\label{thm:higher-order-avg-formula-lin-indep}
Let $k$ and $\rho$ be as in the setting of Theorem \ref{thm:higher-order-avg-formula}. Let
\[f'(\Lambda)\coloneqq\sum_{\substack{\vx_1,\cdots,\vx_k\in\Lambda\\\rk\curbrkt{\vx_1,\cdots,\vx_k}=k}}\rho(\vx_1,\cdots,\vx_k).\]
Then
\begin{align}
M(f')=&\rho\paren{0,\cdots,0}+\int_{\bR^n}\cdots\int_{\bR^n}\rho\paren{\vx_1,\cdots,\vx_k}\diff \vx_1\cdots\diff \vx_k.
\label{eqn:higher-order-avg-formula-lin-indep}
\end{align}
\end{theorem}
\noindent\textbf{Step III.} Rogers finally completed the proof of Theorem \ref{thm:higher-order-avg-formula} by dropping the linear independence condition and lifting Theorem \ref{thm:higher-order-avg-formula-lin-indep} from $f'$ to
\[f(\Lambda)\coloneqq\sum_{{\vx_1,\cdots,\vx_k\in\Lambda}}\rho(\vx_1,\cdots,\vx_k)\]
as promised in Theorem \ref{thm:higher-order-avg-formula} at the cost of an extremely complicated error term $\cE$.
\subsection{Improvement on Rogers' formula}\label{sec:improvement_on_rogers}
Although we have Rogers' higher-order averaging formula, it turns out that the error term $\cE$ is very tricky to control even if we just plug in simple product functions. In the original paper by Rogers \cite{rogers-1955-mmts-of-number-of-lattice-pts, rogers-1956-mmts-of-number-of-lattice-pts-error-term}, he was only able to show convergence of the first \emph{few} moments of number of random lattice points in a \emph{symmetric} set of \emph{fixed} volume. Nevertheless, an intriguing Poisson behaviour was discovered and has been pushed to a greater generality in recent years. \footnote{Actually, Rogers showed that, asymptotically in the number of dimensions $n$, the first $\cO(\sqrt{n})$ moments of the number of random lattices points in a set $\cS$ which is centrally symmetric wrt the origin exhibit the same behaviour as a Poisson moment of the same degree with mean $V/2$, where $V\coloneqq\vol(\cS)$ is a constant independent of $n$. As we will see later, this is too weak for our purpose of list decoding, but it is the earliest result which kicks off a fantastic adventure towards understanding the statistics of random lattices.} We state below, as far as we know, the strongest results towards this direction.
Let $Y\sim\pois(V/2)$ be a Poisson random variable of mean $V/2$ for some $V$ to be specified later.
Kim showed the following improvement upon Rogers results.
\begin{theorem}[Proposition 3.3 of \cite{kim2016random}]\label{thm:kim-improvement}
Let $\cB$ be a centrally symmetric set in $\bR^n$ of volume $V$. There exists constants $C,c>0$ such that, if $n$ is sufficiently large and $V,k\le Cn$, then
\begin{align*}
\prob{Y\ge k}-e^{-cn}\le&\prob{\frac{1}{2}\card{(\Lambda\setminus\{0\})\cap\cB}\ge k}\le\prob{Y\ge k}+e^{-cn}.
\end{align*}
\end{theorem}
Note that the number of \emph{pairs} of lattice points is considered since if $\vx\in\Lambda$ so is $-\vx$. That is why there is a normalization factor $1/2$ in the random variable we consider.
Str\"ombergsson and S\"odergren provided another improvement on the distribution of short vectors in a random lattice.
\begin{theorem}[Theorem 1.2 of \cite{ss-2016-gen-gauss-circle}]\label{thm:ss-improvement}
Let $\cB$ be an $n$-dimensional Euclidean ball centered at the origin of volume $V$. For any $\eps>0$,
\begin{align*}
\prob{\frac{1}{2}\card{(\Lambda\setminus\{0\})\cap\cB}\le k}-\prob{Y\le k}\stackrel{n\to\infty}{\to}0,
\end{align*}
uniformly wrt all $k,V\ge0$ satisfying $\min\{k,V\}\le\cO_\eps(e^{\eps n})$.
\end{theorem}
We remark that both results by Kim and Str\"ombergsson--S\"odergren are great extension to higher-order averaging formula, but they are not directly comparable. In Kim's theorem \ref{thm:kim-improvement}, the set $\cB$ can be any symmetric body, not necessarily convex. This is a good news since in list decoding we care about the number of lattice points in $\cB(\vy,r)$ for any possible received vector $\vy\in\cB(0,\sqrt{nP}+\sqrt{nN})\setminus\cB(0,\sqrt{nP}-\sqrt{nN})$. Kim's result allow us to have control on that by taking $\cB=\cB(\vy,r)\sqcup\cB(-\vy,r)$. Obviously the configuration of lattice points are symmetric in $\cB(\vy,r)$ and $\cB(-\vy,r)$. Hence $|\Lambda\cap\cB|=2|\Lambda\cap\cB(\vy,r)|$. Also, Kim's result holds for $k=\cO(n)$ which is also sufficient for in our application, as we will see. Kim also quantified an exponential convergence rate. Unfortunately, his result requires $V$ to be $\cO(n)$, which is not enough for us.
On the other hand, Str\"ombergsson--S\"odergren's result pushed the volume $V$ to exponentially large in $n$ but insists on $\cB$ being a ball centered at the origin.
It should be intuitively clear that the Poissonianity behaviour of the moments will not hold for arbitrarily large degrees and for sets of arbitrarily large volume. The dimension the lattice is living in is only $n$. If we compute the moments of very high degree, we should expect to encounter some nontrivial correlation which makes the moments tricky to understand. Moreover, if we compute the moments of the number of lattice points in a very large set, it should not be surprising that at some point linearity of the lattices will kick in and dominate the behaviour of the moments.
\section{List decodability of Haar lattices}\label{sec:ld_haar}
Given the state of the art, we pose the following conjecture and use it to show conditional results in the next section. The known properties of the Haar distribution that we have outlined previously should hopefully provide reasonable justification for why we believe that our conjectures are true.
\begin{conjecture}[Poisson moment assumption]\label{conj:poissonianity}
Let $\cB$ be any symmetric set in $\bR^n$ of volume $V=2^{\cO(n)}$ and $k=cn$ for some constant $0<c<1$. Then
\[\exptover{Y\sim\pois(V/2)}{Y^k}\le\exptover{\Lambda\sim\mu}{\paren{\frac{\card{\Lambda\cap\cB}}{2}}^k}\le\exptover{Y\sim\pois(V/2)}{Y^k}+o(1).\]
Recall that the $k$-th moment of a Poisson random variable (Fact \ref{fact:pois_mmt}) is
\[\exptover{Y\sim\pois(V/2)}{Y^k}=e^{-V/2}\sum_{i=0}^\infty\frac{i^k}{i!}(V/2)^i.\]
\end{conjecture}
Note that results/conjectures phrased using tail bounds or moment bounds are essentially equivalent since one can be converted to another using the well-known relation between tails and moments. For any (continuous) random variable $\bfx$ with known tails, we can estimate its moment via
\[\expt{|\bfx|^k}=\int_0^\infty kt^{k-1}\prob{|\bfx|>t}\diff t.\]
For any (continuous) random variable $\bfx$ with known moments, we can bound its tail via Chernoff-type inequality.
\[\prob{|\bfx|>t}\le\frac{\expt{|\bfx|^k}}{t^k}.\]
Previously, we showed that lattices and nested lattice codes can achieve $ 2^{\cO(\frac{1}{\delta}\log^2\frac{1}{\delta})} $ list sizes whereas random spherical codes and periodic ICs achieve list sizes that grow as $ \cO(\frac{1}{\delta}\log\frac{1}{\delta}) $. This leads to the natural question: Do there exist lattices/nested lattice codes that achieve $ \cO(\poly(1/\delta)) $ list sizes? Are the exponential list sizes a consequence of imposing structural regularity or is it an artefact of our proof? We conjecture that lattices can indeed achieve $ \cO(\poly(1/\delta)) $ although we are unable to supply a complete proof at present. However, based on some heuristic assumptions, we can give a ``proof'' that a different ensemble of lattices achieve $ \cO(\poly(1/\delta)) $ list sizes.
\subsection{Conditional list decodability of Haar lattices}\label{sec:cond_ld_haar}
\subsubsection{Codebook construction}\label{sec:cond_ld_haar_cb}
Let $R=\frac{1}{2}\log\frac{P}{N}-\delta$ for some small constant $\delta>0$. Sample a lattice $\Lambda$ from the Haar distribution on $\sL_n$. The lattice codebook is nothing but $\cC\coloneqq \alpha\Lambda\cap\cB(0,\sqrt{nP})$.
Note that
\begin{align*}
\card{\cC}=&\card{\alpha\Lambda\cap\cB(0,\sqrt{nP})}=\card{\Lambda\cap \alpha^{-1}\cB(0,\sqrt{nP})}.
\end{align*}
By Siegel's formula \ref{thm:first-order-avg-formula}, the expected number of codewords in the codebook is
\begin{align*}
\expt{\card{\cC}}=&\frac{\vol\paren{\cB^n\paren{0,\sqrt{nP}}}}{\alpha^n}=\frac{\sqrt{nP}^nV_n}{\alpha^n}.
\end{align*}
Equaling it $2^{nR}$, we have
\begin{align*}
\alpha=&\frac{\sqrt{nP}V_n^{1/n}}{2^R}\asymp\frac{\sqrt{2\pi eP}}{2^R}.
\end{align*}
This coupled with the proceeding computation will provide the (conditional) \emph{existence} of an $(P,N,\poly(1/\delta))$-list decodable lattice code.
\subsubsection{Under distribution assumption}\label{sec:cond_ld_haar_dist}
Heuristically and unrealistically, we first assume that the number of lattice points follows exactly Poisson distribution, i.e., \emph{every} moment of it is Poissonian.
\begin{conjecture}[Poisson distribution assumption]
Let $ \Lf $ be a random lattice drawn from the Haar distribution. If $ \cB $ is any measurable set with nonempty interior, then for all $ t\in\bZ_{\ge0}$,
\[
\Pr[|\Lf\cap\cB|=t] = \prob{Y=t}.
\]
\label{conj:pois_dist}
\end{conjecture}
This assumption is \emph{not} believed to be true. As we mentioned before, at some point linearity should kick in and the moments are expected to diverge from Poissons as the degree grows. Nevertheless, in this section we still conduct computation under this too-good-to-be-true assumption to set the bar which is the ``best" yet never reached list decoding performance one can hope for.
Under the construction given in Sec. \ref{sec:cond_ld_haar_cb}, invoking Conjecture \ref{conj:poissonianity}, we can get a whp guarantee on the size of the codebook. First note that
\begin{align*}
\vol\paren{{{\alpha}}^{-1}\cB\paren{0,{\sqrt{nP}}}}=&\expt{|\cC|}=\frac{\sqrt{nP}^nV_n}{\sqrt{2\pi eP}^n/2^{nR}}\asymp\frac{1}{\sqrt{\pi n}}2^{nR},
\end{align*}
which fits in the setting of Conjecture \ref{conj:poissonianity}.
By the Poisson tail bound \ref{lem:pois_tail},
\begin{align*}
&\prob{\card{\cC}\notin\sqrbrkt{2^{n(R-\delta/2)},2^{n(R+\delta/2)}}}\\
\le&\frac{e^{-2^{nR}}(e\cdot2^{nR})^{2^{n(R-\delta/2)}}}{2^{n(R-\delta/2)2^{n(R-\delta/2)}}}+\frac{e^{-2^{nR}}(e\cdot2^{nR})^{2^{n(R+\delta/2)}}}{2^{n(R+\delta/2)2^{n(R+\delta/2)}}}\\
=&\exp\paren{-2^{nR}+\paren{1+(\ln2)\frac{\delta}{2}n}2^{n(R-\delta/2)}}+\exp\paren{-\paren{(\ln2)\frac{\delta}{2}n-1}2^{n(R+\delta/2)}-2^{nR}}\\
=&e^{-\Omega(2^{nR})}+e^{-\Omega(n\cdot2^{n(R+\delta/2)})}.
\end{align*}
That is to say, with probability at least $1-e^{-\Omega(2^{nR})}-e^{-\Omega(n\cdot2^{n(R+\delta/2)})}$, the rate $R(\cC)$ of code is between $\frac{1}{2}\log\frac{P}{N}-3\delta/2$ and $\frac{1}{2}\log\frac{P}{N}-\delta/2$.
We then turn to upper bound the following probability of failure of list decoding.
\begin{equation}
\prob{ \exists \vy\in\cB^n\paren{ 0,\sqrt{nP}+\sqrt{nN} },\;\card{ \alpha\Lambda\cap\cB^n\paren{\vy,\sqrt{nN}} }> L }.
\label{eqn:ld_pe}
\end{equation}
Take an optimal $\sqrt{n\eps}$-covering $\cY$ of $\cB^n\paren{ 0,\sqrt{nP}+\sqrt{nN} }$. It can be achieved that
\[\card{\cY}=\paren{\frac{\vol\paren{\cB^n\paren{ 0,\sqrt{nP}+\sqrt{nN} + \sqrt{n\eps} }}}{\vol\paren{\cB^n\paren{0,\sqrt{n\eps}}}}}^{1+o(1)}=\paren{\frac{\sqrt{P}+\sqrt{N}+\sqrt{\eps}}{\sqrt{\eps}}}^{(1+o(1))n}\le\paren{\frac{c_2}{\delta}}^n,\]
where in the last step we set $\eps\coloneqq c_1\delta^2$. Then probability~\ref{eqn:ld_pe} is upper bounded by
\begin{align}
&\prob{ \exists \vy\in\cY,\;\card{ \alpha\Lambda\cap\cB^n\paren{\vy,\sqrt{nN}+\sqrt{n\eps}} }> L }\notag\\
\le&\card{\cY}\prob{ \card{\alpha\Lambda\cap\cB^n\paren{\vy,\sqrt{nN}+\sqrt{n\eps}}}>L }.\label{eqn:heuristic}
\end{align}
Let
\begin{align*}
\cB_1\coloneqq & \alpha^{-1}\cB^n\paren{\vy,\sqrt{nN}+\sqrt{n\eps}} \cup \alpha^{-1}\cB^n\paren{-\vy,\sqrt{nN}+\sqrt{n\eps}} ,\\
\cB_2\coloneqq & \alpha^{-1}\cB^n\paren{\vy,\sqrt{nN}+\sqrt{n\eps}} \cap \alpha^{-1}\cB^n\paren{-\vy,\sqrt{nN}+\sqrt{n\eps}} .
\end{align*}
Note that
\begin{equation}
\vol(\cB_1) + \vol(\cB_2)=2\vol\paren{\alpha^{-1}\cB^n\paren{\sqrt{nN}+\sqrt{n\eps}}}.
\label{eqn:vol_identity}
\end{equation}
By our assumption \ref{conj:pois_dist} in this section,
\begin{align}
\card{\Lambda\cap \alpha^{-1}\cB^n\paren{\vy,\sqrt{nN}+\sqrt{n\eps}}}
=& \frac{1}{2}\card{\Lambda\cap \cB_1} + \frac{1}{2}\card{\Lambda\cap \cB_2} \label{eqn:ineq_no_lattice_pts_in_ball}\\
\sim& \pois\paren{\vol(\cB_1)/2} + \pois\paren{\vol(\cB_2)/2} \notag\\
\sim & \pois\paren{\frac{\vol(\cB_1)+\vol(\cB_2)}{2}} \label{eqn:app_pois_add}\\
\sim & \pois\paren{\alpha^{-1}\cB^n\paren{\sqrt{nN}+\sqrt{n\eps}}}. \label{eqn:app_vol_identity}
\end{align}
Eqn. \ref{eqn:app_pois_add} and \ref{eqn:app_vol_identity} follow from Fact \ref{fact:pois_add} and Eqn. \ref{eqn:vol_identity}, respectively.
Plugging parameters into the bound \ref{lem:pois_tail}, we can upper bound the probability in Eqn.~\ref{eqn:heuristic} by
\begin{equation}
\prob{ \card{\Lambda\cap\cB^n\paren{0,\frac{\sqrt{nN}+\sqrt{n\eps}}{{\alpha}}}}>L }<\frac{e^{-V}\paren{eV}^{L}}{L^L},
\label{eqn:pois_tail}
\end{equation}
where
\begin{equation}
V\coloneqq\vol\paren{\cB^n\paren{0,\frac{\sqrt{nN}+\sqrt{n\eps}}{{\alpha}}}}=\paren{\frac{\sqrt{nN}+\sqrt{n\eps}}{{\alpha}}}^nV_n=\frac{1}{\sqrt{\pi n}}2^{n\paren{R-\frac{1}{2}\log\frac{P}{N+2\sqrt{N\eps}+\eps}}}\approx\frac{1}{\sqrt{\pi n}}2^{-c_3n\sqrt{\eps}} <L.
\label{eqn:pois_param}
\end{equation}
In the last step of the above chain of equalities, we set $c_3=1/\sqrt{N}-1/\sqrt{c_1}$ and use that $R=\frac{1}{2}\log\frac{P}{N}-\delta$, $\eps=c_1\delta^2$ and $\log(1+x)\approx x$. Hence the RHS of tail~\ref{eqn:pois_tail} is
\[\exp\paren{-\frac{1}{\sqrt{\pi n}}2^{-c_3n\sqrt{\eps}}}\paren{\frac{e}{\sqrt{\pi n}}2^{-c_3n\sqrt{\eps}}}^{L}/L^L\asymp\frac{\paren{\frac{e}{\sqrt{\pi n}}}^{L}}{L^L}2^{-c_3n\sqrt{\eps}L}.\]
Taken a union bound over $\cY$, the overall probability of failure of list decoding~\ref{eqn:ld_pe} is at most
\[\frac{\paren{\frac{e}{\sqrt{\pi n}}}^{L}}{L^L}2^{-c_3n\sqrt{\eps}L}\paren{\frac{c_2}{\delta}}^n=\frac{\paren{\frac{e}{\sqrt{\pi n}}}^{L}}{L^L}2^{-n\paren{{c_3\sqrt{c_1}}\delta L-\log\frac{c_2}{\delta}}}.\]
The multiplicative factor $\frac{\paren{\frac{e}{\sqrt{\pi n}}}^{L}}{L^L}$ is going to be negligible once $n$ is sent to infinity. The exponent is negative if we set $L$ to be $c'\frac{1}{\delta}\log\frac{1}{\delta}$ for some appropriate constant $c'$.
The above heuristic calculations indicate that, under the Poisson distributional assumption of the number of lattice points in a ball, a random lattice (appropriately scaled) drawn from the Haar measure performs as well as uniformly random spherical codes.
Combining this with the comments following Lemma~\ref{thm:first-order-avg-formula}, we have the following result:
\begin{lemma}
If Conjecture~\ref{conj:pois_dist} is true, then there exists a lattice $ \Lf $ such that $ \Lf\cap\cB(0,\sqrt{nP}) $ has rate $ C(P,N)-\delta $ and is $ \left(P,N ,\Theta(\frac{1}{\delta}\log\frac{1}{\delta})\right)$-list decodable.
\end{lemma}
\subsubsection{Under moment assumption}\label{sec:cond_ld_haar_mmt}
Now instead of assuming that the number of lattice points in any symmetric body has Poisson distribution, we only assume its first $k$ moments match Poisson moments. Let
\begin{equation}
X=\card{\Lambda\cap\cB^n\paren{\frac{\sqrt{nN}+\sqrt{n\eps}}{{\alpha}}}}.
\label{eqn:x_def}
\end{equation}
By Conjecture \ref{conj:poissonianity} and Fact \ref{fact:pois_mmt}, for any $0\le m\le k$,
\[\expt{X^m}\asymp\expt{Y^m}=e^{{-\lambda}}\sum _{{j=0}}^{\infty }{\frac {\lambda^{j}j^{m}}{j!}},\]
where $Y\sim\pois\paren{\lambda}$, $\lambda=V/2$ and $V$ is given by formula~\ref{eqn:pois_param}. Indeed,
\begin{equation}
\lambda\approx\frac{1}{2\sqrt{\pi n}}2^{-c_3n\sqrt{\eps}}=\exp\paren{-\ln2\cdot c_3\sqrt{\eps}\cdot n-\ln\paren{2\sqrt{\pi n}}}\stackrel{n\to\infty}{\to}0.
\label{eqn:pois_mean}
\end{equation}
Then the probability in Eqn.~\ref{eqn:heuristic} can be upper bounded by
\begin{align}
\prob{X^k>L^k}<{\expt{X^k}}/{L^k}=\expt{X^k}e^{-k\ln{L}}.\notag
\end{align}
Let $k\eqqcolon cn$ where $0<c<1$ is a constant. If $\expt{X^k}\le e^{-nD}$ for some $D>0$, then after taking a union bound over $\vy\in\cY$, we are in good shape if
\begin{equation}
e^{-n\paren{D+c\ln\frac{L}{2}-\ln\frac{c_2}{\delta}}}\stackrel{n\to\infty}{\to}0.
\label{eqn:mmt_bd}
\end{equation}
Now let us compute the $k$-th moment.
\begin{align}
\expt{X^k}=&e^{{-\lambda}}\sum _{{j=0}}^{\infty }{\frac {\lambda^{j}j^{k}}{j!}}\notag\\
\asymp&\sum_{j\ge0}\frac{\lambda^jj^k}{\sqrt{2\pi j}\paren{j/e}^j}\label{eqn:app_stirling}\\
=&\sum_{j\ge0}\exp\paren{j\ln\lambda+k\ln j-j\ln j+j-\frac{1}{2}\ln\paren{2\pi j}},\notag
\end{align}
where in Eqn. \ref{eqn:app_stirling} we use Stirling's approximation \ref{lem:stirling}.
As we know, a sum of exponentials is dominated by the largest term. Let us compute the largest one.
Define function
\[f\paren{j}\coloneqq-j\ln j+\paren{\ln\lambda+1}j+\paren{k-1/2}\ln j-\frac{1}{2}\ln\paren{2\pi}.\]
Its first derivative is given by
\[\frac{\diff f}{\diff j}=\ln\lambda+\frac{k-1/2}{j}-\ln j.\]
Equaling it zero and solving the equation, we get the critical point
\[j^*\coloneqq\frac{k-1/2}{W\paren{\frac{k-1/2}{\lambda}}},\]
where $W(\cdot)$ is the \emph{Lambert $W$ function} which we will not formally define. The only thing we use is that, when $x$ is large, we have the following estimate
\[W(x)=\ln x-\ln \ln x+o(1).\]
Note that, by Eqn. \ref{eqn:pois_mean},
\[\frac{k-1/2}{\lambda}=\paren{cn-1/2}\cdot2\sqrt{\pi n}2^{c_3n\sqrt{\eps}}\stackrel{n\to\infty}{\to}\infty.\]
Hence
\begin{align}
W\paren{\frac{k-1/2}{\lambda}}=&\ln\paren{\paren{cn-1/2}\cdot2\sqrt{\pi n}} + \ln 2\cdot c_3n\sqrt{\eps} + \ln\paren{\ln\paren{\paren{cn-1/2}\cdot2\sqrt{\pi n}} + \ln 2\cdot c_3n\sqrt{\eps}}\notag\\
=&\ln2\cdot c_3\sqrt{\eps}\cdot n(1+o(1)).\notag
\end{align}
We thus have
\[j^*\asymp\frac{c}{\ln2\cdot c_3\sqrt{\eps}}.\]
Plug this into $f$,
\begin{align}
f(j^*)=&-j^*\ln j^*+\paren{\ln\lambda+1}j^*+\paren{cn-1/2}\ln j^*-\frac{1}{2}\ln\paren{2\pi}\notag\\
=&-\frac{c}{\ln2\cdot c_3\sqrt{\eps}}\ln\paren{\frac{c}{\ln2\cdot c_3\sqrt{\eps}}}+\paren{-\ln2\cdot c_3\sqrt{\eps}\cdot n-\ln\paren{2\sqrt{\pi n}}+1}\frac{c}{\ln2\cdot c_3\sqrt{\eps}}\notag\\
&+\paren{cn-1/2}\ln\paren{\frac{c}{\ln2\cdot c_3\sqrt{\eps}}}-\frac{1}{2}\ln\paren{2\pi}\notag\\
=& -n\paren{1+o(1)}\paren{c-c\ln\frac{c}{\ln2\cdot c_3\sqrt{\eps}}}. \notag
\end{align}
Finally, the exponent of expression~\ref{eqn:mmt_bd} is
\begin{align}
D+c\ln\frac{L}{2}-\ln\frac{c_2}{\delta}\approx&c-c\ln\frac{c}{\ln2\cdot c_3\sqrt{\eps}}+c\ln\frac{L}{2}-\ln\frac{c_2}{\delta}\notag\\
=&c\ln L-\paren{c+1}\ln\frac{1}{\delta}+c-c\ln\frac{2c}{\ln2\cdot c_3\sqrt{c_1}}-\ln c_2.\notag
\end{align}
In order for it to be positive as $\delta\to0$, we had better set $L=\paren{1/\delta}^a$, where $ac>c+1$, i.e., $a>1+1/c$. If we only assume the first $k=cn<n$ moments are Poissonian, namely $c<1$, say $c=\frac{1}{1+\gamma}$ for some small positive $\gamma$, then we need $a>2+\gamma$, say $a=2.001+\gamma$.
Using arguments similar to the previous section,
\begin{lemma}
If Conjecture~\ref{conj:poissonianity} is true, then there exists a lattice $ \Lf $ such that $ \Lf\cap\cB(0,\sqrt{nP}) $ has rate $ C(P,N)-\delta $ and is $ \left(P,N ,\cO(1/\delta^{1+1/c})\right)$-list decodable.
\label{lemma:poissonmoment_listsize}
\end{lemma}
\subsection{Remark}
The careful reader might have observed that in order to prove Lemma~\ref{lemma:poissonmoment_listsize}, we do not really need the first $ cn $ moments to be Poisson. It suffices to show that the first $ cn $ moments are bounded from above by a quantity that is subexponential in $ n $. However, we are optimistic that a result similar to Conjecture~\ref{conj:poissonianity} can indeed be proved for the Haar distribution on $ \sL_n $.
\section{Concluding remarks and open problems}\label{sec:rk_open_prob}
In this paper we initiate the systematic study of list size problem for codes over $\bR$. In particular, upper bounds on list sizes of nested Construction-A lattice codes and infinite Construction-A lattices are exhibited. Similar upper bounds are also obtained for an ensemble of regular infinite constellations. Matching lower bounds for such an ensemble are provided. Other coding-theoretic properties are studied by the way. Our lower bound for random spherical codes also matches the upper bound in previous work. A caveat is that all of our bounds are concerned with \emph{typical} scaling of the list sizes of \emph{random} codes sampled from the ensembles of interest. The extremal list sizes \emph{may} be smaller than our lower bounds. We conclude the paper with several open questions.
\begin{enumerate}
\item Careful readers might have already noted that a missing piece in this work is a list size lower bound for random Construction-A lattice codes. We had trouble replicating the arguments in \cite{guruswami2013combinatorial}. We leave it as an open question to get a polynomial-in-$1/\delta$ list size lower bound.
\item Can one sample efficiently from the Haar distribution on the spaces of our interest? In particular, can one sample efficiently a generator matrix $\bfG$ from the Haar distribution $\mu$ on $\speclin(n,\bR)$? Can one sample eficiently a lattice $\Lambda$ from the Haar distribution $\mu$ on $\speclin(n,\bR)/\speclin(n,\bZ)$? To this end, we can think of $\speclin(n,\bR)$ as a codimensional-one hypersurface in $\bR^{n^2}$ cut off by the equation $\det(\bfG)=1$. People from Monte Carlo Markov Chain (MCMC) community may be interested in such problems.
\item A very intriguing question which we are unable to resolve in this work is to bring down the exponential list size for random Construction-A lattice codes. We do not believe our upper bound is tight. A starting step towards this goal is probably to obtain an averaging formula custom tailored for Construction-A lattices. Indeed, Loeliger \cite{loeliger-1997-avg-formula-constr-a-lin-codes} has proved a first-order averaging formula for (appropriately scaled) Construction-A lattices as an analog of Siegel's formula for Haar lattices. Specifically, consider an ensemble of Construction-A-type lattices $\Lambda\coloneqq\frac{1}{\alpha}(\cC+q\bZ^n)$ where $\cC\sim\gr(\kappa,\bF_q^n)$ is a uniformly random $\kappa$-dimensional subspace of $\bF_q^n$. Then for any bounded measurable compactly supported function $\rho\colon\bR^n\to\bR$, it holds that
\begin{equation*}
\exptover{\cC\sim\sC_{n,\kappa}}{\sum_{\vx\in\Lambda\setminus\curbrkt{0}}\rho(\vx)}=\frac{1}{\card{\sC_{n,\kappa}}}\sum_{\cC\in\sC_{n,\kappa}}\sum_{\vx\in\Lambda\setminus\curbrkt{0}}\rho(\vx)\xrightarrow{\alpha\to\infty,q/\alpha\to\infty}\det(\Lambda)^{-1}\int_{\bR^n}\rho(\vx)\diff\vx,
\end{equation*}
where, $\sC_{n,\kappa}\coloneqq\gr(\kappa,\bF_q^n)$, and by Loeliger's construction,
\[\det(\Lambda)=\paren{\frac{1}{\alpha}}^n[\bZ^n\colon(\cC+q\bZ^n)]=\card{\bZ^n/(\cC+q\bZ^n)}/\alpha^{n}=q^{n-\kappa}/\alpha^n.\]
Can one lift Loeliger's formula to $k$-variate functions $\rho\colon(\bR^n)^k\to\bR$ and get a higher-order averaging formula for Construction-A lattices as an analog of Rogers' formula for Haar lattices?
\item Can one compute similar moments for random Construction-A lattices? Given a random Construction-A lattice $\Lambda=q^{-1}\cC+\bZ^n$ where $\cC$ is a $\kappa$-dimensional random linear code in $\bF_q^n$, compute the $k$-th moment $\expt{\card{\Lambda\cap\cB_2^n(\vy,\sqrt{nN})}^k}$ for any $\vy\in\bR^n$ and for $k$ as large as possible. For \emph{random binary linear code} over $\bF_2^n$ of rate $1-H(p)+\delta$,\footnote{Note that such a code operates at a rate \emph{above} capacity and the corresponding moments they are interested in are exponentially large. Indeed, they instead consider \emph{centered} moments $\expt{(X-\expt{X})^k}$.} Linial and Mosheiff \cite{linial-mosheiff-2018-wt-dist-rand-bin-lin} recently managed to \emph{characterize} the first $\cO(n/\log n)$ moments of the number of codewords in a Hamming \emph{sphere} of radius $np$. It turns out that up to a threshold $k_0$, the normalized centered moment \[\frac{\expt{(\card{\cC\cap\sham(0,np)}-\expt{\card{\cC\cap\sham(0,np)}})^k}}{\var{\card{\cC\cap\sham(0,np)}}^{k/2}}\] behaves like the moment of a Gaussian (recall Fact \ref{fact:gaussian_mmt}) up to some threshold $k<k_0$, where $k_0$ is 3 or 4 for $\delta$ not too small. From $k_0$ on, linearity quickly kicks in and dominates the behaviour of the moments.
\item We showed that Haar lattices of rate $\frac{1}{2}\log\frac{P}{N}-\delta$ are $(P,N,\poly(1/\delta))$ whp conditioned on Conjecture \ref{conj:poissonianity}. Can one show other coding-theoretic goodness properties under the conjecture? Are Haar lattices good for packing, covering, AWGN, quantization, etc.?
\item In this paper, the list decodability of two ensembles (Construction-A and Haar) of lattices are considered. The ultimate goal is to find an \emph{explicit} $(P,N,\poly(1/\delta))$-list decodable lattice code of rate $\frac{1}{2}\log\frac{P}{N}-\delta$. Recently Kaufman and Mass \cite{kaufman-mass-2018-lattices-from-hdx} constructed lattices of good \emph{distance} from high dimensional expanders. Namely, the resulting lattices are good for packing. Their results are conditioned on the conjecture that the cohomology group of Ramanujan complexes with \emph{integer} coefficients is large. Specifically, for a Ramanujan complex $\cX$, it is conjectured that the dominant part of its cohomology group with binary coefficients
\[H^1(\cX;\bF_2)\cong \bZ^k\oplus\bigoplus_{i=1}^\ell\bF_{2^{n_i}},\]
comes from the free part $\bZ^k\cong H^1(\cX;\bZ)$ rather than the torsion part $\bigoplus_{i=1}^\ell\bF_{2^{n_i}}\cong H^2(\cX;\bZ)$.
It is an interesting question to examine other coding-theoretic goodness properties of such an ensemble, even under their conjecture.
\item Our lower bounds on list sizes only indicate typical behaviours of ensembles of random lattices. This does not exclude the existence of codes with smaller list sizes. Can one prove a lower bound on list sizes of \emph{general} codes over reals, even exponentially off from the upper bound? Namely, for any $2^{nR}$ points on $\cS^{n-1}\paren{0,\sqrt{nP}}$, how large an $L$ can one find such that, no matter how well spread out the points are, one can always find a position $\vy$ to which there are at least $L$ points that are $\sqrt{nN}$-close?
\end{enumerate}
\section*{Acknowledgement}
YZ thanks Noah Stephens-Davidowitz for sharing his expertise on lattices, in particular, introducing him the Poisson heuristics as a prediction of the behaviors of random lattices when he was visiting MIT and for exchanging multiple informative emails afterwards. YZ thanks Mary Wootters for clarifying the state of the art of list decodability of random linear codes. YZ also wants to thank Boris Bukh, Chris Cox, Sidharth Jaggi, Nicolas Resch and Tomasz Tkocz for several inspiring discussions, respectively. Part of this work was done when YZ was visiting CMU under the mentorship of Venkatesan Guruswami who listened to the progress and provided generous encouragement at the early stage. Part of this work was done when SV was a postdoc at CUHK.
\appendices
\section{Table of notation}\label{sec:tab_notation}
\begin{center}
\begin{longtable}{|p{0.091\textwidth}|p{0.168\textwidth}|p{0.25\textwidth}|p{0.414\textwidth}|}
\hline
\textbf{Symbol} & \textbf{Section} & \textbf{Description} & \textbf{Definition/Value/Range} \\ \hline
$A_{n-1}$ & Throughout the paper & Area of an $(n-1)$-dimensioinal unit sphere & $A_{n-1}\coloneqq\area(\cS_2^{n-1})$ \\\hline
$\cA$ & Sec. \ref{sec:ic}, \ref{sec:regular_ic} & Cube of side length $\alpha$ & $\cA\coloneqq[0,\alpha)^n$ \\\hline
\multirow{3}{0.091\textwidth}{$C$} & \multirow{2}{0.168\textwidth}{Sec. \ref{sec:finitefield_prior_work}} & List decoding capacity & $C\coloneqq1-H_q(p)\in[0,1]$ \\\cline{3-4}
& & List decoding capacity & $C\coloneqq1-p\in[0,1]$ \\\cline{2-4}
& Throughout the paper & List decoding capacity & $C\coloneqq\frac{1}{2}\log\frac{P}{N}\in\bR_{\ge0}$ \\\hline
\multirow{3}{0.091\textwidth}{$\cC$} & Sec. \ref{sec:finitefield_prior_work} & Code & $\cC\in\binom{\bF_q^n}{q^{nR}}$ \\\cline{2-4}
& Throughout the paper & Code & $\cC\subset\bR^n$ of size $2^{nR}$ \\\cline{2-4}
& Sec. \ref{sec:results}, \ref{sec:ic}, \ref{sec:regular_ic} & IC & $\cC\subset\bR^n$ \\\hline
$C(L)$ & Sec. \ref{sec:finitefield_prior_work} & List-$L$ capacity & See Eqn. \ref{eqn:list_l_cap} \\\hline
$C_{\rand}(\cW)$ & Sec. \ref{sec:finitefield_prior_work} & Random code capacity & $C_{\text{rand}}(\cW)\coloneqq\max_P\min_{P_{\bfx\bfs\bfy}=P_\bfx P_\bfs W_{\bfy|\bfx\bfs}\colon P_\bfx=P}I(\bfx;\bfy)$ \\\hline
\multirow{2}{0.091\textwidth}{$\bfG$} & \multirow{2}{0.168\textwidth}{Throughout the paper} & Generator matrix of a linear code & $\bfG\in\bF_q^{n\times \kappa}$ \\\cline{3-4}
& & Generator matrix of a lattice & $\bfG\in\bR^{n\times \kappa}$ \\\hline
\multirow{2}{0.091\textwidth}{$k$} & Sec. \ref{sec:haarlattice_introduction}, \ref{sec:ld_haar} & Degree of moments & $k=cn$ \\\cline{2-4}
& Sec. \ref{sec:rk_open_prob} & Degree of moments & $k=\cO(n/\log n)$ \\\hline
$\ell$ & Sec. \ref{sec:ld_constr_a} & Log of list size & $\ell\coloneqq\log_q(L+1)$ \\\hline
$L$ & Throughout the paper & List size & $ L\in[q^{nR}]$ \\\hline
$\cL$ & Throughout the paper & List & $\cL\in\binom{\cC}{\le L}$ \\\hline
$\sL_n$ & Sec. \ref{sec:haarlattice_introduction}, \ref{sec:ld_haar} & Space of determinant-1 lattices & $\sL_n\coloneqq\curbrkt{\Lambda\le\bR^n\text{ lattice}\colon \det(\Lambda)=1}$ \\\hline
$m$ & Sec. \ref{sec:lb_ls_spherical}, \ref{sec:ld_constr_a} & Message & $m\in[q^{nR}]$ \\\hline
\multirow{2}{0.091\textwidth}{$M$} & Sec. \ref{sec:lb_ls_spherical}, \ref{sec:ld_constr_a} & Number of messages/size of codebook & $M\coloneqq|\cM|=q^{nR}$ \\\cline{2-4}
& Sec. \ref{sec:finitefield_prior_work} & Symmetrizability & See Eqn. \ref{eqn:sym} \\\hline
$\cM$ & Sec. \ref{sec:lb_ls_spherical}, \ref{sec:ld_constr_a} & Set of messages & $\cM\coloneqq\curbrkt{0,1,\cdots,2^{nR}-1}$ \\\hline
$n$ & Throughout the paper & Blocklength & $n\in\bZ_{>0}$ \\\hline
$N$ & Throughout the paper & Adversary's power constraint & $N\in\bR_{>0}$ \\\hline
$p$ & Sec. \ref{sec:finitefield_prior_work} & Adversary's power constraint & $p\in[0,1]$ \\\hline
$P$ & Throughout the paper & Transmit power constraint & $ P\in\bR_{>0} $ \\\hline
$\cP(\Lambda)$ & Sec. \ref{sec:ld_constr_a} & Fundamental parallelepiped & $\cP(\Lf)\coloneqq \{ \bfG\vx:\vx\in [0,1 )^n \}$ \\\hline
$q$ & Throughout the paper & Characteristic of finite field & Prime number \\\hline
$Q_\Lambda(\cdot)$ & Sec. \ref{sec:ld_constr_a} & Lattice quantizer & See Eqn. \ref{eqn:lattice_quant} \\\hline
$\rcov$ & Sec. \ref{sec:ld_constr_a} & Covering radius of a lattice & See Appendix \ref{sec:primer_lattices} \\\hline
\multirow{2}{0.091\textwidth}{$\reff$} & Sec. \ref{sec:ld_constr_a} & Effective radius of a lattice & See Appendix \ref{sec:primer_lattices} \\\cline{2-4}
& Sec. \ref{sec:results}, \ref{sec:ic}, \ref{sec:regular_ic} & Effective radius of an infinite constellation & See Def. \ref{def:ic} \\\hline
$\rpack$ & Sec. \ref{sec:ld_constr_a} & Packing radius of a lattice & See Appendix \ref{sec:primer_lattices} \\\hline
$R$ & Throughout the paper & Rate of a code & $\frac{\log|\cC|}{n}\in\bR_{>0} $ \\ \hline
$\vs$ & Throughout the paper & Jamming vector & $\vs\in\cB(0,\sqrt{nN})$ \\\hline
$V(\cC)$ & Sec. \ref{sec:results}, \ref{sec:ic}, \ref{sec:regular_ic} & Effective volume of an IC & $V(\cC)=1/\Delta(\cC)$ \\\hline
$V_n$ & Throughout the paper & Volume of an $n$-dimensioinal unit ball & $V_n\coloneqq\vol(\cB_2^n)$ \\\hline
$\cV(\Lambda)$ & Sec. \ref{sec:ld_constr_a}, \ref{sec:ic} & Fundamental Voronoi region & $\cV(\Lf) \coloneqq \{ \vx\in\bR^n: Q_{\Lf}(\vx) = 0 \}$ \\\hline
$W$ & Sec. \ref{sec:lb_ls_spherical}, \ref{sec:regular_ic} & Witness of list decodability & See Eqn. \ref{eqn:w_spherical}, \ref{eqn:w_ic} \\\hline
$W(\cdot|\cdot,\cdot)$ & Sec. \ref{sec:finitefield_prior_work} & Transition probability of an AVC & $W\colon\cY\times\cX\times\cS\to[0,1]$ \\\hline
$\cW$ & Sec. \ref{sec:finitefield_prior_work} & AVC & $\cW\coloneqq\curbrkt{W(\cdot|\cdot,s),\vs\in\cS}$ \\\hline
$\vx$ & Throughout the paper & Transmitted codeword & $\vbfx\in\cC$ \\\hline
$X$ & Sec. \ref{sec:ld_haar} & Number of lattice points in a ball & See Eqn. \ref{eqn:x_def} \\\hline
$\vy$ & Throughout the paper & Received word & $\vy=\vx+\vs\in\cB(0,\sqrt{nP}+\sqrt{nN})\setminus\cB(0,\sqrt{nP}-\sqrt{nN})$ \\\hline
$Y$ & Sec. \ref{sec:haarlattice_introduction}, \ref{sec:ld_haar} & Poisson random variable & $Y\sim\pois(V/2)$ \\\hline
$\cY$ & Throughout the paper & Net for $\vy$'s & See specific definitions \\\hline
$\vbfz$ & Sec. \ref{sec:regular_ic} & AWGN & $\bR^n\ni\vbfz\sim\cN(0,\sigma^2\bfI)$ \\\hline
$\alpha$ & Throughout the paper & Side length of $\cA$ & $\alpha\in\bR_{>0}$ \\\hline
\multirow{2}{0.091\textwidth}{$\delta$} & Throughout the paper & Gap to capacity & $\delta\coloneqq C-R\in\bR_{>0} $ \\\cline{2-4}
& Sec. \ref{sec:results}, \ref{sec:ic}, \ref{sec:regular_ic} & Gap between $\reff(\cC)$ and $\sqrt{nN}$ & $\delta\coloneqq\log\frac{\reff(\cC)}{\sqrt{nN}}$ \\\hline
$\Delta(\cC)$ & Sec. \ref{sec:results}, \ref{sec:ic}, \ref{sec:regular_ic} & Density of an IC & $\Delta(\cC)\coloneqq \limsup_{a\to\infty}\frac{|\cC\cap [0,a]^n|}{a^n}$ \\\hline
$\eps$ & Throughout the paper & Parameter of a net & See specific definitions \\\hline
$\bfTheta$ & Sec. \ref{sec:haarlattice_introduction} & Rogers' ensemble & $\bfTheta=\bfTheta(\theta_1,\cdots,\theta_{n-1},\omega)$ (Eqn. \ref{eqn:rogers_ensemble}) \\\hline
$\kappa$ & Throughout the paper & Dimension of a linear code or a lattice & $\kappa\in\curbrkt{0,1,\cdots,n}$ \\\hline
$\Lf$ & Throughout the paper & Lattice & $ \Lf\le \bR^n $ \\\hline
$\mu$ & Sec. \ref{sec:haarlattice_introduction}, \ref{sec:ld_haar} & Haar measure on $\speclin(n,\bR)$, $\sL_n$ or $\genlin(n,\bR)$ & See Theorem \ref{thm:haar_slnr} \\\hline
$\tau$ & Sec. \ref{sec:finitefield_prior_work} & Gap to list decoding radius & $\tau\coloneqq 1-1/q-p\in\bR_{>0} $ \\\hline
$\Phi$ & Sec. \ref{sec:ld_constr_a} & Natural embedding & $\Phi\colon \bF_q\to\bZ$ \\\hline
$\psi$ & Sec. \ref{sec:lb_ls_spherical}, \ref{sec:ld_constr_a}, \ref{sec:regular_ic} & Encoding function & $\psi\colon\cM\to\cC$ \\\hline
$[\cdot]\mod\cA$ & Sec. \ref{sec:ic}, \ref{sec:regular_ic} & Quantization error wrt $\alpha\bZ^n$ & $[\cdot]\mod\cA\coloneqq\cdot\mod\alpha\bZ^n$ \\\hline
$[\cdot]\mod\Lambda$ & Sec. \ref{sec:ld_constr_a} & Lattice quantization error & $[\cdot]\mod\Lambda\coloneqq\cdot- Q_\Lambda(\cdot)$ \\\hline
$(\cdot)^*$ & Sec. \ref{sec:ic}, \ref{sec:regular_ic} & Set modulo $\alpha\bZ^n$ & $(\cdot)^*\coloneqq\cdot\mod\cA$ \\\hline
\end{longtable}
\end{center}
\section{Calculations in the proof of Proposition~\ref{prop:lbound_randomspherical}}\label{sec:calc_prop_lbound_randomspherical}
\subsection{Lower bounding $\expt{W}$}\label{sec:lbound_EW}
\begin{align}
\expt{W}=&\sum_{\cL\in\binom{\cM}{L}}\sum_{\vy\in\cY}\prob{\psi\paren{\cL}\subset\cB^n\paren{\vy,\sqrt{nN}}}\label{eqn:enc_notation}\\
=&\binom{M}{L}\card{\cY}\mu^L\notag\\
\ge&\paren{M/L}^L\card{\cY}\mu^L,\notag
\end{align}
where in Eqn. \ref{eqn:expectation_ic} we use the shorthand notation
\[\psi(\cL)\coloneqq\curbrkt{\psi(m)\colon m\in\cL},\]
and $\mu$ is defined as follows,
\[\mu\coloneqq\frac{\area\paren{\C^{n-1}\paren{\sqrt{nN}}}}{\area\paren{\cS^{n-1}\paren{\sqrt{nP}}}}.\]
\subsection{Upper bounding $\var{W}$}\label{sec:ubound_varW}
For $\cL=\curbrkt{m_1,\cdots,m_L}$ and $\vy\in\cY$, define
\[\bI\paren{\vy,\cL}\coloneqq\one{\psi\paren{\cL}\subset\cB^n\paren{\vy,\sqrt{nN}}}.\]
Now the variance of $W$ can be bounded from above as follows,
\begin{align}
\var{W}=&\expt{W^2}-\expt{W}^2\notag\\
=&\sum_{\vy_1,\vy_2\in\cY}\sum_{\cL_1,\cL_2\in\binom{\cM}{L}}\expt{\bI\paren{\vy_1,\cL_1}\bI\paren{\vy_2,\cL_2}}-\expt{\bI\paren{\vy_1,\cL_1}}\expt{\bI\paren{\vy_2,\cL_2}}\notag\\
\le&\sum_{\cL\cap\cL_2\ne\emptyset}\sum_{\vy_1,\vy_2}\expt{\bI\paren{\vy_1,\cL_1}\bI\paren{\vy_2,\cL_2}}\label{eqn:indep}\\
=&\card{\cY}^2\sum_{\ell=1}^L\sum_{\card{\cL_1\cap\cL_2}=\ell}\probover{\vy_1,\vy_2,\cC}{\cE},\label{eqn:rewrite}
\end{align}
where
\begin{enumerate}
\item Eqn. \ref{eqn:indep} follows since for disjoint $\cL_1$ and $\cL_2$, $\bI\paren{y_1,\cL_1}$ and $\bI\paren{y_2,\bL_2}$ are independent, and we upper bound the variance simply by dropping the negative term;
\item in Eqn. \ref{eqn:rewrite} the probability is taken over the independent pairs $y_1,y_2$ sampled uniformly from $\cY$ and the code construction, and we define
\[\cE\coloneqq\curbrkt{\psi\paren{\cL_1}\subset\cB^n\paren{\vy_1,\sqrt{nN}},\;\psi\paren{\cL_2}\subset\cB^n\paren{\vy_2,\sqrt{nN}}}.\]
\end{enumerate}
It is easy to verify that for any $m\in\cL_1\cap\cL_2$, $\cE\subset\cE_1\cap\cE_2\cap\cE_3$, where
\begin{align}
\cE_1\coloneqq&\curbrkt{\vy_1\in\cB^n\paren{\psi\paren{m},\sqrt{nN}},\;\vy_2\in\cB^n\paren{\psi\paren{m},\sqrt{nN}}} ,\notag\\
\cE_2\coloneqq&\curbrkt{\forall m_1\in\cL\setminus\curbrkt{m},\;\psi\paren{m_1}\in\cB^n\paren{\vy_1,\sqrt{nN}}} ,\notag\\
\cE_3\coloneqq&\curbrkt{\forall m_2\in\cL_2\setminus\cL_1,\;\psi\paren{m_2}\in\cB^n\paren{\vy_2,\sqrt{nN}}} .\notag
\end{align}
Note that conditioned on $\cE_1$, $\cE_2$ and $\cE_3$ are independent, and
\begin{align}
\prob{\cE_1}=&\paren{\frac{\area\paren{\C^{n-1}\paren{\sqrt{nN\paren{P-N}/P}}}}{\area\paren{\cS^{n-1}\paren{\sqrt{n\paren{P-N}}}}}}^2 =\mu^2,\notag\\
\prob{\cE_2\cap\cE_3|\cE_1}=&\prob{\cE_2|\cE_1}\prob{\cE_3|\cE_1}=\mu^{L-1}\mu^{L-\ell}=\mu^{2L-\ell-1}.\notag
\end{align}
Note that
\[\mu\le\frac{\area\paren{\cS^{n-1}\paren{\sqrt{nN}}}}{\area\paren{\cS^{n-1}\paren{\sqrt{nP}}}}= c_12^{-n\frac{1}{2}\log\frac{P}{N}},\]
where $c_1\coloneqq\sqrt{P/N}$.
Note also that the number of pairs $\paren{\cL_1,\cL_2}$ with intersection size $\ell$ is
\[K_\ell\coloneqq\binom{M}{\ell}\binom{M-\ell}{L-\ell}\binom{M-L}{L-\ell}\le M^{2L-\ell}.\]
Hence overall we have
\begin{align}
\var{W}\le&\card{\cY}^2\sum_{\ell=1}^LK_\ell\mu^{2L-\ell+1}\notag\\
\le&\card{\cY}^2\mu\sum_{\ell=1}^L\paren{M\mu}^{2L-\ell}\notag\\
\le&\card{\cY}^2\mu L\paren{M\mu}^{L}\label{eqn:take_l}\\
=&\card{\cY}^2LM^L\mu^{L+1},\notag
\end{align}
where Eqn. \ref{eqn:take_l} is obtained by noting that $M\mu\le2^{nR}c_12^{-n\frac{1}{2}\log\frac{P}{N}}= c_12^{-\delta n}$ and taking the dominating term corresponding to $\ell=L$.
\section{A primer on lattices and nested lattice codes}\label{sec:primer_lattices}
For a tutorial introduction to lattices and their applications, see the book by Zamir~\cite{zamir2014latticebook} or the notes by Barvinok~\cite{barvinok2013math669}.
If $ \vv_1,\ldots,\vv_\kappa $ are linearly independent vectors in $ \bR^n $, then the set of all integer linear combinations of $ \vv_1,\ldots,\vv_\kappa $ is called the lattice generated by the vectors $ \vv_1,\ldots,\vv_\kappa $, i.e.,
\[
\Lf \coloneqq \curbrkt{\sum_{i=1}^{\kappa}a_i\vv_i: a_i\in\bZ }.
\]
If $ \bfG=[\vv_1\cdots \vv_\kappa] $, then we can write $ \Lf = \bfG\bZ^\kappa $. The matrix $ \bfG $ is called a generator matrix for $ \Lf $. The generator matrix of a lattice is not unique.
The integer $ \kappa $ is invariant for a lattice and is called the rank of $ \Lf $. In this paper, we only consider lattices in $ \bR^n $ having rank $ n $.
It is obvious that $ \Lf $ is a discrete subgroup of $ \bR^n $ under vector addition. It is also a fact that every discrete subgroup of $ \bR^n $ is a lattice~\cite{barvinok2013math669}.
For any lattice $ \Lf $, it is natural to define the quantizer $ Q_{\Lf} $ which maps every point in $ \bR^n $ to the closest lattice point, i.e., for every $ \vx\in\bR^n $,
\begin{equation}
\label{eqn:lattice_quant}
Q_{\Lf}(\vx) \coloneqq \argmin{\vy\in\Lf}\Vert \vy-\vx \Vert,
\end{equation}
where we assume that ties (in computing the closest lattice point) are resolved according to some arbitrary but fixed rule. Associated with the quantizer is the quantization error
\[
[\vx]\bmod \Lf \coloneqq \vx - Q_{\Lf}(\vx).
\]
For every lattice $ \Lf $, we define the following parameters:
\begin{itemize}
\item The set $$ \cP(\Lf)\coloneqq \{ \bfG\vx:\vx\in [0,1 )^n \}, $$
where $ \bfG $ is a generator matrix of $ \Lf $, is called the fundamental parallelepiped of $ \Lf $.
\item The fundamental Voronoi region $ \cV(\Lf) $ is the set of all points in $ \bR^n $ which are closest to the zero lattice point. In other words,
\[
\cV(\Lf) \coloneqq \{ \vx\in\bR^n: Q_{\Lf}(\vx) = 0 \}.
\]
Any set $ \cS\subset \bR^n $ such that the set of translates of $ \cS $ by lattice points, i.e., $ \{\cS+\vx :\vx\in\Lf \} $ form a partition of $ \bR^n $, is called a fundamental region of $ \Lf$. It is a fact that every fundamental region of $ \Lf $ has the same volume equal to $\det\Lf\coloneqq |\det(\bfG)| $, where $ \bfG $ is any generator matrix of $ \Lf $. The quantity $\det \Lf $ is called the determinant or covolume of $ \Lf $.
\item The covering radius $ \rcov(\Lf) $ is the radius of the smallest closed ball in $ \bR^n $ which contains $ \cV(\Lf) $. It is also equal to the length of the largest vector within $ \cV(\Lf) $.
\item The packing radius $ \rpack(\Lf) $ is the radius of the largest open ball which is contained within $ \cV(\Lf) $. Equivalently, it is half the minimum distance between two lattice points.
\item The effective radius $ \reff(\Lf) $ is equal to the radius of a ball having volume equal to $ \vol(\cV(\Lf)) $.
\end{itemize}
Clearly, we have $ \rpack(\Lf)\leq \reff(\Lf)\leq \rcov(\Lf) $.
In the context of power-constrained communication over Gaussian channels, a nested lattice code is typically the set of all lattice points within a convex compact subset of $ \bR^n $, i.e., $ \cC = \Lf\cap\cB $ for some set $ \cB\subset \bR^n $. Usually $ \cB $ is taken to be $ \cB(0,\sqrt{nP}) $ or $ \cV(\Lc) $ for some lattice $ \Lc $ constructed so as to satisfy the power constraint.
If $ \Lc,\Lf $ are two lattices in $ \bR^n $ with the property that $ \Lc\subsetneq\Lf $, then $ \Lc $ is said to be nested within (or, a sublattice of) $ \Lf $. A nested lattice code with a fine lattice $ \Lf $ and coarse lattice $ \Lc\subsetneq \Lf $ is the lattice code $ \Lf\cap\cV(\Lc) $.
Lattices have been extensively used for problems of packing, covering and communication over Gaussian channels. For many problems of interest, we want to construct high-dimensional lattices $ \Lf $ such that $ \rpack(\Lf)/\reff(\Lf) $ is as large as possible, and $ \rcov(\Lf)/\reff(\Lf) $ is as small as possible. A class of lattices that has these properties is the class of Construction-A lattices, which we describe next.
Let $ q $ be a prime number, and $ \cC_{\mathrm{lin}} $ be an $ (n,\kappa) $ linear code over $ \bFq $. The Construction-A lattice obtained from $ \cC_{\mathrm{lin}} $ is defined to be
\[
\Lf(\cC_{\mathrm{lin}}) \coloneqq \{ \vv\in\bZ^n: [\vv]\bmod (q\bZ^n)\in\Phi(\cC) \},
\]
where $ \Phi $ denotes the natural embedding of $ \bFq^n $ in $ \bR^n $.
An equivalent definition is that $ \Lf(\cC_{\mathrm{lin}}) = \Phi(\cC_{\mathrm{lin}})+q\bZ^n $.
We make use of the following result to choose our coarse lattices:
\begin{theorem}[\cite{erez2005lattices}]
For every $ \delta>0 $,
there exist sequences of prime numbers $ q_n $ and positive integers $ \kappa_n $ such that if $ \cC_{\mathrm{lin}} $ is a randomly chosen linear code\footnote{The $ (n,\kappa_n) $ random code is obtained by choosing an $ n\times \kappa_n $ generator matrix uniformly at random over $ \bFq $.} over $ \bF_{q_n} $, then
\[
\Pr\left[ \frac{\rpack(\Lf(\cC_{\mathrm{lin}}))}{\reff(\Lf(\cC_{\mathrm{lin}}))}<\frac{1}{2}-\delta \text{ or } \frac{\rcov(\Lf(\cC_{\mathrm{lin}}))}{\reff(\Lf(\cC_{\mathrm{lin}}))}>1+\delta\right] = o(1).
\]
\end{theorem}
\section{Goodness properties of $(\alpha,M)$ random infinite constellations}\label{sec:ic_goodness}
\subsection{Packing goodness}\label{sec:ic_packing}
The packing radius of an IC $ \rpack(\cC) $ is defined to be half the minimum distance between two points.
We say that an infinite constellation is good for packing if $ \rpack(\cC)/\reff(\cC)\geq 0.5-o(1) $.
As a warm-up, we give a greedy construction which is good for packing.
Choose $ \alpha $ to be some constant larger than $ 4 $. We will construct an infinite constellation with packing radius at least $ 1 $.
The IC is constructed iteratively as follows:
Start with an arbitrary point $ \vx_1 $. At the $ i $th step, choose $ \vx_i $ to be an arbitrary point from $ \cA\backslash \cup_{j=1}^{i-1}\cB^*(\vx_j,2) $. We repeat this till the $ \cB^*(\vx_j,2) $'s cover $ \cA $. Suppose that the algorithm terminates at the $ M $th step.
The construction ensures that the packing radius is at least $ 1 $. Moreover,
\[ M\geq \frac{\alpha^n}{\vol(\cB(0,2))} \]
However, $ \alpha^n/M=V_n\reff^n $. Using this in the above gives $ \rpack/\reff\geq 0.5 $.
\subsection{AWGN goodness}\label{sec:ic_awgn}
We say that an $(\alpha, M)$ infinite constellation $ \cC $ is good for AWGN (Additive White Gaussian Noise) \cite{erez2005lattices} if for $ \vbfz\sim \cN(0,\sigma^2\bfI) $ and $ \vbfx\sim\cU(\cC\cap \cA) $, we have
\[
\Pr[\Vert \vbfz \Vert>\Vert \vbfx +\vbfz-\vx_j \Vert \text{ for some }\vx_j\in \cC] =2^{-\Theta(n)}
\]
where the probability is over the random choice of the codeword $ \vbfx $ and the noise $ \vbfz $. This is equal to the probability that a codeword different from the transmitted one is closer to the recieved vector when a random codeword is transmitted through an AWGN channel.
The following proposition recovers the achievability part of Poltyrev's \cite{poltyrev1994coding} result:
\begin{proposition}
Fix $ \delta>0 $ and $ N>0 $. A random $ (4\sqrt{n\sigma^2}, M) $ constellation with $ M $ chosen so as to satisfy $ \reff/\sqrt{n\sigma^2}>2^{\delta} $ is good for AWGN with probability $ 1-2^{-\Theta(n)} $.
\end{proposition}
\begin{proof}
Since codewords are uniformly chose, it suffices to assume that the first codeword is transmitted.
\begin{align*}
\bE_{\cC}\Pr[\Vert \vbfz \Vert>\Vert \vbfx +\vbfz-\vx_j \Vert \text{ for some }\vx_j\in \cC] &\leq \Pr[\Vert\vbfz\Vert^2>2^{\delta}n\sigma^2]+\Pr[\vx_j\in\cB^*(\vx_1+\vbfz,\sqrt{n\sigma^2}2^{\delta/2})\text{ for some }j\neq 1]\\
&\leq \Pr[\Vert\vbfz\Vert^2>2^{\delta}n\sigma^2]+\sum_{j=2}^M\Pr[\vx_j\in\cB^*(\vx_1+\vbfz,\sqrt{n\sigma^2}2^{\delta/2})]\\
&\leq 2^{-\Theta(n)}+ M\frac{\vol(\cB(0,\sqrt{n\sigma^2}2^{n\delta/2}))}{\alpha^n}\\
&= 2^{-\Theta(n)}+ \frac{\vol(\cB(0,\sqrt{n\sigma^2}2^{n\delta/2}))}{\vol(\cB(0,\reff))}\\
&=2^{-\Theta(n)}
\end{align*}
\end{proof}
\bibliographystyle{IEEEtran}
| {'timestamp': '2019-01-15T02:04:38', 'yymm': '1901', 'arxiv_id': '1901.03790', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03790'} | arxiv |
\section{Introduction}
Purpose of this study is to build a network growth model that is able to generate synthetic networks which resemble real-world social networks. Existing network growth models in the literature often aim to reproduce only a very small set of network statistics. Our work, on the other hand, attempts to reproduce a larger list of various statistics to evaluate the proposed model's accuracy.
The contribution of this study includes using combination of different growth mechanisms under a community-aware framework, providing a growth model to understand evolution of many social networks, and providing a generative mechanism which can be used in generating synthetic networks.
The rest of this study is structured as follows. In Section 2, the relevant literature is briefly reviewed. In Section 3, the proposed model is formally described. In section 4, experimental results and findings are presented. The conclusion and final remarks are given in Section 5.
\section{Background}
Generally speaking, random graph models assume that the probabilities of links (edges) between nodes (vertices) are independent of each other and equal. There are closely related versions of random graph models. For instance, in original Erdos-Renyi model (Erdos \& Renyi, 1959), all graphs on a fixed node set with a fixed number of links are equally likely. On the other hand, in the model introduced by Gilbert (1959), each link has a fixed probability of being present or absent, independently of the other links.
Random graph models and many other popular models in the literature are originally static models which enable the study of structural features of networks. Another category of network models is growth models (also called as generative network models). Preferential attachment model is an example of a model in the latter category. (Simon, 1955), (Price, 1976), (Barabasi \& Albert, 1999) are the seminal papers on preferential attachment model. The main idea behind this model is as follows. At each time, a new node arrives and makes a certain number of links with existing nodes using the node degrees as probability of making a link with the node. This mechanism is able to generate a degree distribution which follows a power law which is observed in most real-world networks.
Triadic closure is a concept in social network theory, first suggested by German sociologist Simmel (1908). It follows the idea that two nodes are more likely to be connected if they have common neighbors. Generalizing this, we can consider $n$-th order neighbors instead of only first-order neighbors. In this way, for instance, a quadrangle-closure implies that two nodes are more likely to be connected if they have neighbors who are neighbors with each other. Once a quadrangle is closed, a four-cycle is created. Lazega and Pattison (1999) examine whether cycles larger than tri-cycles could be observed in an empirical setting to a greater extent than could be accounted for by parameters for configurations involving at most three nodes. Snijders et al. (2006) describe this as four-cycle partial conditional dependence and proposes it as a new configuration.
Kimura et al. (2004) present a model where links are created by a mixture of preferential attachment, uniform attachment, and community-based attachment model. Leskovec et al. (2008) propose a network evolution model considering the micromechanisms in social networks. Their model utilizes preferential attachment and triangle-closure models in creating links. Lim et al. (2016) provide a comprehensive review of different approaches in generating realistic synthetic graphs.
\section{Proposed Model}
The proposed model works in discrete time steps. It assumes that each node belongs to exactly one community. At each time step, a new link is to be created. Nodes are assumed to arrive in uniform time intervals. The time interval is found by dividing number of links ($m$) to number of nodes ($n$), thus a new node arrives at each $m/n$-th step.
When a new node arrives, it is assigned a community label with respective probabilities given as input. Then, the arriving node makes a link either within its community or in the whole network based on respective probabilities specified by the input parameter. The link can be made with a uniformly selected random node or with a node selected by using node degrees as the proxy probabilities (i.e., preferential attachment). If the link is to be made within community, node degrees for preferential attachment process is calculated only considering the links in the community.
At the time steps where no new node arrives, a new link is created between the existing nodes. One end of the link is selected randomly among all existing nodes. The other end is selected within community/in whole network, randomly or based on preferential attachment model; similar to the procedure explained previously for a newly arriving node. However, another mechanism is available for links between existing nodes that is not available for newly arriving nodes: triangle or quadrangle closing models. For a given node, a triangle is closed by making a link to its second-order neighbor. A quadrangle is closed by making a link to its third-order neighbor. More mechanisms can be created based on the proposed $n$-th order specification but considering that diameter and average path length of observed networks are relatively small, including such mechanisms with higher $n$ value would mean making a link specifically to a distant node rather than a node in the neighborhood.
The selection of mechanisms (e.g., within community/in whole network, random/preferential attachment/triangle-closure/quadrangle-closure) are controlled by input parameters. In some cases, the selected mechanism is not able to generate a new link for reasons such as lack of possible triangles or quadrangles, or because all possible links for the given node and mechanism already exist in the network. In those cases, at that time step, no action is performed and model continues with the next time step. Although the property of uniform arrival of nodes is distorted, the resulting network still has $n$ nodes and $m$ links.
In addition, potential target nodes are selected before checking whether they already have a link with the source node. If a selected node is already connected, no action is performed at that time step too. This also results in violation of uniform arrival of nodes. However, we chose to keep it this way to prevent overdensification of relatively small communities where a randomly selected node is more likely to be an immediate neighbor.
Each mechanism employed in \textit{ComAwareNetGrowth} model corresponds to the simplified versions of possible link formations in real-world networks. The stronger the communities, the more probable for a node to make connection within its community. Random links are usually less frequent in most social networks but actually an existing mechanism. Preferential attachment reflects the 'rich get richer' phenomena. Triangle closures and quadrangle closures are justified by the observation that nodes are usually more likely to make links within their neighborhood rather than distant nodes.
Algorithm 1 presents our proposed model in general with omitting some details. The complete source code in R software language and some network datasets generated using the proposed methodology are available at \href{https://furkangursoy.github.io}{\textit{furkangursoy.github.io}}.
\begin{algorithm}[ht]
\caption{\textit{ComAwareNetGrowth}: The Proposed Community-aware Network Growth Model}
\label{alg:ouralgorithm}
\centering
\includegraphics[width=0.97\linewidth]{algorithm.png}
\end{algorithm}
\section{Experimental Analysis}
In this section, several experiments are conducted and results are analyzed. In the first part, we attempt to generate two real-world undirected simple social networks: Zachary's Karate Club (Zachary, 1977) and Caltech Facebook Network (Traud et al., 2011). The first network, called as Karate in the rest of the study, is a well-known social network of a university karate club where links exist between members who interact outside the club. The latter network, called as Caltech in the rest of the study, consists of the complete set of users from the Facebook network of California Institute of Technology.
Table 1 displays various statistics of the two networks. The statistics are calculated using R's igraph package. In calculation of modularity; first, communities are detected by utilizing fast greedy community detection algorithm available in R. Estimated communities, then, are used in calculation of modularity. The sizes of the found communities are also utilized as input probabilities for belonging to communities in the network growth experiments.
\begin{table}[h!]
\centering
\caption{Network Statistics}
\small
\begin{tabular}{|l|r|r|r|r|r|r|r|}
\cline{2-8}
\multicolumn{1}{l|}{} & n & m & \begin{tabular}[c]{@{}r@{}}Clustering\\ Coefficient \end{tabular} & \begin{tabular}[c]{@{}r@{}}Avg. Path\\ Length \end{tabular} & Modularity & Diameter & \begin{tabular}[c]{@{}r@{}}Power Law\\ Exponent \end{tabular} \\
\hline
Karate & 34 & 78 & 0.26 & 2.41 & 0.38 & 5.00 & 2.55 \\
\hline
Caltech & 769 & 16656 & 0.29 & 2.34 & 0.33 & 6.00 & 1.50 \\
\hline
\end{tabular}
\end{table}
\newpage
\subsection{Experiments on Karate Network}
The following parameter values are used to generate a social network that mimics Karate network: $n = 34$, $m = 78$, $k = 3$, $C = \{0.24, 0.5, 0.26\}$, $comp = 0.8$, $rp_n = 0.22$, $pp_n = 0.78$, $rp_e =0.04$, $pp_e = 0.14$, $c3p_e = 0.41$, and $c4p_e = 0.41$. The experiments are repeated 10 times, and statistics for the generated and observed networks are given in Table 2.
On average, the proposed growth model with the given parameter settings is able to mimic the Karate network in general. However, modularity and and power law exponent\footnote{Most networks follow power-law in the tail. Accordingly, in fitting the power law, lower bound is set as 2 for Karate and 5 for all other experiments.} (Newman, 2005) statistics are not closely matched. Although most of the statistics can be generated with small standard deviations, modularity and clustering coefficient show relatively larger variations in these experiments. This might be due to the very small size of the network.
\begin{table}[h!]
\centering
\caption{Experimental Results for Karate Network}
\small
\begin{tabular}{|l|r|r|r|r|r|}
\cline{2-6}
\multicolumn{1}{l|}{} & \begin{tabular}[c]{@{}r@{}}Clustering\\ Coefficient \end{tabular} & \begin{tabular}[c]{@{}r@{}}Avg. Path\\ Length \end{tabular} & Modularity & Diameter & \begin{tabular}[c]{@{}r@{}}Power Law\\ Exponent \end{tabular} \\
\hline
Run\#1 & 0.18 & 2.32 & 0.26 & 4.00 & 2.20 \\
\hline
Run\#2 & 0.24 & 2.42 & 0.26 & 5.00 & 2.13 \\
\hline
Run\#3 & 0.22 & 2.35 & 0.20 & 4.00 & 2.10 \\
\hline
Run\#4 & 0.25 & 2.47 & 0.27 & 5.00 & 2.31 \\
\hline
Run\#5 & 0.19 & 2.50 & 0.34 & 5.00 & 2.22 \\
\hline
Run\#6 & 0.30 & 2.38 & 0.27 & 5.00 & 2.20 \\
\hline
Run\#7 & 0.20 & 2.31 & 0.21 & 5.00 & 2.24 \\
\hline
Run\#8 & 0.27 & 2.52 & 0.22 & 6.00 & 2.02 \\
\hline
Run\#9 & 0.30 & 2.55 & 0.22 & 6.00 & 2.14 \\
\hline
Run\#10 & 0.27 & 2.56 & 0.34 & 5.00 & 2.19 \\
\hline
\textbf{Mean} & \textbf{0.24} & \textbf{2.44} & \textbf{0.26} & \textbf{5.00} & \textbf{2.18} \\
\hline
\textit{StdDev} & \textit{0.04} & \textit{0.09} & \textit{0.05} & \textit{0.63} & \textit{0.08} \\
\hline
\textbf{Observed} & \textbf{0.26} & \textbf{2.41} & \textbf{0.38} & \textbf{5.00} & \textbf{2.55} \\
\hline
\textbf{Diff.} & \textbf{-0.02} & \textbf{0.03} & \textbf{-0.12} & \textbf{0.00} & \textbf{-0.37} \\
\hline
\end{tabular}
\end{table}
Figure 1 visualizes the communities found in the original Karate network and a synthetic network generated by our model. In the synthetic network, communities are less separated than the original network. Especially, two communities (displayed in white and black) do not come as separate communities. Note that, this is just one of the generated networks. Other networks might more closely resemble the original network.
\begin{figure}[h!]
\centering
\includegraphics[width=0.85\linewidth]{karate.png}
\caption{(a) Observed Network, (b) Generated Network}
\label{fig:boat1}
\end{figure}
\subsection{Experiments on Caltech Network}
The following parameter values are used to generate a network that mimics Caltech network: $n = 769$, $m = 16656$, $k=8$, $C = \{0.375, 0.341, 0.254, 0.017, 0.005, 0.004, 0.003, 0.003\}$, $comp = 0.85$, $rp_n = 0.333$, $pp_n = 0.666$, $rp_e = 0.091$, $pp_e = 0.182$, $c3p_e = 0.363$, and $c4p_e = 0.363$. The experiments are repeated 10 times, and statistics for the generated and observed networks are given in Table 3.
Experimental results show that average path length, modularity, and power law exponent are closely matched with negligible standard deviations. However, clustering coefficient and diameter values are not replicated successfully in terms of difference between the generated and observed statistic. Caltech network is a larger network than the Karate network. Therefore, as desired, variances in the generated statistics are almost zero. Consequently, it can be concluded that given a sufficient number of nodes and links, our proposed growth model is able to produce stable results.
\begin{table}[h!]
\centering
\renewcommand{\arraystretch}{0.97}
\caption{Experimental Results for Caltech Network}
\small
\setlength\tabcolsep{2.5pt}
\begin{tabular}{|l|r|r|r|r|r|}
\cline{2-6}
\multicolumn{1}{l|}{} & \begin{tabular}[c]{@{}r@{}}Clustering\\ Coefficient \end{tabular} & \begin{tabular}[c]{@{}r@{}}Avg. Path\\ Length \end{tabular} & Modularity & Diameter & \begin{tabular}[c]{@{}r@{}}Power Law\\ Exponent \end{tabular} \\
\hline
Run\#1 & 0.17 & 2.19 & 0.32 & 4.00 & 1.52 \\
\hline
Run\#2 & 0.17 & 2.20 & 0.32 & 4.00 & 1.52 \\
\hline
Run\#3 & 0.17 & 2.20 & 0.33 & 4.00 & 1.52 \\
\hline
Run\#4 & 0.17 & 2.19 & 0.34 & 4.00 & 1.52 \\
\hline
Run\#5 & 0.17 & 2.19 & 0.32 & 4.00 & 1.52 \\
\hline
Run\#6 & 0.17 & 2.19 & 0.33 & 4.00 & 1.52 \\
\hline
Run\#7 & 0.17 & 2.20 & 0.32 & 4.00 & 1.52 \\
\hline
Run\#8 & 0.17 & 2.20 & 0.33 & 4.00 & 1.52 \\
\hline
Run\#9 & 0.17 & 2.19 & 0.33 & 4.00 & 1.52 \\
\hline
Run\#10 & 0.17 & 2.20 & 0.32 & 4.00 & 1.52 \\
\hline
\textbf{Mean} & \textbf{0.17} & \textbf{2.20} & \textbf{0.33} & \textbf{4.00} & \textbf{1.52} \\
\hline
\textit{StdDev} & \textit{0.00} & \textit{0.00} & \textit{0.01} & \textit{0.00} & \textit{0.00} \\
\hline
\textbf{Observed} & \textbf{0.29} & \textbf{2.34} & \textbf{0.33} & \textbf{6.00} & \textbf{1.50} \\
\hline
\textbf{Diff.} & \textbf{-0.12} & \textbf{-0.14} & \textbf{0.00} & \textbf{-2.00} & \textbf{0.02} \\
\hline
\end{tabular}
\end{table}
\subsection{Other Experiments}
Another set of experiments are performed without the purpose of mimicking any real network but to explore the variety of networks which can be generated with our proposed growth model. Parameter settings for eight experiments are presented in Table 4. The first and last four experiments are the same except that $m=2000$ for former experiments whereas $m=5000$ for latter experiments, hence a denser network. Each experiment is repeated for 10 times. The mean and standard deviations of generated statistics are presented in Table 5.
\begin{table}[h!]
\centering
\renewcommand{\arraystretch}{0.97}
\caption{Settings for Other Experiments}
\small
\setlength\tabcolsep{2.4pt}
\begin{tabular}{|l|r|r|l|r|r|r|r|r|r|r|r|}
\cline{2-12}
\multicolumn{1}{l|}{} & \multicolumn{1}{l|}{$n$ } & \multicolumn{1}{l|}{$m$ } & $k$ & \multicolumn{1}{l|}{$C$ } & $comp$ & $rp_n$ & $pp_n$ & \multicolumn{1}{l|}{$rp_e$ } & \multicolumn{1}{l|}{$pp_e$ } & \multicolumn{1}{l|}{$c3p_e$ } & \multicolumn{1}{l|}{$c4p_e$ } \\
\hline
Exp\#1 & 500 & 2000 & 5 & \{.2, 0.2, 0.2, 0.2, 0.2\} & 0.50 & 0.50 & 0.5 & 0.25 & 0.25 & 0.25 & 0.25 \\
\hline
Exp\#2 & 500 & 2000 & 5 & \{.2, 0.2, 0.2, 0.2, 0.2\} & 0.75 & 0.33 & 0.66 & 0.10 & 0.20 & 0.30 & 0.40 \\
\hline
Exp\#3 & 500 & 2000 & 5 & \{.005, 0.055, 0.11, 0.28, 0.55\} & 0.75 & 0.33 & 0.66 & 0.10 & 0.20 & 0.30 & 0.40 \\
\hline
Exp\#4 & 500 & 2000 & 5 & \{.005, 0.055, 0.11, 0.28, 0.55\} & 0.25 & 0.17 & 0.83 & 0.12 & 0.63 & 0.12 & 0.12 \\
\hline
Exp\#5 & 500 & 5000 & 5 & \{.2, 0.2, 0.2, 0.2, 0.2\} & 0.50 & 0.50 & 0.50 & 0.25 & 0.25 & 0.25 & 0.25 \\
\hline
Exp\#6 & 500 & 5000 & 5 & \{.2, 0.2, 0.2, 0.2, 0.2\} & 0.75 & 0.33 & 0.66 & 0.10 & 0.20 & 0.30 & 0.40 \\
\hline
Exp\#7 & 500 & 5000 & 5 & \{.005, 0.055, 0.11, 0.28, 0.55\} & 0.75 & 0.33 & 0.66 & 0.10 & 0.20 & 0.30 & 0.40 \\
\hline
Exp\#8 & 500 & 5000 & 5 & \{.005, 0.055, 0.11, 0.28, 0.55\} & 0.25 & 0.17 & 0.83 & 0.12 & 0.63 & 0.12 & 0.12 \\
\hline
\end{tabular}
\end{table}
\begin{table}[h!]
\centering
\caption{Other Experimental Results}
\small
\setlength\tabcolsep{2.5pt}
\begin{tabular}{|l|l|r|r|r|r|r|}
\cline{3-7}
\multicolumn{1}{l}{} & & \begin{tabular}[c]{@{}r@{}}Clustering\\ Coefficient \end{tabular} & \begin{tabular}[c]{@{}r@{}}Avg. Path\\ Length \end{tabular} & Modularity & Diameter & \begin{tabular}[c]{@{}r@{}}Power Law\\ Exponent \end{tabular} \\
\hline
Exp\#1 & Mean & 0.10 & 3.31 & 0.38 & 7.50 & 2.41 \\
\cline{2-7}
& \textit{Std.Dev.} & \textit{0.00} & \textit{0.02} & \textit{0.01} & \textit{0.71} & \textit{0.03} \\
\hline
Exp\#2 & Mean & 0.11 & 3.33 & 0.47 & 7.60 & 2.41 \\
\cline{2-7}
& \textit{Std.Dev.} & \textit{0.00} & \textit{0.03} & \textit{0.01} & \textit{0.52} & \textit{0.04} \\
\hline
Exp\#3 & Mean & 0.10 & 3.29 & 0.34 & 7.60 & 2.39 \\
\cline{2-7}
& \textit{Std.Dev.} & \textit{0.00} & \textit{0.02} & \textit{0.02} & \textit{0.70} & \textit{0.03} \\
\hline
Exp\#4 & Mean & 0.11 & 3.39 & 0.42 & 7.60 & 2.47 \\
\cline{2-7}
& \textit{Std.Dev.} & \textit{0.01} & \textit{0.02} & \textit{0.01} & \textit{0.52} & \textit{0.04} \\
\hline
Exp\#5 & Mean & 0.15 & 2.51 & 0.36 & 5.10 & 1.82 \\
\cline{2-7}
& \textit{Std.Dev.} & \textit{0.00} & \textit{0.00} & \textit{0.01} & \textit{0.32} & \textit{0.01} \\
\hline
Exp\#6 & Mean & 0.16 & 2.52 & 0.44 & 4.90 & 1.81 \\
\cline{2-7}
& \textit{Std.Dev.} & \textit{0.00} & \textit{0.01} & \textit{0.00} & \textit{0.32} & \textit{0.01} \\
\hline
Exp\#7 & Mean & 0.15 & 2.51 & 0.31 & 5.20 & 1.82 \\
\cline{2-7}
& \textit{Std.Dev.} & \textit{0.00} & \textit{0.01} & \textit{0.01} & \textit{0.42} & \textit{0.01} \\
\hline
Exp\#8 & Mean & 0.17 & 2.55 & 0.40 & 5.00 & 1.82 \\
\cline{2-7}
& \textit{Std.Dev.} & \textit{0.00} & \textit{0.01} & \textit{0.02} & \textit{0.00} & \textit{0.01} \\
\hline
\end{tabular}
\end{table}
The experiments confirm that standard deviations are indeed very low. Diameter might be seen as an exception to this but it is mostly due to the nature of that statistic. Since it is an integer value, even if the model generates only two adjacent integer values for this statistic, standard deviation might come as large at the first sight.
As the number of links increase from 2000 to 5000, values for average path Length and diameter get smaller as expected. On the other hand, clustering coefficent increases. There does not seem to be a meaningful change in the values of modularity.
\section{Conclusion}
In this work, we have developed a network growth model with the aim of exploring the mechanisms behind most real-world networks, and being able to mimic real-world networks through these mechanisms. The proposed growth model serves as an initial step to build a realistic growth model which can generate graphs with any set of given statistics.
When there exist a sufficient number of nodes and links, our model generates networks which do not vary between themselves in terms of the network statistics employed in this study. Such stability is highly desired. However, some network statistics are not being successfully replicated. This might be because one or combination of the two things. First, parameter values are determined based on a few manual experiments rather than estimating them from the real network. Second, the mechanisms employed in the growth model might not be sufficient to generate any social network easily, which suggest further development of the model.
Given the limitations of the current work, more effort in future should be directed towards developing more accurate mechanisms, exploring relationships between the mechanisms, and estimating parameter values via more systematic calibration experiments.
\newpage
\section*{References}
Barabasi, A. L., \& Albert, R. (1999). Emergence of scaling in random networks. Science, 286(5439), 509-512. doi:10.1126/science.286.5439.509\vspace{4pt}
\noindent Erdos, P., \& Renyi, A. (1959). On random graphs I. Publicationes Mathematicae (Debrecen), 6, 290-297.\vspace{4pt}
\noindent Gilbert, E. N. (1959). Random graphs. The Annals of Mathematical Statistics, 30(4), 1141-1144.\vspace{4pt}
\noindent Kimura, M., Saito, K., \& Ueda, N. (2004). Modeling of growing networks with directional attachment and communities. Neural Networks, 17(7), 975-988. doi:10.1016/j.neunet.2004.01.005\vspace{4pt}
\noindent Lazega, E., \& Pattison, P. E. (1999). Multiplexity, generalized exchange and cooperation in organizations: A case study. Social Networks, 21(1), 67-90. doi:10.1016/s0378-8733(99)00002-7\vspace{4pt}
\noindent Leskovec, J., Backstrom, L., Kumar, R., \& Tomkins, A. (2008). Microscopic evolution of social networks. Proceeding of the 14th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining - KDD 08. doi:10.1145/1401890.1401948\vspace{4pt}
\noindent Lim, S., Lee, S., Powers, S. S., Shankar, M., \& Imam, N. (2016). Survey of Approaches to Generate Realistic Synthetic Graphs. doi:10.2172/1339361\vspace{4pt}
\noindent Newman, M. (2005). Power laws, Pareto distributions and Zipfs law. Contemporary Physics, 46(5), 323-351. doi:10.1080/00107510500052444\vspace{4pt}
\noindent Price, D. D. (1976). A general theory of bibliometric and other cumulative advantage processes. Journal of the American Society for Information Science, 27(5), 292-306. doi:10.1002/asi.4630270505\vspace{4pt}
\noindent Simmel, G. (1908). Sociologie. Untersuchungen über die Formen der Vergesellschaftung. Duncker \& Humblot.\vspace{4pt}
\noindent Simon, H. A. (1955). On a Class of Skew Distribution Functions. Biometrika, 42(3/4), 425. doi:10.2307/2333389\vspace{4pt}
\noindent Snijders, T. A., Pattison, P. E., Robins, G. L., \& Handcock, M. S. (2006). New Specifications for Exponential Random Graph Models. Sociological Methodology, 36(1), 99-153. doi:10.1111/j.1467-9531.2006.00176.x\vspace{4pt}
\noindent Traud, A. L., Kelsic, E. D., Mucha, P. J., \& Porter, M. A. (2011). Comparing Community Structure to Characteristics in Online Collegiate Social Networks. SIAM Review, 53(3), 526-543. doi:10.1137/080734315\vspace{4pt}
\noindent Zachary, W. W. (1977). An Information Flow Model for Conflict and Fission in Small Groups. Journal of Anthropological Research, 33(4), 452-473. doi:10.1086/jar.33.4.3629752\vspace{4pt}
\end{document}
| {'timestamp': '2019-01-14T02:20:01', 'yymm': '1901', 'arxiv_id': '1901.03629', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03629'} | arxiv |
\section{Learning to Regularize}
In this paper we consider solving linear inverse problems in imaging in which a $p$-pixel image, $\bbeta^\star \in \mathbb{R}^p$ (in vectorized form), is observed via $m$ noisy linear projections as $\bm{y} = \bm{X}\bbeta^\star + \bm{\epsilon}$, where $\bm{y},\bm{\epsilon} \in \mathbb{R}^m$ and $\bm{X} \in \mathbb{R}^{m\times p}$. This general model is used throughout computational imaging, from basic image restoration tasks like deblurring, super-resolution, and image inpainting \cite{dip}, to a wide variety of tomographic imaging applications, including common types of magnetic resonance imaging \cite{fessler2010model}, X-ray computed tomography \cite{elbakri2002statistical}, radar imaging \cite{blahut2004theory}, among others \cite{barrett2013foundations}. The task of estimating $\bbeta^\star$ from $\bm{y}$ is often referred to as {\em image reconstruction}. Classical image reconstruction methods assume some prior knowledge about $\bbeta^\star$ such as smoothness \cite{tychonoff1977solution}, sparsity in some dictionary or basis \cite{figueiredo2005bound,mairal2009online,yu2012solving}, or other geometric properties \cite{rudin1992nonlinear,willett2003platelets,danielyan2012bm3d,marais2017proximal}, and attempt to estimate a $\widehat\bbeta$ that is
both a good fit to the observation $\bm{y}$ and that also conforms to this prior knowledge. In general, a {\em regularization function} $r(\bm{\beta})$ measures the lack of conformity of $\bm{\beta}$ to this prior knowledge and $\widehat\bbeta$ is selected so that $r(\widehat\bbeta)$ is as small as possible while still providing a good fit to the data.
However, recent work in computer vision using deep neural networks has leveraged large collections of ``training'' images to yield unprecedented image recognition performance \cite{he2016deep, huang2017densely, larsson2016fractalnet}, and an emerging body of research is exploring whether this training data can also be used to improve the quality of image reconstruction. In other words, {\em can training data be used to learn how to regularize inverse problems?} As we detail below, existing methods include using training images to learn a low-dimensional image manifold and constraining $\widehat\bbeta$ to lie on this manifold \cite{bora2017compressed} or learning a denoising autoencoder that can be treated as a regularization step ({\em i.e.,~} proximal operator) within an iterative reconstruction scheme \cite{meinhardt2017learning}.
In this paper, we propose a novel neural network architecture based on the Neumann series expansion \cite{schafheitlin1908theorie,gohberg2013basic} that we call a {\em Neumann network}, describe several of its key theoretical properties, and empirically illustrate its superior performance on a variety of reconstruction tasks. In particular,
\begin{itemize}[leftmargin=*]
\item Neumann networks, which directly incorporate the forward operator $\bm{X}$ into the network architecture, can have dramatically lower sample complexity than {\em model-agnostic} networks that attempt to learn the entire image space. As a result, they are much more amenable to applications such as medical imaging or scientific domains where datasets may be smaller.
\item Neumann networks naturally yield a block-wise structure with {\em skip connections} \cite{he2016deep} emanating from each block. These skip connections appear to yield a smoother optimization landscape that is easier to train than related network architectures.
\item When the images of interest lie on a union of subspaces, and when the trainable nonlinear components of the network have sufficient expressiveness/capacity, there exists
a Neumann network estimator that approximates the optimal oracle estimator arbitrarily well. Furthermore, after training the Neumann network on simulated data drawn from a union of subspaces, we show the learned nonlinear components in the trained Neumann network have the form predicted by theory.
\item A simple preconditioning step combined with the Neumann network further improves empirical performance.
\item The empirical performance of the Neumann network on superresolution, deblurring, compressed sensing, and inpainting problems exceeds that of competing methods.
\end{itemize}
\section{Previous Work}\label{sec:previous}
There are several general categories of methods used to learn to solve inverse problems, which are reviewed below. Throughout, we assume we have training samples of the form $(\bm{\beta}_i,\bm{y}_i)$ for $i = 1,\ldots,N$, where $\bm{y}_i = \bm{X} \bm{\beta}_i + \bm{\epsilon}_i$, $\bm{X} \in \mathbb{R}^{m \times p}$ is known and the noise $\bm{\epsilon}_i$ is treated as unknown.
\subsection{Agnostic}
An agnostic learner uses the training data to learn a mapping from $\bm{y}$ to $\bm{\beta}$ without any knowledge of $\bm{X}$ at any point in the training or testing process \cite{xu2014deep}.
The general principle is that, given enough training data, we should be able to learn everything we need to know about $\bm{X}$ to successfully estimate $\bm{\beta}$. Empirically, the success of this approach appears to be highly dependent on the forward operator $\bm{X}$. This straightforward approach has been demonstrated on superresolution \cite{dong2014learning, ledig2017photo}, blind deconvolution \cite{xu2014deep}, and motion deblurring \cite{tan2017motion}, among others. In general, this approach requires large quantities of training data because it is required to not only learn the geometry of the image space containing the $\bm{\beta}$'s, but also aspects of $\bm{X}$. A particularly successful approach to solving inverse problems with neural networks has been through residual learning \cite{he2016deep}.
\subsection{Decoupled}
\label{sec:decoupled}
A decoupled approach operates in two stages. In the first stage, a collection of training images $\bm{\beta}_i$ is used to learn a representation of the image space of interest. In the second stage, this learned representation is incorporated into a mapping from $(\bm{y},\bm{X})$ to $\widehat\bbeta$. That is, the learning takes place in a manner that is decoupled from the inverse problem at hand. Here we present two examples of this.
First, we might learn a generative model $G$ for $\bm{\beta}$'s that takes as input a low-dimensional vector $\bm{z} \in \mathbb{R}^d$ for $d < p$ and outputs $\bm{\beta} = G(\bm{z})$. The basic idea is that the images of interest lie on a low-dimensional submanifold that can be indexed by $\bm{z}$. Given the learned $G$, we can compute $\widehat\bbeta$ from $\bm{y}$ via
\begin{align}
\widehat\bbeta = \argmin_{{\bm{\beta} = G(\bm{z}), \bm{z} \in \mathbb{R}^d}} \| \bm{y} - \bm{X} \bm{\beta} \|_2^2.
\end{align}
This approach was described in \cite{bora2017compressed} with compelling empirical performance for compressed sensing.
Alternatively, we might learn a denoising autoencoder that could be used as a proximal operator in an iterative reconstruction method. Specifically, imagine we had a fixed regularizer $r(\cdot)$ and want to set
\begin{equation}\label{eq:obj}
\widehat\bbeta = \argmin_{\bm{\beta}} \frac{1}{2}\|\bm{y} - \bm{X} \bm{\beta} \|_2^2 + r(\bm{\beta}).
\end{equation}
A proximal gradient algorithm \cite{schmidt2011convergence,parikh2014proximal} starts with an initial estimate $\bm{\beta}^{(0)}$ and step size $\eta > 0$ and then iterates between computing a gradient descent step that pushes the current estimate $\bm{\beta}^{(k)}$ to be a better fit to the data, followed by a {\em proximal operator} that finds an estimate in the proximity of the resulting iterate that is well-regularized (as measured by $r(\cdot)$). This second step is often thought of as a denoising step. One approach to learning to solve inverse problems is to implicitly learn $r(\cdot)$ by explicitly learning a proximal operator in the form of a denoising autoencoder \cite{meinhardt2017learning, chang2017one, gupta2018cnn}.
The key feature in both of these approaches is that all training takes place independently of $\bm{X}$ -- {\em i.e.,~} we either learn a generative model or a proximal operator using the training data, neither of which require knowledge of $\bm{X}$. The advantage of this approach is that once training has taken place, the learned generative model or proximal operator can be used for {\em any} linear inverse problem, so we do not need to re-train a system for each new inverse problem. In other words, the learning is {\em decoupled} from solving the inverse problem.
However, the flexibility of the decoupled approach comes with a high price in terms of sample complexity. To see why, note that learning a generative model or a denoising autoencoder fundamentally amounts to estimating a probability distribution and its support over the space of images; let us denote this distribution as $\phi(\bm{\beta})$. Thoroughly understanding the space of images of interest is important if our learned regularizer is to be used for linear inverse problems of which we are unaware during training.
On the other hand, when we know $\bm{X}$ at training time, then we only need to learn the {\em conditional} distribution $\phi(\bm{\beta} | \bm{X} \bm{\beta})$ or $\phi(\bm{\beta} | \bm{y})$ \cite{efromovich2007conditional}.
For example, imagine an image inpainting scenario in which we only observe a subset of pixels in the image $\bm{\beta}$. Rather than learn the distribution over the space of all possible images, we only need to learn the distribution over the space of missing pixels conditioned on the observed pixels, $\phi(\bm{\beta} | \bm{X} \bm{\beta})$. Of course, $\phi(\bm{\beta} | \bm{X} \bm{\beta})$ can be calculated from $\phi(\bm{\beta})$ and $\bm{X}$ using Bayes' law, but the latter distribution may lie in a much lower-dimensional space, making it easier to learn with limited data.
It is well-known that the accuracy of any estimate of $\phi(\bm{\beta})$ has a minimax rate that scales as ${\cal O}(N^{-\frac{\alpha}{2\alpha+p}})$ with $N$ the number of training samples, $p$ the dimension of $\phi(\bm{\beta})$, and $\alpha$ a smoothness term \cite{donoho1996density,delyon1996minimax,lafferty2008minimax}. This scaling is quite restrictive, but if the conditional density only depends on a subset of size $p'$ of the original $p$ coordinates, the rate for estimating the conditional density function is ${\cal O}(N^{-\frac{\alpha}{2\alpha+p'}})$ \cite{efromovich2007conditional}.
The key point is that decoupled approaches (implicitly) require learning the full density $\phi(\bm{\beta})$, whereas a method that incorporates $\bm{X}$ into the learning process has the potential to simply learn the conditional density $\phi(\bm{\beta} | \bm{X}\bm{\beta})$, which often can be performed accurately with relatively little training data. This observation is supported by our experimental results, which illustrate that decoupled approaches generally require far more training samples than methods that incorporate knowledge of $\bm{X}$.
\begin{figure*}[ht!]
\centering
\includegraphics[width=\textwidth]{figures/netfig_gdn.pdf}
\caption{\small Unrolled gradient descent network. The result of $B$ iterations of gradient descent with a fixed step size $\eta$ and regularizer with gradient $R$, as in \eqref{eq:gdn} is equivalent to the output of the above network, with each block corresponding to a single iteration. The network maps a linear function of the measurements, $\bm{\beta}^{(0)} = \eta \bm{X}^\top\bm{y}$, to a reconstruction $\widehat\bbeta$ by successive application of an operator of the form $[\bm{I}-\eta\bm{X}^\top\bm{X}](\cdot)-\eta R(\cdot)$ and addition of $\eta \bm{X}^\top \bm{y}$. Here $R$ is a trained neural network, and the scale parameter $\eta$ is also trained.
}
\label{fig:GD}
\end{figure*}
\subsection{Unrolled Optimization} \label{sec:unrolled}
Another approach treats a learned component of a network as the gradient of a prior over the data or a proximal operator for a regularizer \cite{chen2017trainable}. Suppose the desired optimal point $\bbeta^\star$ satisfies the optimality condition in \eqref{eq:obj}
Now we assume $r(\cdot)$ is differentiable and
let $R(\bm{\beta}):= \nabla r(\bm{\beta})$ denote the gradient of the regularizer. Then solving \eqref{eq:obj} can be accomplished using iterative optimization; for instance, gradient descent would result in the iterates
\begin{equation}\label{eq:gdn}
\bm{\beta}^{(k+1)} = \bm{\beta}^{(k)} -\eta \left[\bm{X}^\top(\bm{X} \bm{\beta}^{(k)}-\bm{y}) + R(\bm{\beta}^{(k)})\right]
\end{equation}
for a step size $\eta > 0$.
Imagine computing these iterates for a fixed number of iterations, which we will denote $B$ (for Blocks, as will become clear shortly).
``Unrolling" an optimization method refers to taking an iterative optimization method and, instead of iterating until convergence, thinking of a series of $B$ iterates as a single operation to be applied to an input. This idea as applied to gradient descent is represented pictorially in Figure~\ref{fig:GD}. We can now represent the gradient of the regularizer, $R(\cdot)$, with a trainable neural network. In contrast to the decoupled approach described above, unrolled optimization methods learn the regularizer (or its gradient) in the context of the forward model $\bm{X}$ and training observations $\bm{y}_i$ by minimizing the disparity between the true $\bm{\beta}_i$ and $\widehat\bbeta(\bm{y}_i)$, the output of the full network (see Figure~\ref{fig:GD}). This end-to-end training sidesteps the sample complexity challenges described in Section~\ref{sec:decoupled}.
The unrolling approach can be applied to a variety of optimization algorithms beyond gradient descent. The earliest proposed unrolled inverse problem solver was \cite{Gregor2010LFA}, in which the authors proposed unrolling the Iterative Shrinkage and Thresholding Algorithm (ISTA) \cite{beck2009fast} and the coordinate descent algorithm;
further refinements of this approach were proposed in \cite{sprechmann2012learning,kamilov2016learning}. More recent work has illustrated the efficacy of unrolled optimization as applied to (proximal) gradient descent \cite{chen2017trainable,diamond2017unrolled,mardani2018neural}, alternating directions method of multipliers \cite{sun2016deep}, primal-dual methods \cite{adler2018learned}, half-quadratic splitting \cite{schmidt2014shrinkage,zhang2017learning}, block coordinate descent \cite{ravishankar2017physics, ravishankar2018deep,chun2018deep}, alternating minimization \cite{aggarwal2018modl}, iterative reweighted least squares \cite{aggarwal2018multi,pramanik2018off}, and approximate message passing \cite{metzler2017learned}. In proximal gradient settings, the learned neural network is interpreted as a learned proximal operator, whereas in the gradient descent network, the learned neural network is interpreted as the gradient of the regularizer at the input. In other words, for different unrolled optimization methods the learned neural network can play different roles.
While for practical reasons the number of blocks $B$ must be kept small in end-to-end training, empirically this does not appear to be an obstacle to good performance. For example, \cite{Gregor2010LFA} notes that end-to-end training reduces the iterations of the ISTA algorithm required to achieve a fixed error rate by a factor of 20, and \cite{diamond2017unrolled} achieve promising performance with $B = 8$ proximal gradient descent iterations.
Another strategy to enable deeper unrollings is to perform block-by-block training as in \cite{ravishankar2018deep}; however, this approach is unsuitable when the neural network weights are shared between blocks, which is the case in our setting. It is possible to relax the shared-weights assumption, but \cite{aggarwal2018modl} has illustrated that in the low-sample setting, different learned weights in each block can be suboptimal.
\section{Neumann Networks}
Below, we adopt the following strategy. First, we consider the setting in which the gradient of the regularizer is a linear operator and derive a simple Neumann series approximation to an optimal solution of \eqref{eq:obj}. We then consider the overall {\em Neumann network} formed if $R$ is represented by a (potentially nonlinear) neural network. In this section, we treat a nonlinear network operation as a heuristic that we justify theoretically in Section~\ref{sec:theory}. This section also describes a simple preconditioning step that can improve the accuracy of our approach and an explicit comparison between the proposed Neumann network and the unrolled gradient descent network described in Section~\ref{sec:unrolled}.
\begin{figure*}[ht!]
\centering
\includegraphics[width=\textwidth]{figures/netfig_nn.pdf}
\caption{\small {Proposed Neumann network architecture.} Inspired by the Neumann series expansion for computing the inverse of an operator, a Neumann network maps a linear function of the measurements, $\widetilde \bm{\beta}^{(0)} = \eta \bm{X}^\top\bm{y}$ to a reconstruction $\widehat\bbeta$ by successive application of an operator the form $[\bm{I}-\eta\bm{X}^\top\bm{X}](\cdot)-\eta R(\cdot)$ while summing the intermediate outputs of each block. Here $R$ is a trained neural network, and the scale parameter $\eta$ is also trained. Unlike other networks based on unrolling of iterative optimization algorithms, the series structure of Neumann networks lead naturally to skip connections \cite{he2016deep} (highlighted in red) that route the output of each dashed block to directly to the output layer. }
\label{fig:nn}
\end{figure*}
\subsection{Proposed Network Architecture}
Our proposed network architecture is motivated by the regularized least squares optimization problem \eqref{eq:obj} in the special case where the regularizer $r$ is quadratic. In particular, assume $r(\bm{\beta}) = \frac{1}{2}\bm{\beta}^\top\bm{R}\bm{\beta}$ so that $\nabla r(\bm{\beta}) = \bm{R} \bm{\beta}$ for some matrix $\bm{R} \in \mathbb{R}^{p\times p}$. Then a necessary condition for $\bbeta^\star$ to be a minimizer of \eqref{eq:obj} in this case is
\begin{equation}\label{eq:solution}
(\bm{X}^\top\bm{X} + \bm{R})\bbeta^\star = \bm{X}^\top\bm{y}.
\end{equation}
Assuming the matrix on the left-hand side is invertible, the solution is given by
\begin{equation}\label{eq:solution2}
\bbeta^\star = (\bm{X}^\top\bm{X} + \bm{R})^{-1}\bm{X}^\top\bm{y}.
\end{equation}
In order to approximate the matrix inverse in \eqref{eq:solution2} we consider a Neumann series expansion of linear operators \cite{schafheitlin1908theorie,gohberg2013basic}, which we now recall. Let $\bm{A}$ be any $p\times p$ matrix and let $\bm{I}$ denote the $p\times p$ identity matrix. If the \emph{Neumann series} $\sum_{k=0}^\infty \bm{A}^k$ converges then $\bm{I}-\bm{A}$ is invertible and we have
\begin{equation}\label{eq:neumann1}
(\bm{I}-\bm{A})^{-1} = \sum_{k=0}^\infty \bm{A}^k = \bm{I} + \bm{A} + \bm{A}^2 + \bm{A}^3 \cdots
\end{equation}
In particular, a sufficient condition for the convergence of the Neumann series is $\|\bm{A}\| < 1$ where $\|\cdot\|$ is the operator norm. We will make use of an alternative form of the same identity:
\begin{equation}\label{eq:neumann2}
\bm{B}^{-1} = \eta\sum_{k=0}^\infty(\bm{I}-\eta\bm{B})^k,
\end{equation}
which is obtained through a change of variables.
Applying the Neumann series expansion \eqref{eq:neumann2} to the matrix inverse appearing in \eqref{eq:solution2}, we have\footnote{The series in \eqref{eq:neumann2} is guaranteed to converge if ${\|\bm{I}-\eta\bm{B}\| < 1}$. Hence, the expansion in \eqref{eq:neumann_expand} is valid provided ${\|\bm{I}-\eta(\bm{X}^\top\bm{X} + \bm{R})\| < 1}$, which holds if and only if $\bm{X}^\top\bm{X} + \bm{R}$ is positive definite and ${\eta < \|\bm{X}^\top\bm{X} + \bm{R}\|^{-1}}$.}
\begin{equation}\label{eq:neumann_expand}
\bbeta^\star = \sum_{j=0}^\infty(\bm{I}-\eta\bm{X}^\top\bm{X}-\eta \bm{R})^j(\eta \bm{X}^\top\bm{y}).
\end{equation}
Truncating the series in \eqref{eq:neumann_expand} to $B+1$ terms, and replacing multiplication by the matrix $\bm{R}$ with a general mapping $R:\mathbb{R}^p \rightarrow \mathbb{R}^p$, motivates an estimator $\widehat\bbeta$ of the form
\begin{equation}\label{eq:nn_estimator}
\widehat\bbeta(\bm{y}) := \sum_{j=0}^B([\bm{I}-\eta\bm{X}^\top\bm{X}](\cdot)-\eta R(\cdot))^j(\eta \bm{X}^\top\bm{y}).
\end{equation}
We turn \eqref{eq:nn_estimator} into a trainable estimator by letting $R = R_{\bm{\theta}}$ be a trainable mapping depending on a vector of parameters $\bm{\theta} \in \mathbb{R}^q$ to be learned from training data. Specifically, in this work we assume $R_{\bm{\theta}}$ is a neural network, where $\bm{\theta}$ is a vectorized set of weights and biases that define the network. We also treat the step-size choice $\eta$ as a trainable parameter. The class of estimators $\widehat\bbeta(\bm{y}) = \widehat\bbeta(\bm{y};\bm{\theta},\eta)$ specified \eqref{eq:nn_estimator} with trainable network $R = R_{\bm{\theta}}$ we call \emph{Neumann networks}.
Observe that Neumann networks are motivated by an application of the Neumann series identity in the case where the gradient of the regularizer is a linear operator (or, equivalently, the regularizer is quadratic). However, for a general regularizer $r$ such that $R = \nabla r$ is nonlinear, the Neumann network estimator $\widehat\bbeta(\bm{y})$ in \eqref{eq:nn_estimator} may not be a good solution to the optimization problem \eqref{eq:obj}. This is because the Neumann series identity \eqref{eq:neumann2} only holds for linear operators. Despite this fact, we show in the next section that a Neumann network estimator is still mathematically justified under certain model assumptions on the data distribution for which the ideal $R$ is \emph{piecewise linear}. For now, we simply treat the Neumann network estimator as a heuristic motivated by case where $R$ is linear.
To see how \eqref{eq:nn_estimator} can be formulated as a network, observe that the terms in \eqref{eq:nn_estimator} have the following recursive form: let the input to the network be $\tilde{\bm{\beta}}^{(0)} := \eta \bm{X}^\top\bm{y}$ and define
\begin{equation}\label{eq:btj}
\tilde{\bm{\beta}}^{(j)} := (\bm{I}-\eta\bm{X}^\top\bm{X})\tilde{\bm{\beta}}^{(j-1)}-\eta R(\tilde{\bm{\beta}}^{(j-1)})
\end{equation}
for all $j=1,...,B$. Then we have $\widehat\bbeta(\bm{y}) = \sum_{j=0}^B \btj{j}$.
Figure~\ref{fig:nn} shows a block diagram for implementing the Neumann network using the recursion \eqref{eq:btj}. Each block with a dashed boundary in Figure~\ref{fig:nn} represents an application of the operator $[\bm{I}-\eta\bm{X}^\top\bm{X}](\cdot)-\eta R(\cdot)$. Due to its underlying series structure, the Neumann network has several \emph{skip connections} (highlighted in red) that route the output of each dashed block ({\em i.e.,~} the $\btj{j}$'s) to the output layer, similar to those found in residual networks \cite{he2016deep} and related architectures \cite{huang2017densely}. These skip connections are a distinguishing feature of Neumann networks compared to networks derived from unrolled optimization approaches, such as unrolled gradient descent (see Figure~\ref{fig:GD}). We hypothesize these additional skip connections result in a smoother optimization landscape relative to other unrolling approaches, which allows for easier training via stochastic gradient descent. See Section \ref{sec:optlandscape} for empirical evidence and more discussion on this point.
\begin{figure*}[ht!]
\centering
\includegraphics[width=\textwidth]{figures/netfig_pnn.pdf}
\caption{\small Proposed preconditioned Neumann network architecture. The network has the same basic architecture as a Neumann network, but uses a different linear component given by $\bm{T}_{\lambda} = (\bm{X}^\top\bm{X} + \lambda\bm I)^{-1}$ where $\lambda>0$ and a different initialization $\tilde{\bm{\beta}}^{(0)} = \bm{T}_{\lambda} \bm{X}^\top \bm{y}$. When the matrix inverse in $\bm{T}_{\lambda}$ is computationally prohibitive to apply, we replace all instances of $\bm{T}_\lambda$ with an unrolling of a fixed number of iterations of the conjugate gradient algorithm, similar to \cite{aggarwal2018modl}. Here $\tilde{R}$ is a trained neural network, and the scale parameter $\lambda$ is also trained when feasible.}
\label{fig:pnn}
\end{figure*}
\subsection{Preconditioning}
Efficiently finding a solution to the linear system \eqref{eq:solution} using an iterative method is challenging when the matrix $\bm{X}^\top\bm{X} + \bm{R}$ is ill-conditioned. This suggests that our Neumann network approach, which is derived from a Neumann series expansion of the system in \eqref{eq:solution}, may benefit from preconditioning. Here we derive a variant of Neumann networks inspired by a preconditioning of \eqref{eq:solution}.
Starting from \eqref{eq:solution}, for any $\lambda > 0$ we have
\begin{equation}
(\bm{X}^\top\bm{X} + \lambda\bm{I})\bbeta^\star + (\bm{R}-\lambda\bm{I})\bbeta^\star = \bm{X}^\top\bm{y}.
\end{equation}
Applying $\bm{T}_\lambda := (\bm{X}^\top\bm{X} + \lambda\bm{I})^{-1}$ to both sides and rearranging terms gives
\begin{equation}
(\bm{I} - \lambda\bm{T}_\lambda+\tilde{\bm{R}})\bbeta^\star = \bm{T}_\lambda\bm{X}^\top\bm{y}.
\end{equation}
where we have set $\tilde{\bm{R}} = \bm{T}_\lambda \bm{R}$.
Following the same steps used to derive the Neumann network, we arrive at the modified estimator
\begin{equation}\label{eq:pcnn}
\widehat\bbeta_{pc}(\bm{y}) = \sum_{j=0}^B(\lambda \bm{T}_\lambda(\cdot)-\tilde{R}(\cdot))^j \bm{T}_\lambda\bm{X}^\top\bm{y}
\end{equation}
which we call a \emph{preconditioned Neumann network}. Here $\tilde{R} = \tilde{R}_{\bm{\theta}}$ is a trainable mapping depending on parameters $\bm{\theta}$. We also treat $\lambda > 0$ as a trainable parameter when gradients with respect to $\lambda$ are easily calculated (more on this below).
As shown in Figure \ref{fig:pnn}, a preconditioned Neumann network has the same basic network architecture as the standard Neumann network, except the linear component ${[
\bm{I}-\eta \bm{X}^\top \bm{X}](\cdot)}$ is replaced with $[\lambda\bm{T}_\lambda](\cdot)$ and the learned component $[-\eta R](\cdot)$ is replaced with $[-\tilde{R}](\cdot)$. The preconditioned Neumann network also has a different initialization, $\btj{0} = \bm{T}_\lambda\bm{X}^\top\bm{y}$, which is the solution to the Tikhonov regularized least squares problem
$\min_{\bm{\beta}} \|\bm{X}\bm{\beta}-\bm{y}\|^2 + \lambda\|\bm{\beta}\|^2.$
For many inverse problems in imaging, such as deblurring, this is much more accurate approximation to the ideal solution than the matrix transpose initialization $\btj{0} = \eta\bm{X}^\top \bm{y}$ of the standard Neumann network. Hence, we might expect that a preconditioned Neumann network could achieve higher quality solutions with fewer blocks $B$. Our experiments on deblurring of natural images (see Figure~\ref{fig:precondition_bar}) support this observation.
Applying $\bm{T}_\lambda(\cdot)$ may be computationally prohibitive for certain large-scale inverse problems in imaging, such as those arising in CT and MRI reconstruction. To address this issue, we adapt the approach of \cite{aggarwal2018modl} and replace all instances of $\bm{T}_\lambda(\cdot)$ in the preconditioned Neumann network by an unrolling of a fixed number of iterations of the conjugate gradient (CG) algorithm \cite{hestenes1952methods}, which approximates the application of $\bm{T}_\lambda(\cdot)$. Unrolling CG does not require any additional trainable parameters, and backpropagation through the CG layers can be performed via automatic differentiation. This strategy has been shown to be effective for various large-scale MRI reconstruction problems \cite{aggarwal2018multi,pramanik2018off}. Incorporating a trainable $\lambda$ parameter into this approach is simple since the derivatives of the end-to-end network $\widehat\bbeta_{pc}$ with respect to $\lambda$ are also easily computed by automatic differentiation. In particular, we do not need $\bm{T}_\lambda$ to have an analytic expression in terms of $\lambda$ in order to compute derivatives.
Finally, we note other preconditioned Neumann networks could be derived by replacing $\bm{I}$ with a general matrix $\bm{S}$ such that $\bm{X}^\top\bm{X} + \lambda \bm{S}$ is positive definite, e.g., $\bm{S} = \bm{D}^\top\bm{D}$ where $\bm{D}$ is a discrete approximation of the image gradient. For simplicity, we restrict ourselves to the choice $\bm{S} = \bm{I}$ in this work.
\subsection{Equivalence of Unrolled Gradient Descent and Neumann Network for a Linear Learned Component}\label{sec:equivalence}
Suppose the learned component $R$ is linear, {\em i.e.,~} $R(\bm{\beta}) = \bm{R}\bm{\beta}$ for some matrix $\bm{R}\in\mathbb{R}^{p \times p}$.
The $B$th iteration $\bj{B}$ of unrolled gradient descent \eqref{eq:gdn} with step size $\eta>0$ and initialization $\bj{0} = \eta\bm{X}^\top\bm{y}$ can be expanded to obtain
\begin{align}\label{eq:equiv}
\nonumber \bm{\beta}^{(B)} &= \eta \sum_{j = 0}^{B} (\bm{I} - \eta \bm{X}^\top \bm{X} -\eta \bm{R})^j \bm{X}^\top \bm{y},
\end{align}
which is precisely the form of the Neumann network estimator \eqref{eq:nn_estimator}. Therefore, if $R$ is linear the estimator obtained using a unrolling of gradient descent and the Neumann network estimator are the same. When $R$ is nonlinear we no longer have this equivalence.
\section{Theory}\label{sec:theory}
The Neumann network architecture proposed in the previous section is motivated by the Neumann series expansion of a (potentially nonlinear) operator $R$ representing the gradient of a regularizer. Strictly speaking, this Neumann series expansion is valid ({\em i.e.,~} corresponds to the solution of the equation \eqref{eq:obj}) only if $R$ is linear. However, restricting $R$ to to be linear severely limits the class of estimators that can be learned in our framework. In particular, if $R$ is linear then the resulting learned estimator has to be linear, which is suboptimal for many data types.
In this section we show that a Neumann series approach is still mathematically justified for data belonging to a union of subspaces (UoS) model. Our reasons for focusing on a UoS model are two-fold: First, UoS models are a natural generalization of linear subspace models and are used widely in many signal and image reconstruction problems, either as a deterministic model \cite{elhamifar2009sparse,blumensath2011sampling,liu2013robust} or as a statistical model in the form of a Gaussian mixture model with low-rank covariances \cite{renna2014reconstruction,yang2015compressive,houdard2018high}. Second, we believe UoS models represent a reasonable trade-off between model complexity/expressiveness and analytic tractability, and allow us to provide some insight on the expected behavior of Neumann networks beyond the setting where $R$ is linear.
To be precise, here we consider the class of \emph{Neumann network estimators} $\widehat\bbeta$ given in \eqref{eq:nn_estimator} that are specified by a (potentially nonlinear) mapping\footnote{Here we do not assume $R$ is a neural network with a particular architecture, but study the idealized case where $R$ can represent any mapping from $\mathbb{R}^p$ to $\mathbb{R}^p$.} ${R:\mathbb{R}^p \rightarrow\mathbb{R}^p}$, step size $\eta$, and number of blocks $B$. We study two questions:
\begin{enumerate}
\item Can a Neumann network estimator be used to reconstruct images belonging to a UoS, and if so, what is an optimal choice of $R$?
\item Can this $R$ be learned using standard neural network architectures and training?
\end{enumerate}
Our main result, given in Theorem~\ref{thm:main}, addresses the first question by showing there exists a Neumann network estimator with a \emph{piecewise linear} $R$ that gives arbitrarily small reconstruction error under mild assumptions on the subspaces and their interaction with the measurement operator. We study the second question empirically, and show that the learned $R$ well-approximates the predicted optimal piecewise linear $R$ in an idealized setting.
\subsection{Images Belonging to a Single Subspace}
Suppose the ground truth images belong to an $r$-dimensional subspace $\mathcal{S} \subset \mathbb{R}^p$. Let $\bm{U} \in \mathbb{R}^{p\times r}$ be a matrix whose columns form an orthonormal basis for $\mathcal{S}$. Assume $m \geq r$ and $\bm{X}\bm{U} \in \mathbb{R}^{m\times r}$ is full rank. In other words, we assume there is no image in the subspace also in the nullspace of $\bm{X}$ besides the zero image\footnote{This assumption is met in many practical settings. For example, in an inpainting setting it is equivalent to assuming there is no image in the subspace having support contained entirely within the inpainting region. Likewise, in compressed sensing by subsampling DFT coefficients, it is equivalent to assuming there is no image in the subspace bandlimited to the set of unobserved DFT coefficients. Both of these assumptions are reasonable for subspaces spanned by natural images.}. Then given noise-free linear measurements of the form $\bm{y} = \bm{X}\bbeta^\star$ of any data point $\bbeta^\star = \bm{U}\bm{w}^\star \in \mathcal{S}$ we can always recover $\bbeta^\star$ by applying the linear estimator
\begin{equation}
\widehat\bbeta_o(\bm{y}) = \bm{U}(\bm{U}^\top \bm{X}^\top\bm{X}\bm{U})^{-1}\bm{U}^\top \bm{X}^\top\bm{y}
\end{equation}
since it is easy to check that $\widehat\bbeta_o(\bm{y}) = \bbeta^\star$. In other words, there always exists a linear estimator that gives exact recovery of images belonging to the subspace from their noise-free linear measurements.
Our first result shows that there exists a linear Neumann network estimator of the form \eqref{eq:nn_estimator} ({\em i.e.,~} a linear choice of $R$ in \eqref{eq:nn_estimator}) such that for all points in the subspace the reconstruction error can be made arbitrarily small by choosing the step size $\eta$ and block size $B$ appropriately. For simplicity, we restrict ourselves to the case of noise-free measurements and where $\bm{X}$ has orthonormal rows.
\begin{myLemma}\label{lem:singlesub}
Let $\bm{X} \in \mathbb{R}^{m\times p}$ be any measurement matrix with orthonormal rows, and let $\mathcal{S} \subset \mathbb{R}^p$ be an $r$-dimensional subspace with orthonormal basis $\bm{U} \in \mathbb{R}^{r\times p}$. Suppose $m\geq r$ and $\bm{X}\bm{U} \in \mathbb{R}^{m\times r}$ is full rank. Then for any $\eta \in (0,1]$, the $B$-term Neumann network estimator $\widehat\bbeta$ with linear $R(\bm{\beta}) = \bm{R}\beta$ where $\bm{R} \in \mathbb{R}^{p\times p}$ is given by
\begin{equation}\label{eq:Rform}
\bm{R} = -c_{\eta,B}\,(\bm{I}-\bm{X}^\top\bm{X})\bm{U}(\bm{U}^\top\bm{X}^\top\bm{X}\bm{U})^{-1}\bm{U}^\top\bm{X}^\top\bm{X}
\end{equation}
for a constant $c_{\eta,B}$ depending only on $\eta$ and $B$,
satisfies the error bounds
\begin{equation}\label{eq:est_bounds}
\|\widehat\bbeta(\bm{X}\bbeta^\star) - \bbeta^\star\| \leq (1-\eta)^{B+1}\|\bm{X}\bbeta^\star\|.
\end{equation}
for all $\bbeta^\star \in \mathcal{S}$.
\end{myLemma}
The proof of Lemma 1 is given in the Appendix. The main idea behind the proof is that with this choice of $R$ the Neumann network terms $\btj{j}$ simplify to
\begin{equation}
\btj{j} = a_j\bm{X}^\top\bm{X}\bbeta^\star + b_j(\bm{I}-\bm{X}^\top\bm{X})\bbeta^\star
\end{equation}
for some constants $a_j$ and $b_j$ that satisfy $\sum_j a_j\approx 1$ and $\sum_j b_j \approx 1$. Hence, we have $\widehat\bbeta(\bm{y}) = \sum_{j=0}^B \btj{j} \approx \bm{X}^\top\bm{X}\bbeta^\star + (\bm{I}-\bm{X}^\top\bm{X})\bbeta^\star = \bbeta^\star$.
\subsection{Images Belonging to a Union of Subspaces}
Now we suppose that the images belong to a UoS $\cup_{k=1}^K\mathcal{S}_{k} \subset \mathbb{R}^p$ where, for simplicity, we assume each subspace $\mathcal{S}_k$ has dimension $r$. For all $k=1,...,K$ we let $\bm{U}_k \in \mathbb{R}^{p\times r}$ denote a matrix whose columns form an orthonormal basis for $\mathcal{S}_k$. Again, we assume $m \geq r$ and $\bm{X}\bm{U}_k \in \mathbb{R}^{m\times r}$ is full rank for every $k=1,...,K$. In other words, we assume there is no image in the UoS also in the nullspace of $\bm{X}$ besides the zero image.
Let $\bm{y} = \bm{X}\bbeta^\star$ be the measurements of any point $\bbeta^\star$ belonging to the UoS. If we know $\bbeta^\star$ belongs to the $k$th subspace, {\em i.e.,~} $\bbeta^\star = \bm{U}_k\bm{w}^\star$ for some $\bm{w}^\star\in\mathbb{R}^p$, then similar to the single subspace case, we can apply the estimator
\begin{equation}
\widehat\bbeta_o(\bm{y};k) := \bm{U}_k(\bm{U}_k^\top \bm{X}^\top\bm{X}\bm{U}_k)^{-1}\bm{U}_k^\top \bm{X}^\top\bm{y}
\end{equation}
since it is easy to see that $\bbeta^\star = \widehat\bbeta_o(\bm{y}; k)$. We call $\widehat\bbeta_o(\bm{y};k)$ the \emph{oracle estimator}, since it assumes knowledge of the subspace index $k$ to which the image belongs.
We show that, under appropriate conditions on the subspaces and the measurement operator, there is a piecewise linear choice of Neumann network estimator ({\em i.e.,~} an estimator of the form \eqref{eq:nn_estimator} with $R$ piecewise linear) that recovers any image belonging to the UoS from its noise-free measurements with arbitrarily small reconstruction error. In other words, there is a Neumann network estimator that well-approximates the oracle estimator.
Specifically, we consider a piecewise linear function $R^*$ of the form
\begin{equation}\label{eq:pwl}
R^*(\bm{\beta}) =
\begin{cases}
\bm{R}_1\bm{\beta} & \text{if}~\bm{\beta}\in \mathcal{C}_1\\
~~~\vdots & ~~~~ \vdots \\
\bm{R}_K\bm{\beta} & \text{if}~\bm{\beta}\in \mathcal{C}_K
\end{cases}
\end{equation}
where each $\bm{R}_k$ is a $p \times p$ matrix, and the regions $\mathcal{C}_k$ are disjoint and whose union is all of $\mathbb{R}^p$. The main idea behind our analysis is this: If the ground truth point $\bbeta^\star$ belongs the $k$th subspace, then we prove that the Neumann series summands $\btj{0},\btj{1},...,\btj{B}$ all lie in the same region $\mathcal{C}_k$. This means that the same $\bm{R}_k$ is used in computing each summand, so we can write
\begin{equation*}
\widehat\bbeta(\bm{y}) = \sum_{j=0}^B\btj{j} = \sum_{j=0}^B(\bm{I} - \eta\bm{X}^\top\bm{X} - \eta\bm{R}_k)^j(\eta\bm{X}^\top\bm{y}).
\end{equation*}
Choosing $\bm{R}_k$ to have the same form as in the single subspace case (see Lemma~\ref{lem:singlesub}), we then will have $\bbeta^\star = \widehat\bbeta_o(\bm{y},k) \approx \widehat\bbeta(\bm{y})$.
To be exact, we specify $\bm{R}_k$ and $\mathcal{C}_k$ as follows. Similar to Lemma~\ref{lem:singlesub}, we choose
\begin{equation*}
\bm{R}_k \!=\! -c_{\eta,B}\,(\bm{I}-\bm{X}^\top\bm{X})\bm{U}_{k}(\bm{U}_{k}^\top\bm{X}^\top\bm{X}\bm{U}_{k})^{-1}\bm{U}_{k}^\top\bm{X}^\top\bm{X},
\end{equation*}
for all $k=1,...,K$, where $c_{\eta,B}>0$ is a constant depending only on $\eta$ and $B$. We also define the corresponding region $\mathcal{C}_k$ as
\begin{equation*}
\mathcal{C}_k = \left\{\bm{\beta}\in\mathbb{R}^p: d_{\bm{X},k}(\bm{\beta}) < d_{\bm{X},\ell}(\bm{\beta})~\text{for all}~\ell \neq k \right\}
\end{equation*}
where $d_{\bm{X},k}(\bm{\beta}) := \|(\bm{I}-\bm{X}\bm{U}_k(\bm{X}\bm{U}_k)^{+})\bm{X}\bm{\beta}\|$ is the distance between the vector $\bm{X}\bm{\beta}$ and the subspace $\spn(\bm{X}\bm{U}_k)$. In other words, $\mathcal{C}_k$ is the set of all points whose distance to the $k$th subspace is smaller than the distance to all other subspaces, as measured by the functions $d_{\bm{X},\ell}$ for all $\ell =1,...,K$.
We now state our main theorem:
\begin{myTheorem}\label{thm:main}
Let $\bm{X} \in \mathbb{R}^{m\times p}$ be any measurement matrix with orthonormal rows, and for all $k=1,...,K$ let $\bm{U}_k \in \mathbb{R}^{p\times r}$ be an orthonormal basis for the $k$th subspace $\mathcal{S}_k$ with $\dim \spn(\bm{X}\bm{U}_k) = r$. Suppose $\text{span}(\bm{X}\bm{U}_{k}) \cap \text{span}(\bm{X}\bm{U}_\ell) = \{0\}$ for all $k\neq \ell$. Then the Neumann network estimator $\widehat\bbeta$ with step size $\eta \in (0,1)$ and piecewise linear $R = R^*$ as defined in \eqref{eq:pwl} satisfies
\begin{equation}\label{eq:est_bounds2}
\|\widehat\bbeta(\bm{X}\bbeta^\star) - \bbeta^\star\| \leq (1-\eta)^{B+1}\|\bm{X}\bbeta^\star\|,
\end{equation}
for all $\bbeta^\star \in \cup_{k=1}^K\mathcal{S}_k$.
\end{myTheorem}
The condition $\text{span}(\bm{X}\bm{U}_{k}) \cap \text{span}(\bm{X}\bm{U}_\ell) = \{0\}$ for all $\ell \neq k$, appearing in Theorem~\ref{thm:main} is not overly restrictive if we take into account the statistics of natural images. For instance, this condition holds for a generic union of $r$-dimensional subspaces provided $m \geq 2r$, regardless of the number of subspaces in the union\footnote{This is because if $\spn(\bm{U}_k)$, $k=1,...,K$, are generic $r$-dimensional subspaces in $\mathbb{R}^p$, then $\mathcal{V}_k = \spn(\bm{X}\bm{U}_k)$, $k=1,...,K$, are generic $r$-dimensional subspaces in $\mathbb{R}^m$. Since two generic subspaces are linearly independent provided the sum of their dimensions does not exceed the ambient dimension, we see that $\mathcal{V}_k$ and $\mathcal{V}_\ell$, $k\neq \ell$ collectively span a $2r$-dimensional subspace, which is only possible if their intersection is trivial.}. Moreover, based on results in compressive sensing using low-rank Gaussian mixture models \cite{reboredo2013compressive,renna2014reconstruction}, we conjecture this condition can be weakened under appropriate assumptions on $\bm{X}$ and appropriate modification of $R^*$, but we do not pursue this refinement here.
Theorem~\ref{thm:main} shows there exists a Neumann network estimator with a certain choice of $R^*$ that well-approximates an oracle estimator for images belonging to a union of subspaces. In principle, since $R^*$ is piecewise linear with a finite number of regions, it is realizable as a sufficiently deep neural network with ReLU activations \cite{arora2018understanding}. However, this does not necessarily mean that a Neumann network estimator with $R$ given by a ReLU network when trained on images belonging to a union of subspaces will recover $R = R^*$ specified in Theorem 1. For example, there may be other $R'$ that yield similar training loss as $R^*$, or the learned component may be under-parameterized (e.g., not enough layers) in such a way that it cannot well-approximate $R^*$. Nevertheless, one would hope that given sufficient training data and a sufficiently expressive network architecture for the learned component, it may be possible to learn a good approximation to $R^*$ as specified in Theorem~\ref{thm:main}. Below we illustrate that this is indeed the case for a Neumann network trained on images belonging to synthetic union of subspaces.
Finally, using the equivalence of Neumann networks and unrolled gradient descent networks estimators in the case where the learned component $R$ is linear (see Sec. \ref{sec:equivalence}), we show that an unrolled gradient descent network as defined in \eqref{eq:gdn} with the same piecewise linear $R=R^*$ as defined in \eqref{eq:pwl} satisfies the error bounds as in Theorem~\ref{thm:main}:
\begin{myCorollary}\label{cor:main}
Under the same assumptions as Theorem~\ref{thm:main}, the unrolled gradient descent estimator $\widehat\bbeta'(\bm{y}) = \bj{B}$ with step size $\eta \in (0,1)$ and $R = R^*$ as defined in \eqref{eq:pwl} satisfies
\begin{equation}\label{eq:est_bounds3}
\|\widehat\bbeta'(\bm{X}\bbeta^\star) - \bbeta^\star\| \leq (1-\eta)^{B+1}\|\bm{X}\bbeta^\star\|,
\end{equation}
for all $\bbeta^\star \in \cup_{k=1}^K\mathcal{S}_k$,
\end{myCorollary}
Corollary 1 shows that the equivalence between unrolled gradient descent estimators and Neumann network estimators observed in the case where $R$ is linear carries over to the special case where $R = R^*$ is piecewise linear and the networks are evaluated on linear measurements of points belonging to the union of subspaces.
\subsection{Empirical Validation}
Here we illustrate empirically that the optimal $R^*$ predicted by Theorem 1 is well-approximated by training a Neumann network for a 1-D inpainting task on synthetic UoS data. We generate random training data belonging to a union of three 3-dimensional subspaces in $\mathbb{R}^{10}$, and train a Neumann network to inpaint five missing coordinates ({\em i.e.,~} $\bm{X} \in \mathbb{R}^{5\times 10}$ restricts a vector to coordinates 1--5). We parameterize the learned component $R$ of the Neumann Network as a $7$-layer fully connected neural network with ReLU activations, which is trained by minimizing the mean squared error of the reconstruction over the training set using stochastic gradient descent (more details on this experiment can be found in the Supplementary Materials).
\begin{figure}[ht!]
\centering
\includegraphics[width=0.45\textwidth]{figures/Bexp.pdf}
\caption{\small Example output of Neumann network trained on synthetic union of subspaces data for a 1-D inpainting task. Here a vector $\bbeta^\star \in \mathbb{R}^{10}$ is drawn from one of the subspaces, and its measurements $\bm{y} = \bm{X}\bm{\beta}^*$ (restriction to first five coordinates) are input into the Neumann network, which faithfully restores the missing coordinates. The output $\widehat\bbeta$ of the Neumann network is a sum of terms $\btj{j}$ (shown in bottom left).
As predicted by Theorem~\ref{thm:main}, the terms $\btj{j}$ are weighted linear combinations the projections of $\bbeta^\star$ onto the observed and unobserved coordinates. Also as predicted by Theorem~\ref{thm:main}, the outputs of the learned component $R(\btj{j})$ (shown in bottom right) are zero in the observed coordinates and scaled projections of $\bbeta^\star$ in the unobserved coordinates.}
\label{fig:Bexp}
\end{figure}
\begin{figure}[ht!]
\centering
\includegraphics[height=0.32\textwidth]{figures/learnedR_exp4_new_wide2.pdf}
\caption{\small Piecewise linearity test. We measure how linear the learned $R$ is when evaluated at two vectors drawn from the same subspace, from two different subspaces, or from two random Gaussian vectors. The plot illustrates that the learned $R$ only behaves like a linear operator when the vectors belong the same subspace ({\em i.e.,~} the relative error is small), which indicates the learned $R$ is approximately piecewise linear, as predicted by Theorem~1.}
\label{fig:learnedR_exp1}
\end{figure}
Figure~\ref{fig:Bexp} illustrates the output of the trained Neumann network for one specific input, including the outputs from the intermediate Neumann network terms $\btj{j}$ and the learned component outputs $R(\btj{j})$. As predicted by Theorem~\ref{thm:main}, the Neumann network terms $\btj{j}$ have the form $a_j \bm{X}^\top\bm{X}\bbeta^\star + b_j (\bm{I}-\bm{X}^\top\bm{X})\bbeta^\star$ for some constants $a_j$ and $b_j$. Also, the outputs of the learned component $R(\btj{j})$ all lie in the null space of $\bm{X}$, {\em i.e.,~} are vectors supported on coordinates $6-10$.
Figure~\ref{fig:learnedR_exp1} displays the results of a quantitative experiment to assess whether the learned component $R$ is piecewise linear as predicted by Theorem 1. First, we test whether the learned $R$ is approximately linear when restricted to inputs belonging to each subspace, {\em i.e.,~} we test whether $R(\bbeta^\star_1 + \bbeta^\star_2) \approx R(\bbeta^\star_1) + R(\bbeta^\star_2)$, for all $\bbeta^\star_1,\bbeta^\star_2$ belonging to the same subspace. As baselines we compare to the case where $\bbeta^\star_1$ and $\bbeta^\star_2$ belong to different subspaces, and the case where $\bbeta^\star_1$ and $\bbeta^\star_2$ are Gaussian random vectors. In Figure~\ref{fig:learnedR_exp1} we display a boxplot of the relative error $\|R(\bbeta^\star_1 + \bbeta^\star_2) -R(\bbeta^\star_1)-R(\bbeta^\star_2)\|/\gamma$ of 1024 randomly generated $\bbeta^\star_1,\bbeta^\star_2$, which are normalized such that $\|\bbeta^\star_1\|=\|\bbeta^\star_2\| = \gamma$. Here we set normalization to $\gamma = 0.25$, though similar results were obtained for $\gamma \in [0.1,0.5]$ (not shown). As predicted, the relative error concentrates near zero in the case where $\bbeta^\star_1,\bbeta^\star_2$ belong to the same subspace, and is otherwise large, indicating the learned $R$ is indeed approximately piecewise linear as predicted by Theorem 1.
In the Supplementary Materials we provide more empirical evidence that the $R$ learned in this experiment closely approximates the ideal $R^*$ predicted by Theorem 1. Specifically, we demonstrate that the learned component behaves as expected on inputs restricted to the column space and row space of the forward model $\bm{X}$. These experiments verify that, at least for this 1-D inpainting task on synthetic data, the ideal piecewise linear $R^*$ predicted by Theorem 1 is well-approximated with standard neural network architectures and training.
A more systematic study involving different forward models $\bm{X}$ and different network architectures is needed to determine whether the ideal $R^*$ identified in Theorem~1 is learnable more generally for large-scale imaging data and using practical architectures like convolutional neural networks. Also, our results do not address the case of noisy measurements or forward models with non-orthogonal rows, which are important considerations for many inverse problems. We leave these as open questions for future work.
Finally, while our focus in this section was on UoS models, our analysis does not rule out the applicability of Neumann networks to other non-linear models. Indeed, in the next section we show empirically that Neumann networks perform well on a variety of linear inverse problems when trained on realistic image datasets that are unlikely to be perfectly captured by a low-dimensional UoS model.
\section{Experiments}
We begin this section with a comparison of Neumann networks against other methods of solving several different inverse problems with learned components.
After that, we investigate the effect of larger and smaller training sets on all methods, demonstrating that Neumann networks are robust to small training set sizes.
We follow these experiments with an illustration of the effects of incorporating preconditioning into the Neumann network for deblurring, which is shown to give a gain of several dBs of PSNR, permitting smaller networks and allowing for faster training and implementation. We follow with an investigation into an MRI reconstruction problem to demonstrate the proposed methods in a large-scale setting. Finally, we explore the optimization landscape of Neumann networks relative to unrolled gradient descent, illustrating that Neumann networks have smoother loss landscapes than unrolled Gradient Descent, while also generally achieving lower test set errors.
\subsection{Datasets and Comparison Methods}
In our experiments, we consider three different small-scale training sets: CIFAR10 \cite{krizhevsky2009learning}, CelebA \cite{liu2015faceattributes}, and STL10 \cite{coates2011analysis}, and one larger-scale undersampled MRI reconstruction task.
The CIFAR10 dataset is a machine learning standard, consisting of real-world images of both man-made and natural scenes \cite{krizhevsky2009learning}. The dataset has been resized to be $32 \times 32$ pixels.
We use a subset of the aligned Celebrity Faces With Attributes (CelebA) dataset \cite{liu2015faceattributes}. The CelebA dataset consists of human faces at a variety of angles, and the subset that is used here has been aligned so that all faces lie in the center of the image.
The STL10 dataset \cite{coates2011analysis} is a curated subset of the ImageNet dataset, and was originally intended to be used with semisupervised learning problems. In our experiments, we have resized all CelebaA and STL10 images to be $64 \times 64$ pixels.
We select a subset of images of size 30,000 uniformly from each individual dataset to be used for training in the results presented below.
We use these training sets in seven different inverse problems in imaging: Block inpainting, deblurring, deblurring with additive noise $\epsilon$ of variance $0.01$, superresolution (SR4 and SR10) with two different upsampling levels (4x and 10x across the entire image, respectively), and compressive sensing (CS2 and CS8) with two separate levels of compression (2x and 8x, respectively). The compressed sensing design matrices are random Gaussian matrices.
We compare Neumann networks \textbf{(NN)} and preconditioned Neumann networks \textbf{(PNN)} with four methods which can be applied to solve a variety of inverse problems:
We first compare to the gradient descent network \textbf{(GDN)}, an {\em unrolled optimization} algorithm that is trained end-to-end. While theoretical properties GDN and NN are examined in Section~\ref{sec:theory}, we hope to compare the qualitative and quantitative differences between the two architectures.
For a fair comparison, we use an identical architecture for the nonlinear learned component in the gradient descent network and the nonlinear learned component in the Neumann network.
We also compare to MOdel-based reconstruction with Deep Learned priors \textbf{(MoDL)} \cite{aggarwal2018modl}, another unrolled algorithm containing a novel data-consistency step that performs conjugate gradient iterations inside the unrolled algorithm. MoDL is also trained end-to-end, and also shares learned parameters between the learned algorithm. In our main experimental section, we use an identical architecture for the learned component of MoDL as is used in GDN and NN.
Trainable Nonlinear Reaction Diffusion \textbf{(TNRD)} \cite{chen2017trainable} is an unrolled optimization algorithm that closely resembles GDN, but with a specific, novel architecture for the learned component motivated by insights from diffusion methods for inverse problems. The learned components in each block consist of a single filter, followed by a learned nonlinearity, and then the transpose of the single filter is applied. Weights are \emph{not} shared across blocks in TNRD.
The residual autoencoder \textbf{(ResAuto)}, first proposed in \cite{mao2016image}, is an {\em agnostic} method. In Section~\ref{sec:previous}, we discussed agnostic methods that learn a mapping from $\bm{y}$ to $\bm{\beta}$, but in these experiments, we consider a variant of an agnostic learner that learns a mapping from $\bm{X}^\top \bm{y}$ to $\widehat\bbeta$ but does not otherwise use $\bm{X}$. Specifically, we construct a 12-layer convolutional-deconvolutional residual neural network (almost twice as many layers as the network used in the Neumann network), with a channel-wise fully connected layer.
Compressed Sensing using Generative Models, \textbf{(CSGM)} \cite{bora2017compressed} is a {\em decoupled} method which first trains a generative model for the data. After training the generative model, arbitrary inverse problems can be solved by finding the image in the range of the generator which is closest to the distorted image. As in the setup of \cite{bora2017compressed}, in our experiments we train three generative networks, one for each dataset.
Our final method does not incorporate training data at all into the solution of the inverse problem. We reconstruct using total-variation regularized least squares \textbf{(TV)}. We minimize our objective using the algorithm of \cite{wang2008new}, with hyperparameters chosen via cross-validation over a held-out validation set for each dataset and inverse problem.
\subsection{Training and Implementation}\label{sec:training_details}
Given training pairs $\{(\bm{\beta}_i,\bm{y}_i)\}_{i=1}^N$, and
assuming the learned component $R$ inside the Neumann network depends smoothly on a set of parameters $\bm{\theta}$, {\em i.e.,~} the partial derivatives $\partial_{\bm{\theta}}R(\bm{\beta};\bm{\theta})$ exist, we train a Neumann network $\widehat\bbeta$ by minimizing the empirical risk $\mathcal{L}(\bm{\theta}) = \sum_{i=1}^N \|\widehat\bbeta(\bm{y}_i;\bm{\theta})-\bm{\beta}_i\|^2$.
In the Supplemental Materials we derive the backpropagation gradients $\partial_{\bm{\theta}}\mathcal{L}(\bm{\theta})$ in the case where $\widehat\bbeta$ is a Neumann network or a gradient descent network.
The learned components of NN, GDN, and MoDL have identical architectures: a 7-layer convolutional-deconvolutional neural network with a single channel-wise fully-connected layer \cite{pathak2016context}, inspired by architectural choices in \cite{dong2016image, mao2016image, kim2016accurate}.
For NN, GDN, MoDL, and TNRD we used architectures with $B = 6$ blocks. The learned component is fixed per network, {\em i.e.,~} the learned component in the first block has identical weights to the learned component in all other blocks in any given method and inverse problem, except in TNRD. While using a larger $B$ is possible, we found that increasing $B$ beyond 8 led to greatly increased sensitivity to SGD step size schedule choices. This phenomenon can be observed in Section~\ref{sec:precond}. Anecdotally, we find that it is more difficult to choose SGD step sizes for GDN than for NN even for small $B$, and this difficulty became problematic for $B$ greater than 6.
The ResAuto architecture imitates the architecture of \cite{mao2016image}, an approach that highly resembles the U-Net \cite{ronneberger2015u}, but adjusted for good performance on inverse problems like superresolution, deblurring, and inpainting. Superficially, the architecture resembles an expanded version of the previously-described learned component, with 12 convolution or deconvolution layers instead of 7. Further implementation details can be found in supplementary materials.
\subsection{Small-scale Experiments}
In this section, a variety of methods are used to solve the previously-described inverse problems on three datasets. First, a quantitative comparison in terms of PSNR of the previously-outlined approaches on a variety of datasets and inverse problems is described in Table~~\ref{table:compare_cifar}.
We observe that NN and GDN are competitive across all inverse problems and datasets. State-of-the-art methods like MoDL and TNRD perform quite well across all datasets, but the differences in architecture between PNN and MoDL appear to give an edge to PNN, which we hypothesize is an effect of our previously-highlighted skip connections. All methods that incorporate the forward model into the training and reconstruction process perform competitively in our small-scale experiments.
CSGM appears to suffer because of the lack of training data across all experiments. CSGM must learn the manifold associated with each dataset before being able to produce accurate reconstructions, which in our relatively sample-limited setting appears not to happen. See Figure~\ref{fig:sample_complexity_fig} or the Supplement for examples of images produced by CSGM. While TV reconstructions are reasonably accurate across problems, they are not as accurate as learned approaches, especially in inpainting and compressed sensing.
\begin{table}[htbp]
\centering
\begin{adjustbox}{width=\columnwidth}
\begin{tabular}{ll |lllllll}
& & Inpaint & Deblur & Deblur$+\epsilon$ & CS2 & CS8 & SR4 & SR10 \\ \hline
\parbox[t]{1mm}{\multirow{7}{*}{\rotatebox[origin=c]{90}{CIFAR10}}} & NN & 28.20 & 36.55 & 29.43 & 33.83 & \textbf{25.15} & 24.48 & \textbf{23.09} \\
& PNN & 28.40 & \textbf{37.83} & \textbf{30.47} & 33.75 & 23.43 & \textbf{26.06} & 21.79 \\
& GDN & 27.76 & 31.25 & 29.02 & \textbf{34.99} & 25.00 & 24.49 & 20.47 \\
& MoDL & 28.18 & 34.89 & 29.72 & 33.47 & 23.72 & 24.54 & 21.90 \\
& TNRD & 27.87 & 34.84 & 29.70 & 32.74 & 25.11 & 23.84 & 21.99 \\
& ResAuto & \textbf{29.05} & 31.04 & 25.24 & 18.51 & 9.29 & 24.84 & 21.92 \\
& CSGM & 17.88 & 15.20 & 14.61 & 17.99 & 19.33 & 16.87 & 16.66 \\
& TV & 25.90 & 27.57 & 26.64 & 25.41 & 20.68 & 24.71 & 20.68 \\ \hline \hline
\parbox[t]{1mm}{\multirow{7}{*}{\rotatebox[origin=c]{90}{CelebA}}} & NN & \textbf{31.06} & 31.01 & 30.43 & \textbf{35.12} & \textbf{28.38} & 27.31 & 23.57 \\
& PNN & 30.45 & \textbf{33.79} & \textbf{30.89} & 32.61 & 26.41 & \textbf{28.70} & 23.74 \\
& GDN & 30.99 & 30.19 & 29.27 & 34.93 & 28.33 & 27.14 & 23.46 \\
& MoDL & 30.75 & 30.80 & 29.59 & 30.22 & 25.84 & 26.42 & 24.12 \\
& TNRD & 30.21 & 29.92 & 29.79 & 33.89 & 28.19 & 25.75 & 22.73 \\
& ResAuto & 29.66 & 25.65 & 25.29 & 19.41 & 9.16 & 25.62 & \textbf{24.92} \\
& CSGM & 17.75 & 15.68 & 15.30 & 17.99 & 18.21 & 18.11 & 17.88 \\
& TV & 24.07 & 30.96 & 26.24 & 25.91 & 23.01 & 26.83 & 20.70 \\ \hline \hline
\parbox[t]{1mm}{\multirow{7}{*}{\rotatebox[origin=c]{90}{STL10}}} & NN & 27.47 & 29.43 & 26.12 & \textbf{31.98} & \textbf{26.65} & 24.88 & 21.80 \\
& PNN & 28.00 & \textbf{30.66} & \textbf{27.21} & 31.40 & 23.43 & \textbf{25.95} & \textbf{22.19} \\
& GDN & \textbf{28.07} & 30.19 & 25.61 & 31.11 & 26.19 & 24.88 & 21.46 \\
& MoDL & 28.03 & 29.42 & 26.06 & 27.29 & 23.16 & 24.67 & 16.88 \\
& TNRD & 27.88 & 29.33 & 26.32 & 31.05 & 25.38 & 24.55 & 21.21 \\
& ResAuto & 27.28 & 25.42 & 25.13 & 19.48 & 9.30 & 24.12 & 21.13 \\
& CSGM & 16.50 & 14.04 & 15.59 & 16.67 & 16.39 & 16.58 & 16.47 \\
& TV & 26.29 & 29.96 & 26.85 & 24.82 & 22.04 & 26.37 & 20.12
\end{tabular}
\end{adjustbox}
\caption{\small PSNR comparison for the CIFAR, CelebA, and STL10 datasets respectively. Values reported are the median across a test set of size 256.}
\label{table:compare_cifar}
\end{table}
\begin{figure}[h]
\centering
\begin{tabular}{c@{}c@{}c@{}c@{}c}
{\small Original and} \\ \small{$\bm{X}^\top \bm{y}$} & {\small NN} & {\small GDN} & {\small ResAuto} \\ \hline \\[-2ex]
\subfloat{\includegraphics[width = 0.15\textwidth]{figures/pretty_pictures/large_figures/celeba_deblur/orig}} &
\subfloat{\includegraphics[width = 0.15\textwidth]{figures/pretty_pictures/large_figures/celeba_deblur/neumann}} &
\subfloat{\includegraphics[width = 0.15\textwidth]{figures/pretty_pictures/large_figures/celeba_deblur/grad}} &
\subfloat{\includegraphics[width = 0.15\textwidth]{figures/pretty_pictures/large_figures/celeba_deblur/resauto}} \\[-2ex]
\subfloat{\includegraphics[width = 0.15\textwidth]{figures/pretty_pictures/large_figures/celeba_deblur/altered}} & \subfloat{\includegraphics[width = 0.15\textwidth]{figures/pretty_pictures/large_figures/celeba_deblur/celeba_neumm_residual}} &
\subfloat{\includegraphics[width = 0.15\textwidth]{figures/pretty_pictures/large_figures/celeba_deblur/celeba_grad_residual}} &
\subfloat{\includegraphics[width = 0.15\textwidth]{figures/pretty_pictures/large_figures/celeba_deblur/celeba_resauto_residual}} \\
\end{tabular}
\caption{\small Reconstruction comparison on the CelebA dataset for the deblur plus noise problem. While the Neumann networks (NN) and gradient descent networks (GDN) perform well, the differences are most apparent the residual images in the second row, especially in the background reconstruction.
Residuals are formed by displaying the norm across color channels of the error at each pixel, scaled by a factor of 6.}
\label{fig:large_images_cifar_inpaint}
\end{figure}
\begin{figure}[h]
\centering
\begin{tabular}{c@{}c@{}c@{}c@{}c}
{\small Original and} \\ {\small $\bm{X}^\top \bm{y}$} & {\small NN} & {\small GDN} & {\small ResAuto} \\ \hline \\[-2ex]
\subfloat{\includegraphics[width = 0.15\textwidth]{figures/pretty_pictures/large_figures/stl10_cs8/orig}} &
\subfloat{\includegraphics[width = 0.15\textwidth]{figures/pretty_pictures/large_figures/stl10_cs8/neumann}} &
\subfloat{\includegraphics[width = 0.15\textwidth]{figures/pretty_pictures/large_figures/stl10_cs8/grad}} &
\subfloat{\includegraphics[width = 0.15\textwidth]{figures/pretty_pictures/large_figures/stl10_cs8/resauto}} \\[-2ex]
\subfloat{\includegraphics[width = 0.15\textwidth]{figures/pretty_pictures/large_figures/stl10_cs8/altered}} & \subfloat{\includegraphics[width = 0.15\textwidth]{figures/pretty_pictures/large_figures/stl10_cs8/neumann_res}} &
\subfloat{\includegraphics[width = 0.15\textwidth]{figures/pretty_pictures/large_figures/stl10_cs8/grad_res}} &
\subfloat{\includegraphics[width = 0.15\textwidth]{figures/pretty_pictures/large_figures/stl10_cs8/resauto_res}}
\end{tabular}
\caption{\small 8x compressed sensing reconstruction comparison on STL10. ResAuto fails to invert the compressed sensing problem adequately. The Gradient Descent network (GDN) reconstructs accurately but generates more artifacts than the Neumann network (NN).}
\label{fig:large_images_celeba_superres}
\end{figure}
The residual autoencoder in particular has excellent performance on certain problems like inpainting and superresolution, but is not competitive for compressed sensing and deblurring. Recall the motivation for the residual autoencoder: the closer $\bm{X}^\top \bm{y}$ is to the ground truth $\bbeta^\star$, the simpler the residual $\bbeta^\star-\bm{X}^\top \bm{y}$ that the network must learn. With this in mind, it seems reasonable that the residual autoencoder should perform well on small-scale downsampling, inpainting, and deblurring, but would fail to generate high-quality reconstructions for compressed sensing or heavy downsampling where $\bm{X}^\top\bm{y}$ is likely to be a poor approximation of $\bbeta^\star$.
The difference in performance between PNN and NN in Table \ref{table:compare_cifar} can provide some insight regarding the usage of various architectures. First, although PNN performs well for 4x superresolution, deblurring, and deblurring with noise, preconditioning is not a universal solution: inpainting and compressed sensing are perfectly conditioned and preconditioning appears to worsen performance. We see similar effects with MoDL, which performs better than NN or GDN on certain problems, but suffers especially in compressed sensing. These results further emphasize that consideration of the specific forward model at hand should be an important element of designing learned inverse problem solvers.
In addition, we observe some variance in results across datasets. CIFAR10 in particular seems to be a an outlier: while the best reconstructions on CelebA are uniformly more accurate than on STL10, the apparent "difficulty" of reconstruction in CIFAR10 is more task-specific.
Figures~\ref{fig:large_images_cifar_inpaint} and \ref{fig:large_images_celeba_superres} demonstrate more qualitative and quantitative detail in some examples from several different inverse problems and all three datasets. In these figures the residuals are shown for illustrative purposes: the residuals are formed by displaying the scaled pixelwise norm across color channels of the difference $\bbeta^\star - \widehat\bbeta$ where $\bbeta^\star$ is the true image, and $\widehat\bbeta$ the estimate, scaled by a factor of 6. Magnitudes are clipped to be less than or equal to 1.
\subsection{Effect of Sample Size}
In section \ref{sec:decoupled} we hypothesized that incorporating information about the forward operator would have implications for the sample sizes required to achieve particular error rates.
\begin{figure}[ht!]
\centering
\renewcommand{\arraystretch}{0.1}
\begin{tabular}{c|@{}c@{}c@{}c@{}c@{}c}
& \begin{tabular}{@{}c@{}}{\scriptsize Original and} \\ {\scriptsize $\bm{X}^\top \bm{y}$}\end{tabular} & {\scriptsize NN} & {\scriptsize GDN} & {\scriptsize ResAuto} & {\scriptsize CSGM} \\ \hline \\[-2ex]
\raisebox{1.5em}{2k} & \subfloat{\includegraphics[width = 0.12\textwidth]{figures/sample_comp/30k/orig}} & \subfloat{\includegraphics[width = 0.12\textwidth]{figures/sample_comp/2k/neumann_plane}} &
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/sample_comp/2k/grad_plane}} &
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/sample_comp/2k/resauto_plane}} &
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/sample_comp/2k/csgm_plane}}\\[-2ex]
\raisebox{2em}{\begin{tabular}{@{}c@{}}{\scriptsize $\bm{X}^\top \bm{y}$ and} \\ {\scriptsize Residuals}\end{tabular}} & \subfloat{\includegraphics[width = 0.12\textwidth]{figures/sample_comp/30k/altered}} & \subfloat{\includegraphics[width = 0.12\textwidth]{figures/sample_comp/2k/neumann_plane_residual}} &
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/sample_comp/2k/grad_plane_residual}} &
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/sample_comp/2k/resauto_plane_residual}} & \subfloat{\includegraphics[width = 0.12\textwidth]{figures/sample_comp/2k/csgm_plane_residual}} \\[-2ex]
\raisebox{1.5em}{30k} & \subfloat{\includegraphics[width = 0.12\textwidth]{figures/sample_comp/30k/orig}} & \subfloat{\includegraphics[width = 0.12\textwidth]{figures/sample_comp/30k/neumann}} &
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/sample_comp/30k/grad}} &
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/sample_comp/30k/resauto}} &
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/sample_comp/30k/csgm}}\\[-2ex]
\raisebox{2em}{\begin{tabular}{@{}c@{}}{\scriptsize $\bm{X}^\top \bm{y}$ and} \\ {\scriptsize Residuals}\end{tabular}} & \subfloat{\includegraphics[width = 0.12\textwidth]{figures/sample_comp/30k/altered}} & \subfloat{\includegraphics[width = 0.12\textwidth]{figures/sample_comp/30k/neumann_res}} &
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/sample_comp/30k/grad_res}} &
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/sample_comp/30k/resauto_res}} & \subfloat{\includegraphics[width = 0.12\textwidth]{figures/sample_comp/30k/csgm_res}} \\
\end{tabular}
\caption{\small A qualitative comparison of the reconstructions produced for the deblurring problem on a single image at two different training set sizes, along with the associated residual images. Residual images are scaled by a factor of 6.}
\label{fig:sample_complexity_fig}
\end{figure}%
\begin{figure}[ht!]
\centering
\subfloat[Sample Complexity]{\includegraphics[width = 0.4\textwidth]{figures/sample_complexity_bar_small.png}\label{fig:sample_complexity_bar}}~~
\subfloat[Preconditioning]{\includegraphics[width = 0.4\textwidth]{figures/precondition_bar.png} \label{fig:precondition_bar}}
\caption{\small Performance comparisons. (a) Median PSNR of methods trained with different sample sizes of 2,000, 30,000, and 50,000. Neumann networks (NN) and Preconditioned Neumann networks (PNN) scale very well with training set size, with smaller marginal gains as training sizes increase. All PSNR values are for the CIFAR-10 dataset, and the inverse problem used is the previously described deblurring problem. (b) PSNR (dB) for the standard and preconditioned NN. The inverse problem in this case is deblurring with a Gaussian kernel of size $5 \times 5$ and variance $\sigma = 5.0$.}
\end{figure}%
A coarse comparison of the presented learning-based methods at different sample sizes is provided in Figure~\ref{fig:sample_complexity_bar}. We observe that while all methods suffer a decrease in PSNR at low sample sizes, the Neumann network has the highest-quality reconstructions at only 2,000 images, and also enjoys the largest increase of performance when going from 2,000 to 30,000 training images. Gradient descent network performs well even at very low sample sizes, but artifacts are present in reconstructions at low sample sizes, visible in Figure~\ref{fig:sample_complexity_fig}.
Methods that do not incorporate the forward model, like ResAuto and CSGM, perform poorly in the low-sample regime, as discussed in Section~\ref{sec:decoupled}. While ResAuto performs competitively at 30k iterations, there is little change between image qualities produced at these sample sizes, and even a very slight decrease in performance. CSGM improves significantly with increasing samples, but does not produce high-quality reconstructions on this inverse problem.
\subsection{Effect of Preconditioning}\label{sec:precond}
Figure~\ref{fig:precondition_bar} illustrates the effect of preconditioning on the performance of the Neumann network with different numbers of blocks $B$ on a deblurring task. While the original Neumann network does not surpass 32 dB PSNR with 8 blocks, the preconditioned Neumann network surpasses the original with only $B = 2$, and continues to improve as the number of blocks increases. Example images are included in the supplementary materials.
The forward problem in this case is Gaussian deblurring with $\sigma = 5.0$ and a blur kernel of size $5 \times 5$. The corresponding $\bm{X}$ is very poorly conditioned, and a $\lambda$ of 0.01 is used in the preconditioning matrix $(\bm{X}^\top \bm{X} + \lambda \bm{I})^{-1}$.
Depending on the structure of $\bm{X}$ and how easily $(\bm{X}^\top \bm{X} + \lambda \bm{I})^{-1}$ can be computed, preconditioning can be computationally costly, but it appears to permit fewer Neumann network blocks for comparable performance. Since the primary resource bottleneck for training the Neumann network end-to-end is memory, fewer blocks permits faster training, or alternately, allows implementations to achieve higher performance than would otherwise be possible with fixed computational resources.
\subsection{MRI Experiments}\label{sec:mri}
\begin{figure*}[ht!]
\centering
\renewcommand{\arraystretch}{0.1}
\begin{tabular}{@{}c@{}c@{}c@{}c@{}c@{}c@{}c@{}c}
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/mri/orig}} &
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/mri/neumann}} &
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/mri/neumann_vanilla}} &
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/mri/modl}} &
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/mri/gradprecondinit}} &
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/mri/gradstandardinit}} &
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/mri/tnrd}} &
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/mri/tv1}} \\[-2ex]
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/mri/mask}} &
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/mri/neumann_residual}} &
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/mri/neumann_vanilla_residual}} &
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/mri/modl_residual}} &
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/mri/gradprecondinit_residual}} &
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/mri/gradstandardinit_residual}} &
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/mri/tnrd_residual}} &
\subfloat{\includegraphics[width = 0.12\textwidth]{figures/mri/tv_residual1}} \\ \\
{\scriptsize Original/Mask } & {\scriptsize PNN}
& {\scriptsize NN}
& {\scriptsize MoDL} & {\scriptsize GDN2} & {\scriptsize GDN1} & {\scriptsize TNRD}
& {\scriptsize TV} \\ \\
{\scriptsize PSNR (dB) } & {\scriptsize 34.95 dB}
& {\scriptsize 33.09 dB}
& {\scriptsize 34.09 dB} & {\scriptsize 33.18 dB} & {\scriptsize 31.37 dB} & {\scriptsize 32.39 dB}
& {\scriptsize 32.29 dB} \\ \\
{\scriptsize Test Time (sec) } & {\scriptsize 16.3 sec}
& {\scriptsize 5.5 sec}
& {\scriptsize 14.3 sec} & {\scriptsize 5.7 sec} & {\scriptsize 3.1 sec} & {\scriptsize 4.0 sec}
& {\scriptsize 349.2 sec}
\end{tabular}
\caption{\small A comparison of MRI reconstruction quality for a variety of trainable and non-trainable image reconstruction methods. The 12-coil data is undersampled by a factor of $4\times$ and Gaussian noise with $\sigma=0.01$ is added in k-space. The reconstructions are displayed in the first row, while the second row contains the residual images scaled by a factor of $4$. PSNR is displayed next to the method name, while below each method name is the mean time required to reconstruct a single MRI image in seconds. GDN2 denotes the Gradient Descent network using the same initialization as the preconditioned Neumann network, while GDN1 uses the same initialization as the Neumann network.}
\label{fig:mri_reconstruction}
\end{figure*}%
In this section we provide results of multi-coil MRI reconstruction from undersampled measurements. Full training and test data is the data used for the experiments in \cite{aggarwal2018modl}, consisting of 12-coil Cartesian sampled k-space data of dimension $232 \times 208 \times 12$ with known coil sensitivity maps. The size of the training set is 360 such acquisitions across 4 subjects, with testing being performed on 40 images from one, separate subject who was not used for training. The sum-of-squares reconstruction is treated as ground truth. Further details of the data acquisition can be found in \cite{aggarwal2018modl}.
All experiments are for 4$\times$ undersampling, although we differ from \cite{aggarwal2018modl} in that we train on a fixed k-space undersampling mask. The undersampling mask is fully sampled in the center 0.15 fraction of frequencies, with the remaining frequencies being sampled according to a random Gaussian pattern. The mask is visualized in figure \ref{fig:mri_reconstruction}.
For the MRI experiments we follow the precedent set by \cite{aggarwal2018modl} in our choice of learned component, using only a simple five-layer convolutional network with 64 filters per layer and ReLU nonlinearities for all architectures other than TNRD. The TNRD architecture follows the architecture proposed in \cite{chen2017trainable}. The Neumann network results presented here are for the preconditioned Neumann network (PNN), and the number of blocks for GDN, PNN, MoDL, and TNRD is fixed to be 5. The preconditioning operator in PNN is implemented through 10 conjugate gradient iterations, identically to \cite{aggarwal2018modl}. We compare to GDN with the same initialization as NN (GDN1) and as PNN (GDN2) to study the effect of different initializations on GDN.
We observe that unrolled optimization approaches are advantageous in this setting compared to the more traditional TV-regularized reconstruction. Preconditioning, both to improve initialization as in GDN2, and incorporated into the architectures, as in PNN and MoDL, improves PSNR significantly in this setting.
A major benefit of learned reconstruction methods is their test time, which is displayed beneath the method name and PSNR in Figure \ref{fig:mri_reconstruction}. We note that all learned approaches reconstruct an order of magnitude faster than the agnostic TV approach. Although preconditioning incurs an additional cost in terms of test time, the performance increase is substantial for MoDL and PNN.
\subsection{Optimization Landscapes}\label{sec:optlandscape}
\begin{figure}[htpb]
\centering
\begin{tabular}{c@{}c@{}c@{}c@{}c}
\subfloat{\includegraphics[width = 0.2\textwidth]{figures/neumann_surf}} &
\subfloat{\includegraphics[width = 0.2\textwidth]{figures/neumann_contour}} &
\subfloat{\includegraphics[width = 0.2\textwidth]{figures/grad_surf}} &
\subfloat{\includegraphics[width = 0.2\textwidth]{figures/grad_contour_1}} \\[-2ex]
\subfloat{\includegraphics[width = 0.2\textwidth]{figures/neumann_opt_sr10_surf}} &
\subfloat{\includegraphics[width = 0.2\textwidth]{figures/neumann_opt_sr10_contour}} &
\subfloat{\includegraphics[width = 0.2\textwidth]{figures/grad_opt_sr10_surf}} &
\subfloat{\includegraphics[width = 0.2\textwidth]{figures/grad_opt_sr10_contour}} \\[-2ex]
\subfloat{\includegraphics[width = 0.2\textwidth]{figures/neumann_opt_cs8_surf}} & \subfloat{\includegraphics[width = 0.2\textwidth]{figures/neumann_opt_cs8_contour}} &
\subfloat{\includegraphics[width = 0.2\textwidth]{figures/grad_opt_cs8_surf}} &
\subfloat{\includegraphics[width = 0.2\textwidth]{figures/grad_opt_cs8_contour}} \\
{\begin{tabular}{@{}c@{}}{\scriptsize (a) Neumann Loss} \\[-0.5em] {\scriptsize Surface}\end{tabular}} & {\begin{tabular}{@{}c@{}}{ \scriptsize (b) Neumann} \\[-0.5em] {\scriptsize Contour}\end{tabular}} & {\begin{tabular}{@{}c@{}}{\scriptsize (c) GDN Loss} \\[-0.5em] {\scriptsize Surface}\end{tabular}} & {\scriptsize (d) GDN Contour}
\end{tabular}
\caption{\small Optimization landscapes and contour plots. (a) The optimization landscape associated with the training loss of the Neumann network around the center optimal point. (b) The associated contour plot. (c) The optimization landscape associated with the training loss of the gradient descent network. (d) The associated contour plot.
Neumann network landscapes tend to have wider basins around the minimizer and be steeper outside the basin of the minimizer, which are both more favorable to practical optimization by SGD.
Figures use the CIFAR-10 dataset and, from top to bottom, deblurring inverse problem with $\sigma=2.5$, $10\times$ superresolution, and compressed sensing with $8\times$ compression.}
\label{fig:opt_landscape_test}
\end{figure}
The performance of the Neumann networks (NN) and Gradient Descent networks (GDN) are very similar across a range of problems and datasets, but NN slightly outperforms GDN consistently. We hypothesize this is due to differences in the connectivity of their network architectures and the effect this has on training.
Specifically, both NN and GDN contain connections across blocks, but differ mainly in their \emph{direction} and \emph{extent}. Adjacent blocks in both networks share residual connections as in a ResNet \cite{he2016deep} (the inclusion of the identity $\bm{I}$ in the linear part $[\bm{I}-\eta\bm{X}^\top\bm{X}](\cdot)$ of each block of NN and GDN is a residual connection). However, the main difference is that NN contain additional ``skip'' connections that connect each block with the final layer, similar to architectures like DenseNets \cite{huang2017densely}. Recent work \cite{li2018visualizing} has highlighted the role of residual connections in the optimization landscape of deep architectures, implying that residual connections ``smooth" the optimization landscape. Specifically, fewer local minima tend to be present, and those minima tend to be wide, as opposed to sharp. In addition, the authors of \cite{li2018visualizing} note that skip connections from intermediate or early layers of deep networks to final layer tend to provide stronger smoothing effects on optimization landscapes than residual connections alone. Hence, we might expect the additional skip connections present in NN also lead to a smoother optimization landscape.
In Figure~\ref{fig:opt_landscape_test} we illustrate the optimization landscapes using the method of \cite{li2018visualizing}, which proposes a procedure for projecting the loss landscape of very high-dimensional models into two dimensions for visualization purposes. Suppose that the fully-trained network has a set of parameters which is vectorized $\widehat{\bm{\theta}} \in \mathbb{R}^K$. We draw two independent standard Gaussian vectors ${\bm v}_1$, ${\bm v}_2$ with dimension $K$, and normalize them in the manner described in \cite{li2018visualizing} that accounts for the scaling ambiguity of ReLU networks. Then we compute the test and training set error for parameters given by $\widehat{\bm{\theta}} + \tau (i {\bm v}_1 + j {\bm v}_2)$ for step size $\tau > 0$ and integers $i, j$. The plots above are generated for $i, j \in \{-125,..., 125\}$ and $\tau = 0.01$. We demonstrate plots for three different forward models: deblurring, compressed sensing with $8\times$ compression, and $10\times$ superresolution.
Figure~\ref{fig:opt_landscape_test} illustrates several attractive properties of the NN and GDN. Local minima appear to be rare in the neighborhood of the trained minima for GDN and NN. While neither is convex, it is interesting to note that the NN landscapes seem to have much wider basins around minima and higher slope outside this main basin. GDN's optimization landscape appears to require a search around a low-slope landscape until finding a region of high curvature in the deblurring and compressed sensing case, and contains more local minima than NN.
In addition, experimental evidence and some theory indicate that wider local minima have better generalization properties \cite{keskar2016large}. This does not indicate that one architecture should perform better than another, but if both networks achieve similar training error, wider local minima may translate to better test performance.
\section{Discussion and Conclusions}
This paper describes a novel network architecture that departs from the currently-popular unrolled optimization framework described in Section~\ref{sec:unrolled}. Our approach is based on the Neumann series expansion for inverting linear operators and has several key features. First, Neumann networks naturally contain ``skip connections'' \cite{he2016deep,huang2017densely} that appear to yield optimization landscapes that facilitate more efficient training, but are absent from previously proposed network architectures.
Our theoretical analysis reveals that when the training data lie in a union of subspaces, the optimal {\em oracle} estimator that has prior knowledge of both the subspaces in the union and the identity of the subspace to which true image belongs is piecewise linear. We show this piecewise linear oracle estimator can be approximated arbitrarily well by a Neumann network whose learned component coincides with a specific piecewise linear map, which in principle can always be realized by a neural network using ReLU activations. Furthermore, we observe empirically on simulated union-of-subspaces data that the nonlinear learned component in the trained Neumann network well-approximates the specific piecewise linear map predicted by theory.
We are unaware of past work on using neural networks to solve inverse problems demonstrating such properties.
Third, we describe a simple preconditioning step that, when combined with the Neumann network architecture, provides an additional increase in reconstruction PSNR and can reduce the number of blocks $B$ needed for accurate reconstruction, which in turn decreases reconstruction computational complexity when the preconditioning can be computed efficiently. As a result, using a truncated series expansion with only $B$ blocks results in a small, bounded approximation error.
Finally, we explore the proposed Neumann network's empirical performance on a variety of inverse problems relative to the performance of representative agnostic, decoupled, and unrolled optimization methods described in Section~\ref{sec:previous}.
While this paper has focused on solving linear inverse problems in imaging using training data to train a neural network, {\em more generally we can think of this paper as a case study in leveraging physical models to guide neural network architecture design.} More specifically, we can think of networks such as the Neumann network as a single large neural network in which a subset of edge weights ({\em i.e.,~} those corresponding to the operation $\bm{I}-\eta\bm{X}^\top\bm{X}$ and other zero-valued ``edges" that define the general architecture of Figure~\ref{fig:nn}) are determined by the physical forward model that specifies the inverse problem at hand and are held fixed during training, while the remaining edges ({\em i.e.,~} those that correspond to the operation $R(\cdot)$) can be learned during training. In other words, {\em we use knowledge of the inverse problem structure to define the neural network architecture.}
This perspective leads to interesting potential avenues for future work. Specifically, our proposed Neumann network is inspired by series expansions for inverting linear operators, but there are alternative methods for inverting nonlinear operators that may yield new challenges and opportunities. For instance, Adomian decompositions and polynomial expansions have been successfully used to solve differential equations with both linear and nonlinear components \cite{gabet1994theoretical,adomian2013solving}, and so designing future networks inspired by this framework could lead to new theoretical insights beyond what we present above.
In addition, the reader might note that neural networks based on the Neumann series expansion or iterative optimization methods have several repeated blocks, leading to the question of whether standard stochastic gradient descent is the most efficient training regimen. For instance, recent work on ``Neural Ordinary Differential Equations'' \cite{neuralODE} has considered an ODE representation of the operation of a neural network instead of a series of discrete layers and used this perspective to devise training methods that leverage ODE solvers for more efficient training. Such techniques might be leveraged to improve training of Neumann networks.
\section*{Appendix}
Here we let $\bm{P}_{\bm{X}}$ and $\bm{P}_{\bm{X}_\perp}$ denote the projectors onto the row space of $\bm{X}$ and the null space of $\bm{X}$, respectively. In particular, $\bm{P}_{\bm{X}} = \bm{X}^\top\bm{X}$ and $\bm{P}_{\bm{X}_\perp} = \bm{I}-\bm{X}^\top\bm{X}$, since we assume $\bm{X}$ has orthonormal rows in Lemma 1, Theorem 1, and Corollary 1.
\subsection{Proof of Lemma 1}\label{sec:prooflem1}
We have $\widehat\bbeta(\bm{y}) = \sum_{j=0}^B\btj{j}$ where $\btj{0}= \eta\bm{X}^\top\bm{y}$, $\bm{y} = \bm{X}\bbeta^\star$, and
\begin{align}
\btj{j} & = (\bm{I} - \eta\bm{X}^\top\bm{X} -\eta R)\btj{j-1} \\
& = (\bm{P}_{\bm{X}_\perp} + (1-\eta)\bm{P}_{\bm{X}} - \eta R)\btj{j-1}
\end{align}
for all $j=1,...,B$, and where in the last line we used the identity $\bm{I} = \bm{P}_{\bm{X}} + \bm{P}_{\bm{X}_\perp}$.
We show that $R(\bm{\beta}) = \bm{R}\bm{\beta}$ with $\bm{R}$ as specified in Lemma 1 satisfies the desired error bounds. Define $\bm{Q} = \bm{P}_{\bm{X}_\perp}\bm{U}(\bm{U}^\top\bm{X}^\top\bm{X}\bm{U})^{-1}\bm{U}^\top\bm{X}^\top$ so that $\bm{R} = -c_{\eta,B}\,\bm{Q}\bm{X}$. With this choice of $\bm{R}$ we have $\bm{P}_{\bm{X}} \bm{R} = 0$, and an easy induction shows
\begin{equation}\label{eq:betajs}
\btj{j} = \eta(1-\eta)^j\bm{X}^\top\bm{y} - \eta \sum_{k=0}^{j-1} \bm{R}\btj{k}
\end{equation}
for all $j\geq 1$. Summing this over $j=0,1,...,B$ gives
\begin{align}
\widehat\bbeta(\bm{y})
& = \sum_{j=0}^B \eta(1-\eta)^j\bm{X}^\top\bm{y} -\eta \sum_{j=1}^{B}\sum_{k=0}^{j-1} \bm{R}\btj{k}\nonumber\\
& = \sum_{j=0}^B \eta(1-\eta)^j\bm{X}^\top\bm{y}-\eta \sum_{j=0}^{B-1}(B-j)\bm{R}\btj{j}\label{eq:bhatlem}
\end{align}
Next, we show we can choose the constant $c_{\eta,B}$ so that the second term above simplifies to
\begin{equation}\label{eq:xperpeq}
-\eta \sum_{j=0}^{B-1}(B-j)\bm{R}\btj{j} = \bm{Q}\bm{y}.
\end{equation}
Observe that $\bm{R}^2\btj{k} = 0$ for all $k=0,...,j-1$, and so from \eqref{eq:betajs} we have $\bm{R}\btj{j} = \eta(1-\eta)^j\bm{R}\bm{X}^\top\bm{y}$, which gives
\begin{equation*}
\sum_{j=0}^{B-1}(B-j)\bm{R}\btj{j} = \eta\sum_{j=0}^{B-1}(B-j)(1-\eta)^j\bm{R}\bm{X}^\top\bm{y}.
\end{equation*}
Letting
$
c_{\eta,B} = \left(\eta^2\sum_{j=0}^{B-1}(B-j)(1-\eta)^j\right)^{-1}
$
we obtain \eqref{eq:xperpeq}. Therefore, combining \eqref{eq:bhatlem} and \eqref{eq:xperpeq} we have
\begin{align}\label{eq:finalform}
\widehat\bbeta(\bm{y}) & = \eta\sum_{j=0}^B (1-\eta)^j\bm{X}^\top\bm{y} + \bm{Q}\bm{y}.
\end{align}
Finally, since we assume $\bm{y} = \bm{X}\bbeta^\star$, we see that $\bm{X}^\top\bm{y} = \bm{P}_{\bm{X}}\bm{\beta}^*$ and $\bm{Q}\bm{y} = \bm{P}_{\bm{X}_\perp}\bm{\beta}^*$, and using the fact that ${\eta\sum_{j=0}^B (1-\eta)^j = 1-(1-\eta)^{B+1}}$ from \eqref{eq:finalform} we have
$\widehat\bbeta(\bm{y}) = \bbeta^\star - (1-\eta)^{B+1}\bm{P}_{\bm{X}}\bm{\beta}^*$
which gives the desired error bound.
\subsection{Proof of Theorem \ref{thm:main} and Corollary \ref{cor:main}}
To prove Theorem~\ref{thm:main} we show that if $\bbeta^\star$ belongs to the $k$th subspace then $R^*$ acts acts as the linear map $\bm{R}_k$ when applied to each Neumann network term $\btj{j}$. That is, we show $\btj{j} \in \mathcal{C}_k$ for all $j=0,...,B$, where $\btj{0}= \eta\bm{X}^\top\bm{y}$ and $\btj{j} = (\bm{I}-\eta\bm{X}^\top\bm{X})\btj{j-1} -\eta R^*(\btj{j-1})$ for $j=1,...,B$. The desired error bounds then follow by direct application of Lemma~\ref{lem:singlesub}.
First, an easy induction shows that
\begin{equation}
\btj{j} = \eta(1-\eta)^j \bm{X}^\top\bm{y} -\eta \sum_{i=0}^{j-1}R^*(\btj{k}).
\end{equation}
Using the fact that $\bm{P}_{\bm{X}}R^*(\bm{\beta}) = 0$ for all $\bm{\beta} \in \mathbb{R}^p$, and $\bm{y} = \bm{X}\bbeta^\star$, we have
$\bm{P}_{\bm{X}}\btj{j} = \eta(1-\eta)^j\bm{P}_{\bm{X}}\bbeta^\star$
for all $j=0,...,B$. Since the region $\mathcal{C}_k$ is a cone, in order to prove $\btj{j} \in \mathcal{C}_k$ for all $j=0,...,B$ it suffices to show $\bm{P}_{\bm{X}}\bbeta^\star \in \mathcal{C}_k$. This means we need to show $d_{\bm{X},k}(\bbeta^\star) < d_{\bm{X},\ell}(\bbeta^\star)$ for all $\ell\neq k$, or equivalently,
\begin{multline*}
\|(\bm{I}-\bm{X}\bm{U}_k(\bm{X}\bm{U}_k)^{+})\bm{X}\bbeta^\star\|\\ < \|(\bm{I}-\bm{X}\bm{U}_\ell(\bm{X}\bm{U}_\ell)^{+})\bm{X}\bbeta^\star\|
\end{multline*}
for all $\ell \neq k$. Since $\bm{X}\bm{U}_k(\bm{X}\bm{U}_k)^{+}$ is projection onto $\text{span}(\bm{X}\bm{U}_k)$, and $\bm{X}\bbeta^\star \in \text{span}(\bm{X}\bm{U}_k)$, we have ${(\bm{I}-\bm{X}\bm{U}_{k}(\bm{X}\bm{U}_{k})^{+})\bm{X}\bbeta^\star = 0}$ and so
${\|(\bm{I}-\bm{X}\bm{U}_{k}(\bm{X}\bm{U}_{k})^{+})\bm{X}\bbeta^\star\| = 0}$.
Furthermore, since by assumption $\bm{X}\bbeta^\star \notin \text{span}(\bm{X}\bm{U}_\ell)$ for all $\ell \neq k$, we have ${(\bm{I}-\bm{X}\bm{U}_{k}(\bm{X}\bm{U}_{k})^{+})\bm{X}\bbeta^\star \neq 0}$, which means
${\|(\bm{I}-\bm{X}\bm{U}_\ell(\bm{X}\bm{U}_\ell)^{+})\bm{X}\bbeta^\star\| > 0}$,
proving the claim.
Similarly, to prove Corollary~\ref{cor:main} we need to show $\bj{j} \in \mathcal{C}_k$ for all $j=0,...,B$, where $\bj{0} = \eta\bm{X}^\top\bm{y} \in \mathcal{C}_k$ and $\bj{j} = (\bm{I}-\eta\bm{X}^\top\bm{X})\bj{j-1} -\eta R^*(\bj{j-1}) + \bj{0}$. Since $\bm{P}_{\bm{X}}R^*(\bm{\beta}) = 0$ for all $\bm{\beta} \in \mathbb{R}^p$, an easy induction shows that
\begin{equation}
\bm{P}_{\bm{X}}\bj{j} = \eta\sum_{i=0}^j(1-\eta)^i\bm{P}_{\bm{X}}\bbeta^\star.
\end{equation}
Since each $\bj{j}$ is a scalar multiple of $\bm{P}_{\bm{X}}\bbeta^\star$, by the same argument as above we have $\bj{j} \in \mathcal{C}_k$ for all $j = 0,...,B$, which proves the claim.
\bibliographystyle{IEEEtran}
| {'timestamp': '2019-06-05T02:06:47', 'yymm': '1901', 'arxiv_id': '1901.03707', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03707'} | arxiv |
\section*{Author summary}
\section{Introduction}
Effective response to disease outbreaks depends on reliable estimates of their status.
This process of identifying new outbreaks and monitoring ongoing ones — \vocab{disease surveillance} — is a critical tool for policy makers and public health professionals~\cite{horstmann1974}.
The traditional practice of disease surveillance is based upon gathering information from in-person patient visits.
Clinicians make a diagnosis and report that diagnosis to the local health department.
These health departments aggregate the reports to produce local assessments and also pass information further up the government hierarchy to the national health ministry, which produces national assessments~\cite{mondor2012}.
Our previous work describes this process with a mathematical model~\cite{priedhorsky2018flow}.
This approach is accepted as sufficient for decision-making~\cite{johnson2004, rolfes2018annual} but is expensive, and results lag real time by anywhere from a week~\cite{cdc2016} to several months~\cite{bahk2015comparing, jajosky2004}.
Novel surveillance systems that use disease-related internet activity traces such as social media posts, web page views, and search queries are attractive because they would be faster and cheaper~\cite{priedhorsky2017cscw, santillana2015}.
One can conjecture that an increase of influenza-related web searches is due to an increase in flu observations by the public, which in turn corresponds to an increase in real influenza activity.
These systems use statistical techniques to estimate a mapping from past activity to past traditional surveillance data, then apply that map to current activity to predict current (but not yet available) traditional surveillance data, a process known as \vocab{nowcasting}.
\begin{figure}
\includegraphics[width=\textwidth]{us_ili_and_deceptive.pdf}
\caption{
\caphead{Simple deceptive models for influenza-like illness (ILI)}
This figure shows five one-feature models that map U.S.\ Google volume for contagiousness-related searches to ILI data from the CDC (``how long are you contagious'', ``flu contagious'', ``how long am i contagious'', ``influenza contagious'', ``when are you contagious'').
We fit using ordinary least squares linear regression over the first three seasons of the study period.
Despite a good fit during the training period, these models severely overestimate the peaks of the fourth and fifth seasons, demonstrating that a model's history of accuracy does not yield accurate predictions in the future if it uses deceptive input features, such as these contagiousness searches.
Our \vocab{deceptiveness} metric quantifies the risk of such divergence.
}
\label{fig:us-ili-deceptive}
\end{figure}
One specific concern with this approach is that these models can learn coincidental, rather than informative, relationships~\cite{priedhorsky2018flow}.
For example, Bodnar and Salathé found a correlation between zombie-related Twitter messages and influenza~\cite{bodnar2013}.
More quantitatively, Ginsberg \etal\ built a flu model using search queries selected from 50~million candidates by a purely data-driven process that considered correlation with influenza-like-illness in nine regions of the United States~\cite{ginsberg2008}.
Of the 45 queries selected by the algorithm for inclusion in the model, 6~(13\%) were only weakly related to influenza (3~categorized as ``antibiotic medication'', 2~``symptoms of an unrelated disease'', 1~``related disease'').
Of the 55 next-highest-scoring candidates, 8~(15\%) were weakly related (3, 2, and 3 respectively) and 19~(35\%) were ``unrelated to influenza'', e.g. ``high school basketball''.
That is, even using a high-quality, very computationally expensive approach that leveraged demonstrated historical correlation in nine separate geographic settings, one-third of the top 100 features were weakly related or not related to the disease in question.
\Figure{fig:us-ili-deceptive} illustrates this problem for flu using contagiousness-related web searches.
Such features, with a dubious real link to the quantity of interest, pose a risk that the model may perform well during training but then provide erroneous estimates later when coincidental relationships fail, especially if they do so suddenly.
We have previously proposed a metric called \vocab{deceptiveness} to quantify this risk~\cite{priedhorsky2018flow}.
This metric quantifies the fraction of an estimate that depends on noise (coincidental relationships between input and output data) rather than signal (informative relationships) and is a real number between 0 and 1 inclusive.
We hypothesize that disease nowcasting models that leverage the deceptiveness of input features have better accuracy than those that do not.
This is an important question because disease forecasting is improved by better nowcasting.
For example, Brooks \etal's top-performing entry~\cite{brooks2018nonmechanistic} to the CDC's flu forecasting challenge~\cite{cdcchallenge2017} was improved by nowcasting.
Lu \etal\ tested autoregressive nowcasts using several internet data sources and found that they improved 1-week-ahead forecasts~\cite{lu2018accurate}.
Kandula \etal\ measured the benefit of nowcasting to their flu forecasting model at 8–35\%~\cite{kandula2018evaluation}.
Finally, our own work shows that a Bayesian seasonal flu forecasting model using ordinary differential equations benefits from filling a one-week reporting delay with internet-based nowcasts~\cite{osthus2018good}.
The present work tests this hypothesis using five seasons of influenza-like-illness (ILI) in the United States (2011–2016).
We selected U.S.\ influenza because high-quality reference data are easily available and because it is a pathogen of great interest to the public health community.
Although flu is often considered a mild infection, it can be quite dangerous for some populations, including older adults, children, and people with underlying health conditions.
Typical U.S.\ flu seasons kill ten to fifty thousand people annually~\cite{rolfes2018annual}.
Our experiment is a simulation study followed by validation using real data.
This lets us test our approach using fully-known deceptiveness as well as a more realistic setting with estimated deceptiveness.
We trained linear estimation models to nowcast ILI using an extension of ridge regression~\cite{hoerl1970} called \vocab{generalized ridge}~\cite{hemmerle1975gridge} or \vocab{gridge regression} that lets us apply individual weights to each feature, thus expressing a prior belief on their value: higher value for lower deceptiveness.
We used three classes of input features:
(1)~synthetic features constructed by adding plausible noise patterns to ILI,
(2)~Google search volume on query strings related to influenza,
and (3)~Google search volume on inferred topics related to influenza.
We found that accurate deceptiveness knowledge did indeed reduce prediction error, and in the case of the automatically-generated query string features, as much or more than topic features that require human curation. We also found that semantic distance as derived from the Wikipedia article category tree served as a useful proxy for deceptiveness.
The remainder of this paper is organized as follows.
We next describe our data sources, regression approach, and experiment structure.
After that, we describe our results and close with their implications and suggestions for future work.
\section{Methods}
Our study period was five consecutive flu seasons, 2011–2012 through 2015–2016, using weekly data.
The first week in the study was the week starting Sunday, July 3, 2011, and the last week started Sunday, June 26, 2016, for a total of 261 consecutive weeks.
We considered each season to start on the first Sunday in July, and the previous season to end on the day before (Saturday).
We used gridge regression to fit input features to U.S.\ ILI over a subset of the first three seasons, then used the fitted coefficients to estimate ILI in the fourth and fifth seasons.
(We used this training schedule, rather than training a new model for each week as one might do operationally, in order to provide a more challenging setting to better differentiate the models.)
We assessed accuracy by comparing the estimates to ILI using three metrics: $r^2$ (the square of Pearson correlation), root mean squared error (RMSE), and hit rate.
The experiment is a full factorial experiment with four factors, yielding a total of 225 models:
\begin{enumerate}
\item \inhead{Class of input features} (3 levels): synthetic features, search query string volume, and search topic volume.
\item \inhead{Training period} (3): one, two, or three consecutive seasons.
\item \inhead{Noise added to deceptiveness} (5): perfect knowledge of deceptiveness to none at all.
\item \inhead{Model type} (5): ridge regression and four levels of gridge regression.
\end{enumerate}
This procedure is implemented in a Python program.
The remainder of this section describes our data sources, regression algorithm, experimental factors, and assessment metrics in detail.
\subsection{Data sources}
We used four types of data in this experiment:
\begin{enumerate}
\item \inhead{Reference data.}
U.S.\ national ILI from the Centers for Disease Control and Prevention (CDC).
This is a weekly estimate of influenza incidence.
\item \inhead{Synthetic features.}
Weekly time series computed by adding specific types of systematic and random noise to ILI.
These simulated features have known deceptiveness.
\item \inhead{Flu-related concepts.}
We used the crowdsourced Wikipedia category tree to enumerate a set of concepts and estimate the semantic relatedness of each to influenza.
\item \inhead{Real features.}
Two types of weekly time series: Google search query strings and Google search topics.
These features are based on the flu-related concepts above and use estimated flu relatedness as a proxy for deceptiveness.
\end{enumerate}
This section explains the format and quirks of the data, how we obtained them, and how readers can also obtain them.
\subsubsection{Reference data: U.S.\ influenza-like illness (ILI) from CDC}
\vocab{Influenza-like illness} (ILI) is a syndromic metric that estimates influenza \vocab{incidence}, i.e., the number of new flu infections.
It is the fraction of patients presenting to the health care system who have symptoms consistent with flu and no alternate explanation~\cite{cdc2016}.
The basic process is that certain clinics called \vocab{sentinel providers} report the total number of patients seen during each interval along with those diagnosed with ILI.
Local, provincial, and national governments then collate these data to produce corresponding ILI reports~\cite{cdc2016}.
U.S.\ ILI values tend to range between 1–2\% during the summer and 7–8\% during a severe flu season~\cite{cdc2016, cdc2018percentage}.
While an imperfect measure (for example, it is subject to reporting and behavior biases if some groups, like children, are more commonly seen for ILI~\cite{lee2015detecting}), it is considered sufficiently accurate for decision-making purposes by the public health community~\cite{johnson2004, rolfes2018annual}.
In this study, we used weekly U.S.\ national ILI downloaded from the Centers for Disease Control and Prevention (CDC)'s FluView website~\cite{cdc2017fluview} on December 21, 2016, six months after the end of the study period.
This delay is enough for reporting backfill to settle sufficiently~\cite{osthus2018good}.
\Figure{fig:us-ili-deceptive} illustrates these data, and they are available as an Excel spreadsheet in S1~Dataset\ (\code{ILI.xls}).
\subsubsection{Synthetic features: Computed by us}
\label{sec:features-synthetic}
These simulated features are intended to model a plausible way in which internet activity traces with varying usefulness might arise.
Their purpose is to provide an experimental setting with features that are sufficiently realistic and have known deceptiveness.
\begin{figure}
\includegraphics[width=\textwidth]{bases.pdf}
\caption{
\caphead{Systematic noise basis functions for synthetic features}
These functions model plausible mechanisms of how features are affected by exogenous events.
}
\label{fig:bases}
\end{figure}
Each synthetic feature $x$ is a random linear combination of ILI $y$, Gaussian random noise $\varepsilon$, and systematic noise $\sigma$ (all vectors with 261 elements, one for each week):
\begin{align}
x &= w_\text{i} y + w_\text{r} \varepsilon + w_\text{s} \sigma \\
\label{eq:three-1}
1 &= w_\text{i} + w_\text{r} + w_\text{s}
\end{align}
A feature's deceptiveness $g \in [0,1]$ is simply the weight of its systematic noise: $g = w_\text{s}$.
Random noise $\varepsilon$ is a random multivariate normal vector with standard deviation 1.
Systematic noise $\sigma$ is a random linear combination of seven basis functions $\sigma_j$:
\begin{align}
w_\text{s} \sigma &= \sum_{j=1}^7 w_{\text{s}j} \sigma_j \\
w_\text{s} &= \sum_{j=1}^7 w_{\text{s}j}
\end{align}
These basis functions, illustrated in \Figure{fig:bases}, simulate sources of systematic noise for internet activity traces.
They fall into three classes:
\begin{itemize}
\item \inhead{Oprah effect~\cite{priedhorsky2018flow}:} 3 types.
These simulate pulses of short-lived traffic driven by media interest.
For example, U.S.\ Google searches for measles were 10 times higher in early 2015 than any other time during the past five years~\cite{google2017trends}, but measles incidence peaked in 2014~\cite{cdc2018measles}.
The three specific bases are: \vocab{annual}~$\sigma_1$, a pulse every year shortly after the flu season peak; \vocab{fore}~$\sigma_2$, pulses during both the training and test seasons (second, fourth, and fifth); and \vocab{late}~$\sigma_3$, pulses only during the test seasons (fourth and fifth).
The last creates features with novel divergence after training is complete, producing deceptive features that cannot be detected by correlation with reference data.
\item \inhead{Drift:} 2 types.
These simulate steadily changing public interest.
For example, as the case definition of autism was modified, the number of individuals diagnosed with autism increased~\cite{hill2015}.
The two bases are: \vocab{steady}~$\sigma_4$, a slow change over the entire study period of five seasons, and \vocab{late}~$\sigma_5$, a transition from one steady state to another over the fourth season.
The latter again models novel divergence.
%
%
\item \inhead{Cycle:} 2 types.
This simulates phenomena that have an annual ebb and flow correlating with the flu season.
An example is the U.S.\ basketball season noted above.
The two bases are: \vocab{annual}~$\sigma_6$, cycles continuing for all five seasons, and \vocab{ending}~$\sigma_7$, cycles that end after the training seasons.
The latter again models novel divergence.
\end{itemize}
In order to build one feature, we need to sample the nine elements of the weight vector $w = ( w_\text{i}, w_\text{r}, w_{\text{s}1}, ...\, w_{\text{s}7} )$, which sums to 1.
This three-step procedure is as follows.
First, $w_\text{i}$, $w_\text{r}$, and $w_\text{s}$ are sampled from a Dirichlet distribution:
\begin{gather}
(w_\text{i}, w_\text{r}, w_\text{s}) \sim \text{Dir}(1.0, 0.5, 1.5) \\
\text{E}(w_\text{i}) = \frac{1}{3} \quad , \quad
\text{E}(w_\text{r}) = \frac{1}{6} \quad , \quad
\text{E}(w_\text{s}) = \frac{1}{2}
\end{gather}
Next, the relative weight of the three types of systematic noise is sampled:
\begin{align}
(w_\text{so}, w_\text{sd}, w_\text{sc})
&\sim w_\text{s} \text{Dir}(0.3,0.3,0.3)
\end{align}
Finally, all the weight for each type is randomly assigned with equal probability to a single basis function:
\begin{align}
(w_{\text{s}1}, w_{\text{s}2}, w_{\text{s}3})
&\sim w_\text{so} \text{Multinomial}(1, [\frac{1}{3}, \frac{1}{3}, \frac{1}{3}]) \\
(w_{\text{s}4}, w_{\text{s}5})
&\sim w_\text{sd} \text{Multinomial}(1, [\frac{1}{2}, \frac{1}{2}]) \\
(w_{\text{s}6}, w_{\text{s}7})
&\sim w_\text{sc} \text{Multinomial}(1, [\frac{1}{2}, \frac{1}{2}]) \\
\end{align}
\begin{figure}
\includegraphics[width=\textwidth]{synthetic_examples.pdf}
\caption{
\caphead{Example synthetic features}
This figure shows the least and most deceptive features and a third with medium deceptiveness.
}
\label{fig:synthetic-examples}
\end{figure}
\begin{figure}
\includegraphics[width=\textwidth]{decept_hist.pdf}
\caption{
\caphead{Deceptiveness histogram for all three feature types}
Synthetic features have continuous deceptiveness and are grouped into ten bins, while the two types of search features have seven discrete deceptiveness levels.
}
\label{fig:decept-all}
\end{figure}
This procedure yields a variety of high- and low-quality synthetic features.
We sampled 500 of them.
\Figure{fig:synthetic-examples} shows three examples, and \Figure{fig:decept-all} shows the deceptiveness histogram.
The features we used are available in S3~Dataset\ (\code{synthetic.xlsx}).
\subsubsection{Flu-related concepts: Wikipedia}
\label{sec:flu-concepts}
In order to build the flu nowcasting model based on web search queries described in the next section, we first needed a set of influenza-related concepts.
We used the Wikipedia inter-article link graph to generate a set of candidate concepts and the Wikipedia article category hierarchy to estimate the semantic relatedness of each concept to influenza, which we use as a proxy for deceptiveness.
An important advantage of this approach is that it is automated and easily generalizable to other diseases.
Wikipedia is a popular web-based encyclopedia whose article content and metadata are crowdsourced~\cite{ayers2008}.
We used two types of metadata from a dataset~\cite{priedhorsky2017cscwdata} collected March 24, 2016 for our previous work~\cite{priedhorsky2017cscw} using the Wikipedia API.
First, Wikipedia articles contain many hyperlinks to other articles within the encyclopedia.
This work used the article ``Influenza'' and the 572 others it links to, including clearly related articles such as ``Infectious disease'' and apparently unrelated ones such as ``George W.\ Bush'', who was the U.S.\ president immediately prior to 2009 H1N1.
Second, Wikipedia articles are leaves in a category hierarchy.
Both articles and categories have one or more parent categories.
For example, one path from ``Influenza'' to the top of the tree is: \emph{Healthcare-associated infections}, \emph{Infectious diseases}, \emph{Diseases and disorders}, \emph{Health}, \emph{Main topic classifications}, \emph{Articles}, and finally \emph{Contents}.
This tree can be used to estimate semantic relatedness between two articles.
The number of levels one must climb the tree before finding a common category is a metric called \vocab{category distance}~\cite{priedhorsky2017cscw}; the distance between an article and itself is 1.
For example, the immediate categories of ``Infection'' include \emph{Infectious diseases}.
Thus, the distance between these two articles is~2, because we had to ascend two levels from ``Influenza'' before discovering the common category \emph{Infectious diseases}.
We used category distance between each of the 573 articles and ``Influenza'' to estimate the semantic relatedness to influenza.
The minimum category distance was 1 and the maximum 7.
The basic intuition for this approach is that Wikipedia category distance is a reasonable proxy for how related a concept is to influenza, and this relatedness is in turn a reasonable proxy for deceptiveness.
For example, consider a distance-1 feature and a distance-7 feature that are both highly correlated with ILI.
Standard linear regression will give equal weight to both features.
However, we conjecture that the distance-7 feature's correlation is more likely to be spurious than the distance-1's; i.e., we posit that the distance-7 feature is more deceptive.
Thus, we give the distance-1 feature more weight in the regression, as described below.
Because category distance is a discrete variable $d \in [1,7] \cap \mathbb{Z}$, while deceptiveness $g \in [0,1]$ is continuous, we convert category distance into a deceptiveness estimate $\hat g$ as follows:
\begin{equation}
\hat g = (1-2\epsilon) \frac{d-1}{6} + \epsilon
\end{equation}
The purpose of $\epsilon \ne 0$ is to ensure that features with minimum category distance of~1 receive regularization from the linear regression, as described below.
In our initial data exploration, the value of $\epsilon$ had little effect, so we used $\epsilon = 0.05$; therefore, $\hat g \in \{ 0.05, 0.20, 0.35, 0.50, 0.65, 0.80, 0.95 \}$.
We emphasize that category distance is already a noisy proxy for deceptiveness.
Even with zero noise added to deceptiveness, $\hat g \ne g$.
It is important to realize that because Wikipedia is continually edited, metadata such as links and categories change over time.
Generally, mature topic areas such as influenza and infectious disease are more stable than, for example, current events.
The present study assumes that the dataset we used is sufficiently correct despite its age; i.e., freshly collected links and categories might be somewhat different but not necessarily more correct.
The articles used and their category distances are in S2~Dataset\ (\code{en+Influenza.xlsx}).
\subsubsection{Real features: Google searches}
\label{sec:features-search}
Typically, each feature for internet-based disease surveillance estimates public interest in a specific concept.
This study uses Google search volume as a measure of public interest.
By mapping our Wikipedia-derived concepts to Google search queries, we obtained a set of queries with estimated deceptiveness.
Then, search volume over time for each of these queries, as well as their deceptiveness, are input for our algorithms.
We tested two types of Google searches.
\vocab{Search query strings} are the raw strings typed into the Google search box.
We designed an automated procedure to generate query strings from Wikipedia article titles.
\vocab{Search topics} are concepts assigned to searches by Google using proprietary and unspecific algorithms.
We built a map from Wikipedia article titles to topics manually.
Our procedure to map articles to query strings is:
\begin{enumerate}
\item Decode the percent notation in the title portion of the article's URL~\cite{wikipedia2018percent}.
\item Change underscores to spaces.
\item Remove parentheticals.
\item Approximate non-ASCII characters with ASCII using the Python package \code{unidecode}~\cite{solc2018}.
\item Change upper case letters to lower case. (This serves a simplifying rather than necessary purpose, as the Google Trends API is case-insensitive.)
\item Remove all characters other than alphanumeric, slash, single quote, space, and hyphen.
\item
Remove \vocab{stop phrases} we felt were unlikely to be typed into a search box.
Matches for the following regular expressions were removed (note leading and trailing spaces):
\begin{itemize}
\item ``\code{ and\b}''
\item ``\code{^global }''
\item ``\code{^influenza .? virus subtype }''
\item ``\code{^list of }''
\item ``\code{^the }''
\end{itemize}
\end{enumerate}
This produces a query string for all 573 articles.
The map is 1-to-1: each article maps to exactly one query string, and each query string maps to exactly one article.
The process is entirely automated once the list of stop phrases is developed.
Google search topics is a somewhat more amorphous concept.
Searches are assigned to topics by Google's proprietary machine learning algorithms, which are not publically available~\cite{google2018trendshelp}.
A given topic is identified by its name or a hexadecimal code.
For example, the query string ``apple'' might be assigned to ``Apple (fruit)'' or ``Apple (technology company)'' based on the content of the full search session or other factors.
\begin{table}
\makebox[\textwidth][c]{
\begin{tabular}{lllc}
\toprule
\textbf{Article}
& \textbf{Query string}
& \textbf{Topic name}
& \textbf{Topic code} \\
\midrule
Sense (molecular biology) & sense & Sense (Molecular biology) & \code{/m/0dpw95} \\
Influenza A virus subtype H9N2 & h9n2 & Influenza A virus subtype H9N2 (Virus) & \code{/m/0b3dc1} \\
George W.\ Bush & george w bush & George W. Bush (43rd U.S. President) & \code{/m/09b6zr} \\
\bottomrule
\end{tabular}
}
\caption{
\caphead{Sample Wikipedia articles and the queries to which they map}
}
\label{tab:sample-queries}
\end{table}
To manually build a mapping between Wikipedia articles and Google search topics,
we entered the article title and some variations into the search box on the Google Trends website~\cite{google2017trends} and then selected the most reasonable topic named in the site's auto-complete box.
The topic code was in the URL.
If the appropriate topic was unclear, we discussed it among the team.
Not all articles had a matching topic; we identified 363 topics for the 573 articles (63\%).
Among these 363 articles, the map is 1-to-1.
\Table{tab:sample-queries} shows a few examples of both mappings, and \Figure{fig:decept-all} shows the deceptiveness histograms.
\begin{figure}
\includegraphics[width=\textwidth]{ght_examples.pdf}
\caption{
\caphead{Search volume for two queries presented to our model}
The topic ``Influenza A virus (Virus)'' shows a seasonal pattern roughly corresponding to ILI, while the raw query ``respiratory system'' shows a seasonal pattern that does not correspond to ILI.
}
\label{fig:ght-examples}
\end{figure}
We downloaded search volume for both query strings and topics from the Google Health Trends API~\cite{stocking2017} on July 31, 2017.
This gave us a weekly time series for the United States for each search query string and topic described above.
These data appear to be a random sample, changing slightly from download to download.
Each element of the time series is the probability that the reported search session contains the string or topic, multiplied by 10 million.
Searches without enough volume to exceed an unspecified privacy threshold are set to zero, i.e., we cannot distinguish between few searches and no searches.
For this reason, we removed from analysis searches with more than 2/3 of the 261 weeks having a value of zero.
This resulted in 457 usable of 573 query strings (80\%) and 349 of 363 topics (96\%).
\Figure{fig:ght-examples} shows two of these time series.
Our map and category distances are in S2~Dataset\ (\code{en+Influenza.xlsx}).
Google's terms of service prohibit redistribution of the search volume data.
However, others can request the data using the same procedure we used~\cite{google2018ghtform}.
We used the script \code{ght_get} in the experiment source code for downloading.
This script depends on a patched source code file originally provided by Google that has an unclear license; therefore, we cannot redistribute this code.
Access to the Google source code is granted with the data, and we do provide the patch.
\subsection{Gridge regression}
Linear regression is a popular approach for mapping features (inputs) to observations (output).
This section describes the algorithm and the extensions we used in our experiment to incorporate deceptiveness information.
The model for linear regression is
\begin{equation}
y = X\beta + \varepsilon
\end{equation}
where $y$ is an $N \times 1$ observation vector, $X = [1, x_1, x_2, \ldots, x_p]$ is an $N \times (p+1)$ feature matrix where $x_i$ is the $N \times 1$ standardized feature vector (i.e., mean centered and standard deviation scaled) corresponding to feature $i$, $\beta$ is a $(p+1) \times 1$ coefficient vector, $\varepsilon \sim \text{MVN}(0,\sigma^2 I)$, where $\text{MVN}(\mu,\Sigma)$ is a multivariate normal distribution with mean $\mu$ and covariance matrix $\Sigma$, $\sigma^2 > 0$ is a scalar, and $I$ is an $N \times N$ identity.
Standardizing the features of $X$ is a convention that places all features on the same scale.
The goal of linear regression is to find the estimate of $\beta$ that minimizes the sum-of-squared residual errors. The \vocab{ordinary least squares} (OLS) estimator $\hat{\beta}^\text{OLS}$ solves the following:
\begin{equation}
\label{eq:leastsquares}
\hat{\beta}^{\text{OLS}}
= \argmin_{\beta}
\sum_{j=1}^N \Bigg(y_j - \beta_0 - \sum_{i=1}^p \beta_i x_{ji}\Bigg)^2
\end{equation}
or in matrix form:
\begin{equation}
\hat{\beta}^{\text{OLS}}
= (X'X)^{-1} Xy
\end{equation}
$\hat{\beta}^\text{OLS}$ is the unbiased, minimum variance estimator of $\beta$, assuming $\varepsilon$ is normally distributed~\cite[ch.~1–2]{scheffe1959variance}.
A prediction corresponding to a new feature vector $\ddot{x}$ is $\hat{y}^\text{OLS} = \ddot{x} \hat{\beta}^\text{OLS}$.
While $\hat{y}^\text{OLS}$ is unbiased, it is often possible to construct an estimator with smaller \vocab{expected prediction error} — i.e., with predictions on average closer to the true value — by introducing some amount of bias through \vocab{regularization}, which is the process of introducing additional information beyond the data.
Also, regularization can make regression work in situations with more features than observations, like ours.
One popular regularization method is called \vocab{ridge regression}~\cite{hoerl1970}, which extends OLS by encouraging the coefficients $\beta$ to be small.
This minimizes:
\begin{equation}
\label{eq:ridge_min}
\hat{\beta}^{\text{ridge}}_{\lambda}
= \argmin_{\beta} \left\{
\sum_{j=1}^N
\left( y_j - \beta_0 - \sum_{i=1}^p \beta_i x_{ji} \right)^{\!\!2}
+ \lambda \sum_{i=1}^p \beta_i^2
\right\}
\end{equation}
or equivalently:
\begin{equation}
\label{eq:ridge_closed_form}
\hat{\beta}^{\text{ridge}}_{\lambda}
= (X'X + \lambda I )^{-1} X'y.
\end{equation}
The additional parameter $\lambda \geq 0$ controls the strength of regularization. When $\lambda=0$, this is equivalent to OLS.
As $\lambda$ increases, the coefficient vector $\beta$ is constrained towards zero more vociferously.
Ridge regression applies the same degree of regularization to each feature, as $\lambda$ is common to all features.
A second extension, called \vocab{generalized ridge regression}~\cite{hemmerle1975gridge} or \vocab{gridge regression}, adds a feature-specific modifier $\kappa_i$ to the regularization:
\begin{equation}
\label{eq:fridge_min}
\hat{\beta}^{\text{gridge}}_{\lambda\kappa}
= \argmin_{\beta} \left\{
\sum_{j=1}^N
\left( y_j - \beta_0 - \sum_{i=1}^p \beta_i x_{ji} \right)^{\!\!2}
+ \lambda \sum_{i=1}^p \kappa_i \beta_i^2
\right\}
\end{equation}
$\kappa_i \geq 0$ adjusts the regularization penalty individually for each feature (ridge regression is a special case where $\kappa_i = 1\ \forall\ i$).
Gridge retains closed-form solvability:
\begin{equation}
\label{eq:gridge_closed_form}
\hat{\beta}^{\text{gridge}}_{\lambda\kappa}
= (X'X + \lambda K)^{-1} X'y
\end{equation}
where $K$ is a diagonal matrix with $\kappa_i$ on the diagonal and zero on the off-diagonals.
Gridge regression allows us to incorporate feature-specific deceptiveness information by making $\kappa_i$ a function of feature $i$'s deceptiveness.
The more deceptive feature $i$, the larger $\kappa_i$.
\subsection{Experiment factors}
Our experiment had 225 conditions.
This section describes its factors:
input feature class~(3 levels),
training period~(3),
deceptiveness noise added~(5),
and regression type~(5).
\subsubsection{Input feature class}
We tested three classes of input features:
\begin{enumerate}
\item \inhead{Synthetic.} Randomly generated transformations of ILI, as described above in~\S\ref{sec:features-synthetic}.
\item \inhead{Search query string.} Volume of Google searches entered directly by users, as described above in \S\ref{sec:features-search}.
\item \inhead{Search topic.} Volume of Google search topics inferred by Google's proprietary algorithms, as described above in \S\ref{sec:features-search}.
\end{enumerate}
Each feature comprises a time series of weekly data, with frequency and alignment matching our ILI data.
\subsubsection{Training period}
We tested three different training periods:
1st through 3rd seasons inclusive (three season),
2nd and 3rd (two seasons),
and 3rd only (one season).
Because the 4th season contains transitions in the synthetic features, we did not use it for training even when testing on the 5th season.
\subsubsection{Deceptiveness noise added}
The primary goal of our study is to evaluate how much knowledge of feature deceptiveness helps disease incidence models.
In the real world, this knowledge will be imperfect.
Thus, one of our experiment factors is to vary the quality of feature deceptiveness knowledge.
Our basic approach is to add varying amounts of noise to the best available estimate of each feature's deceptiveness $\hat g \in [0,1]$.
Recall that for synthetic features, $\hat g = g$ is known exactly, while for the search-based features, $\hat g$ is an estimate based on the Wikipedia category distance.
To compute the noise-added deceptiveness $\tilde g_i$ for feature $i$, for noise added $\gamma$, we simply select a random other feature $j$ and mix with its deceptiveness: $\tilde g_i = (1-\gamma) \hat g_i + \gamma \hat g_j$.
There are five levels of this factor:
\begin{itemize}
\item Zero noise: $\gamma = 0$, i.e., the model gets the best available estimate of $g_i$.
\item Low noise: $\gamma = 0.05$.
\item Medium noise: $\gamma = 0.15$.
\item High noise: $\gamma = 0.4$.
\item Total noise: $\gamma = 1$, i.e., the model gets no correct information at all about $g_i$.
\end{itemize}
Models do not know what condition they are in; they get only $\tilde g_i$, not $\gamma$.
\subsubsection{Regression type}
We tested five types of gridge regression:
\begin{enumerate}
\item Ridge regression: $\kappa_i = 1$, i.e., ignore deceptiveness information.
\item
Threshold gridge regression: keep features with category distance $d_i \leq 3$ and discard them otherwise, as in \cite{priedhorsky2017cscw}.
This is implemented as a threshold $\tilde g_i = 0.35$, which is applicable to both search and synthetic features (which have no $d_i$).
%
\begin{equation}
\kappa_i = \begin{cases}
0.1 & \text{if } \tilde g_i \leq 0.35 \\
1 & \text{otherwise}
\end{cases}
\end{equation}
\item Linear fridge: $\kappa_i = \tilde g_i$.
\item Quadratic fridge: $\kappa_i = \tilde g_i^2$.
\item Quartic fridge: $\kappa_i = \tilde g_i^4$.
\end{enumerate}
These levels are in rough ascending order of deceptiveness importance.
(We additionally tested, but do not report, a few straw-man models to help identify bugs in our code.)
All models used $\lambda = 150.9$, obtained by 10-fold cross-validation~\cite{james2013introduction}.
For each model, we tested 41 values of $\lambda$ evenly log-spaced between $10^{-1}$ and $10^7$; each fold fitted a model on the 9 folds left in and then evaluated its RMSE on the one fold left out.
The $\lambda$ with the lowest mean RMSE (plus a bias of up to 0.02 to encourage $\lambda$s in the middle of the range) across the 10 folds, was reported as the best $\lambda$ for that model.
We then used the mean of these best $\lambda$s for our experiment.
\subsection{Assessment of models}
To evaluate a model, we apply its coefficients learned during the training period to input features during the 52 weeks of the fourth and fifth seasons respectively, yielding estimated ILI $\hat y$.
We then compare $\hat y$ to reference ILI $y$ for each of the two test seasons.
For each model and metric, this yields two scalars.
We report three metrics:
\begin{enumerate}
\item \inhead{$\boldsymbol{r^2}$},
the square of the Pearson correlation $r$.
Most previous work reports this unitless metric.
\item \inhead{Root mean squared error} (RMSE),
defined as:
\begin{equation}
\sqrt{\frac{1}{N} \sum_{j=1}^N (y_j - \hat{y}_j)^2}
\end{equation}
has interpretable units of ILI.
\item \inhead{Hit rate}
is a measure of how well a prediction captures the direction of change.
It is defined as the fraction of weeks when the direction of the prediction (increase or decrease) matches the direction of the reference data~\cite{santillana2015}:
\begin{equation}
\frac{\sum_{j=2}^N \text{sign}(y_j - y_{j-1})
\overset{?}{=}
\text{sign}(\hat y_j - \hat y_{j-1} )}
{N-1}
\end{equation}
Because it captures the trend (is the flu going up or down?), it directly answers a simple, relevant, and practical public health question.
\end{enumerate}
\section{Results}
\begin{figure}
\includegraphics[width=\textwidth]{selected_models.pdf}
\caption{
\caphead{ILI predictions for zero-added-noise, 3-season-trained models}
This figure shows the 15 models in the ``ideal'' situation: no noise added to deceptiveness, and trained on all three training seasons.
The different types of gridge regression show subtle yet distinct differences, with the models taking into account deceptiveness more generally being closer to the ILI reference data.
}
\label{fig:selected-models}
\end{figure}
Output of our regression models is illustrated in \Figure{fig:selected-models}, which shows 15 selected conditions.
These conditions are close to what would be done in practice: use all available training information and add no noise.
The differences between gridge regression types are subtle, but they are real, and close examination shows that the stronger gridge models that place higher importance on deceptiveness information are closer to the ILI reference data.
The remainder of this section analyzes these differences across all the conditions.
\begin{figure}
\includegraphics[width=\textwidth]{results_rmse_4.pdf}
\caption{
\caphead{Gridge regression error compared to plain ridge, 5th season}
Gridge algorithms that take into account deceptiveness \textit{usually} have lower RMSE than plain ridge, which does not.
Further, adding deceptiveness noise usually gives the appropriate trend: worse deceptiveness knowledge means worse predictions.
$r^2$ and RMSE on the 4th season show similar trends, while hit rate shows limited benefit from gridge; these figures are available in S4~Figure.
}
\label{fig:results-rmse}
\end{figure}
\Figure{fig:results-rmse} illustrates the effect on error (RMSE) of adding noise to deceptiveness information; $r^2$ is similar.
Generally, the gridge algorithms have lower error than plain ridge in lower-added-noise conditions and higher error in higher-added-noise situations.
That is, conditions with better knowledge of deceptiveness outperform the baseline, and performance declines as deceptiveness knowledge worsens, which is the expected trend.
This supports our hypotheses that (a)~incorporating knowledge of feature deceptiveness can improve estimates of disease incidence based on internet data and (b)~semantic distance, as expressed in the Wikipedia article category tree, is an effective proxy for deceptiveness.
(Hit rate shows limited benefit for gridge, as we discuss below.)
\begin{figure}
\vspace{-24pt}
\includegraphics[width=\textwidth]{summary_boxplot.pdf}
\caption{
\caphead{Improvement over ridge in zero- and low-noise conditions}
This figure illustrates performance of the gridge algorithms divided by plain ridge in the same condition.
The third group compares \emph{query string} gridge models against \emph{topic} ridge.
Boxes plot the median with first and third quartiles, and the whiskers show the maximum and minimum.
Each box-and-whiskers summarizes 12 data points.
For the two error metrics, increasing the importance of deceptiveness through quadratic gridge yields increasing improvement over plain ridge, but the trend ends at quartic gridge.
Notably, this is true even when comparing query string models (which are completely automatic) against topic ridge (which requires lots of manual attention), suggesting that deceptiveness information can be used to replace expensive human judgement.
Hit rate, however, seems to gain limited benefit from deceptiveness in this experiment.
}
\label{fig:results-summary}
\end{figure}
\Figure{fig:results-summary} summarizes the improvement of the four gridge algorithms over plain ridge for all three metrics in the zero- and low-noise conditions.
These results suggest that adding low-noise knowledge of deceptiveness to ridge regression improves error but not hit rate.
It also appears that the benefits of gridge level off between quadratic (deceptiveness squared) and quartic (deceptiveness raised to the fourth power): while quartic sometimes beats quadratic ridge, it frequently is worse than plain ridge.
We speculate that the lack of observed benefit of gridge on hit rate is due to one or both of two reasons.
First, plain ridge may be sufficiently good on this metric that it has already reached diminishing returns; recall that in \Figure{fig:selected-models} all five algorithms captured the overal trend of ILI well.
Second, ILI is noisy, with lots of ups and downs from week to week regardless of the medium-term trend.
This randomness may limit the ability of hit rate to assess performance on a weekly time scale without overfitting.
That is, we believe that gridge's failure to improve over plain ridge on hit rate is unlikely to represent a concerning flaw in the algorithm.
\section{Discussion}
Our previous work introduced \vocab{deceptiveness}, which quantifies the risk that a disease estimation model's error will increase in the future because it uses features that are coincidentally, rather than informatively, correlated with the quantity of interest~\cite{priedhorsky2018flow}.
This work tests the hypothesis that incorporating deceptiveness knowledge into a disease nowcasting algorithm reduces error; to our knowledge, it is the first work to quantitatively assess this question.
To do so, we used simulated features with known deceptiveness as well as two types of real web search features with deceptiveness estimated using semi- and fully-automated algorithms.
\subsection{Findings}
Our experiment yielded three main findings:
\begin{enumerate}
\item
Deceptiveness information does help our linear regression nowcasting algorithms, and it helps more when it is more accurate.
\item
A readily available, crowdsourced semantic relatedness measure, Wikipedia category distance, is a useful proxy for deceptiveness.
\item
Deceptiveness information helps automatically generated features perform the same or better than similar, semi-automated features that require human curation.
\end{enumerate}
The effects we measured are stronger for the synthetic features than the real ones.
We speculate that this is for two reasons.
First, the web search feature types are skewed towards low deceptiveness, because they are based on Wikipedia articles directly linked from ``Influenza'', while the synthetic features lack this skew.
Second, the synthetic features can have zero-noise deceptiveness information, while the real features cannot, because they use Wikipedia category distance as a less-accurate proxy.
If verified, the second would further support the hypothesis that more accurate deceptiveness information improves nowcasts.
The third finding is interesting because it is relevant to a long-standing tension regarding how much human intervention is required for accurate measurements of the real world using internet data: more automated algorithms are much cheaper, but they risk oversimplifying the complexity of human experience.
For example, our query strings were automatically generated from Wikipedia article titles, which are written for technical accuracy rather than salience for search queries entered by laypeople.
To select features for disease estimation, one could use a fully-automated approach (e.g., our query strings), a semi-automated approach (e.g., our topics, which required a manual mapping step), or a fully-manual approach (e.g., by expert elicitation of search queries or topics, which we did not test).
One might expect that a trade-off would be present here: more automatic is cheaper, but more manual is more accurate.
However, this was not the case in our results.
The third box plot group in \Figure{fig:results-summary} compares the gridge models using query string features to a baseline of plain ridge on \emph{topic} features.
Query strings perform favorably regardless of whether the baseline is plain ridge on query strings or topics, and sometimes the improvement is greater than gridge using topic features.
This suggests that there is not really a trade-off, and fully automatic features might be among the most accurate.
\subsection{Limitations}
All experiments are imperfect.
Due to its finite scope, this work has many limitations.
We believe that the most important ones are:
\begin{itemize}
\item
Wikipedia is changing continuously.
While we believe that these changes would not have a material effect on our results, we have not tested this.
\item
Wikipedia has non-semantic categories, such as the roughly 20,000 articles in category \emph{Good article} that our algorithm that would assign distance~1 from each other.
We have not yet encountered any other relevant non-semantic categories, and ``Influenza'' is not a \emph{Good article}, so we believe this limitation does not affect the present results.
However, any future work extending our algorithms should exclude these categories from the category distance computation.
\item
The mapping from Wikipedia articles to Google query strings and topics has not been optimized.
While we have presented mapping algorithms that are reasonable both by inspection and supported by our current and prior~\cite{priedhorsky2017cscw} results, we have not compared these algorithms to alternatives.
\item
Linear regression algorithm metaparameters were not fully evaluated.
For example, $\epsilon$ in §\ref{sec:flu-concepts} was thoughtfully but arbitrarily assigned rather than experimentally optimized.
\item
Other methods of feature generation may be better.
This experiment was not designed to evaluate the full range of feature generation algorithms.
In particular, direct elicitation of features such as query strings and topics should be evaluated.
\end{itemize}
\subsection{Future work}
This is an initial feasibility study using a fairly basic nowcasting model.
At this point, the notion of deceptiveness for internet-based disease estimation is promising, but continued and broader positive results are needed to be confident in this hypothesis.
In addition to addressing the limitations above, we have two groups of recommendations for future work.
First, multiple opportunities to improve nowcasting performance should be investigated.
Additional deceptiveness-aware fitting algorithms such as generalized lasso~\cite{tibshirani2011glasso} and generalized elastic net~\cite{sokolov2016glasticnet} should be tested.
Category distance also has opportunities for improvement.
For example, it can be made finer-grained by measuring path length through the Wikipedia category tree rather than counting the number of levels ascended: the distance between ``Influenza'' and ``Infection'' would become~3, taking into account that \emph{Infectious diseases} was a direct category of the latter.
Finally, alternate deceptiveness estimates need testing, for example category distance based on the medical literature.
In addition to better nowcasting, utility needs to be demonstrated when deceptiveness-aware nowcasts augment best-in-class forecasting models, such as those doing well in the CDC's flu forecasting challenge~\cite{cdcchallenge2017}.
Second, we are optimistic that our algorithms will generalize well to different diseases and locations.
This is because our best feature-generation algorithm is fully automated, making it straightforward to generalize by simply offering new input.
For example, to generate features for dengue fever in Colombia, one could: start with the article ``Dengue fever'' in Spanish Wikipedia; write a set of Spanish stop phrases; use the Wikipedia API to collect links from that article and walk the category tree; pull appropriate search volume data from Google or elsewhere; and then proceed as described above.
Future studies should evaluate generalizability to a variety of disease and location contexts.
\subsection{Conclusion}
We present a study testing the value of deceptiveness information for nowcasting disease incidence using simulated and real internet features and generalized ridge regression. We found that incorporating such information does in fact help nowcasting; to our knowledge, ours is the first quantitative evaluation of this question.
Based on these results, we hypothesize that other internet-based disease estimation methods may also benefit from including feature deceptiveness estimates. We look forward to further research yielding deeper insight into the deceptiveness question.
\section*{Author contributions}
Experiment concept: RP~ARD~DO.
Methods: RP~ARD~DO (experiment), MB~FO (mapping Wikipedia articles to Google searches), DO (statistical approach).
Data curation, investigation, and software: RP~ARD.
Visualization: RP.
Literature review: RP~ARD.
Writing: RP~ARD~DO.
Review and editing: RP~ARD~MB~FO~DO.
Funding acquisition and project administration: RP.
\section*{Acknowledgments}
We thank the Wikipedia editing community for building the link and category networks used to compute semantic distance and Google, Inc.\ for providing us with search volume data.
We also appreciate the helpful feedback provided by anonymous reviewers.
\bibliographystyle{plainurl}
| {'timestamp': '2019-01-14T02:21:51', 'yymm': '1901', 'arxiv_id': '1901.03677', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03677'} | arxiv |
\section{Introduction}
Graph modification problems are a popular topic in computer science. In these problems,
one is given a graph and wants to apply a minimum number of modifications, for example
edge deletions, to obtain a graph that fulfills some graph property~$\Pi$.
An important reason for the popularity of graph modification problems
is their usefulness in graph-based data analysis. A classic problem in this context is
\textsc{Cluster Editing} where we may insert and delete edges and~$\Pi$ is the set of
cluster graphs. These are exactly the graphs that are disjoint unions of cliques and it is
well-known that a graph is a cluster graph if and only if it does not contain a~$P_3$, a path on three
vertices, as induced subgraph. \textsc{Cluster Editing} has many applications~\cite{BB13}, for example
in clustering gene interaction networks~\cite{BSY99} or protein
sequences~\cite{WBLR07}. The variant where we may only delete edges is known as
\textsc{Cluster Deletion}~\cite{SST04}. Further graph-based data analysis problems that
lead to graph modification problems for some graph property~$\Pi$ defined by small
forbidden induced subgraphs arise in the analysis of biological~\cite{BHK15,HWL+15} or
social networks~\cite{BHSW15,NG13}.
Besides the application, there is a more theoretical reason why graph modification problems are very important in computer science: Often these problems are
NP-hard~\cite{LY80,Yan81} and thus they represent interesting case studies for algorithmic
approaches to NP-hard problems. For example, by systematically categorizing graph
properties based on their forbidden subgraphs one may outline the border between tractable
and hard graph modification problems~\cite{ASS17,Kom18,Yan81}.
In recent years, multilayer graphs have become an increasingly important tool for
integrating and analyzing network data from different sources~\cite{KAB+14}. Formally,
multilayer graphs can be viewed as edge-colored (multi-)graphs, where each edge color represents one
layer of the input graph. With the advent of multilayer graphs in network analysis it can be
expected that graph modification problems for edge-colored graphs will arise in many applications as it was the case in uncolored graphs.
One example for such a problem is \textsc{Module
Map}~\cite{SK18}. Here, the input is a simple graph with red
and blue edges and the aim is to obtain by a minimum number of edge deletions and
insertions a graph that contains no~$P_3$ with two blue edges, no~$P_3$ with a red and a
blue edge, and no a triangle, called~$K_3$, with two blue edges and one red edge. \textsc{Module Map} arises in computational biology~\cite{AS14,SK18}; the red layer represents genetic interactions
and the blue layer represents physical protein interactions~\cite{AS14}.
Motivated by the practical application of \textsc{Module Map}, an edge deletion problem
with bicolored forbidden induced subgraphs, we aim to study such problems from a more
systematic and algorithmic point of view. Given the importance of~$P_3$-free graphs in the
uncolored case, we focus on the problem where we want to destroy all
\emph{bicolored~$P_3$s}, that is, all~$P_3$s with one blue and one red edge, by edge
deletions.
\begin{quote}
\textsc{Bicolored~$P_3${} Deletion (BPD)}\\
\textbf{Input}: A two-colored graph~$G=(V, E_r,E_b)$
and an integer~$k \in \mathds{N}$.\\
\textbf{Question}: Can we delete at most~$k$ edges from~$G$ such that the remaining graph contains no bi\-colored~$P_3${} as induced subgraph?
\end{quote}
We use~$E:=E_r\uplus E_b$ to denote the set of all edges of~$G$,~$n:=|V|$ to denote the number of vertices in~$G$, and~$m:=|E|$ to denote the number of edges in~$G$.
Bicolored $P_3$s are closely connected to Gallai colorings of complete graphs~\cite{Gal67,GS04}. A Gallai coloring is an edge-coloring such that in every triangle, the three edges of the triangle receive at most two different colors. When we view nonedges of~$G$ as edges with a third color, say green, then a bicolored~$P_3$ is the same as a triangle that violates the property of Gallai colorings. Thus, \textsc{BPD}{} is essentially equivalent to the following problem: Given a complete graph with an edge-coloring with the colors red, blue, and green that is not a Gallai coloring, can we transform the coloring into a Gallai coloring by recoloring at most~$k$ blue or red edges with the color green?
\paragraph{Our Results.} We show that \textsc{BPD}{} is NP-hard and that, assuming the Expo\-nential-Time Hypo\-thesis (ETH)~\cite{IPZ01}, it cannot be solved
in a running time that is subexponential in the instance size. We then study two different
aspects of the computational complexity of the problem.
First, we consider special cases that can be solved in polynomial time, motivated by
similar studies for problems on uncolored graphs~\cite{BLS99}. We are in particular
interested in whether or not we can exploit structural properties of input graphs that can
be expressed in terms of \emph{colored} forbidden subgraphs. We show that \textsc{BPD}{} can be solved
in polynomial time on graphs that do not contain a certain type of bicolored~$K_3$s as induced subgraphs, where bicolored~$K_3$s are triangles with edges of both colors. Moreover, we show that \textsc{BPD}{} can be solved in polynomial time on graphs that contain no~$K_3$s with one edge color and no~$P_3$s
with one edge color as induced subgraphs.
Second, we consider the parameterized complexity of \textsc{BPD}{} with respect to the natural
parameter~$k$. We show that \textsc{BPD}{} can be solved in~$\ensuremath{\mathcal{O}}(1.84^k\cdot nm )$~time and
that it admits a problem kernel with~$\ensuremath{\mathcal{O}}(k\Delta\min(k,\Delta))$ vertices, where~$\Delta$ is the
maximum degree in~$G$. As a side result, we show that \textsc{BPD}{} admits a trivial problem
kernel with respect to~$\ell:= m-k$.
\section{Preliminaries}
We consider undirected simple graphs~$G$ with vertex set~$V$ and edge set~$E$, where~$E$ is partitioned into a set~$E_b$ of \emph{blue edges} and a set~$E_r$ of \emph{red edges}, denoted by~$G=(V,E_r,E_b)$. For a vertex~$v$,~$N_G(v):=\{u\mid \{u,v\}\in E\}$ denotes the \emph{open
neighborhood} of~$v$ and~$N_G[v]:=N_G(v) \cup \{v\}$ denotes the \emph{closed neighborhood} of~$v$. For a vertex set~$W$,~$N_G(W):=\bigcup_{w\in W}N(w)\setminus W$ denotes the \emph{open neighborhood} of~$W$ and~$N_G[W]:=N_G(W)\cup W$ denotes the \emph{closed neighborhood} of~$W$. The \emph{degree}~$\deg(v):=|N_G(v)|$ of a vertex~$v$ is the size of its open neighborhood. Moreover, we define~$\deg_b(v):=|\{ u \mid \{u,v\} \in E_b\}|$ as the \emph{blue degree} of~$v$ and~$deg_r(v):=|\{ u \mid \{u,v\} \in E_r\}|$ as the \emph{red degree} of~$v$. We let~$N_G^2(v):=N_G(N_G(v))\setminus \{v\}$ denote the \emph{second neighborhood} of~$v$. For any two vertex sets~$V_1, V_2 \subseteq V$, we denote by~$E_G(V_1,V_2):= \{ \{v_1,v_2\} \in E \mid v_1 \in V_1, v_2 \in V_2 \}$ the set of edges between~$V_1$ and~$V_2$ in~$G$ and write~$E_G(V'):=E_G(V',V')$. In each context we may omit the subscript~$G$ if the graph is clear from the context.
For any~$V'\subseteq V$,~$G[V']:=(V',E(V')\cap E_r, E(V') \cap E_b)$ denotes the \emph{subgraph induced by~$V'$}. We say that some graph~$H=(V^H,E^H_r,E_b^H)$ is an \emph{induced subgraph} of $G$ if there is a set~$V' \subseteq V$, such that~$G[V']$ is isomorphic to~$H$, otherwise~$G$ is called \emph{$H$-free}. Two vertices~$u$ and~$v$ are \emph{connected} if there is a path from~$u$ to~$v$ in~$G$. A \emph{connected component} is a maximal vertex set~$S$ such that each two vertices are connected in~$G[S]$. A \emph{clique} in a graph~$G$ is a set~$K \subseteq V$ of vertices such that in~$G[K]$ each pair of vertices is adjacent. The graph~$(\{u,v,w\},\{\{u,v\}\},\{\{v,w\}\})$ is called \emph{bi\-colored~$P_3$}. We say that a vertex~$v\in V$ is \emph{part of} a bi\-colored~$P_3$~in~$G$ if there is a set~$V' \subseteq V$ with~$v \in V'$ such that~$G[V']$ is a bi\-colored~$P_3$. Furthermore, we say that two edges~$\{u,v\}$ and~$\{v,w\}$ \emph{form} a bi\-colored~$P_3$~if~$G[\{u,v,w\}]$ is a bi\-colored~$P_3$. For any edge set~$E'$ we denote by~$G-E':=(V, E_r \setminus E', E_b \setminus E')$ the graph we obtain by deleting all edges in~$E'$. As a shorthand, we write~$G-e:=G-\{e\}$ for an edge~$e$. An edge deletion set~$S$ is a \emph{solution} for an instance~$(G,k)$ of \textsc{BPD}~if~$G-S$ is bi\-colored~$P_3$-free and~$|S|\le k$.
A \emph{branching rule} for some problem~$L$ is a computable function that maps an instance~$w$ of~$L$ to a tuple of instances~$(w_1, \dots, w_t)$ of~$L$. The branching rule is called \emph{correct} if~$w$ is a yes-instance for~$L$ if and only if there is some~$i \in \{1,\dots,t\}$ such that~$w_i$ is a yes-instance of~$L$. The application of branching rules gives rise to a search tree whose size is analyzed using branching vectors; for more details refer to the monograph of Fomin and Kratsch~\cite{FK10}. A \emph{reduction rule} for some problem~$L$ is a computable function that maps an instance~$w$ of~$L$ to an instance~$w'$ of~$L$ such that~$w$ is a yes-instance if and only if~$w'$ is a yes-instance.
\emph{Parameterized Complexity} is the analysis of the complexity of problems depending on the input size~$n$ and a problem parameter~$k$~\cite{Cyg+15,DF13}. A problem is called \emph{fixed-parameter tractable}, if there exists an algorithm with running time~$f(k) \cdot n^{\ensuremath{\mathcal{O}}(1)}$ for some computable function~$f$ that solves the problem. An important tool in the development of parameterized algorithms is \emph{problem kernelization}. Problem kernelization is a polynomial-time preprocessing by \emph{reduction rules}: A Problem~$L$ admits a problem kernel if, given any instance~$I$ of~$L$ with parameter~$k$, one can compute an equivalent instance~$I'$ of~$L$ with parameter~$k'$ in polynomial time such that~$k' \leq k$ and the size of~$I'$ is bounded by some computable function~$g$ only depending on~$k$. The function~$g$ is called~\emph{kernel size}.
\section{Bicolored $\mathbf{P_3}$ Deletion is NP-hard}
In this section we prove the NP-hardness of \textsc{BPD}. This motivates our study of polynomial-time solvable cases and the parameterized complexity in Sections~\ref{Section: polytime} and~\ref{Section: param}, respectively.
\begin{theorem} \label{Theorem: NP-h}
\textsc{BPD}{} is NP-hard even if the maximum degree of~$G$ is eight.
\end{theorem}
\begin{proof}
To show the NP-hardness we give a polynomial-time reduction from the NP-hard \textsc{(3,4)-Sat} problem which is given a 3-CNF formula~$\phi$ where each variable occurs in at most four clauses, and asks if there is a satisfying assignment for~$\phi$~\cite{Tovey84}.
Let~$\phi$ be a 3-CNF formula with variables~$X=\{x_1, \dots, x_{|X|}\}$ and clauses~$\mathcal{C}=\{C_1, \dots, C_{|\mathcal{C}|}\}$ with four occurrences per variable. For a given variable $x_i$ that occurs in a clause $C_j$ we define the \emph{occurrence number} $\Psi (C_j,x_i)$ as the number of clauses in $\{C_1, C_2, \dots, C_j \}$ where~$x_i$ occurs. Intuitively, $\Psi(C_j,x_i)=r$ means that the $r$th occurrence of variable~$x_i$ is the occurrence in clause~$C_j$. Since each variable occurs in at most four clauses, we have~$\Psi(C_j,x_i) \in \{1,2,3,4\}$.
\proofparagraph{Construction:} We describe how to construct an equivalent instance~$(G=(V,E_r,E_b),k)$ of \textsc{BPD}~from~$\phi$.
For each variable~$x_i \in X$ we define a \emph{variable gadget} as follows. The variable gadget of~$x_i$ consists of a \emph{central vertex}~$v_i$ and two vertex sets~$T_i:=\{t_i^1,t_i^2,t_i^3,t_i^4\}$ and~$F_i:=\{f_i^1,f_i^2,f_i^3,f_i^4\}$. We add a blue edge from~$v_i$ to every vertex in~$T_i$ and a red edge from~$v_i$ to every vertex in~$F_i$.
For each clause~$C_j \in \mathcal{C}$ we define a \emph{clause gadget} as follows. The clause gadget of~$C_j$ consists of three vertex sets~$A_j:=\{a_j^1,a_j^2,a_j^3\}$, $B_j:=\{b_j^1,b_j^2,b_j^3\}$, and~$W_j:=\{w_j^1, w_j^2, w_j^3 ,w_j^4\}$. We add blue edges such that the vertices in~$B_j\cup W_j$ form a clique with only blue edges in~$G$. Moreover, for each~$p \in \{1,2,3\}$, we add a blue edge~$\{a_j^p,b_j^p\}$ and a red edge~$\{a_j^p,u\}$ for every~$u \in W_j \cup B_j \setminus \{b_j^p\}$. Observe that there are no edges between $a_j^1$, $a_j^2$, and $a_j^3$; all other vertex pairs are connected either by a red edge or a blue edge.
We connect the variable gadgets with the clause gadgets by identifying vertices in~$T_i \cup F_i$ with vertices in~$A_j$ as follows. Let~$C_j$ be a clause containing variables~$x_{i_1}, x_{i_2}$, and~$x_{i_3}$. For each~$p \in \{1,2,3\}$ we set~
$$a_j^p = \begin{cases}
t_{i_p}^{\Psi(C_j,x_{i_p})}&\text{if }x_{i_p}\text{ occurs as a positive literal in }C_j\text{, and}\\
f_{i_p}^{\Psi(C_j,x_{i_p})}&\text{if }x_{i_p}\text{ occurs as a negative literal in }C_j\text{.}
\end{cases}$$
Now, for every variable~$x_i \in X$ each vertex in~$T_i \cup F_i$ is identified with at most one vertex~$a_j^p$. Figure~\ref{Figure: NP-h construction} shows an example of a clause gadget and its connection with the variable gadgets. To complete the construction of the BPD instance~$(G,k)$ we set~$k:=4\cdot |X|+14 \cdot |\mathcal{C}|$
\begin{figure}
\begin{center}
\begin{tikzpicture}[scale=0.9]
\tikzstyle{knoten}=[circle,fill=white,draw=black,minimum size=5pt,inner sep=0pt]
\tikzstyle{bez}=[inner sep=0pt]
\node[knoten] (a1j)[label=210:{$a^1_1=t_1^1$}] at (-2,-0.4) {};
\node[knoten] (a2j)[label=left:{$a^2_1=f_2^1$}] at (-0.5,2.4) {};
\node[knoten] (a3j)[label=330:{$a^3_1=t_3^1$}] at (2,-0.4) {};
\node[knoten] (b1j)[label=270:{$b^1_1$}] at (-1.2,-1.15) {};
\node[knoten] (b2j)[label=right:{$b^2_1$}] at (0.5,2.4) {};
\node[knoten] (b3j)[label=270:{$b^3_1$}] at (1.2,-1.15) {};
\node[knoten] (w1) at (0,0.7) {};
\node[knoten] (w2) at (0,-0.5) {};
\node[knoten] (w3) at (-0.5,0.2) {};
\node[knoten] (w4) at (0.5,0.2) {};
\draw[-,color=blue,very thick] (a1j) to (b1j);
\draw[-,color=blue,very thick] (a2j) to (b2j);
\draw[-,color=blue,very thick] (a3j) to (b3j);
\draw[-,color=blue,very thick,bend left=10] (b1j) to (b2j);
\draw[-,color=blue,very thick,bend right=10] (b1j) to (b3j);
\draw[-,color=blue,very thick] (b2j) to (b3j);
\foreach \x in {1,2,...,4}{
\draw[-, color=myred] (a1j) to (w\x);
\draw[-, color=blue, very thick] (b1j) to (w\x);
\draw[-, color=myred] (a2j) to (w\x);
\draw[-, color=blue, very thick] (b2j) to (w\x);
\draw[-, color=myred] (a3j) to (w\x);
\draw[-, color=blue, very thick] (b3j) to (w\x);
\foreach \y in {1,2,...,4}{
\draw[-, color=blue, very thick] (w\y) to (w\x);
}
}
\draw[-, color=myred] (a1j) to (b2j);
\draw[-, color=myred] (a1j) to (b3j);
\draw[-, color=myred] (a2j) to (b1j);
\draw[-, color=myred,bend left=10] (a2j) to (b3j);
\draw[-, color=myred] (a3j) to (b1j);
\draw[-, color=myred] (a3j) to (b2j);
\node[knoten] (v1)[label=above:{$v_1$}] at (-5.0,4.0) {};
\node[knoten] (v2)[label=above:{$v_2$}] at (00,4.0) {};
\node[knoten] (v3)[label=above:{$v_3$}] at (5.0,4.0) {};
\node[knoten] (t11) at (-4.0,4.7) {};
\node[knoten] (t12) at (-4.0,4.2) {};
\node[knoten] (t13) at (-4.0,3.7) {};
\node[knoten] (f11) at (-6.0,4.7) {};
\node[knoten] (f12) at (-6.0,4.2) {};
\node[knoten] (f13) at (-6.0,3.7) {};
\node[knoten] (f14) at (-6.0,3.2) {};
\node[knoten] (f21) at (-1.0,4.7) {};
\node[knoten] (f22) at (-1.0,4.2) {};
\node[knoten] (f23) at (-1.0,3.7) {};
\node[knoten] (t24) at (1.0,3.2) {};
\node[knoten] (t21) at (1.0,4.7) {};
\node[knoten] (t22) at (1.0,4.2) {};
\node[knoten] (t23) at (1.0,3.7) {};
\node[knoten] (t31) at (6.0,4.7) {};
\node[knoten] (t32) at (6.0,4.2) {};
\node[knoten] (t33) at (6.0,3.7) {};
\node[knoten] (f31) at (4.0,4.7) {};
\node[knoten] (f32) at (4.0,4.2) {};
\node[knoten] (f33) at (4.0,3.7) {};
\node[knoten] (f34) at (4.0,3.2) {};
\foreach \x in {1,2,3}{
\foreach \y in {1,2,3}{
\draw[-, color=myred] (v\x) to (f\x\y);
\draw[-, color=blue,very thick] (v\x) to (t\x\y);
}
}
\draw[-, color=myred] (v1) to (f14);
\draw[-, color=blue, very thick, bend right=20] (v1) to (a1j);
\draw[-, color=blue,very thick] (v2) to (t24);
\draw[-, color=myred] (v2) to (a2j);
\draw[-, color=myred] (v3) to (f34);
\draw[-, color=blue, very thick, bend left=20] (v3) to (a3j);
\node[knoten] (w1) at (0,0.7) {};
\node[knoten] (w2) at (0,-0.5) {};
\node[knoten] (w3) at (-0.5,0.2) {};
\node[knoten] (w4) at (0.5,0.2) {};
\end{tikzpicture}
\end{center}
\caption{The lower part of the figure shows the clause gadget of a clause~$C_1=(x_1 \lor \overline{x_2} \lor x_3)$. The upper part of the figure shows variable gadgets representing variables~$x_1$, $x_2$, and~$x_3$. The vertices~$a^1_1, a^2_1$, and~$a^3_1$ from the clause gadget are identified with vertices from the variable gadgets. The bold lines represent blue edges and the thin lines represent red edges.} \label{Figure: NP-h construction}
\end{figure}
\proofparagraph{Intuition:}
Before showing the correctness of the reduction, we describe its idea. For each variable~$x_i$ we have to delete all blue edges in~$E(\{v_i\},T_i)$ or all red edges in~$E(\{v_i\},F_i)$ in the corresponding variable gadget. Deleting the edges in~$E(\{v_i\},T_i)$ assigns true to the variable~$x_i$ while deleting the edges in~$E(\{v_i\},F_i)$ assigns false to~$x_i$. Since we identify vertices in~$T_i \cup F_i$ with vertices in~$A_j$ the information of the truth assignment is transmitted to the clause gadgets. We will be able to make a clause-gadget bi\-colored~$P_3$-free with~$14$ edge deletions if and only if there is at least one vertex in~$A_j$ which is incident with a deleted edge of its variable gadget.
\proofparagraph{Correctness:} We now show the correctness of the reduction by proving that there is a satisfying assignment for~$\phi$ if and only if~$(G,k)$ is a yes-instance of \textsc{BPD}.
$(\Rightarrow)$ Let~$\mathcal{A}:X \rightarrow \{\text{true},\text{false}\}$ be a satisfying assignment for~$\phi$. In the following, we construct a solution~$S$ for~$(G,k)$.
For each variable~$x_i$ we add~$E(\{v_i\},T_i)$ to~$S$ if~$\mathcal{A}(x_i)=\text{true}$ and we add~$E(\{v_i\},F_i)$ to~$S$ if~$\mathcal{A}(x_i)=\text{false}$. Note that for each variable we add exactly four edges to~$S$.
For each $C_j \in \mathcal{C}$ we add the following edges: Since~$\mathcal{A}$ is satisfying, $C_j$ contains a variable~$x_i$ such that~$\mathcal{A}(x_i)$ satisfies~$C_j$. By the construction of~$G$ there is exactly one~$p \in \{1,2,3\}$ such that~$a_j^p=t^{\Psi(C_j,x_i)}_i$ if~$x_i$ occurs as a positive literal in~$C_j$ or~$a_j^p=f^{\Psi(C_j,x_i)}_i$ if~$x_i$ occurs as a negative literal in~$C_j$. For both~$q \in \{1,2,3\} \setminus \{p\}$ we add~$E(\{a^{q}_j\},W_j\cup B_j)$ to~$S$. Note that since~$|E(\{a^{q}_j\},W_j\cup B_j)| = |W_j\cup B_j| =7$ we add exactly~$14$ edges per clause. Thus, we have an overall number of~$4 \cdot |X| +14\cdot |\mathcal{C}|$ edges in~$S$.
Let~$G':=G-S$. It remains to show that there is no bi\-colored~$P_3$~in~$G'$. Let~$C_j \in \mathcal{C}$. We first show that no edge in~$E_{G'}(A_j \cup B_j \cup W_j)$ is part of a bi\-colored~$P_3$~in~$G'$. For any two vertices~$u_1,u_2 \in W_j\cup B_j$ it holds that~$N_{G'}[u_1]=N_{G'}[u_2]$. Hence, no edge in~$E_{G'}(W_j \cup B_j)$ is part of an induced~$P_3$ in~$G'$ and therefore no edge in~$E_{G'}(W_j \cup B_j)$ is part of a bi\-colored~$P_3$~in~$G'$. It remains to show that no edge in~$E_{G'}(A_j,W_j \cup B_j)$ is part of a bi\-colored~$P_3$~in~$G'$. Without loss of generality assume that~$E(\{a^{1}_j\} \cup \{a^{2}_j\} ,W_j\cup B_j) \subseteq S$ and $E(\{a^{3}_j\} ,W_j\cup B_j) \cap S = \emptyset$. Thus, the only possible edges in~$E_{G'}(A_j \cup B_j \cup W_j)$ that might form a bi\-colored~$P_3$~in~$G'$ are the edges in~$E(\{a^{3}_j\} ,W_j\cup B_j)$. We show for every~$u \in W_j \cup B_j$ that~$\{a^3_j,u\} \in E_{G'}(A_j,W_j \cup B_j)$ is not part of an induced bi\-colored~$P_3$~in~$G'$. Since~$\{a_j^3\} \cup B_j \cup W_j$ is a clique in~$G'$, the edge $\{a^3_j,u\}$ may only form a bi\-colored~$P_3$~with an edge~$\{a_j^3,v_i\}$, where~$v_i$ is the central vertex of the variable gadget of a variable~$x_i$ occurring in $C_j$. By the construction of~$G$ it follows that $a^3_j \in \{ t^{\Psi(C_j,x_i)}_i, f^{\Psi(C_j,x_i)}_i \}$ for exactly one variable~$x_i$. Since~$E(\{a^{3}_j\} ,W_j\cup B_j) \cap S = \emptyset$, the assignment~$\mathcal{A}(x_i)$ satisfies clause~$C_j$ by the construction of~$S$. If~$\mathcal{A}(x_i)=\text{true}$, then~$\{a^3_j, v_i\} = \{t_i^{\Psi(C_j,x_i)}, v_i\}\in E_G(\{v_i\},T_i) \subseteq S$ and therefore~$\{a^3_j, v_i\}$ is not an edge of~$G'$. Analogously, if~$\mathcal{A}(x_i)=\text{false}$, then~$\{a^3_j, v_i\} = \{f_i^{\Psi(C_j,x_i)}, v_i\}\in E_G(\{v_i\},F_i) \subseteq S$ is not an edge of~$G'$. Hence, no edge in~$E_{G'}(A_j \cup B_j \cup W_j)$ is part of a bi\-colored~$P_3$~in~$G'$.
Let~$x_i \in X$. We show that no edge in~$E_{G'}( \{v_i\} \cup T_i \cup F_i)$ is part of a bi\-colored~$P_3$~in~$G'$. Since either~$E_{G}( \{v_i\}, T_i) \subseteq S$ or~$E_{G}( \{v_i\}, F_i) \subseteq S$, all edges in~$E_{G'}( \{v_i\} \cup T_i \cup F_i)$ have the same color. Hence, there is no bi\-colored~$P_3$~in~$G'$ consisting of two edges from one variable gadget. Since there is no vertex in~$G'$ that is adjacent to two vertices of distinct variable gadgets, an edge~$e \in E_{G'}( \{v_i\} \cup T_i \cup F_i)$ may only form a bi\-colored~$P_3$~with an edge in~$E_{G'}(A_j \cup B_j \cup W_j)$ for some clause~$C_j$. However, since no edge in~$E_{G'}(A_j \cup B_j \cup W_j)$ is part of a bi\-colored~$P_3$~in~$G'$ as shown above, $e$ does not form a bi\-colored~$P_3$~with an edge from a clause gadget. Therefore, no edge in $E_{G'}( \{v_i\} \cup T_i \cup F_i)$ is part of a bi\-colored~$P_3$. It follows that~$G'$ does not contain any bi\-colored~$P_3$
$(\Leftarrow)$ Conversely, let~$S$ be a solution for~$(G,k)$. Note that for every variable~$x_i\in X$ we have~$|S \cap E_G(\{v_i\},T_i \cup F_i)| \geq 4$ since every edge in~$E_G(\{v_i\},T_i)$ forms a bi\-colored~$P_3$~with every edge in~$E_G(\{v_i\},F_i)$.
Before we define a satisfying assignment~$\mathcal{A}: X \rightarrow \{\text{true}, \text{false}\}$ for~$\phi$ we take a more detailed look at which edges of the clause gadgets need to be elements of~$S$. Let~$C_j \in \mathcal{C}$ be a clause and let~$G_j:=G[A_j\cup B_j\cup W_j]$ be the induced subgraph of the corresponding clause gadget. We show that~$14$ edge deletions are necessary and sufficient to transform~$G_j$ into a bi\-colored~$P_3$-free graph. Obviously, for pairwise distinct~$p,q,r \in \{1,2,3\}$, deleting the~$14$ edges in~$E_{G_j}(\{a_j^p,a_j^q\},B_j\cup W_j)$ transforms~$G_j$ into a bi\-colored~$P_3$-free graph, since~$\{a_j^r\} \cup B_j \cup W_j$ is a clique in~$G_j$. Hence, deleting~$14$ edges is sufficient. It remains to show that when deleting less than~$14$ edges there are still bi\-colored~$P_3$ s in~$G_j$. To this end, we show that either one of the vertices in~$A_j$ is not incident with an edge deletion in~$G_j$ or we need more than~$14$ edge deletions to transform~$G_j$ into a bi\-colored~$P_3$-free graph. We consider three vertices~$\xi_1, \xi_2, \xi_3 \in B_j \cup W_j$ representing the endpoints of deleted edges incident with~$a_j^1$, $a_j^2$, and~$a_j^3$, respectively. Let~$S_j:=\{ \{a_j^p, \xi_p \} \mid p \in \{1,2,3\}\}$. The following claim gives a lower bound on the number of edge deletions in~$G_j$ after deleting~$S_j$.
\begin{claim} \label{Claim: One clause guy without edgedel}
There are at least~$12$ edge-disjoint~bi\-colored~$P_3$ s in~$G_j-S_j$.
\end{claim}
\begin{claimproof}
We define three sets~$\mathcal{P}^1$,~$\mathcal{P}^2$, and~$\mathcal{P}^3$ containing~bi\-colored~$P_3$ s and show that the union $\mathcal{P}^1 \cup \mathcal{P}^2 \cup \mathcal{P}^3$ contains at least~$12$ edge-disjoint bi\-colored~$P_3$ s in~$G_j - S_j$. Here, we represent bi\-colored~$P_3$ s by edge sets of size two. For each~$p \in \{1,2,3\}$ we set
\begin{align*}
\mathcal{P}^p := \{ \{ \{a_j^p, w\}, \{w,\xi_p\} \} \mid w \in (B_j \cup W_j) \setminus \{b_j^p, \xi_p\} \}.
\end{align*}
Let~$p \in \{1,2,3\}$. Since $E_{G_j}(W_j \cup B_j) \subseteq E_b$, and~$E_{G_j}( \{a_j^p\}, (B_j \cup W_j) \setminus \{b_j^p\}) \subseteq E_r$, it follows that every set~$P \in \mathcal{P}^p$ is a bi\-colored~$P_3$~in~$G_j- S_j$. Obviously, the bi\-colored~$P_3$ s in~$\mathcal{P}^p$ are edge-disjoint and $|\mathcal{P}^p| = |(B_j \cup W_j) \setminus \{b_j^1,\xi_1\}| = 5$.
We now show that the union~$\mathcal{P}^1 \cup \mathcal{P}^2 \cup \mathcal{P}^3$ contains at least~$12$ edge-disjoint bi\-colored~$P_3$ s in~$G_j - S_j$. To this end, consider the following subset
\begin{align*}
\mathbb{P}:= (\mathcal{P}^1 \cup \mathcal{P}^2 \cup \mathcal{P}^3) \setminus \{Q_1,Q_2,Q_3\} \subseteq \mathcal{P}^1 \cup \mathcal{P}^2 \cup \mathcal{P}^3,
\end{align*}
where
\begin{align*}
Q_1 &:= \{ \{a_j^2, \xi_1\}, \{\xi_1, \xi_2\} \},\\
Q_2 &:= \{ \{a_j^3, \xi_1\}, \{\xi_1, \xi_3\} \},\\
Q_3 &:= \{ \{a_j^3, \xi_2\}, \{\xi_2, \xi_3\} \}.
\end{align*}
Obviously,~$Q_1, Q_2, Q_3 \not \in \mathbb{P}$ and $|\mathbb{P}| \geq 3 \cdot 5-3=12$. It remains to show that all bi\-colored~$P_3$ s in~$\mathbb{P}$ are edge-disjoint. Assume towards a contradiction that there are~$P,R \in \mathbb{P}$ with~$P \neq R$ and~$P \cap R \neq \emptyset$. Since every~$\mathcal{P}^p$ contains edge-disjoint bi\-colored~$P_3$ s, it follows that~$P \in \mathcal{P}^{p}$ and~$R \in \mathcal{P}^{r}$ for some~$p \neq r$. Without loss of generality assume~$p < r$. Since for every~$w \in B_j \cup W_j$ edges~$\{a_j^{r}, w \}$ are not contained in any bi\-colored~$P_3$~in~$\mathcal{P}^{p}$ and conversely edges~$\{a_j^{p}, w \}$ are not contained in any bi\-colored~$P_3$~in~$\mathcal{P}^{r}$ it follows that~$P \cap R = \{\{\xi_{p},\xi_{r}\}\}$. We conclude~$R=\{ \{a^{r}_j, \xi_{p}\}, \{\xi_{p}, \xi_{r}\}\}$.
Consider the case~$p = 1$ and~$r =2$. Then,~$R=Q_1 \not \in \mathbb{P}$. Analogously, if~$p = 1$ and~$r =3$, then~$R=Q_2 \not \in \mathbb{P}$, and if~$p=2$ and~$r=3$, then~$R=Q_3 \not \in \mathbb{P}$. In every case we have~$R \not \in \mathbb{P}$ which contradicts the assumption~$P, R \in \mathbb{P}$. Hence, there are no bi\-colored~$P_3$ s in~$\mathbb{P}$ that share an edge and therefore~$\mathcal{P}^1 \cup \mathcal{P}^2 \cup \mathcal{P}^3$ contains at least~$12$ edge-disjoint bi\-colored~$P_3$ s as claimed. $\hfill \Diamond$
\end{claimproof}
Claim \ref{Claim: One clause guy without edgedel} implies that if every vertex in~$A_j$ is incident with an edge in~$S \cap E_{G_j}(A_j,B_j \cup W_j)$, we have $|S \cap E_{G_j}(A_j \cup B_j \cup W_j)| \geq 3+12=15$.
We now show that deleting~$E_{G_j}(\{a_j^p,a_j^q\},B_j\cup W_j)$ for distinct~$p,q \in \{1,2,3\}$ are the only three possible ways to transform~$G_j$ into a bi\-colored~$P_3$-free graph with less than~$15$ edge deletions. By Claim~\ref{Claim: One clause guy without edgedel}, we can assume without loss of generality that~$E_{G_j}(\{a_j^3\},W_j \cup B_j) \cap S = \emptyset$. We show that this implies that all edges incident with~$a^1_j$ and~$a^2_j$ in~$G_j$ are deleted by~$S$.
\begin{claim} \label{Claim: NP-h all edges deleted}
If~$E_{G_j}(\{a_j^3\},W_j \cup B_j) \cap S = \emptyset$, then, $E_{G_j}(\{a_j^p\},B_j \cup W_j) \subseteq S$ for~$p=1$ and for~$p=2$.
\end{claim}
\begin{claimproof}
First, note that no edge~$\{b^3_j, w\}$ with $w \in B_j \cup W_j$ is an element of~$S$, since otherwise~$\{a^3_j,b^3_j\} \in E_b$ and~$\{a^3_j,w\} \in E_r$ form a bi\-colored~$P_3$~in~$G_j-S$ which contradicts the fact that~$G-S$ is bi\-colored~$P_3$-free.
Next, consider~$\{a_j^p,b_j^3\}$. Clearly, $\{a_j^p,b_j^3\}$ is an element of~$S$, since otherwise~$\{a_j^p,b_j^3\} \in E_r$ and~$\{a_j^3,b_j^3\} \in E_b$ form a bi\-colored~$P_3$~in~$G_j-S$ which contradicts the fact that~$G-S$ is bi\-colored~$P_3$-free.
It remains to show that $E_{G_j}(\{a_j^p\},(B_j \setminus \{b_j^3\}) \cup W_j) \subseteq S$. Assume towards a contradiction that there exists an edge~$\{a_j^p, w\}$ in~$G_j-S$ with~$w \in (B_j \cup W_j) \setminus \{b_j^3\}$. If~$w = b_j^p$, the edges~$\{a_j^p, b_j^p\} \in E_b$ and~$\{b_j^p, a_j^3 \} \in E_r$ form a bi\-colored~$P_3$~in~$G_j-S$. Otherwise, if~$w \neq b_j^p$ the edges~$\{a_j^p, w\} \in E_r$ and~$\{w, b^3_j\} \in E_b$ form a bi\-colored~$P_3$~in~$G_j-S$. Both cases contradict the fact that~$G-S$ is bi\-colored~$P_3$-free and therefore~$E_{G_j-S}(\{a_j^p\},B_j \cup W_j) = \emptyset$ as claimed.~$\hfill \Diamond$
\end{claimproof}
We conclude from Claim \ref{Claim: NP-h all edges deleted} that deleting the~$14$ edges in~$E_{G_j}(\{a_j^p,a_j^q\},B_j\cup W_j)$ for distinct~$p,q \in \{1,2,3\}$ are the only three possible ways to destroy all bi\-colored~$P_3$ s in~$G_j$ with at most~$14$ edge deletions.
This fact combined with the fact that we need at least~$4$ edge deletions per variable gadget and~$|S|\leq 4 \cdot |X|+14 \cdot |\mathcal{C}|$ implies that~$|E_G(A_j\cup B_j \cup W_j) \cap S|=14$ for each clause~$C_j$ and $|E_G(\{v_i\} \cup T_i \cup F_i) \cap S|=4$ for each variable~$x_i$.
We now define a satisfying assignment~$\mathcal{A}: X \rightarrow \{\text{true},\text{false}\}$ for~$\phi$ by
\begin{align*}
\mathcal{A}(x_i) := \begin{cases}
\text{true} &\text{if }E(\{v_i\},T_i) \subseteq S\text{, and}\\
\text{false}&\text{if }E(\{v_i\},F_i) \subseteq S\text{.}\\
\end{cases}
\end{align*}
The assignment~$\mathcal{A}$ is well-defined since in each variable gadget either all red or all blue edges belong to~$S$.
Let~$C_j \in \mathcal{C}$ be some clause in~$\phi$. It remains to show that~$C_j$ is satisfied by~$\mathcal{A}$. Since~$|E_G(A_j\cup B_j \cup W_j) \cap S|=14$ there are distinct~$p,q\in\{1,2,3\}$ such that~$S \cap E_G(A_j\cup B_j \cup W_j) = E_G(\{a_j^p,a_j^q\} , B_j\cup W_j)$. Without loss of generality assume~$p=1$ and~$q=2$. Therefore~$E_G(\{a_j^3\},W_j \cup B_j) \cap S = \emptyset$. By the construction of~$G$ we know that there is a variable~$x_i \in X$ occurring in~$C_j$ such that either~$a^3_j=t_i^{\Psi(C_j,x_i)}$ or~$a^3_j=f_i^{\Psi(C_j,x_i)}$.
We show that clause~$C_j$ is satisfied by the assignment~$\mathcal{A}(x_i)$.
For all~$w \in W_j$, $G-S$ contains the red edge~$\{a^3_j,w\}$. Moreover,~$G-S$ contains the blue edge~$\{a^3_j,b_j^3\}$. Since no vertex in~$W_j \cup B_j$ is adjacent to~$v_i$ we conclude that~$\{a^3_j, v_i\} \in S$ since otherwise~$\{a^3_j, v_i\}$ is part of a bi\-colored~$P_3$~in~$G'$ which contradicts the fact that~$G'$ is bi\-colored~$P_3$-free.
If~$a^3_j=t_i^{\Psi(C_j,x_i)}$, then variable~$x_i$ occurs as a positive literal in~$C_j$ by the construction of~$G$. Then, $\{a^3_j, v_i\} \in E(\{v_i\},T_i)$. We conclude from~$\{a^3_j, v_i\} \in S$ that~$E(\{v_i\},T_i) \subseteq S$ and therefore~$\mathcal{A}(x_i)=\text{true}$. Analogously, if~$a^3_j=f_i^{\Psi(C_j,x_i)}$, then~$\{a^3_j, v_i\} \in E(\{v_i\},F_i)$. From~$\{a^3_j, v_i\} \in S$ we conclude~$\mathcal{A}(x_i)= \text{false}$.
In both cases, the assignment~$\mathcal{A}$ satisfies~$C_j$ which completes the correctness proof.
\end{proof}
Note that for any instance~$\phi$ of \textsc{(3,4)-SAT} it holds that~$|\mathcal{C}| \leq \frac{4}{3} |X|$. Thus, in the proof of Theorem~\ref{Theorem: NP-h} we constructed a graph with~$8 \cdot |X|+42 \cdot |\mathcal{C}| \in \mathcal{O}(|X|)$ edges, $k=4 \cdot |X|+14 \cdot |\mathcal{C}| \in \mathcal{O}(|X|)$, and therefore~$\ell = 4 \cdot |X| +28 \cdot |\mathcal{C}| \in \mathcal{O}(|X|)$ for the dual parameter~$\ell=m -k$. Considering the ETH~\cite{IPZ01} and the fact that there is a reduction from \textsc{3Sat} to \textsc{(3,4)-Sat} with a linear blow-up in the number of variables~\cite{Tovey84} this implies the following.
\begin{corollary} \label{Corollary: ETH lower bounds}
If the ETH is true, then \textsc{BPD}{} cannot be solved in~$2^{o(n+m+k+\ell)}$ time even if the maximum degree in~$G$ is eight.
\end{corollary}
\section{Polynomial-Time Solvable Cases} \label{Section: polytime}
Since \textsc{BPD}~is NP-hard in general, there is little hope to find a polynomial-time algorithm that solves \textsc{BPD}~on arbitrary instances. In this section we provide polynomial-time algorithms for two special cases of \textsc{BPD}~that are characterized by colored forbidden induced subgraphs.
\subsection{\textsc{BPD}~on Bicolored~$K_3$-free Graphs} Our first result is a polynomial-time algorithm for \textsc{BPD}, when~$G=(V,E_r,E_b)$ does not contain a certain type of~$K_3$s.
\begin{defi}
Three vertices~$u,v,w$ form a \emph{bicolored~$K_3$} if~$G[\{u,v,w\}]$ contains exactly three edges such that exactly two of them have the same color. A bicolored~$K_3$ is \emph{endangered in~$G$} if at least one of the two edges with the
same color is part of a bi\-colored~$P_3$~in~$G$.
\end{defi}
A bicolored~$K_3$ on vertices~$u,v,w$ can be seen as an induced subgraph of~$G$, such that after one edge deletion in~$E_G(\{u,v,w\})$ one might end up with a new~bi\-colored~$P_3${} containing the vertices~$u,v$, and~$w$. This happens, if we delete one of the two edges with the same color. If the bicolored~$K_3$ is endangered, it might be necessary to delete one of these two edges to transform~$G$ into a bi\-colored~$P_3$-free graph. Intuitively, a graph~$G$ that contains no (endangered) bicolored~$K_3$ can be seen as a graph from which we can delete any edge that is part of a bi\-colored~$P_3${} without producing a new one. Note that the following result also implies that \textsc{BPD}{} can be solved in polynomial time on triangle-free graphs and thus also on bipartite graphs.
\begin{theorem}\label{thm:endangered}
\textsc{BPD}{} can be solved in~$\ensuremath{\mathcal{O}}(nm^{\frac{3}{2}})$ time if~$G$ contains no endangered bicolored~$K_3$.
\end{theorem}
\begin{proof}
We prove the theorem by reducing \textsc{BPD}~to \textsc{Vertex Cover} on bipartite graphs which can be solved in polynomial time since it is equivalent to computing a maximum matching.
\begin{quote}
\textsc{Vertex Cover}\\
\textbf{Input:} A graph~$G=(V, E)$ and an integer~$k \in \mathds{N}$.\\
\textbf{Question:} Is there a \emph{vertex cover} of size at most~$k$ in~$G$, that is, a set~$S\subseteq V$ with~$|S| \leq k$ such that every edge~$e \in E$ has at least one endpoint in~$S$.
\end{quote}
Let~$(G=(V,E_b,E_r),k)$ be an instance of \textsc{BPD}~where~$G$ contains no endangered bicolored~$K_3$. We define an instance~$(G',k')$ of \textsc{Vertex Cover} as follows. Let~$G'=(V',E')$ be the graph with vertex set~$V' := E_r \cup E_b$ and edge set~$E' := \{\{e_1,e_2\} \subseteq E_b\cup E_r \mid e_1 \text{ and } e_2 \text{ form a bi\-colored~$P_3$~in }G \}$. That is,~$G'$ contains a vertex for each edge of~$G$ and edges are adjacent if they form a~$P_3$ in~$G$. Moreover, let~$k'=k$. The graph~$G'$ is obviously bipartite with partite sets~$E_b$ and~$E_r$.
We now show that~$(G,k)$ is a yes-instance for \textsc{BPD} if and only if~$(G',k')$ is a yes-instance for \textsc{Vertex Cover}.
$(\Rightarrow)$ Let~$S$ be a solution for~$(G,k)$. Note that the edges~of~$G$ are vertices of~$G'$ by construction and therefore~$S \subseteq V'$. We show that~$S$ is a vertex cover in~$G'$.
Assume towards a contradiction that there is an edge~$\{ x, y \} \in E'$ with~$x,y \not \in S$. By the definition of~$E'$, the edges~$x$ and~$y$ form a bi\-colored~$P_3$~in~$G$. This contradicts the fact that~$G-S$ is bi\-colored~$P_3$-free. Hence, $S$ is a vertex cover of size at most~$k$ in~$G'$
$(\Leftarrow)$ Let~$C \subseteq V'$ with~$|C| \leq k$ be a minimal vertex cover of~$G'$. Note that the vertices of~$G'$ are edges of~$G$ by construction and therefore~$C \subseteq E$. We show that~$G-C$ is bi\-colored~$P_3$-free.
Assume towards a contradiction that there are~$x=\{u,v\}\in E_b \setminus C$, and $y=\{v,w\}\in E_r \setminus C$ forming a bi\-colored~$P_3$~in~$G-C$. Then,~$x$ and~$y$ do not form a bi\-colored~$P_3$~in~$G$ since otherwise there is an edge~$\{x,y\} \in E'$, which has no endpoint in the vertex cover~$C$. It follows that~$\{u,w\} \in C$.
Obviously, the vertices~$u,v,w$ form a bicolored~$K_3$.
Since~$x$ and~$y$ form a bi\-colored~$P_3$~in~$G-C$, one of these edges has the same color as~$\{u,w\}$.
Since~$\{u,w\} \in C$ and~$C$ is minimal, it follows that~$\{u,w\} \in V'$ is an endpoint of an edge in~$G'$ and thus~$\{u,w\}$ is part of a bi\-colored~$P_3$~in~$G$. Therefore,~$G[\{ u,v,w\}]$ forms an endangered bicolored~$K_3$ in~$G$ which contradicts the fact that~$G$ contains no endangered bicolored~$K_3$. This proves the correctness of the reduction.
For a given instance~$(G,k)$ of \textsc{BPD}, the \textsc{Vertex Cover} instance~$(G',k')$ can be computed in~$\mathcal{O}(nm)$ time by computing all bi\-colored~$P_3$ s of~$G$. Since \textsc{Vertex Cover} can be solved in~$\mathcal{O}(|E'| \cdot \sqrt{|V'|})$ time on bipartite graphs~\cite{HK73} and since $|V'|=m$ and~$|E'|\leq nm$, we conclude that \textsc{BPD}{} can be solved in~$\mathcal{O}(nm^\frac{3}{2})$ time on graphs without endangered~$K_3$s.
\end{proof}
\subsection{BPD on Graphs without Monochromatic~$K_3$s and~$P_3$s} We now show a second polynomial-time solvable special case that is characterized by four colored forbidden induced subgraphs: the two \emph{monochromatic}~$K_3$s, these are the~$K_3$s where all three edges have the same color, and the two \emph{monochromatic}~$P_3$s, these are the~$P_3$s where both edges have the same color. Observe that a graph that does not contain these forbidden induced subgraphs may still contain~$K_3$s or~$P_3$s.
We provide two reduction rules that lead to a polynomial-time algorithm for this special case. These rules can also be applied to general instances of~\textsc{BPD}~and thus their running time bound is given for general graphs. We will later show that on graphs without monochromatic~$K_3$s and~$P_3$s we can apply them exhaustively in~$\ensuremath{\mathcal{O}}(n)$ time.
\begin{reduc}
\label{reduc:small-components}
\begin{enumerate}[a)]
\item Remove all bi\-colored~$P_3$-free components from~$G$.
\item If~$G$ contains a connected component~$C$ of
size at most five, then compute the minimum number of edge deletions~$k_C$ to
make~$G[C]$~bi\-colored~$P_3${}-free, remove~$C$ from~$G$, and set~$k\leftarrow k-k_C$.
\end{enumerate}
\end{reduc}
\begin{lemma}
Reduction Rule~\ref{reduc:small-components} is correct and can be exhaustively applied in~$\ensuremath{\mathcal{O}}(nm)$~time.
\end{lemma}
\begin{proof}
The correctness of Reduction Rule~\ref{reduc:small-components} is obvious. Part a) can be exhaustively applied in~$\ensuremath{\mathcal{O}}(nm)$ time as follows: First compute the connected components of~$G$ in~$\ensuremath{\mathcal{O}}(n+m)$ via breadth-first search. Then, enumerate all bi\-colored~$P_3$ s and label the vertices that are not contained in any~bi\-colored~$P_3${} in~$\ensuremath{\mathcal{O}}(nm)$ time. Finally, remove all connected components without labeled vertices~in~$\ensuremath{\mathcal{O}}(n+m)$ time. Part b) of Reduction Rule~\ref{reduc:small-components} can be applied exhaustively in~$\ensuremath{\mathcal{O}}(n)$ time since we only need to find and remove connected components of constant size.
\end{proof}
The second reduction rule involves certain bridges that may be deleted greedily. An edge~$e$ is a \emph{bridge} if the graph~$G-e$ has more connected components than~$G$.
\begin{reduc}
\label{reduc:bridge-conflict}
If~$G$ contains a~bi\-colored~$P_3${} formed by~$\{u,v\}$ and~$\{v,w\}$ such that~$\{u,v\}$ is a bridge of~$G$ and the connected component~$C$ containing~$v$ and~$w$ in~$G-\{ u,v\}$ is~bi\-colored~$P_3${}-free, then remove~$C$ from~$G$ and set~$k\leftarrow k-1$.
\end{reduc}
\begin{lemma}
Reduction Rule~\ref{reduc:bridge-conflict} is correct and can be applied exhaustively in $\ensuremath{\mathcal{O}}(n^2 m^2)$~time.
\end{lemma}
\begin{proof}
Let~$(G,k)$ be the original instance and~$(G',k'=k-1)$ be the instance after the application
of the rule. If~$(G',k')$ has a solution~$S'$, then~$S'\cup \{u,v\}$ is
a solution for~$(G,k)$ and thus~$(G,k)$ is also a yes-instance. It remains to show that
if~$(G,k)$ is a yes-instance, then so is~$(G',k')$. Consider a solution~$S$ with~$|S|\le k$
for~$G$. Observe that~$\{u,v\}\in S$ or~$\{v,w\}\in S$. This
implies~$S':=S\cap E(G[V\setminus C])\le k-1$. Finally, observe that
since~$G[V\setminus C]=G'$,~$S'$ is a solution of size at most~$k-1$ for~$G'$.
The running time can be seen as follows: We compute in~$\ensuremath{\mathcal{O}}(n+m)$ time the set of
bridges in~$G$, and in~$\ensuremath{\mathcal{O}}(nm)$ time the two connected components resulting from the
deletion of each bridge. Moreover, in~$\ensuremath{\mathcal{O}}(nm)$~time we can compute for each bridge
if it forms a~bi\-colored~$P_3${} with any other edge. Then, we check for
each bridge in~$\ensuremath{\mathcal{O}}(nm)$~time whether the two new disconnected components are~bi\-colored~$P_3$~free. Since there are at most~$\ensuremath{\mathcal{O}}(n)$ bridges, the overall running time for this step is~$\ensuremath{\mathcal{O}}(n^2\cdot m)$. Thus, we can determine in~$\ensuremath{\mathcal{O}}(n^2\cdot m)$~time whether the reduction
rule can be applied. Since the rule can be applied~$\ensuremath{\mathcal{O}}(m)$ times, we arrive at the
claimed running time bound.
\end{proof}
As we will show later, any graph without monochromatic $P_3$s and monochromatic~$K_3$s to which
the above reduction rules do not apply has maximum degree two. These graphs can be solved
in linear time as we see in the following lemma.
\begin{lemma}\label{lem:deg-two}
Let~$(G,k)$ be an instance of~\textsc{BPD}{} such that~$G$ has maximum degree two. Then,~$(G,k)$ can be solved in~$\ensuremath{\mathcal{O}}(n)$ time.
\end{lemma}
\begin{proof}
In the following, we construct a solution~$S$ for~$(G,k)$. If~$G$ has maximum degree~two, then each connected component of~$G$ is either a path or a cycle. The algorithm first deals with cycles and then considers the remaining paths.
First, we consider each connected component~$C$ of~$G$ which is a cycle. We either transform~$C$ into one or two paths or solve~$C$ directly. First, assume that~$C$ contains three subsequent edges~$e_1, e_2$, and~$e_3$ of the same color, then edge~$e_2$ is not part of any bi\-colored~$P_3$. Hence~$e_2$ can be removed without decreasing~$k$. The remaining connected component is a path and will be solved in the second step. Second, assume that~$C$ contains exactly two subsequent edges~$e_1$ and~$e_2$ with the same color. Further, assume~$|C|\ge4$. Note that this is no restriction since after applying Reduction Rule~\ref{reduc:small-components} each component of~$G$ has size at least six. Further, let~$e_0$ be the other edge that is incident with~$e_1$ and let~$e_3$ be the other edge that is incident with~$e_2$. According to our assumption,~$e_0$ and~$e_1$ form a bi\-colored~$P_3$~and~$e_2$ and~$e_3$ form a bi\-colored~$P_3$. Hence, either~$e_0\in S$ or~$e_1\in S$ and either~$e_2\in S$ or~$e_3\in S$. Since~$e_1$ and~$e_2$ have the same color and no further edges are incident with~$e_1$ and~$e_2$, we may assume that~$e_0, e_3\in S$. The remaining connected components are paths and will be solved in the second step. Third, consider the case that~$C$ contains no two subsequent edges of the same color. Hence, cycle~$C$ consists of~$2\ell$ edges~$e_1, \ldots , e_{2\ell}$ and each two subsequent edges form a bi\-colored~$P_3$. Thus,~$C$ contains a set of~$\ell$ edge-disjoint bi\-colored~$P_3$ s~$\{e_1, e_2\}, \{ e_3, e_4\}, \ldots , \{ e_{2\ell-1}, e_{2\ell}\}$ and contains exactly~$\ell$ blue edges. Thus, deleting the~$\ell$ blue edges of~$C$ is optimal.
In a second step, we consider each connected component that is a path. Let~$P_n$ be a path consisting of~$n$ vertices~$v_1, \ldots , v_n$. Visit the edges~$\{v_i,v_{i+1}\}$ for increasing~$i$ starting at~$v_1$. For each edge, check whether it is contained in a bi\-colored~$P_3${}. Let~$\{v_i,v_{i+1}\}$ be the first encountered edge that is in~a~bi\-colored~$P_3${}. Then, delete~$\{v_{i+1},v_{i+2}\}$, decrease~$k$ by one, and continue with~$\{v_{i+2},v_{i+3}\}$ if it exists. First, observe that~$\{v_{i+1},v_{i+2}\}$ exists since~$\{v_i,v_{i+1}\}$ does not form a~bi\-colored~$P_3${} with~$\{v_{i-1},v_{i}\}$. Second, observe that the deletion of~$\{v_{i+1},v_{i+2}\}$ is simply an application of Reduction~Rule~\ref{reduc:bridge-conflict} and therefore correct. Clearly, this greedy algorithm runs in~$\ensuremath{\mathcal{O}}(n)$ time.
In altogether~$\ensuremath{\mathcal{O}}(n)$ time, we can consider each cycle~$C$ and either solve~$C$ or delete one or two edges, which transforms~$C$ into one or two paths.
The greedy algorithm for paths runs in~$\ensuremath{\mathcal{O}}(n)$ time on all paths. Thus, the remaining instance can be solved in~$\ensuremath{\mathcal{O}}(n)$ time. The overall running time follows.
\end{proof}
\begin{figure}
\begin{center}
\begin{tikzpicture}[scale=0.7]
\tikzstyle{knoten}=[circle,fill=white,draw=black,minimum size=5pt,inner sep=0pt]
\tikzstyle{bez}=[inner sep=0pt]
\node[knoten] (v)[label=above:{$v$}] at (1.6,1) {};
\node[knoten] (u1)[label=left:{$u_1$}] at (0,0) {};
\node[knoten] (u2)[label=right:{$u_2$}] at (1,0) {};
\node[knoten] (w1)[label=below:{$w_1$}] at (2.2,0) {};
\node[knoten] (w2)[label=below:{$w_2$}] at (3.2,0) {};
\node[knoten] (t)[label=below:{$t$}] at (0.5,-1) {};
\draw[-,color=blue,very thick] (v) to (u1);
\draw[-,color=blue,very thick] (v) to (u2);
\draw[-,color=blue,very thick] (t) to (u2);
\draw[-,color=blue,very thick] (w1) to (w2);
\draw[-,color=myred] (v) to (w1);
\draw[-,color=myred] (v) to (w2);
\draw[-,color=myred] (u1) to (u2);
\draw[-,color=myred] (u1) to (t);
\node[knoten] (t)[label=above:{$t$}] at (6.75,0.75) {};
\node[knoten] (v)[label=left:{$v$}] at (6,0) {};
\node[knoten] (u)[label=right:{$u$}] at (7.5,0) {};
\node[knoten] (w)[label=270:{$w$}] at (6.75,-0.75) {};
\draw[-,color=blue,very thick] (v) to (u);
\draw[-,color=blue,very thick] (v) to (t);
\draw[-,color=blue,very thick] (w) to (u);
\draw[-,color=myred] (u) to (t);
\draw[-,color=myred] (v) to (w);
\node[knoten] (u)[label=left:{$u$}] at (10,0.75) {};
\node[knoten] (v)[label=above:{$v$}] at (11.5,0) {};
\node[knoten] (w)[label=left:{$w$}] at (10,-0.75) {};
\node[knoten] (t)[label=above:{$t$}] at (12.5,0) {};
\draw[-,color=blue,very thick] (v) to (u);
\draw[-,color=blue,very thick] (v) to (w);
\draw[-,color=myred] (v) to (t);
\draw[-,color=myred] (u) to (w);
\node[bez] (a) at (-1,1.5) {(a)};
\node[bez] (b) at (5,1.5) {(b)};
\node[bez] (c) at (8.7,1.5) {(c)};
\end{tikzpicture}
\end{center}
\caption{Subgraphs used in the proof of Theorem~\ref{theo:no monochromatic subgraph linear time} (a)~$|N(v)|=4$, (b)~$G[N[v]]$ is a diamond and (c)~$G[N[v]]$ is a paw.} \label{Figure: Proof monochromatic in linear time}
\end{figure}
We have now all ingredients to present the polynomial-time algorithm for graphs without monochromatic~$K_3$ and monochromatic~$P_3$. In order to prove the correctness of the algorithm and the linear running time, we make the following observation about such graphs.
\begin{lemma}\label{lem:deg-bound}
Let~$G$ be a graph that contains no monochromatic~$K_3$ and no monochromatic~$P_3$ as
induced subgraphs. Then, the maximum blue degree and the maximum red degree in~$G$ are
two.
\end{lemma}
\begin{proof}
We show the proof only for the blue degree, the bound for the red degree can be shown
symmetrically.
Assume towards a contradiction that~$G$ contains a vertex~$t$ with at least three blue
neighbors~$u$,~$v$, and~$w$. Since~$G$ contains no blue~$P_3$, the
subgraph~$G[\{u,v,w\}]$ has three edges. Moreover, since~$G$ contains no
monochromatic~$K_3$ not all of the three edges in~$G[\{u,v,w\}]$ are red. Assume without
loss of generality that~$\{u,v\}$ is blue. Then~$G[\{u,v,t\}]$
is a blue~$K_3$, a contradiction.
\end{proof}
\begin{theorem}
\label{theo:no monochromatic subgraph linear time}
\textsc{BPD}{} can be solved in~$\ensuremath{\mathcal{O}}(n)$ time if~$G$ contains no monochromatic~$K_3$ and no monochromatic~$P_3$.
\end{theorem}
\begin{proof}
The algorithm first applies Reduction Rule~\ref{reduc:small-components} exhaustively. Afterwards, Reduction Rule~\ref{reduc:bridge-conflict} is applied on all bridges~$\{u,v\}$ with~$\deg(u)\geq 3$ or~$\deg(v) \geq 3$. Thus, let~$G$ be the graph after the applications of Reduction Rules~\ref{reduc:small-components} and~\ref{reduc:bridge-conflict} as described above. We show that~$G$ has maximum degree at most two. Afterwards, Lemma~\ref{lem:deg-two} applies and the remaining instance can be solved in~$\ensuremath{\mathcal{O}}(n)$ time. Observe that by
Lemma~\ref{lem:deg-bound}, the maximum degree in~$G$ is four.
First, assume that the maximum degree of~$G$ is four and let~$v$ be a vertex of degree
four. We show that~$N[v]$ is a connected component of~$G$. This implies that~$N[v]$ is removed by Reduction
Rule~\ref{reduc:small-components} in this case. By Lemma~\ref{lem:deg-bound},~the vertex~$v$ has exactly two
blue neighbors~$u_1$,~$u_2$ and exactly two red neighbors~$w_1$,~$w_2$. Since~$G$ contains no
monochromatic~$P_3$ and no monochromatic~$K_3$,~$\{ u_1, u_2\}$ is red and~$\{ w_1,w_2\}$ is blue. Now assume towards a
contradiction, that one of these four vertices has a neighbor~$t\notin N[v]$
in~$G$. Without loss of generality assume that this vertex is~$u_1$. See Figure~\ref{Figure: Proof monochromatic in linear time} (a) for an example. Then,~$\{ u_1,t\}$
is red because otherwise~$G[\{ u_1,v,t\}]$ is a
blue~$P_3$. This implies that~$\{ u_2,t\}$ is blue because
otherwise~$G[\{ u_1,u_2,t\}]$ is a red~$P_3$ or a red~$K_3$. Then,
however,~$G[\{ u_2,v,t\}]$ is a blue~$P_3$. Altogether, this implies that~$N[v]$ is
a connected component of~$G$.
Hence, if~$G$ is reduced with respect to Reduction~Rule~\ref{reduc:small-components},
then~$G$ contains no vertices of degree four.
Second, assume that the maximum degree of~$G$ is three and let~$v$ be a vertex of degree
three. If~$G[N[v]]$ is a~$K_4$, then $N[v]$ is a connected component of~$G$ and is
removed by Reduction~Rule~\ref{reduc:small-components}. Next, assume~$G[N[v]]$ is a
diamond, and let~$t$, $u$, and~$w$ denote the neighbors of~$v$ where~$u$ is the other
vertex that has degree three in~$G[N[v]]$. See Figure~\ref{Figure: Proof monochromatic in linear time} (b) for an example. Assume without loss of generality that $u$ is
a blue neighbor of~$v$. Moreover, one of~$t$ and~$w$, say~$w$, is a red neighbor of~$v$, since otherwise~$\{t,v\}$, and~$\{v,w\}$ form a monochromatic~$P_3$. This
implies that~$t$ is a blue neighbor of~$v$, because otherwise~$G[\{ v,w,t\}]$ is a
red~$P_3$. Consequently,~$t$ is a red neighbor of~$u$ because otherwise~$t$,~$v$,
and~$u$ form a blue~$K_3$. Hence,~$w$ is a blue neighbor of~$u$ because
otherwise~$G[\{ u,w,t\}]$ is a red~$P_3$. Altogether, we have that~$t$ and~$w$ each
have a red and a blue neighbor in~$\{u,v\}$. Since~$N[v]=N[u]$, we have that~$t$ and~$w$
cannot have a neighbor in~$V\setminus N[v]$ as such a neighbor would form a
monochromatic~$P_3$ with one of~$u$ and~$v$. Hence,~$N[v]$ is a connected component
of~$G$ in this case and consequently removed by Reduction
Rule~\ref{reduc:small-components} a).
Thus~$G[N[v]]$ is neither a~$K_4$ nor a diamond if~$G$ is reduced with respect
to~Reduction Rule~\ref{reduc:small-components}. Moreover,~$G[N[v]]$ cannot
be a claw since in this case~$G$ contains a monochromatic~$P_3$. Hence, the only
remaining case is that~$G[N[v]]$ is a paw. Let~$t$,~$u$, and~$w$ be the neighbors of~$v$
where~$u$ and~$w$ are adjacent. For an example see Figure~\ref{Figure: Proof monochromatic in linear time}~(c). Assume furthermore without loss of generality that~$v$
is incident with two blue edges. This implies that~$t$ is a red neighbor of~$v$. Also,~$u$
and~$w$ are blue neighbors of~$v$. Consequently,~$\{ u,w\}$ is red. As in the proof above for the case that~$G[N[v]]$ is a diamond,~$u$ and~$w$ have
no further neighbor in~$G$. Thus,~$\{v,t\}$ is a bridge with~$\deg(v) = 3$ that fulfills the condition of
Reduction Rule~\ref{reduc:bridge-conflict} and thus~$\{v,t\}$ is removed by this
rule. Altogether this implies that any instance to which
Reduction Rules~\ref{reduc:small-components} and~\ref{reduc:bridge-conflict} have been applied as described above has maximum degree two.
By Lemma~\ref{lem:deg-two}, we can thus solve the remaining instance in linear time.
Next, we consider the running times of Reduction Rules~\ref{reduc:small-components} and~\ref{reduc:bridge-conflict} in more detail since for both rules the running time analysis given above did \emph{not} assume that~$G$ contains no monochromatic~$P_3$ and no monochromatic~$K_3$.
First, we apply Reduction Rule~\ref{reduc:small-components} exhaustively. Since~$G$ has maximum degree at most four, we can label all vertices that are contained in some bi\-colored~$P_3${} in~$\ensuremath{\mathcal{O}}(n)$ time and thus Reduction Rule~\ref{reduc:small-components} can be applied exhaustively in~$\ensuremath{\mathcal{O}}(n)$ time. Observe that in the resulting graph the maximum degree of~$G$ is three since vertices of degree~four are in connected components of size~five.
Next, we consider the running time of Reduction Rule~\ref{reduc:bridge-conflict}, after Reduction Rule~\ref{reduc:small-components} was applied exhaustively. Recall that Reduction Rule~\ref{reduc:bridge-conflict} is only applied to bridges that have at least one endpoint with degree three. To apply the rule exhaustively, we first compute in~$\ensuremath{\mathcal{O}}(n)$ time the set of all vertices of degree three. For each such vertex~$v$, the graph~$G[N[v]]$ is a paw because otherwise,~$N[v]$ is a connected component of constant size as shown above. Hence, there exist two vertices~$u, w\in N(v)$ such that~$N(u)=\{ v,w\}$ and~$N(w)=\{ u,v\}$. The vertices~$u$ and~$w$ can be determined in~$\ensuremath{\mathcal{O}}(1)$ time. Let~$t\in N(v)\setminus\{ u,w\}$. Then, Reduction Rule~\ref{reduc:bridge-conflict} removes~$\{v,t\}$ from~$G$. Thus, in~$\ensuremath{\mathcal{O}}(1)$ time, we may apply Reduction Rule~\ref{reduc:bridge-conflict} on the bridge containing~$v$. Consequently, the rule can be applied exhaustively on all degree-three vertices~$\ensuremath{\mathcal{O}}(n)$ time. Afterwards, the remaining instance has maximum degree two and can be solved in~$\ensuremath{\mathcal{O}}(n)$ time. Hence, the overall running time is $\ensuremath{\mathcal{O}}(n)$.
\end{proof}
\section{Parameterized Complexity} \label{Section: param}
In this section we study the parameterized complexity of \textsc{BPD}~parameterized by~$k$, $\ell:=m-k$, and~$(k,\Delta)$, where~$\Delta$ denotes the maximum degree of~$G$. We first provide an~$\ensuremath{\mathcal{O}}(1.84^k\cdot nm)$-time fixed-parameter algorithm for \textsc{BPD}. Afterwards, we study problem kernelizations for \textsc{BPD}~parameterized by~$(k,\Delta)$ and~$\ell$.
\subsection{ A Fixed-Parameter algorithm for Bicolored~$P_3$~Deletion}
We now provide a fixed-parameter algorithm that solves \textsc{BPD}~parameterized by~$k$. Note that there is a naive~$\ensuremath{\mathcal{O}}(2^k \cdot nm)$ branching algorithm for \textsc{BPD}: For a given instance~$(G,k)$, check in~$\ensuremath{\mathcal{O}}(nm)$ time if~$G$ contains a bi\-colored~$P_3$. If this is not the case, then answer yes. Otherwise, answer no if~$k<1$. If~$k\ge 1$, then compute a bi\-colored~$P_3$~formed by the edges~$e_1$ and~$e_2$ and branch into the cases~$(G-e_1,k-1)$ and~$(G-e_2,k-1)$. Here, we modify the simple algorithm by branching on slightly more complex structures obtaining a running time of~$\ensuremath{\mathcal{O}}(1.84^k \cdot nm)$. Note that by Corollary~\ref{Corollary: ETH lower bounds} a subexponential algorithm in~$k$ is not possible when assuming the ETH.
\begin{figure}
\begin{center}
\begin{tikzpicture}[scale=0.7]
\tikzstyle{knoten}=[circle,fill=white,draw=black,minimum size=5pt,inner sep=0pt]
\tikzstyle{bez}=[inner sep=0pt]
\node[knoten] (u1)[label=above:{$u$}] at (-1,5) {};
\node[knoten] (v1)[label=above:{$v$}] at (0,5) {};
\node[knoten] (w1)[label=above:{$w$}] at (1,5) {};
\node[knoten] (z1)[label=270:{$z$}] at (0,4) {};
\draw[-,color=blue,very thick] (u1) to (v1);
\draw[-,color=myred] (v1) to (w1);
\draw[-,color=blue,very thick] (u1) to (z1);
\draw[-,color=myred] (v1) to (z1);
\draw[-,color=blue,very thick] (w1) to (z1);
\node[knoten] (u2)[label=above:{$u$}] at (5,5) {};
\node[knoten] (v2)[label=above:{$v$}] at (6,5) {};
\node[knoten] (w2)[label=above:{$w$}] at (7,5) {};
\node[knoten] (z2)[label=270:{$z$}] at (6,4) {};
\draw[-,color=blue,very thick] (u2) to (v2);
\draw[-,color=myred] (v2) to (w2);
\draw[-,color=blue,very thick] (u2) to (z2);
\draw[-,color=blue,very thick] (v2) to (z2);
\draw[-,color=myred] (w2) to (z2);
\node[knoten] (u3)[label=above:{$u$}] at (-1,2) {};
\node[knoten] (v3)[label=above:{$v$}] at (0,2) {};
\node[knoten] (w3)[label=above:{$w$}] at (1,2) {};
\node[knoten] (z3)[label=270:{$z$}] at (0,1) {};
\draw[-,color=blue,very thick] (u3) to (v3);
\draw[-,color=myred] (v3) to (w3);
\draw[-,color=myred] (u3) to (z3);
\draw[-,color=blue,very thick] (v3) to (z3);
\draw[-,color=blue,very thick] (w3) to (z3);
\node[knoten] (u4)[label=above:{$u$}] at (5,2) {};
\node[knoten] (v4)[label=above:{$v$}] at (6,2) {};
\node[knoten] (w4)[label=above:{$w$}] at (7,2) {};
\node[knoten] (z41)[label=270:{$z_1$}] at (5.5,1) {};
\node[knoten] (z42)[label=270:{$z_2$}] at (6.5,1) {};
\draw[-,color=blue,very thick] (u4) to (v4);
\draw[-,color=myred] (v4) to (w4);
\draw[-,color=blue,very thick] (u4) to (z41);
\draw[-,color=myred] (v4) to (z41);
\draw[-,color=blue,very thick] (v4) to (z42);
\draw[-,color=myred] (w4) to (z42);
\node[bez] (a) at (-2,4.5) {(a)};
\node[bez] (b) at (4,4.5) {(b)};
\node[bez] (a) at (-2,1.5) {(c)};
\node[bez] (b) at (4,1.5) {(d)};
\end{tikzpicture}
\end{center}
\caption{The graphs used in the proof of Theorem~\ref{Theorem: Branhing Algorithm} (a) LC-Diamond, (b) LO-Diamond, (c) IIZ-Diamond and (d) CC-Hourglass. The names refer to the shapes of the connected components of both colors. Due to symmetry we use the same names if we swap the red and blue colors of the edges in each graph.} \label{Figure: Branching Subgraphs}
\end{figure}
The basic idea of the algorithm is to branch on LC-Diamonds, LO-Diamonds, IIZ-Diamonds and CC-Hourglasses. For the definition of these structures see Figure~\ref{Figure: Branching Subgraphs}. We say that a graph~$G$ is \emph{nice} if~$G$ has none of the structures from Figure~\ref{Figure: Branching Subgraphs} as induced subgraph and every edge of~$G$ forms a bi\-colored~$P_3$~with at most one other edge of~$G$. We give a polynomial-time algorithm that solves \textsc{BPD}~when the input graph is nice. To this end consider the following proposition.
\begin{proposition} \label{Proposition: No more conflicts after branching}
Let~$(G=(V,E_r,E_b),k)$ be an instance of~\textsc{BPD}{} such that~$G$ is nice. Moreover, let~$p$ be the number of~bi\-colored~$P_3$ s in~$G$. Then, for every two edges~$e_1$ and~$e_2$ forming a bi\-colored~$P_3$~in~$G$ there is an edge~$e \in \{e_1,e_2\}$ such that
\begin{enumerate}
\item[a)] $G-e$ contains~$p-1$ bi\-colored~$P_3$ s, and
\item[b)] $G-e$ is nice.
\end{enumerate}
\end{proposition}
\begin{proof} \textit{a)} Let~$e_1:=\{u,v\} \in E_b$ and~$e_2:=\{v,w\} \in E_r$ form a bi\-colored~$P_3$~in~$G$. Note that the number of bi\-colored~$P_3$ s in~$G-e_1$ and~$G-e_2$ is at least~$p-1$ since every edge of~$G$ is part of at most one bi\-colored~$P_3$~since~$G$ is nice. It remains to show that there is an edge~$e \in \{e_1, e_2\}$ such that the number of bi\-colored~$P_3$ s in~$G-e$ is at most~$p-1$. Assume towards a contradiction that there are at least~$p$ bi\-colored~$P_3$ s in~$G-e_1$ and in~$G-e_2$. Then, there exist vertices~$z_1,z_2 \in V$, such that~$\{u,z_1\}$ and~$\{z_1,v\}$ form a bi\-colored~$P_3$~in~$G-e_1$ and also~$\{v,z_2\}$ and~$\{z_2,w\}$ form a bi\-colored~$P_3$~in~$G-e_2$.
First, assume~$z_1 = z_2 =: z$. If~$\{v,z\} \in E_r$, then~$\{u,z\} \in E_b$, $\{w,z\}\in E_b$, and~$G[\{u,v,w,z\}]$ is an LC-Diamond with two red and three blue edges. This contradicts the fact that~$G$ contains no induced LC-Diamond. Analogously, if~$\{v,z\} \in E_b$, then~$G[\{u,v,w,z\}]$ is an LC-Diamond with two blue and three red edges. We conclude~$z_1 \neq z_2$.
Second, assume~$\{v,z_1\} \in E_b$. Then, $\{u,z_1\} \in E_r$. Since every edge of~$G$ is part of at most one~bi\-colored~$P_3$, there is an edge~$\{z_1,w\} \in E$. If~$\{z_1, w\} \in E_r$, then the graph~$G[\{u,v,w,z_1\}]$ is an LC-Diamond. Otherwise, if~$\{z_1,w\} \in E_b$, then the graph~$G[\{u,v,w,z_1\}]$ is an IIZ-Diamond. This contradicts the fact that~$G$ contains no induced LC- or IIZ-Diamond. Therefore,~$\{v,z_1\} \in E_r$. With the same arguments we can show that~$\{v,z_2\} \in E_b$.
From~$\{v,z_1\} \in E_r$ and~$\{v,z_2\} \in E_b$ we conclude~$\{u,z_1\} \in E_b$ and~$\{w,z_2\} \in E_r$. If~$E(\{u,v,w,z_1,z_2\})=\{ \{u,v\}, \{u,z_1\}, \{v,w\},\{v,z_1\},\{v,z_2\},\{w,z_2\}\}=: A$, then the graph~$G[\{u,v,w,z_1,z_2\}]$ is an induced CC-Hourglass which contradicts the fact that~$G$ does not contain induced CC-Hourglasses. Hence, $E(\{u,v,w,z_1,z_2\}) \supsetneq A$. Consider the following cases.
\textbf{Case 1:} $\{u,w\} \in E$. Then~$\{u,v\}$ and~$\{v,w\}$ do not form a bi\-colored~$P_3$, which contradicts the choice of~$\{u,v\}$ and~$\{v,w\}$.
\textbf{Case 2:} $\{z_1,w\} \in E$. If~$\{z_1,w\} \in E_b$, then~$G[\{u,v,w,z_1\}]$ is an induced LC-Diamond. Otherwise, if~$\{z_1,w\} \in E_r$, then~$G[\{u,v,w,z_1\}]$ is an induced LO-Diamond. Both cases contradict the fact that~$G$ is nice.
\textbf{Case 3:} $\{z_2,u\} \in E$. If~$\{z_2,u\} \in E_r$, then~$G[\{u,v,w,z_2\}]$ is an induced LC-Diamond. Otherwise, if~$\{z_1,w\} \in E_b$, then~$G[\{u,v,w,z_2\}]$ is an induced LO-Diamond. Both cases contradict the fact that~$G$ is nice.
\textbf{Case 4:} $\{z_1,z_2\} \in E$. If~$\{z_1,z_2\} \in E_b$, then~$G[\{z_1,z_2,w,v\}]$ is an LC-Diamond. Otherwise, if~$\{z_1,z_2\} \in E_r$, then~$G[\{z_1,z_2,u,v\}]$ is an LC-Diamond. Both cases contradict the fact that~$G$ is nice.
All cases lead to a contradiction. Hence, there exists~$e \in \{e_1, e_2\}$ such that~$G-e$ contains~$p-1$ bi\-colored~$P_3$ s which proves statement a).
\textit{b)} Next, we show that~$G-e$ is nice. From a) and the fact that~$G$ is nice we know that every~bi\-colored~$P_3${} of~$G-e$ is also a~bi\-colored~$P_3${} in~$G$. Hence, the fact that every edge of~$G$ is part of at most one bi\-colored~$P_3$~implies that every edge of~$G-e$ is part of at most one bi\-colored~$P_3$.
First, assume towards a contradiction that~$G-e$ contains an induced LC-, LO- or IIZ-Diamond~$(G-e)[\{u,v,w,z\}]$ as given in Figure~\ref{Figure: Branching Subgraphs}. Since~$G$ contains no such structure, we conclude~$e=\{u,w\}$ and $\{u,v,w,z\}$ is a clique in~$G$. Then, deleting~$e$ from~$G$ produces a new bi\-colored~$P_3$~on edges~$\{u,v\}$ and~$\{v,w\}$ in~$G-e$ which contradicts Statement~a). Therefore,~$G-e$ contains no induced LC-, LO- and IIZ-Diamonds.
Second, assume towards a contradiction that~$G-e$ contains an induced CC-Hour\-glass~$(G-e)[\{u,v,w,z_1,z_2\}]$ as given in Figure~\ref{Figure: Branching Subgraphs}. Then, since~$G$ does not contain an induced CC-Hourglass, both endpoints of~$e$ are elements of~$\{u,v,w,z_1,z_2\}$ and~$G[\{u,v,w,z_1,z_2\}]$ contains exactly seven edges.
\textbf{Case 1:} $e=\{u,w\}$ (or~$e=\{z_1,z_2\}$). Then,~$G-e$ contains the new bi\-colored~$P_3$~formed by the edges~$\{u,v\}$ and~$\{u,w\}$ (by $\{z_1,v\}$ and $\{v,z_2\}$, respectively) which contradicts~a).
\textbf{Case 2:} $e=\{z_1,w\}$. Then, $G[\{u,v,w,z_1\}]$ is an induced LC-Diamond in~$G$ if~$e \in E_b$ and~$G[\{u,v,w,z_1\}]$ is an induced LO-Diamond in~$G$ if~$e \in E_r$ which contradicts the fact that~$G$ has no induced LC-Diamonds and LO-Diamonds.
\textbf{Case 3:} $e=\{z_2,u\}$ Then, $G[\{u,v,w,z_2\}]$ is an induced LO-Diamond in~$G$ if~$e \in E_b$ and~$G[\{u,v,w,z_2\}]$ is an induced LC-Diamond in~$G$ if~$e \in E_r$ which contradicts the fact that~$G$ has no induced LC-Diamonds and LO-Diamonds.
All cases lead to a contradiction and therefore~$G-e$ contains no induced LC-, LO-, IIZ-Diamonds, CC-Hourglasses and every edge of~$G-e$ is part of at most one bi\-colored~$P_3$.
\end{proof}
Proposition~\ref{Proposition: No more conflicts after branching} implies a simple algorithm for \textsc{BPD}~on such graphs.
\begin{corollary} \label{Corollary: Solve after Branching}
Let~$(G,k)$ be an instance of \textsc{BPD}~where~$G$ is nice. Then, we can decide in~$\ensuremath{\mathcal{O}}(nm)$ time whether~$(G,k)$ is a yes- or a no-instance of \textsc{BPD}.
\end{corollary}
\begin{proof}
We solve \textsc{BPD}~with the following algorithm: First, enumerate all bi\-colored~$P_3$ s in $\ensuremath{\mathcal{O}}(nm)$~time. Second, check if there are at most~$k$ bi\-colored~$P_3$ s. If yes,~$(G,k)$ is a yes-instance. Otherwise,~$(G,k)$ is a no-instance.
It remains to show that this algorithm is correct. Assume~$G$ contains~$p$ bi\-colored~$P_3$ s. Since every edge of~$G$ forms a bi\-colored~$P_3$~with at most one other edge, all bi\-colored~$P_3$ s in~$G$ are edge-disjoint. Hence,~$p$ edge deletions are necessary. By Proposition~\ref{Proposition: No more conflicts after branching} a) we can eliminate exactly one bi\-colored~$P_3$~with one edge deletion without producing other bi\-colored~$P_3$ s. By Proposition~\ref{Proposition: No more conflicts after branching} b) this can be done successively with every bi\-colored~$P_3$, since after deleting one of its edges we do not produce LC-, LO-, IIZ-Diamonds, CC-Hourglasses or edges that form a bi\-colored~$P_3$~with more than one other edge. Thus,~$p$ edge deletions are sufficient. Hence, the algorithm is correct.
\end{proof}
Next, we describe how to transform an arbitrary graph~$G$ into a nice graph~$G'$ by branching. To this end consider the following branching rules applied on an instance~$(G,k)$ of \textsc{BPD}.
\begin{branch} \label{BR: eliminate multi pts}
If there are three distinct edges~$e_1, e_2, e_3 \in E_r \cup E_b$ such that~$e_1$ forms a bi\-colored~$P_3$~with~$e_2$ and with $e_3$, then branch into the cases
\begin{enumerate}
\item[•] $I_1:=(G-e_1,k-1)$, and
\item[•] $I_2:=(G-\{e_2, e_3\},k-2)$.
\end{enumerate}
\end{branch}
\begin{lemma}
Branching Rule~\ref{BR: eliminate multi pts} is correct.
\end{lemma}
\begin{proof}
We show that~$(G,k)$ is a yes-instance of \textsc{BPD}~if and only if at least one of the instances~$I_1$ or~$I_2$ is a yes-instance of \textsc{BPD}.
$(\Leftarrow)$ Assume~$I_1$ is a yes-instance or~$I_2$ is a yes-instance. In each branching case~$I_i$ the parameter~$k$ is decreased by the exact amount~$p_i$ of edges deleted from~$G$. Therefore, if some~$I_i$ has a solution of size at most~$k-p_i$, then~$(G,k)$ has a solution.
$(\Rightarrow)$ Let~$S$ be a solution for~$G$. Since~$e_1$ and~$e_2$ form a bi\-colored~$P_3$, at least one of these edges belongs to~$S$. If~$e_1 \in S$, then~$I_1$ is a yes-instance since we can transform~$G-e_1$ into a bi\-colored~$P_3$-free graph by deleting the at most~$k-1$ edges in~$S\setminus \{e_1\}$. Otherwise, if~$e_1 \not \in S$, then~$e_2, e_3 \in S$. Hence, $I_2$ is a yes-instance since we can transform~$G-\{e_2,e_3\}$ into a bi\-colored~$P_3$-free graph by deleting the at most~$k-2$ edges in~$S \setminus \{e_2,e_3\}$.
\end{proof}
\begin{branch} \label{BR: eliminate these crazy diamonds}
If there are vertices~$u,v,w,z \in V$ such that~$G[\{u,v,w,z\}]$ is an LC-Diamond (Figure~\ref{Figure: Branching Subgraphs} (a)) or an LO-Diamond (Figure~\ref{Figure: Branching Subgraphs} (b)) or an IIZ-Diamond (Figure~\ref{Figure: Branching Subgraphs} (c)), then branch into the cases
\begin{enumerate}
\item[•] $I_1:= (G-\{v,w\},k-1)$,
\item[•] $I_2:= (G-\{\{u,v\},\{u,z\}\},k-2)$, and
\item[•] $I_3:= (G-\{\{u,v\},\{v,z\}, \{w,z\}\},k-3)$.
\end{enumerate}
\end{branch}
\begin{lemma}
Branching Rule~\ref{BR: eliminate these crazy diamonds} is correct.
\end{lemma}
\begin{proof}
We show that~$(G,k)$ is a yes-instance of \textsc{BPD}~if and only if at least one of the instances~$I_1$, $I_2$, or~$I_3$ is a yes-instance of \textsc{BPD}.
$(\Leftarrow)$ This direction obviously holds since in every instance~$I_i$ the parameter~$k$ is decreased by the exact amount of edges deleted from~$G$.
$(\Rightarrow)$ Let~$S$ be a solution for~$G$. In LO-Diamonds, LC-Diamonds, and in IIZ-Dia\-monds, the edges~$\{u,v\}$ and~$\{v,w\}$ form a bi\-colored~$P_3$~in~$G$ and therefore~$\{u,v\} \in S$ or~$\{v,w\} \in S$. If~$\{v,w\} \in S$, then~$I_1$ is a yes-instance. Otherwise, if~$\{v,w\} \not \in S$ it follows that~$\{u,v\} \in S$. If~$\{u,z\} \in S$, we have~$\{u,v\},\{u,z\} \in S$ and therefore~$I_2$ is a yes-instance. So we assume~$\{v,w\} \not \in S$, $\{u,v\} \in S$, $\{u,z\} \not \in S$ and consider the following cases.
\textbf{Case 1:} $G[\{u,v,w,z\}]$ is an LC-Diamond. Then, $\{u,z\}$ and~$\{v,z\}$ form a bi\-colored~$P_3$~in~$G-\{u,v\}$. Since~$\{u,z\} \not \in S$, it follows that~$\{v,z\} \in S$. The edges~$\{v,w\}$ and~$\{w,z\}$ form a bi\-colored~$P_3$~in~$G-\{\{u,v\},\{v,z\}\}$ which implies~$\{v,w\} \in S$ or~$\{w,z\} \in S$. If~$\{v,w\} \in S$, then~$I_1$ is a yes-instance. Otherwise, if~$\{w,z\} \in S$, then~$\{u,v\},\{v,z\},\{w,z\} \in S$ and therefore~$I_3$ is a yes-instance.
\textbf{Case 2:} $G[\{u,v,w,z\}]$ is an LO-Diamond. Then, $\{u,z\}$ and~$\{w,z\}$ form a bi\-colored~$P_3$~in~$G-\{u,v\}$. Since~$\{u,z\} \not \in S$, it follows that~$\{w,z\} \in S$. The edges~$\{v,w\}$ and~$\{v,z\}$ form a bi\-colored~$P_3$~in~$G-\{\{u,v\},\{v,z\}\}$ which implies~$\{v,w\} \in S$ or~$\{v,z\} \in S$. If~$\{v,w\} \in S$, then~$I_1$ is a yes-instance. Otherwise, if~$\{v,z\} \in S$, then~$\{u,v\},\{v,z\},\{w,z\} \in S$ and therefore~$I_3$ is a yes-instance.
\textbf{Case 3:} $G[\{u,v,w,z\}]$ is an IIZ-Diamond. Then, $\{u,z\}$ forms a bi\-colored~$P_3$~with~$\{w,z\}$ and with~$\{v,z\}$ in~$G-\{u,v\}$. Since~$\{u,z\} \not \in S$, it follows that~$\{w,z\}, \{v,z\} \in S$ and therefore~$I_3$ is a yes-instance.
\end{proof}
\begin{branch} \label{BR: eliminate CC-Hourglasses}
If there are vertices~$u,v,w,z_1,z_2 \in V$ such that~$G[\{u,v,w,z_1,z_2\}]$ is a CC-Hourglass as given in Figure~\ref{Figure: Branching Subgraphs} (d), then branch into the cases
\begin{enumerate}
\item[•] $I_1:= (G-\{v,w\},k-1)$,
\item[•] $I_2:= (G-\{\{u,v\},\{v,z_1\}\},k-2)$, and
\item[•] $I_3:= (G-\{\{u,v\},\{u,z_1\}, \{v,z_2\}\},k-3)$.
\end{enumerate}
\end{branch}
\begin{lemma}
Branching Rule~\ref{BR: eliminate CC-Hourglasses} is correct.
\end{lemma}
\begin{proof}
We show that~$(G,k)$ is a yes-instance of \textsc{BPD}~if and only if at least one of the instances~$I_1$, $I_2$, or~$I_3$ is a yes-instance of \textsc{BPD}.
$(\Leftarrow)$ This direction obviously holds since in every instance~$I_i$ the parameter~$k$ is decreased by the exact amount of edges deleted from~$G$.
$(\Rightarrow)$ Let~$S$ be a solution for~$G$. The edges~$\{u,v\}$ and~$\{v,w\}$ form a bi\-colored~$P_3$~in~$G$ and~therefore~$\{u,v\} \in S$ or $\{v,w\} \in S$. If~$\{v,w\} \in S$, then~$I_1$ is a yes-instance. Otherwise, if~$\{v,w\} \not \in S$, then~$\{u,v\} \in S$. The edge~$\{v,z_1\}$ forms a bi\-colored~$P_3$~with~$\{u,z_1\}$ and~$\{v,z_2\}$~in~$G-\{u,v\}$. If~$\{v,z_1\} \in S$, then~$I_2$ is a yes-instance. Otherwise, if~$\{v,z_1\} \not \in S$, then~$\{u,z_1\},\{v,z_2\} \in S$. Hence, $I_3$ is a yes-instance.
\end{proof}
We use the Branching Rules \ref{BR: eliminate multi pts}-\ref{BR: eliminate CC-Hourglasses} to state the following theorem.
\begin{theorem}
\textsc{BPD}{} can be solved in~$\ensuremath{\mathcal{O}}(1.84^k\cdot nm)$~time.
\end{theorem}
\begin{proof}
We solve \textsc{BPD}~for an instance~$(G,k)$ as follows: Initially, we compute the adjacency matrix of~$G$ in~$\ensuremath{\mathcal{O}}(n^2)$ time. We then compute one of the structures we branch on, which is an induced LC-Diamond, LO-Diamond, IIZ-Diamond, CC-Hourglass or some edge which forms a bi\-colored~$P_3$~with two other edges. Next, we branch according to the Branching Rules~\ref{BR: eliminate multi pts}, \ref{BR: eliminate these crazy diamonds}, and \ref{BR: eliminate CC-Hourglasses}. If no further branching rule is applicable we check in~$\ensuremath{\mathcal{O}}(nm)$ time whether the remaining instance is a yes-instance or not. This is possible by Corollary~\ref{Corollary: Solve after Branching}. The branching vectors are~$(1,2)$ for Branching Rule~\ref{BR: eliminate multi pts}, and~$(1,2,3)$ for Branching Rules~\ref{BR: eliminate these crazy diamonds} and~\ref{BR: eliminate CC-Hourglasses}. This delivers a branching factor smaller than~$1.8393$. We next describe in detail how we can find one of the structures we branch on, in such a way that the algorithm described above runs in~$\mathcal{O}(1.84^k \cdot nm )$~time
Isolated vertices do not contribute to the solution of the instance. Thus, we delete all isolated vertices in~$\mathcal{O}(n)$ time. Hence we can assume~$n \leq 2m$ in the following. Afterwards, we compute a maximal packing~$\mathcal{P}$ of edge-disjoint~bi\-colored~$P_3$ s. Here, we represent a~bi\-colored~$P_3${} by an edge set of size two. We define~$P := \bigcup_{p \in \mathcal{P}} p$ as the set of all edges of~bi\-colored~$P_3$ s in~$\mathcal{P}$. Note that~$\mathcal{P}$ and thus~$P$ can be found in~$\ensuremath{\mathcal{O}}(n m)$ time by enumerating all~bi\-colored~$P_3$ s in~$G$. If~$|P| > 2k$, the graph~$G$ contains more than~$k$ edge-disjoint bi\-colored~$P_3$ s and~$(G,k)$ is a no instance. In this case we can stop and return no. Otherwise, we have~$|P| \leq 2k$ and use~$P$ to compute the structures we apply Branching Rules~\ref{BR: eliminate multi pts}-\ref{BR: eliminate CC-Hourglasses} on as follows.
Note that in any LC-, LO- or IIZ- Diamond~$G[\{u,v,w,z\}]$ the edges~$\{u,v\}$ and~$\{v,w\}$ form a bi\-colored~$P_3${} in~$G$ and thus, $\{u,v\} \in P$ or~$\{v,w\} \in P$. Therefore, we can find~$G[\{u,v,w,z\}]$ in $\ensuremath{\mathcal{O}}(km)$ time by iterating over all possible tuples~$(e_1,e_2)$ with~$e_1 \in P$ and $e_2 \in E$ and then check with the adjacency matrix in~$\ensuremath{\mathcal{O}}(1)$ time if the induced subgraph~$G[e_1 \cup e_2]$ is an LC-, LO- or IIZ- Diamond.
Furthermore, note that any CC-Hourglass~$G[\{u,v,w,z_1,z_2\}]$ contains two edge-disjoint bi\-colored~$P_3$ s~$\{\{u,v\}, \{v,w\}\}$ and~$\{\{z_1,v\},\{v,z_2\}\}$. Thus, at least two edges of~$G[\{u,v,w,z_1,z_2\}]$ are elements of~$P$. Therefore, we can find~$G[\{u,v,w,z_1,z_2\}]$ in~$\ensuremath{\mathcal{O}}(k^2n^2)$ time by iterating over all possible tuples~$(e_1,e_2,x,y)$ with~$e_1, e_2 \in P$ and~$x,y \in V$ and then check with the adjacency matrix in~$\ensuremath{\mathcal{O}}(1)$ time if the induced subgraph~$G[e_1 \cup e_2 \cup \{x,y\}]$ is a CC-Hourglass.
Finally, let~$e_1$ be an edge that forms two~bi\-colored~$P_3$ s with other edges~$e_2$ and~$e_3$. Again, at least one of the edges~$e_1, e_2$, or~$e_3$ is an element of~$P$. Thus, we can find~$e_1$, $e_2$, and~$e_3$ in~$\ensuremath{\mathcal{O}}(kn^2)$ time iterating over all triples containing an edge from~$P$ and two vertices from~$V$, which form the remaining two endpoints.
Since $n \leq 2m$ we can find one of the structures on which we apply Branching Rules~\ref{BR: eliminate multi pts}-\ref{BR: eliminate CC-Hourglasses} in~$\ensuremath{\mathcal{O}}(k^2 nm)$ time. This gives us a total running time of~$\ensuremath{\mathcal{O}}(1.8393^k \cdot k^2 nm) \subseteq \ensuremath{\mathcal{O}}(1.84^k \cdot nm)$ time as claimed.
\end{proof}
Note that it is possible to improve the branching rules on LO-Diamonds, IIZ-Diamonds, and CC-Hourglasses to obtain a branching vector~$(2,2,3,3)$, but then, branching on LC-Diamonds still needs a branching vector of~$(1,2,3)$, which is the bottleneck. To put the running time of Theorem~\ref{Theorem: Branhing Algorithm} into perspective note that \textsc{Cluster Deletion}, which can be viewed as the uncolored version of \textsc{BPD}, can be solved in~$\ensuremath{\mathcal{O}}(1.42^k+m)$ time \cite{BD11}. Thus there is a large gap between the running time bounds of the problems. It would be interesting to know if this gap can be closed or if \textsc{BPD}~is significantly harder than \textsc{Cluster Deletion}.
\subsection{On Problem Kernelization} In this paragraph we consider problem kernelization for \textsc{BPD}~parameterized by~$(k,\Delta)$ and~$\ell:=m-k$. We show that \textsc{BPD}~admits problem kernels with~$\ensuremath{\mathcal{O}}(k\Delta\min(k,\Delta))$~vertices or at most~$2\ell$ edges, respectively.
In the following, we provide two reduction rules leading to an~$\ensuremath{\mathcal{O}}(k\Delta\min(k,\Delta))$ vertex kernel for \textsc{BPD}. The first reduction rule deletes all edges which form more than~$k$ bi\-colored~$P_3$ s.
\begin{reduc}
\label{reduc:edge-in-too-many-conflicts}
If~$G$ contains an edge~$\{ u,v\}$ such that there exist vertices~$w_1,\ldots ,w_t$ with~$t >k$ such that~$G[\{ u,v,w_i\}]$ is a bi\-colored~$P_3$~for each~$i$, then remove~$\{ u,v\}$ and decrease~$k$ by one.
\end{reduc}
\begin{lemma}
Reduction Rule~\ref{reduc:edge-in-too-many-conflicts} is correct and can be applied exhaustively in~$\ensuremath{\mathcal{O}}(nm)$~time.
\end{lemma}
\begin{proof}
First, we prove the correctness of Reduction Rule~\ref{reduc:edge-in-too-many-conflicts}. Let~$S$ be a solution for~$(G,k)$. Without loss of generality, consider an edge~$\{ u,v\}\in E_r$ such that there exist vertices~$w_1, \ldots , w_t$ such that for each~$i$ the graph~$G[\{ u,v,w_i\}]$ is a bi\-colored~$P_3$. At least one edge of each bi\-colored~$P_3$,~$G[\{ u,v,w_i\}]$ is an element of~$S$. Assume towards a contradiction~$\{ u,v\}\notin S$. In each bi\-colored~$P_3$,~$G[\{ u,v,w_i\}]$ the blue edge~$\{ v, w_i\}$ has to be removed. In other words,~$\{\{ v,w_i\}|1\le i\le t\}\subseteq S$. Since~$t >k$,~$|S|>k$, a contradiction to~$|S|\le k$. Hence,~$\{ u,v\}\in S$ and~$S\setminus\{\{ u,v\}\}$ is a solution for~$(G-\{ u,v\}, k-1)$. For the opposite direction, if~$S$ is a solution for~$(G-\{ u,v\}, k-1)$ then~$S\cup\{\{ u,v\}\}$ is is a solution for~$(G,k)$.
Second, we bound the running time of applying Reduction Rule~\ref{reduc:edge-in-too-many-conflicts} exhaustively. In a first step, for each edge~$e\in E$ compute the number of bi\-colored~$P_3$ s containing~$e$. This can be done in~$\ensuremath{\mathcal{O}}(nm)$~time. In a second step, check if an edge~$e=\{ u,v\}$ is part of more than~$k$ bi\-colored~$P_3$ s and remove~$e$ if this is the case. After the removal of~$e$, every new bi\-colored~$P_3$~contains vertices~$u$ and~$v$. Hence, for each remaining vertex~$w\in V$, check if~$G[\{u,v,w\}]$ is a new bi\-colored~$P_3$~in~$G-\{ u,v\}$. If yes, then update the number of bi\-colored~$P_3$ s for edges~$\{ u,w\}$ and~$\{ v,w\}$. This can be done in~$\ensuremath{\mathcal{O}}(n)$ time.
Since~$k<m$, the overall running time of Reduction Rule~\ref{reduc:edge-in-too-many-conflicts} is~$\ensuremath{\mathcal{O}}(nm)$.
\end{proof}
Let~$\mathcal{P}$ denote the set of all vertices of~$G$ which are part of bi\-colored~$P_3$ s. Then, the set~$N[\mathcal{P}]$ contains all vertices which are either part of a bi\-colored~$P_3$~or which are adjacent to a vertex in a bi\-colored~$P_3$. In other words, a vertex~$v$ is contained in~$V\setminus N[\mathcal{P}]$ if and only if each vertex~$u\in N[v]$ is not part of any bi\-colored~$P_3$ . In the following, we present a reduction rule to remove all vertices in~$V\setminus N[\mathcal{P}]$.
\begin{reduc}
\label{reduc:edge-deletions-no-second-neighborhood}
If~$G$ contains a vertex~$v\in V$ such that each vertex~$u\in N[v]$ is not part of any bi\-colored~$P_3$. Then, remove~$v$ from~$G$.
\end{reduc}
\begin{lemma}
Reduction Rule~\ref{reduc:edge-deletions-no-second-neighborhood} is correct and can be applied exhaustively in~$\ensuremath{\mathcal{O}}(nm)$~time.
\end{lemma}
\begin{proof}
Let~$H:=G[V\setminus\{ v\}]$. We prove that there exists a solution~$S$ for~$(G,k)$ if and only if~$S$ is also a solution for~$(H,k)$.
$(\Rightarrow )$ Let~$S$ be a solution for~$(G,k)$. Since~$H$ is an induced subgraph of~$G$,~$S\cap E(H)$ is a solution for~$(H,k)$.
$(\Leftarrow )$ Let~$S$ be a solution for~$(H,k)$ of minimum size. If~$S=\emptyset$,~$S$ is also a solution for~$(G,k)$. Thus, in the following we assume that~$S\neq\emptyset$. Assume towards a contradiction, that~$G-S$ is not bi\-colored~$P_3$-free. Then, each bi\-colored~$P_3$~in~$G-S$ has to contain vertex~$v$. Since vertex~$v$ is not part of any bi\-colored~$P_3$~in~$G$, the set~$S$ contains at least one edge deletion~$\{ u, w\}$ such that~$G[\{ u,v,w\}]$ is an induced bi\-colored~$P_3$~in~$G-\{u,w\}$. We will use the following claim to obtain a contradiction.
\begin{claim} \label{claim:deletion-sequence}
There exists an ordering~$(e_1, \ldots , e_{|S|})$ of~$S$ such that for each~$i$ the edge~$e_i$ is part of a bi\-colored~$P_3$~in~$G-\{ e_1, \ldots , e_{i-1}\}$.
\end{claim}
\begin{claimproof}
Assume towards a contradiction that such an ordering does not exist. Since for all~$S'\subsetneq S$ the graph~$H-S'$ contains a~bi\-colored~$P_3$, the set~$S$ is not empty. Thus there exists a maximal index~$1\le i<|S|$ such that there is a finite sequence~$(e_1, \ldots , e_i)$ of elements of~$S$ where for each~$j$ the edge~$e_j$ is part of a bi\-colored~$P_3$~in~$G-\{ e_1, \ldots , e_{j-1}\}$. According to our choice of~$i$, there exists no edge of~$S$ which is part of a bi\-colored~$P_3$~in~$G-\{ e_1, \ldots , e_i\}$. If~$G-\{ e_1, \ldots , e_i\}$ contains a bi\-colored~$P_3${} formed by~$\{x,y\}$ and~$\{y,z\}$, then~$\{ x,y\}\in S$ or~$\{y,z\}\in S$. This contradicts the fact that no edge of~$S$ is part of a bi\-colored~$P_3$~in~$G-\{ e_1, \ldots , e_i\}$. Otherwise,~$G-\{ e_1, \ldots , e_i\}$ is bi\-colored~$P_3$-free. Then,~$\{e_1, \ldots , e_i\}$ is a solution for~$(H,k)$. This contradicts the fact that no~$S'\subsetneq S$ is a solution for~$(H,k)$.
$\hfill \Diamond$
\end{claimproof}
Recall that there exists an edge deletion~$\{ u,w\}$ in~$S$ such that~$G[\{ u,v,w\}]$ is an induced bi\-colored~$P_3$~and that~$v$ is not part of any bi\-colored~$P_3$~in~$G$. According to Claim~\ref{claim:deletion-sequence} there exists an ordering~$F=(e_1, \ldots , e_{|S|})$ of edge deletions such that for each~$i$ the edge~$e_i$ is part of a bi\-colored~$P_3$~in~$G-\{ e_{1}, \ldots , e_{i-1}\}$. Let~$W\subseteq N_G(v)$ be the set of neighbors of~$v$ which are incident with an edge deletion in~$S$. Let~$t$,~$1\le t\le |S|$, be the minimum index such that~$e_t$ is incident with a vertex in~$N_G(v)$. Then~$e_t=\{ w,z\}$ where~$w\in N(v)$.
Intuitively, edge~$e_{t}$ is the first edge deletion incident with a neighbor~$w$ of~$v$. Observe that~$z\in N_G^2(v)$ since no vertex of~$N_G(v)$ is part of any bi\-colored~$P_3$~in~$G$.
Without loss of generality assume that the edge~$\{ v,w\}$ is red. The edge~$\{ w,z\}$ is red since otherwise~$G[\{ v,w,z\}]$ is a bi\-colored~$P_3$~in~$G$. According to Claim~\ref{claim:deletion-sequence}, the edge~$\{ w,z\}$ is part of a bi\-colored~$P_3$~in~$G-\{ e_1, \ldots , e_{t-1}\}$. Hence, there exists a vertex~$y\in V$ with~$y\neq v$ such that~$G[\{ w,y,z\}]$ is a bi\-colored~$P_3$~in~$G-\{ e_1, \ldots , e_{t-1}\}$. Moreover,~$\{w,z\}$ is the red edge and~$\{ w,y\}$ is the blue edge of this bi\-colored~$P_3$. First, assume~$y\in N_G(v)$. According to our assumption that no vertex in~$N_G[v]$ is part of a~bi\-colored~$P_3$~in~$G$, vertex~$y$ is not part of a bi\-colored~$P_3$~in~$G$. Hence, in the ordering~$F$ there exists a minimal index~$j$ such that the edge~$e_j$ is the first edge deletion incident with vertex~$y$. Since~$G[\{ w,y,z\}]$ is an induced bi\-colored~$P_3$~in~$G-\{ e_1, \ldots , e_{t-1}\}$, we conclude~$j<t$. Since we assumed~$y\in N_G[v]$, this contradicts the minimality of~$t$. Second, assume~$y\in N_G^2(v)$. Since all edges between~$w$ and~$N_G^2(v)\cap N_G(w)$ are red, the edge~$\{ w,y\}$ is red. Since~$G[\{ w,y,z\}]$ is an induced bi\-colored~$P_3$~in~$G-\{ e_1, \ldots , e_{t-1}\}$ the edge~$\{ w,y\}$ is contained in~$S$. This contradicts the choice of~$t$. Hence, vertex~$v$ is not incident with an edge deletion. Third, assume towards a contradiction~$y\in V\setminus(N[v]\cup N^2(v))$. Since~$w\in N(v)$, we observe~$\{ w,y\}\notin E$. Recall that~$G[{w,y,z}]$ is a bi\-colored~$P_3$~in~$G-\{e_1, \ldots, e_t\}$. Hence~$\{w,z\}$ and~$\{y,z\}$ form a bi\-colored~$P_3$~in~$G-\{e_1, \ldots, e_t\}$. Since~$w$ is not contained in any bi\-colored~$P_3$~in~$G-\{ e_1, \ldots, e_t\}$,~$\{ w,y\}\in E$, a contradiction to~$y\notin V\setminus(N[v]\cup N^2(v))$.
Next, consider the running time of applying Reduction Rule~\ref{reduc:edge-deletions-no-second-neighborhood} exhaustively. In a first step, determine all bi\-colored~$P_3$ s in~$G$. Afterwards, determine for each vertex~$v\in V$ if~$v$ is part of some bi\-colored~$P_3$. This needs~$\ensuremath{\mathcal{O}}(nm)$~time. Now, check for each vertex~$v\in V$ if each vertex~$u\in N[v]$ is not part of any bi\-colored~$P_3$. This can be done in~$\ensuremath{\mathcal{O}}(m)$~time. The claimed running time follows.
\end{proof}
\begin{theorem}
\label{theo:k2delta-kernel-bip3del}
\textsc{BPD}~admits a~$\ensuremath{\mathcal{O}}(k\Delta\min(k,\Delta))$-vertex kernel that can be computed in~$\mathcal{O}(nm)$~time.
\end{theorem}
\begin{proof}
First, apply Reduction Rule~\ref{reduc:edge-in-too-many-conflicts} exhaustively. Second, apply Reduction Rule~\ref{reduc:edge-deletions-no-second-neighborhood} exhaustively. This needs~$\ensuremath{\mathcal{O}}(nm)$~time altogether. We prove that~$(G,k)$ is a yes-instance if~$G$ contains at most~$\ensuremath{\mathcal{O}}(k\Delta\min(k,\Delta))$ vertices. Let~$\mathcal{P}$ be the set of vertices which are contained in a bi\-colored~$P_3$~in~$G$, and let~$P$ be a maximal set of edge-disjoint bi\-colored~$P_3$ s in~$G$. If~$(G,k)$ is a yes-instance for \textsc{BPD}, then~$|P|\le k$. Since Reduction Rule~\ref{reduc:edge-in-too-many-conflicts} was applied exhaustively, each edge is contained in at most~$\min(k,2\Delta)$ bi\-colored~$P_3$ s. Hence, the total number of bi\-colored~$P_3$ s in~$G$ is at most $2k\min(k,2\Delta)$. Consequently,~$|\mathcal{P}|\le 6k\min(k,2\Delta)$. Since Reduction Rule~\ref{reduc:edge-deletions-no-second-neighborhood} was applied exhaustively,~$V\setminus N[\mathcal{P}]=\emptyset$. In other words, set~$\mathcal{P}$ has no second neighborhood in~$G$. Since each vertex has degree at most~$\Delta$ we have $|{N}(\mathcal{P})|\le 6k\Delta\min(k,2\Delta)$. Hence, the overall number of vertices in~$G$ is~$\ensuremath{\mathcal{O}}(k\Delta\min(k,\Delta))$ if~$(G,k)$ is a yes-instance for \textsc{BPD}.
\end{proof}
By the above, \textsc{BPD}~admits a linear problem kernel in~$k$, if~$G$ has constant maximum degree.
Note that a kernelization by~$\Delta$ alone is unlikely since \textsc{BPD}~is NP-hard even if~$\Delta=8$ by Theorem~\ref{Theorem: NP-h}. Since \textsc{BPD}~is fixed-parameter tractable with respect to parameter~$k$, we can trivially conclude that it admits an exponential-size problem kernel. It is open if there is a polynomial kernel depending only on~$k$ while \textsc{Cluster Deletion} has a relatively simple~$4k$-vertex kernel \cite{Guo09}. Summarizing, \textsc{BPD}~seems to be somewhat harder than \textsc{Cluster Deletion} if parameterized by~$k$.
In contrast, \textsc{BPD}~seems to be easier than \textsc{Cluster Deletion} if parameterized by the dual parameter~$\ell:=m-k$: there is little hope that \textsc{Cluster Deletion} admits a problem kernel of size~$\ell^{\ensuremath{\mathcal{O}}(1)}$~\cite{GK18} while \textsc{BPD}{} has a trivial linear-size problem
kernel as we show below.
\begin{theorem} \label{Theorem: Branhing Algorithm}
\textsc{BPD}{} admits a problem kernel with~$2\ell$ edges and~vertices which can be computed in~$\ensuremath{\mathcal{O}}(n+m)$ time.
\end{theorem}
\begin{proof}
We show that instances with at least~$2\ell$ edges are trivial yes-instances. Let~$(G=(V,E_r,E_b),k)$ with~$|E| \geq 2\ell$ be an instance of \textsc{BPD}. Then, since~$E_r$ and~$E_b$ form a partition of~$E$, we have~$|E_r| \geq \ell$ or~$|E_b| \geq \ell$. Without loss of generality let~$|E_r| \geq \ell$. Since~$|E_b| = m - |E_r| \leq m - \ell = k$,~$E_b$ is a solution for~$(G,k)$.
\end{proof}
\section{Outlook}
We have left open many questions for future work. First, it would be interesting to further
investigate the structure of bi\-colored~$P_3${}-free graphs. Since each color class may
induce an arbitrary graph it seems difficult to obtain a concise and non-trivial structural
characterization of these graphs. One may, however, exploit the connection with Gallai
colorings which are colorings where no triangle receives more than two colors. In particular, the following characterization of Gallai colorings is known~\cite{Gal67,GS04}: any Gallai
coloring of a complete graph can be obtained by taking some complete 2-colored graph and substituting its vertices with a complete graph and some Gallai
coloring of this complete graph. This characterization relies on the
decomposition property that in any Gallai coloring of a complete graph~$G$ with at least three
colors, there is at least one edge color that spans a disconnected graph~$H$. Then, by the
property of Gallai colorings, the edges in~$G$ that are between two different components~$H_1$
and~$H_2$ of~$H$ have the same color.
Second, there are many open questions concerning \textsc{Bicolored~$P_3${} Deletion}. Does \textsc{Bicolored~$P_3${} Deletion} admit a polynomial-size kernel for~$k$? Can \textsc{Bicolored~$P_3${}
Deletion} be solved in~$2^{\ensuremath{\mathcal{O}}(n)}$ time? Can \textsc{Bicolored~$P_3${} Deletion} be solved in
polynomial time on graphs that contain no monochromatic~$P_3$? Can \textsc{Bicolored~$P_3${}
Deletion} be solved in polynomial time on graphs that contain no cycle consisting only
of blue edges? Even simpler is the following question: Can \textsc{Bicolored~$P_3${} Deletion} be
solved in polynomial time if the subgraph induced by the red edges and the subgraph induced by the blue edges are each a disjoint union of paths?
Moreover, it would be interesting to perform a similar study on \textsc{Bicolored~$P_3${} Editing} where we
may also insert blue and red edges.
Third, it would also be interesting identify graph problems that are NP-hard on general
two-edge colored graphs but polynomial-time solvable on bi\-colored~$P_3${}-free graphs.
Finally, we were not able to resolve the following question: Can we find bi\-colored~$P_3${}s in~$\ensuremath{\mathcal{O}}(n+m)$ time?
Using the connection to Gallai colorings and the decomposition property of Gallai colorings seems to be a
promising approach to address these open question.
\medskip
\noindent \emph{Acknowledgments.} We would like to thank Michał Pilipczuk (University of Warsaw) for
pointing out the connection to Gallai colorings and their characterization.
| {'timestamp': '2020-02-12T02:15:23', 'yymm': '1901', 'arxiv_id': '1901.03627', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03627'} | arxiv |
\section{Supplementary Material}
We first explain the hyper-parameters and then provide full experimental results on all three datasets.
\subsection{Hyperparameters}
For all our experiments, we exploit a $1500$-iteration warm-up phase where the learning rate gradually increases from $0.002$ to $0.02$.
We also initialize all models with ImageNet pre-trained weights released by MSRA~\footnote{https://github.com/KaimingHe/deep-residual-networks}.
\vspace{-0.25cm}
\paragraph{COCO:}
We resize the image such that the length of the shorter edge is $800$ and the length of the longer edge does not exceed $1333$.
We do not utilize multi-scale training.
For testing, we feed multi-scale images for all models.
Specifically, we resize the images to multiple scales of which the shorter edge equals to $\{480, 544, 608, 672, 736, 800, 864, 928, 992, 1056, 1120\}$ respectively.
We also add left-right flipping.
Finally, we average the semantic segmentation logits under different scales.
For PSPNet, we do sliding window test with $513 \times 513$ cropped image.
\vspace{-0.25cm}
\paragraph{Cityscapes:}
We do multi-scale training where we resize the input image in a way that the length of the shorter edge is randomly sampled from $[800, 1024]$.
For multi-scale testing, we use the same protocol as COCO except the set of scales is $\{704, 768, 832, 896, 960, 1024, 1088, 1152, 1216, 1280, 1344\}$.
For PSPNet, we do sliding window test with $713 \times 713$ cropped image.
\vspace{-0.25cm}
\paragraph{Our Dataset:}
We utilize multi-scale training where the length of the shorter edge is randomly sampled from $[800, 1200]$.
We do not perform multi-scale testing.
\subsection{Full Experimental Results}
We show the full experimental results including run time in Table~\ref{table:coco}, Table~\ref{table:cityscapes} and Table~\ref{table:our_dataset}.
We also add two more variants of our model as baselines, \ie, UPSNet-C and UPSNet-CP.
UPSNet-C is UPSNet without the panoptic head.
We train it with just semantic and instance segmentation losses.
During test, we use the same combine heuristics as in~\cite{kirillov2018panoptic} to generate the final prediction.
UPSNet-CP has the same model as UPSNet.
We train it in the same way as UPSNet as well.
During test, we use the same combine heuristics as in~\cite{kirillov2018panoptic} to generate the final prediction.
\begin{table*}[t]
\centering
\setlength{\tabcolsep}{3pt}
\begin{tabular}{@{}c|ccc|ccc|ccc|cccc@{}}
\hline
\toprule
Models & PQ & SQ & RQ & $\text{PQ}^{\text{Th}}$ & $\text{SQ}^{\text{Th}}$ & $\text{RQ}^{\text{Th}}$ & $\text{PQ}^{\text{St}}$ & $\text{SQ}^{\text{St}}$ & $\text{RQ}^{\text{St}}$ & mIoU & $\text{AP}^{\text{box}}$ & $\text{AP}^{\text{mask}}$ & Run Time (ms) \\
\midrule
\midrule
JSIS-Net~\cite{de2018panoptic} & 26.9 & 72.4 & 35.7 & 29.3 & 72.1 & 39.2 & 23.3 & 73.0 & 30.4 & - & - & - & - \\
RN50-MR-CNN & 38.6 & 76.4 & 47.5 & 46.2 & 80.2 & 56.2 & 27.1 & 70.8 & 34.5 & - & - & - & - \\
MR-CNN-PSP & 41.8 & 78.4 & 51.3 & 47.8 & 81.3 & 58.0 & 32.8 & 74.1 & 41.1 & 53.9 & 38.1 & 34.2 & 186 \\
{UPSNet}-C & 41.5 & 79.1 & 50.9 & 47.5 & 81.2 & 57.7 & 32.6 & \textbf{76.1} & 40.6 & \textbf{54.5} & \textbf{38.2} & \textbf{34.4} & 153 \\
{UPSNet}-CP & 41.5 & \textbf{79.2} & 50.8 & 47.3 & \textbf{81.3} & 57.4 & 32.8 & 76.0 & 40.9 & 54.3 & 37.8 & 34.3 & $\ast$ \\
{UPSNet} & \textbf{42.5} & 78.0 & \textbf{52.5} & \textbf{48.6} & 79.4 & \textbf{59.6} & \textbf{33.4} & 75.9 & \textbf{41.7} & 54.3 & 37.8 & 34.3 & 167 \\
\toprule
Multi-scale & PQ & SQ & RQ & $\text{PQ}^{\text{Th}}$ & $\text{SQ}^{\text{Th}}$ & $\text{RQ}^{\text{Th}}$ & $\text{PQ}^{\text{St}}$ & $\text{SQ}^{\text{St}}$ & $\text{RQ}^{\text{St}}$ & mIoU & $\text{AP}^{\text{box}}$ & $\text{AP}^{\text{mask}}$ & Run Time (ms) \\
\midrule
\midrule
MR-CNN-PSP-M & 42.2 & 78.5 & 51.7 & 47.8 & \textbf{81.3} & 58.0 & 33.8 & 74.3 & 42.2 & 55.3 & \textbf{38.1} & 34.2 & 3,624 \\
UPSNet-M & \textbf{43.0} & \textbf{79.1} & \textbf{52.8} & \textbf{48.9} & 79.7 & \textbf{59.7} & \textbf{34.1} & \textbf{78.2} & \textbf{42.3} & \textbf{55.7} & 37.8 & \textbf{34.3} & 2,433 \\
\bottomrule
\end{tabular}
\caption{Panoptic segmentation results on COCO. Superscripts \text{Th} and \text{St} stand for thing and stuff. `-` means inapplicable. `$\ast$` means the run time of {UPSNet}-CP is the same with the one of {UPSNet}-C.}
\label{table:coco}
\end{table*}
\begin{table*}[t]
\centering
\setlength{\tabcolsep}{3pt}
\begin{tabular}{@{}c|ccc|ccc|ccc|cccc@{}}
\hline
\toprule
Models & PQ & SQ & RQ & $\text{PQ}^{\text{Th}}$ & $\text{SQ}^{\text{Th}}$ & $\text{RQ}^{\text{Th}}$ & $\text{PQ}^{\text{St}}$ & $\text{SQ}^{\text{St}}$ & $\text{RQ}^{\text{St}}$ & mIoU & $\text{AP}^{\text{box}}$ & $\text{AP}^{\text{mask}}$ & Run Time (ms) \\
\midrule
\midrule
Li \textit{et al.}~\cite{li2018weakly} & 53.8 & - & - & 42.5 & - & - & 62.1 & - & - & 71.6 & - & 28.6 & - \\
MR-CNN-PSP & 58.0 & 79.2 & 71.8 & 52.3 & 77.9 & 66.9 & 62.2 & 80.1 & 75.4 & 75.2 & 37.7 & 32.8 & 583 \\
{UPSNet}-C & 58.1 & 79.0 & 72.0 & 52.2 & 78.0 & 66.6 & 62.3 & 79.8 & 75.9 & \textbf{75.3} & 37.9 & 33.2 & 198 \\
{UPSNet}-CP & 58.7 & 79.1 & 72.8 & 53.1 & 77.7 & 68.1 & 62.7 & 80.0 & \textbf{76.3} & 75.2 & 39.1 & 33.3 & $\ast$ \\
{UPSNet} & \textbf{59.3} & \textbf{79.7} & \textbf{73.0} & \textbf{54.6} & \textbf{79.3} & \textbf{68.7} & \textbf{62.7} & \textbf{80.1} & 76.2 & 75.2 & \textbf{39.1} & \textbf{33.3} & 202 \\
\toprule
Multi-scale & PQ & SQ & RQ & $\text{PQ}^{\text{Th}}$ & $\text{SQ}^{\text{Th}}$ & $\text{RQ}^{\text{Th}}$ & $\text{PQ}^{\text{St}}$ & $\text{SQ}^{\text{St}}$ & $\text{RQ}^{\text{St}}$ & mIoU & $\text{AP}^{\text{box}}$ & $\text{AP}^{\text{mask}}$ & Run Time (ms) \\
\midrule
\midrule
Kirillov \textit{et al.}~\cite{kirillov2018panoptic} & 61.2 & 80.9 & 74.4 & 54.0 & - & - & \textbf{66.4} & - & - & \textbf{80.9} & - & 36.4 & \\
MR-CNN-PSP-M & 59.2 & 79.7 & 73.0 & 52.3 & 77.9 & 66.9 & 64.2 & 81.0 & 77.4 & 76.9 & 37.7 & 32.8 & 18,063 \\
UPSNet-50-M & 60.1 & 80.3 & 73.6 & 54.9 & 79.5 & 68.9 & 63.7 & 80.8 & 76.9 & 76.8 & 39.1 & 33.3 & 2,607 \\
UPSNet-101-M & \textbf{61.8} & \textbf{81.3} & \textbf{74.8} & \textbf{57.6} & \textbf{81.3} & \textbf{70.5} & 64.8 & \textbf{81.4} & \textbf{77.8} & 79.2 & \textbf{43.9} & \textbf{39.0} & 4,126 \\
\bottomrule
\end{tabular}
\caption{Panoptic segmentation results on Cityscapes.}
\label{table:cityscapes}
\end{table*}
\begin{table*}[t]
\centering
\setlength{\tabcolsep}{3pt}
\begin{tabular}{@{}c|ccc|ccc|ccc|cccc@{}}
\hline
\toprule
Models & PQ & SQ & RQ & $\text{PQ}^{\text{Th}}$ & $\text{SQ}^{\text{Th}}$ & $\text{RQ}^{\text{Th}}$ & $\text{PQ}^{\text{St}}$ & $\text{SQ}^{\text{St}}$ & $\text{RQ}^{\text{St}}$ & mIoU & $\text{AP}^{\text{box}}$ & $\text{AP}^{\text{mask}}$ & Run Time \\
\midrule
\midrule
MR-CNN-PSP & 45.5 & 77.1 & 57.6 & 40.1 & 77.2 & 52.1 & 48.7 & \textbf{77.1} & 60.9 & 70.5 & 32.2 & 29.6 & 598 \\
{UPSNet}-C & 46.4 & 76.7 & 58.8 & 43.1 & 77.2 & 55.4 & 48.3 & 76.4 & 60.8 & 70.6 & 33.0 & \textbf{30.5} & 224\\
{UPSNet}-CP & 46.7 & 76.8 & 59.1 & 42.9 & 77.1 & 55.1 & 48.9 & 76.7 & 61.5 & 70.8 & 33.2 & 30.4 & $\ast$\\
{UPSNet} & \textbf{47.1} & \textbf{77.1} & \textbf{59.4} & \textbf{43.8} & \textbf{77.7} & \textbf{55.5} & \textbf{49.0} & 76.7 & \textbf{61.7} & \textbf{70.8} & \textbf{33.2} & 30.4 & 225 \\
\bottomrule
\end{tabular}
\caption{Panoptic segmentation results on our dataset.}
\label{table:our_dataset}
\end{table*}
\subsection{Visual Examples}
We show more visual examples of our panoptic segmentation on COCO, Cityscapes and our dataset in Fig. \ref{fig:results_coco}, Fig. \ref{fig:results_cityscapes} and Fig. \ref{fig:results_ours} respectively.
\begin{figure*}
\centering
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/image/coco_3.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/gt/coco_3.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/combined/coco_3.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/upsnet/coco_3.png}} \\
\vspace{-0.35cm}
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/image/coco_4.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/gt/coco_4.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/combined/coco_4.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/upsnet/coco_4.png}} \\
\vspace{-0.35cm}
\subfloat[Image]{\includegraphics[width = .249\linewidth]{imgs/vis/image/coco_5.png}} \hfill
\subfloat[Ground truth]{\includegraphics[width = .249\linewidth]{imgs/vis/gt/coco_5.png}} \hfill
\subfloat[Combined method~\cite{kirillov2018panoptic}]{\includegraphics[width = .249\linewidth]{imgs/vis/combined/coco_5.png}} \hfill
\subfloat[Ours]{\includegraphics[width = .249\linewidth]{imgs/vis/upsnet/coco_5.png}} \\
\caption{Visual examples of panoptic segmentation on COCO.}
\label{fig:results_coco}
\end{figure*}
\begin{figure*}
\centering
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/image/cityscapes_2_small.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/gt/cityscapes_2.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/combined/cityscapes_2.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/upsnet/cityscapes_2.png}} \\
\vspace{-0.35cm}
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/image/cityscapes_3_small.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/gt/cityscapes_3.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/combined/cityscapes_3.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/upsnet/cityscapes_3.png}} \\
\vspace{-0.35cm}
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/image/cityscapes_5_small.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/gt/cityscapes_5.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/combined/cityscapes_5.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/upsnet/cityscapes_5.png}} \\
\vspace{-0.35cm}
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/image/cityscapes_6_small.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/gt/cityscapes_6.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/combined/cityscapes_6.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/upsnet/cityscapes_6.png}} \\
\vspace{-0.35cm}
\subfloat[Image]{\includegraphics[width = .249\linewidth]{imgs/vis/image/cityscapes_7_small.png}} \hfill
\subfloat[Ground truth]{\includegraphics[width = .249\linewidth]{imgs/vis/gt/cityscapes_7.png}} \hfill
\subfloat[Combined method~\cite{kirillov2018panoptic}]{\includegraphics[width = .249\linewidth]{imgs/vis/combined/cityscapes_7.png}} \hfill
\subfloat[Ours]{\includegraphics[width = .249\linewidth]{imgs/vis/upsnet/cityscapes_7.png}} \\
\caption{Visual examples of panoptic segmentation on Cityscapes.}
\label{fig:results_cityscapes}
\end{figure*}
\begin{figure*}
\centering
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/image/ours_2_small.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/gt/ours_2.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/combined/ours_2.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/upsnet/ours_2.png}} \\
\vspace{-0.35cm}
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/image/ours_3_small.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/gt/ours_3.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/combined/ours_3.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/upsnet/ours_3.png}} \\
\vspace{-0.35cm}
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/image/ours_4_small.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/gt/ours_4.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/combined/ours_4.png}} \hfill
\subfloat{\includegraphics[width = .249\linewidth]{imgs/vis/upsnet/ours_4.png}} \\
\vspace{-0.35cm}
\subfloat[Image]{\includegraphics[width = .249\linewidth]{imgs/vis/image/ours_5_small.png}} \hfill
\subfloat[Ground truth]{\includegraphics[width = .249\linewidth]{imgs/vis/gt/ours_5.png}} \hfill
\subfloat[Combined method~\cite{kirillov2018panoptic}]{\includegraphics[width = .249\linewidth]{imgs/vis/combined/ours_5.png}} \hfill
\subfloat[Ours]{\includegraphics[width = .249\linewidth]{imgs/vis/upsnet/ours_5.png}} \\
\caption{Visual examples of panoptic segmentation on our internal dataset.}
\label{fig:results_ours}
\end{figure*}
\section{Conclusion}
In this paper, we proposed the {UPSNet} which provides a unified framework for panoptic segmentation.
It exploits a single backbone network and two lightweight heads to predict semantic and instance segmentation in one shot.
More importantly, our parameter-free panoptic head leverages the logits from the above two heads and has the flexibility to predict an extra \textit{unknown} class.
It handles the varying number of classes per image and enables back propagation for the bottom representation learning.
Empirical results on three large datasets show that our {UPSNet} achieves state-of-the-art performance with significantly faster inference compared to other methods.
In the future, we would like to explore more powerful backbone networks and smarter parameterization of panoptic head.
\section{Experiments}
In this section, we present the experimental results on COCO~\cite{lin2014microsoft}, Cityscapes~\cite{cordts2016cityscapes} and our internal dataset.
\textbf{COCO}
We follow the setup of COCO 2018 panoptic segmentation task which consists of $80$ and $53$ classes for thing and stuff respectively.
We use train2017 and val2017 subsets which contain approximately $118$k training images and $5$k validation images.
\textbf{Cityscapes}
Cityscapes has $5000$ images of ego-centric driving scenarios in urban settings which are split into $2975$, $500$ and $1525$ for training, validation and testing respectively.
It consists of $8$ and $11$ classes for \textit{thing} and \textit{stuff}.
\textbf{Our Dataset}
We also use an internal dataset which is similar to Cityscapes and consists of $10235$ training, $1139$ validation and $1186$ test images of ego-centric driving scenarios.
Our dataset consists of $10$ and $17$ classes for \textit{thing} (\eg, car, bus) and \textit{stuff} (\eg, building, road) respectively.
\begin{table}[t]
\centering
\resizebox{\linewidth}{!}{%
\setlength{\tabcolsep}{3pt}
\begin{tabular}{@{}c|ccc|cccc@{}}
\hline
\toprule
Models & PQ & SQ & RQ & $\text{PQ}^{\text{Th}}$ & $\text{PQ}^{\text{St}}$ & mIoU & AP \\
\midrule
\midrule
JSIS-Net~\cite{de2018panoptic} & 26.9 & 72.4 & 35.7 & 29.3 & 23.3 & - & - \\
RN50-MR-CNN & 38.6 & 76.4 & 47.5 & 46.2 & 27.1 & - & - \\
MR-CNN-PSP & 41.8 & \textbf{78.4} & 51.3 & 47.8 & 32.8 & 53.9 & 34.2 \\
Ours & \textbf{42.5} & 78.0 & \textbf{52.4} & \textbf{48.5} & \textbf{33.4} & \textbf{54.3} & \textbf{34.3} \\
\toprule
Multi-scale & PQ & SQ & RQ & $\text{PQ}^{\text{Th}}$ & $\text{PQ}^{\text{St}}$ & mIoU & AP \\
\midrule
\midrule
MR-CNN-PSP-M & 42.2 & 78.5 & 51.7 & 47.8 & 33.8 & 55.3 & 34.2 \\
Ours-M & \textbf{43.2} & \textbf{79.2} & \textbf{52.9} & \textbf{49.1} & \textbf{34.1} & \textbf{55.8} & \textbf{34.3} \\
\bottomrule
\end{tabular}
}
\vspace{-0.3cm}
\caption{Panoptic segmentation results on COCO. Superscripts \text{Th} and \text{St} stand for thing and stuff. `-` means inapplicable.}
\vspace{-0.5cm}
\label{table:coco}
\end{table}
\begin{table*}[t]
\centering
{%
\setlength{\tabcolsep}{3pt}
\begin{tabular}{@{}c|c|ccc|ccc|ccc@{}}
\hline
\toprule
Models & backbone & PQ & SQ & RQ & $\text{PQ}^{\text{Th}}$ & $\text{SQ}^{\text{Th}}$ & $\text{RQ}^{\text{Th}}$ & $\text{PQ}^{\text{St}}$ & $\text{SQ}^{\text{St}}$ & $\text{RQ}^{\text{St}}$ \\
\midrule
\midrule
Megvii (Face++) & ensemble model & 53.2 & 83.2 & 62.9 & 62.2 & 85.5 & 72.5 & 39.5 & 79.7 & 48.5 \\
Caribbean & ensemble model & 46.8 & 80.5 & 57.1 & 54.3 & 81.8 & 65.9 & 35.5 & 78.5 & 43.8 \\
PKU\_360 & ResNeXt-152-FPN & 46.3 & 79.6 & 56.1 & 58.6 & 83.7 & 69.6 & 27.6 & 73.6 & 35.6 \\
\midrule
JSIS-Net~\cite{de2018panoptic} & ResNet-50 & 27.2 & 71.9 & 35.9 & 29.6 & 71.6 & 39.4 & 23.4 & 72.3 & 30.6 \\
AUNet~\cite{li2018attention} & ResNeXt-152-FPN & 46.5 & \textbf{81.0} & 56.1 & \textbf{55.9} & \textbf{83.7} & \textbf{66.3} & 32.5 & 77.0 & 40.7 \\
Ours & ResNet-101-FPN & \textbf{46.6} & 80.5 & \textbf{56.9} & 53.2 & 81.5 & 64.6 & \textbf{36.7} & \textbf{78.9} & \textbf{45.3} \\
\bottomrule
\end{tabular}
}
\vspace{-0.3cm}
\caption{Panoptic segmentation results on MS-COCO 2018 \emph{test-dev}. The top $3$ rows contain results of top $3$ models taken from the official leadboard.}
\vspace{-0.5cm}
\label{table:coco_test_dev}
\end{table*}
\textbf{Experimental Setup}
For all datasets, we report results on the validation set.
To evaluate the performance, we adopt panoptic quality (PQ), recognition quality (RQ) and semantic quality (SQ)~\cite{kirillov2018panoptic} as the metrics.
We also report average precision (AP) of mask prediction, mean IoU of semantic segmentation on both \textit{stuff} and \textit{thing} and the inference run-time for comparison.
At last, we show results of ablation study on various design components of our model.
Full results with all model variants are shown in the supplementary material.
We set the learning rate and weight decay as $0.02$ and $0.0001$ for all datasets.
For COCO, we train for $90$K iterations and decay the learning rate by a factor of $10$ at $60$K and $80$K iterations.
For Cityscapes, we train for $12$K iterations and apply the same learning rate decay at $9$K iterations.
For our dataset, we train for $36$K iterations and apply the same learning rate decay at $24$K and $32$K iterations.
Loss weights of semantic head are $0.2$, $1.0$ and $1.0$ on COCO, Cityscapes and ours respectively.
RoI loss weights are one fifth of those of semantic head.
Loss weights of panoptic head are $0.1$, $0.5$ and $0.3$ on COCO, Cityscapes and ours respectively.
All other loss weights are set to $1.0$.
We mainly compare with the combined method used in~\cite{kirillov2018panoptic}.
For a fair comparison, we adopt the model which uses a Mask R-CNN with a ResNet-50-FPN and a PSPNet with a ResNet-50 as the backbone and apply the combine heuristics to compute the panoptic segmentation.
We denote our implementation of the combined method as `MR-CNN-PSP' and its multi-scale testing version as `MR-CNN-PSP-M'.
Unless specified otherwise, the combined method hereafter refers to `MR-CNN-PSP'.
For PSPNet, we use `poly' learning rate schedule as in~\cite{chen2018deeplab} and train $220$K, $18$K and $76$K on COCO, Cityscapes and our dataset with mini-batch size $16$.
We test all available models with the multi-scale testing.
Specifically, we average the multi-scale logits of PSPNet for the combined method and the ones of semantic segmentation head for our {UPSNet}.
For simplicity, we just use single scale testing on Mask R-CNN of the combined method and our instance segmentation head.
During evaluation, due to the sensitivity of PQ with respect to RQ, we predict all \textit{stuff} segments of which the areas are smaller than a threshold as \textit{unknown}.
The thresholds on COCO, Cityscapes and our dataset are $4096$, $2048$ and $2048$ respectively.
To be fair, we apply this area thresholding to all methods.
\begin{table}[t]
\centering
\resizebox{\linewidth}{!}{%
\setlength{\tabcolsep}{3pt}
\begin{tabular}{@{}c|ccc|cccc@{}}
\hline
\toprule
Models & PQ & SQ & RQ & $\text{PQ}^{\text{Th}}$ & $\text{PQ}^{\text{St}}$ & mIoU & AP \\
\midrule
\midrule
Li \textit{et al.}~\cite{li2018weakly} & 53.8 & - & - & 42.5 & 62.1 & 71.6 & 28.6 \\
MR-CNN-PSP & 58.0 & 79.2 & 71.8 & 52.3 & 62.2 & 75.2 & 32.8 \\
TASCNet~\cite{li2018learning} & 55.9 & - & - & 50.5 & 59.8 & - & - \\
Ours & \textbf{59.3} & \textbf{79.7} & \textbf{73.0} & \textbf{54.6} & \textbf{62.7} & \textbf{75.2} & \textbf{33.3} \\
\midrule
TASCNet-COCO~\cite{li2018learning} & 59.2 & - & - & 56.0 & 61.5 & - & - \\
Ours-COCO & \textbf{60.5} & \textbf{80.9} & \textbf{73.5} & \textbf{57.0} & \textbf{63.0} & \textbf{77.8} & \textbf{37.8} \\
\toprule
Multi-scale & PQ & SQ & RQ & $\text{PQ}^{\text{Th}}$ & $\text{PQ}^{\text{St}}$ & mIoU & AP \\
\midrule
\midrule
Kirillov \textit{et al.}~\cite{kirillov2018panoptic} & 61.2 & 80.9 & 74.4 & 54.0 & \textbf{66.4} & \textbf{80.9} & 36.4 \\
MR-CNN-PSP-M & 59.2 & 79.7 & 73.0 & 52.3 & 64.2 & 76.9 & 32.8 \\
Ours-M & 60.1 & 80.3 & 73.5 & 55.0 & 63.7 & 76.8 & 33.3\\
Ours-101-M-COCO & \textbf{61.8} & \textbf{81.3} & \textbf{74.8} & \textbf{57.6} & 64.8 & 79.2 & \textbf{39.0} \\
\bottomrule
\end{tabular}
}
\vspace{-0.3cm}
\caption{Panoptic segmentation results on Cityscapes. '-COCO' means the model is pretrained on COCO. `-101` means the model uses ResNet-101 as the backbone. Unless specified, all models use ResNet-50 as the backbone and are pretrained on ImageNet.}
\vspace{-0.3cm}
\label{table:cityscapes}
\end{table}
\subsection{COCO}
We compare with several recent published methods including JSIS-Net~\cite{de2018panoptic}, RN50-MR-CNN~\footnote{\url{https://competitions.codalab.org/competitions/19507\#results}} and the combined method~\cite{kirillov2018panoptic} on COCO.
Since authors in~\cite{kirillov2018panoptic} do not report results on COCO, we use our MR-CNN-PSP model as the alternative to do the experiments.
JSIS-Net uses a ResNet-50 wheres RN50-MR-CNN uses two separate ResNet-50-FPNs as the backbone.
Our {UPSNet} adopts a ResNet-50-FPN as the backbone.
In order to better leverage context information, we use a global average pooling over the feature map of the last layer in the 5-th stage of
ResNet (`res5'), reduce its dimension to $256$ and add back to FPN before producing $P_5$ feature map.
Table~\ref{table:coco} shows the results of all metrics.
The mIoU metric is computed over the $133$ classes of stuff and thing in the COCO 2018 panoptic segmentation task which is different from previous $172$ classes of COCO-Stuff.
We are among the first to evaluate mIoU on this $133$-class subset.
From the table, we can see that our {UPSNet} achieves better performance in all metrics except the SQ.
It is typically the case that the an increase in RQ leads to the slight decrease of SQ since we include more TP segments which could have possibly lower IoU.
Note that even with multi-scale testing, MR-CNN-PSP is still worse than ours on PQ.
Moreover, from the mIoU column, we can see that the performance of our semantic head is even better than a separate PSPNet which verifies its effectiveness.
With multi-scale testing, both MR-CNN-PSP and {UPSNet} are improved and ours is still better.
We also add the comparisons on the \emph{test-dev} of MS-COCO 2018 in Table~\ref{table:coco_test_dev}.
Although we just use ResNet-101 as the backbone, we achieve slightly better results compared to the recent AUNet~\cite{li2018attention} which uses ResNeXt-152.
We also list the top three results on the leadboard which uses ensemble and other tricks.
It is clear from the table that we are on par with the second best model without using any such tricks.
In terms of the model size, RN50-MR-CNN, MR-CNN-PSP and {UPSNet} consists of $71.2$M, $91.6$M and $46.1$M parameters respectively.
Therefore, our model is significantly lighter.
We show visual examples of panoptic segmentation on this dataset in the first two rows of Fig.~\ref{fig:results}.
From the $1$-st row of the figure, we can see that the combined method completely ignores the cake and other objects on the table whereas ours successfully segments them out.
This is due to the inherent limitations of the combine heuristic which first pastes the high confidence segment, \ie, table, and then ignores all highly overlapped objects thereafter.
\begin{table}[t]
\centering
\resizebox{\linewidth}{!}{%
\setlength{\tabcolsep}{3pt}
\begin{tabular}{@{}c|ccc|cccc@{}}
\hline
\toprule
Models & PQ & SQ & RQ & $\text{PQ}^{\text{Th}}$ & $\text{PQ}^{\text{St}}$ & mIoU & AP \\
\midrule
\midrule
MR-CNN-PSP & 45.5 & 77.1 & 57.6 & 40.1 & 48.7 & 70.5 & 29.6 \\
Ours & \textbf{47.1} & \textbf{77.1} & \textbf{59.4} & \textbf{43.8} & \textbf{49.0} & \textbf{70.8} & \textbf{30.4} \\
\bottomrule
\end{tabular}
}
\vspace{-0.3cm}
\caption{Panoptic segmentation results on our dataset.}
\vspace{-0.3cm}
\label{table:our_dataset}
\end{table}
\subsection{Cityscapes}
We compare our model on Cityscapes with Li \textit{et al.}~\cite{li2018weakly}, the combined method~\cite{kirillov2018panoptic} and TASCNet~\cite{li2018learning}.
Note that the method in~\cite{li2018weakly} uses a ResNet-101 as the backbone whereas all other reported methods use ResNet-50 within their backbones.
We use $2$ deformable convolution layers for the semantic head.
The results are reported in Table~\ref{table:cityscapes}.
It is clear from the table that both our {UPSNet} and MR-CNN-PSP significantly outperform the method in~\cite{li2018weakly}, especially on $\text{PQ}^{\text{Th}}$.
This may possibly be caused by the fact that their CRF based instance subnetwork performs worse compared to Mask R-CNN on instance segmentation.
Under the same single scale testing, our model achieves better performance than the combined method.
Although multi-scale testing significantly improves both the combined method and {UPSNet}, ours is still slightly better.
Results reported in~\cite{kirillov2018panoptic} are different from the ones of our MR-CNN-PSP-M since: 1) they use ResNet-101 as the backbone for PSPNet; 2) they pre-train Mask R-CNN on COCO and PSPNet on extra coarsely labeled data.
We also have a model variant, denoting as `Ours-101-M', which adopts ResNet-101 as the backbone and pre-trains on COCO.
As you can see, it outperforms the reported metrics of the combined method.
We show the visual examples of panoptic segmentation on this dataset in the $3$-rd and $4$-th rows of Fig.~\ref{fig:results}.
From the $3$-rd row of the figure, we can see that the combined method tends to produce large black area, \ie, \textit{unknown}, whenever the instance and semantic segmentation conflicts with each other.
In contrast, our {UPSNet} resolves the conflicts better.
Moreover, it is interesting to note that some \textit{unknown} prediction of our model has the vertical or horizontal boundaries.
This is caused by the fact that instance head predicts nothing whereas semantic head predicts something for these out-of-box areas.
The logits of \textit{unknown} class will then stand out by design to avoid contributing to both FP and FN as described in section~\ref{sect:model_arch}.
\subsection{Our Dataset}
Last but not least, we compare our model on our own dataset with the combined method~\cite{kirillov2018panoptic}.
All reported methods use ResNet-50 within their backbones.
We use $2$ deformable convolution layers for the semantic head.
The results are reported in Table~\ref{table:our_dataset}.
We can observe that similar to COCO, our model performs significantly better than the combined method on all metrics except SQ.
We show the visual examples of panoptic segmentation on this dataset in the last two rows of Fig.~\ref{fig:results}.
From the examples, similar observations as COCO and Cityscapes are found.
\begin{table}[t]
\centering
\resizebox{\linewidth}{!}{%
\setlength{\tabcolsep}{3pt}
\begin{tabular}{@{}c|ccc@{}}
\hline
\toprule
Model & COCO & Cityscapes & Our Dataset \\
\midrule
\midrule
Img. Size & $800 \times 1300$ & $1024 \times 2048$ & $1200 \times 1920$ \\
\midrule
MR-CNN-PSP & \begin{tabular}{@{}c@{}}188 \\ (186 + 2) \\ \end{tabular} & \begin{tabular}{@{}c@{}}1105 \\ (583 + 522) \\ \end{tabular} & \begin{tabular}{@{}c@{}}1016 \\ (598 + 418) \\ \end{tabular} \\ \hline
Ours & \textbf{171} & \textbf{236} & \textbf{264} \\ \hline
Speedup & 10$\%$ $\times$ & 368$\%$ $\times$ & 285$\%$ $\times$ \\
\bottomrule
\end{tabular}
}
\vspace{-0.3cm}
\caption{Run time (ms) comparison. Note the bracket below the MR-CNN-PSP results contains their breakdown into the network inference (left) and the combine heurisitc (right).}
\vspace{-0.5cm}
\label{table:run_time}
\end{table}
\input{vis}
\subsection{Run Time Comparison}
We compare the run time of inference on all three datasets in Table~\ref{table:run_time}.
We use a single NVIDIA GeForce GTX 1080 Ti GPU and an Intel Xeon E5-2687W CPU (3.00GHz).
All entries are averaged over $100$ runs on the same image with single scale test.
For COCO, the PSPNet within the combined method uses the original scale.
We also list the image size on each dataset.
It is clearly seen in the table that as the image size increases, our {UPSNet} is significantly faster in run time.
For example, the combined method takes about $3 \times$ time than ours.
\subsection{Ablation Study}
We perform extensive ablation studies on COCO dataset to verify our design choices as listed in Table~\ref{table:ablation}.
Empty cells in the table indicate the corresponding component is not used.
All evaluation metrics are computed over the output of the panoptic head on the validation set.
\textbf{Panoptic Head:}
Since the inference of our panoptic head is applicable as long as we have outputs from both semantic and instance segmentation heads, we can first train these two heads simultaneously and then directly evaluate the panoptic head.
We compare the results with the ones obtained by training all three heads.
By doing so, we can verify the gain of training the panoptic head over treating it as a post processing procedure.
From the first two rows of Table~\ref{table:ablation}, we can see that training the panoptic head does improve the PQ metric.
\textbf{Instance Class Assignment:}
Here, we focus on different alternatives of assigning instance class.
We compare our heuristic as described in section~\ref{sect:model_arch} with the one which only trusts the predicted class given by the instance segmentation head.
As you can see from the $2$-nd and $3$-rd rows of the Table~\ref{table:ablation}, our instance class assignment is better.
\textbf{Loss Balance:}
We investigate the weighting scheme of loss functions.
Recall that without the proposed RoI loss, our {UPSNet} contains $7$ loss functions.
In order to weight them, we follow the principle of loss balance, \ie, making sure their values are roughly on the same order of magnitude.
In particular, with loss balance, we set the weights of semantic and panoptic losses as $0.2$ and $0.1$ and the rest ones as $1.0$.
Without loss balance, we set the weights of both semantic and panoptic losses as $0.1$ and the rest ones as $1.0$.
The $3$-rd and $4$-th rows of Table~\ref{table:ablation} show that introducing the loss balance improves the performance.
\textbf{RoI Loss \& Unknown Prediction:}
Here, we investigate the effectiveness of our RoI loss function over the semantic head and the unknown prediction.
From $4$-th and $5$-th rows of Table~\ref{table:ablation}, one can conclude that adding such a new loss function does slightly boost the $\text{PQ}^{\text{St}}$.
From $5$-th and $6$-th rows of Table~\ref{table:ablation}, along with the RoI loss, predicting unknown class improves the metrics significantly.
\textbf{\textsc{Oracle} Results:}
We also explore the room for improvement of the current system by replacing some inference results with the ground truth (GT) ones.
Specifically, we study the box, instance class assignment and semantic segmentation results which correspond to GT Box, GT ICA and GT Seg. columns in Table~\ref{table:ablation}.
It is clear from the table that using GT boxes along with our predicted class probabilities improves PQ which indicates that better region proposals are required to achieve higher recall.
On top of the GT boxes, using the GT class assignment greatly improves the PQ, \eg, $\approx +7.0$.
The imperfect $\text{PQ}^{\text{Th}}$ indicates that our mask segmentation is not good enough.
Moreover, using the GT semantic segmentation gives the largest gain of PQ, \ie, $+29.5$, which highlights the importance of improving semantic segmentation.
$\text{PQ}^{\text{St}}$ is imperfect since we resize images during inference which causes the misalignment with labels.
It is worth noticing that increasing semantic segmentation also boosts $\text{PQ}^{\text{Th}}$ for $10$ points.
This is because our model leverages semantic segments while producing instance segments.
However, it is not the case for the combined method as its predicted instance segments only relies on the instance segmentation network.
\begin{table}
\centering
\resizebox{\linewidth}{!}
{%
\setlength{\tabcolsep}{2.5pt}
\begin{tabular}{@{}cccccccc|ccc@{}}
\hline
\toprule
Pano. & \begin{tabular}{@{}c@{}}Our \\ ICA \end{tabular} & \begin{tabular}{@{}c@{}} Loss \\ Bal.\end{tabular} & \begin{tabular}{@{}c@{}}RoI \\ Loss\end{tabular} & Unk. & \begin{tabular}{@{}c@{}}GT \\ Box\end{tabular} & \begin{tabular}{@{}c@{}}GT \\ ICA\end{tabular} & \begin{tabular}{@{}c@{}}GT \\ Seg.\end{tabular} & PQ & $\text{PQ}^{\text{Th}}$ & $\text{PQ}^{\text{St}}$ \\
\midrule
\midrule
& & & & & & & & 41.2 & 47.6 & 31.6 \\
\hline
\checkmark & & & & & & & & 41.6 & 47.6 & 32.5 \\
\hline
\checkmark & \checkmark & & & & & & & 41.7 & 47.7 & 32.8 \\
\hline
\checkmark & \checkmark & \checkmark & & & & & & 42.3 & 48.4 & 33.1 \\
\hline
\checkmark & \checkmark & \checkmark & \checkmark & & & & & 42.3 & 48.3 & 33.2 \\
\hline
\checkmark & \checkmark & \checkmark & \checkmark & \checkmark & & & & 42.5 & 48.5 & 33.4 \\
\hline
\checkmark & \checkmark & \checkmark & \checkmark & \checkmark & \checkmark & & & 46.7 & 55.3 & 33.6 \\
\hline
\checkmark & & \checkmark & \checkmark & & \checkmark & \checkmark & & 53.0 & 64.6 & 35.5 \\
\hline
\checkmark & \checkmark & \checkmark & \checkmark & \checkmark & & & \checkmark & 72.0 & 58.6 & 92.3 \\
\bottomrule
\end{tabular}
}
\vspace{-0.3cm}
\caption{Ablation study on COCO dataset. `Pano.', `Loss Bal.', `Unk.' and `ICA' stand for training with panoptic loss, loss balance, \textit{unknown} prediction and instance class assignment respectively.}
\vspace{-0.3cm}
\label{table:ablation}
\end{table}
\section{Introduction}
Relying on the advances in deep learning, computer vision systems have been substantially improved, especially in tasks such as semantic segmentation~\cite{zhao2017pyramid} and instance segmentation~\cite{he2017mask}.
The former focuses on segmenting amorphous image regions which share similar texture or material such as grass, sky and road, whereas the latter focuses on segmenting countable objects such as people, bicycle and car.
Since both tasks aim at understanding the visual scene at the pixel level, a shared model or representation could arguably be beneficial.
However, the dichotomy of these two tasks lead to very different modeling strategies despite the inherent connections between them.
For example, fully convolutional neural networks~\cite{long2015fully} are often adopted for semantic segmentation while proposal based detectors~\cite{ren2015faster} are frequently exploited for instance segmentation.
As an effort to leverage the possible complementariness of these two tasks and push the segmentation systems further towards real-world application, Kirillov~\etal~\cite{kirillov2018panoptic} unified them and proposed the so-called \textit{panoptic segmentation} task.
It is interesting to note that tasks with the same spirit have been studied under various names before deep learning became popular.
Notable ones include image parsing~\cite{tu2005image}, scene parsing~\cite{tu2005image} and holistic scene understanding~\cite{yao2012describing}.
In panoptic segmentation, countable objects (those that map to instance segmentation tasks well) are called \textit{things} whereas amorphous and uncountable regions (those that map to semantic segmentation tasks better) are called \textit{stuff}.
For any pixel, if it belongs to \textit{stuff}, the goal of a panoptic segmentation system is simply to predict its class label within the \textit{stuff} classes.
Otherwise the system needs to decide which instance it belongs to as well as which \textit{thing} class it belongs to.
The challenge of this task lies in the fact that the system has to give a unique answer for each pixel.
In this paper, we propose a unified panoptic segmentation network ({UPSNet}) to approach the panoptic segmentation problem as stated above.
Unlike previous methods~\cite{kirillov2018panoptic,li2018weakly} which have two separate branches designed for semantic and instance segmentation individually, our model exploits a single network as backbone to provide shared representations.
We then design two heads on top of the backbone for solving these tasks simultaneously.
Our semantic head builds upon deformable convolution~\cite{dai2017deformable} and leverages multi-scale information from feature pyramid networks (FPN)~\cite{lin2017feature}.
Our instance head follows the Mask R-CNN~\cite{he2017mask} design and outputs mask segmentation, bounding box and its associated class.
As shown in experiments, these two lightweight heads along with the single backbone provide good semantic and instance segmentations which are comparable to separate models.
More importantly, we design a panoptic head which predicts the final panoptic segmentation via pixel-wise classification of which the number of classes per image could vary.
It exploits the logits from the above two heads and adds a new channel of logits corresponding to an extra \textit{unknown} class.
By doing so, it provides a better way of resolving the conflicts between semantic and instance segmentation.
Moreover, our parameter-free panoptic head is very lightweight and could be used with various backbone networks.
It facilitates end-to-end training which is not the case for previous methods~\cite{kirillov2018panoptic,li2018weakly}.
To verify the effectiveness of our {UPSNet}, we perform extensive experiments on two public datasets: Cityscapes~\cite{cordts2016cityscapes} and COCO~\cite{lin2014microsoft}.
Furthermore, we test it on our internal dataset which is similar in spirit to Cityscapes (\ie, images are captured from ego-centric driving scenarios) but with significantly larger ($\approx 3\times$) size.
Results on these three datasets manifest that our {UPSNet} achieves state-of-the-art performances and enjoys much faster inference compared to recent competitors.
\section{Unified Panoptic Sementation Network}\label{sect:model}
In this section, we first introduce our model and then explain the implementation details.
Following the convention of~\cite{kirillov2018panoptic}, we divide the semantic class labels into \textit{stuff} and \textit{thing}.
Specifically, \textit{thing} refers to the set of labels of instances (\eg pedestrian, bicycle), whereas \textit{stuff} refers to the rest of the labels that represent semantics without clear instance boundaries (\eg street, sky).
We denote the number of \textit{stuff} and \textit{thing} classes as $N_{\text{stuff}}$ and $N_{\text{thing}}$ respectively.
\subsection{{UPSNet} Architecture}\label{sect:model_arch}
UPSNet~consists of a shared convolutional feature extraction backbone and multiple heads on top of it.
Each head is a sub-network which leverages the features from the backbone and serves a specific design purpose that is explained in further detail below.
The overall model architecture is shown in Fig.~\ref{fig:model}.
\vspace{-0.3cm}
\paragraph{Backbone:}
We adopt the original Mask R-CNN~\cite{he2017mask} backbone as our convolutional feature extraction network.
This backbone exploits a deep residual network (ResNet)~\cite{he2016deep} with a feature pyramid network (FPN)~\cite{lin2017feature}.
\vspace{-0.3cm}
\paragraph{Instance Segmentation Head:}
The instance segmentation head follows the Mask R-CNN design with a bounding box regression output, a classification output, and a segmentation mask output.
The goal of the instance head is to produce instance aware representations that could identify \textit{thing} classes better.
Ultimately these representations are passed to the panoptic head to contribute to the logits for each instance.
\vspace{-0.3cm}
\paragraph{Semantic Segmentation Head:}
The goal of the semantic segmentation head is to segment all semantic classes without discriminating instances.
It could help improving instance segmentation where it achieves good results of \textit{thing} classes.
Our semantic head consists of a deformable convolution~\cite{dai2017deformable} based sub-network which takes the multi-scale feature from FPN as input.
In particular, we use $P_2$, $P_3$, $P_4$ and $P_5$ feature maps of FPN which contain $256$ channels and are $1/4$, $1/8$, $1/16$ and $1/32$ of the original scale respectively.
These feature maps first go through the same deformable convolution network independently and are subsequently upsampled to the $1/4$ scale.
We then concatenate them and apply $1 \times 1$ convolutions with softmax to predict the semantic class.
The architecture is shown in Fig.~\ref{fig:semantic_head}.
As will be experimentally verified later, the deformable convolution along with the multi-scale feature concatenation provide semantic segmentation results as good as a separate model, \eg, a PSPNet adopted in~\cite{kirillov2018panoptic}.
Semantic segmentation head is associated with the regular pixel-wise cross entropy loss.
To put more emphasis on the foreground objects such as pedestrians, we also incorporate a RoI loss.
During training, we use the ground truth bounding box of the instance to crop the logits map after the $1 \times 1$ convolution and then resize it to $28 \times 28$ following Mask R-CNN.
The RoI loss is then the cross entropy computed over $28 \times 28$ patch which amounts to penalizing more on the pixels within instances for incorrect classification.
As demonstrated in the ablation study later, we empirically found that this RoI loss helps improve the performance of panoptic segmentation without harming the semantic segmentation.
\vspace{-0.3cm}
\paragraph{Panoptic Segmentation Head:}
Given the semantic and instance segmentation results from the above described two heads, we combine their outputs (specifically per pixel logits) in the panoptic segmentation head.
The logits from semantic head is denoted as $X$ of which the channel size, height and width are $N_{\text{stuff}} + N_{\text{thing}}$, $H$ and $W$ respectively.
$X$ can then be divided along channel dimension into two tensors $X_{\text{stuff}}$ and $X_{\text{thing}}$ which are logits corresponding to \textit{stuff} and \textit{thing} classes.
For any image, we determine the number of instances $N_{\text{inst}}$ according to the number of ground truth instances during training.
During inference, we rely on a mask pruning process to determine $N_{\text{inst}}$ which is explained in Section ~\ref{sect:implement_detail}.
$N_{\text{stuff}}$ is fixed since number of \textit{stuff} classes is constant across different images, whereas $N_{\text{inst}}$ is not constant since the number of instances per image can be different.
The goal of our panoptic segmentation head is to first produce a logit tensor $Z$ which is of size $(N_{\text{stuff}} + N_{\text{inst}}) \times H \times W$ and then uniquely determine both the class and instance ID for each pixel.
We first assign $X_{\text{stuff}}$ to the first $N_{\text{stuff}}$ channels of $Z$ to provide the logits for classifying \textit{stuffs}.
For any instance $i$, we have its mask logits $Y_i$ from the instance segmentation head which is of size $28 \times 28$.
We also have its box $B_i$ and class ID $C_i$.
During training $B_i$ and $C_i$ are ground truth box and class ID whereas during inference they are predicted by Mask R-CNN.
Therefore, we can obtain another representation of $i$-th instance from semantic head $X_{\text{mask}_i}$ by only taking the values inside box $B_i$ from the channel of $X_{\text{thing}}$ corresponding to $C_i$.
$X_{\text{mask}_i}$ is of size $H \times W$ and its values outside box $B_i$ are zero.
We then interpolate $Y_i$ back to the same scale as $X_{\text{mask}_i}$ via bilinear interpolation and pad zero outside the box to achieve a compatible shape with $X_{\text{mask}_i}$, denoted as $Y_{\text{mask}_i}$.
The final representation of $i$-th instance is $Z_{N_{\text{stuff}} + i} = X_{\text{mask}_i} + Y_{\text{mask}_i}$.
Once we fill in $Z$ with representations of all instances, we perform a softmax along the channel dimension to predict the pixel-wise class.
In particular, if the maximum value falls into the first $N_{\text{stuff}}$ channel, then it belongs to one of stuff classes.
Otherwise the index of the maximum value tells us the instance ID.
The architecture is shown in Fig.~\ref{fig:panoptic_head}.
During training, we generate the ground truth instance ID following the order of the ground truth boxes we used to construct the panoptic logits.
The panoptic segmentation head is then associated with the standard pixel-wise cross entropy loss.
During inference, once we predict the instance ID following the above procedure, we still need to determine the class ID of each instance.
One can either use the class ID $C_{\text{inst}}$ predicted by Mask R-CNN or the one predicted by the semantic head $C_{\text{sem}}$.
As shown later in the ablation study, we resort to a better heuristic rule.
Specifically, for any instance, we know which pixels correspond to it, \ie, those of which the \textit{argmax} of $Z$ along channel dimension equals to its instance ID.
Among these pixels, we first check whether $C_{\text{inst}}$ and $C_{\text{sem}}$ are consistent.
If so, then we assign the class ID as $C_{\text{inst}}$.
Otherwise, we compute the mode of their $C_{\text{sem}}$, denoting as $\hat{C}_{\text{sem}}$.
If the frequency of the mode is larger than $0.5$ and $\hat{C}_{\text{sem}}$ belongs to \textit{stuff}, then the predicted class ID is $\hat{C}_{\text{sem}}$.
Otherwise, we assign the class ID as $C_{\text{inst}}$.
In short, while facing inconsistency, we trust the majority decision made by the semantic head only if it prefers a \textit{stuff} class.
The justification of such a conflict resolution heuristic is that semantic head typically achieves very good segmentation results over \textit{stuff} classes.
\begin{figure}
\begin{center}
\includegraphics[width=0.99\linewidth]{imgs/semantic_head}
\end{center}
\vspace{-0.5cm}
\caption{Architecture of our semantic segmentation head.}
\vspace{-0.5cm}
\label{fig:semantic_head}
\end{figure}
\vspace{-0.3cm}
\paragraph{Unknown Prediction:}
In this section, we explain a novel mechanism to allow UPSNet~to classify a pixel as the \textit{unknown} class instead of making a wrong prediction.
To motivate our design, we consider a case where a pedestrian is instead predicted as a bicycle.
Since the prediction missed the pedestrian, the false negative (FN) value of pedestrian class will be increased by $1$.
On the other hand, predicting it as a bicycle will be increasing the false positive (FP) of bicycle class also by $1$.
Recall that, the panoptic quality (PQ)~\cite{kirillov2018panoptic} metric for panoptic segmentation is defined as,
\begin{align}
PQ = \underbrace{\frac{\sum_{(p, g) \in \text{TP}} \text{IoU}(p, g) }{ \vert \text{TP} \vert }}_{\text{SQ}} \underbrace{\frac{ \vert \text{TP} \vert }{ \vert \text{TP} \vert + \frac{1}{2} \vert \text{FP} \vert + \frac{1}{2} \vert \text{FN} \vert }}_{\text{RQ}}, \nonumber
\end{align}
which consist of two parts: recognition quality (RQ) and semantic quality (SQ).
It is clear that increasing either FN or FP degrades this measurement.
This phenomena extends to wrong predictions of the stuff classes as well.
Therefore, if a wrong prediction is inevitable, predicting such pixel as \textit{unknown} is preferred since it will increase FN of one class by $1$ without affecting FP of the other class.
To alleviate the issue, we compute the logits of the extra unknown class as $Z_{\text{unknown}} = \max \left( X_{\text{thing}} \right) - \max \left( X_{\text{mask}} \right)$ where $X_{\text{mask}}$ is the concatenation of $X_{\text{mask}_i}$ of all masks along channel dimension and of shape $N_{\text{inst}} \times H \times W$.
The maximum is taken along the channel dimension.
The rationale behind this is that for any pixel if the maximum of $X_{\text{thing}}$ is larger than the maximum of $X_{\text{mask}}$, then it is highly likely that we are missing some instances (FN).
The construction of the logits is shown in Fig.~\ref{fig:panoptic_head}.
To generate the ground truth for the \textit{unknown} class, we randomly sample $30\%$ ground truth masks and set them as \textit{unknown} during training.
In evaluating the metric, any pixel belonging to \textit{unknown} is ignored, \ie, setting to \textit{void} which will not contribute to the results.
\begin{figure}
\begin{center}
\includegraphics[width=0.99\linewidth]{imgs/panoptic_head}
\end{center}
\vspace{-0.5cm}
\caption{Architecture of our panoptic segmentation head.}
\vspace{-0.5cm}
\label{fig:panoptic_head}
\end{figure}
\subsection{Implementation Details}\label{sect:implement_detail}
In this section, we explain the implementation details of {UPSNet}.
We follow most of settings and hyper-parameters of Mask R-CNN which will be introduced in the supplementary material.
Hereafter, we only explain those which are different.
\vspace{-0.3cm}
\paragraph{Training: }
We implement our model in PyTorch~\cite{paszke2017automatic} and train it with $16$ GPUs using the distributed training framework Horovod~\cite{sergeev2018horovod}.
Images are preprocessed following~\cite{he2017mask}.
Each mini-batch has $1$ image per GPU.
As mentioned, we use ground truth box, mask and class label to construct the logits of panoptic head during training.
Our region proposal network (RPN) is trained end-to-end with the backbone whereas it was trained separately in \cite{he2017mask}.
Due to the high resolution of images, \eg, $1024 \times 2048$ in Cityscapes, logits from semantic head and panoptic head are downsampled to $1/4$ of the original resolution.
Although we do not fine-tune batch normalization (BN) layers within the backbone for simplicity, we still achieve comparable results with the state-of-the-art semantic segmentation networks like PSPNet.
Based on common practice in semantic~\cite{chen2017rethinking,zhao2017pyramid} and instance segmentation~\cite{peng2017megdet,liu2018path}, we expect the performance to be further improved with BN layers fine-tuned.
Our {UPSNet} contains $8$ loss functions in total: semantic segmentation head (whole image and RoI based pixel-wise classification losses), panoptic segmentation head (whole image based pixel-wise classification loss), RPN (box classification, box regression) and instance segmentation head (box classification, box regression and mask segmentation).
Different weighting schemes on these multi-task loss functions could lead to very different training results.
As shown in the ablation study, we found the loss balance strategy, \ie, assuring the scales of all losses are roughly on the same order of magnitude, works well in practice.
\vspace{-0.3cm}
\paragraph{Inference: }
During inference, once we obtained output boxes, masks and predicted class labels from the instance segmentation head, we apply a mask pruning process to determine which mask will be used for constructing the panoptic logits.
In particular, we first perform the class-agnostic non-maximum suppression with the box IoU threshold as $0.5$ to filter out some overlapping boxes.
Then we sort the predicted class probabilities of the remaining boxes and keep those whose probability are larger than $0.6$.
For each class, we create a canvas which is of the same size as the image.
Then we interpolate masks of that class to the image scale and paste them onto the corresponding canvas one by one following the decreasing order of the probability.
Each time we copy a mask, if the intersection between the current mask and those already existed over the size of the current mask is larger than a threshold, we discard this mask.
Otherwise we copy the non-intersecting part onto the canvas.
The threshold of this intersection over itself is set to $0.3$ in our experiments.
Logits from the semantic segmentation head and panoptic segmentation head are of the original scale of the input image during inference.
\section{Related Work}
\textbf{Semantic Segmentation:}
Semantic segmentation is one of the fundamental computer vision tasks that has a long history.
Earlier work~\cite{everingham2010pascal,mottaghi2014role} focused on introducing datasets for this task and showed the importance of global context by demonstrating the gains in bayesian frameworks, whether structured or free-form.
Recent semantic segmentation methods that exploit deep convolutional feature extraction mainly approach this problem from either multi-scale feature aggregation~\cite{zhao2017pyramid,long2015fully,chen2016attention,hariharan2015hypercolumns}, or end-to-end structured prediction~\cite{chen2014semantic,zheng2015conditional,arnab2016higher,liu2015semantic,chen2017rethinking} perspectives.
As context is crucial for semantic segmentation, one notable improvement to most convolutional models emerged from dilated convolutions~\cite{yu2016multiscale,yu2017dilated} which allows for a larger receptive field without the need of more free parameters.
Pyramid scene parsing network (PSPNet)~\cite{zhao2017pyramid} that uses dilated convolutions in its backbone, and its faster variant~\cite{zhao2018icnet} for real-time applications are widely utilized in practical applications.
Based on FPN and PSPNet, a multi-task framework is proposed in~\cite{xiao2018unified} and demonstrated to be versatile in segmenting a wide range of visual concepts.
\textbf{Instance Segmentation:}
Instance segmentation deals not only with identifying the semantic class a pixel is associated with, but also the specific object instance that it belongs to.
Beginning with the introduction of region-based CNN (R-CNN)~\cite{girshick2014rich}, many early deep learning approaches to instance segmentation attacked the problem by casting the solution to instance segmentation as a two stage approach where a number of segment proposals are made, which is then followed by a voting between those proposals to choose the best~\cite{uijlings2013selective,dai2016instance,dai2015convolutional,hariharan2014simultaneous,hariharan2015hypercolumns,ren17recattend}.
The common denominator for these methods is that the segmentation comes before classification, and are therefore slower.
Li~\etal~\cite{li2017fully} proposed a fully convolutional instance-aware segmentation method, where instance mask proposals~\cite{dai2016instance} are married with fully convolutional networks~\cite{long2015fully}.
Most recently, Mask R-CNN~\cite{he2017mask} introduced a joint approach to both mask prediction and recognition where one of the two parallel heads are dedicated to each task.
\textbf{Panoptic Segmentation:}
Instance segmentation methods that focus on detection bounding box proposals, as mentioned above, ignore the classes that are not well suited for detection, \eg, sky, street.
On the other hand, semantic segmentation does not provide instance boundaries for classes like pedestrian and bicycle in a given image.
Panoptic segmentation task, first coined by Kirillov~\etal~\cite{kirillov2018panoptic} unifies these tasks and defines an ideal output for \textit{thing} classes as instance segmentations, as well as for \textit{stuff} classes as semantic segmentation.
The baseline panoptic segmentation method introduced in~\cite{kirillov2018panoptic} processes the input independently for semantic segmentation via a PSPNet, and for instance segmentation utilizing a Mask R-CNN~\cite{he2017mask}, followed by simple heuristic decisions to produce a single void, stuff, or thing instance label per pixel.
Recently, Li~\etal~\cite{li2018weakly} introduced a weakly- and semi-supervised panoptic segmentation method where they relieve some of the ground truth constraints by supervising thing classes using bounding boxes, and stuff classes by utilizing image level tags.
De Gaus~\etal~\cite{de2018panoptic} uses a single feature extraction backbone for the pyramid semantic segmentation head~\cite{zhao2017pyramid}, and the instance segmentation head~\cite{he2017mask}, followed by heuristics for merging pixel level annotations, effectively introducing an end-to-end version of~\cite{kirillov2018panoptic} due to the shared backbone for the two task networks.
Li~\etal~\cite{li2018attention} propose the attention-guided unified network (AUNet) which leverages proposal and mask level attention to better segment the background.
Similar post-processing heuristics as in~\cite{kirillov2018panoptic} are used to generate the final panoptic segmentation.
Li~\etal~\cite{li2018learning} propose things and stuff consistency network (TASCNet) which constructs a binary mask predicting things vs. stuff for each pixel.
An extra loss is added to enforce the consistency between things and stuff prediction.
In contrast to most of these methods, we use a single backbone network to provide both semantic and instance segmentation results.
More importantly, we develop a simple yet effective panoptic head which helps accurately predict the instance and class label.
| {'timestamp': '2019-04-05T02:05:37', 'yymm': '1901', 'arxiv_id': '1901.03784', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03784'} | arxiv |
\section{Introduction} \label{section introduction}
\input{introduction.tex}
\section{Related Work} \label{section related work}
\input{relatedWork.tex}
\section{System Model and Notation} \label{section model}
\input{model.tex}
\section{Our Result} \label{section result}
\input{result.tex}
\subsection{Algorithm}
\input{algorithm.tex}
\subsection{Proof of Correctness} \label{section correctness}
\input{correctness.tex}
\section{Discussion} \label{section discussion}
\input{discussion.tex}
\bibliographystyle{abbrv}
| {'timestamp': '2019-01-16T02:20:59', 'yymm': '1901', 'arxiv_id': '1901.03804', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03804'} | arxiv |
\section{Introduction}
Autonomous robot has become a popular research topic over the last decades.
We have seen an increasing demand for robots in various applications, such as autonomous driving, inspection, search and rescue.
One of the fundamental technologies for autonomous tasks is localization.
Robots require precise 6-DoF (Degrees of Freedom) poses for navigation and control.
A lot of sesnors have been used for local pose estimation.
The Radar and LiDAR are widely used in the confined indoor environment, while the camera and IMU are applicable in both indoor and outdoor environments.
There are many impressive algorithms for local pose estimation, such as visual-based method \cite{klein2007parallel, ForPizSca1405, engel2014lsd, mur2015orb, engel2017direct}, and visual-inertial-based method \cite{MouRou0704,LiMou1305,LeuFurRab1306,bloesch2015robust,mur2017visual,qin2018vins}.
These algorithms achieves incremental and accurate state estimation within a local region.
However, there are several drawbacks limiting the usage of these algorithms in practice.
The first drawback of local pose estimation algorithems is that they produce pose estimation in a local frame (with respect to the starting point) without a global coordinate.
We may get different estimations when we start from different points even in the same environment.
Hence, they are unfriendly to reuse without a fixed global coordinate.
The second drawback is that due to the lack of global measurements, the local estimations are prone to accumulated drifts in the long run.
Although some vision-based loop closure methods were proposed to eliminate drifts, they cannot handle the large-scale environment with the mass data.
\begin{figure}
\centering
\includegraphics[width=0.45\textwidth]{kitti}
\caption{
\label{fig:a_graph} KITTI dataset results of the proposed sensor fusion framework (VO + GPS). The top of this figure is a pair of stereo images. The left bottom part is the estimated trajectory and feature points, while the right bottom part is the estimated global trajectory aligned with Google map.}
\end{figure}
\begin{figure*}
\centering
\includegraphics[width=0.98\textwidth]{paperb_framework}
\caption{
\label{fig:paperb_framework}
An illustration of the proposed framework structure. The global estimator fuses local estimations with various global sensors to achieve locally accurate and globally drift-free pose estimation. }
\end{figure*}
Compared with local sensors, global sensors, such as GPS, barometers, and magnetometers, have advantages in global localization within large-scale environments.
They provide global measurements with respect to the fixed earth frame, which is drift-free.
However, their measurements are usually unsmooth and noisy, which cannot be directly used for precise control and navigation.
Taking GPS as an example, it can measure approximate location in meters, but measurements are discontinuous at a low rate.
Also, it only measures 3D position without 3D orientation.
Therefore, only global sensors are insufficient for real-time 6-DoF state estimation.
Since local sensors (camera, IMU and LiDAR) achieves impressive performance in local accuracy and global sensors (GPS, magnetometer and barometer) are drift-free, it is a smart way to fuse them together to achieve locally accurate and globally drift-free 6-DoF pose estimation.
In order to increase the robustness, we want to fuse sensors as many as possible.
Consequently, a general framework which supports multiple sensors is required.
Although traditional EKF-based methods can fuse the local estimation into the global frame gradually, an accurate initial guess about the transformation between different frames is required to guarantee convergence.
Also, the EKF methods are sensitive to time synchronization.
Any late-coming measurements will cause trouble since states cannot be propagated back in filter procedure.
To this end, we use an optimization-based method to solve this problem, which is suitable for multiple sensor fusion inherently.
In this paper, we propose an optimization framework to fuse local estimations with global sensor measurements.
Local estimations come from existing state-of-the-art VO/VIO works.
Global sensors are treated as general factors in pose graph.
Local factors and global sensor factors are summed up together to build the optimization problem.
Our system achieves locally accurate and globally drift-free state estimation.
We highlight the contribution of this paper as follows:
\begin{itemize}
\item a general framework to fuse various global sensors with local estimations, which achieves locally accurate and globally drift-free localization.
\item an evaluation of the proposed system on both public datasets and real experiments.
\item open-source code for the community.
\end{itemize}
\section{Related Work}
\label{sec:literature}
Recently, multiple sensor fusion approach for state estimation has become a popular trend in order to improve both accuracy and robustness.
By the type of sensors employed in the system, research works can be classified as local localization and global-aware localization.
For local localization, cameras, IMU, LiDAR and RGB-D sensors are usually used for 6-DoF state estimation in small environment.
Impressive approaches over the last decades include visual-based methods \cite{klein2007parallel, ForPizSca1405, engel2014lsd, mur2015orb, engel2017direct}, LiDAR-based methods \cite{zhang2014loam}, RGB-D based methods \cite{kerl2013dense}, and event-based methods \cite{rebecq2017evo}.
There are also some multi-sensor fusion methods, such as visual-inertial fusion \cite{MouRou0704,LiMou1305,huang2010observability,LeuFurRab1306,bloesch2015robust,mur2017visual,qin2018vins,liu2018ice} and visual-LiDAR fusion \cite{zhang2015visual}.
Among these work, \cite{MouRou0704,LiMou1305,bloesch2015robust} are filter-based methods while \cite{LeuFurRab1306,mur2017visual,qin2018vins} are optimization-based methods.
In optimization-based framework, a lot of visual measurements and inertial measurements are kept in a bundle.
The states related to the observed measurements are optimized together.
One advantage of optimization-based approaches over EKF-based ones is that states can be iteratively linearized to increase accuracy.
Both filter-based methods and optimization-based methods can achieve highly accurate state estimation.
Due to the lack of global measurement, the accumulated drifts is unavoidable over time.
For global-aware localization, global sensors (GPS, magnetometer, barometer, etc) are incorporated in the system.
Global sensor measures absolute quantities with respect to the earth frame, which are independent of the starting point.
Global measurements are usually noisy and low-frequency, so they cannot be used alone.
Therefore, global sensors are usually fused with local sensors for accurate and global-aware localization.
\cite{lynen2013robust} proposed an EKF-based algorithm to fuse visual measurement with inertial and GPS measurement to get drift-free estimation.
\cite{SheMulMic1405} used UKF (Unscented Kalman Filter) algorithm to fuse visual, LiDAR and GPS measurements, which is an extension of EKF without analytic Jacobians.
Filter-based methods are sensitive to time synchronization.
Any late-coming measurements will cause trouble since states cannot be propagated back in filter procedure.
Hence, special ordering mechanism is required to make sure that all measurements from multiple sensors are in order.
Compared with filter-based method, optimization-based method have advantage in this aspect.
Because the big bundle serves as a nature buffer, it can wait and store measurements for a long time.
\cite{mascaro2018gomsf} used an optimization-based framework to fuse local VIO (Visual Inertial Odometry) with GPS measurements, which produced more accurate results than method proposed in \cite{lynen2013robust}.
The transformation between local coordinate and global coordinate was frequently optimized in this approach.
Few research works fuse sensors more than three types.
In this paper, we propose a more general optimization-based framework for global localization, which can support multiple global sensors.
Each sensor serves as a general factor, which can be easily added into the optimization problem.
\section{System Overview}
\label{sec:System Overview}
According to the measurement's reference frame, we category sensors into local and global types.
\subsubsection{Local Sensors}
Camera, LiDAR, IMU (accelerometer and gyroscope), etc.
This kind of sensor is not globally referenced, thus a reference frame is usually needed.
In general, the first pose of the robot is set as the origin in order to boot up the sensor.
The estimation of the robot's pose incrementally evolves from the starting point.
Therefore, accumulated drift will grow with the distance from starting point.
\subsubsection{Global Sensors}
GPS, magnetometer, barometer, etc.
This kind of sensor is globally referenced.
It always works under a fixed global frame, such as the earth frame.
The origin of the reference frame is fixed and known in advance.
Their measurements are global-referenced but noisy.
The error is independent of traveled distance.
For GPS, it measures absolute longitude, latitude and altitude with respect to the earth.
The longitude, latitude, and altitude can be converted to x, y and z coordinate.
For magnetometer, it measures magnetic field direction and strength, which can determine the orientation.
For barometer, it measures air pressure, which can be converted to height.
The structure of our framework is shown in Fig. \ref{fig:paperb_framework}.
Local sensors (camera and IMU) are used in local estimation.
The existing VO/VIO approaches are adopted to produce local poses.
Local results and global sensors are input into a global pose graph.
They are converted to unified factors to construct the optimization problem.
The global estimator generates locally accurate and globally aware 6-DoF pose results.
\section{Methodology}
\label{sec:algorithm}
\subsection{Local Pose Estimation}
For local pose estimation, we adopt existing VO (Visual Odometry)/VIO (Visual-Inertial Odometry) algorithms.
There are many impressive VO/VIO algorithms, such as \cite{mur2015orb, MouRou0704,LiMou1305,LeuFurRab1306,bloesch2015robust,mur2017visual,qin2018vins}.
Any of them can be used as local pose estimation in our framework, as long as it produces 6-DoF poses.
This part is not the main contribution of this paper.
For the completeness, we briefly introduce our previous VIO algorithm \cite{qin2018vins}, which is used in our open-source implementations.
The VIO estimates poses of several IMU frames and features' depth within a sliding window.
The states are defined as:
\begin{equation}
\begin{split}
\mathcal{X}_l &= \left [ \mathbf{x}_0,\,\mathbf{x}_{1},\, \cdots \,\mathbf{x}_{n},\, \lambda_0,\,\lambda_{1},\, \cdots \,\lambda_{m} \right ] \\
\mathbf{x}_k &= \left [ \mathbf{p}^l_{b_k},\,\mathbf{v}^l_{b_k},\,\mathbf{q}^l_{b_k}, \,\mathbf{b}_a, \,\mathbf{b}_g \right ], k\in [0,n],
\end{split}
\end{equation}
where the $k$-th IMU state $\mathbf{x}_k$ consists of the position $\mathbf{p}^{l}_{b_k}$, velocity $\mathbf{v}^{l}_{b_k}$, orientation $\mathbf{q}^{l}_{b_k}$ of IMU's center with respect to local reference frame $l$.
We use quaternion to represent orientation.
The first IMU pose is set as reference frame.
$\mathbf{b}_a$ and $\mathbf{b}_g$ are accelerometer bias and gyroscope bias respectively.
Features are parameterized by their inverse depth $\lambda$ when first observed in camera frame.
The estimation is formulated as a nonlinear least-squares problem,
\begin{equation}
\label{eq:nonlinear_cost_function}
\begin{aligned}
\min_{\mathcal{X}_l} \left \{ \left
\| \mathbf{r}_p - \mathbf{H}_p \mathcal{X} \right \|^2
+ \sum_{k \in \mathcal{B}} \left \| \mathbf{r}_{\mathcal{B}}(\hat{\mathbf{z}}^{b_k}_{b_{k+1}},\, \mathcal{X}) \right \|_{\mathbf{P}^{b_k}_{b_{k+1}}}^2 + \right. \\
\left.
\sum_{(l,j) \in \mathcal{C}} \rho( \left \| \mathbf{r}_{\mathcal{C}}(\hat{\mathbf{z}}^{c_j}_l ,\, \mathcal{X}) \right \|_{\mathbf{P}^{c_j}_l}^2 )
\right\},
\end{aligned}
\end{equation}
where $\mathbf{r}_{\mathcal{B}}(\hat{\mathbf{z}}^{b_k}_{b{k+1}},\, \mathcal{X})$ and $\mathbf{r}_{\mathcal{C}}(\hat{\mathbf{z}}^{c_j}_l,\, \mathcal{X})$ represent inertial and visual residuals respectively.
The prior term, $\{\mathbf{r}_p,\,\mathbf{H}_p\}$, contains information about past marginalized states.
$\rho (\cdot)$ represents robust huber norm \cite{Hub64}.
The detailed explanation can be found at \cite{qin2018vins}.
The VIO achieves accurate real-time 6-DoF pose estimations in the local frame.
\begin{figure}
\centering
\includegraphics[width=0.4\textwidth]{factor_graph}
\caption{
\label{fig:factor_graph}
An illustration of the global pose graph structure.
Every node represents one pose in world frame, which contains position and orientation.
The edge between two consecutive nodes is a local constraint, which is from local estimation (VO/VIO).
Other edges are global constraints, which come from global sensors.
}
\end{figure}
\subsection{Global Pose Graph Structure}
The illustration of the global pose graph structure is shown in Fig. \ref{fig:factor_graph}.
Every pose, which contains position and orientation in world frame, serves as one node in the pose graph.
The density of nodes is determined by the lowest-frequency sensor.
The edge between two consecutive nodes is a local constraint, which is from local estimation (VO/VIO).
That edge constrains the relative pose from one node to another node.
Other edges are global constraints, which come from global sensors.
The nature of pose graph optimization is an MLE (Maximum Likelihood Estimation) problem.
The MLE consists of the joint probability distribution of robot poses over a time period.
Variables are global poses of all nodes, $\mathcal{X}=\{\mathbf{x}_0, \mathbf{x}_1, ..., \mathbf{x}_n\}$, where $\mathbf{x}_i = \{\mathbf{p}^w_i, \mathbf{q}^w_i\}$.
$\mathbf{p}^w$ and $\mathbf{q}^w$ are position and orientation under the global frame.
Under the assumption that all measurement probabilities are independent, the problem is typically derived as,
\begin{equation}
\mathcal{X}^* = \argmaxA_{\mathcal{X}} \prod^{n}_{t=0}\prod^{}_{k\in{\mathbf{S}}} p(\mathbf{z}^k_t|\mathcal{X}),
\end{equation}
where $\mathbf{S}$ is the set of measurements, which includes local measurements (VO$\backslash$VIO) and global measurments (GPS, magnetometer, barometer and so on).
We assume the uncertainty of measurements are Gaussian distribution with mean and covariance, which is $p(\mathbf{z}^k_t|\mathcal{X}) \sim \mathcal{N}(\tilde{\mathbf{z}}^k_t, \Omega^k_t)$.
Therefore, the above-mentioned equation is derived as,
\begin{equation}
\label{eq:ba}
\begin{split}
\mathcal{X}^* &= \argmaxA_{\mathcal{X}} \prod^{n}_{t=0} \prod^{}_{k\in{\mathbf{S}}} exp(-\frac{1}{2}\left\|\mathbf{z}^k_t - h^k_t(\mathcal{X})\right\|^2_{ \mathbf{\Omega}^k_t}) \\
&= \argminA_{\mathcal{X}} \sum^n_{t=0} \sum^{}_{k\in{\mathbf{S}}}
\left\|\mathbf{z}^k_t - h^k_t(\mathcal{X})\right\|^2_{ \mathbf{\Omega}^k_t}.
\end{split}
\end{equation}
The Mahalanobis norm is $\left \| \mathbf{r} \right\|_\mathbf{\Omega}^2 = \mathbf{r}^T \mathbf{\Omega}^{-1}{\mathbf{r}}$.
Then the state estimation is converted to a nonlinear least squares problem, which is also known as Bundle Adjustment (BA).
\subsection{Sensor Factors}
\subsubsection{Local Factor}
Since the local estimation (VO/VIO) is accurate within a small region, we take advantage of the relative pose between two frames.
Considering two sequential frame $t-1$ and frame $t$, the local factor is derived as,
\begin{equation}
\begin{split}
\mathbf{z}^{l}_t - h^{l}_t(\mathcal{X}) &= \mathbf{z}^{l}_t - h^{l}_t(\mathbf{x}_{t-1},\mathbf{x}_{t}) \\
&=
\begin{bmatrix}
\inv{\mathbf{q}^{l}_{t-1}}(\mathbf{p}^l_t - \mathbf{p}^l_{t-1}) \\
\inv{\mathbf{q}^{l}_{t-1}} {\mathbf{q}^{l}_{t}}
\end{bmatrix}
\ominus
\begin{bmatrix}
\inv{\mathbf{q}^{w}_{t-1}}(\mathbf{p}^w_t - \mathbf{p}^w_{t-1}) \\
\inv{\mathbf{q}^{w}_{t-1}} {\mathbf{q}^{w}_{t}}
\end{bmatrix},
\end{split}
\end{equation}
where ($\mathbf{q}^l_{t-1}, \mathbf{p}^l_{t-1})$ and ($\mathbf{q}^l_{t}, \mathbf{p}^l_{t})$ are poses at time $t-1$ and $t$ in local frame from VO/VIO.
$\ominus$ is the minus operation on the error state of quaternion.
The first row represents relative position error between two poses, and the second row represents relative rotation error between two poses.
If the VO/VIO algorithm produces the covariance matrix of poses, we use it as the covariance of local measurements.
Otherwise, we use the unified covariance for all local measurments.
\subsubsection{GPS Factor}
Raw measurements of GPS are longitude, latitude, and altitude, which are not in x,y, and z-axis coordinates.
Generally, we can convert longitude, latitude and altitude into ECEF (Earth Centred Earth Fixed), ENU (local East North Up), and NED (local North East Down) coordinates.
Here, we take ENU coordinate as the example.
By setting the first GPS measurement as the origin point, we get GPS's measruments in the ENU world frame, $\mathbf{p}^{GPS}_t = [x^w_t, y^w_t, z^w_t]^T$.
The GPS factor is derived as,
\begin{equation}
\mathbf{z}^{GPS}_t - h^{GPS}_t(\mathcal{X})
= \mathbf{z}^{GPS}_t - h^{GPS}_t({\mathbf{x}_t})
= \mathbf{p}^{GPS}_t - \mathbf{p}^w_t .
\end{equation}
The GPS measurements directly constrain the position of every node.
The covariance is determined by the number of satellites when the measurement is received.
The more satellites it receives, the smaller covariance it is.
\subsubsection{Magnetometer Factor}
The magnetometer can measure a vector of the magnetic field intensity.
The direction of this vector can help to determine orientation in the world frame.
We assume the magnetometer is calibrated offline without offset or bias.
First of all, we lookup table to get the magnetic intensity $\mathbf{z}^w$ of the local region in the ENU coordinate.
We assume that the magnetic intensity $\mathbf{z}^w$ is constant within this area.
Our measurement is denoted as $\mathbf{z}^{m}_t$.
The orientation of $\mathbf{z}^{m}_t$ should match $\mathbf{z}^w$ if we put the sensor coinciding with the ENU coordinate.
Inspired by this, the factor is derived as:
\begin{equation}
\begin{split}
\mathbf{z}^{m}_t - h^{m}_t(\mathcal{X})
&=\mathbf{z}^{m}_t - h^{m}_t(\mathbf{x}_t) \\
&=\frac{\mathbf{z}^{m}_t }{\|\mathbf{z}^{m}_t\|} -
\mathbf{q}^m_b \inv{\mathbf{q}^w_t}\frac{ \mathbf{z}^w }{\| \mathbf{z}^w\|},
\end{split}
\end{equation}
where $\mathbf{q}^m_b$ is the transformation from robot's center to the magnetometer's center, which is known and calibrated offline.
Since the magnetic field is easily affected by the environment, we only use the normalized vector without length.
The length is used to determine covariance.
If the length of measurement differs $\mathbf{z}^w$ a lot, we set a big covariance.
Otherwise, we use a small covariance.
\subsubsection{Barometer Factor}
The barometer measures the air pressure in an area.
We assume that the air pressure is constant at one altitude over a period of time.
So the air pressure can be converted to height linearly.
As the same as GPS, we set the first measurement as the origin height.
Then we get the measurement of height $z^m_t$.
Intuitively, the factor is a residual of height estimation, which is written as:
\begin{equation}
\mathbf{z}^{m}_t - h^{m}_t(\mathcal{X}) = \mathbf{z}^{m}_t - h^{m}_t(\mathbf{x}_t) =
{z}^{m}_t - z_t .
\end{equation}
Since this measurement is noisy, we caculate the variance of several measurments within a short time, and use it in the cost function.
\subsubsection{Other Global Factors}
Though we only specify GPS, magnetometer, and barometer factors in detail, our system is not limited to these global sensors.
Other global sensors and even some artificial sensors, such as Motion Capture system, WiFi and Bluetooth fingerprint, can be used in our system.
The key is to model these measurements as residual factors under one global frame.
\subsection{Pose Graph Optimization}
Once the graph is built, optimizing it equals to finding the configuration of nodes that match all edges as much as possible.
Ceres Solver~\cite{ceres-solver} is used for solving this nonlinear problem, which utilizes Gaussian-Newton and Levenberg-Marquadt approaches in an iterative way.
We run pose graph optimization at low frequency (1Hz).
After every optimization, we get the transformation for local frame to global frame.
Therefore, We can transform subsequent high-rate local poses (VO/VIO, 200Hz) by this transformation to achieve real-time high-rate global poses.
Since the pose graph is quite sparse, the computation complexity increases linearly with the number of poses.
We can keep a huge window for pose graph optimization to get accurate and globally drift-free pose estimation.
When the computation complexity exceeds real-time capability, we throw old poses and measurements, and keep the window in a limited size.
\section{Experimental Results}
\label{sec:experiments}
We evaluate the proposed system with visual and inertial sensors both on datasets and with real-world experiments.
In the first experiment, we compare the proposed algorithm with another state-of-the-art algorithm on public datasets.
We then test our system with self-developed sensor suite in the real-world outdoor environment.
The numerical analysis is generated to show the accuracy of our system in detail.
\subsection{Datasets}
We evaluate our proposed system using KITTI Datasets~\cite{geiger2012we}.
The datasets are collected onboard a vehicle,
which contains stereo images (Point Grey Flea 2, 1382x512 monochrome, 10 FPS) and GPS.
Images are synchronized and rectified.
The transformation between sensors is calibrated.
Also, the ground truth states are provided by the Inertial Navigation System (OXTS RT 3003).
We run datasets with stereo cameras, latitude, longitude, and altitude from raw GPS measurements.
The stereo cameras are used for local state estimation.
The local results are fused with GPS measurements in global optimization.
\begin{figure}
\centering
\includegraphics[width=0.45\textwidth]{01}
\caption{
\label{fig:kitti01} Rotation error and translation error plot in 10\_03\_drive\_0042.}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=0.45\textwidth]{09}
\caption{
\label{fig:kitti09} Rotation error and translation error plot in 09\_30\_drive\_0033.}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=0.4\textwidth]{propose_ORB}
\caption{
\label{fig:propose_ORB} Trajectories of one KITTI sequence (09\_30\_drive\_0033) recovered from ORB-SLAM and the proposed algorithm.
}
\end{figure}
\begin{table}
\centering
\caption{ RMSE\cite{sturm2012benchmark} in KITTI datasets in meters.\label{tab:kitti_error}}
\begin{tabular}{cccc}
\toprule
\multirow{2}{*}{Sequences} &
\multirow{2}{*}{Length[km] } &
\multicolumn{2}{c}{RMSE[m]}
\\
\cline{3-4}
& & ORB-SLAM & Proposed \\
\midrule
09\_30\_drive\_0016 & 0.39 & 0.18 & \textbf{0.12} \\
09\_30\_drive\_0018 & 2.21 & 0.83 & \textbf{0.24} \\
09\_30\_drive\_0020 & 1.23 & 0.71 & \textbf{0.27} \\
09\_30\_drive\_0027 & 0.69 & 0.57 & \textbf{0.15} \\
09\_30\_drive\_0033 & 1.71 & 3.01 & \textbf{0.27} \\
09\_30\_drive\_0034 & 0.92 & 1.04 & \textbf{0.20} \\
10\_03\_drive\_0027 & 3.72 & 1.25 & \textbf{0.28} \\
10\_03\_drive\_0042 & 2.45 & 12.48 & \textbf{0.63} \\
\bottomrule
\end{tabular}
\end{table}
In this experiment, we compare our results with ORB-SLAM~\cite{mur2015orb}, a state-of-the-art visual odometry method that works with stereo cameras.
Orb-slam is an optimization-based algorithm with powerful relocalization capability.
It maintains a map of keyframes and landmarks.
We evaluate RPE (Relative Pose Errors) and ATE (Relative Trajecotry Error) one results produced by proposed method and ORB-SLAM.
The RPE is caculated by the tool proposed in \cite{geiger2012we}.
The position and rotation RPE of two sequences are shown in Fig. \ref{fig:kitti01} and Fig. \ref{fig:kitti09} respectively.
For translation error, the proposed method is obviously lower than ORB-SLAM.
It shows that the position drift is effectively eliminated by GPS measurement.
For rotation error, the proposed method is not better than ORB-SLAM.
Because GPS can't directly measure rotation angles, it cannot improve local accuracy on rotation.
The RMSE (Root Mean Square Errors) of absolute trajectory error for more sequences in KITTI datasets is shown in Table.~\ref{tab:kitti_error}.
Estimated trajectories are aligned with the ground truth by Horn's method \cite{horn1987closed}.
For all sequences, the proposed method outperforms orb-slam, which demonstrates that fusing GPS measurements
effectively increases the accuracy of the estimated trajectory.
Intuitively, GPS corrects accumulated drifts in the long run.
Trajectories of one KITTI sequence (09\_30\_drive\_0033) recovered from ORB-SLAM and the proposed algorithm are shown in Fig. \ref{fig:propose_ORB}.
Trajectories are aligned with Google map from the bird-eye view.
From the picture, we can see that the estimated trajectory of ORB-SLAM drifts several meters at the end.
The estimated trajecotry of proposed method matches the road network well.
This experiment demonstrates that proposed system has advantage of pose estimation in a long distance.
\subsection{Real-world experiment}
\begin{figure}
\centering
\includegraphics[width=0.4\textwidth]{device_in_paperb}
\caption{\label{fig:device} The sensor suite we used for the outdoor experiment, which contains two forward-looking global shutter cameras (MatrixVision mvBlueFOX-MLC200w) with 752x480 resolution. We use the built-in IMU, magnetometer, barometer and GPS from the DJI A3 flight controller.}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=0.45\textwidth]{trajectory_b}
\caption{
\label{fig:trajectory_b} The trajectories of our small-scale outdoor experiment recovered from VIO, the proposed algorithm and MSF respectively. We use RTK trajectory as ground truth.}
\end{figure}
\begin{figure}
\centering
\includegraphics[width=0.45\textwidth]{rpe_b}
\caption{
\label{fig:rpe_b} Relative pose error plot in our small scale outdoor experiment.}
\end{figure}
\begin{table}
\centering
\caption{{RMSE[m] in outdoor experiment.} \label{tab:outdoor_experiment}}
\begin{tabular}{c c c c c}
\toprule
\multirow{2}{*}{Sequence} & \multirow{2}{*}{Length[m]} &
\multicolumn{3}{c}{RMSE[m]} \\
\cline{3-5}
& & VIO & Proposed & MSF \\
\hline
Outdoor1 & 242.05 & 0.77 & \textbf{0.40} & 0.66 \\
Outdoor2 & 233.89 & 0.66 & \textbf{0.41} & 0.58 \\
Outdoor3 & 232.13 & 0.75 & \textbf{0.38} & 0.63 \\
\bottomrule
\end{tabular}
\end{table}
\begin{figure}
\centering
\includegraphics[width=0.4\textwidth]{pathonmap}
\caption{
\label{fig:pathonmap} The trajectories of our large-scale outdoor experiment recovered from VIO and the proposed algorithm (VIO + GPS + magnetometer + barometer) respectively.}
\end{figure}
In this experiment, we used self-developed sensor suite which were equipped with multiple sensors.
The sensor suite is shown in Fig.~\ref{fig:device}.
It contains stereo cameras (mvBlueFOX-MLC200w, 20Hz) and DJI A3 controller\footnote{\url{http://www.dji.com/a3}}, which inculdes built-in IMU, magnetometer, barometer and GPS receiver.
We also equip it with RTK (Real-Time Kinematic)\footnote{\url{https://www.dji.com/d-rtk}} receiver for high-accurate localization.
The RTK base station is established on the top of a building.
The RTK can provide precise positioning of one centimeter vertically and horizontally, which is treated as ground truth.
We run states estimation with all available sensors.
For accuracy comparison, we walked two circles on the ground.
We compare our results against MSF~\cite{lynen2013robust}, which fuses visual odometry, inertial measurements, and GPS in an EKF-based framework.
The trajecotry comparison is shown in Fig.~\ref{fig:trajectory_b}, and the RPE (Relative Pose Error) is plotted in Fig.~\ref{fig:rpe_b}.
We can see obvious translation drift in the estimated trajectory of VIO.
From the relative pose error, we can see that the proposed system improved the accuracy of VIO a lot.
Also, the proposed system outperforms MSF~\cite{lynen2013robust}.
The RMSE of more outdoor experiments is shown in Table.~\ref{tab:outdoor_experiment}.
Our system achieved the best performance in all sequence.
We also perform a larger outdoor experiment and compared the results with Google map.
Estimated trajecoties are shown in Fig.~\ref{fig:pathonmap}.
The estimated trajecotry of VIO drifted along with distance.
Thanks to the global sensors, the trajectory of proposed system is almost drift-free, which matches the road map very well.
\section{Conclusion}
\label{sec:conclusion}
In this paper, we propose a optimization-based framework to fuse local estimations with global sensors.
Local estimations came from previous VO/VIO work.
Global sensors are treated as general factors in pose graph optimization.
This system achieves locally accurate and globally drift-free pose estimation.
We demonstrate the impressive performance of our system on public datasets and with real-world experiments.
\clearpage
| {'timestamp': '2019-01-14T02:20:39', 'yymm': '1901', 'arxiv_id': '1901.03642', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03642'} | arxiv |
\section{Introduction}
\label{sec:intro}
\input{tex/intro.tex}
\section{Related Work}
\label{sec:related}
\input{tex/related.tex}
\section{Method}
\label{sec:method}
\input{tex/method.tex}
\section{Experiments}
\label{sec:results}
\input{tex/results/results.tex}
\section{Conclusion}
\label{sec:conclusion}
\input{tex/conclusion.tex}
\clearpage
{\small
\bibliographystyle{ieee}
\subsection{Layout Prediction}
Additional examples comparing images generated with our scene context model and those generated from Johnston \textit{et al.} \cite{img_gen_from_scene_graph18} are shown in Figure \ref{fig:supp_visual}. To highlight the layout, we overlaid the predicted object boundaries over the images. The bounding box and the name of the corresponding object share the same color in the overlaid pictures.
For ease of comparison in this figure, the ground truth images (column d) are flanked by our results (column c) and the Johnston \textit{et al.} images (column e). In the first row, note the less cluttered scene layout in our model leading to more realistic image generation. In the second row, note that the location of the hands (pink, yellow) and jacket (teal) relative to the head (pink) is more realistic in our model. The third and fourth rows show uncluttered backgrounds (sky and wall), more bounded object shapes, and fewer image generation artifacts. Fifth row shows an example of blurry object (bear) and background (wall and bush) generation. However, our generated objects are more recognizable.
In the last row, both models failed to predict the location of sunglasses (orange), which are both placed far away from the face. However, our scene context model helped in preserving the overall shape of the object from its parts. Overall, we observed that the predicted scene layouts have better compliance with the input scene graph, as well as less cluttered and more realistic relations. This observations on visual inspection of layouts correlate with the Mean Opinion Relation Score (MORS) report in the results section, and reproduced here (Table \ref{tab:mors}).
\begin{table}[]
\centering
\begin{tabular}{llll}
\textbf{Relation category} & \textbf{JJ} \cite{img_gen_from_scene_graph18} & \textbf{Ours} \\
\hline
Semantic & 0.60 & \textbf{0.78} \\
Geometric & 0.64 & \textbf{0.68} \\
Possessive & 0.62 & \textbf{0.80} \\
Miscellaneous & 0.78 & \textbf{0.86} \\
\hline
Overall MORS & 0.64 & \textbf{0.74} & \\
\end{tabular}
\caption{Mean Opinion Relation score (MORS) on 100 random images and relationship pairs generated from the colored scene graphs in Visual Genome test set. The score is broken by relation category. Each image was rated by five workers.
}
\label{tab:mors}
\end{table}
\input{tex/supp_visual_vg.tex}
\subsection{Image Quality}
In addition to the RGB quality evaluation by workers, we computed the Frechet Inception Distance (FID)
\cite{FID_NIPS2017} on the entire test set. Table \ref{tab:fid} shows the FID scores for images generated on COCO-stuff and Visual Genome test set respectively. Lower FID value denotes better image quality and diversity. The Johnston \textit{et al.} model had better FID scores that ours, even though in the Mechanical Turk experiments reported in our main text, our model produces more realistic images in a direct A versus B comparison. Since the FID is based on feature extraction, we speculate that the FID score is not capturing the spatial relationships between objects in these complex scenes. We note a similar result in Johnston \textit{et al.}, where their Inception scores were worse than the StackGAN model, even though their images were rated higher. Together, these results suggest that a new quantitative metric is needed for this particular task.
We also observed anecdotally that the color images from our model were less vibrant. We speculate that the \emph{sum pooling} in our scene context network may be introducing the undesirable low contrast effect in the generated images. We attribute the low contrast as one of the primary reasons why our model's output did not have better FID score than the Johnson \textit{et al.} model. Further investigation on better pooling mechanisms to reduce the artifact remains as a future work.
\begin{table}[tb]
\centering
\begin{tabular}{llll}
FID & JJ \cite{img_gen_from_scene_graph18} & \textbf{Ours} \\
\hline
COCO-stuff & 92.6\% & 99.6\% \\
\hline
Visual Genome & 94.4\% & 100.7\% \\
\hline
\end{tabular}
\caption{FID score on COCO-stuff \cite{coco-stuff} and Visual Genome \cite{visual_genome16} test dataset. Lower FID score generally denotes better quality.}
\label{tab:fid}
\end{table}
\subsection{Datasets}
\textbf{COCO}: We performed experiments on the 2017 COCO-Stuff
dataset \cite{coco-stuff}, which augments a subset of the COCO
dataset \cite{coco} with additional stuff categories. The dataset annotates
$40K$ train and $5K$ val images with bounding boxes
and segmentation masks for $80$ thing categories (people,
cars, etc.) and $91$ stuff categories (sky, grass, etc.).
Similar to \cite{img_gen_from_scene_graph18}, we used thing and stuff annotations to construct synthetic scene
graphs based on the 2D image coordinates of the objects,
encoding six mutually exclusive geometric relationships: `left'
`of', `right of', `above', `below', `inside', and `surrounding'.
We ignored objects covering less than 2\% of the image,
and used images with $3$ to $8$ objects.
\textbf{Visual Genome}: We experimented on Visual Genome [26]
version 1.4 (VG) which comprises 108,077 images annotated
with scene graphs.
Similar to the pre-processing described in \cite{img_gen_from_scene_graph18},
we used object and relationship categories
occurring at least 2,000 and 5,00 times, respectively in
the training set. The resulting training set included 178 object and 45 relationship types.
We ignored small objects, and only selected images with object counts between 3
and 30 and at least one relationship. This pre-processing gave us 62,565 training, 5,506 validation, and 5,088 test images with an
average of 10 objects and five relationships per image.
Visual Genome does not provide segmentation masks, so
we omitted the mask prediction loss for models trained on VG.
\subsection{Qualitative Results}
Sample images are shown in Figure \ref{fig:coco} for COCO-stuff, and Figure \ref{fig:visual} for Visual Genome. We observe anecdotally that scene context helps in preserving relationship types and also generate more realistic images. Quantitative metrics for assessing the quality of generated images are limited in efficacy, especially in this task where scene graph compliance is important. We therefore performed subjective evaluations on Mechanical Turk to compare the performance of our model to Johnson \textit{et al.} \cite{img_gen_from_scene_graph18}. Each query was rated by five independent workers. In approximately 10\% of the trials, we used ground truth images to ensure task compliance and filtered out bad actors.
\paragraph{COCO.}
For COCO-stuff, we leveraged the included captions to perform an AB-X comparison, inspired by Johnson \textit{et al.} \cite{img_gen_from_scene_graph18}, where we asked raters in a two-alternative force choice task to select ``which image matches the caption better''. As shown in Figure \ref{fig:mscoco_abx}, when the ground truth box and mask are provided, our model outperforms the Johnson \textit{et al.} model by a significant margin (60.5\% to 39.5\%). However, our scene graph context model performs worse when generating images using the predicted box and mask. We speculate that the scene graph context and matching loss renders the model less tolerant to noisy box and mask predictions, since the model was never trained under those conditions.
We also carried out an A vs. B test by presenting paired images from the two models and asking workers to select the image that looked more realistic. The results of this user test confirmed the previous findings that our model performed better when provided with ground truth box and masks, but were not as robust to the noisier predicted boxes and masks (Figure \ref{fig:mscoco_avb})
\begin{figure}
\begin{subfigure}[a]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{images/ABX_captions_coco.png}
\end{subfigure}
\begin{subfigure}[b]{0.45\textwidth}
\centering
\begin{tabular}{llll}
- & JJ \cite{img_gen_from_scene_graph18} & \textbf{Ours} \\
\hline
GT box and GT mask & 39.5\% & \textbf{60.5\%} \\
Predicted box and mask & \textbf{63.8\%} & 36.2\% \\
\hline
\end{tabular}
\end{subfigure}
\caption{AB-X comparison inspired by Fig.7 in Johnson \textit{et al.} \cite{img_gen_from_scene_graph18} on images drawn from the COCO-stuff test set. $N=991$ images in the test set were rated by workers to determine which image matches the caption better. See top for an example query (A = Ours, B = JJ model).}
\label{fig:mscoco_abx}
\end{figure}
\begin{figure}
\begin{subfigure}[a]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{images/ABX.png}
\end{subfigure}
\begin{subfigure}[b]{0.45\textwidth}
\centering
\begin{tabular}{llll}
- & JJ \cite{img_gen_from_scene_graph18} & \textbf{Ours} \\
\hline
GT box and GT mask & 36.9\% & \textbf{63.1\%} \\
Predicted box and mask & \textbf{67.8\%} & 32.2\% \\
\hline
\end{tabular}
\end{subfigure}
\caption{AvB comparison on images drawn from the COCO-stuff test set. Each worker was asked to rate which image looked more realistic. We tested $N=991$ test set images, with five independent ratings per image.}
\label{fig:mscoco_avb}
\end{figure}
\paragraph{Visual Genome.}
Visual Genome has more complex relationships compared to those derived from COCO-stuff, so we hypothesized that our model's scene context network would provide more of a benefit. For this dataset, we also conducted AB-X and A-B testing against Johnston \textit{et al.} \cite{img_gen_from_scene_graph18} to measure performance in preserving spatial relationships. For the AB-X test, since captions do not exist in Visual Genome, we randomly sampled relations to generate pseudo-captions (``person on top of grass'') and asked workers to select which image from the two models better matched the relation.
These user studies revealed that our model outperformed Johnson \textit{et al.} in terms of both generating realistic images (A-B test, 58\% compared to 42\%), and also generating images that better comply with the scene graph (AB-X, 57\% compared to 43\%).
For our qualitative studies in this section, we have asked workers to directly compare generated images from both models on image quality. In the next section, we use standalone metrics that measure compliance to the scene graph's spatial layout and semantic relationships.
\begin{table}[]
\centering
\begin{tabular}{llll}
Study & JJ \cite{img_gen_from_scene_graph18} & \textbf{Ours} \\
\hline
AB-X (Caption) & 42.6\% & \textbf{57.4\%} \\
\hline
AvB & 42.7\% & \textbf{58.3\%}\\
\hline
\end{tabular}
\caption{Visual Genome qualitative study results. Our model outperformed Johnson \textit{et al.} when workers were asked to select which image was more realistic (AvB), and which image better matched a provided pseudo-caption (AB-X).}
\end{table}
\subsection{Layout Prediction}
In addition to evaluating final image quality, we also compared model performance at the intermediate stage of layout prediction (``Scene layout'' in Figure \ref{fig:pipeline}). Although Intersection-over-Union (IoU) was previously used to measure agreement with the ground truth image, IoU is not the best metric to measure how well geometric relationships between objects in the predicted image comply with the input scene graph. Although IoU may appear as a strict measurement for localization, it is not an indicator of a compliant layout. IoU may not correlate with the geometric relationship as depicted in Figure \ref{fig:relation_score}. The inferred relationship could be incorrect even with significant IoU. Even zero IoU (no overlap with ground truth) could still preserve the relationship indicated in the scene graph.
\paragraph{Relation Score.}
We instead propose a new metric, \emph{relation score}, that measures the compliance of geometric or spatial relationships more accurately than IoU. As an example, if the scene graph specifies that object A is on the left of object B, it is sufficient for the model to comply with that relationship, without requiring the size of the objects to match the ground truth image. See Figure \ref{fig:relation_score} for a graphical illustration.
\begin{figure}[!t] \begin{center}
\begin{subfigure}[b]{
0.5\textwidth}
\includegraphics[width=\textwidth]{images/relation_score.png}
\end{subfigure}
%
\caption{Relation score metric vs IoU. Left: Example ground truth relationship. Center: A high IoU does not guarantee compliance with the intended geometric relationship. Right: Even with $0$ IoU the predicted relationship could still be compliant with the intended relationship }
\label{fig:relation_score}
\end{center}\end{figure}
Because the COCO-stuff relationships are all mutually exclusive and spatial (e.g. 'above', 'below'), we can automate the relation score calculation to verify compliance with the scene graph relationships. We define the relation score as the fraction of spatial relationships that are satisfied in each model's predicted layout. Our scene context model outperforms Johnson \textit{et al.} in both metrics: IoU (0.483 vs. 0.459) and the relation score (0.54 vs. 0.51), as shown in Table \ref{tab:rel_score_coco}.
\begin{table}[]
\centering
\begin{tabular}{llll}
\textbf{Metric} & \textbf{JJ \cite{img_gen_from_scene_graph18}} & \textbf{Ours} \\
\hline
Avg IOU & 0.459 & \textbf{0.483} \\
Relation score & 0.512 & \textbf{0.536} \\
\hline
\end{tabular}
\caption{Relationship compliance. Relation score (the higher the better) on COCO stuff test set.}
\label{tab:rel_score_coco}
\end{table}
\paragraph{Mean Opinion Relation Score.} The relationship vocabulary in Visual Genome (VG) is rich, and not limited to spatial relationships, so automated computation of relation score metric isn't possible for VG. Instead, we propose a Mean Opinion Relation Score (MORS) metric for relationship compliance. We first analyze the types of relationships contained in this dataset.
We used the relation types categories from Zellers \textit{et al.} \cite{neural_motifs_2017}. Of the $46$ relations in Visual Genome, 45\% of the relations are classified as \textit{Geometric}, indicating a spatial relationship. \textit{Semantic} (holding, carrying, walking, etc) and \textit{Possessive} (belonging to, have, etc) constituted 11\% and 10\% of the relationships, respectively. The remainder were marked as \textit{Miscellaneous}, which included descriptors such as: 'and', 'for', or 'of'. This classification is depicted in Table \ref{tab:relclasses}. Figure \ref{fig:color_sg} shows a sample scene graph, with the relationships color-coded (Geometric: green, Semantic: blue, Possessive: orange, and Miscellaneous: grey).
\begin{figure}
\centering
\includegraphics[width=0.4\textwidth]{images/vg/color_sg_example.png}
\caption{Example scene graph from the Visual Genome dataset, with relationships between objects colored according to their category: Geometric (green), Possessive (orange) and Miscellaneous (grey).}
\label{fig:color_sg}
\end{figure}
To compute the MORS, we selected single image-relationship pairs, and asked workers to rate whether the relationship is true in the image (Figure \ref{fig:mors}, top). MORS is then defined as the fraction of tested relationships that were found present in the generated image. Visual Genome has several well-known issues, such as semantically overlapping categories, non-exhaustive annotations, and noisy annotations. We therefore manually curated accurate annotations to determine the score. Our results are shown in Figure \ref{fig:mors}. Our model's overall MORS was higher than that of Johnson \textit{et al.} (0.74 compared to 0.64). We broke down performance by the relation category and observed that for geometric relationships, our models are relatively close (0.68 compared to 0.64), which we expect due to the layout placement mechanism in both models. However, our model was significantly better on non-spatial relationships such as semantic (0.78 vs 0.60) or possessive (0.80 vs 0.62). Our scene context network also includes semantic embeddings, which could be responsible for this improvement.
Note that the relation score measures scene graph compliance at the scene layout stage, with the bounding boxes and segmentation masks. In contrast, MORS can measure more complex non-spatial relationships, and tracks compliance of the final generated image. For more details on the qualitative studies, see the supplemental information.
\begin{table}[]
\centering
\begin{tabular}{ll}
\textbf{Relation category} & \textbf{Relations} \\
\hline
Semantic & covering, eating, standing on, \\
& carrying, looking at, walking on, \\
& sitting on, sitting in, standing in, \\
& holding, riding \\
\hline
Geometric & next to, above, beside, behind, by, \\
& laying on, hanging on, under, on, \\
& below, against, attached to, near, \\
& on top of, at, in front of, around, \\
& along, on side of, parked on\\
\hline
Possessive & has, belonging to, inside, with, over, \\
& covered in, have, in, wears, wearing\\
\hline
Miscellaneous & and, for, of, made of\\
\hline
\end{tabular}
\caption{Relationship categories observed in Visual Genome, inspired by Zeller \textit{et al.} \cite{neural_motifs_2017}.}
\label{tab:relclasses}
\end{table}
\begin{figure}
\begin{subfigure}[a]{0.45\textwidth}
\centering
\includegraphics[width=0.7\textwidth]{images/MORS.png}
\end{subfigure}
\begin{subfigure}[b]{0.45\textwidth}
\centering
\begin{tabular}{llll}
\textbf{Relation category} & \textbf{JJ} \cite{img_gen_from_scene_graph18} & \textbf{Ours} \\
\hline
Semantic & 0.60 & \textbf{0.78} \\
Geometric & 0.64 & \textbf{0.68} \\
Possessive & 0.62 & \textbf{0.80} \\
Miscellaneous & 0.78 & \textbf{0.86} \\
\hline
Overall MORS & 0.64 & \textbf{0.74} & \\
\hline
Avg IOU & 0.223 & \textbf{0.234} \\
\end{tabular}
\end{subfigure}
\caption{Mean Opinion Relation score (MORS) on 100 random images and relationship pairs generated from the colored scene graphs in Visual Genome test set. The score is broken by relation category. Each image was rated by five workers. IoU corresponds to all predicted boxes in the test set.}
\label{fig:mors}
\end{figure}
\input{tex/results/visual_comparison_coco.tex}
\input{tex/results/visual_comparison_vg_new.tex}
| {'timestamp': '2019-01-17T02:01:07', 'yymm': '1901', 'arxiv_id': '1901.03762', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03762'} | arxiv |
\section{Introduction}
\label{sec_introduction}
Relaying along with OFDMA is being considered as a promising technology for providing high data rate connectivity anywhere, anytime\cite{Salem_TCS_2010}.
Physical layer security aspects in relay-assisted communication has recently gathered considerable attention in the research community \cite{amitav_TCST_2014}. Based on the relaying strategy, e.g., amplify-and-forward (AF) or decode-and-forward (DF), resource allocation problems are formulated differently and are thus investigated separately.
Broadly, there exist two kinds of wire tapping scenarios: single eavesdropper with trusted users \cite{Jindal_CL_2015, Jeong_TSP_2011, Derrick_TWC_2011} and untrusted users \cite{RSAINI_TIFS_2016}. The study in \cite{Jindal_CL_2015} considered subcarrier and power allocation problems in an AF relay-assisted OFDM system with single eavesdropper. Assuming availability of direct path, \cite{Jeong_TSP_2011} considered sum rate maximization problem under total system power constraint in DF relay-assisted secure cooperative communication (DFSCC) for a single source-destination pair with a single eavesdropper. Multiuser resource allocation problem in OFDMA-based DFSCC with single eavesdropper was solved in \cite{Derrick_TWC_2011}. Recently, resource allocation problems for improving secure capacity and system fairness in OFDMA system with untrusted users and single friendly jammer have been considered in \cite{RSAINI_TIFS_2016}. \emph{To the best of our knowledge, OFDMA-based DFSCC with multiple untrusted users has not yet been considered in the literature.}
We consider two resource allocation problems. First, sum secure rate maximization is studied subject to individual power constraints on source and relay, due to their geographically apart locations. Second, sum power minimization is solved subject to the fairness constraint in terms of per-user minimum support secure rate. The key contributions are as follows: (i) We derive secure rate positivity constraints for each subcarrier, which includes the optimal subcarrier allocation policy. (ii) We prove that the two problems described above belong to the class of generalized convex problems which can be solved optimally. (iii) We show that the optimal secure rate for a user is achieved when rates of source-relay and relay-user links over a subcarrier are equal. (iv) We also present analytical and graphical interpretation of the derived optimal solutions.
\section{System Model}
\label{sec_system_model}
We consider the downlink of an OFDMA-based cooperative communication system with a trusted DF relay controlled by a base station (hereafter referred as source $\mathcal{S}$). The users have mutual untrust and request secure communication from $\mathcal{S}$. The subcarriers on $\mathcal{S}$-to-$\mathcal{R}$ and $\mathcal{R}$-to-$m$th user ($\mathcal{U}_m$) links are assumed to follow quasi-static Rayleigh fading. Availability of perfect CSI for each link is assumed. All nodes are equipped with single antenna, and $\mathcal{R}$ operates in half-duplex mode\cite{Jindal_CL_2015, Jeong_TSP_2011}. There is no direct connectivity between $\mathcal{S}$ and $\mathcal{U}_m$ \cite{Derrick_TWC_2011}.
DFSCC with trusted $\mathcal{R}$ and $M$ untrusted users is a multiple eavesdropper scenario, where for each user there exist $M-1$ eavesdroppers, and the strongest of them is considered as the equivalent eavesdropper. Over a subcarrier $n$, the secure rate $R_{s_{n}}^m$ of $\mathcal{U}_m$ is defined as the non-negative difference of the rate $R_{n}^m$ of $\mathcal{U}_m$ and the rate $R_{n}^e$ of the equivalent eavesdropper $\mathcal{U}_e$ \cite{RSAINI_TIFS_2016}. Mathematically, the secure rate is expressed as:
\begin{align}\label{rate_definition_1}
R_{s_{n}}^m = \left \{ R_{n}^m - \max\limits_{o \in \{1,2,\cdots M\} \setminus m} R_{n}^o \right \}^+ = \left\{ R_{n}^m - R_{n}^e \right \}^+
\end{align}
where $x^+ \hspace{-0.25mm}=\hspace{-0.25mm} \max\{0,x\}$.
In half-duplex DF cooperative communication, $R_{n}^m = \frac{1}{2} \min \left \{ R_{n}^{sr},R_{n}^{rm} \right \}$, where $R_{n}^{sr}$ and $R_{n}^{rm}$ respectively denote the rates of $\mathcal{S}$-to-$\mathcal{R}$ and $\mathcal{R}$-to-$\mathcal{U}_m$ links over subcarrier $n$.
Using this, (\ref{rate_definition_1}) can be simplified as \cite{Jeong_TSP_2011}:
\begin{equation}\label{rate_definition_4}
R_{s_{n}}^m = \left(1/2\right) \left\{ \min{ (R_{n}^{sr}, R_{n}^{rm} ) } - R_{n}^{re} \right\}^+.
\end{equation}
Next, we discuss the sum secure rate maximization problem.
\section{Sum Secure Rate Maximization in DFSCC}
\label{sec_sum_rate_imp}
Denoting $P_{n}^s$ and $P_{n}^r$ respectively as powers of $\mathcal{S}$ and $\mathcal{R}$ over subcarrier $n$, the optimization problem can be stated as:
\begin{align}\label{opt_prob_rate_max}
& \mathcal{P}0: & & \underset{\pi_{n}^m, P_{n}^s, P_{n}^r} {\text{maximize}}
\left[ R_s\left(\pi_{n}^m, P_{n}^s, P_{n}^r\right) = \sum_{m=1}^M \sum_{n=1}^N \pi_{n}^m R_{s_{n}}^m \right] \nonumber \\
& \text{s.t.}
& & C1: \sum_{m=1}^M \pi_{n}^m \leq 1 \text{ } \forall n, \quad C2: \pi_{n}^m \in \{0,1\} \text{ } \forall m, n,\nonumber \\
&
& & C3: \sum_{n=1}^N P_{n}^s \leq P_S, \quad \quad C4: \sum_{n=1}^N P_{n}^r \leq P_R, \nonumber \\
&
& & C5: P_{n}^s\ge 0, P_{n}^r\ge 0 \text{ } \forall n
\end{align}
where $\pi_{n}^m$ is a subcarrier allocation variable, indicating whether subcarrier $n$ is allocated to $\mathcal{U}_m$ or not. Constraints $C1$ and $C2$ ensure that a subcarrier is allocated to only one user. Power budgets $P_S$ and $P_R$ at $\mathcal{S}$ and $\mathcal{R}$ are respectively incorporated in $C3$ and $C4$. $C5$ includes positivity constraints. For each subcarrier, there are two real variables $P_{n}^s$, $P_{n}^r$, and one binary variable $\pi_{n}^m$. Because of $\log$ and $\max$ functions in objective, $\mathcal{P}0$ is a mixed integer non-linear programming problem, which is NP hard. To solve $\mathcal{P}0$, first we determine subcarrier allocation and then we complete power allocation.
\subsection{Subcarrier Allocation}\label{subsec_subcarr_alloc}
The feasibility of achieving positive secure rate by $\mathcal{U}_m$ over a subcarrier $n$ is described by the following proposition.
\begin{proposition}\label{proposition_rate_positivity}
In DFSCC with untrusted users, positive secure rate over a subcarrier $n$ can be obtained if and only if (i) the subcarrier is allocated to the best gain user, and (ii) $\mathcal{R}$-to-$\mathcal{U}_e$ link of the eavesdropper $\mathcal{U}_e$ is the bottleneck link compared to the $\mathcal{S}$-to-$\mathcal{R}$ link over that subcarrier.
\end{proposition}
\begin{IEEEproof}
$R_{s_{n}}^m$ in (\ref{rate_definition_4}) can be restated as:
\begin{align}\label{simplified_sec_rate_def}
R_{s_{n}}^m = \frac{1}{2}
\begin{cases}
R_{n}^{sr} - R_{n}^{re} & \text{if $R_{n}^{re}<R_{n}^{sr}<R_{n}^{rm}$ }\\
R_{n}^{rm} - R_{n}^{re} & \text{if $R_{n}^{re}<R_{n}^{rm}<R_{n}^{sr}$ }\\
0 & \text{otherwise}.
\end{cases}
\end{align}
From (\ref{simplified_sec_rate_def}) we note that, conditions for positive secure rate are: (a) $R_{n}^{re}<R_{n}^{rm}$ and (b) $R_{n}^{re}<R_{n}^{sr}$. Let $\gamma_{n}^{sr}$, $\gamma_{n}^{rm}$, and $\gamma_{n}^{re}$ respectively denote the channel gains of $\mathcal{S}$-to-$\mathcal{R}$, $\mathcal{R}$-to-$\mathcal{U}_m$, and $\mathcal{R}$-to-$\mathcal{U}_e$ links over subcarrier $n$.
The rates $R_{n}^{sr}$, $R_{n}^{rm}$, and $R_{n}^{re}$ are given by
$\log_2 \left( 1+ P_{n}^s\gamma_{n}^{sr}/{\sigma^2}\right)$,
$\log_2 \left( 1+ P_{n}^r\gamma_{n}^{rm}/{\sigma^2}\right)$, and
$\log_2 \left( 1+ P_{n}^r\gamma_{n}^{re}/{\sigma^2}\right)$, respectively.
Here $\sigma^2$ is the additive white Gaussian noise (AWGN) variance. Condition (a) $R_{n}^{re}<R_{n}^{rm}$, simplified as $\gamma_{n}^{re} < \gamma_{n}^{rm}$, indicates the optimal subcarrier allocation policy which can be stated as:
\begin{align}\label{subcarrier_alloc_relay}
\pi_{n}^m=
\begin{cases}
1 & \text{if $\gamma_{n}^{rm} > \gamma_{n}^{re}\triangleq\max\limits_{o \in \{1,2,\cdots M\} \setminus m} \gamma_{n}^{ro}$}\\
0 & \text{otherwise.}
\end{cases}
\end{align}
Condition (b) $R_{n}^{re}<R_{n}^{sr}$, simplified as ${P_{n}^r \gamma_{n}^{re}}/\sigma^2<{P_{n}^s \gamma_{n}^{sr}}/\sigma^2$, should be incorporated as a power optimization constraint. \end{IEEEproof}
Following the observations $R_{n}^{re}\hspace{-0.5mm}<\hspace{-0.5mm}R_{n}^{rm}$ and $R_{n}^{re}\hspace{-0.5mm}<\hspace{-0.5mm}R_{n}^{sr}$ in Proposition \ref{proposition_rate_positivity}, $R_{s_{n}}^m$ can be rewritten without $\max$ operator as:
\begin{align}\label{simplified_objective}
R_{s_{n}}^m = \frac{1}{2} \left[ \log_2 \left( \frac{1+ \min{ \left( \frac{P_{n}^s\gamma_{n}^{sr}}{\sigma^2}, \frac{P_{n}^r \gamma_{n}^{rm}}{\sigma^2} \right)}} {1+\frac{P_{n}^r \gamma_{n}^{re}}{\sigma^2}} \right) \right].
\end{align}
\subsection{Power Allocation}\label{subsec_power_alloc}
Ensuring $R_{n}^{re}\hspace{-0.5mm}<\hspace{-0.5mm}R_{n}^{rm}$ through optimal subcarrier allocation \eqref{subcarrier_alloc_relay} and enforcing $R_{n}^{re}\hspace{-0.5mm}<\hspace{-0.5mm}R_{n}^{sr}$ as a constraint, equivalent power allocation problem for $\mathcal{P}0$ using \eqref{simplified_objective} can be formulated as:
\begin{align}\label{opt_prob_rate_max_simplified_obj}
&\mathcal{P}1:\hspace{-3mm}&&\underset{P_{n}^s, P_{n}^r, t_n} {\text{maximize}} \left[ \widehat{R_{s}}(t_n, P_n^r) \triangleq \sum_{n=1}^N \frac{1}{2} \left \{ \log_2 \left( \frac{1+ t_n} {1+ \frac{P_{n}^r \gamma_{n}^{re}}{\sigma^2}} \right) \right \} \right] \nonumber \\
& \text{s.t.}
& & C1: t_n \leq \frac{P_{n}^s\gamma_{n}^{sr}}{\sigma^2} \text{ } \forall n,\quad C2: t_n \leq \frac{P_{n}^r\gamma_{n}^{rm}}{\sigma^2} \text{ } \forall n, \nonumber \\
&
& & C3, C4, C5, \text{as in } \eqref{opt_prob_rate_max},
\quad C6: \frac{P_{n}^r \gamma_{n}^{re}}{\sigma^2} \le \frac{P_{n}^s \gamma_{n}^{sr}}{\sigma^2}\text{ } \forall n .
\end{align}
Constraints $C1-C2$ come from the definition of $\min\left\lbrace\cdot\right\rbrace$, $C6$ comes from secure rate positivity requirements given by Proposition \ref{proposition_rate_positivity}. Due to non-concave objective function $\widehat{R_{s}}$, $\mathcal{P}1$ is non-convex. However, via the following lemma, we show that $\mathcal{P}1$ belongs to the class of generalized convex problems.
\begin{lemma}\label{PL:lemma}
The objective function of $\mathcal{P}1$ is pseudolinear on the feasible region defined by the constraints, and the solution obtained from the KKT conditions is the global optimal.
\end{lemma}
\begin{IEEEproof}
The objective function $\widehat{R_{s}}\left(t_n, P_{n}^r\right)$ of $\mathcal{P}1$ is a pseudolinear function~\cite{komlosi1993first} of $t_{n}$ and $P_{n}^r$, with $\frac{\partial \widehat{R_{s}}}{\partial t_{n}} = \frac{1}{2(1+t_n)} \triangleq a_n$ and $\frac{\partial \widehat{R_{s}}}{\partial P_{n}^r} = \frac{-\gamma_{n}^{re}}{2(\sigma^2+P_{n}^r\gamma_{n}^{re})} \triangleq b_n$, because $\frac{\partial \widehat{R_{s}}}{\partial t_{n}}, \frac{\partial \widehat{R_{s}}}{\partial P_{n}^r}\neq 0$ in the entire feasible region defined by the linear constraints $C1-C6$.
Moreover, determinant of the bordered Hessian is given as:
$Det(B_{H})=
\begin{vmatrix}
0 & \frac{\partial \widehat{R_{s}}}{\partial t_n} & \frac{\partial \widehat{R_{s}}}{\partial P_n^r}\\
\frac{\partial \widehat{R_{s}}}{\partial t_n} & \frac{\partial^2 \widehat{R_{s}}}{\partial t_n^2} & \frac{\partial^2 \widehat{R_{s}}}{\partial {t_n}\partial P_n^r} \\
\frac{\partial \widehat{R_{s}}}{\partial P_n^r} & \frac{\partial^2 \widehat{R_{s}}}{\partial P_n^r \partial {t_n}} & \frac{\partial^2 \widehat{R_{s}}}{\partial {P_n^r}^2} \end{vmatrix}
=
\begin{vmatrix}
0 & a_n & b_n\\
a_n & -a_n^2 & 0 \\
b_n & 0 & b_n^2 \end{vmatrix}
= 0.$\\
Following this and \cite[Theorem 4.3.8]{Bazaraa}, along with the knowledge that constraints are linear and differentiable, it can be inferred that the KKT point is the global optimal solution.
\end{IEEEproof}
The optimal power allocation ($P_{n}^s$, $P_{n}^r$) obtained after solving KKT conditions is characterized by following Theorem.
\begin{theorem}\label{theorem_one}
In DFSCC, maximum secure rate over a subcarrier is achieved when the following relationship holds
\begin{equation}
\label{max_capacity_condition}
P_{n}^s \gamma_{n}^{sr} = P_{n}^r \gamma_{n}^{rm}.
\end{equation}
\end{theorem}
\begin{IEEEproof}
Lagrangian $\mathcal{L}_1$ of the problem $\mathcal{P}1$ can be stated as:
\begin{align}\label{lagrange_rate_maximization}
\mathcal{L}_1 = &\sum_{n=1}^N \frac{1}{2} \left \{ \log_2 \left( \frac{1+ t_n} {1+ \frac{P_{n}^r \gamma_{n}^{re}}{\sigma^2}} \right) \right \} - \sum_{n=1}^N x_n \left( t_n - \frac{P_{n}^s\gamma_{n}^{sr}}{\sigma^2} \right) \nonumber\\
& - \sum_{n=1}^N y_n \left( t_n - \frac{P_{n}^r\gamma_{n}^{rm}}{\sigma^2} \right)
- \sum_{n=1}^N z_n \left( \frac{P_{n}^r \gamma_{n}^{re}}{\sigma^2} - \frac{P_{n}^s \gamma_{n}^{sr}}{\sigma^2} \right) \nonumber\\
&- \lambda \left( \sum_{n=1}^N P_{n}^s - P_S \right) - \mu \left( \sum_{n=1}^N P_{n}^r - P_R \right).
\end{align}
Here, $x_n, y_n, z_n, \lambda$, and $\mu$ are Lagrange multipliers. Using (\ref{opt_prob_rate_max_simplified_obj}) and (\ref{lagrange_rate_maximization}), the KKT conditions for $\mathcal{P}1$ are given by
\begin{subequations}
\begin{equation}\label{lang_derivative_psn}
\frac{\partial \mathcal{L}_1}{\partial P_{n}^s} = x_n \frac{\gamma_{n}^{sr}}{\sigma^2} + z_n \frac{\gamma_{n}^{sr}}{\sigma^2} -\lambda = 0
\end{equation}
\begin{equation}\label{lang_derivative_prn}
\frac{\partial \mathcal{L}_1}{\partial P_{n}^r} = \frac{-\gamma_{n}^{re}}{2\left( \sigma^2+P_{n}^r\gamma_{n}^{re} \right) } + y_n \frac{\gamma_{n}^{rm}}{\sigma^2} - z_n \frac{\gamma_{n}^{re}}{\sigma^2} -\mu = 0
\end{equation}
\begin{equation}\label{lang_derivative_zn}
\frac{\partial \mathcal{L}_1}{\partial t_{n}} = \frac{1}{2\left( 1+t_n \right)} - x_n -y_n = 0
\end{equation}
\begin{equation}\label{comp_slackness_dummy_var}
x_n \left( t_n - \frac{P_{n}^s\gamma_{n}^{sr}}{\sigma^2} \right) = 0; \quad y_n \left( t_n - \frac{P_{n}^r\gamma_{n}^{rm}}{\sigma^2} \right) = 0
\end{equation}
\begin{equation}\label{comp_slackness_power_contraint}
z_n \left( {P_{n}^r \gamma_{n}^{re}} - {P_{n}^s \gamma_{n}^{sr}}\right) = 0
\end{equation}
\begin{equation}\label{comp_slackness_power}
\lambda \left( \sum_{n=1}^N P_{n}^s - P_S\right) = 0; \quad \mu \left(\sum_{n=1}^N P_{n}^r - P_R \right) = 0.
\end{equation}
\end{subequations}
\noindent Next we consider the following three cases.
\begin{align}\label{three_cases_for_t_n}
t_{n} =
\begin{cases}
P_{n}^s\gamma_{n}^{sr}/\sigma^2 & \text{if $P_{n}^s\gamma_{n}^{sr} < P_{n}^r\gamma_{n}^{rm}$ }\\
P_{n}^r\gamma_{n}^{rm}/\sigma^2 & \text{if $P_{n}^s\gamma_{n}^{sr} > P_{n}^r\gamma_{n}^{rm}$ }\\
P_{n}^s\gamma_{n}^{sr}/\sigma^2 = P_{n}^r\gamma_{n}^{rm}/\sigma^2 & \text{otherwise.}
\end{cases}
\end{align}
Case 1:
$t_{n} = P_{n}^s\gamma_{n}^{sr}/ \sigma^2$; $x_n>0$ and $y_n=0$.
From (\ref{lang_derivative_prn}) we get $\frac{\gamma_{n}^{re}}{2\left( \sigma^2+P_{n}^r\gamma_{n}^{re} \right) } + \mu + z_n \frac{\gamma_{n}^{re}}{\sigma^2} = 0$, which cannot be satisfied for any positive finite $P_{n}^r$ and $\sigma^2$. Thus, this case is infeasible.
Case 2:
$t_{n} = P_{n}^r\gamma_{n}^{rm} / \sigma^2$; $x_n=0$ and $y_n>0$, it gives $\lambda = z_n \gamma_{n}^{sr}/\sigma^2$ and $y_n = 1/\left\{ 2(1+t_n)\right \}$.
Substituting in (\ref{lang_derivative_prn}),
\begin{align}\label{opt_power_solution_case_2}
\mu + \lambda \frac{\gamma_{n}^{re}}{\gamma_{n}^{sr}} + \frac{\gamma_{n}^{re}}{2 \left( \sigma^2+P_{n}^r\gamma_{n}^{re} \right) } - \frac{\gamma_{n}^{rm}}{2 \left( \sigma^2+P_{n}^r\gamma_{n}^{rm} \right) } = 0.
\end{align}
Since $P_{n}^r\gamma_{n}^{rm}/\sigma^2 < P_{n}^s\gamma_{n}^{sr}/\sigma^2$, and we know that $\gamma_{n}^{rm}>\gamma_{n}^{re}$. Thus, $P_{n}^r\gamma_{n}^{re}/\sigma^2 < P_{n}^r\gamma_{n}^{rm}/\sigma^2 < P_{n}^s\gamma_{n}^{sr}/\sigma^2$ which indicates that $z_n=0$ (c.f. (\ref{comp_slackness_power_contraint})). Since $z_n=0$, so $\lambda=0$. Thus, (\ref{opt_power_solution_case_2}) results in a quadratic equation in $P_{n}^r$, having following form
\begin{align}\label{quadratic_prn}
\left(P_{n}^r\right)^2 \gamma_{n}^{rm} \gamma_{n}^{re} + P_{n}^r \left(\gamma_{n}^{rm} + \gamma_{n}^{re}\right)\sigma^2 + \sigma^4 - \Delta_n = 0
\end{align}
where $\Delta_n = \frac{\sigma^2}{2\mu}\left(\gamma_{n}^{rm} - \gamma_{n}^{re}\right)$.
For a fixed $\mu$, the optimal $P_{n}^r$, obtained as the only positive real root of (\ref{quadratic_prn}) is given by
\begin{align}\label{optimal_solution_prn}
\hspace{-2mm}P_{n}^r\hspace{-0.5mm} =\hspace{-0.5mm}\frac{-\sigma^2(\gamma_{n}^{rm}\hspace{-0.5mm}+\hspace{-0.5mm}\gamma_{n}^{re})
\hspace{-0.5mm}+\hspace{-0.5mm} \sqrt{\hspace{-0.5mm}\sigma^4 \left(\gamma_{n}^{rm}\hspace{-0.5mm}-\hspace{-0.5mm}\gamma_{n}^{re} \right)^2 \hspace{-0.5mm}+\hspace{-0.5mm} 4 \gamma_{n}^{rm}\gamma_{n}^{re}\Delta_n } }{2\gamma_{n}^{rm}\gamma_{n}^{re}}\hspace{-0.5mm}.\hspace{-2mm}
\end{align}
\begin{comment}
\begin{align}\label{optimal_solution_prn}
P_{n}^r =\frac{-\sigma^2(\gamma_{n}^{rm}+\gamma_{n}^{re})
+ \sqrt{\sigma^4 \left(\gamma_{n}^{rm}-\gamma_{n}^{re} \right)^2 + 4 \gamma_{n}^{rm}\gamma_{n}^{re}\Delta_n } }{2\gamma_{n}^{rm}\gamma_{n}^{re}}.
\end{align}
\begin{align}\label{optimal_solution_prn}
P_{n}^r =\frac{1}{2} \left[ - \left( \frac{\sigma^2}{\gamma_{n}^{rm}}+ \frac{\sigma^2}{\gamma_{n}^{re}} \right)
+ \sqrt{ \left( \frac{\sigma^2}{\gamma_{n}^{rm}}-\frac{\sigma^2}{\gamma_{n}^{re}} \right)^2 + \frac{4 \Delta_n}{\gamma_{n}^{rm}\gamma_{n}^{re}} } \right].
\end{align}
\end{comment}
For a known $P_{n}^r$, we set $P_{n}^s = P_{n}^r\frac{\gamma_{n}^{rm}}{\gamma_{n}^{sr}} + \delta$, where $\delta$ is a very small positive number, because allocating more $P_{n}^s$ does not provide a higher secure rate. The optimum $\mu$ can be found using subgradient method \cite{sboyd_subgradient}, such that $\sum_{n=1}^N P_{n}^r = P_R$.
Case 3:
$t_{n} = P_{n}^r\gamma_{n}^{rm}/\sigma^2 = P_{n}^s\gamma_{n}^{sr}/\sigma^2$;
$x_n>0$ and $y_n>0$. Replacing $x_n = \lambda\frac{\sigma^2}{\gamma_{n}^{sr}} - z_n$ (from (\ref{lang_derivative_psn})),
in (\ref{lang_derivative_zn}) we get
$y_n \hspace{-0.5mm}=\hspace{-0.5mm} \frac{1}{2\left( 1+t_n \right) } \hspace{-0.5mm}-\hspace{-0.5mm} \lambda\frac{\sigma^2}{\gamma_{n}^{sr}} \hspace{-0.5mm}+\hspace{-0.5mm} z_n$.
On substituting $t_{n}$ and $y_n$ in (\ref{lang_derivative_prn}),
\begin{comment}
\scriptsize
\begin{eqnarray}\label{opt_power_solution_case_3}
\frac{\gamma_{n}^{re}}{2\left( \sigma^2\hspace{-0.5mm}+\hspace{-0.5mm}P_{n}^r\gamma_{n}^{re} \right) }\hspace{-0.5mm}-\hspace{-0.5mm} \frac{\gamma_{n}^{rm}}{2 \left( \sigma^2\hspace{-0.5mm}+\hspace{-0.5mm}P_{n}^r\gamma_{n}^{rm} \right) }\hspace{-0.5mm} + \hspace{-0.5mm}\mu \hspace{-0.5mm}+\hspace{-0.5mm} \lambda \left(\hspace{-0.5mm} \frac{\gamma_{n}^{rm}}{\gamma_{n}^{sr}} \hspace{-0.5mm}\right) = z_n \left(\hspace{-0.5mm} \gamma_{n}^{rm}-\gamma_{n}^{re} \hspace{-0.5mm}\right).
\end{eqnarray}\normalsize
\end{comment}
\begin{align}\label{opt_power_solution_case_3}
& \frac{\gamma_{n}^{re}}{2\left( \sigma^2+P_{n}^r\gamma_{n}^{re} \right) }- \frac{\gamma_{n}^{rm}}{2 \left( \sigma^2+P_{n}^r\gamma_{n}^{rm} \right) } + \mu + \lambda \left( \frac{\gamma_{n}^{rm}} {\gamma_{n}^{sr}} \right) \nonumber \\
& \qquad \qquad = z_n \left(\gamma_{n}^{rm}-\gamma_{n}^{re} \right)/ \sigma^2.
\end{align}
The complimentary slackness condition
(\ref{comp_slackness_power_contraint}) can be simplified as
$z_n \left(P_{n}^r \gamma_{n}^{re}/\sigma^2 - P_{n}^r \gamma_{n}^{rm}/\sigma^2 \right) = 0$, which indicates $z_n=0$ because $\gamma_{n}^{rm}>\gamma_{n}^{re}$.
After simplifications, (\ref{opt_power_solution_case_3}) results in a quadratic equation in $P_{n}^r$ similar to (\ref{quadratic_prn}) with
$\Delta_n = \frac{\sigma^2 \gamma_{n}^{sr} \left(\gamma_{n}^{rm} - \gamma_{n}^{re} \right) }{2 \left( \mu\gamma_{n}^{sr}+\lambda\gamma_{n}^{rm} \right) }$.
For fixed $\lambda$ and $\mu$, the optimal $P_n^r$ is given by (\ref{optimal_solution_prn}).
The optimal $\lambda$ and $\mu$ are obtained using subgradient method \cite{sboyd_subgradient} such that $\sum_{n=1}^N P_{n}^r = P_R$ and $\sum_{n=1}^N P_{n}^s = P_S$.
Since with $\delta\to 0$ case 2 is inherently contained in case 3, (\ref{max_capacity_condition}) provides an energy-efficient global optimal solution.
\end{IEEEproof}
\subsection{Analytical and Graphical Interpretations}\label{subsec_analytic_interp}
Writing (\ref{opt_power_solution_case_3}) with $z_n=0$ in a compact form we get
\begin{align}\label{analytical_insight}
\frac{\frac{\gamma_{n}^{rm}-\gamma_{n}^{re}}{\sigma^2}} {2\left(1 + \frac{P_{n}^r\gamma_{n}^{rm}}{\sigma^2} \right) \left(1 + \frac{P_{n}^r\gamma_{n}^{re}}{\sigma^2} \right)} = \mu + \lambda \left( \frac{\gamma_{n}^{rm}}{\gamma_{n}^{sr}} \right) \text{ } \forall n.
\end{align}
From \eqref{simplified_objective} and \eqref{max_capacity_condition}, it appears intuitive that $P_{n}^r$ should be allocated according to the relative gain $(\gamma_{n}^{rm}\hspace{-0.5mm}-\hspace{-0.5mm}\gamma_{n}^{re})$. However on closely observing \eqref{analytical_insight}, we note that $P_{n}^r$ depends not only on relative gain, but also on absolute gains $\gamma_{n}^{sr}$, $\gamma_{n}^{rm}$, and $\gamma_{n}^{re}$.
Utilizing the secure rate definition (\ref{simplified_sec_rate_def}), the result \eqref{max_capacity_condition} obtained from Theorem \ref{theorem_one} can be explained graphically using Fig. \ref{fig:case3_explanation}. When $\mathcal{S}$-to-$\mathcal{R}$ link is the bottleneck as compared to $\mathcal{R}$-to-$\mathcal{U}_m$ link i.e., $P_{n}^s \gamma_{n}^{sr} < P_{n}^r \gamma_{n}^{rm}$
(case 1 in (\ref{three_cases_for_t_n}), and case (a) in Fig. \ref{fig:case3_explanation}), the secure rate is given as $R_{s_n}^m = \log_2\left(\frac{\sigma^2+P_{n}^s \gamma_{n}^{sr}}{\sigma^2+P_{n}^r \gamma_{n}^{re}}\right).$
\begin{comment}
\begin{align}
R_{n}^m = \log_2\left(\frac{1+\frac{P_{n}^s \gamma_{n}^{sr}}{\sigma^2}}{1+\frac{P_{n}^r \gamma_{n}^{re}}{\sigma^2}}\right)
\end{align}
\end{comment}
This case is infeasible because $R_{s_n}^m$ can be improved by either increasing $P_{n}^s$ or reducing $P_{n}^r$. If there is enough $P_S$ budget, then $P_{n}^s$ could be increased till (\ref{max_capacity_condition}) gets satisfied, beyond which $\mathcal{R}$-to-$\mathcal{U}_m$ link becomes the bottleneck (considered separately as case (b) in Fig. \ref{fig:case3_explanation}). However, if $P_S$ is limited, then $P_{n}^r$ should be reduced till (\ref{max_capacity_condition}) gets satisfied. With further lowered $P_{n}^r$, $\mathcal{R}$-to-$\mathcal{U}_m$ link becomes the bottleneck. Thus, at KKT point $P_{n}^s \gamma_{n}^{sr}$ cannot be less than $P_{n}^r \gamma_{n}^{rm}$, and hence case 1 is infeasible.
\begin{figure}[!t]
\centering
\epsfig{file=figure_1.eps,width=3.2in}
\vspace{-2mm}\caption{Graphical interpretation of Theorem \ref{theorem_one}.}
\label{fig:case3_explanation}
\end{figure}
When $\mathcal{R}$-to-$\mathcal{U}_m$ link is bottleneck compared to $\mathcal{S}$-to-$\mathcal{R}$ link
i.e., $P_{n}^r \gamma_{n}^{rm} < P_{n}^s \gamma_{n}^{sr} $ (case 2 in (\ref{three_cases_for_t_n}), and case (b) in Fig. \ref{fig:case3_explanation}), $R_{s_n}^m = \log_2\left(\frac{\sigma^2+P_{n}^r \gamma_{n}^{rm}}{\sigma^2+P_{n}^r \gamma_{n}^{re}}\right)$,
\begin{comment}
\begin{align}
R_{n}^m = \log_2\left(\frac{1+\frac{P_{n}^r \gamma_{n}^{rm}}{\sigma^2}}{1+\frac{P_{n}^r \gamma_{n}^{re}}{\sigma^2}}\right)
\end{align}
\end{comment}
which is an increasing function of $P_{n}^r$. In order to improve $R_{s_n}^m$, $P_{n}^r$ can be increased till (\ref{max_capacity_condition}) gets satisfied, beyond which the $\mathcal{S}$-to-$\mathcal{R}$ link becomes bottleneck. If $P_R$ is limited then just enough $P_{n}^s$ should be utilized so as to satisfy (\ref{max_capacity_condition}). Higher $P_{n}^s$, though feasible, does not improve secure rate, as $R_{s_n}^m$ is independent of $P_{n}^s$. Thus, case 2 can have multiple solutions but with the same optimal value.
\begin{remark}\label{rem:rem1}
Using (\ref{max_capacity_condition}) in (\ref{simplified_objective}), at KKT point $R_{s_{n}}^m$ is concave increasing in $P_n^r$, and is bounded by $\left(1/2\right)\log_2 \left( {\gamma_{n}^{rm}}/{ \gamma_{n}^{re}} \right)$.
\end{remark}
\section{Sum Power Minimization in DFSCC}
\label{sec_power_min_sum_rate}
For the sum power minimization problem, considering sum secure rate constraint over OFDMA system is not significant from fairness point of view. Actually it would utilize power resources over those subcarriers where higher secure rate can be achieved, which may lead to scarcity of power resources and eventually very small secure rate for some users. For handling this issue, we consider a minimum support secure rate requirement $R_{ssr}$ for each user. This results in a more complicated problem with $M$ rate constraints, instead of one.
Following Proposition \ref{proposition_rate_positivity}, first, subcarrier allocation is done based on (\ref{subcarrier_alloc_relay}). Since the maximum secure rate achievable over a subcarrier is bounded (cf. Remark~\ref{rem:rem1}), before optimal power allocation, it is checked whether $R_{ssr}$ for each user can be achieved. If it can be achieved, that user is selected for power allocation, otherwise not. Considering $U^a$ as the set of selected users for resource allocation and $N_m$ as the set of subcarriers of $\mathcal{U}_m$, the sum power minimization problem is given by:
\begin{align}\label{opt_prob_power_min}
&\hspace{-1mm}\mathcal{Q}0 : & & \underset{P_{k}^s, P_{k}^r} {\text{minimize}} \sum_{\mathcal{U}_m \in U^a} \sum_{k \in N_m} \left( P_{k}^s + P_{k}^r \right) \nonumber \\
&\hspace{-1mm}\text{s.t.}
& & \hspace{-5mm}C1\hspace{-1mm}:\hspace{-1mm}\sum_{k \in N_m} R_{s_{k}}^m \geq R_{ssr} \text{ }\forall\hspace{0.5mm}\mathcal{U}_m\hspace{-0.5mm}\in\hspace{-0.5mm} U^a, \hspace{1mm} C2\hspace{-0.5mm}: P_{k}^s, P_{k}^r\ge 0.
\end{align}
Since all subcarriers are independent, per-user rate constraints can be handled in parallel. Thus, the optimization problem can be decomposed at user level and solved in parallel. The individual user level problem for each $\mathcal{U}_m\in U^a$ is stated as:
\begin{align}\label{opt_prob_power_min_user}
&\mathcal{Q}1 : & & \underset{ P_{k}^r, P_{k}^s} {\text{minimize}} \sum_{k \in N_m} \left(P_{k}^s + P_{k}^r \right) \nonumber \\
& \text{s.t.}
& & \hspace{-5mm}C1: \sum_{k \in N_m} \frac{1}{2} \log_2 \left( \frac{1+t_k}{1+\frac{P_{k}^r\gamma_{k}^{re}}{\sigma^2}} \right) \geq R_{ssr}, \nonumber \\
&
& & \hspace{-5mm}C2: t_k \leq \frac{P_{k}^s\gamma_{k}^{sr}}{\sigma^2} \text{ } \forall k, \quad C3: t_k \leq \frac{P_{k}^r\gamma_{k}^{rm}}{\sigma^2} \text{ } \forall k, \nonumber \\
&
& & \hspace{-5mm}C4: {P_{k}^r \gamma_{k}^{re}}/{\sigma^2} \le {P_{k}^s \gamma_{k}^{sr}}/{\sigma^2} \text{ } \forall k, C5: P_{k}^s\ge 0, P_{k}^r\ge 0\text{ } \forall k.
\end{align}
The objective function of $\mathcal{Q}1$ is linear, $C1$ is pseudolinear (Lemma~\ref{PL:lemma}), and $C2-C5$ are linear.
So, the KKT point gives the optimal solution \cite{Bazaraa}.
The Lagrangian $\mathcal{L}_2$ of $\mathcal{Q}1$ with $x_k, y_k, z_k$, and $\lambda$ as the Lagrange multipliers is given by:
\begin{align}
&\mathcal{L}_2 = \sum_{k \in N_m} \left(P_{k}^s + P_{k}^r\right) + \sum_{k \in N_m} x_k \left( t_k - \frac{P_{k}^s\gamma_{k}^{sr}}{\sigma^2} \right) \nonumber\\
& + \sum_{k \in N_m} y_k \left( t_k - \frac{P_{k}^r\gamma_{k}^{rm}}{\sigma^2} \right)
+ \sum_{k \in N_m} z_k \left( \frac{P_{k}^r \gamma_{k}^{re}}{\sigma^2} - \frac{P_{k}^s \gamma_{k}^{sr}}{\sigma^2} \right) \nonumber\\
& - \lambda \left[ \sum_{k \in N_m} \frac{1}{2} \left \{ \log_2 \left( \frac{1+ t_k} {1+ \frac{P_{k}^r \gamma_{k}^{re}}{\sigma^2}} \right) \right \} - R_{ssr} \right].
\end{align}
The stationarity KKT conditions for $\mathcal{Q}1$ are given by:
\begin{subequations}
\begin{equation}\label{lang_derivative_psn_1}
\frac{\partial \mathcal{L}_2}{\partial P_{k}^s} = 1 - x_k \frac{\gamma_{k}^{sr}}{\sigma^2} - z_k \frac{\gamma_{k}^{sr}}{\sigma^2} = 0
\end{equation}
\begin{equation}\label{lang_derivative_prn_1}
\frac{\partial \mathcal{L}_2}{\partial P_{k}^r} = 1 + \frac{\lambda \gamma_{k}^{re}}{2\left( \sigma^2+P_{k}^r\gamma_{k}^{re} \right) } - y_k \frac{\gamma_{k}^{rm}}{\sigma^2} + z_k \frac{\gamma_{k}^{re}}{\sigma^2} = 0
\end{equation}
\begin{equation}\label{lang_derivative_zn_1}
\frac{\partial \mathcal{L}_2}{\partial t_{k}} = x_k + y_k - \frac{\lambda}{2 \left( 1+t_k \right) } = 0.
\end{equation}
\end{subequations}
In addition, there are four complimentary slackness conditions, three are similar to (\ref{comp_slackness_dummy_var})-(\ref{comp_slackness_power_contraint}), and fourth is given as:
\begin{align}\label{comp_slackness_rate}
\lambda \left[ \sum_{k \in N_m} \frac{1}{2} \left \{ \log_2 \left( \frac{1+ t_k} {1+ \frac{P_{k}^r \gamma_{k}^{re}}{\sigma^2}} \right) \right \} - R_{ssr} \right] = 0.
\end{align}
Here also there exist three cases similar to (\ref{three_cases_for_t_n}). Considering the cases one by one, in case 1, $x_k>0$ but $y_k=0$. This case is infeasible because, if $y_k=0$, then (\ref{lang_derivative_prn_1}) cannot be satisfied. Considering case 2, $x_k=0$, $y_k>0$, and $z_k=0$ (by the same argument as explained in the proof of Theorem \ref{theorem_one}); thus (\ref{lang_derivative_psn_1}) cannot be satisfied, and hence this case is also infeasible. The only feasible case is case 3, in which, using $z_k=0$ and on simplifying (\ref{lang_derivative_psn_1})-(\ref{lang_derivative_zn_1}), we obtain a quadratic equation in $P_{k}^r$ similar to (\ref{quadratic_prn}) where $\Delta_n$ is replaced with
$\Delta_k = \frac{\lambda \sigma^2 \gamma_{k}^{sr} \left( \gamma_{k}^{rm} - \gamma_{k}^{re} \right) }{2 \left( \gamma_{k}^{sr}+\gamma_{k}^{rm} \right)}.$
The optimal $P_{k}^r$ is given by (\ref{optimal_solution_prn}) for a fixed value of $\lambda$, and the optimal $\lambda$ is found using subgradient method \cite{sboyd_subgradient} such that $C1$ in $\mathcal{Q}1$ is satisfied with equality.
\section{Numerical Results}
\label{sec_results}
Here we present numerical results of OFDMA-based DFSCC with $M=8$ users and $N=64$ subcarriers. $\mathcal{S}$ and $\mathcal{R}$ are assumed to be respectively located at $(0,0)$ and $(1,0)$. The users are uniformly distributed inside a unit square, centered at $(2,0)$. With $\sigma^2=1$, we consider quasi-static Rayleigh fading. Large scale fading is modeled using path loss exponent $=3$.
Fig. \ref{fig:sum_rate_max}(a) presents the variation of optimal sum secure rate $R_s^*$ (or $\widehat{R_{s}^*}$) with source power budget $P_S$, for different relay power budgets $P_R$. At low $P_R$, $R_s^*$ is limited by $P_R$ itself and increasing $P_S$ does not improve $R_s^*$ significantly. Interestingly, at high enough $P_R$, $R_s^*$ increases with diminishing returns before saturating at high $P_S$. This indicates the existence of an upper bound on $R_s^*$. {\em The monotonicity of $R_s^*$ corroborates pseudolinearity with respect to $P_n^s$ and $P_n^r$.} Fig. \ref{fig:sum_rate_max}(b) shows that sum power required per-user increases exponentially with $R_{ssr}$. Sum power required for a fixed $R_{ssr}$ increases with number of users, due to effectively lesser number of subcarriers per-user. The performance improvement achieved by the proposed solutions over a benchmark scheme, namely, uniform power allocation, is also demonstrated in Figs. \ref{fig:sum_rate_max}(a) and \ref{fig:sum_rate_max}(b).
\begin{figure}[t!]
\centering
\epsfig{file=figure_2.eps,width=3.in}
\vspace{-2mm}\caption{\hspace{-1.5mm}(a)\hspace{0.5mm}Secure rate versus source power; (b)\hspace{0.5mm}Sum power versus support rate.}
\label{fig:sum_rate_max}
\end{figure}
\section{Concluding Remarks}
\label{sec_conclusion}
To summarize, we have investigated resource allocation in OFDMA-based DFSCC with multiple untrusted users. Global optimal solutions for secure rate maximization and sum power minimization problems have been obtained by exploiting the concepts of generalized convexity and pseudolinearity. Numerical results have offered insight into the optimal power required for realizing an energy-efficient DFSCC system.
| {'timestamp': '2019-01-14T02:16:37', 'yymm': '1901', 'arxiv_id': '1901.03585', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03585'} | arxiv |
\section{Introduction}%
\label{sec:intro}
\paragraph{Game-based models for controller synthesis} \textit{Two-player zero-sum games}~\cite{DBLP:conf/dagstuhl/2001automata,rECCS} and \textit{Markov decision processes} (MDPs)~\cite{filar1997,baier2008principles,DBLP:conf/vmcai/RandourRS15} are two popular frameworks to model decision making in adversarial and uncertain environments respectively. In the former, a system controller and its environment compete antagonistically, and synthesis aims at building strategies for the controller that ensure a specified behavior \textit{against all possible strategies of the environment}. In the latter, the system is faced with a given stochastic model of its environment, and the focus is on satisfying a given level of expected performance, or a \textit{specified behavior with a sufficient probability}. Classical objectives studied in both settings notably include \textit{parity}, a canonical way of encoding $\omega$-regular specifications, and \textit{mean-payoff}, which evaluates the average payoff per transition in the limit of an infinite run in a weighted graph.
\paragraph{Window objectives in games} The traditional parity and mean-payoff objectives share two shortcomings. First, they both reason about infinite runs \textit{in their limit}. While this elegant abstraction yields interesting theoretical properties and makes for robust interpretation, it is often beneficial in practical applications to be able to specify a \textit{parameterized time frame} in which an acceptable behavior should be witnessed. Second, both parity and mean-payoff games belong to $\UPTIME \cap \coUPTIME$~\cite{DBLP:journals/ipl/Jurdzinski98,DBLP:conf/cav/GawlitzaS09}, but despite recent breakthroughs~\cite{DBLP:conf/stoc/CaludeJKL017,DBLP:conf/lics/DaviaudJL18}, they are still not known to be in~$\PTIME$. Furthermore, the latest results~\cite{DBLP:journals/corr/abs-1807-10546,mpuniv} indicate that all existing algorithmic approaches share inherent limitations that prevent inclusion in $\PTIME$.
Window objectives address the time frame issue as follows. In their \textit{fixed} variant, they consider a window of size bounded by $\lambda \in \mathbb{N}_0$ (given as a parameter) sliding over an infinite run and declare this run to be winning if, in all positions, the window is such that the (mean-payoff or parity) objective is locally satisfied. In their \textit{bounded} variant, the window size is not fixed a priori, but a run is winning if there exists a bound $\lambda$ for which the condition holds. Window objectives have been considered both in \textit{direct} versions, where the window property must hold from the start of the run, and \textit{prefix-independent} versions, where it must hold from some point on. Window games were initially studied for mean-payoff~\cite{DBLP:journals/iandc/Chatterjee0RR15} and parity~\cite{DBLP:journals/corr/BruyereHR16}. They have since seen diverse extensions and applications: e.g.,~\cite{DBLP:conf/csl/BaierKKW14,DBLP:conf/rp/Baier15,DBLP:conf/concur/BrazdilFKN16,DBLP:conf/concur/BruyereHR16,DBLP:journals/acta/HunterPR18,DBLP:conf/fsttcs/0001PR18}.
\paragraph{Window objectives in MDPs} Our goal is to lift the theory of window games to the stochastic context. With that in mind, we consider the canonical \textit{threshold probability problem}: given an MDP, a window objective defining a set of acceptable runs $E$, and a probability threshold $\alpha$, we want to decide if there exists a controller \textit{strategy} (also called \textit{policy}) to achieve $E$ with probability at least $\alpha$. It is well-known that many problems in MDPs can be reduced to threshold problems for appropriate objectives: e.g., maximizing the \textit{expectation} of a prefix-independent function boils down to maximizing the probability to reach the best end-components for that function (see examples in~\cite{baier2008principles,DBLP:journals/iandc/BruyereFRR17,DBLP:journals/fmsd/RandourRS17}).
\paragraph{Example} Before going further, let us consider an example. Take the MDP depicted in Fig.~\ref{fig:intro_ex}: circles depict states and dots depict actions, labeled by letters. Each action yields a probability distribution over successor states: for example, action $b$ leads to $s_2$ with probability $0.5$ and $s_3$ with the same probability. This MDP is actually a \textit{Markov chain} (MC) as the controller has only one action available in each state: this process is purely stochastic.
\begin{figure}[tbh]
\begin{center}
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node
distance=2.5cm,bend angle=45, scale=0.6, font=\normalsize]
\tikzstyle{p1}=[draw,circle,text centered,minimum size=7mm,text width=4mm]
\tikzstyle{p2}=[draw,rectangle,text centered,minimum size=7mm,text width=4mm]
\tikzstyle{act}=[fill,circle,inner sep=1pt,minimum size=1.5pt, node distance=1cm] \tikzstyle{empty}=[text centered, text width=15mm]
\node[p1] (1) at (0,0) {$s_{1}$};
\node[empty] at ($(1)+(0,1)$) {1};
\node[p1] (2) at (5,0) {$s_{2}$};
\node[empty] at ($(2)+(0,1)$) {2};
\node[p1] (3) at (2.5,-2.5) {$s_{3}$};
\node[empty] at ($(3)+(0,1)$) {0};
\node[act] (1a) at (2.5,0) {};
\node[empty] at ($(1a)+(0,0.4)$) {\scriptsize $a$};
\node[act] (2a) at (5,-1.5) {};
\node[empty] at ($(2a)-(0.4,0)$) {\scriptsize $b$};
\node[act] (3a) at (0,-1.5) {};
\node[empty] at ($(3a)+(0.4,0)$) {\scriptsize $c$};
\coordinate[shift={(-5mm,0mm)}] (init) at (1.west);
\path[-latex']
(init) edge (1)
(1) edge (1a)
(2) edge (2a)
(1a) edge node[above,xshift=0mm]{\scriptsize $1$} (2)
(3a) edge node[left,xshift=0mm]{\scriptsize $1$} (1)
;
\draw [->] (2a) to[out=0,in=315] node[right,xshift=0mm]{\scriptsize $0.5$} (2);
\draw [->] (2a) to[out=270,in=0] node[right,xshift=1mm]{\scriptsize $0.5$} (3);
\draw [->] (3) to[out=180,in=270] (3a);
\end{tikzpicture}
\caption{Simple Markov chain where parity is surely satisfied but all window parity objectives have probability zero.}%
\label{fig:intro_ex}
\end{center}
\end{figure}
We consider the \textit{parity} objective here: we associate a non-negative integer priority with each state, and a run is winning if the minimum one amongst those seen infinitely often is even.
Clearly, any run in this MC is winning: either it goes through $s_3$ infinitely often and the minimum priority is $0$, or it does not, and the minimum priority seen infinitely often is~$2$. Hence the controller not only wins \textit{almost-surely} (with probability one), but even \textit{surely} (on all runs).
Now, consider the \textit{window parity} objective that informally asks for the minimum priority inside a window of size bounded by $\lambda$ to be even, with this window sliding all along the infinite run. Fix any $\lambda \in \mathbb{N}_0$. It is clear that every time $s_1$ is visited, there will be a fixed strictly positive probability $\varepsilon > 0$ of not seeing $0$ before $\lambda$ steps: this probability is $1/2^{\lambda-1}$. Let us call this seeing a \textit{bad window}. Since we are in a \textit{bottom strongly connected component} of the MC, we will almost-surely visit $s_1$ infinitely often~\cite{baier2008principles}. Using classical probability arguments (Borel-Cantelli), one can easily be convinced that the probability to see bad windows infinitely often is one. Hence the probability to win the window parity objective is zero. This canonical example illustrates the difference between traditional parity and window parity: the latter is more restrictive as it asks for a strict bound on the time frame in which each odd priority should be answered by a smaller even priority.
Note that in practice, such a behavior is often wished for. For example, consider a computer server having to grant requests to clients. A classical parity objective can encode that requests should eventually be granted. However, it is clear that in a desired controller, requests should not be placed on hold for an arbitrarily long time. The existence of a finite bound on this holding time can be modeled with a \textit{bounded} window parity objective, while a specific bound can also be set as a parameter using a \textit{fixed} window parity objective.
\paragraph{Our contributions} We study the \textit{threshold probability problem} in MDPs for window objectives based on \textit{parity} and \textit{mean-payoff}, two prominent formalisms in qualitative and quantitative (resp.) analysis of systems. We consider the different variants of window objectives mentioned above: fixed vs.~bounded, direct vs.~prefix-independent. A nice feature of our approach is that we provide a \textit{unified view} of parity and mean-payoff window objectives: \textit{our algorithm can actually be adapted for any window-based objective} if an appropriate black-box is provided for a restricted sub-problem. This has two advantages: (i) conceptually, our approach permits a \textit{deeper understanding of the essence of the window mechanism}, not biased by technicalities of the specific underlying objective; (ii) our framework can \textit{easily} be \textit{extended} to other objectives for which a window version could be defined. This point is of great practical interest too, as it opens the perspective of a modular, generic software tool suite for window objectives.
\renewcommand{\arraystretch}{1.3}
\begin{table}
\small
\begin{center}
\begin{tabular}{|c||c|c||c|c|}
\cline{2-5}
\multicolumn{1}{c|}{} & \multicolumn{2}{c||}{parity} & \multicolumn{2}{c|}{mean-payoff} \\
\cline{2-5}
\multicolumn{1}{c|}{} & \;complexity\; & memory & complexity & memory\\
\hhline{-|====|}
\;DFW\; & \multirow{3}{*}{$\mathsf{P}$-c.} & \multirow{2}{*}{\;polynomial\;} & \;$\mathsf{EXPTIME}$/$\mathsf{PSPACE}$-h.\; & \;pseudo-polynomial\; \\
\cline{1-1}\cline{4-5}
\;FW\; & & & $\mathsf{P}$-c. & polynomial \\
\cline{1-1} \cline{3-5}
\;BW\; & & \;memoryless\; & $\mathsf{NP} \cap \mathsf{coNP}$ & memoryless \\
\hline
\end{tabular}
\end{center}
\caption{Complexity of the threshold probability problem for window objectives in MDPs and memory requirements. Acronyms DFW, FW and BW respectively stand for direct fixed window, fixed window and bounded window objectives. All memory bounds are tight and \textit{pure} strategies always suffice. For mean-payoff, the $\mathsf{PSPACE}$-hardness holds even for acyclic MDPs, and the bounded case is as hard as mean-payoff games. All results are new.}%
\label{table:overview}
\end{table}
We give an overview of our results in Table~\ref{table:overview}. For the sake of space, we use acronyms below: DFW for direct fixed window, FW for (prefix-independent) fixed window, DBW for direct bounded window, and BW for (prefix-independent) bounded window. Our main contributions are as follows.
\begin{enumerate}
\item We solve DFW MDPs through reductions to safety MDPs over \textit{well-chosen unfoldings}. This results in polynomial-time and pseudo-polynomial-time algorithms for the parity and mean-payoff variants respectively (Thm.~\ref{thm:direct}). We prove these complexities to be almost tight (Thm.~\ref{thm:directHardness}), the most interesting case being the $\mathsf{PSPACE}$-hardness of DFW mean-payoff objectives, even in the case of \textit{acyclic} MDPs.
We also show that no upper bound can be established on the window size needed to win in general (Sect.~\ref{subsec:illustration}), \textit{in stark contrast to the two-player games situation} (Sect.~\ref{subsec:games}).
\item We use similar reductions to prove that \textit{finite memory} suffices in the prefix-independent case (Thm.~\ref{finite-memory-cor}). Yet, in this case, we can do better than using the unfoldings to solve the problem. We start by studying \textit{end-components} (ECs), the crux for all prefix-independent objectives in MDPs: we show that ECs can be classified based on their \textit{two-player zero-sum game interpretation} (Sect.~\ref{sec:ec}). Using the result on finite memory, we prove that in ECs classified as \textit{good}, almost-sure satisfaction of window objectives can be ensured, whereas it is impossible to satisfy them with non-zero probability in the other ECs (Lem.~\ref{grolem}). We also establish tight complexity bounds for this classification problem (Thm.~\ref{thm:classification}). This \textit{EC classification} is --- both conceptually and complexity-wise --- the cornerstone to deal with general MDPs.
\item Our general algorithm is developed in Sect.~\ref{sec:general}: we prove $\mathsf{P}$-completeness for all prefix-independent variants but for the BW mean-payoff one (Thm.~\ref{thm:general} and Thm.~\ref{thm:generalHardness}), where we show that the problem is in $\mathsf{NP} \cap \mathsf{coNP}$ and as hard as mean-payoff games, a canonical ``hard'' problem for that complexity class.
\item For all variants, we prove \textit{tight memory bounds}: see Thm.~\ref{thm:direct} and Thm.~\ref{thm:directHardness} for the direct fixed variants, Thm.~\ref{thm:general} and Thm.~\ref{thm:generalHardness} for the prefix-independent fixed and bounded ones. In all cases, \textit{pure} strategies (i.e., without randomness) suffice.
\item We leave out DBW objectives from our analysis as we show they are not well-behaved. We illustrate their behavior in Sect.~\ref{subsec:illustration} and discuss their pitfalls in Sect.~\ref{sec:concl}.
\end{enumerate}
Along the way, we develop several side results that help drawing a \textit{line between MDPs and games} w.r.t.~window objectives: e.g., whether or not a uniform bound exists in the bounded case (Sect.~\ref{subsec:illustration}). As stated above, our approach is also generic and may be easily extended to other window-based objectives.
\paragraph{Comments on our results} In the game setting, window objectives are all in polynomial time, except for the BW mean-payoff variant, in $\mathsf{NP} \cap \mathsf{coNP}$. Despite clear differences in behaviors, the situation is almost the same here. The only outlier case is the DFW mean-payoff one, whose complexity rises significantly. As we show in Thm.~\ref{thm:directHardness}, the loss of prefix-independence permits to emulate shortest path problems on MDPs that are famously hard to solve efficiently (e.g.,~\cite{DBLP:conf/icalp/HaaseK15,DBLP:journals/fmsd/RandourRS17,DBLP:journals/corr/abs-1809-03107,DBLP:conf/tacas/HartmannsJKQ18}). In the almost-sure case, however, DFW mean-payoff MDPs collapse to $\mathsf{P}$ (Rmk.~\ref{rmk:DFWMP_AS_P}).
In games, window objectives permit to avoid long-standing $\mathsf{NP} \cap \mathsf{coNP}$ complexity barriers for parity~\cite{DBLP:journals/corr/BruyereHR16} and mean-payoff~\cite{DBLP:journals/iandc/Chatterjee0RR15}. Since both are known to be in $\mathsf{P}$ for the threshold probability problem in MDPs~\cite{DBLP:conf/soda/ChatterjeeJH04,DBLP:journals/fmsd/RandourRS17}, the main interest of window objectives resides in their \textit{modeling power}. Still, they may turn out to be more efficient in practice too, as polynomial-time algorithms for parity and mean-payoff, based on linear programming, are often forsaken in favor of exponential-time value or strategy iteration ones (e.g.,~\cite{DBLP:conf/cav/AshokCDKM17}).
\paragraph{Related work} We already mentioned many related articles, hence we only briefly discuss some remaining models here. Window parity games are strongly linked to the concept of \textit{finitary $\omega$-regular games}: see, e.g.,~\cite{DBLP:journals/tocl/ChatterjeeHH09}, or~\cite{DBLP:journals/corr/BruyereHR16} for a complete list of references. The window mechanism can be used to ensure a certain form of (local) guarantee over runs: different techniques have been considered in MDPs, notably \textit{variance-based}~\cite{DBLP:journals/jcss/BrazdilCFK17} or \textit{worst-case-based}~\cite{DBLP:journals/iandc/BruyereFRR17,DBLP:conf/icalp/BerthonRR17} methods.
Finally, let us mention the very recent work of Bordais et al.~\cite{DBLP:journals/corr/abs-1812-09298}, which considers a \textit{seemingly} related question: the authors define a \textit{value function} based on the window \textit{mean-payoff} mechanism and consider maximizing its expected value (which is different from the expected window size we discuss in Sect.~\ref{sec:concl}). While there definitively are similarities in our works w.r.t.~technical tools, the two approaches are quite different and have their own strengths: we focus on deep understanding of the window mechanism through a \textit{generic approach} for the canonical threshold probability problem for all window-based objectives, here instantiated as mean-payoff \textit{and} parity; whereas Bordais et al.~focus on a particular \textit{optimization problem} for a function relying on this mechanism.
In addition to having \textit{different philosophies}, our divergent approaches yield \textit{interesting differences}. We mention three examples illustrating the conceptual gap. First, in~\cite{DBLP:journals/corr/abs-1812-09298}, the studied function takes the same value for direct and prefix-independent bounded window mean-payoff objectives, whereas we show in Sect.~\ref{subsec:illustration} that the classical definitions of window objectives induce a striking difference between both (in the MDP of Ex.~\ref{ex:uniform}, the prefix-independent version is satisfied for window size one, whereas no uniform bound on all runs can be defined for the direct case). Second, we are able to prove $\mathsf{PSPACE}$-hardness for the DFW mean-payoff case, whereas the best lower bound known for the related problem in~\cite{DBLP:journals/corr/abs-1812-09298} is $\mathsf{PP}$. Lastly, let us recall that our work also deals with window \textit{parity} objectives while the function of~\cite{DBLP:journals/corr/abs-1812-09298} is strictly built on mean-payoff.
Our paper presents in full details, with additional proofs and examples, the contributions published in a preceding conference version~\cite{concur_sw}.
\paragraph{Outline} Sect.~\ref{sec:prelim} defines the model and problem under study. In Sect.~\ref{sec:window}, we introduce window objectives, discuss their status in games, and illustrate their behavior in MDPs. Sect.~\ref{sec:fixed} is devoted to the fixed variants and the aforementioned reductions. In Sect.~\ref{sec:ec}, we analyze the case of ECs and develop the classification procedure. We build on it in Sect.~\ref{sec:general} to solve the general case. Finally, in Sect.~\ref{sec:concl}, we discuss the limitations of our work, as well as interesting extensions within arm's reach (e.g., multi-objective threshold problem, expected value problem).
\section{Preliminaries}%
\label{sec:prelim}
\paragraph{Probability distributions} Given a set $S$, let~$\ensuremath{\mathcal{D}} (S)$
denote the set of rational probability distributions over~$S$. Given a distribution $\iota \in \ensuremath{\mathcal{D}} (S)$, let $\ensuremath{{\sf Supp}} (\iota) = \{ s \in S \mid \iota(s) > 0\}$ denote its support.
\paragraph{Markov decision processes} A finite
\textit{Markov decision process} (MDP) is a tuple
$\mathcal{M} = (S,A,\delta)$ where $S$ is a finite set of \emph{states},
$A$~is a finite set of \emph{actions} and
$\delta\colon S\times A \rightarrow \ensuremath{\mathcal{D}} (S)$ is a partial function
called the \emph{probabilistic transition function}. The
set of actions that are available in a state $\ensuremath{s} \in \ensuremath{S} $ (i.e., for which $\delta(s, a)$ is defined) is
denoted by $A(s)$. We use $\delta(s,a,s')$ as a shorthand for
$\delta(s,a)(s')$. For the sake of readability, we write $(s,a,s') \in \delta$ to indicate that $\delta$ is defined on $(s,a)$ and $s' \in \ensuremath{{\sf Supp}} (\delta(s,a))$.
We assume w.l.o.g.~that MDPs are \textit{deadlock-free}: for all
$s \in S$, $A(s) \neq \emptyset$. An MDP where for all
$s \in \ensuremath{S} $, $\vert A(s)\vert = 1$ is a fully-stochastic process
called a \textit{Markov chain} (MC).
A \emph{run}
of~$\mathcal{M}$ is an infinite sequence
$\rho = s_0a_0 \ldots a_{n-1} s_n\ldots{}$ of states and actions such
that $\delta(s_i,a_i,s_{i+1})>0$ for all~$i\geq 0$. The
\textit{prefix} up to the $n$-th state of $\rho$ is the finite
sequence $\rho[0, n] = s_0a_0 \ldots a_{n-1}s_n$. The \textit{suffix}
of $\rho$ starting from the $n$-th state of $\rho$ is the run
$\rho[n, \infty] = s_{n}a_{n}s_{n+1}a_{n+1}\dots$. Moreover, we denote by
$\rho[n]$ the $n$-th state $s_n$ of $\rho$. Finite prefixes of runs
of the form $h = s_0a_0 \ldots a_{n-1} s_n$ are called
\emph{histories}. We sometimes denote the last state of history $h$ by $\mathsf{Last}(h)$. We resp.~denote the sets of runs and histories of an
MDP $\mathcal{M}$ by $\Runs{\mathcal{M}}$ and $\Hists{\mathcal{M}}$.
\paragraph{End-components} Fix an MDP $\mathcal{M} = (S,A,\delta)$. A \textit{sub-MDP} of
$\mathcal{M}$ is an MDP $\mathcal{M}' = (S',A',\delta')$ with $S' \subseteq S$,
$\emptyset \neq A'(s) \subseteq A(s)$ for all~$s \in S'$,
$\ensuremath{{\sf Supp}} (\delta(s,a)) \subseteq
S'$ for all~$s \in S', a \in A'(s)$, $\delta' = \restr{\delta}{S'\times A'}$.
Such a sub-MDP $\mathcal{M}'$ is an \emph{end-component} (EC) of $\mathcal{M}$ if and only if the
underlying graph of $\mathcal{M}'$ is \textit{strongly connected}, i.e.,
there is a run between any pair of states in $S'$. Given an EC $\mathcal{M}' = (S',A',\delta')$ of $\mathcal{M}$, we say that its sub-MDP $\mathcal{M}'' = (S'',A'',\delta'')$, $S'' \subseteq S'$, $A'' \subseteq A'$, is a \textit{sub-EC} of $\mathcal{M}'$ if $\mathcal{M}''$ is also an EC\@. We let $\ecs(\mathcal{M})$
denote the set of ECs of~$\mathcal{M}$, which may be of exponential size as ECs need not be disjoint.
The union of two ECs with non-empty intersection is itself an EC:\@ hence we can define the \emph{maximal} ECs (MECs) of an MDP, i.e., the ECs that cannot be extended. We let $\mecs(\mathcal{M})$
denote the set of MECs of~$\mathcal{M}$; it is of polynomial size (because MECs are pair-wise disjoints) and computable in polynomial
time~\cite{DBLP:journals/jacm/ChatterjeeH14}.
\paragraph{Strategies} A~\emph{strategy}~$\sigma$ is
a function $\Hists{\mathcal{M}}\rightarrow \ensuremath{\mathcal{D}} (A)$ such that for
all~$h \in \Hists{\mathcal{M}}$ ending in~$s$, we
have~$\ensuremath{{\sf Supp}} (\sigma(h)) \subseteq A(s)$. The set of all strategies is
$\ensuremath{\Sigma} $. A strategy is \textit{pure} if all histories are mapped to
\textit{Dirac distributions}, i.e., the support is a singleton. A
strategy~$\sigma$ can be encoded by a \emph{Mealy machine}
$(Q,\sigma_a,\sigma_u,\iota)$ where~$Q$ is a finite or infinite set
of memory states,~$\iota$ the \emph{initial distribution on~$Q$},
$\sigma_a$ the \emph{next action function}
$\sigma_a\colon S \times Q \rightarrow \ensuremath{\mathcal{D}} (A)$ where
$\ensuremath{{\sf Supp}} (\sigma_a(s,q)) \subseteq A(s)$ for any~$s\in S$ and~$q \in Q$,
and $\sigma_u$ the \emph{memory update function}
$\sigma_u\colon A\times S \times Q \rightarrow Q$. We say
that~$\sigma$ is \emph{finite-memory} if~$|Q|<\infty$, and
\emph{$K$-memory} if~$|Q|=K$; it is memoryless if~$K=1$, thus only
depends on the last state of the history. We see such strategies as
functions $s \mapsto \ensuremath{\mathcal{D}} (A(s))$ for $s \in S$. A strategy is
\emph{infinite-memory} if~$Q$ is infinite.
The entity choosing the strategy is often called the
\textit{controller}.
\paragraph{Induced MC} An MDP~$\mathcal{M}$, a strategy~$\sigma$ encoded by
$(Q,\sigma_a,\sigma_u,\iota)$, and a state~$s$ determine a Markov
chain $\mathcal{M}_s^\sigma$ defined on the state space $S\times Q$ as
follows. The initial distribution is such that for any~$q \in Q$,
state $(s,q)$ has probability $\iota(q)$, and~$0$ for other
states. For any pair of states $(s,q)$ and~$(s',q')$, the probability
of transition $(s,q) \xrightarrow{a} (s',q')$ is equal to
$\sigma_a(s,q)(a) \cdot \delta(s,a,s')$ if $q' = \sigma_u(s,q,a)$, and
to~$0$ otherwise. A~\emph{run} of~$\mathcal{M}_s^\sigma$ is an infinite
sequence of the form $(s_0,q_0)a_0(s_1,q_1)a_1\ldots$, where each
$(s_i,q_i) \xrightarrow{a_i} (s_{i+1},q_{i+1})$ is a transition with
non-zero probability in~$\mathcal{M}_s^\sigma$, and~$s_0=s$. When
considering the probabilities of events in $\mathcal{M}_s^\sigma$, we will
often consider sets of runs of~$\mathcal{M}$. Thus, given
$E \subseteq {(SA)}^\omega$, we denote by $\mathbb{P}_{\mathcal{M},s}^\sigma[E]$ the
probability of the runs of~$\mathcal{M}_s^\sigma$ whose
projection\footnote{The projection of a run
$(s_0,q_0)a_0(s_1,q_1)a_1\ldots$ in $\mathcal{M}_s^\sigma$ to $\mathcal{M}$ is
simply the run $s_{0}a_{0}s_{1}a_{1}\ldots{}$ in $\mathcal{M}$. For the sake of readability, we make similar abuse of notation --- identifying runs in the induced MC with their projections in the MDP --- throughout our paper.} to~$\mathcal{M}$
is in~$E$, i.e., the probability of event $E$ when $\mathcal{M}$ is executed
with initial state~$s$ and strategy~$\sigma$. Note that every measurable set (\textit{event})
has a uniquely defined probability~\cite{vardi_FOCS85}
(Carath\'eodory's extension theorem induces a unique probability
measure on the Borel $\sigma$-algebra over cylinders of
${(SA)}^\omega$). We may drop some subscripts of $\mathbb{P}_{\mathcal{M},s}^\sigma$
when the context is clear.
\paragraph{Bottom strongly-connected components} The counterparts of ECs in MCs are \textit{bottom strongly-connected components} (BSCCs). In our formalism, where an MC is simply an MDP $\mathcal{M} = (S,A,\delta)$ with $\vert A(s)\vert = 1$ for all $s \in \ensuremath{S} $, BSCCs are exactly the ECs of such an MDP $\mathcal{M}$.
\paragraph{Sure and almost sure events} Let $\mathcal{M} = (S,A,\delta)$, $\sigma \in \Sigma$, and $E \subseteq {(SA)}^\omega$
be an event. We say that
$E$ is \textit{sure}, written $\sureStrat{\mathcal{M},s}{\sigma}{E}$, if and only if
$\Runs{\mathcal{M}^\sigma_s} \subseteq E$ (again abusing our notation to consider projections on ${(SA)}^\omega$);
and that $E$ is \textit{almost-sure}, written
$\almostStrat{\mathcal{M},s}{\sigma}{E}$, if and only if
$\mathbb{P}^\sigma_{\mathcal{M},s}[E] = 1$.
\paragraph{Almost-sure reachability of ECs} Given a run $\rho = s_0 a_0 s_1 a_1 \ldots{} \in \Runs{\mathcal{M}}$, let
\[
\mathsf{inf}(\rho) = \{s \in S \mid \forall\, i \geq 0,\, \exists\, j > i,\, s_j = s\}
\]
denote the set of states visited infinitely-often along $\rho$, and let
\[
\mathsf{infAct}(\rho) = \{a \in A \mid \forall\, i \geq 0,\, \exists\, j > i,\, a_j = a\}
\]
similarly denote the actions taken infinitely-often along $\rho$.
Let $\mathsf{limitSet}(\rho)$ denote the pair $(\mathsf{inf}(\rho), \mathsf{infAct}(\rho))$. Note that this pair may induce a well-defined sub-MDP $\mathcal{M}' = (\mathsf{inf}(\rho), \mathsf{infAct}(\rho), \restr{\delta}{\mathsf{inf}(\rho)\times \mathsf{infAct}(\rho)})$, but in general this need not be the case. A folklore result in MDPs (e.g.,~\cite{baier2008principles}) is the following: for any state $s$ of MDP $\mathcal{M}$, for any strategy $\sigma \in \Sigma$, we have that
\[
\almostStrat{\mathcal{M},s}{\sigma}{\{\rho \in \Runs{\mathcal{M}^\sigma_s} \mid \mathsf{limitSet}(\rho) \in \ecs(\mathcal{M})\}},
\]
that is, under any strategy, the limit behavior of the MDP almost-surely coincides with an EC\@. This property is a key tool in the analysis of MDPs with prefix-independent objectives, as it essentially says that we only need to identify the ``best'' ECs and maximize the probability to reach them.
\paragraph{Decision problem} An \textit{objective} for an MDP $\mathcal{M} = (S, A, \delta)$ is a measurable set of runs $E \subseteq {(SA)}^\omega$. Given an MDP $\mathcal{M}=(S, A, \delta)$, an initial state $s$, a threshold $\alpha \in [0, 1] \cap \mathbb{Q}$, and such an objective $E$, the \textit{threshold probability problem} is to decide whether there exists a strategy $\sigma \in \Sigma$ such that $\mathbb{P}_{\mathcal{M}, s}^\sigma\left[ E \right ] \geq \alpha$ or not.
Furthermore, if it exists, we want to build such a strategy.
\paragraph{Weights and priorities} In this paper, we always assume an MDP $\mathcal{M}=(S, A, \delta)$ with either (i)~a \textit{weight} function $w\colon A \rightarrow \mathbb{Z}$ of largest absolute weight $W$, or (ii) a \textit{priority} function $p\colon S \rightarrow \{0, 1, \ldots{}, d\}$, with $d \leq \vert S\vert +1$ (w.l.o.g.). This choice is left implicit when the context is clear, to offer a unified view of mean-payoff and parity variants of window objectives.
\paragraph{Complexity} When studying the complexity of decision problems, we make the classical assumptions of the field: we consider the model size $\vert \mathcal{M} \vert$ to be polynomial in $\vert S \vert$ and the \textit{binary encoding} of weights and probabilities (e.g., $V = \log_2 W$, with $W$ the largest absolute weight), whereas we consider the largest priority $d$, as well as the upcoming window size $\lambda$, to be encoded in unary.
When a problem is polynomial in $W$, we say that it is \textit{pseudo}-polynomial: it would be polynomial if weights would be given in unary.
\paragraph{Mean-payoff and parity objectives}
We consider window objectives based on \textit{mean-payoff} and \textit{parity} objectives. Let us discuss those classical objectives.
The first one is a \textit{quantitative} objective, for which we consider \textit{weighted} MDPs. Let $\rho \in \Runs{\mathcal{M}}$ be a run of such an MDP\@.
The \textit{mean-payoff} of prefix $\rho[0, n]$ is
$\mathsf{MP}(\rho[0, n])=\frac{1}{n} \sum_{i=0}^{n-1} w(a_i)$, for $n>0$.
This is naturally extended to runs by considering the limit behavior.
The \textit{mean-payoff} of $\rho$ is $\mathsf{MP}(\rho) = \liminf_{n \rightarrow \infty} \mathsf{MP}(\rho[0, n])$. Given a threshold $\nu \in \mathbb{Q}$, the mean-payoff objective accepts all runs whose mean-payoff is above the threshold, i.e., $\mathsf{MeanPayoff}(\nu) = \{\rho \in \Runs{\mathcal{M}} \mid \mathsf{MP}(\rho) \geq \nu\}$. The corresponding threshold probability problem is in~$\mathsf{P}$ using linear programming, and pure memoryless strategies suffice (see, e.g.,~\cite{DBLP:journals/fmsd/RandourRS17}). Note that $\nu$ can be taken equal to zero without loss of generality. Another variant of mean-payoff exists: it is defined using $\limsup$ instead of $\liminf$. In the classical one-dimension setting, optimal strategies for the two versions coincide and ensure the same thresholds (whereas the values may differ on an arbitrary run). In our setting, we will interpret the mean-payoff over a finite horizon, hence the two variants are de facto equivalent for our use.
The second objective, parity, is a \textit{qualitative} one, for which we consider MDPs with a priority function. The \emph{parity objective} requires that the smallest priority seen infinitely often along a run be even, i.e., $\mathsf{Parity} = \{\rho \in \Runs{\mathcal{M}} \mid \min_{s \in \mathsf{inf}(\rho)} p(s) = 0 \pmod 2\}$. Again, the corresponding threshold probability problem is in $\mathsf{P}$ and pure memoryless strategies suffice~\cite{DBLP:conf/soda/ChatterjeeJH04}.
\clearpage
\section{Window objectives}%
\label{sec:window}
\subsection{Definitions}\label{subsec:defs}
~\paragraph{Good windows}
Given a weighted MDP $\mathcal{M}$ and $\lambda > 0$, we define the \textit{good window mean-payoff} objective
\begin{equation*}
\mathsf{GW}_{\mathsf{mp}}(\lambda) = \Big\{ \rho \in \Runs{\mathcal{M}} \mid \exists\, l < \lambda,\; \mathsf{MP}\big(\rho[0, l+1]\big) \geq 0\Big\}
\end{equation*}
requiring the existence of a window of size bounded by $\lambda$ and starting at the first position of the run, over which the mean-payoff is at least equal to zero (w.l.o.g.).
Similarly, given an MDP $\mathcal{M}$ with priority function $p$, we define the \textit{good window parity} objective,
\begin{equation*}
\mathsf{GW}_{\mathsf{par}}(\lambda) = \Big\{ \rho \in \Runs{\mathcal{M}} \mid \exists\, l < \lambda,\; \big(p(\rho[l]) \bmod 2 = 0 \wedge \forall\, k < l,\; p(\rho[l]) < p(\rho[k])\big)\Big\}
\end{equation*}
requiring the existence of a window of size bounded by $\lambda$ and starting at the first position of the run, for which the last priority is even and is the smallest within the window.
To preserve our generic approach, we use subscripts $\mathsf{mp}$ and $\mathsf{par}$ for mean-payoff and parity variants respectively.
So, given $\Omega = \{\mathsf{mp}, \mathsf{par}\}$ and a run $\rho \in \Runs{\mathcal{M}}$,
we say that \textit{an $\Omega$-window is closed} in at most $\lambda$ steps from $\rho[i]$ if $\rho[i, \infty]$ is in $\mathsf{GW}_\Omega(\lambda)$. If a window is not yet closed, we call it \textit{open}.
\paragraph{Fixed variants} Given $\lambda > 0$, we define the \textit{direct fixed window} objective
\begin{equation*}
\mathsf{DFW}_{\Omega}(\lambda) = \left\{ \rho \in \Runs{\mathcal{M}} \mid \forall\, j \ge 0,\; \rho[j,\infty] \in \mathsf{GW}_{\Omega}(\lambda)\right\}
\end{equation*}
asking for all $\Omega$-windows to be closed within $\lambda$ steps along the run.
We also define the \textit{fixed window} objective
\begin{equation*}
\mathsf{FW}_{\Omega}(\lambda) = \left\{ \rho \in \Runs{\mathcal{M}} \mid \exists\, i \ge 0,\; \rho[i,\infty] \in \mathsf{DFW}_{\Omega}(\lambda)\right\}
\end{equation*}
that is the
\textit{prefix-independent} version of the previous one: it requires it to be eventually satisfied.
\paragraph{Bounded variant} Finally, we define the \textit{bounded window} objective
\begin{equation*}
\mathsf{BW}_{\Omega} = \left\{ \rho \in \Runs{\mathcal{M}} \mid \exists\, \lambda > 0,\; \rho \in \mathsf{FW}_{\Omega}(\lambda)\right\}
\end{equation*}
requiring the existence of a bound $\lambda$ for which the fixed window objective is satisfied. Note that this bound need not be \textit{uniform} along all runs in general. A \textit{direct} variant may also be defined, but turns out to be ill-suited in the stochastic context: we illustrate it in Sect.~\ref{subsec:illustration} and discuss its pitfalls in Sect.~\ref{sec:concl}. Hence we focus on the prefix-independent version in the following.
\subsection{Overview in games}\label{subsec:games}
Window mean-payoff and window parity objectives were considered in two-player zero-sum games~\cite{DBLP:journals/iandc/Chatterjee0RR15,DBLP:journals/corr/BruyereHR16}. The game setting is equivalent to deciding if there exists a controller strategy in an MDP such that the corresponding objective is \textit{surely} satisfied, i.e., by all consistent runs. We quickly summarize the main results here. In both cases, window objectives establish \textit{conservative approximations} of the classical ones, with \textit{improved complexity}.
For mean-payoff~\cite{DBLP:journals/iandc/Chatterjee0RR15}, (direct and prefix-independent) fixed window objectives can be solved in polynomial time, both in the model and the window size. Memory is in general needed for both players, but polynomial memory suffices. Bounded versions belong to $\mathsf{NP} \cap \mathsf{coNP}$ and are as hard as mean-payoff games. Memoryless strategies suffice for the controller but not for its opponent (infinite memory is needed for the prefix-independent case, polynomial memory suffices in the direct case). Interestingly, if the controller can win the bounded window objective, then a \textit{uniform bound} exists, i.e., there exists a window size $\lambda$ sufficiently large such that the bounded version coincides with the fixed one. Recall that this is not granted by definition. We will see that \textit{in MDPs, this does not hold} (Ex.~\ref{ex:uniform}). This uniform bound in games is however pseudo-polynomial.
For parity~\cite{DBLP:journals/corr/BruyereHR16}, similar results are obtained. The crucial difference is the uniform bound on $\lambda$, which also exists but in this case is equal to the number of states of the game. Thanks to that, all variants of window parity objectives belong to $\mathsf{P}$. The memory requirements are the same as for window mean-payoff.
\subsection{Illustration}%
\label{subsec:illustration}
\begin{exa}
We first go back to the example of Sect.~\ref{sec:intro}, depicted in Fig.~\ref{fig:intro_ex}. Let $\mathcal{M}$ be this MDP\@. Fix run $\rho = {(s_1\, a\, s_2\, b\, s_3\, c)}^\omega$. We have that $\rho \not\in \mathsf{FW}_{\mathsf{par}}(\lambda = 2)$ --- a fortiori, $\rho \not\in \mathsf{DFW}_{\mathsf{par}}(\lambda = 2)$ --- as the window that opens in $s_1$ is not closed after two steps (because $s_1$ has odd priority $1$, and $2$ is not smaller than $1$ so does not suffice to answer it). If we now set $\lambda = 3$, we see that this window closes on time, as $0$ is encountered within three steps. As all other windows are immediately closed, we have $\rho \in \mathsf{DFW}_{\mathsf{par}}(\lambda = 3)$ --- a fortiori, $\rho \in \mathsf{FW}_{\mathsf{par}}(\lambda = 3)$ and $\rho \in \mathsf{BW}_\mathsf{par}$.
Regarding the probability of these objectives, however, we have already argued that, for all $\lambda > 0$, $\mathbb{P}_{\mathcal{M}, s_1}[\mathsf{FW}_\mathsf{par}(\lambda)] = 0$, whereas $\mathbb{P}_{\mathcal{M}, s_1}[\mathsf{Parity}] = 1$ since $s_3$ is almost-surely visited infinitely often but any time bound is almost-surely exceeded infinitely often too. Observe that $\mathsf{BW}_\mathsf{par} = \bigcup_{\lambda > 0} \mathsf{FW}_{\mathsf{par}}(\lambda)$, hence we also have that $\mathbb{P}_{\mathcal{M}, s_1}[\mathsf{BW}_\mathsf{par}] = 0$ (by countable additivity).
Similar reasoning holds for window mean-payoff objectives, by taking the weight function $w = \{a \mapsto -1, b \mapsto 0, c \mapsto 1\}$.\hfill$\triangleleft$
\end{exa}
With the next example, we illustrate one of the main differences between games and MDPs w.r.t.~window objectives. As discussed in Sect.~\ref{subsec:games}, in two-player zero-sum games, both for parity and mean-payoff, there exists a \textit{uniform bound} on the window size $\lambda$ such that the fixed variants coincide with the bounded ones. We show that this property does not carry over to MDPs.
\begin{figure}[tbh]
\begin{center}\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node
distance=2.5cm,bend angle=45, scale=0.6, font=\normalsize]
\tikzstyle{p1}=[draw,circle,text centered,minimum size=7mm,text width=4mm]
\tikzstyle{p2}=[draw,rectangle,text centered,minimum size=7mm,text width=4mm]
\tikzstyle{act}=[fill,circle,inner sep=1pt,minimum size=1.5pt,
node distance=1cm] \tikzstyle{empty}=[text centered, text
width=15mm]
\node[p1] (1) at (0,0) {$s$};
\node[empty] at ($(1)+(0,1)$) {1};
\node[p1] (2) at (5,0) {$t$};
\node[empty] at ($(2)+(0,1)$) {0};
\node[act] (1a) at (1.5,0) {};
\node[empty] at ($(1a)+(0.3,0.3)$) {\scriptsize $a$};
\node[act] (2a) at (6.5,0) {};
\node[empty] at ($(2a)+(0,-0.4)$) {\scriptsize $b$};
\node[] (init) at (-1.6,0) {};
\path[-latex']
(init) edge (1)
(1) edge (1a)
(1a) edge node[above,xshift=0mm]{\scriptsize $0.5$} (2);
\draw [->] (1a) to[out=90,in=45]
node[above,xshift=0mm]{\scriptsize $0.5$} (1);
\draw [->] (2) to[out=0,in=180] node[]{} (2a);
\draw [->] (2a) to[out=90,in=60] node[above ,xshift=0mm]{\scriptsize $1$} (2);
\end{tikzpicture}
\caption{On this Markov chain, there is no uniform bound over all runs, in contrast to the game setting.}%
\label{fig:exNoBound}
\end{center}
\end{figure}
\begin{exa}%
\label{ex:uniform}
Consider the MC $\mathcal{M}$ depicted in Fig.~\ref{fig:exNoBound}. It is clear that for any $\lambda > 0$, there is probability $1/2^{\lambda-1}$ that objective $\mathsf{DFW}_{\mathsf{par}}(\lambda)$ is not satisfied. Hence, for all $\lambda > 0$, $\mathbb{P}_{\mathcal{M}, s}[\mathsf{DFW}_{\mathsf{par}}(\lambda)] < 1$.
Now let $\mathsf{DBW}_{\mathsf{par}}$ be the \textit{direct} bounded window objective evoked in Sect.~\ref{subsec:defs} and defined as $\mathsf{DBW}_\mathsf{par} = \bigcup_{\lambda > 0} \mathsf{DFW}_{\mathsf{par}}(\lambda)$. We claim that $\mathbb{P}_{\mathcal{M}, s}[\mathsf{DBW}_{\mathsf{par}}] = 1$. Indeed, any run ending in $t$ belongs to $\mathsf{DBW}_{\mathsf{par}}$, as it belongs to $\mathsf{DFW}_{\mathsf{par}}(\lambda)$ for $\lambda$ equal to the length of the prefix up to $t$. Since $t$ is almost-surely reached (as it is the only BSCC of the MC), we conclude that $\mathsf{DBW}_{\mathsf{par}}$ is indeed satisfied almost-surely.
Essentially, the difference stems from the fairness of probabilities. In a game, the opponent would control the successor choice after action $a$ and always go back to $s$, resulting in objective $\mathsf{DBW}_{\mathsf{par}}$ being lost. However, in this MC, $s$ is almost-surely left eventually, but we cannot guarantee when: hence there exists a window bound for each run, but there is no uniform bound over all runs.
This simple MC also illustrates the classical difference between sure and almost-sure satisfaction: while we have $\almostStrat{\mathcal{M},s}{}{\mathsf{FW}_\mathsf{par}(\lambda = 1)}$, we do not have $\sureStrat{\mathcal{M},s}{}{\mathsf{FW}_\mathsf{par}(\lambda = 1)}$, because of run $\rho = {(s\,a)}^\omega$.
Again the same reasoning holds for mean-payoff variants of the objectives, for example with $w = \{ a \mapsto -1, b \mapsto 1\}$.\hfill$\triangleleft$
\end{exa}
We leave out the \textit{direct} bounded objective $\mathsf{DBW}_\Omega$ from now on. We will come back to it in Sect.~\ref{sec:concl} and motivate why this objective is not well-behaved. Hence, in the following, we focus on direct and prefix-independent fixed window objectives and prefix-independent bounded ones.
\section{Fixed case: better safe than sorry}%
\label{sec:fixed}
We start with the fixed variants of window objectives. Our main goal here is to establish that \textit{pure finite-memory} strategies suffice in all cases. As a by-product, we also obtain algorithms to solve the corresponding decision problems. Still, for the prefix-independent variants, we will obtain better complexities using the upcoming generic approach (Sect.~\ref{sec:general}).
Our main tools are natural reductions from direct (resp.~prefix-independent) window problems on MDPs to safety (resp.~co-B\"uchi) problems on \textit{unfoldings} based on the window size $\lambda$ (i.e., larger arenas incorporating information on open windows). We use \textit{identical unfoldings} for both direct and prefix-independent objectives, in order to obtain a unified proof. In both cases, the set of states to avoid in the unfolding corresponds to leaving a window open for $\lambda$ steps.
\subsection{Reductions}\label{subsec:reductions}
~\paragraph{Mean-payoff}
Let $\mathcal{M} = (S,A,\delta)$ be an MDP with weight function $w$ (of maximal absolute weight $W$), and
$\lambda>0$ be the window size. We
define the unfolding MDP
$\mdp_{\lambda} = (\tilde{S}, A, \tilde{\delta})$ as follows:
\begin{itemize}
\item $\tilde{S} = S \times \set{0,\ldots, \lambda} \times \set{ -\lambda \cdot W, \ldots, 0}$.
\item $\tilde{\delta}\colon \tilde{S} \times A \to
\ensuremath{\mathcal{D}} (\tilde{S})$ is defined as follows for all $a$ in $A$:
\begin{align*}
\tilde{\delta}\left((s,l,z), a\right)(t, l + 1, z + w(a)) = \nu
\text{ if }
\big( \delta(s,a)(t) = \nu \big) \; \wedge \;
\big( l < \lambda \big) \; \wedge \;
\big( z + w(a) < 0 \big),
\\
\tilde{\delta}\left((s,l,z), a\right)(t,0,0) = \nu
\text{ if }
\big( \delta(s,a)(t) = \nu \big) \; \wedge \; \Big[\big( z + w(a) \ge 0 \big) \vee \Big(\big ( l = \lambda \big) \; \wedge \;
\big ( z < 0 \big)\Big)\Big].
\end{align*}
\item Once an initial state $s_\text{init} \in S$ is fixed in $\mathcal{M}$, the
associated initial state in $\mdp_{\lambda}$ is $\tilde{s}_\text{init} = (s_\text{init}, 0, 0) \in \tilde{S}$.
\end{itemize}
\noindent
Note that $\mdp_{\lambda}$ is unweighted: it keeps track in each of its
states of the current state of $\mathcal{M}$, the size of the
current open window as well as the current sum of weights in the
window: these two values are reset whenever a window is closed (left-hand side of the disjunction) or stays open for $\lambda$ steps (right hand-side). A key underlying property used here is the so-called
\textit{inductive property of
windows}~\cite{DBLP:journals/iandc/Chatterjee0RR15,DBLP:journals/corr/BruyereHR16}.
\begin{pty}[Inductive property of windows]
Consider a run $\rho = s_0 a_0 s_1 a_1 \ldots{}$ in an MDP\@. Fix a
window starting in position $i \geq 0$. Let $j$ be the position in
which this window gets closed, assuming it does. Then, all windows
in positions from $i$ to $j$ also close in $j$.
\end{pty}
The validity of this property is easy to check by contradiction (if it
was not the case, then the window in $i$ would close before $j$). This
property is fundamental in our reduction: without it we would have to
keep track of all open windows in parallel, which would result in a
blow-up exponential in $\lambda$.
In the upcoming reductions, the set of states to avoid will be \[B = \set{(s,l,z) \mid (l = \lambda) \land (z < 0)}.\] By construction of $\mdp_{\lambda}$, it exactly corresponds to windows staying open for $\lambda$ steps.
\paragraph{Parity} Let $\mathcal{M} = (S,A,\delta)$ be an
MDP with priority function $p$, and $\lambda>0$ be the window size. We define the unfolding MDP
$\mdp_{\lambda} = (\tilde{S}, A, \tilde{\delta})$ as follows:
\begin{itemize}
\item $\tilde{S} = S \times \set{0,\ldots, \lambda} \times \set{0, 1, \dots, d}$.
\item $\tilde{\delta}\colon \tilde{S} \times A \to
\ensuremath{\mathcal{D}} (\tilde{S})$ is defined as follows for all $a$ in $A$:
\begin{align*}
\tilde{\delta}\left((s,l,c), a\right)(t, l + 1, \min(c, p(t))) &= \nu
\text{ if }
\big( \delta(s,a)(t) = \nu \big) \; \wedge \;
\big( l < \lambda - 1 \big) \; \wedge \;
\big( c \bmod 2 = 1 \big),
\\
\tilde{\delta}\left((s,l,c), a\right)(t,0,p(t)) &= \nu
\text{ if }
\big( \delta(s,a)(t) = \nu \big) \; \wedge \;
\big( l = \lambda - 1 \big) \; \wedge \;
\big( c \bmod 2 = 1 \big),
\\
\tilde{\delta}\left((s,l,c), a\right)(t,0,p(t)) &= \nu
\text{ if }
\big( \delta(s,a)(t) = \nu \big) \; \wedge \;
\big( c \bmod 2 = 0 \big).
\end{align*}
\item Once an initial state $s_\text{init} \in S$ is fixed in $\mathcal{M}$, the
associated one in $\mdp_{\lambda}$ is $\tilde{s}_\text{init} = (s_\text{init}, 0, p(s_\text{init})) \in \tilde{S}$.
\end{itemize}
This unfolding keeps track in each of its states of the current state
of the original MDP, the size of the current window and the minimum
priority in the window: again, these two values are reset whenever a window is closed or stays open for $\lambda$ steps.
In this case, the set of states to avoid will be $B = \set{(s,l,c) \mid (l = \lambda - 1) \land (c \bmod 2 = 1)}$, with an equivalent interpretation.
\begin{rem}
There is a slight asymmetry in the use of indices for the current
window size in the two constructions: that is due to mean-payoff using
weights on actions (two states being needed for one action) and parity
using priorities on states.
\end{rem}
\paragraph{Objectives} We treat mean-payoff and parity versions in a unified way from now on. As stated before, the set $B$ represents in both cases windows being open for $\lambda$ steps and should be avoided: at all times for direct variants, eventually for prefix-independent ones. We define the following objectives over the unfoldings:
\begin{align*}
&\mathsf{Reach}(\mdp_{\lambda}) = {(\tilde{S}A)}^*BA{(\tilde{S}A)}^\omega, &\mathsf{Safety}(\mdp_{\lambda}) = {(\tilde{S}A)}^\omega \setminus \mathsf{Reach}(\mdp_{\lambda}),\\
&\mathsf{Buchi}(\mdp_{\lambda}) = {({(\tilde{S}A)}^*BA)}^\omega, &\mathsf{coBuchi}(\mdp_{\lambda}) = {(\tilde{S}A)}^\omega \setminus \mathsf{Buchi}(\mdp_{\lambda}).
\end{align*}
Our ultimate goal is to prove that the safety and co-B\"uchi objectives in $\mdp_{\lambda}$ are \textit{probability-wise equivalent} to the direct fixed window and fixed window ones in $\mathcal{M}$, modulo a well-defined \textit{mapping} between histories, runs and strategies. This will induce the correctness of our reduction.
\paragraph{Mapping} Fix an initial state $s_\text{init}$ in $\mathcal{M}$ and let $\tilde{s}_\text{init}$ be its corresponding initial state in $\mdp_{\lambda}$. Let $\Hists{\mathcal{M}, s_\text{init}}$ denote the histories of $\mathcal{M}$ starting in $s_\text{init}$. We start by defining a bijective mapping $\pi_{\mdp_{\lambda}}$, and its inverse $\pi_\mathcal{M}$, between \textit{histories} of $\Hists{\mathcal{M}, s_\text{init}}$ and $\Hists{\mdp_{\lambda}, \tilde{s}_\text{init}}$. We use $\pi_{\mdp_{\lambda}} \colon \Hists{\mathcal{M}, s_\text{init}} \rightarrow \Hists{\mdp_{\lambda}, \tilde{s}_\text{init}}$ for the $\mathcal{M}$-to-$\mdp_{\lambda}$ direction, and $\pi_\mathcal{M}\colon \Hists{\mdp_{\lambda}, \tilde{s}_\text{init}} \rightarrow \Hists{\mathcal{M}, s_\text{init}}$ for the opposite one. We define $\pi_{\mdp_{\lambda}}$ inductively as follows.
\begin{itemize}
\item $\pi_{\mdp_{\lambda}}(s_\text{init}) = \tilde{s}_\text{init}$.
\item Let $h \in \Hists{\mathcal{M}, s_\text{init}}$, $\tilde{h} = \pi_{\mdp_{\lambda}}(h)$, $a \in A$, $s \in S$. Then, $\pi_{\mdp_{\lambda}}(h\cdot a \cdot s) = \tilde{h} \cdot a \cdot \tilde{s}$, where $\tilde{s}$ is obtained from $\mathsf{Last}(\tilde{h})$, $a$ and $s$ following the unfolding construction.
\end{itemize}
We define $\pi_\mathcal{M}$ as its inverse, i.e., the function projecting histories of $\Hists{\mdp_{\lambda}, \tilde{s}_\text{init}}$ to ${(SA)}^*S$.
We naturally extend these mappings to \textit{runs} based on this inductive construction.
Now, we also extend these mappings to \textit{strategies}. Let $\sigma$ be a strategy in $\mathcal{M}$. We define its twin strategy $\tilde{\sigma} = \pi_{\mdp_{\lambda}}(\sigma)$ in $\mdp_{\lambda}$ as follows: for all $\tilde{h} \in \Hists{\mdp_{\lambda}, \tilde{s}_\text{init}}$, $\tilde{\sigma}(\tilde{h}) = \sigma(\pi_\mathcal{M}(\tilde{h}))$. Note that this strategy is well-defined as $\mathcal{M}$ and $\mdp_{\lambda}$ share the same actions and $\pi_\mathcal{M}$ is a proper function over $\Hists{\mdp_{\lambda}, \tilde{s}_\text{init}}$ (i.e., each history $\tilde{h}$ has an image in $\Hists{\mathcal{M}, s_\text{init}}$). Similarly, given a strategy $\tilde{\sigma}$ in $\mdp_{\lambda}$, we build a twin strategy $\sigma = \pi_\mathcal{M}(\tilde{\sigma})$ using $\pi_{\mdp_{\lambda}}$. Hence we also have a bijection over strategies.
We say that two objects (histories, runs, strategies) are $\pi$-\textit{corresponding} if they are the image of one another through mappings $\pi_\mathcal{M}$ and $\pi_{\mdp_{\lambda}}$.
\paragraph{Probability-wise equivalence} For any any history $h$, we denote by $\mathsf{Cyl}(h)$ the \textit{cylinder set} spanned by it, i.e., the set of all runs prolonging $h$. Cylinder sets are the building blocks of probability measures in MCs, as all measurable sets belong to the $\sigma$-algebra built upon them~\cite{baier2008principles}. We show that our mappings preserve probabilities of cylinder sets.
\begin{lem}%
\label{lem:cylinders}
Let $\mathcal{M}$, $\mdp_{\lambda}$, $\pi_{\mathcal{M}}$ and $\pi_{\mdp_{\lambda}}$ be defined as above. Fix any couple of $\pi$-corresponding strategies $(\sigma, \tilde{\sigma})$ for $\mathcal{M}$ and $\mdp_{\lambda}$ respectively. Then, for any couple of $\pi$-corresponding histories $(h, \tilde{h})$ in $\Hists{\mathcal{M}, s_\text{init}} \times \Hists{\mdp_{\lambda}, \tilde{s}_\text{init}}$, we have that
\begin{equation}
\label{eq:cylinders}
\mathbb{P}_{\mathcal{M}, s_\text{init}}^\sigma[\mathsf{Cyl}(h)] = \mathbb{P}_{\mdp_{\lambda}, \tilde{s}_\text{init}}^{\tilde{\sigma}}[\mathsf{Cyl}(\tilde{h})].
\end{equation}
\end{lem}
\begin{proof}
We fix $\mathcal{M}$, $\mdp_{\lambda}$, $\pi_{\mathcal{M}}$, $\pi_{\mdp_{\lambda}}$, and a couple of $\pi$-corresponding strategies $(\sigma, \tilde{\sigma})$. We prove the equality by induction on histories. The base case, for $h = s_\text{init}$ and $\tilde{h} = \tilde{s}_\text{init}$, is trivial, as we have
\begin{align*}
\mathbb{P}_{\mathcal{M}, s_\text{init}}^\sigma[\mathsf{Cyl}(h)] = \mathbb{P}_{\mathcal{M}, s_\text{init}}^\sigma[\Runs{\mathcal{M}, s_\text{init}}] &= 1\\ &= \mathbb{P}_{\mdp_{\lambda}, \tilde{s}_\text{init}}^{\tilde{\sigma}}[\Runs{\mdp_{\lambda}, \tilde{s}_\text{init}}] = \mathbb{P}_{\mdp_{\lambda}, \tilde{s}_\text{init}}^{\tilde{\sigma}}[\mathsf{Cyl}(\tilde{h})].
\end{align*}
Now, assume Eq.~\eqref{eq:cylinders} true for a couple of $\pi$-corresponding histories $(h, \tilde{h})$. Consider any one-step extension of these histories, say $(h\cdot a \cdot s, \tilde{h}\cdot a\cdot \tilde{s})$ for $a \in A$, $s \in S$ and $\tilde{h}\cdot a\cdot \tilde{s} = \pi_{\mdp_{\lambda}}(h\cdot a\cdot s)$. We need to prove that Eq.~\eqref{eq:cylinders} still holds for this pair of histories. Let us expand the equality to prove as follows:
\begin{align*}
\mathbb{P}_{\mathcal{M}, s_\text{init}}^\sigma[\mathsf{Cyl}(h\cdot a \cdot s)] &= \mathbb{P}_{\mdp_{\lambda}, \tilde{s}_\text{init}}^{\tilde{\sigma}}[\mathsf{Cyl}(\tilde{h}\cdot a \cdot \tilde{s})]\\
\iff \mathbb{P}_{\mathcal{M}, s_\text{init}}^\sigma[h] \cdot \sigma(h)(a) \cdot \delta(\mathsf{Last}(h), a, s) &= \mathbb{P}_{\mdp_{\lambda}, \tilde{s}_\text{init}}^{\tilde{\sigma}}[\tilde{h}] \cdot \tilde{\sigma}(\tilde{h})(a) \cdot \tilde{\delta}(\mathsf{Last}(\tilde{h}), a, \tilde{s}).
\end{align*}
Now, observe that $\sigma(h)(a) = \tilde{\sigma}(\tilde{h})(a)$ since $\sigma$ and $\tilde{\sigma}$ are $\pi$-corresponding strategies and $h$ and $\tilde{h}$ are $\pi$-corresponding histories. Furthermore, $\delta(\mathsf{Last}(h), a, s) = \tilde{\delta}(\mathsf{Last}(\tilde{h}), a, \tilde{s})$ by construction of the unfolding. Now since $\mathbb{P}_{\mathcal{M}, s_\text{init}}^\sigma[h] = \mathbb{P}_{\mdp_{\lambda}, \tilde{s}_\text{init}}^{\tilde{\sigma}}[\tilde{h}]$ holds by induction hypothesis, we are done.
\end{proof}
Since the previous lemma holds for all cylinders, we may extend the result to any event (see, e.g.,~\cite{baier2008principles} for the construction of the $\sigma$-algebra and related questions).
\begin{cor}%
\label{cor:events}
Let $\mathcal{M}$, $\mdp_{\lambda}$, $\pi_{\mathcal{M}}$ and $\pi_{\mdp_{\lambda}}$ be defined as above. Fix any couple of $\pi$-corresponding strategies $(\sigma, \tilde{\sigma})$ for $\mathcal{M}$ and $\mdp_{\lambda}$ respectively. Then, for any couple of $\pi$-corresponding measurable objectives $(E, \tilde{E}) \subseteq \Runs{\mathcal{M}, s_\text{init}} \times \Runs{\mdp_{\lambda}, \tilde{s}_\text{init}}$, we have that
\begin{equation*}
\mathbb{P}_{\mathcal{M}, s_{\text{init}}}^\sigma[E] = \mathbb{P}_{\mdp_{\lambda}, \tilde{s}_\text{init}}^{\tilde{\sigma}}[\tilde{E}].
\end{equation*}
\end{cor}
\paragraph{Correctness of the reductions} We may now establish our reductions.
\begin{lem}%
\label{lem:reductions}
Let $\mathcal{M} = (S,A,\delta)$ be an MDP, $\lambda > 0$ be the window size, $\Omega
\in \{\mathsf{mp}, \mathsf{par}\}$, $\mathcal{M}_\lambda = (\tilde{S}, A, \tilde{\delta})$ be the
unfolding of $\mathcal{M}$ defined as above for variant $\Omega$, $s \in S$ be a state of $\mathcal{M}$, and $\tilde{s} \in \tilde{S}$ be its
$\pi$-corresponding state in $\mathcal{M}_\lambda$. The following assertions hold.
\begin{enumerate}
\item For any strategy $\sigma$ in $\mathcal{M}$, there exists a strategy
$\tilde{\sigma}$ in $\mdp_{\lambda}$ such that
\begin{align*}
\mathbb{P}_{\mdp_{\lambda}, \tilde{s}}^{\tilde{\sigma}}[\mathsf{Safety}(\mdp_{\lambda})] = \mathbb{P}_{\mathcal{M}, s}^\sigma[\mathsf{DFW}_{\Omega}(\lambda)] \quad \wedge \quad \mathbb{P}_{\mdp_{\lambda}, \tilde{s}}^{\tilde{\sigma}}[\mathsf{coBuchi}(\mdp_{\lambda})] = \mathbb{P}_{\mathcal{M}, s}^\sigma[\mathsf{FW}_{\Omega}(\lambda)].
\end{align*}
\item For any strategy $\tilde{\sigma}$ in $\mdp_{\lambda}$, there exists a strategy
$\sigma$ in $\mathcal{M}$ such that
\begin{align*}
\mathbb{P}_{\mathcal{M},s}^\sigma[\mathsf{DFW}_{\Omega}(\lambda)] =
\mathbb{P}_{\mdp_{\lambda}, \tilde{s}}^{\tilde{\sigma}}[\mathsf{Safety}(\mdp_{\lambda})] \quad \wedge \quad \mathbb{P}_{\mathcal{M},s}^\sigma[\mathsf{FW}_{\Omega}(\lambda)] =
\mathbb{P}_{\mdp_{\lambda}, \tilde{s}}^{\tilde{\sigma}}[\mathsf{coBuchi}(\mdp_{\lambda})].
\end{align*}
\end{enumerate}
Moreover, such strategies can be obtained through mappings $\pi_{\mathcal{M}}$ and $\pi_{\mdp_{\lambda}}$.
\end{lem}
\begin{proof}
To prove it, it suffices to see that $\mathsf{Safety}(\mdp_{\lambda})$ (resp.~$\mathsf{coBuchi}(\mdp_{\lambda})$) is $\pi$-corresponding with $\mathsf{DFW}_{\Omega}(\lambda)$ (resp.~$\mathsf{FW}_{\Omega}(\lambda)$) and invoke Cor.~\ref{cor:events}. As noted earlier, this correspondence is trivial by construction of the unfoldings. Consider the safety case: a run $\tilde{\rho}$ in $\mdp_{\lambda}$ belongs to $\mathsf{Safety}(\mdp_{\lambda})$ \textit{if and only if} all the windows along $\rho = \pi_\mathcal{M}(\tilde{\rho})$ close within $\lambda$ steps. Similarly, a run $\tilde{\rho}$ in $\mdp_{\lambda}$ belongs to $\mathsf{coBuchi}(\mdp_{\lambda})$ \textit{if and only if} it visits $B$ finitely often, hence if and only if $\rho = \pi_\mathcal{M}(\tilde{\rho})$ contains a finite number of windows left open for $\lambda$ steps.
\end{proof}
Intuitively, to obtain a strategy $\sigma$ in $\mathcal{M}$ from a strategy $\tilde{\sigma}$ in the unfolding $\mdp_{\lambda}$, we have to integrate in the memory of $\sigma$ the additional information encoded in $\tilde{S}$: hence the memory required by $\sigma$ is the one used by $\tilde{\sigma}$ with a blow-up polynomial in $\vert \tilde{S}\vert$.
\subsection{Memory requirements and complexity}\hfill
\paragraph{Upper bounds} Thanks to the reductions established in Lem.~\ref{lem:reductions}, along with the
fact that \textit{pure memoryless} strategies suffice for safety and co-Büchi
objectives in MDPs~\cite{baier2008principles}, we obtain the following result.
\begin{thm}\label{finite-memory-cor}
Pure finite-memory strategies suffice for the threshold probability problem for all fixed window objectives.
That is,
given MDP $\mathcal{M} = (S,A,\delta)$, initial state $s \in S$, window size $\lambda > 0$, $\Omega \in \{\mathsf{mp}, \mathsf{par}\}$, objective $E \in \{\mathsf{DFW}_{\Omega}(\lambda), \mathsf{FW}_{\Omega}(\lambda)\}$ and threshold probability $\alpha \in [0, 1] \cap \mathbb{Q}$, if there exists a strategy $\sigma \in \Sigma$ such that $\mathbb{P}_{\mathcal{M},s}^\sigma [E] \geq \alpha$, then there exists a pure finite-memory strategy $\sigma'$ such that $\mathbb{P}_{\mathcal{M},s}^{\sigma'} [E] \geq \alpha$.
\end{thm}
These reductions also yield algorithms for the threshold probability problem in the fixed window case. We only use them for the direct variants, as the generic approach we develop in Sect.~\ref{sec:general} proves to be more efficient for the prefix-independent one, for two reasons: first, we may restrict the co-B\"uchi-like analysis to end-components; second, we use a more tractable analysis than the co-B\"uchi unfolding for mean-payoff. However, the reduction established for prefix-independent variants is not without interest: it yields sufficiency of finite-memory strategies, which is a \textit{key ingredient} to establish our generic approach (used in Lem.~\ref{grolem}).
\begin{thm}%
\label{thm:direct}
The threshold probability problem is
\begin{enumerate}[label={(\alph*)}]
\item in $\mathsf{P}$ for direct fixed window parity objectives, and pure polynomial-memory optimal strategies can be constructed in polynomial time.
\item in $\mathsf{EXPTIME}$ for direct fixed window mean-payoff objectives, and pure pseudo-polynomial-memory optimal strategies can be constructed in pseudo-polynomial time.
\end{enumerate}
\end{thm}
\begin{proof}
The algorithm is simple: given $\mathcal{M} = (S,A,\delta)$ and $\lambda > 0$, build $\mdp_{\lambda}$ and solve the corresponding safety problem. This can be done in polynomial time in $\vert\mdp_{\lambda}\vert$ and pure memoryless strategies suffice over $\mdp_{\lambda}$~\cite{baier2008principles}.
For parity, the unfolding is of size polynomial in $\vert \mathcal{M} \vert$, the number of priorities $d$ and the window size $\lambda$. Since both $d$ (anyway bounded by $\mathcal{O}(\vert S\vert)$) and $\lambda$ are assumed to be given in unary, it yields the result.
For mean-payoff, the unfolding is of size polynomial in $\vert \mathcal{M} \vert$, the largest absolute weight $W$ and the window size $\lambda$. Since weights are assumed to be encoded in binary, we only have a pseudo-polynomial-time algorithm.
\end{proof}
\paragraph{Lower bounds} We complement the results of Thm.~\ref{thm:direct} with almost-matching lower bounds, showing that our approach is close to optimal, complexity-wise.
\begin{thm}%
\label{thm:directHardness}
The threshold probability problem is
\begin{enumerate}[label={(\alph*)}]
\item\label{item:directHardness1} $\PTIME$-hard for direct fixed window parity objectives, and polynomial-memory strategies are in general necessary;
\item\label{item:directHardness2} $\mathsf{PSPACE}$-hard for direct fixed window mean-payoff objectives (even for acyclic MDPs), and pseudo-polynomial-memory strategies are in general necessary.
\end{enumerate}
\end{thm}
\begin{proof}
Item~\ref{item:directHardness1}. We establish $\PTIME$-hardness for direct fixed window parity objectives through a reduction from two-player reachability games, which are known to be $\PTIME$-complete~\cite{DBLP:journals/tods/Beeri80,DBLP:journals/jcss/Immerman81}. Let $\mathcal{G} = (V = V_1 \uplus V_2, E)$ be a game graph, where states in $V_1$ (resp.~$V_2$) belong to player~$1$ (resp.~player~$2$), and $E \subseteq V \times V$ is the set of transitions. Without loss of generality, we assume this graph to be strictly alternating, i.e., $E \subseteq V_1 \times V_2 \uplus V_2 \times V_1$, and without deadlock. The reachability objective $\mathsf{Reach}(T)$ for $T \subseteq V$ accepts all plays that eventually visit the set $T$. Again w.l.o.g., we assume that $T \subseteq V_1$. Given an initial state $v_{\text{init}} \in V_1$ and target set $T \subseteq V_1$, deciding if player~$1$ has a winning strategy ensuring that $T$ is visited whatever the strategy of player~$2$ is $\PTIME$-hard. We reduce this question to a threshold probability problem for a direct fixed window parity objective as follows. From $\mathcal{G}$, we build the MDP $\mathcal{M} = (S, A, \delta)$ such that $S = V_1$, $A = V_2$ and $\delta$ is constructed in the following manner:
\begin{itemize}
\item for all $v_1\in V_1 \setminus T$, $v'_1 \in V_1$, $v_2 \in V_2$, $(v_1, v_2, v'_1) \in \delta$ iff $(v_1, v_2) \in E$ and $(v_2, v'_1) \in E$;
\item probabilities are taken uniform, i.e., $\delta(v_1, v_2, v'_1) = \left( \dfrac{1}{\vert\ensuremath{{\sf Supp}} (\delta(v_1, v_2))\vert}\right) $;
\item states in $T$ are made absorbing, i.e., they only allow an action $a$ such that $\delta(v, a, v) = 1$ for any $v \in T$.
\end{itemize}
We add a priority function $p\colon S \rightarrow \{0, 1\}$ that assigns $1$ to all states in $S$ except states that correspond to states in $T \subseteq V_1$: those states get priority $0$. Let us fix objective $\mathsf{DFW}_\mathsf{par}(\lambda = \vert V_1 \vert)$. We claim that player~$1$ has a winning strategy from $v_{\text{init}}$ in the reachability game $\mathcal{G}$ if and only if the controller has a strategy almost-surely satisfying objective $\mathsf{DFW}_\mathsf{par}(\lambda = \vert V_1 \vert)$ from $v_{\text{init}}$ in the MDP $\mathcal{M}$. Observe that this reduction is in $\LOGSPACE$: it remains to check its correctness.
Consider what happens in $\mathcal{M}$. The only way to close the window that will open in $v_{\text{init}}$ is to reach $T$, and we ought to close it to obtain a satisfying run as we consider the \textit{direct} objective. Furthermore, once $T$ is reached, the run is necessarily winning as we stay in $T$ forever and always see priority $0$. We also know that if $T$ can be reached, $\lambda$ steps suffice to do so, as memoryless strategies suffice in the game $\mathcal{G}$ (note that we do not count actions here). Lifting a winning strategy from $\mathcal{G}$ to $\mathcal{M}$ is thus trivial: we mimic a memoryless one w.l.o.g.\ and reach $T$ \textit{surely} in $\mathcal{M}$ within $\lambda$ steps, ensuring the objective.
Hence, the other direction remains: given a strategy $\sigma$ such that $\almostStrat{\mathcal{M}, v_{\text{init}}}{\sigma}{\mathsf{DFW}_\mathsf{par}(\lambda)}$, we need to construct a winning strategy in $\mathcal{G}$. This may seem more difficult as we need to go from an almost-surely winning strategy to a surely winning one: something which is not possible in general. Yet, we show that $\sigma$ is actually surely winning for $\mathsf{DFW}_\mathsf{par}(\lambda)$. By contradiction, assume it is not the case, i.e., that there exists a consistent run $\rho$ such that $\rho \not\in \mathsf{DFW}_\mathsf{par}(\lambda)$: then, a finite prefix $\rho[0, n]$ can be extracted, such that a window remains open for $\lambda$ steps along it. Now, since we consider a direct objective, the cylinder spanned by this prefix only contains losing runs, and since $\rho[0, n]$ is finite, it has a strictly positive probability. Hence $\sigma$ is not almost-surely winning and we have our contradiction. This proves that $\sigma$ is actually surely-winning, and it is then trivial to mimic it in $\mathcal{G}$ to obtain a winning strategy for player~$1$. This shows that the reduction from reachability games to the threshold probability problem for direct fixed window parity objectives holds, thus that the latter is $\PTIME$-hard.
Regarding memory, the proof for direct fixed window parity games in~\cite{DBLP:journals/corr/BruyereHR16} carries over easily to our setting by replacing the states of the opponent by stochastic actions, in the natural way. Hence the lower bound is trivial to establish. Yet, we illustrate the need for memory in Ex.~\ref{ex:directmem} to help the reader understand the phenomenon.
Item~\ref{item:directHardness2}. Consider the $\mathsf{PSPACE}$-hardness of the mean-payoff variant. We proceed via a reduction from the threshold probability problem for shortest path objectives~\cite{DBLP:conf/icalp/HaaseK15,DBLP:journals/fmsd/RandourRS17}. This problem is as follows. Let $\mathcal{M} = (S, A, \delta)$ be an MDP with weight function $w\colon A \rightarrow \mathbb{N}_0$ (we use strictly positive weights w.l.o.g.). We fix a target set $T \subseteq S$ and define the \textit{truncated sum up to} $T$ as the function $\mathsf{TS}^T\colon \Runs{\mathcal{M}} \rightarrow \mathbb{N} \cup \{\infty\}$ given by
\begin{equation*}
\mathsf{TS}^T(\rho) = \begin{cases}
\sum_{i = 0}^{n-1} w(a_i) &\text{if } \rho[n] \in T \,\wedge\, \forall\, 0 \leq j < n,\, \rho[j] \not\in T,\\
\infty &\text{if } \forall\, j \geq 0,\, \rho[j] \not\in T.\end{cases}
\end{equation*}
Given an upper bound $\ell \in \mathbb{N}$, the shortest path objective is \[\mathsf{ShortestPath}(\ell) = \{\rho \in \Runs{\mathcal{M}} \mid \mathsf{TS}^T(\rho) \leq \ell\}.\] Deciding if there exists a strategy $\sigma$ such that $\mathbb{P}_{\mathcal{M},s}^\sigma[\mathsf{ShortestPath}(\ell)] \geq \alpha$, given $s \in S$ and $\alpha \in [0, 1] \cap \mathbb{Q}$, is known to be $\mathsf{PSPACE}$-hard, even for \textit{acyclic} MDPs~\cite{DBLP:conf/icalp/HaaseK15}. The target set $T$ is assumed to be made of absorbing states (i.e., with self-loops): the acyclicity is to be interpreted over the rest of the underlying graph. We establish a reduction from this problem, in the acyclic case, to a threshold probability problem for a direct fixed window mean-payoff objective, maintaining the acyclicity of the underlying graph (except in target states, again).
Given the original MDP $\mathcal{M}$, we only modify the weight function to obtain MDP $\mathcal{M}'$. We define $w'$ from $w$, the target $T$ and the bound $\ell$ as follows:
\begin{itemize}
\item for all $(s, a, s') \in \delta$, $s' \not\in T$, $w'(a) = -w(a)$;
\item for all $(s, a, t) \in \delta$, $s \not\in T$, $t \in T$, $w'(a) = -w(a) + \ell$;
\item for all $(t, a, t) \in \delta$, $t \in T$, $w'(a) = 0$.
\end{itemize}
Intuitively, we take the opposite of all weights; add the bound when entering the target; and make the target cost-free. We then define the objective $\mathsf{DFW}_\mathsf{mp}(\lambda = \vert \ensuremath{S} \vert)$ and claim that there exists a strategy $\sigma$ in $\mathcal{M}$ to ensure $\mathbb{P}_{\mathcal{M},s}^\sigma[\mathsf{ShortestPath}(\ell)] \geq \alpha$ if and only if there exists a strategy $\sigma'$ in $\mathcal{M}'$ to ensure $\mathbb{P}_{\mathcal{M}',s}^{\sigma'}[\mathsf{DFW}_\mathsf{mp}(\lambda)] \geq \alpha$.
Proving it is fairly easy. Observe that, by construction, the sum of weights over a prefix in $\mathcal{M}'$ that is not yet in $T$ is strictly negative, and the opposite of the sum over the same prefix in the original MDP $\mathcal{M}$. Due to the addition of $\ell$ on entering $T$, we have that any run $\rho' \in \Runs{\mathcal{M}'}$ sees all its windows closed if and only if the very same run $\rho \in \Runs{\mathcal{M}}$ is such that $\mathsf{TS}^T(\rho) \leq \ell$ in $\mathcal{M}$. Now, using the acyclicity of the underlying graph, we know that if a run reaches $T$, it does so in at most $\lambda$ steps. We thus conclude that $\rho' \in \mathsf{DFW}_\mathsf{mp}(\lambda)$ in $\mathcal{M}'$ if and only if $\rho \in \mathsf{ShortestPath}(\ell)$ in $\mathcal{M}$. It is then trivial to derive the desired result and establish the correctness of the reduction: this concludes our proof of $\mathsf{PSPACE}$-hardness for the threshold probability problem for direct fixed window mean-payoff objectives.
Finally, the need for pseudo-polynomial memory is also obtained through this reduction. Indeed, there is a chain of reductions from \textit{subset-sum games}~\cite{DBLP:journals/tcs/Travers06,DBLP:journals/iandc/FearnleyJ15} to our setting, via the shortest path problem presented above~\cite{DBLP:conf/icalp/HaaseK15}. More precisely, subset-sum games are known to require pseudo-polynomial-memory strategies as optimal strategies need to track the current sum of weights (see, e.g.,~\cite{DBLP:journals/fmsd/RandourRS17}). These games can be (polynomially) reduced to the shortest path problem, as in~\cite{DBLP:conf/icalp/HaaseK15}, which in turn we can reduce (polynomially) to our problem, as just established. Hence the need for pseudo-polynomial-memory strategies carries over to our setting.
\end{proof}
\begin{rem}
Throughout this paper, we assume the window size $\lambda$ to be given in unary, or equivalently, to be polynomial in the description of the MDP (as for practical purposes, having exponential window sizes would somewhat defeat the purpose of time bounds in specifications). It is thus interesting to note that the hardness results we established in Thm.~\ref{thm:directHardness} do hold under this assumption: the complexity essentially comes from the weight structure, as in other counting-like problems in MDPs~\cite{DBLP:conf/icalp/HaaseK15,DBLP:journals/fmsd/RandourRS17,DBLP:journals/iandc/BruyereFRR17}.
\end{rem}
\begin{rem}%
\label{rmk:DFWMP_AS_P}
As noted in the proof of Thm.~\ref{thm:directHardness}, almost-surely winning coincides with surely winning for the \textit{direct fixed} window objectives. Therefore, the threshold probability problem for $\mathsf{DFW}_\mathsf{mp}(\lambda)$ collapses to $\mathsf{P}$ if the threshold is $\alpha = 1$~\cite{DBLP:journals/iandc/Chatterjee0RR15}.
\end{rem}
\begin{figure}[tbh]
\begin{center}
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node
distance=2.5cm,bend angle=45, scale=0.55, font=\normalsize]
\tikzstyle{p1}=[draw,circle,text centered,minimum size=7mm,text width=5mm]
\tikzstyle{p2}=[draw,rectangle,text centered,minimum size=7mm,text width=4mm]
\tikzstyle{act}=[fill,circle,inner sep=1pt,minimum size=1.5pt, node distance=1cm] \tikzstyle{empty}=[text centered, text width=15mm]
\node[p1] (1) at (0,0) {$s_{1}$};
\node[p1] (2) at (3,2.5) {$s_{2}$};
\node[act] (2a) at (4.5,2.5) {};
\node[p1] (2bis) at (6,2.5) {$s_{5}$};
\node[act] (2bisa) at (7.5,2.5) {};
\node[p1] (2tris) at (9,2.5) {$s_{7}$};
\node[act] (2trisa) at (10.5,2.5) {};
\node[p1] (3) at (3,0) {$s_{3}$};
\node[act] (3a) at (4.5,0) {};
\node[p1] (3bis) at (6,0) {$s_{6}$};
\node[act] (3bisa) at (7.5,0) {};
\node[p1] (4) at (3,-2.5) {$s_{4}$};
\node[act] (4a) at (4.5,-2.5) {};
\node[p1] (8) at (12,0) {$s_{8}$};
\node[act] (8a) at (13.5,1.25) {};
\node[act] (8b) at (13.5,0) {};
\node[act] (8c) at (13.5,-1.25) {};
\node[p1] (9) at (15,2.5) {$s_{9}$};
\node[act] (9a) at (16.5,2.5) {};
\node[empty] at ($(9)+(0,1.2)$) {\small 4};
\node[p1] (10) at (15,0) {$s_{10}$};
\node[act] (10a) at (16.5,0) {};
\node[p1] (11) at (15,-2.5) {$s_{11}$};
\node[act] (11a) at (16.5,-2.5) {};
\node[p1] (10bis) at (18,0) {$s_{12}$};
\node[act] (10bisa) at (19.5,0) {};
\node[empty] at ($(10bis)+(0,1.2)$) {\small 2};
\node[p1] (11bis) at (18,-2.5) {$s_{13}$};
\node[act] (11bisa) at (19.5,-2.5) {};
\node[p1] (11tris) at (21,-2.5) {$s_{14}$};
\node[act] (11trisa) at (22.5,-2.5) {};
\node[empty] at ($(11tris)+(0,1.2)$) {\small 0};
\node[empty] (end) at (24,0) {back to $s_1$};
\node[empty] at ($(2)+(0,1.2)$) {\small 5};
\node[empty] at ($(3)+(0,1.2)$) {\small 3};
\node[empty] at ($(4)+(0,1.2)$) {\small 1};
\node[act] (1a) at (1.5,0) {};
\node[empty] at ($(1a)+(-0.1,0.4)$) {\scriptsize $a$};
\node[empty] at ($(8a)+(-0,0.4)$) {\scriptsize $b$};
\node[empty] at ($(8b)+(-0,0.4)$) {\scriptsize $c$};
\node[empty] at ($(8c)+(-0,0.4)$) {\scriptsize $d$};
\coordinate[shift={(-5mm,0mm)}] (init) at (1.west);
\path[-latex']
(init) edge (1)
(1) edge (1a)
(2) edge (2a)
(2a) edge (2bis)
(3) edge (3a)
(3a) edge (3bis)
(4) edge (4a)
(4a) edge (8)
(8) edge (8a)
(8) edge (8b)
(8) edge (8c)
(9) edge (9a)
(9a) edge (end)
(10) edge (10a)
(10a) edge (10bis)
(11) edge (11a)
(11a) edge (11bis)
(2bis) edge (2bisa)
(2bisa) edge (2tris)
(2tris) edge (2trisa)
(2trisa) edge (8)
(3bis) edge (3bisa)
(3bisa) edge (8)
(10bis) edge (10bisa)
(10bisa) edge (end)
(11bis) edge (11bisa)
(11bisa) edge (11tris)
(11tris) edge (11trisa)
(11trisa) edge (end)
(1a) edge (2)
(1a) edge (3)
(1a) edge (4)
(8a) edge (9)
(8b) edge (10)
(8c) edge (11)
;
\end{tikzpicture}
\caption{This MDP with $d = 6$ priorities admits an almost-surely (even surely) winning strategy for $\mathsf{DFW}_\mathsf{par}(\lambda = \frac{d}{2} + 2)$: the controller must answer to the path with priority $5$ (resp.~$3$, $1$) by choosing $b$ (resp.~$c$, $d$). This requires $\mathcal{O}(\frac{d}{2})$ memory states.}%
\label{fig:memory}
\end{center}
\end{figure}
\begin{exa}%
\label{ex:directmem}
Consider the direct fixed window parity objective in the MDP depicted in Fig.~\ref{fig:memory}, inspired by~\cite{DBLP:journals/corr/BruyereHR16}. For the sake of readability, we did not write all details in the figure: all actions have uniform probability distributions over their successors, and all unlabeled states have priority $d = 6$. This example can easily be generalized to any even $d \geq 0$. Observe that the MDP has size $\vert S\vert = 2 + \frac{d}{2} \cdot (\frac{d}{2} + 1)$, hence polynomial in $d$.
Fix the objective $\mathsf{DFW}_\mathsf{par}(\lambda = \frac{d}{2} + 2)$. We claim that the controller may achieve it almost-surely (even surely) with a strategy using memory of size $\frac{d}{2}$. Indeed, each time action $a$ results in taking the path of priority $(d-1)$ (resp.~$(d-3), \ldots{}, 1$), the only possibility for the controller is to choose the path with priority $(d-2)$ (resp.~$(d-4), \ldots{}, 0$), otherwise a window stays open for $\lambda$ steps. Doing this ensures that the objective is satisfied surely.
Now, if the controller uses less than $\frac{d}{2}$ memory, he has to answer to two different odd priorities with the same choice of action in $s_8$, which results in a window staying open for $\lambda$ steps with strictly positive probability. Hence, there is no almost-sure winning strategy with such limited memory: polynomial-memory strategies are needed in this example.\hfill$\triangleleft$
\end{exa}
\section{The case of end-components}%
\label{sec:ec}
We have already solved the case of direct fixed window objectives: it remains to consider prefix-independent fixed and bounded variants. As seen in Sect.~\ref{sec:prelim}, the analysis of MDPs with prefix-independent objectives crucially relies on \textit{end-components} (ECs). Indeed, they are almost-surely reached in the long run.
In this section, we study what happens in ECs: how to play optimally and what can be achieved. In Sect.~\ref{sec:general}, we will use this knowledge as the cornerstone of our algorithm for general MDPs. The main result here is a \textit{strong link between ECs and two-player games}: intuitively, either the probability to win a window objective in an EC is zero, or it is one and there exists a sub-EC where the controller can actually win surely, i.e., as in a two-player game played on this sub-EC\@.
\paragraph{Safe ECs} We start by defining the notion of $\lambda$-safety, that will characterize such sub-ECs.
\begin{defi}[$\lambda$-safety]
Let $\mathcal{M}$ be an MDP, $\Omega \in \{\mathsf{mp}, \mathsf{par}\}$,
$\lambda > 0$, and
$\mathcal{C} = (S_\mathcal{C},A_\mathcal{C},\delta_\mathcal{C}) \in \ecs(\mathcal{M})$, we say that $\mathcal{C}$
is $\lambda$-safe$_\Omega$ if there exists a strategy
$\sigma \in \Sigma$ in $\mathcal{C}$ such that, from all $s \in S_\mathcal{C}$, $\sureStrat{\mathcal{C}, s}{\sigma}{\mathsf{DFW}_\Omega(\lambda)}$.
\end{defi}
Classifying an EC as $\lambda$-safe$_{\Omega}$ or not boils down to
interpreting it as a \textit{two-player game} (the duality between MDPs and games is further explored in~\cite{DBLP:journals/iandc/BruyereFRR17,DBLP:conf/icalp/BerthonRR17}). In this setting, the
uncertainty becomes adversarial: when there is some uncertainty about
the outcome of an action, we do not consider probabilities but we let
the opponent decide the outcome of the action. On entering a state
$s$ of the MDP after some history, the controller chooses an action
$a$ following its strategy and the
opponent then chooses a successor state $s'$ such that
$s' \in \ensuremath{{\sf Supp}} (\delta(s, a))$ without taking into account the exact
values of probabilities. In such a view, the opponent tries to
prevent the controller from achieving its objective. A
\textit{winning strategy} for the controller in the game interpretation is a strategy that
ensures the objective regardless of its opponent's strategy. An EC is thus said to be $\lambda$-safe$_{\Omega}$ if and only if its two-player interpretation admits a winning strategy for $\mathsf{DFW}_\Omega(\lambda)$.
\begin{rem}
Throughout this paper, all the strategies we consider are uniform in the game-theoretic sense. That is, if an objective is achievable from a set of states, we do not need to have a different strategy for each starting state, and we may instead use the very same strategy from all starting states. This uniformity is not needed in our approach but we have it for free for both the classical MDP strategies (reachability, B\"uchi, etc)~\cite{baier2008principles} and the two-player window games~\cite{DBLP:journals/iandc/Chatterjee0RR15,DBLP:journals/corr/BruyereHR16}. We use it for the sake of readability, as it permits to have one strategy per EC instead of one per state of the EC for example. Hence all our statements are written with that in mind.
\end{rem}
\begin{prop}%
\label{prop:stratSafe}
Let $\mathcal{M}$ be an MDP, $\Omega \in \{\mathsf{mp}, \mathsf{par}\}$, $\lambda > 0$, and $\mathcal{C} = (S_\mathcal{C},A_\mathcal{C},\delta_\mathcal{C}) \in \ecs(\mathcal{M})$ be $\lambda$-safe$_{\Omega}$. Then, there exists a pure polynomial-memory strategy $\sigma^{\Omega, \lambda, \mathcal{C}}_{\text{safe}}$ in $\mathcal{C}$ such that $\sureStrat{\mathcal{C}, s}{\sigma^{\Omega, \lambda, \mathcal{C}}_{\text{safe}}}{\mathsf{DFW}_\Omega(\lambda)}$ for all $s \in S_\mathcal{C}$.
\end{prop}
\begin{proof}
Straightforward by definition of $\lambda$-safety and pure polynomial-memory strategies being sufficient in two-player zero-sum direct fixed window games, both for mean-payoff~\cite{DBLP:journals/iandc/Chatterjee0RR15} and parity~\cite{DBLP:journals/corr/BruyereHR16} variants.
\end{proof}
\paragraph{Good ECs} As sketched above, the existence of sub-ECs that are $\lambda$-safe is crucial in order to satisfy any window objective in an EC\@. We thus introduce the notion of \textit{good} ECs.
\begin{defi}%
\label{def:good}
Let $\mathcal{M}$ be an MDP, $\Omega \in \{\mathsf{mp}, \mathsf{par}\}$, and
$\mathcal{C} \in \ecs(\mathcal{M})$, we say that
\begin{itemize}
\item $\mathcal{C}$ is $\lambda$-good$_\Omega$, for $\lambda > 0$, if it contains a sub-EC $\mathcal{C}'$ which is $\lambda$-safe$_\Omega$.
\item $\mathcal{C}$ is $\mathsf{BW}$-good$_\Omega$ if it contains a sub-EC $\mathcal{C}'$ which is $\lambda$-safe$_\Omega$ for some $\lambda > 0$.
\end{itemize}
\end{defi}
\noindent
By definition, any $\mathsf{BW}$-good$_\Omega$ EC is also $\lambda$-good$_\Omega$ for an appropriate $\lambda > 0$. Yet, we use a different terminology as in the $\mathsf{BW}$ case, we do not fix $\lambda$ a priori: this will be important complexity-wise.
We now establish that good$_\Omega$ ECs are exactly the ones where window objectives can be satisfied with non-zero probability, and actually, with probability one.
\begin{lem}[Zero-one law]\label{grolem} Let $\mathcal{M}$ be an MDP\@,
$\Omega \in \{\mathsf{mp}, \mathsf{par}\}$ and
$\mathcal{C} = (S_\mathcal{C}, A_\mathcal{C}, \delta_\mathcal{C}) \in \ecs(\mathcal{M})$. The
following assertions hold.
\begin{enumerate}[label={(\alph*)}]
\item For all $\lambda > 0$, either\label{fixed-case-grolem}
\begin{enumerate}[label={(\roman*)},left=-7mm]
\item $\mathcal{C}$ is $\lambda$-good$_\Omega$ and
there exists a strategy $\sigma$ in $\mathcal{C}$ such that
$\almostStrat{\mathcal{C}, s}{\sigma}{\mathsf{FW}_\Omega(\lambda)}$ for all $s \in S_\mathcal{C}$,\label{grolem1}
\item or for all $s \in S_\mathcal{C}$, for all strategy $\sigma$ in $\mathcal{C}$,
$\mathbb{P}_{\mathcal{C}, s}^\sigma[\mathsf{FW}_\Omega(\lambda)] =
0$.\label{grolem2}
\end{enumerate}
\item Either\label{bounded-case-grolem}
\begin{enumerate}[label={(\roman*)},left=-7mm]
\item $\mathcal{C}$ is
$\mathsf{BW}$-good$_\Omega$ and
there exists a strategy $\sigma$ in $\mathcal{C}$ such that
$\almostStrat{\mathcal{C}, s}{\sigma}{\mathsf{BW}_\Omega}$ for all $s \in S_\mathcal{C}$,\label{grolem3}
\item or for all $s \in S_\mathcal{C}$, for all strategy
$\sigma$ in $\mathcal{C}$, $\mathbb{P}_{\mathcal{C}, s}^\sigma[\mathsf{BW}_\Omega] =
0$.\label{grolem4}
\end{enumerate}
\end{enumerate}
\end{lem}
\begin{proof}
We begin with the fixed variant~\ref{fixed-case-grolem}. Case~\ref{grolem1}. Fix
$\lambda > 0$ and assume there exists a sub-EC $\mathcal{C}'$ with state
space $S_{\mathcal{C}'}$ that is $\lambda$-safe$_\Omega$. By Prop.~\ref{prop:stratSafe}, there
exists a strategy $\sigma^{\Omega, \lambda, \mathcal{C}'}_{\text{safe}}$ in $\mathcal{C}'$ such that
$\sureStrat{\mathcal{C}', s}{\sigma^{\Omega, \lambda, \mathcal{C}'}_{\text{safe}}}{\mathsf{DFW}_\Omega(\lambda)}$ for all $s \in S_{\mathcal{C}'}$. Now, since $\mathcal{C}$ is an EC, there exists a (pure memoryless) strategy $\sigma_{\text{reach}}$ in $\mathcal{C}$ that ensures eventually reaching $\mathcal{C}'$ almost-surely from any state $s \in S_\mathcal{C}$~\cite{baier2008principles}. Hence, the desired strategy $\sigma$ can be defined as follows: play according to $\sigma_{\text{reach}}$ until $\mathcal{C}'$ is reached, then switch to $\sigma^{\Omega, \lambda, \mathcal{C}'}_{\text{safe}}$ forever. It is straightforward to check that $\sigma$ almost-surely satisfies $\mathsf{FW}_\Omega(\lambda)$ from anywhere in $\mathcal{C}$, thanks to prefix-independence. Note that it does not ensure it surely in general, as $\sigma_{\text{reach}}$ does not guarantee to reach $\mathcal{C}'$ surely either.
Case~\ref{grolem2}. Now assume that such a $\lambda$-safe$_{\Omega}$ sub-EC does not exist. Recall
that finite-memory strategies suffice for
$\mathsf{FW}_\Omega(\lambda)$ objectives by Thm.~\ref{finite-memory-cor}, hence we can restrict our study to such strategies without loss of generality. Fix any finite-memory strategy
$\sigma$ in $\mathcal{C}$ and state $s \in S_\mathcal{C}$. The induced MC $\mathcal{M}^\sigma_s$ is finite, hence runs almost-surely end up in a BSCC~\cite{baier2008principles}. Let $\mathcal{B}$ be any BSCC of $\mathcal{M}^\sigma_s$ reached with positive probability. Since there exists no $\lambda$-safe$_{\Omega}$ sub-EC in $\mathcal{C}$, there must exist a run $\widehat{\rho}$ in $\mathcal{B}$ such that $\widehat{\rho} \not\in \mathsf{DFW}_\Omega(\lambda)$; otherwise, $\sigma$ would be witness that the EC obtained by projecting $\mathcal{B}$ over $S_\mathcal{C}$ is $\lambda$-safe$_{\Omega}$. From $\widehat{\rho}$, we extract a history $\widehat{h}$ ending with a window open for $\lambda$ steps (it exists otherwise $\widehat{\rho}$ would be in $\mathsf{DFW}_\Omega(\lambda)$). This history is finite: it has a probability lower-bounded by some $\varepsilon > 0$ to happen whenever its starting state is visited. Now, since all states in $\mathcal{B}$ are almost-surely visited infinitely often, we conclude that this history also happens infinitely often with probability one. Therefore, the probability to win the prefix-independent objective $\mathsf{FW}_\Omega(\lambda)$ when reaching $\mathcal{B}$ is zero. Since this holds for any BSCC induced by $\sigma$, we obtain the claim.
Let us continue with the bounded case~\ref{bounded-case-grolem}. Case~\ref{grolem3} is trivial thanks to~\ref{fixed-case-grolem}\ref{grolem1} and $\mathsf{FW}_\Omega(\lambda) \subseteq \mathsf{BW}_{\Omega}$. Now consider case~\ref{grolem4}. By~\ref{fixed-case-grolem}\ref{grolem2}, we have that $\mathbb{P}_{\mathcal{C}, s}^\sigma[\mathsf{FW}_\Omega(\lambda)] = 0$ for all $s \in S_\mathcal{C}$, $\lambda > 0$ and $\sigma$ in $\mathcal{C}$. Observe that by definition, we have
\begin{equation*}
\mathsf{BW}_{\Omega} = \bigcup_{\lambda > 0} \mathsf{FW}_{\Omega}(\lambda).
\end{equation*}
Fix any strategy $\sigma$ in $\mathcal{C}$ and $s \in S_\mathcal{C}$. By countable additivity of probability measures, we have that
\begin{equation*}
\mathbb{P}_{\mathcal{C}, s}^\sigma[\mathsf{BW}_\Omega] \; \leq \; \sum_{\lambda > 0}
\mathbb{P}^\sigma_{\mathcal{C}, s} [\mathsf{FW}_\Omega(\lambda)].
\end{equation*}
Since the right term is equal to zero, we obtain the claim.
\end{proof}
\begin{rem}%
\label{rmk:uniformECs}
An interesting consequence of Lem.~\ref{grolem} is the existence of uniform bounds on $\lambda$ in ECs, in contrast to the general MDP case, as seen in Sect.~\ref{subsec:illustration}. This is indeed natural, as we established that winning with positive probability within an EC coincides with winning surely in a sub-EC;\@ sub-EC that can be seen as a two-player zero-sum game where uniform bounds are granted by~\cite{DBLP:journals/iandc/Chatterjee0RR15,DBLP:journals/corr/BruyereHR16}.
\end{rem}
By Lem.~\ref{grolem}, we know that interesting strategies exist in good$_ \Omega$ ECs. Let us describe them.
\begin{prop}%
\label{prop:stratGood}
Let $\mathcal{M}$ be an MDP, $\Omega \in \{\mathsf{mp}, \mathsf{par}\}$, and $\mathcal{C} = (S_\mathcal{C},A_\mathcal{C},\delta_\mathcal{C}) \in \ecs(\mathcal{M})$.
\begin{itemize}
\item If $\mathcal{C}$ is $\lambda$-good$_\Omega$, for some $\lambda > 0$, there exists a pure polynomial-memory strategy $\sigma^{\Omega, \lambda, \mathcal{C}}_{\text{good}}$ such that $\almostStrat{\mathcal{C}, s}{\sigma^{\Omega, \lambda, \mathcal{C}}_{\text{good}}}{\mathsf{FW}_\Omega(\lambda)}$ for all $s \in S_\mathcal{C}$.
\item If $\mathcal{C}$ is $\mathsf{BW}$-good$_\Omega$, there exists a pure memoryless strategy $\sigma^{\Omega, \mathsf{BW}, \mathcal{C}}_{\text{good}}$ such that $\almostStrat{\mathcal{C}, s}{\sigma^{\Omega, \mathsf{BW}, \mathcal{C}}_{\text{good}}}{\mathsf{BW}_\Omega}$ for all $s \in S_\mathcal{C}$.
\end{itemize}
\end{prop}
\noindent
Intuitively, such strategies first mimic a pure memoryless strategy reaching a safe$_{\Omega}$ sub-EC almost-surely, then switch to a strategy surely winning in this sub-EC, which is lifted from the game interpretation.
\begin{proof}
Consider the $\lambda$-good$_\Omega$ case. Strategy $\sigma^{\Omega, \lambda, \mathcal{C}}_{\text{good}}$ is the one described in the proof of Lem.~\ref{grolem}\ref{fixed-case-grolem}\ref{grolem1}: it first plays as the pure memoryless strategy $\sigma_\text{reach}$ then switches to strategy $\sigma^{\Omega, \lambda, \mathcal{C}'}_{\text{safe}}$ from Prop.~\ref{prop:stratSafe} when the $\lambda$-safe$_\Omega$ sub-EC $\mathcal{C}'$ is reached. Hence it is pure and polynomial memory still suffices. The almost-sure satisfaction of the objective was proved in Lem.~\ref{grolem}.
Now, consider the $\mathsf{BW}$-good$_\Omega$ case. Note that using our current knowledge, it is easy to build a pure polynomial-memory strategy, but we want more: a pure \textit{memoryless} one. For that, we use the following reasoning. Strategy $\sigma^{\Omega, \mathsf{BW}, \mathcal{C}}_{\text{good}}$ will again first play as a pure memoryless strategy trying to reach a $\lambda$-safe$_\Omega$ sub-EC for some $\lambda > 0$ (we know one exists), then switch to a surely winning strategy inside this sub-EC\@. Still, we do not really need to win for $\mathsf{DFW}_{\Omega}(\lambda)$, we only need to win for the bounded variant $\mathsf{DBW}_{\Omega} = \bigcup_{\lambda > 0} \mathsf{DFW}_{\Omega}(\lambda)$. Results in two-player zero-sum games (which we are actually solving here when considering surely winning strategies) guarantee that in this case, pure memoryless strategies suffice for the controller, both for mean-payoff~\cite{DBLP:journals/iandc/Chatterjee0RR15} and parity variants~\cite{DBLP:journals/corr/BruyereHR16}. Since the switch is state-based (depending on whether we are in the sub-EC or not), we can wrap both strategies in $\sigma^{\Omega, \mathsf{BW}, \mathcal{C}}_{\text{good}}$ and retain a pure memoryless strategy. Again, the almost-sure satisfaction of the objective follows from Lem.~\ref{grolem}.
\end{proof}
\paragraph{Classification} We may already sketch a general solution to the threshold probability problem based on Lem.~\ref{grolem} and the well-known fact that ECs are almost-surely reached under any strategy: an optimal strategy must maximize the probability to reach good$_\Omega$ ECs. It is therefore crucial to be able to identify such ECs efficiently. However, an MDP may in general contain an exponential number of ECs. Fortunately, the next lemma establishes that we do not have to test them all.
\begin{lem}
Let $\mathcal{M}$ be an MDP and $\mathcal{C} \in \ecs(\mathcal{M})$. If $\mathcal{C}$ is $\lambda$-good$_\Omega$ (resp.~$\mathsf{BW}$-good$_\Omega$), then it is also the case of any super-EC $\mathcal{C}' \in \ecs(\mathcal{M})$ containing $\mathcal{C}$.
\end{lem}
\begin{proof}
Trivial by Def.~\ref{def:good}.
\end{proof}
\begin{cor}%
\label{cor:goodMECs}
Let $\mathcal{M}$ be an MDP and $\mathcal{C} \in \mecs(\mathcal{M})$ be a maximal EC\@. If $\mathcal{C}$ is not $\lambda$-good$_\Omega$ (resp.~$\mathsf{BW}$-good$_\Omega$), then neither is any of its sub-EC $\mathcal{C}' \in \ecs(\mathcal{M})$.
\end{cor}
The interest of Cor.~\ref{cor:goodMECs} is that the number of MECs is bounded by $\vert S\vert$ for any MDP $\mathcal{M} = (S,A,\delta)$ because they are all disjoints. Furthermore, the MEC decomposition can be done efficiently (e.g., quadratic time~\cite{DBLP:journals/jacm/ChatterjeeH14}). So, we know classifying MECs is sufficient and MECs can easily be identified in an MDP:\@ it remains to discuss how to classify a MEC as good$_\Omega$ or not.
Let $\mathcal{M} = (S,A,\delta)$. Recall that a MEC $\mathcal{C} = (S_\mathcal{C},A_\mathcal{C},\delta_\mathcal{C}) \in \mecs(\mathcal{M})$ is $\lambda$-good$_\Omega$ (resp.~$\mathsf{BW}$-good$_\Omega$) if and only if it contains a $\lambda$-safe$_\Omega$ sub-EC\@. By definition of $\lambda$-safety, this is equivalent to having a non-empty \textit{winning set} for the controller in the two-player zero-sum game over $\mathcal{C}$ --- naturally defined as explained above. This winning set contains all states in $S_\mathcal{C}$ from which the controller has a \textit{surely winning} strategy. This winning set, if non-empty, necessarily contains at least one sub-EC of $\mathcal{C}$, as otherwise the opponent could force the controller to leave it and win the game (by prefix-independence). Thus, testing if a MEC is good$_\Omega$ boils down to solving its two-player game interpretation.
\begin{thm}[MEC classification]%
\label{thm:classification}
Let $\mathcal{M}$ be an MDP and $\mathcal{C} \in \mecs(\mathcal{M})$. The following assertions hold.
\begin{enumerate}[label={(\alph*)}]
\item Deciding if $\mathcal{C}$ is $\lambda$-good$_\Omega$, for $\lambda > 0$, is in $\mathsf{P}$ for $\Omega \in \{\mathsf{mp}, \mathsf{par}\}$. Furthermore, a corresponding pure polynomial-memory strategy $\sigma^{\Omega, \lambda, \mathcal{C}}_{\text{good}}$ can be constructed in polynomial time.
\item Deciding if $\mathcal{C}$ is $\mathsf{BW}$-good$_\mathsf{mp}$ is in $\NPTIME \cap \mathsf{coNP}$ and a corresponding pure memoryless strategy $\sigma^{\mathsf{mp}, \mathsf{BW}, \mathcal{C}}_{\text{good}}$ can be constructed in pseudo-polynomial time.
\item Deciding if $\mathcal{C}$ is $\mathsf{BW}$-good$_\mathsf{par}$ is in $\PTIME$ and a corresponding pure memoryless strategy $\sigma^{\mathsf{par}, \mathsf{BW}, \mathcal{C}}_{\text{good}}$ can be constructed in polynomial time.
\end{enumerate}
\end{thm}
\begin{proof}
All complexities are expressed w.r.t.\ the representation of $\mathcal{C}$, as the larger MDP $\mathcal{M}$ is never used in the process. Complexity results follow from game solving algorithms presented in~\cite{DBLP:journals/iandc/Chatterjee0RR15} for mean-payoff\footnote{The published version of~\cite{DBLP:journals/iandc/Chatterjee0RR15} contains a slight bug in sub-procedure $\mathsf{GoodWin}$ that was corrected in subsequent articles~\cite{DBLP:conf/concur/BruyereHR16,DBLP:journals/corr/BruyereHR16}. All results of~\cite{DBLP:journals/iandc/Chatterjee0RR15} still hold modulo this correction.} and~\cite{DBLP:journals/corr/BruyereHR16} for parity. Note that for mean-payoff, the bound on $\lambda$ for which the fixed and bounded variants coincide is pseudo-polynomial, whereas for parity this bound is polynomial, hence the different results: the algorithm for bounded window mean-payoff games actually bypasses this bound to obtain $\NPTIME \cap \mathsf{coNP}$ membership instead of simply $\mathsf{EXPTIME}$.
For constructing the strategy, we only need to plug the almost-sure-reachability strategy to the surely-winning one, as presented in Prop.~\ref{prop:stratGood}. Such a reachability strategy can easily be computed in polynomial time~\cite{baier2008principles}, hence the complexity is dominated by the cost of computing the surely-winning one, as presented in~\cite{DBLP:journals/iandc/Chatterjee0RR15,DBLP:journals/corr/BruyereHR16}.
\end{proof}
\section{General MDPs}%
\label{sec:general}
\paragraph{Algorithms} We now have all the ingredients to establish an algorithm for the threshold probability problem in the general case. Intuitively, given an MDP $\mathcal{M}$, an initial state $s$ and a window objective $\mathsf{FW}_{\Omega}(\lambda)$ for $\lambda > 0$ (resp.~$\mathsf{BW}_{\Omega}$), we first compute the MEC decomposition of $\mathcal{M}$, then classify each MEC as $\lambda$-good$_\Omega$ (resp.~$\mathsf{BW}$-good$_\Omega$) or not, and finally compute an optimal strategy from $s$ to reach the union of good$_\Omega$ MECs: the probability of reaching such MECs is then exactly the maximum probability to satisfy the window objective.
The fixed and bounded versions are presented in Fig.~\ref{fig:algo}. Let $\mathcal{M} = (S, A, \delta)$ be the MDP\@. The MEC decomposition (Line~\ref{line:decomp}) takes quadratic time~\cite{DBLP:journals/jacm/ChatterjeeH14} and yields at most $\vert S\vert$ MECs. The classification depends on the variant considered, as established in Thm.~\ref{thm:classification}: it is in $\PTIME$ for fixed variants and bounded window parity, and in $\NPTIME \cap \mathsf{coNP}$ for bounded window mean-payoff (with a pseudo-polynomial-time procedure). Finally, sub-procedure $\mathsf{MaxReachability}(s, T)$ computes the maximum probability to reach the set $T$ from $s$. It is well-known that this can be done in polynomial time and that pure memoryless optimal strategies exist~\cite{baier2008principles}. Therefore the overall complexity of the algorithm is dominated by the classification step.
\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}
\begin{figure}[tbh]
\begin{center}
\begin{minipage}[t]{.48\linewidth}
\begin{algorithm}[H]
\caption{\label{alg:FW}$\mathsf{FixedWindow}(\mathcal{M}, s, \Omega, \lambda)$}
\algsetup{linenodelimiter=}
\begin{algorithmic}[1]
\REQUIRE{MDP $\mathcal{M}$, state $s$, $\Omega
\in \{\mathsf{mp}, \mathsf{par}\}$, $\lambda > 0$}
\ENSURE{Maximum probability of
$\mathsf{FW}_\Omega(\lambda)$ from $s$}
\STATE{$T\gets \emptyset$}
\FORALL{\label{line:decomp} $\mathcal{C} = (S_\mathcal{C}, A_\mathcal{C}, \delta_\mathcal{C}) \in \mecs(\mathcal{M})$}
\IF{\label{line:classify} $\mathcal{C}$ is $\lambda$-good$_{\Omega}$}
\STATE{$T \gets T \uplus S_\mathcal{C}$}
\ENDIF%
\ENDFOR%
\STATE{\label{line:reach} $\nu = \mathsf{MaxReachability}(s, T)$}
\RETURN{$\nu$}
\end{algorithmic}
\end{algorithm}
\end{minipage}
\hfill
\begin{minipage}[t]{.48\linewidth}
\begin{algorithm}[H]
\caption{\label{alg:BW}$\mathsf{BoundedWindow}(\mathcal{M}, s, \Omega)$}
\algsetup{linenodelimiter=}
\begin{algorithmic}[1]
\REQUIRE{MDP $\mathcal{M}$, state $s$, $\Omega
\in \{\mathsf{mp}, \mathsf{par}\}$}
\ENSURE{Maximum probability of
$\mathsf{BW}_\Omega$ from $s$}
\STATE{$T\gets \emptyset$}
\FORALL{$\mathcal{C} = (S_\mathcal{C}, A_\mathcal{C}, \delta_\mathcal{C}) \in \mecs(\mathcal{M})$}
\IF{$\mathcal{C}$ is $\mathsf{BW}$-good$_{\Omega}$}
\STATE{$T \gets T \uplus S_\mathcal{C}$}
\ENDIF%
\ENDFOR%
\STATE{$\nu = \mathsf{MaxReachability}(s, T)$}
\RETURN{$\nu$}
\end{algorithmic}
\end{algorithm}
\end{minipage}
\caption{Algorithms computing the maximum probability of fixed and bounded window objectives in general MDPs.}%
\label{fig:algo}
\end{center}
\end{figure}
\paragraph{Correctness} We first prove that these algorithms are sound and complete.
\begin{lem}\label{lm:correctness}
Alg.~\ref{alg:FW} and Alg.~\ref{alg:BW} are correct: given an MDP $\mathcal{M} = (S, A, \delta)$, an initial state $s \in S$, $\Omega \in \{\mathsf{mp}, \mathsf{par}\}$, $\lambda > 0$, we have that
\begin{align*}
\mathsf{FixedWindow}(\mathcal{M}, s, \Omega, \lambda) &= \max_{\sigma \in \Sigma} \mathbb{P}_{\mathcal{M},s}^\sigma[\mathsf{FW}_{\Omega}(\lambda)],\\
\mathsf{BoundedWindow}(\mathcal{M}, s, \Omega) &= \max_{\sigma \in \Sigma} \mathbb{P}_{\mathcal{M},s}^\sigma[\mathsf{BW}_{\Omega}].
\end{align*}
\end{lem}
\begin{proof}
The proof is straightforward based on our previous results. First, recall that objectives $\mathsf{FW}_{\Omega}(\lambda)$ and $\mathsf{BW}_{\Omega}$ are prefix-independent; that in MDPs, the limit-behavior under any strategy almost-surely coincides with an EC (see Sect.~\ref{sec:prelim}); and that MECs are pair-wise disjoint. We thus have that
\begin{align*}
\sup_{\sigma \in \Sigma} \mathbb{P}_{\mathcal{M},s}^\sigma[\mathsf{FW}_{\Omega}(\lambda)] &= \sup_{\sigma \in \Sigma} \sum_{\mathcal{C} \in \mecs(\mathcal{M})} \mathbb{P}_{\mathcal{M},s}^\sigma[\diamondsuit\square \mathcal{C}] \cdot \mathbb{P}_{\mathcal{C}}^\sigma[\mathsf{FW}_{\Omega}(\lambda)],\\
\sup_{\sigma \in \Sigma} \mathbb{P}_{\mathcal{M},s}^\sigma[\mathsf{BW}_{\Omega}] &= \sup_{\sigma \in \Sigma} \sum_{\mathcal{C} \in \mecs(\mathcal{M})} \mathbb{P}_{\mathcal{M},s}^\sigma[\diamondsuit\square \mathcal{C}] \cdot \mathbb{P}_{\mathcal{C}}^\sigma[\mathsf{BW}_{\Omega}],
\end{align*}
where $\diamondsuit\square \mathcal{C}$ uses the standard LTL notation as a shorthand for \[\{\rho = s_0 a_0 s_1 \ldots \in \Runs{\mathcal{M}} \mid \exists\, i \geq 0,\, \forall\, j > i,\, s_j \in S_\mathcal{C}\}\] with $S_\mathcal{C}$ the set of states of $\mathcal{C}$; and where we write $\mathbb{P}_{\mathcal{C}}$ without distinction on the entry point because the supremum probability to win for a prefix-independent objective is identical in all states of a MEC (as the controller may force reaching any state he wants almost-surely).
By Lem.~\ref{grolem}, we know that \textit{supremum} winning probabilities in ECs are zero-one laws: they are equal to one in good$_\Omega$ ECs and to zero in all other ECs. Furthermore, when almost-sure satisfaction is achievable, the corresponding strategy stays in the EC\@. Let us denote by $\mathsf{LGEC}_\Omega(\mathcal{M}, \lambda)$ and $\mathsf{BWGEC}_\Omega(\mathcal{M})$ the sets of $\lambda$-good$_\Omega$ and $\mathsf{BW}$-good$_\Omega$ MECs of $\mathcal{M}$ respectively, and by $L$ and $B$ the disjoint union of the corresponding state spaces. That is,
\begin{align*}
L = \biguplus_{\mathcal{C} = (S_\mathcal{C}, A_\mathcal{C}, \delta_\mathcal{C}) \in \mathsf{LGEC}_\Omega(\mathcal{M}, \lambda)} S_\mathcal{C}, \qquad \qquad \qquad\qquad
B = \biguplus_{\mathcal{C} = (S_\mathcal{C}, A_\mathcal{C}, \delta_\mathcal{C}) \in \mathsf{BWGEC}_\Omega(\mathcal{M})} S_\mathcal{C}.
\end{align*}
We have that
\begin{align*}
\sup_{\sigma \in \Sigma} \mathbb{P}_{\mathcal{M},s}^\sigma[\mathsf{FW}_{\Omega}(\lambda)] &= \sup_{\sigma \in \Sigma} \sum_{\mathcal{C} \in \mathsf{LGEC}_\Omega(\mathcal{M}, \lambda)} \mathbb{P}_{\mathcal{M},s}^\sigma[\diamondsuit \square \mathcal{C}] = \sup_{\sigma \in \Sigma} \mathbb{P}_{\mathcal{M},s}^\sigma\left[\diamondsuit L\right],\\
\sup_{\sigma \in \Sigma} \mathbb{P}_{\mathcal{M},s}^\sigma[\mathsf{BW}_{\Omega}] &= \sup_{\sigma \in \Sigma} \sum_{\mathcal{C} \in \mathsf{BWGEC}_\Omega(\mathcal{M})} \mathbb{P}_{\mathcal{M},s}^\sigma[\diamondsuit \square\mathcal{C}] = \sup_{\sigma \in \Sigma} \mathbb{P}_{\mathcal{M},s}^\sigma\left[\diamondsuit B\right].
\end{align*}
Now, observe that the term on the right-hand side is exactly the probability computed by our algorithm through the call to sub-procedure $\mathsf{MaxReachability}$ on Line~\ref{line:reach}: our algorithm is thus correct, as it computes the supremum probability to achieve the corresponding window objective.
It remains to establish that this probability is actually a \textit{maximum} probability, as claimed. Indeed, there exists a strategy to achieve the probability $\nu$ returned by our algorithm. From $s$, we know that pure memoryless optimal strategies exist to reach the computed set $T$ (which coincides with $L$ or $B$ depending on the considered variant), and inside $T$, there exist pure finite-memory optimal strategies for all good$_\Omega$ MECs, as shown in Thm.~\ref{thm:classification}. We can easily combine all these strategies in an optimal strategy for $\mathcal{M}$, which concludes our proof.
\end{proof}
\paragraph{Complexity} We wrap-up our results on prefix-independent window objectives in the following theorem.
\begin{thm}%
\label{thm:general}
The threshold probability problem is
\begin{enumerate}[label={(\alph*)}]
\item in $\PTIME$ for fixed window parity objectives and fixed window mean-payoff objectives, and pure polynomial-memory optimal strategies can be constructed in polynomial time;
\item in $\PTIME$ for bounded window parity objectives, and pure memoryless optimal strategies can be constructed in polynomial time;
\item in $\NPTIME \cap \mathsf{coNP}$ for bounded window mean-payoff objectives, and pure memoryless optimal strategies can be constructed in pseudo-polynomial time.
\end{enumerate}
\end{thm}
\begin{proof}
The complexity results follow from the analysis we made before:
\begin{itemize}
\item the MEC decomposition (Line~\ref{line:decomp}) takes quadratic time~\cite{DBLP:journals/jacm/ChatterjeeH14} and yields at most $\vert S\vert$ MECs;
\item classifying a MEC (Line~\ref{line:classify}) is in $\PTIME$ for fixed variants and bounded window parity, and in $\NPTIME \cap \mathsf{coNP}$ for bounded window mean-payoff (Thm.~\ref{thm:classification});
\item $\mathsf{MaxReachability}(s, T)$ (Line~\ref{line:reach}) takes polynomial time~\cite{baier2008principles}.
\end{itemize}
Overall we have $\PTIME$-membership for all variants except bounded window mean-payoff, where we are in $\PTIME^{\NPTIME \cap \mathsf{coNP}}$, which is equal to $\NPTIME \cap \mathsf{coNP}$~\cite{DBLP:journals/tit/Brassard79}.
Regarding optimal strategies, they are by-products of Alg.~\ref{alg:FW} and Alg.~\ref{alg:BW}. Inside good$_\Omega$ MECs, we play the strategy granted by Thm.~\ref{thm:classification}, and outside, we simply play a pure memoryless optimal reachability strategy obtained through $\mathsf{MaxReachability}(s, T)$~\cite{baier2008principles}.
\end{proof}
\paragraph{Lower bounds} We complement the results of Thm.~\ref{thm:general} with matching lower bounds, showing that our approach is optimal complexity-wise.
\begin{thm}%
\label{thm:generalHardness}
The threshold probability problem is
\begin{enumerate}[label={(\alph*)}]
\item $\PTIME$-hard for fixed window parity objectives and fixed window mean-payoff objectives, and polynomial-memory strategies are in general necessary;
\item $\PTIME$-hard for bounded window parity objectives;
\item as hard as mean-payoff games for bounded window mean-payoff objectives.
\end{enumerate}
\end{thm}
\begin{proof}
Complexity-wise, the lower bounds follow from the results in two-player zero-sum window mean-payoff~\cite{DBLP:journals/iandc/Chatterjee0RR15} and window parity~\cite{DBLP:journals/corr/BruyereHR16} games, coupled with the equivalence between the threshold probability problem and solving a two-player game established in Sect.~\ref{sec:ec}. Note that formally, this equivalence only holds if the MDP is an EC, hence we have to make sure that the corresponding game problems retain their hardness when considered over arenas that correspond to ECs (i.e., when the underlying graph is strongly connected). Fortunately, careful inspection of the related results in~\cite{DBLP:journals/iandc/Chatterjee0RR15,DBLP:journals/corr/BruyereHR16} shows that this is the case. Note that mean-payoff games are widely considered as a canonical ``hard'' problem for the class $\NPTIME \cap \mathsf{coNP}$ (see, e.g.,~\cite{DBLP:journals/iandc/Chatterjee0RR15}).
Regarding strategies, the fixed case is the only one where memory is needed, as stated in Thm.~\ref{thm:general}. Again, the necessity of polynomial memory is witnessed through the equivalence with two-player games in ECs, proved in Sect.~\ref{sec:ec}, along with results on fixed window mean-payoff and fixed window parity games~\cite{DBLP:journals/iandc/Chatterjee0RR15,DBLP:journals/corr/BruyereHR16}.
\end{proof}
\section{Limitations and perspectives}%
\label{sec:concl}
Recall that we summarized our results in Table~\ref{table:overview}, and compared them to the state of the art in Sect.~\ref{sec:intro}. The goal of this section is to discuss the limitations of our work and some extensions within arm's reach.
\paragraph{Direct bounded window objectives} We left out a specific variant of window objectives that was considered in games~\cite{DBLP:journals/iandc/Chatterjee0RR15,DBLP:journals/corr/BruyereHR16}: the \textit{direct bounded} variant, defined as $\mathsf{DBW}_\Omega = \bigcup_{\lambda > 0} \mathsf{DFW}_{\Omega}(\lambda)$ (see Sect.~\ref{subsec:illustration}). This variant is maybe not the most natural as it is \textit{not} prefix-independent, yet allows to close the windows of a run in an arbitrarily large --- but bounded along the run --- number of steps.
This variant gives rise to complex behaviors in MDPs, notably due to its interaction with the almost-sure reachability of ECs. Let us illustrate it on an example.
\begin{exa}
Consider the MDP in Fig.~\ref{fig:DBW} and objective $\mathsf{DBW}_\mathsf{mp}$. A window opens in the first step due to action $a$. The only way to close it is to loop in $s_2$ using action $b$ up to the point where the running sum of weights becomes non-negative. Note also that when it does, all windows are closed and the controller may safely switch to $s_5$. Now, observe that taking action $b$ repeatedly induces a \textit{symmetric random walk}~\cite{grinstead_AMS1997}. Classical probability results ensure that a non-negative sum will be obtained almost-surely, but the number of times $b$ is played must remain unbounded (as for any bounded number, there exists a strictly positive probability to obtain only $-1$'s for example). Therefore, in this example, there exists an infinite-memory strategy $\sigma$ such that $\almostStrat{\mathcal{M},s_1}{\sigma}{\mathsf{DBW}_\mathsf{mp}}$, but no finite-memory strategy can do as good.
Now, if we modify the probabilities in $b$ to $\delta(s_2, b) = \{s_3 \mapsto 0.6, s_4 \mapsto 0.4\}$, the random walk becomes \textit{asymmetric}, with a strictly positive chance to diverge toward $-\infty$. While the best possible strategy is still the one defined above, it only guarantees a probability strictly less than one to satisfy the objective.\hfill$\triangleleft$
\end{exa}
\begin{figure}[tbh]
\centering
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node
distance=2.5cm,bend angle=45, scale=0.6, font=\normalsize]
\tikzstyle{p1}=[draw,circle,text centered,minimum size=7mm,text width=4mm]
\tikzstyle{p2}=[draw,rectangle,text centered,minimum size=7mm,text width=4mm]
\tikzstyle{act}=[fill,circle,inner sep=1pt,minimum size=1.5pt, node distance=1cm] \tikzstyle{empty}=[text centered, text width=15mm]
\node[p1] (1) at (0,0) {$s_{1}$};
\node[p1] (2) at (4,0) {$s_{2}$};
\node[act] (1a) at (2,0) {};
\node[act] (2a) at (4,3) {};
\node[act] (2b) at (6,0) {};
\node[act] (3a) at (2,1.5) {};
\node[act] (4a) at (6,1.5) {};
\node[act] (5a) at (10,0) {};
\node[empty] at ($(3a)+(-0.7,0)$) {\scriptsize $c, -1$};
\node[empty] at ($(4a)+(0.5,0)$) {\scriptsize $d, 1$};
\node[p1] (3) at (2,3) {$s_{3}$};
\node[p1] (4) at (6,3) {$s_{4}$};
\node[empty] at ($(1a)+(-0,0.3)$) {\scriptsize $a, -1$};
\node[empty] at ($(5a)+(-0,-0.3)$) {\scriptsize $f, 0$};
\node[empty] at ($(2a)+(-0,0.3)$) {\scriptsize $b, 0$};
\node[empty] at ($(2b)+(-0,0.3)$) {\scriptsize $e, 0$};
\node[p1] (5) at (8,0) {$s_{5}$};
\coordinate[shift={(-5mm,0mm)}] (init) at (1.west);
\path[-latex']
(init) edge (1)
(1) edge (1a)
(2) edge (2a)
(2) edge (2b)
(3) edge (3a)
(5) edge (5a)
(4) edge (4a)
(1a) edge node[below,xshift=0mm]{\scriptsize $1$} (2)
(2b) edge node[below,xshift=0mm]{\scriptsize $1$} (5)
(3a) edge node[right,xshift=1mm]{\scriptsize $1$} (2)
(4a) edge node[left,xshift=-1mm]{\scriptsize $1$} (2)
(2a) edge node[below,xshift=0mm]{\scriptsize $0.5$} (3)
(2a) edge node[below,xshift=0mm]{\scriptsize $0.5$} (4)
;
\draw [->] (5a) to[out=90,in=45] node[above ,xshift=0mm]{\scriptsize $1$} (5);
\end{tikzpicture}
\caption{There exists a strategy $\sigma$ ensuring $\almostStrat{\mathcal{M},s_1}{\sigma}{\mathsf{DBW}_\mathsf{mp}}$ but it requires infinite memory as it needs to use $b$ up to the point where the running sum becomes non-negative, then switch to $e$.}%
\label{fig:DBW}
\end{figure}
What do we observe? First, \textit{infinite-memory strategies are required}, which is a problem for practical applications. Second, even for \textit{qualitative} questions (is the probability zero or one?), the actual probabilities of the MDP must be considered, not only the existence of a transition. This is in stark contrast to most problems in MDPs~\cite{baier2008principles}: in that sense, the direct bounded window objective is not well-behaved. This is due to the connection with random walks we just established. Imagine that we replace the gadget related to action $b$ by a much more complex EC:\@ the corresponding random walk will be quite tedious to analyze. It is well-known that complex random walks are difficult to tackle for verification and synthesis. For example, even simple asymmetric random walks, like the one we sketched, are not \textit{decisive} MCs, a large and robust class of MCs where reachability questions can be answered~\cite{DBLP:journals/lmcs/AbdullaHM07}.
\paragraph{Markov chains} Our work focuses on the threshold probability problem for MDPs, and the corresponding strategy synthesis problem. Better complexities could possibly be obtained in the case of MCs, where there are no non-deterministic choices. To achieve this, a natural direction would be to focus on the classification of ECs (Sect.~\ref{sec:ec}), the bottleneck of our approach: for MCs, this classification would involve \textit{one-player window games} (for the opponent), whose precise complexity has yet to be explored and would certainly be lower than for two-player games.
Note however that complexity classes in the MC case are unlikely to be much lower: all parity variants are already in $\mathsf{P}$, and the high complexity of the direct fixed window mean-payoff case would remain: a construction similar to the $\mathsf{PSPACE}$-hardness proof (Thm.~\ref{thm:directHardness}) easily shows this problem to be $\mathsf{PP}$-hard, already for \textit{acyclic} MCs (again using~\cite{DBLP:conf/icalp/HaaseK15}). Let us recall that $\mathsf{PP}$-hard problems are widely believed to be outside $\mathsf{NP}$, as otherwise the polynomial hierarchy would collapse to $\mathsf{P}^\mathsf{NP}$ by Toda's theorem~\cite{DBLP:journals/siamcomp/Toda91}.
\paragraph{Expected value problem} Given an MDP $\mathcal{M}$ and an initial state $s$, we may be interested in synthesizing a strategy $\sigma$ that minimizes the \textit{expected window size} for a fixed window objective (say $\mathsf{FW}_\Omega(\lambda)$ for the sake of illustration), which we straightforwardly define as
\[
\mathbb{E}^\sigma_{\mathcal{M}, s, \Omega}(\lambda) = \sum_{\lambda > 0}^\infty \lambda \cdot \mathbb{P}_{\mathcal{M}, s}^\sigma[\mathsf{FW}_\Omega(\lambda) \setminus \mathsf{FW}_\Omega(\lambda-1)],
\]
with $\mathsf{FW}_\Omega(0) = \emptyset$. This meets the natural desire to build strategies that strive to maintain the \textit{best time bounds possible in their local environment} (e.g., EC of $\mathcal{M}$). Note that this is totally different from the value function used in~\cite{DBLP:journals/corr/abs-1812-09298}.
For prefix-independent variants, \textit{we already have all the necessary machinery} to solve this problem. First, we refine the classification process to identify the best window size achievable in each MEC, if any. Indeed, if a MEC is $\lambda$-good, it necessarily is for some $\lambda$ between one and the upper bound derived from the game-theoretic interpretation (Rmk.~\ref{rmk:uniformECs}): we determine the smallest value of $\lambda$ for each MEC via a binary search coupled with the classification procedure. Second, using classical techniques (e.g.,~\cite{DBLP:journals/fmsd/RandourRS17}), we contract each MEC to a single-state EC, and give it a weight that represents the best window size we can ensure in it (hence this weight may be infinite if a MEC is not $\mathsf{BW}$-good). Finally, we construct a global strategy that favors reaching MECs with the lowest weights, for example by synthesizing a strategy minimizing the classical mean-payoff value. Note that if $\lambda$-good MECs cannot be reached almost-surely, the expected value will be infinite, as wanted. Observe that \textit{such an approach maintains tractability}, as we end up with a polynomial-time algorithm.
Direct variants would require more involved techniques, as the unfoldings developed in Sect.~\ref{sec:fixed} are strongly linked to the fixed window size $\lambda$, and cannot be that easily combined for different values of $\lambda$.
\paragraph{Multi-objective problems} Window games have also been considered in the multidimension setting, where several weight (resp.~priority) functions are given, and the objective is defined as the intersection of all one-dimension objectives~\cite{DBLP:journals/iandc/Chatterjee0RR15,DBLP:journals/corr/BruyereHR16}. Again, \textit{our generic approach supports effortless extension to this setting}.
In the direct case, the unfoldings of Sect.~\ref{sec:fixed} can easily be generalized to multiple dimensions, as in~\cite{DBLP:journals/iandc/Chatterjee0RR15,DBLP:journals/corr/BruyereHR16}. For prefix-independent variants, the EC classification needs to be adapted to handle multidimension window games, which we can solve using the techniques of~\cite{DBLP:journals/iandc/Chatterjee0RR15,DBLP:journals/corr/BruyereHR16}. Then, we also need to consider a multi-objective reachability problem~\cite{DBLP:journals/fmsd/RandourRS17}.
While almost all cases of multidimension window games are $\mathsf{EXPTIME}$-complete, note that the decidability of the bounded mean-payoff case is still open; it is however known to be non-primitive recursive hard.
\paragraph{Tool support} Thanks to its low complexity and its adequacy w.r.t.~applications, our window framework lends itself well to tool development. We are currently building a tool suite for MDPs with window objectives based on the main results of this paper along with the aforementioned extensions. Our aim is to provide a dedicated extension of \textsc{Storm}, a cutting-edge probabilistic model checker~\cite{DBLP:conf/cav/DehnertJK017}.
\bibliographystyle{alpha}
| {'timestamp': '2020-12-14T02:02:03', 'yymm': '1901', 'arxiv_id': '1901.03571', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03571'} | arxiv |
\section{MLaut, API Design and Main Features}
\label{sec:api}
MLaut~\cite{mlaut_2018} is a modelling and workflow toolbox that was written with the aim of simplifying the task of running machine learning benchmarking experiments. MLaut was created with the specific use-case of large-scale performance evaluation on a large number of real life datasets, such as the study of~\cite{fernandez-delgado_we_2014}. Another key goal was to provide a scalable and unified high-level interface to the most important machine learning toolboxes, in particular to include deep learning models in such a large-scale comparison..
Below, we describe package design and functionality. A short usage handbook is included in Section \ref{subsec:code_examples}
MLaut may be obtained from pyPI via \texttt{pip install mlaut}, and is maintained on GitHub at \texttt{github.com/alan-turing-institute/mlaut}. A Docker container can also be obtained from Docker Hub via \texttt{docker pull kazakovv/mlaut}.
\subsection{Applications and Use}
MLaut main use case is the set-up and execution of supervised (classification and regression) benchmarking experiments. The package currently provides an high-level workflow interface to scikit-learn and keras models, but can easily be extended by the user to incorporate model interfaces from additional toolboxes into the benchmarking workflow.
MLaut automatically creates begin-to-end pipeline for processing data, training machine learning experiments, making predictions and applying statistical quantification methodology to benchmark the performance of the different models.
More precisely, MLaut provides functionality to:
\begin{itemize}
\item Automate the entire workflow for large-scale machine learning experiments studies. This includes structuring and transforming the data, selecting the appropriate estimators for the task and data data at hand, tuning the estimators and finally comparing the results.
\item Fit data and make predictions by using the prediction strategies as described in \ref{subsection:estimators} or by implementing new prediction strategies.
\item Evaluate the results of the prediction strategies in a uniform and statistically sound manner.
\end{itemize}
\subsection{High-level Design Principles}
We adhered to the high-level API design principles adopted for the scikit-learn project \cite{buitinck_api_2013}. These are:
\begin{enumerate}
\item Consistency.
\item Inspection.
\item Non-proliferation of classes.
\item Composition.
\item Sensible defaults.
\end{enumerate}
We were also inspired by the Weka project~\cite{jagtap_census_2013}, a platform widely used for its data mining functionalities. In particular, we wanted to replicate the ease of use of Weka in a pythonic setting.
\subsection{Design Requirements}
Specific requirements arise from the main use case of scalable benchmarking and the main design principles:
\begin{enumerate}
\item \textbf{Extensibility.} MLaut needs to provide a uniform and consistent interface to level 3 toolbox interfaces (as in Section~\ref{sec:intro.toolboxes}). It needs to be easily extensible, e.g., by a user wanting to add a new custom strategy to benchmark.
\item \textbf{Data collection management.} Collections of data sets to benchmark on may be found on the internet or exist on a local computer. MLaut needs to provide abstract functionality for managing such data set collections.
\item \textbf{Algorithm/model management.} In order to match algorithms with data sets, MLaut needs to have abstract functionality to do so. This needs to include sensible default settings and easy meta-data inspection of standard methodology.
\item \textbf{Orchestration management.} MLaut needs to conduct the benchmarking experiment in a standardized way with minimal user input beyond its specification, with sensible defaults for the experimental set-up. The orchestration module needs to interact with, but be separate from the data and algorithm interface.
\item \textbf{User Friendliness.} The package needs to be written in a pythonic way and should not have a steep learning curve. Experiments need to be easy to set-up, conduct, and summarize, from a python console or a jupyter notebook.
\end{enumerate}
In our implementation of MLaut, we attempt to address the above requirements by creating a package which:
\begin{itemize}
\item \textit{Has a nice and intuitive scripting interface}. One of our main requirements was to have a native Python scripting interface that integrates well with the rest of our code. Our design attempts to reduce user interaction to the minimally necessary interface points of experiment specification, running of experiments, and querying of results.
\item \textit{Provides a high level of abstraction form underlying toolboxes}. Our second criteria was that MLaut provided high level of abstraction from underlying toolboxes. One of our main requirements was for MLaut to be completely model and toolbox agnostic. The scikit-learn interface was too light-weight for our purposes as its parameter and meta-data management is not interface explicit (or inspectable).
\item \textit{Provides Scalable workflow automation}. This needed to be one of MLaut's cornerstone contributions. Its main logic is implemented in the \code{orchestrator} class that orchestrates the evaluation of all estimators on all datasets. The class manages resources for building the estimator models, saving/loading the data and the estimator models. It is also aware of the experiment's partial run state and can be used for easy resuming of an interrupted experiment.
\item \textit{Allows for easy estimator construction and retrieval}. The end user of the package should be able to easily add new machine learning models to the suite of build in ones in order to expand its functionality. Besides a small number of required methods to implement, we have provided interfaces to two of the most used level 3 toolbox packages, sklearn and keras.
\item \textit{Has a dedicated meta-data interface for sensible defaults of estimators}. We wanted to ensure that the estimators that are packaged in MLaut come with sensible defaults, i.e. pre-defined hyper-parameters and tuning strategies that should be applicable in most use cases. The robustness of these defaults has been tested and proven as part of the original large-scale classification study. As such, the user is not required to have a detailed understanding of the algorithms and how they need to be set up, in order to make full use them.
\item \textit{Provides a framework for quantitative benchmark reporting}. Easily accessible evaluation methodology for the benchmarking experiments is one of the key features of the package. We also considered reproducibility of results as vital, reflected in a standardized set-up and interface for the experiments, as well as control throughout of pseudo-random seeds..
\item \textit{Orchestrates the experiments and parallelizes the load over all available CPU cores}. A large benchmarking study can be quite computationally expensive. Therefore, we needed to make sure that all available machine resources are fully utilized in the process of training the estimators. In order to achieve this we used the parallelization methods that are available as part of the \code{GridSearch} method and natively with some of the estimators. Furthermore, we also provide a Docker container for running MLaut which we recommend using as a default as it allows the package to run in the background at full load.
\item \textit{Provides a uniform way of storing a retrieving data}. Results of benchmarking experiments needed to be saved in a uniform way and made available to users and reviewers of the code. At the current stage, we implemented back-end functionality for management via local HDF5 database files. In the future, we hope to support further data storage back-ends with the same orchestrator-sided facade interface.
\end{itemize}
\subsubsection{Estimator encapsulation}
MLaut implements a logic of encapsulating the meta-data with the estimators that it pertains to. This is achieved by using a decorator class that is attached to each estimator class. By doing this, our extended interface is are able to bundle wide-ranging meta-data information with each estimator class. This includes:
\begin{itemize}
\item Basic estimator properties such as name, estimator family;
\item Types of tasks that a particular estimator can be applied to;
\item The type of data which the estimator expects or can handle;
\item The model architecture (on level 3, as in Section~\ref{sec:intro.toolboxes}). This is particularly useful for more complex estimators such as deep neural networks. By applying the decorator structure the model architecture can be easily altered without changing the underlying estimator class.
\end{itemize}
This extended design choice has significant benefits for a benchmarking workflow package. First of all, it allows fsearching for estimators based on some basic criteria such as task or estimator family. Second of all, it allows to inspect, query, and change default hyper-parameter settings used by the estimators. Thirdly, strategies with different internal model architectures can be deployed with relative ease.
\subsubsection{Workflow design}
The workflow supported by MLaut consists of the following main steps:
\begin{figure}[h!]
\centering
\includegraphics[scale=0.7]{pipeline}
\caption{The orchestrated MLaut workflow}
\end{figure}
\begin{enumerate}
\item \textbf{Data collection.} As a starting point the user needs to gather and organize the datasets of interest on which the experiments will be run. The raw datasets need to be saved in a HDF5 database. Metadata needs to be attached to each dataset which is later used in the training phase for example for distinguishing the target variables. MLaut provides an interface for manipulating the databases through its \code{Data} and \code{Files\_IO} classes. The logic of the toolbox is to provision two HDF5 databases one for storing the input data such as the datasets and a second one to store the output of the machine learning experiments and processed data such as train/test index splits. This separation of input and output is not required but is recommended. The datasets also need to be split in a \textit{train} and \textit{test} set in advance of proceeding with the next phase in the pipeline. The indices of the train and test splits are stored separately from the actual datasets in the HDF5 database to ensure data integrity and reproducibility of the experiments. All estimators are trained and tuned on the training set only. At the end of this process the estimators are used on the test sets which guarantees that all predictions are made on unseen data.
\item \textbf{Training phase.} After the datasets are stored in the HDF5 database by following the convention adopted by MLaut the user can proceed to training the estimators. The user needs to provide an array of machine learning estimators that will be used in the training process. MLaut provides a number of default estimators that can be instantiated. This can be done by the use of the \code{estimators} module. The package also provides the flexibility for the user to write its own estimator by inheriting from the \code{mlaut\_estimator} class. Furthermore, there is a \code{generic\_estimator} module which provides flexibility for the user to create new estimators with only a couple of lines of code.
The task of training the experiments is performed by the \code{experiments. Orchestrator} class. This class manages the sequence of the training the the parallelization of the load. Before training each dataset is preprocessed according to metadata provided on the estimator level. This includes normalizing the features and target variables, conversion from categorical to numerical values.
We recommend running the experiments inside a Docker container if they are very computationally intensive. This allows MLaut to run in the background on a server without shutting down unexpectedly due to loss of connection. We have provided a Docker image that makes this process easy.
\item \textbf{Making predictions.} During training the fitted models are stored on the hard drive. At the end of the training phase the user can again use \code{experiments.Orchestrator} class to retrieve the trained models and make predictions on the test sets.
\item \textbf{Analyse results.} \label{pipelineAnalyseResults} The last stage is analysing the output of the results of the machine learning experiments. In order to initiate the process the user needs to call the \code{analyze\_results.prediction\_errors} method which returns two dictionaries with the average errors per estimator on all datasets as well as the errors per estimator achieved on each dataset. These results can be used as inputs to the statistical tests that are also provided as part of the \code{analyze\_rezults} module which mostly follow the methodology proposed by \cite{demsar_statistical_2006}.
\end{enumerate}
\subsection{Software Interface and Main Toolbox Modules}
MLaut is built around the logic of the pipeline workflow described earlier. Our aim was to implement the programming logic for each step of the pipeline in a different module. The code that is logically used in more than one of the stages is implemented in a \code{Shared} module that is accessible by all other classes. The current design pattern is most closely represented by the \textit{fa\c{c}ade} and \textit{adaptor} patterns under which the user interacts with one common interface to access the underlying adaptors which represent the underlying machine learning and statistical toolboxes.
\begin{figure}[h!]
\centering
\includegraphics[scale=0.7]{user_interaction}
\caption{Interaction between the main MLaut modules}
\end{figure}
\subsubsection{Data Module}
The \code{Data} module contains the high level methods for manipulating the raw datasets. It provides a second layer of interface to the lower level classes for accessing, storing and extracting data from HDF5 databases. This module uses heavily the functionality developed in the \code{Shared} module but provides a higher level of abstraction for the user.
\subsubsection{Estimators Module} \label{subsection:estimators_module}
This module encompasses all machine learning models that come with MLaut as well as methods for instantiating them based on criteria provided by the user. We created MLaut for the purpose of running supervised classification experiments but the toolbox also comes with estimators that can be used for supervised regression tasks.
From a software design perspective the most notable method in this class is the \code{build} method which returns an instantiated estimator with the the appropriate hyper parameter search space and model architecture. In software design terms this approach resembles more closely the \textit{builder design pattern} which aims at separating the construction of and object from its representation. This design choice allows the base \code{mlaut\_estimator} class to create different representations of machine learning models.
The \code{mlaut\_estimator} object includes methods that complete its set of functionalities. Some of the main ones are a \code{save} method that takes into account the most appropriate format to persist a trained estimator object. This could include the pickle format used by most \textit{scikit-learn} estimators or the \textit{HDF5} format used by keras. A \code{load} function is also available for restoring the saved estimators.
The design of the package also relies on the estimators having a uniform \code{fit} and \code{predict} methods that takes the same input date and generate predictions in the same format. These methods are not implemented at the \code{mlaut\_estimator} level but instead we relied on the fact that these fundamental methods will be uniform across the underlying packages. However, there is a discrepancy in the behaviour of the \textit{scikit-learn} and \textit{keras} estimators. For classification tasks \textit{keras} requires the labels of the training data to be one hot encoded. Furthermore, the default behaviour of the keras \code{predict} method is equivalent to the \code{predict\_proba} in scikit-learn. We solved these discrepancies by overriding the \code{fit} and \code{predict} methods of the implemented keras estimators.
Through the use of decorators and by implementing the \code{build} method we are able to fully customize the estimator object with minimal required programming. The decorator class allows to set the metadata associated with the estimator. This includes setting the name, estimator family, types of tasks and hyper parameters. This together with an implemented \code{build} method will give the user a fully specified machine learning model. This approach also facilitates the application of the algorithms and the use of the software as we can ensure that each algorithm is matched to the correct datasets. Furthermore, this allows to easily retrieve the required algorithms by executing a simple command.
\begin{figure}[h!]
\centering
\includegraphics[scale=0.7]{estimator_class}
\caption{Interaction between MLaut Estimator class and third-party ml estimators}
\end{figure}
Closely following terminology and taxonomy of~\cite{james_introduction_2013}, mlaut estimators are currently assigned to one of the following methodological families:
\begin{enumerate}[label=\alph*)]
\item \textbf{Baseline Estimators}. This family of models is also referred to as a dummy estimator and serves as a benchmark to compare other models to. It does not aim to learn any representation of the data but simply adopts a strategy of guessing.
\item \textbf{Generalized Linear Model Estimators}. A family of models that assumes that a (generalized) linear relationship exists between the dependent and target values.
\item \textbf{Naive Bayes Estimators}. This class of models applies the Bayes theorem my making the naive assumption that all features are independent.
\item \textbf{Prototype Method Estimators}. Family of models that apply prototype matching techniques for fitting the data. The most prominent member of this family is the K-means algorithm.
\item \textbf{Kernel Method Estimators}. Family of models using kernelization techniques, including support vector machine based estimazors.
\item \textbf{Deep Learning and Neural Network Estimators}. This family of models provides implementation of neural network models, including deep neural networks.
\item \textbf{Ensembles-of-Trees Estimators}. Family of methods that combines the predictions of several tree-based estimators in order to produce a more robust overall estimator. This family is further divided in:
\begin{enumerate}
\item \textit{averaging methods}. The models in this group average the predictions of several independent models in order to arrive at a combined estimator. An example is Breiman's random forest.
\item \textit{boosting methods}. An ensembling approach of building models sequentially based on iterative weighted residual fitting. An example are stochastic gradient boosted tree models.
\end{enumerate}
\end{enumerate}
In addition ot this the user also has the option to write their own estimator objects. In order to achieve this the new class needs to inherit from the \code{mlaut\_estimator} class. and implementing the abstract methods in each child class. The main abstract method that needs to be implemented is the \code{build} method which returns an wrapped instance of the estimator with a set of hyper-parameters that will be used in the tuning process. For further details about the implemented estimators refer to \ref{subsection:estimators}.
\subsubsection{Experiments Module}
This module contains the logic for orchestration of the machine learning experiments. The main parameters in this module are the datasets and the estimator models that will be trained on the data. The main \code{run} method of the module then proceeds to training all estimators on all datasets, sequentially. The core of the method represent two embedded \code{for} loops the first of which iterates over the datasets and the second one over the estimators. Inside the inner loop the orchestrator class builds an estimator instance for each dataset. This allows to tailor the machine learning model for each dataset. For example, the architecture of a deep neural network can be altered to include the appropriate number of neurons based on the input dimensions of the data. This module is also responsible for saving the trained estimators and making predictions. It should be noted that the orchestrator module is not responsible for the parallelization of the experiments which is handled on an individual estimator level.
\subsubsection{Result Analysis Module} \label{subsection:analyse_results}
This module includes the logic for performing the quantitative evaluation and comparison of the machine learning strategies' performance. The predictions of the trained estimators on the test sets for each dataset serve as input. First, performances and, if applicable, standard errors on the individual data sets are computed, for a given average or aggregate loss/performance quantifier. The samples of performances are then used as inputs for comparative quantification.
API-wise, the framework for assessing the performance of the machine learning estimators hinges on three main classes. The \code{anlyze\_results} class implements the calculation of the quantifiers. Through composition this class relies on the \code{losses} class that performs the actual calculation of the prediction performances over the individual test sets. The third main class that completes the framework design is the \code{scores} class. It defines the loss/quantifier function that is used for assessing the predictive power of the estimators. An instance of the \code{scores} class is passed as an argument to the \code{losses} class.
We believe that this design choice of using three classes is required to provide the necessary flexibility for the composite performance quantifiers as described in Section~\ref{Sec:benchmarking} - i.e., to allow to compute ranks for an arbitrarily chosen loss (e.g., mean rank with resect to mean absolute error), or to perform comparison testing using an arbitrarily chosen performance quantifier (e.g., Wilcoxon signed rank test comparing F1-scores).
Our API also facilitates user custom extension, e.g., for users who wish to add a new score function, an efficient way to compute aggregate scores or standard errors, or a new comparison testing methodology.
For example, adding new score functions can be easily achieved by inheriting from the \code{MLautScore} abstract base class. On the other hand, the \code{losses} class completely encapsulates the logic for the calculation of the predictive performance of the estimators. This is particularly useful as the class internally implements a mini orchestrator procedure for calculating and presenting the loss achieved by all estimators supplied as inputs. Lastly, the suite of statistical tests available in MLaut can be easily expanded by adding the appropriate method to the \code{analyze\_results} class or a descendant.
\begin{figure}[h!]
\centering
\includegraphics[scale=0.7]{analyse_results_interaction}
\caption{Interaction between main classes inside the \code{analyse\_results} module}
\end{figure}
Mathematical details of the implemented quantification procedures implemented in MLaut were presented in Section~\ref{Sec:benchmarking}. Usage details
In this implementation of MLaut we use third-party packages for performing the statistical tests. We rely mostly on the \code{scikit-learn} package. However, for post hoc tests we use the \code{scikit-posthocs} package \cite{terpilowski_scikit-posthocs:_nodate} and the \code{Orange} package \cite{demsar_orange:_2013} which we also used for creating critical distance graphs for comparing multiple classifiers.
\subsubsection{Shared Module}
This module includes classes and methods that are shared by the other modules in the package. The \code{Files\_IO class} comprises of all methods for manipulating files and datasets. This includes saving/loading of trained estimators from the HDD and manipulating the HDF5 databases. The \code{Shared} module also keeps all static variables that are used throughout the package.
\subsection{Workflow Example}
\label{subsec:code_examples}
We give a step-by-step overview over the most basic variant of the user workflow. Advanced examples with custom estimators and set-ups may be found in the MLaut tutorial~\cite{mlaut_2018}.
\subsubsection*{Step 0: setting up the data set collection}
The user should begin by setting up the data set collection via the \code{Files\_IO class}. Meta-data for each dataset needs to be provided that includes as a minimum the class column name/target attribute and name of dataset. This needs to be done {\emph once} for every dataset collection, and may not need to be done for a pre-existing or pre-deployed collection. Currently, only local HDF5 data bases are supported.
We have implemented back-end set-up routines which download specific data set collections and generate the meta-data automatically. Current support includes the UCI library data sets and OpenML.
Alternatively, the back-end may be populated directly by storing an in-memory pandas DataFrame via the \code{save\_pandas\_dataset} method, e.g., as part of custom loading scripts.
\begin{lstlisting}[language=Python]
input_io.save_pandas_dataset(
dataset=data, #in Pandas DataFrame format
save_loc='/openml', #location in HDF5 database
metadata=metadata)
\end{lstlisting}
In this case, meta-data for the individual datasets needs to be provided in the following dictionary format:
\begin{lstlisting}[language=Python]
metadata = {
'class_name': ..., #label column name
'source': , # source of the data
'dataset_name': ... ,
'dataset_id': id
}
\end{lstlisting}
\subsubsection*{Step 1: initializing data and output locations}
As the next step, the user should specify the back-end links to the data set collections (``input'') and to intermediate or analysis results (``output'').This is done via the \code{data} class. It is helpful for code readability to store these in code{input\_io} and \code{out\_io} variables.
\begin{lstlisting}[language=Python]
input_io = data.open_hdf5('data/openml.h5', mode='r')
out_io = data.open_hdf5(
'data/openml-classification.h5', mode='a')
\end{lstlisting}
These may then be supplied as parameters to preparation and orchestration routines.
We then proceed to getting the paths to the raw datasets as well as the respective train/test splits which is performed respectively though the use of \code{list\_datasets} and \code{split\_datasets} methods.
\begin{lstlisting}[language=Python]
(dts_names_list,
dts_names_list_full_path) = data.list_datasets(
hdf5_io=input_io,
hdf5_group='openml/')
split_dts_list = data.split_datasets(hdf5_in=input_io,
hdf5_out=out_io,
dataset_paths=dts_names_list_full_path)
\end{lstlisting}
\subsubsection*{Step 2: initializing estimators}
The next step is to instantiate the learning strategies, estimators in sklearn terminology, which we want to use in the benchmarking exercise. The most basic and fully automated variant is use of the \code{instantiate\_default\_estimators} method which loads a pre-defined set of defaults given specified criteria. Currently, only a simple string look-up via the \code{estimators} parameter is implemented, but we plan to extend the search/matching functionality. The string criterion may be used to fetch specific estimators by a list of names, entire families of models, estimators by task (e.g., classification), or simply all available estimators.
\begin{lstlisting}[language=Python]
instantiated_models = instantiate_default_estimators(
estimators=['Classification'],
verbose=1,
n_jobs=-1)
\end{lstlisting}
\subsubsection*{\bf Step 3: orchestrating the experiment}
The final step is to run the experiment by passing references to data and estimators to the \code{orchestrator} class, then initating the training process by invoking its \code{run} method.
\begin{lstlisting}[language=Python]
orchest = orchestrator(hdf5_input_io=input_io,
hdf5_output_io=out_io,
dts_names=dts_names_list,
original_datasets_group_h5_path='openml/')
orchest.run(modelling_strategies=instantiated_models)
\end{lstlisting}
\subsubsection*{Step 4: computing benchmark quantifiers}
After the estimators are trained and the predictions of the estimators are recorded we can proceed to obtaining quantitative benchmark results for the experiments.
For this, we need to instantiate the \code{AnalyseResults} class by supplying the folders where the raw datasets and predictions are stored. Its \code{prediction\_errors} method may be invoked to returns both the calculated prediction performance quantifiers, per estimator as well as the prediction performances per estimator and per dataset.
\begin{lstlisting}[language=Python]
analyse = AnalyseResults(
hdf5_output_io=out_io,
hdf5_input_io=input_io,
input_h5_original_datasets_group='openml/',
output_h5_predictions_group='experiments/predictions/')
#Score function that will be used for the statistical tests
score_accuracy = ScoreAccuracy()
estimators = instantiate_default_estimators(['Classification'])
(errors_per_estimator,
errors_per_dataset_per_estimator,
errors_per_dataset_per_estimator_df) =
analyse.prediction_errors(metric=score_accuracy, estimators=estimators)
\end{lstlisting}
The prediction errors per dataset per estimator can be directly examined by the user. On the other hand, the estimator performances may be used as further inputs for comparative quantification via hypothesis tests. For example, we can perform a paired t-test for pairwise comparison of methods by invoking the code below:
\begin{lstlisting}[language=Python]
t_test, t_test_df = analyze.t_test(errors_per_estimator)
\end{lstlisting}
\section{Further benchmarking results} \label{section:statistical_appendix}
\subsection{paired t-test, without multiple testing correction} \label{table:t_test}
\begin{adjustbox}{max width=\linewidth}
\input{tables/t_test1.tex}
\end{adjustbox}
\clearpage
\begin{adjustbox}{max width=\linewidth}
\input{tables/t_test2.tex}
\end{adjustbox}
\begin{adjustbox}{max width=\linewidth}
\input{tables/t_test3.tex}
\end{adjustbox}
\begin{adjustbox}{max width=\linewidth}
\input{tables/t_test4.tex}
\end{adjustbox}
\begin{adjustbox}{max width=\linewidth}
\input{tables/t_test5.tex}
\end{adjustbox}
\begin{adjustbox}{max width=\linewidth}
\input{tables/t_test6.tex}
\end{adjustbox}
\begin{adjustbox}{max width=\linewidth}
\input{tables/t_test7.tex}
\end{adjustbox}
\subsection{Wilcoxon signed-rank test, without Bonferroni correction} \label{table:wilcoxon}
\begin{adjustbox}{max width=\linewidth}
\input{tables/wilcoxon_test1.tex}
\end{adjustbox}
\clearpage
\begin{adjustbox}{max width=\linewidth}
\input{tables/wilcoxon_test2.tex}
\end{adjustbox}
\begin{adjustbox}{max width=\linewidth}
\input{tables/wilcoxon_test3.tex}
\end{adjustbox}
\begin{adjustbox}{max width=\linewidth}
\input{tables/wilcoxon_test4.tex}
\end{adjustbox}
\begin{adjustbox}{max width=\linewidth}
\input{tables/wilcoxon_test5.tex}
\end{adjustbox}
\begin{adjustbox}{max width=\linewidth}
\input{tables/wilcoxon_test6.tex}
\end{adjustbox}
\begin{adjustbox}{max width=\linewidth}
\input{tables/wilcoxon_test7.tex}
\end{adjustbox}
\end{landscape}
\begin{landscape}
\subsection{Nem\'enyi post-hoc significance} \label{table:nemeniy}
\begin{adjustbox}{max width=\linewidth}
\input{tables/nemeniy_test1.tex}
\end{adjustbox}
\clearpage
\begin{adjustbox}{max width=\linewidth}
\input{tables/nemeniy_test2.tex}
\end{adjustbox}
\begin{adjustbox}{max width=\linewidth}
\input{tables/nemeniy_test3.tex}
\end{adjustbox}
\begin{adjustbox}{max width=\linewidth}
\input{tables/nemeniy_test4.tex}
\end{adjustbox}
\begin{adjustbox}{max width=\linewidth}
\input{tables/nemeniy_test5.tex}
\end{adjustbox}
\begin{adjustbox}{max width=\linewidth}
\input{tables/nemeniy_test6.tex}
\end{adjustbox}
\begin{adjustbox}{max width=\linewidth}
\input{tables/nemeniy_test7.tex}
\end{adjustbox}
\end{landscape}
\subsection{Accuracy by data set, type (a) standard errors} \label{table:avg_performance_per_estimator}
\input{tables/errors_per_dataset_per_estimator.tex}
\label{table:performance_per_dataset_and_per_estimator}
\section{Benchmarking supervised learning strategies on multiple datasets - methods}
\label{Sec:benchmarking}
We now describe the suite of performance and comparison quantification methods implemented in the mlaut package. It consists largely of state-of-art of model comparison strategies for the multiple datasets situation, supplemented by our own constructions based on standard statistical estimation theory where appropriate. References and prior work will be discussed in the respective sub-sections.
mlaut supports the following types of benchmark quantification methodology and post-hoc analyses:
\begin{enumerate}
\itemsep-0.2em
\item[(i)] loss-based performance quantifiers, such as mean squared error and mean absolute error, including confidence intervals.
\item[(ii)] aggregate performance quantifiers, such as contingency table quantities (sensitivity, specifity) in classification, including confidence intervals.
\item[(iii)] rank based performance quantifiers, such as average performance rank.
\item[(iv)] comparative hypothesis tests, for relative performance of methods against each other.
\end{enumerate}
The exposition uses notation and terminology previously introduced in Section~\ref{sec:theory}. Different kinds of quantifiers (loss and/or rank based), and different kinds of future performance guarantees (trained vs re-fitted prediction functional; seen vs unseen sources), as discussed in Section~\ref{sec:theory.performance}, may apply across all types of benchmarking analyses.
Which of these is the case, especially under which future data scenario the guarantee given is supposed to hold, will be said explicitly for each, and should be taken into account by any use of the respective quantities in scientific argumentation.
Practically, our recommendation is to consider which of the future data scenarios (a), (b), (c) a guarantee is sought for, and whether evidencing differences in rank, or differences in absolute performances, are of interest.
\subsection{Average based performance quantifiers and confidence intervals}
For average based performance quantifiers, performances and their confidence intervals are estimated from the sample of loss/score evaluates. We will denote the elements in this sample by $L_{j,k}^{(i)}:=L(\hat{Y}_k^{(i)},Y_{j}^{(i)})$ (for notation on RHS see Section~\ref{sec:theory.performance.avg}
). Note that, differently from the population quantities, there are three (not two) indices: $k$ for the strategy, $i$ for the dataset, and $j$ for which test set point we are considering.
\begin{table}[h]
\centering
\begin{tabular}{|c | c c | c c |}
\noalign{\hrule height 1.0pt}
estimate & estimates & f.d.s. & standard error estimate & CLT in\\
\noalign{\hrule height 1.0pt}
$\widehat{\eta}_{i,k} := \frac{1}{M_i}\sum_{j=1}^{M_i} L_{j,k}^{(i)}$ & $\eta_{i,k}$ & (a) & $\sqrt{\frac{\widehat{v}_{i,k}}{M_i}},\;\mbox{where}\;\widehat{v}_{i,k}:=\frac{\sum_{j=1}^{M_i} (L_{j,k}^{(i)}-\widehat{\eta}_{i,k})^2}{M_i-1}$& $M_i$ \\
$\widehat{\eta}_{k} := \frac{1}{D}\sum_{i=1}^{D} \widehat{\eta}_{i,k}$ & $\overline{\eta}_{k}$ & (a) & $\frac{1}{D}\sqrt{\sum_{i=1}^D\frac{\widehat{v}_{i,k}}{M_i}}$ & $D,M_1,\dots, M_D$ \\
$\widehat{\varepsilon}^*_{k}:= \widehat{\eta}_{k}$ & $\varepsilon^*_{k}$ & (c) & $\sqrt{\frac{\widehat{w}_{k}}{D}},\;\mbox{where}\;\widehat{w}_{k}:=\frac{\sum_{i=1}^{D} (\widehat{\eta}_{i,k} - \widehat{\varepsilon}^*_{k})^2}{D-1}$ & $D$ \\
\noalign{\hrule height 1.0pt}
\end{tabular}
\caption{Table of basic estimates of expected loss, with confidence intervals. First column = definition of the estimate. Second column = the quantity which is estimated by the estimate. Third column = which future data scenario (f.d.s.) estimate and confidence intervals give a guarantee for. Fourth column = standard error estimate (normal approximation) for the estimate in the first column, e.g., to construct frequentist confidence intervals. Fifth column = quantities governing central limit theorem (CLT) asymptotics for the confidence intervals.}
\label{table:perfest}
\end{table}
Table~\ref{table:perfest} presents a number of expected loss estimates with proposed standard error estimates. As all estimates are mean estimates of independent (or conditionally independent) quantities, normal approximated, two-sided confidence intervals may be obtained for any of the quantities in the standard way, i.e., at $\alpha$ confidence as the interval
$$[\widehat{\theta} + \Phi^{-1}(\alpha/2) \widehat{SE}, \widehat{\theta} - \Phi^{-1}(\alpha/2) \widehat{SE}]$$
where $\widehat{\theta}$ is the respective (mean) estimate and $\widehat{SE}$ is the corresponding standard error estimate.
Note that different estimates and confidence intervals arise through the different future data scenarios that the guarantee is meant to cover - see Sections~\ref{subsection:loss_functions} and~\ref{sec:theory.performance} for a detailed explanation how precisely the future data scenarios differ in terms of re-fitting/re-using the prediction functional, and obtaining performance guarantees for predictive use on an unseen/seen data source.
In particular, choosing a different future data scenario may affect the confidence intervals even though the midpoint estimate is the same: the midpoint estimates $\widehat{\varepsilon}^*_{k}$ and $\widehat{\varepsilon}_{k}$ coincide, but the confidence intervals for future data scenario (c), i.e., new data source and the strategy is re-fitted, are usually wider than the confidence intervals for the future data scenario (a), i.e., already seen data source and no re-fitting of the strategy.
Technically, all expected loss estimates proposed in Table~\ref{table:perfest} are (conditional) mean estimates. The confidence intervals for $\widehat{\eta}_{i,k}$ and $\widehat{\varepsilon}^*_{k}$ are obtained as standard confidence intervals for a (conditionally) independent sample mean: $\widehat{\varepsilon}^*_{k}$ is considered to be the mean of the independent samples $\widehat{\eta}_{i,k}$ (varying over $i$). $\eta_{i,k}$ is considered to be the mean of the conditionally independent samples $L_{j,k}^{(i)}$ (varying over $j$, and conditioned on $f_{i,k}$). Confidence intervals for $\widehat{\eta}_{k}$ are obtained averaging the estimated variances of independent summands $\widehat{\eta}_{i,k}$, which corresponds to the plug-in estimate obtained from the equality $\operatorname{Var}(\widehat{\eta}_{k}) = \frac{1}{D^2}\sum_{i=1}^{D} \operatorname{Var}(\widehat{\eta}_{i,k})$ (all variances conditional on the $f_{i,k}$).
\subsection{Aggregate based performance quantifiers and confidence intervals}
For aggregate based performance quantifiers, performances and their confidence intervals are estimated from the sample of loss/score evaluates. We will denote the elements in this sample by $L_{k}^{(i)}:=L(\hat{Y}_{\star,k}^{(i)},Y_{\star}^{(i)})$ (for notation on RHS see Section~\ref{sec:theory.performance.aggr}). We note that unlike in the case of average based evaluation, there is no running index for the test set data point, only indices $i$ for the data set and $k$ for the prediction strategy.
\begin{table}[h]
\centering
\begin{tabular}{|c | c c | c c |}
\noalign{\hrule height 1.0pt}
estimate & estimates & f.d.s. & standard error estimate & CLT in\\
\noalign{\hrule height 1.0pt}
$\widehat{\varepsilon}^*_{k}:= \frac{1}{D}\sum_{i=1}^D L_{k}^{(i)}$ & $\varepsilon^*_{k}$ & (c) & $\sqrt{\frac{\widehat{w}_{k}}{D}},\;\mbox{where}\;\widehat{w}_{k}:=\frac{\sum_{i=1}^{D} (L_{k}^{(i)} - \widehat{\varepsilon}_{k}^*)^2}{D-1}$ & $D$ \\
\noalign{\hrule height 1.0pt}
\end{tabular}
\caption{Table of basic estimates of expected loss, with confidence intervals. First column = definition of the estimate. Second column = the quantity which is estimated by the estimate. Third column = which future data scenario (f.d.s.) estimate and confidence intervals give a guarantee for. Fourth column = standard error estimate (normal approximation) for the estimate in the first column, e.g., to construct frequentist confidence intervals. Fifth column = quantities governing central limit theorem (CLT) asymptotics for the confidence intervals.}
\label{table:perfestaggr}
\end{table}
Table~\ref{table:perfestaggr} presents one estimate of expected loss estimates with proposed standard error estimate, for future data situation (c), i.e., generalization of performance to a new dataset. Even though there is only a single estimate, we present it in a table for concordance with Table~\ref{table:perfest}. An confidence interval at $\alpha$ confidence is obtained as
$$[\widehat{\varepsilon}_{k}^* + \Phi^{-1}(\alpha/2) \widehat{w}_{k}, \widehat{\varepsilon}_{k}^* - \Phi^{-1}(\alpha/2) \widehat{w}_{k}].$$
The mean and variance estimates are obtained from standard theory of mean estimation, by the same principle as $\widehat{\varepsilon}^*_{k}$ for average based estimates.
Estimates for situations (a) may be naively constructed from multiple test sets of the same size, or obtained from further assumptions on $L$ via re-sampling, though we abstain from developing such an estimate as it does not seem to be common - or available - at the state-of-art.
\subsection{Rank based performance quantifiers}
\label{Sec:benchmarking.rank}
mlaut has functionality to compute rankings based on any average or aggregate performance statistic, denoted $L$ below. I.e., for any choice of $L$, the following may be computed.
As in Section~\ref{sec:theory.performance.rank}, define $L_{k}^{(i)}:=L(\hat{Y}_k^{(i)},Y_{j}^{(i)})$ in the case the raw statistic being an average, and $L_{k}^{(i)}:=L(\hat{Y}_{\star,k}^{(i)},Y_{\star}^{(i)})$ in case it is an aggregate. Denote by $R_k^{(i)}$ the order rank of $L_{k}^{(i)}$ within the tuple $(L_{1}^{(i)},\dots, L_{K}^{(i)})$.
\begin{table}[h]
\centering
\begin{tabular}{|c | c c | c c |}
\noalign{\hrule height 1.0pt}
estimate & estimates & f.d.s. & standard error estimate & CLT in\\
\noalign{\hrule height 1.0pt}
$\widehat{r}_{k}= \frac{1}{D}\sum_{i=1}^D R_{k}^{(i)}$ & $r_k$ & (c) & $\sqrt{\frac{\widehat{\nu}_{k}}{D}},\;\mbox{where}\;\widehat{\nu}_{k}:=\frac{\sum_{i=1}^{D} (L_{k}^{(i)} - \widehat{r}_{k})^2}{D-1}$ & $D$ \\
$z_{k,k'} = \widehat{r}_{k} - \widehat{r}_{k'}$ & $r_k - r_{k'}$ & (c) &
$\frac{z_{k,k'}\cdot \sqrt{6D}}{\sqrt{K(K+1)}}$ & $K,D$\\
\noalign{\hrule height 1.0pt}
\end{tabular}
\caption{Table of basic estimates of average rank, with confidence intervals. First column = definition of the estimate. Second column = the quantity which is estimated by the estimate. Third column = which future data scenario (f.d.s.) estimate and confidence intervals give a guarantee for. Fourth column = standard error estimate (normal approximation) for the estimate in the first column, e.g., to construct frequentist confidence intervals. Fifth column = quantities governing central limit theorem (CLT) asymptotics for the confidence intervals.}
\label{table:perfestrank}
\end{table}
Table~\ref{table:perfestrank} presents an average rank estimates and an average rank difference estimate, for future data situation (c), i.e., generalization of performance to a new dataset.\\
The average rank estimate and its standard error is based on the central limit theorem in the number of data sets. The average rank difference estimate is Nem\'enyi's critical difference as referred to in~\cite{demsar_statistical_2006} which is used in visualizations.
\subsection{Statistical tests for method comparison}\label{subsection:statistical_tests}
While the methods in previous sections compute performances with confidence bands, they do not by themselves allow to compare methods in the sense of ruling out that differences are due to randomness (with the usual statistical caveat that this can never be ruled out entirely, but the plausibility can be quantified).
mlaut implements significance tests for two classes of comparisons: absolute performance differences, and average rank differences, in future data scenario (c), i.e., with a guarantee for the case where the strategy is re-fitted to a new data source.
mlaut's selection follows closely, and our exposition below follows loosely, the work of~\cite{demsar_statistical_2006}. While the latter is mainly concerned with classifier comparison, there is no restriction-in-principle to leverage the same testing procedures for quantitative comparison with respect to arbitrary (average or aggregate) raw performance quantifiers.
\subsubsection{Performance difference quantification}
The first class of tests we consider quantifies, for a choice of aggregate or average loss $L$, the significance of average differences of expected generalization performances, between two strategies $k$ and $k'$.
The meanings of ``average'' and ``significant'' may differ, and so does the corresponding effect size - these are made precise below.
All the tests we describe are based on the paired differences of performances, where the pairing considered is the pairing through datasets. That is, on dataset $i$, there are performances of strategy $k$ and $k'$ which are considered as a pair of performances.
For the paired differences, we introduce abbreviating notation $\Delta_{k,k'}^{(i)}:= \widehat{\eta}_{i,k} - \widehat{\eta}_{i,k'}$ if the performance is an average loss/score, and $\Delta_{k,k'}^{(i)}:= L^{(i)}_{k}-L^{(i)}_{k'}$ if the loss is an aggregate loss/score. Non-parametric tests below will also consider the ranks of the paired differences, we will write $\Lambda_{k,k'}^{(i)}$ for the rank of $\Delta_{k,k'}^{(i)}$ within the sample $(\Delta_{k,k'}^{(1)},\dots, \Delta_{k,k'}^{(D)})$, i.e., taking values between $1$ and $D$.\\
We denote by $\Delta_{k,k'}^{(*)}$ and $\Lambda_{k,k'}^{(*)}$ the respective population versions, i.e., the performance difference on a random future dataset, as in scenario (c).
\begin{table}[h]
\centering
\begin{tabular}{|c | c | c c c |}
\noalign{\hrule height 1.0pt}
name & tests null & e.s.(raw) & e.s.(norm) & stat.\\
\noalign{\hrule height 1.0pt}
paired t-test & $\ensuremath{\mathbb{E}} [\Delta_{k,k'}^{(*)}] \overset{?}{=} 0$ &
$\overline{\Delta}_{k,k'} := \frac{1}{D}\sum_{i=1}^D \Delta_{k,k'}^{(i)}$
& $d_{k,k'}:=\frac{\overline{\Delta}_{k,k'}}{\sqrt{\widehat{v}_{k,k'}}},$ where
& $t_{k,k'}:= \sqrt{D}\cdot d_{k,k'}$\\
& & & $\widehat{v}_{k,k'} = \frac{\sum_{i=1}^D (\Delta_{k,k'}^{(i)} - \overline{\Delta}_{k,k'})^2}{D-1}$ & \\
\noalign{\hrule height 1.0pt}
Wilcoxon & $\mbox{med} [\Lambda_{k,k'}^{(*)}] \overset{?}{=} 0$ &
$w_{k,k'}:= $
& & \\
signed-rank t.& & $\frac{1}{D}\sum_{i=1}^D \Lambda_{k,k'}^{(i)}\operatorname{sgn} (\Delta_{k,k'}^{(i)})$
& $\rho_{k,k'}:=\frac{2 w_{k,k'}}{D+1} $ & $W_{k,k'}:= D\cdot w_{k,k'}$\\
\noalign{\hrule height 1.0pt}
\end{tabular}
\caption{Table of pairwise comparison tests for benchmark comparison. name = name of the testing procedure. tests null = the null hypothesis that is tested by the testing procedure. e.s.(raw) = the corresponding effect size, in raw units. e.s.(norm) = the corresponding effect size, normalized. stat. = the test statistic which is used in computation of significance. Symbols are defined as in the previous sections.}
\label{table:testsdiff}
\end{table}
Table~\ref{table:testsdiff} lists a number of common testing procedures. The significances may be seen as guarantees for future data situation (c). The normalized effect size for the paired t-test comparing the performance of strategies $k$ and $k'$, the quantity $d_{k,k'}$ in Table~\ref{table:testsdiff}, is called Cohen's d(-statistic) for paired samples (to avoid confusion in comparison with literature, it should be noted that Cohen's d-statistic also exists for unpaired versions of the t-test which we do not consider here in the context of performance comparison). The normalized effect size for the Wilcoxon signed-rank test, the quantity $\rho_{k,k'}$, is called biserial rank correlation, or rank-biserial correlation.
It should also be noted that the Wilcoxon signed-rank test, while making use of rank differences, is not a pairwise comparison of strategies' performance ranks - this is a common misunderstanding. While ``ranks'' appear in both concepts, the ranks in the Wilcoxon signed-rank tests are the ranks of the performance differences, pooled \emph{across} data sets, while in a rank based performance quantifier, the ranking of different methods' performances (not differences) \emph{within} a data sets (not across data sets) is considered.
The above tests are implemented for one-sided and two-sided alternatives. See~\cite{ross_introductory_2010}, \cite{demsar_statistical_2006}, or~\cite{wilcoxon_individual_1945} for details.
Portmanteau tests for the above may be based on parametric ANOVA, though~\cite{demsar_statistical_2006}
recommends avoiding these due to the empirical asymmetry and non-normality of loss distributions. Hence for multiple comparisons, mlaut implements Bonferroni and Bonferroni-Holm significance correction based post-hoc testing.
In order to compare the performance of the prediction functions $f$ one needs to perform statistical tests on the output produced by $L(f(X^*), Y^*)$. Below we enumerate the statistical tests that can be employed to assess the results produced by the loss functions $L$ as described in \ref{subsection:loss_functions}.
\subsubsection{Performance rank difference quantification}
Performance rank based testing uses the observed performance ranks $R_k^{(i)}$ of the $k$-th strategy, on the $i$-th data set. These are defined as above in Section~\ref{Sec:benchmarking.rank}, of which we keep notation, including notation for the average rank estimate $\widehat{r}_{k}= \frac{1}{D}\sum_{i=1}^D R_{k}^{(i)}$. We further introduce abbreviating notation for rank differences, $S_{k,k'}^{(i)}:= R_k^{(i)} - R_{k'}^{(i)}$.
\begin{table}[h]
\centering
\begin{tabular}{|c | c | c c c |}
\noalign{\hrule height 1.0pt}
name & tests null & e.s.(raw) & e.s.(norm) & stat.\\
\noalign{\hrule height 1.0pt}
sign test & $\ensuremath{\mathbb{E}}[\operatorname{sgn} (R^{(*)}_k-R^{(*)}_{k'})] \overset{?}{=} 0$ &
$S_{k,k'} := \sum_{i=1}^D S_{k,k'}^{(i)}$
& $z_{k,k'}:= \frac{\sqrt{D}\cdot S_{k,k'}}{\sqrt{D^2-S_{k,k'}^2}}$
& $p_{k,k'}:= \frac{D+S_{k,k'}}{2D}$\\
\noalign{\hrule height 1.0pt}
Friedman & $r_k-r_{k'} \overset{?}{=} 0$ &
$Q:= $
& & \\
test& (for some $k,k'$) &
$\frac{12D}{K(K+1)}\sum_{k=1}^K (\widehat{r}_{k} - \frac{K+1}{2})^2$
& \multicolumn{2}{c|}{$F := \frac{(D-1)Q}{D(K-1) - Q} $}\\
\noalign{\hrule height 1.0pt}
\end{tabular}
\caption{Table of pairwise comparison tests for benchmark comparison. name = name of the testing procedure. tests null = the null hypothesis that is tested by the testing procedure. e.s.(raw) = the corresponding effect size, in raw units. e.s.(norm) = the corresponding effect size, normalized. stat. = the test statistic which is used in computation of significance. Symbols are defined as in the previous sections.}
\label{table:testsdiffrank}
\end{table}
Table~\ref{table:testsdiffrank} describes common testing procedures which may both be seen as tests for a guarantee of expected rank difference $r_k - r_{k'}$ in future data scenario (c). The sign test is a binomial test regarding the proportion $p_{k,k'}$ being significantly different from $\frac{1}{2}$. In case of ties, a trinomial test is used.
The implemented version of the Friedman test uses the F-statistic (and not the Q-statistic aka chi-squared-statistic) as described in~\cite{demsar_statistical_2006}.
For post-hoc comparison and visualization of average rank differences, mlaut implements the combination of Bonferroni and studentized rannge multiple testing correction with Nem\'enyi's confidence intervals, as described in~\ref{Sec:benchmarking.rank}.
\section{Introducing MLaut}
\label{sec:intro}
MLaut~\cite{mlaut_2018} is a modelling and workflow toolbox in python, written with the aim of simplifying large scale benchmarking of machine learning strategies, e.g., validation, evaluation and comparison with respect to predictive/task-specific performance or runtime. Key features are:
\begin{enumerate}
\itemsep-0.2em
\item[(i)] automation of the most common workflows for benchmarking modelling strategies on multiple datasets including statistical post-hoc analyses, with user-friendly default settings
\item[(ii)] unified interface with support for scikit-learn strategies, keras deep neural network architectures, including easy user extensibility to (partially or completely) custom strategies
\item[(iii)] higher-level meta-data interface for strategies, allowing easy specification of scikit-learn pipelines and keras deep network architectures, with user-friendly (sensible) default configurations
\item[(iv)] easy setting up and loading of data set collections for local use (e.g., data frames from local memory, UCI repository, openML, Delgado study, PMLB)
\item[(v)] back-end agnostic, automated local file system management of datasets, fitted models, predictions, and results, with the ability to easily resume crashed benchmark experiments with long running times
\end{enumerate}
MLaut may be obtained from pyPI via \texttt{pip install mlaut}, and is maintained on GitHub at \texttt{github.com/alan-turing-institute/mlaut}. A Docker implementation of the package is available on Docker Hub via \texttt{docker pull kazakovv/mlaut}.
\subsection*{Note of caution: time series and correlated/associated data samples}
MLaut implements benchmarking functionality which provides statistical guarantees under assumption of either independent data samples, independent data sets, or both. This is mirrored in Section~\ref{sec:theory.setting} by the crucial mathematical assumptions of statistical independence (i.i.d.~samples), and is further expanded upon in Section~\ref{sec:theory.performance}.\\
{\bf In particular, it should be noted that naive application of the validation methodology implemented in MLaut to samples of time series, or other correlated/associated/non-independent data samples (within or between datasets), will in general violate the validation methodologies' assumptions, and may hence result in misleading or flawed conclusions about algorithmic performance.}\\
The BSD license under which MLaut is distributed further explicitly excludes liability for any damages arising from use, non-use, or mis-use of MLaut (e.g., mis-application within, or in evaluation of, a time series based trading strategy).
\subsection{State-of-art: modelling toolbox and workflow design}
\label{sec:intro.toolboxes}
A hierarchy of modelling designs may tentatively be identified in contemporary machine learning and modelling ecosystems, such as the python data science environment and the R language:
\begin{enumerate}
\itemsep-0.2em
\item[Level 1.] implementation of specific methodology or a family of machine learning strategies, e.g., the most popular packages for deep learning, Tensorflow \cite{martin_abadi_tensorflow:_2015}, MXNet \cite{chen_mxnet:_2015}, Caffe \cite{shelhamer_caffe_nodate} and CNTK \cite{seide_cntk:_2016}.
\item[Level 2.] provision of a unified interface for methodology solving the same ``task'', e.g., supervised learning aka predictive modelling. This is one core feature of the Weka~\cite{jagtap_census_2013}, scikit-learn~\cite{pedregosa_scikit-learn:_2011} and Shogun~\cite{sonnenburg_shogun_2010} projects which both also implement level 1 functionality, and main feature of the caret~\cite{wing_caret:_2018} and mlr~\cite{bischl_mlr:_2016} packages in R which provides level 2 functionality by external interfacing of level 1 packages.
\item[Level 3.] composition and meta-learning interfaces such as tuning and pipeline building, more generally, first-order operations on modelling strategies. Packages implementing level 2 functionality usually (but not always) also implement this, such as the general hyper-parameter tuning and pipeline composition operations found in scikit-learn and mlr or its mlrCPO extension. Keras~\cite{chollet_keras_2015} has abstract level 3 functionality specific to deep learning, Shogun possesses such functionality specific to kernel methods.
\item[Level 4.] workflow automation of higher-order tasks performed with level 3 interfaces, e.g., diagnostics, evaluation and comparison of pipeline strategies. Mlr is, to our knowledge, the only existing modelling toolbox with a modular, class-based level 4 design that supports and automates re-sampling based model evaluation workflows. The Weka GUI and module design also provides some level 4 functionality.\\
A different type of level 4 functionality is automated model building, closely linked to but not identical with benchmarking and automated evaluation - similarly to how, mathematically, model selection is not identical with model evaluation. Level 4 interfaces for automated model building also tie into level 3 interfaces, examples of automated model building are implemented in auto-Weka~\cite{hall2009weka}, auto-sklearn~\cite{feurer2015efficient}, or extensions to mlrCPO~\cite{thomas2018automatic}.
\end{enumerate}
In the Python data science environment, to our knowledge, there is currently no widely adopted solution with level 4 functionality for evaluation, comparison, and benchmarking workflows. The reasonably well-known skll~\cite{skll} package provides automation functionality in python for scikit-learn based experiments but follows an unencapsulated scripting design which limits extensibility and usability, especially since it is difficult to use with level 3 functionality from scikit-learn or state-of-art deep learning packages.
Prior studies conducting experiments which are level 4 use cases, i.e., large-scale benchmarking experiments of modelling strategies, exist for supervised classification, such as \cite{fernandez-delgado_we_2014, wainer_comparison_2016}. Smaller studies, focusing on a couple of estimators trained on a small number of datasets have also been published \cite{huang_comparing_2003}.
However, to the best of our knowledge: none of the authors released a toolbox for carrying out the experiments; code used in these studies cannot be directly applied to conduct other machine learning experiments; and, deep neural networks were not included as part of the benchmark exercises.
At the current state-of-art, hence, there is a distinct need for level 4 functionality in the scikit-learn and keras ecosystems. Instead of re-creating the mlr interface or following a GUI-based philosophy such as Weka, we have decided to create a modular workflow environment which builds on the particular strengths of python as an object oriented programming language, the notebook-style user interaction philosophy of the python data science ecosystem, and the contemporary mathematical-statistical state-of-art with best practice recommendations for conducting formal benchmarking experiments - while attempting to learn from what we believe works well (or not so well) in mlr and Weka.
\subsection{Scientific contributions}
MLaut is more than a mere implementation of readily existing scientific ideas or methods. We argue that the following contributions, outlined in the manuscript, are scientific contributions closely linked to its creation:
\begin{enumerate}
\itemsep-0.2em
\item[(1)] design of a modular ``level 4'' software interface which supports the predictive model validation/comparison workflow, a data/model file input/output back-end, and an abstraction of post-hoc evaluation analyses, at the same time.
\item[(2)] a comprehensive overview of the state-of-art in statistical strategy evaluation, comparison and comparative hypothesis testing on a collection of data sets. We further close gaps in said literature by formalizing and explicitly stating the kinds of guarantees the different analyses provide, and detailing computations of related confidence intervals.
\item[(3)] as a principal test case for MLaut, we conducted a large-scale supervised classification study in order to benchmark the performance of a number of machine learning algorithms, with a key sub-question being whether more complex and/or costly algorithms tend to perform better on real-world datasets. On the representative collection of UCI benchmark datasets, kernel methods and random forests perform best.
\item[(4)] as a specific but quite important sub-question we empirically investigated whether common off-shelf deep learning strategies would be worth considering as a default choice on the ``average'' (non-image, non-text) supervised learning dataset. The answer, somewhat surprising in its clarity, appears to be that they are not - in the sense that alternatives usually perform better. However, on the smaller tabular datasets, the computational cost of off-shelf deep learning architectures is also not as high as one might naively assume. This finding is also subject to a major caveat and future confirmation, as discussed in Section~\ref{subsection:estimators.keras} and Section~\ref{subsection:conclusions}.
\end{enumerate}
Literature relevant to these contribution will be discussed in the respective sections.
\subsection{Overview: usage and functionality}
\label{subsec:ease_of_use}
We present a short written demo of core MLaut functionality and user interaction, designed to be convenient in combination with jupyter notebook or scripting command line working style. Introductory jupyter notebooks similar to below may be found as part of MLaut's documentation~\cite{mlaut_2018}.
The first step is setting up a database for the dataset collection, which has to happen only once per computer and dataset collection, and which we assume has been already stored in a local MLaut HDF5 database. The first step in the core benchmarking workflow is to define hooks to the database input and output files:
\begin{lstlisting}[language=Python]
input_io = data.open_hdf5(...) #path to input HDF5 file
out_io = data.open_hdf5(...) #path to output HDF5 file
\end{lstlisting}
After the hooks are created we can proceed to preparing fixed re-sampling splits (training/test) on which all strategies are evaluated. By default MLaut creates a single evaluation split with a uniformly sampled $\dfrac{2}{3}$ of the data for training and $\dfrac{1}{3}$ for testing.
\begin{lstlisting}[language=Python]
data.split_datasets(hdf5_in=..., hdf5_out=..., dataset_paths=...)
\end{lstlisting}
For a simple set-up, a standard set of estimators that come with sensible parameter defaults can be initialized. Advanced commands allow to specify hyper-parameters, tuning strategies, keras deep learning architectures, scikit-learn pipelines, or even fully custom estimators.
\begin{lstlisting}[language=Python]
est = ['RandomForestClassifier','BaggingClassifier']
estimators = instantiate_default_estimators(estimators=est)
>>> estimators
<mlaut.estimators.ensemble_estimators.Random_Forest_Classifier>
<mlaut.estimators.ensemble_estimators.Bagging_Classifier>
\end{lstlisting}
The user can now proceed to running the experiments. Training, prediction and evaluation are separate; partial results, including fitted models and predictions, are stored and retrieved through database hooks. This allows intermediate analyses, and for the experiment to easily resume in case of a crash or interruption. If this happens, the user would simply need to re-run the code above and the experiment will continue from the last checkpoint, without re-executing prior costly computation.
\begin{lstlisting}[language=Python]
>>> orchest.run(modelling_strategies=estimators)
RandomForestClassifier trained on dataset 1
RandomForestClassifier trained on dataset 2
...
\end{lstlisting}
The last step in the pipeline is executing post-hoc analyses for the benchmarking experiments. The \code{AnalyseResults} class allows to specify performance quantifiers to be computed and comparison tests to be carried out, based on the intermediate computation data, e.g., predictions from all the strategies.
\begin{lstlisting}[language=Python]
analyze.prediction_errors(score_accuracy, estimators)
\end{lstlisting}
The \code{prediction\_errors()} method returns two sets of results: \code{errors\_per\_estimator} dictionary which is used subsequently in further statistical tests and \code{errors\_per\_dataset \_per\_estimator\_df} which is a dataframe with the loss of each estimator on each dataset that can be examined directly by the user.
We can also use the produced errors in order to perform the statistical tests for method comparison. The code below shows an example of running a t-test.
\begin{lstlisting}[language=Python]
_, t_test_df = analyze.t_test(errors_per_estimator)
>>> t_test_df
Estimator 1 Estimator 2
t_stat p_val t_stat p_val
Estimator 1 ... ... ... ...
Estimator 2 ... ... ... ...
...
\end{lstlisting}
Data frames or graphs resulting from the analyses can then be exported, e.g., for presentation in a scientific report.
\subsection*{Authors contributions}
MLaut is part of VK's PhD thesis project, the original idea being suggested by FK. MLaut and this manuscript were created by VK, under supervision by FK. The design of MLaut is by VK, with suggestions by FK. Sections~\ref{sec:intro}, \ref{sec:theory} and~\ref{Sec:benchmarking} were substantially edited by FK before publication, other sections received only minor edits (regarding content). The benchmark study of supervised machine learning strategies was conducted by VK.
\subsection*{Acknowledgments}
We thank Bilal Mateen for critical reading of our manuscript, and especially for suggestions of how to improve readability of Section~\ref{sec:theory.performance}.
FK acknowledges support by The Alan Turing Institute under EPSRC grant EP/N510129/1.
\section{Using MLaut to Compare the Performance of Classification Algorithms}
As an major test use case for MLaut, we conducted a large-scale benchmark experiment comparing a selection of off-shelf classifiers on datasets from the UCI Machine Learning Repository. Our study had four main aims:
\begin{enumerate}
\itemsep-0.2em
\item[(1)] stress testing the MLaut framework on scale, and observing the user interaction workflow in a major test case.
\item[(2)] replicating the key points of the experimental set-up by~\cite{fernandez-delgado_we_2014}, while avoiding their severe mistake of tuning on the test set.
\item[(3)] including deep learning methodology to the experiment.
\end{enumerate}
Given the above, the below benchmarking study is, to the best of our knowledge, the first large-scale supervised classification study which\footnote{in the disjunctive sense: i.e., to the best of our knowledge, the first large-scale benchmarking study which does \emph{any} of the above rather than being only the first study to do \emph{all} of the above.}:
\begin{enumerate}
\itemsep-0.2em
\item[(a)] is correctly conducted via out-of-sample evaluation and comparison. This is since~\cite{fernandez-delgado_we_2014} commit the mistake of tuning on the test set, as it is even acknowledged in their own Section 3 Results and Discussion.
\item[(b)] includes contemporary deep neural network classification approaches, and is conducted on a broad selection of classification data sets which is not specific to a special domain such as image classification (the UCI dataset collection).
\end{enumerate}
We intend to extend the experiment in the future by including further dataset collections and learning strategies.
Full code for our experiments, including random seeds, can be found as a jupyter notebook in MLaut's documentation~\cite{mlaut_2018}.
\subsection{Hardware and software set-up}
The benchmark experiment was conducted on a Microsoft Azure VM with 16 CPU cores and 32 GB of RAM, by our Docker virtualized implementation of MLaut. The experiments ran for about 8 days. MLaut requires Python 3.6 and should be installed in a dedicated virtual environment in order to avoid conflicts or the Docker implementation should be used. The full code for running the experiments and the code for generating the results in results Appendix~\ref{section:statistical_appendix} can be found in the examples directory in the \href{https://github.com/alan-turing-institute/mlaut/blob/master/examples/mlaut_study.zip}{GitHub repository} of the project.
\subsection{Experimental set-up}
\label{subsection:expsetup}
\subsubsection{Data set collection}
The benchmarking study uses the same dataset collection as employed by~\cite{fernandez-delgado_we_2014}. This collection consists of 121 tabular datasets for supervised classification, taken directly from the UCI machine learning repository. Prior to the experiment, each dataset was standardized, such that each individual feature variable has a mean of 0 and a standard deviation of 1.
The dataset collection of~\cite{fernandez-delgado_we_2014} intends to be representative of a wide scope of basic real-world classification problems. It should be noted that this representative cross-section of simple classification tasks \emph{excludes} more specialized tasks such as image, audio, or text/document classification which are usually regarded to by typical applications of deep learning, and for which deep learning is also the contemporary state-of-art.
For a detail description of the~\citet{fernandez-delgado_we_2014} data collection, see section~2.1 there.
\subsubsection{Re-sampling for evaluation}
Each dataset is in split into exactly one pair of training and test set. The training sets are selected, for each data set, uniformly at random\footnote{independently for each dataset in the collection} as (a rounded) $\frac{2}{3}$ of the available data sample; the remaining $\frac{1}{3}$ in the dataset form the test set on which the strategies are asked to make predictions. Random seeds and the indices of the exact splits were saved to ensure reproducibility and post-hoc scrutiny of the experiments.
The training set may (or may not) be further split by the contender methods for tuning - as stated previously in Section~\ref{sec:theory}, this is not enforced as part of the experimental set-up\footnote{Unlike in the set-up of~\cite{fernandez-delgado_we_2014} which, on top of doing so, is also faulty.}, but is left to each learning strategy to deal with internally, and will be discussed in the next section. In particular, none of the strategies have access to the test set for tuning or training.
\subsection{Evaluation and comparison}
We largely followed the procedure suggested by \cite{demsar_statistical_2006} for the analysis of the performance of the trained estimators.
For all classification strategies, the following performance quantifiers are computed per dataset:
\begin{enumerate}
\itemsep-0.2em
\item misclassification loss
\item rank of misclassification loss
\item runtime
\end{enumerate}
Averages of these are computed, with standard errors for future data situation (c: re-trained, on unseen dataset). In addition, for the misclassification loss on each data set, standard errors for future data situation (a: re-used, same dataset) are computed.
The following pairwise comparisons between samples of performances by dataset are computed:
\begin{enumerate}
\itemsep-0.2em
\item paired t-test on misclassification losses, with Bonferroni correction
\item (paired) Wilcoxon signed rank on misclassification losses, with Bonferroni correction
\item Friedman test on ranks, with Nem\'enyi's significant rank differences and post-hoc significances
\end{enumerate}
Detail descriptions of these may be found in Section~\ref{Sec:benchmarking}.
\subsection{Benchmarked machine learning strategies}
\label{subsection:estimators}
Our choice of classification strategies is not exhaustive, but is meant to be representative of off-shelf choices in the \textit{scikit-learn} and \textit{keras} packages. We intend to extend the selection in future iterations of this study.
From \textit{scikit-learn}, the suite of standard off-shelf approaches includes linear models, Naive Bayes, SVM, ensemble methods, and prototype methods.
We used \textit{keras} to construct a number of neural network architectures representative of the state-of-art. This proved a challenging task due to the lack of explicitly recommended architectures for simple supervised classification to be found in literature.
\subsubsection{Tuning of estimators}
It is important to note that the off-shelf choices and their default parameter settings are often not considered good or state-of-art: hyper-parameters in \textit{scikit-learn} are by default not tuned, and there are no default \textit{keras} that come with the package.
For \textit{scikit-learn} classifiers, we tune parameters using \textit{scikit-learn}'s \texttt{GridSearchCV} wrapper-compositor (which never looks at the test set by construction).
In all cases of tuned methods, parameter selection in the inner tuning loop is done via grid tuning by 5-fold cross-validation, with respect to the default \textit{score} function implemented at the estimator level. For classifiers as in our study, the default tuning score is mean accuracy (averaged over all 5 tuning test folds in the inner cross-validation tuning loop), which is equivalent to tuning by mean misclassification loss.
The tuning grids will be specified in Section~\ref{subsection:estimators.sklearn} below.
For \textit{keras} classifiers, we built architectures by interpolating general best practice recommendations in scientific literature~\cite{ojha_metaheuristic_2017}, as well as based on concrete designs found in software documentation or unpublished case studies circulating on the web. We further followed the sensible default choices of \textit{keras} whenever possible.
The specific choices for neural network architecture and hyper-parameters are specified in Section~\ref{subsection:estimators.keras} below.
\subsubsection{Off-shelf scikit-learn supervised strategies}
\label{subsection:estimators.sklearn}
\begin{enumerate}[label=\roman*)]
\item Algorithms that do not have any tunable hyperparameters
\desestim{sklearn.dummy.DummyClassifier}
{None}
{This classifier is a naive/uninformed baseline and always predicts the most frequent class in the training set (``majority class''). This corresponds to the choice of the \textit{most\_frequent} parameter.}
\desestim{sklearn.naive\_bayes.BernoulliNB}{None}{Naive Bayes classifier for multivariate Bernoulli models. This classifier assumes that all features are binary, if not they are converted to binary. For reference please see \cite{bishop_pattern_2006} Chapter 2.}
\desestim{sklearn.naive\_bayes.GaussianNB}
{None}
{Standard implementation of the Naive Bayes algorithm with the assumption that the features are Gaussian. For reference please see \cite{bishop_pattern_2006} Chapter 2. }
\item Linear models
\desestim{sklearn.linear\_model.PassiveAggressiveClassifier}
{\code{C}: array of 13 equally spaced numbers on a log scale in the range $[10^{-2};10^{10}]$ \code{scikit-learn} default: 1}
{Part of the online learning family of models based on the \textit{hinge loss} function. This algorithm observes feature-value pairs $z$ in sequential manner. After each observation the algorithm makes a prediction, checks the correct value and calibrates the weights. For further reference see \cite{crammer_online_2006}.}
\item Clustering Algorithms
\desestim{sklearn.neighbors.KNeighborsClassifier}
{\code{n\_neighbors=[1;30]}, \code{scikit-learn} default: 5
\code{p=[1,2], \code{scikit-learn} default:2}
}
{The algorithm uses a majority vote of the nearest neighbours of each data point to make a classification decision. For reference see \cite{cover_nearest_1967} and \cite{bishop_pattern_2006}, Chapter 2.}
\item Kernel Methods
\desestim{sklearn.svm.SVC}{
C: array of 13 equally spaced numbers on a log scale in the range $[2^{-5};2^{15}]$, \code{scikit-learn} default: 1.
gamma: array of 13 equally spaced numbers on a log scale in the range $[2^{-15};2^{3}]$, \code{scikit-learn} default: auto
}
{This estimator is part of the Support Vector family of algorithms. In this study, we use the Gaussian kernel only. For reference see \cite{cortes_support-vector_1995} and \cite{bishop_pattern_2006}, Chapter 7. The performance of support vector machine is very sensitive with respect to tuning parameters:
\begin{itemize}
\item \textbf{C}, the regularization parameter. There does not seem to be a consensus in the community regarding the space for the C hyper-parameter search. In an example\footnote{At the time of writing this paper the example was available on this link: \linkA}
the \code{scikit-learn} documentation refers to an initial hyper-parameter search space for C in the range $[10^{-2};10^{10}]$ \cite{scikit-learn_model_2018}. However, a different example\footnote{At the time of writing this paper the example was available on this link: \linkB} suggests $[1,10,100,1000]$. A third \code{scikit-learn} example\footnote{At the time of writing this paper the example was available on this link: \linkC} suggests testing for both the linear and rbf kernels and broad values for the C and $\gamma$ parameters. Other researches \cite{hsu_practical_2016} suggest to use apply a search for C in the range $[2^{-5}; 2^{15}]$ which we used in our study as it provides a good compromise between reasonable running time and comprehensiveness of the search space.
\item \textbf{$\gamma$}, the inverse kernel bandwith. The \code{scikit-learn} example\footnote{At the time of writing this paper the example was available on this link: \linkA} \cite{scikit-learn_model_2018} suggests hyper-parameter search space for $\gamma$ in the range $[10^{-9};10^3]$. However, a second \code{scikit-learn} example\footnote{At the time of writing this paper the example was available on this link: \linkB} suggest to search only in $[0.0001, 0.001]$. On the other hand, \cite{hsu_practical_2016} suggest searching for $\gamma$ in the range $[2^{-15}; 2^{3}]$ which again we found to be the middle ground and applied in our study.
\end{itemize}
}
\item Ensemble Methods
The three main models that we used in this study that are part of this family are the RandomForest, Bagging and Boosting. The three models are built around the logic of using the predictions of a large number of weak estimators, such as decision trees. As such they share a lot of the same hyperparameters. Namely, some of the main parameters for this family of models are the number of estimators, max number of features and the maximum tree depth, default values for each estimator which are suggested in the \code{scikit-learn} package. Recent research \cite{probst_tunability:_2018} and informal consensus in the community suggest that the performance gains from deviating from the default parameters are rewarded for the Boosting algorithm but tend to have limited improvements for the RandomForest algorithm. As such, for the purposes of this study we will focus our efforts to tune the Boosting and Bagging algorithms but will use a relatively small parameter search space for tuning RandomForest.
\desestim{sklearn.ensemble.GradientBoostingClassifier}
{number of estimators: $[10, 50, 100]$, \code{scikit-learn} default: 100.
max depth: integers in the range $[1;10]$, \code{scikit-learn} default: 3.
}
{Part of the ensemble meta-estimators family of models. We used the default sklearn \textit{deviance} loss. The algorithm fits a series of decision trees on the data and predictions are made based on a majority vote. At each iteration the data is modified by applying weights to it and predictions are made again. At each iteration the weights of the incorrectly $x,y$ pairs are increased (boosted) and decreased for the correctly predicted pairs.
As per the \code{scikit-learn} documentation \cite{scikit-learn_model_2018} This estimator is not recommended for datasets with more than two classes as it requires the introduction of regression tress at each iteration. The suggested approach is to use the RandomForest algorithm instead. A lot of the datasets used in this study are multiclass supervised learning problems. However, for the purposes of this study we will use the Gradient Boosting algorithm in order to see how it performs when benchmarked to the suggested approach. For reference see \cite{friedman_greedy_2001} and \cite{efron_computer_2016}, Chapter 17.}
\desestim{sklearn.ensemble.RandomForestClassifier}
{For this study we used the following hyperparameter grid:
number of estimators: $[10, 50, 100]$, \code{scikit-learn} default: 10
max features: [auto, sqrt, log2, None], \code{scikit-learn} default: auto
max depth: $[10, 100, \text{ None}]$, \code{scikit-learn} default: None
}
{Part of the ensemble meta-estimators family of models. The algorithm fits decision trees on sub-samples of the dataset. The average voting rule is used for making predictions. For reference see \cite{breiman_random_2001} and \cite{efron_computer_2016}, Chapter 17.}
\desestim{sklearn.ensemble.BaggingClassifier}
{number of estimators: $[10, 50, 100]$, \code{scikit-learn} default: 10}
{Part of the ensemble meta-estimators family of models. The algorithm draws with replacement feature-label pairs $(x,y)$, trains decision base tree estimators and makes predictions based on voting or averaging rules. For reference see \cite{breiman_bagging_1996} and \cite{efron_computer_2016}, Chapter 17.}
\end{enumerate}
\subsubsection{Keras neural network architectures including deep neural networks}
\label{subsection:estimators.keras}
We briefly summarize our choices for hyper-parameters and architecture.
\begin{itemize}
\item \textbf{Architecture}. Efforts have been made to make the choice of architectures less arbitrary by suggesting algorithms for finding the optimal neural network architecture \cite{gupta_optimizing_2018}. Other researches have suggested good starting points and best practices that one should adhere to when devising a network architecture \cite{hasanpour_lets_2016, sansone_training_2017}. We also followed the guidelines of \cite{goodfellow_deep_2016}, in particular Chapter 6.4. The authors conducted an empirical study and showed that the accuracy of networks increases as the number of layers grow but the gains are diminishing rapidly beyond 5 layers. These findings are also confirmed by other studies \cite{ba_deep_2013} that question to need to use very deep feed-forward networks. In general, the consensus in the community seems to be that 2-4 hidden layers are sufficient for most feed-forward network architectures.
One notable exception to this rule seem to be convolutional network architecture which have been showed to perform best when several sequential layers are stacked one after the other. However, this study does \emph{not} make use of convolutional neural networks, as our data is not suitable for these models, in particular because there is no well-specified way to transform samples into a multidimensional array form.
The architectures are given below as their keras code specification.
\item \textbf{Activation function}. We used the rectified linear unit (ReLu) as our default choice of activation function as has been found to accelerate convergence and is relatively inexpensive to perform \cite{krizhevsky_imagenet_2017}.
\item \textbf{Regularization}. We employ the current state-of-art in neural network regularization: dropout. In the absence of clear rules when and where dropout should be applied, we include two versions of each neural network in the study: one version \emph{not} using dropout, and one using dropout. Dropout regularization is as described by~\citet{hinton_improving_2012, srivastava_dropout:_2014} where its potential for improving the generalization accuracy of neural networks is shown. We used a dropout rate of 0.5 as suggested by the authors.
\item \textbf{Hyper-parameter tuning}. We did not perform grid search to find the optimal hyper parameters for the network. The reason for this is two-fold. We interfaced the neural network models from \textit{keras}. The \textit{keras} interface is not fully compatible with \textit{scikit learn's GridSearch}, nor does it provide easy off-shelf tuning facilities (see subsection ~\ref{subsection:estimators_module} for details).
Furthermore, using grid search tuning does not seem to be considered common practice by the community, and it is even actively recommended to avoid by some researchers~\cite{bergstra_random_2012}, hence might not be considered a fair representation of the state-of-art. Instead, the prevalent practice seems to be manual tuning of hyper-parameters based on learning curves.
Following the latter in the absence of off-shelf automation, we manually tuned learning rate, batch size, and number of epochs by manual inspection of learning curves and performances on the full \emph{training sets} (see below).
\item \textbf{Learning Rate}. The learning rate is one of the crucial hyper-parameter choices when training neural networks. The generally accepted rule to find the optimal rate is to start with a large rate and if the training process does not diverge decrease the learning rate by a factor of 3~\cite{bengio_practical_2012}. This approach is confirmed by~\cite{srivastava_dropout:_2014} who also affirm that a larger learning rate can be used in conjunction with dropout without risking that the weights of the model blow out.
\item \textbf{Batch Size}. The datasets used in the study were relatively small and could fit in the memory of the machine that we used for training the algorithms. As a result we set the batch size to equal the entire dataset which is equivalent to full gradient descent.
\item \textbf{Number of epochs}. We performed manual hyper-parameter selection by inspection of individual learning curves for all combinations of learning rate and architecture. For this, learning curves on individual data sets' training samples were inspected visually for the ``plateau range'' (range of minimal training error). For all architectures, and most data sets, the plateau was already reached for \emph{one single epoch}, and training error usually tended to increase in the range of 50-500 epochs. The remaining, small number of datasets (most of which were of 4-or-above-digit sample size) plateaued in the 1-digit range.\\
While this is a \emph{very surprising finding} as it corresponds to a single gradient descent step, \emph{it is what we found}, while following what we consider the standard manual tuning steps for neural networks. We further discuss this in Section~\ref{subsection:exp.disc} and acknowledge that \emph{this surprising finding warrants further investigation}, e.g., through checking for mistakes, or including neural networks tuned by automated schemes.\\
Thus, all neural networks architectures were trained for \emph{one single epoch} - since choosing a larger (and more intuitive number of epochs) would have been somewhat arbitrary, and not in concordance with the common manual tuning protocol.
\end{itemize}
For the keras models, we adopted six neural network architectures with varying depths and widths. Our literature review revealed that there is no consistent body of knowledge or concrete rules pertaining to constructing neural network models for simple supervised classification (as opposed to image recognition etc). Therefore, we extrapolated from general best practice guidelines as applicable to our study, and also included (shallow) network architectures that were previously used in benchmark studies. The full \textit{keras} architecture of the neural networks used are listed below.\\
\desestim{keras.models.Sequential}
{batch size: None, learning rate: $[1, 0.01, 0.001]$, loss: mean squared error, optimizer: Adam, metrics: accuracy.}
{Own architecture of Deep Neural Network model applying the principles highlighted above. For this experiment we made used of the empirical evidence that networks of 3-4 layers were sufficient to learn any function discussed in \cite{ba_deep_2013}. However, we opted for a slightly narrower network in order to investigate whether wider nets tend to perform better than narrow ones.
\lstinputlisting[language=Python]{deep_nn_4_layer_thin_dropout.py}}
\desestim{keras.models.Sequential}
{batch size: None, learning rate: $[1, 0.01, 0.001]$, loss: mean squared error, optimizer: Adam, metrics: accuracy.}
{In this architecture we experimented with the idea that wider networks perform better than narrower ones. No dropout was performed in order to test the idea that regularization is necessary for all deep neural network models.
\lstinputlisting[language=Python]{deep_nn_4_layer_wide_no_dropout.py}}
\desestim{keras.models.Sequential}
{batch size: None, learning $[1, 0.01, 0.001]$, loss: mean squared error, optimizer: Adam, metrics: accuracy.}
{We tested the same architecture as above but applying dropout after the first two layers.
\lstinputlisting[language=Python]{deep_nn_4_layer_wide_with_dropout.py}}
\desestim{keras.models.Sequential}
{batch size: None, learning rate: $[1, 0.01, 0.001]$, loss: mean squared error, optimizer: Adam, metrics: accuracy.}
{Deep Neural Network model inspired from architecture suggested by \cite{sansone_training_2017}:
\lstinputlisting[language=Python]{deep_nn_12_layer_wide_with_dropout.py}}
\desestim{keras.models.Sequential}
{batch size: None, learning rate: $[1,0.01, 0.001]$, loss: mean squared error, optimizer: Adam, metrics: accuracy.}
{Deep Neural Network model suggested in \cite{hinton_improving_2012} with the following architecture:
\lstinputlisting[language=Python]{keras_nn_4_layer_wide_dropout_each_layer.py}}
\desestim{keras.models.Sequential}
{batch size: None, learning rate: $[1,0.01, 0.001]$, loss: mean squared error, optimizer: Adam, metrics: accuracy.}
{Deep Neural Network model suggested in \cite{srivastava_dropout:_2014} with the following architecture:
\lstinputlisting[language=Python]{deep_nn_2_layer_dropout_input_layer.py}}
\subsection{Results}
Table~\ref{table:average_performance_estimators} shows an summary overview of results.
\begin{table}[h!]
\centering
\input{tables/avg_metrics.tex}
\caption{Columns are: average rank (lower is better), classification accuracy, standard error of average score (version c) and training time of the prediction strategy. Performances are estimated as described in Section~\ref{subsection:expsetup}. Rows correspond to prediction strategies, increasingly ordered by their average rank. Naming for sklearn estimators is as in Section~\ref{subsection:estimators.sklearn}. Naming of keras estimators is as in Section~\ref{subsection:estimators.keras}, followed by a string \texttt{dropout} or \texttt{no\_dropout} indicating whether dropout was used, and by a string \texttt{lr} and some number indicating the choice of learning rate.} \label{table:average_performance_estimators}
\end{table}
Figure~\ref{fig:boxchart_results} summarizes the samples of performances in terms of classification accuracy. The sample is performance by method, ranging over data sets, averaged over the test sample within each dataset - i.e., the size of the sample of performance equals the number of data sets in the collection.
\begin{figure}[h!]
\centering
\includegraphics[scale=0.7]{boxchart_results}
\caption{Box-and-whiskers plot of samples of classification accuracy performances classification accuracy by method, ranging over data sets, averaged over the test sample within each dataset. y-axis is classification accuracy. x-axis correspond to prediction strategies, ordered by mean classification accuracy. Naming for sklearn estimators is as in Section~\ref{subsection:estimators.sklearn}. Naming of keras estimators is as in Section~\ref{subsection:estimators.keras}, followed by a string \texttt{dropout} or \texttt{no\_dropout} indicating whether dropout was used, and by a string \texttt{lr} and some number indicating the choice of learning rate. Whisker length is limited at 1.5 times interquartile range.} \label{fig:boxchart_results}
\end{figure}
The Friedman test was significant at level p=2e-16. Figure~\ref{fig:nemeniy_test_critical_distance} displays effect sizes, i.e., average ranks with Nem\'enyi's post-hoc critical differences.
\begin{figure}[h!]
\centering
\includegraphics[scale=0.7]{critical_diff}
\caption{Nem\'enyi post-hoc critical differences comparison diagram after~\cite{demsar_statistical_2006}. CD = critical average rank difference range. x-axis displays average rank (lower is better). Indicated x-axis location = average ranks of prediction strategy, with strategies of below-critical average rank difference connected by a bar. Naming for sklearn estimators is as in Section~\ref{subsection:estimators.sklearn}. Naming of keras estimators is as in Section~\ref{subsection:estimators.keras}, followed by a string \texttt{dropout} or \texttt{no\_dropout} indicating whether dropout was used, and by a string \texttt{lr} and some number indicating the choice of learning rate. Note that for the sake of readability, the worst performing neural networks were removed from the plot. } \label{fig:nemeniy_test_critical_distance}
\end{figure}
From all the above, the top five algorithms among the contenders were the Random Forest, SVC, Bagging, K Neighbours and Gradient Boosting classifiers.
Further benchmarking results may be found in the automatically generated Appendix~\ref{section:statistical_appendix}. These include results of paired t-tests and Wilcoxon signed rank tests. Briefly summarizing these: Neither t-test (Appendix~\ref{table:t_test}), nor the Wilcoxon signed rank test (Appendix~\ref{table:wilcoxon}), with Bonferroni correction (adjacent strategies and all vs baseline), in isolation, are able to reject the null hypothesis of a performance difference between any two of the top five performers.
\subsection{Discussion}
\label{subsection:exp.disc}
We discuss our findings below, including a comparison with the benchmarking study by~\citet{fernandez-delgado_we_2014}.
\subsubsection{Key findings}
In summary, the key findings of the benchmarking study are:
\begin{enumerate}
\itemsep-0.2em
\item[(i)] MLaut is capable of carrying out large-scale benchmarking experiments across a representative selection of off-shelf supervised learning strategies, including state-of-art deep learning models, and a selection of small-to-moderate-sized basic supervised learning benchmark data sets.
\item[(ii)] On the selection of benchmark data sets representative for basic (non-specialized) supervised learning, the best performing algorithms are ensembles of trees and kernel-based algorithms. Neural networks (deep or not) perform poorly in comparison.
\item[(iii)] Of the algorithms benchmarked, grid-tuned support vector classifiers are the most demanding of computation time. Neural networks (deep or not) and the other algorithms benchmarked require computation time in a comparable orders of magnitude.
\end{enumerate}
\subsubsection{Limitations}
The main limitations of our study are:
\begin{enumerate}
\itemsep-0.2em
\item[(i)] restriction to the Delgado data set collection. Our study is at most as representative for the methods' performance as the Delgado data set collection is for basic supervised learning.
\item[(ii)] training the neural networks for one epoch only. As described in~\ref{subsection:estimators.keras} we believe we arrived at this choice following standard tuning protocol, but it requires further investigation, especially to rule out a mistake - or to corroborate evidence of a potential general issue of neural networks with basic supervised learning (i.e., not on image, audio, text data etc).
\item[(iii)] A relative small set of prediction strategies. While our study is an initial proof-of-concept for MLaut on commonly used algorithms, it did not include composite strategies (e.g., full pipelines), or the full selection available in state-of-art packages.
\end{enumerate}
\subsubsection{Comparison to the study of Delgado et al}
In comparison to the benchmarking study of~\citet{fernandez-delgado_we_2014}, for most algorithms we find comparable performances which are within 95\% confidence bands (of ours). A notable major departure is performance of the neural networks, which we find to be substantially worse. The latter finding may be plausibly explained by at least one of the following:
\begin{enumerate}
\itemsep-0.2em
\item[(i)] an issue-in-principle with how we tuned the neural networks - e.g., a mistake; or a difference to how the neural networks were tuned by~\citet{fernandez-delgado_we_2014}. However, it appears that~\citet{fernandez-delgado_we_2014} used default settings.
\item[(ii)] an overly optimistic bias of~\citet{fernandez-delgado_we_2014}, through their mistake of tuning on the test set. This bias would be expected to be most severe for the models with most degrees of freedom to tune - i.e., the neural networks.
\end{enumerate}
In additional comparison, the general rankings (when disregarding the neural networks) are similar. Though, since a replication of rankings is dependent on conducting the study on exactly the same set of strategies, we are only able to state this qualitatively. Conversely, our confidence intervals indicate that rankings in general are very unstable on the data set collection, as roughly a half of the 179 classifiers which~\citet{fernandez-delgado_we_2014} benchmarked seem to be within 95\% confidence ranges of each other.
This seems to highlight the crucial necessity of reporting not only performances but also confidence bands, if reasoning is to be conducted about which algorithmic strategies are the ``best'' performing ones.
\subsubsection{Conclusions}
\label{subsection:conclusions}
Our findings corroborate most of the findings of the major existing benchmarking study of~\citet{fernandez-delgado_we_2014}. In addition, we validate the usefulness of MLaut to easily conduct such a study.
As a notable exception to this confirmation of results, we find that neural networks do not perform well on ``basic'' supervised classification data sets. While it may be explained by a bias that~\citet{fernandez-delgado_we_2014} introduced into their study by the mistake of tuning on the test set, it is still under the strong caveat that further investigation needs to be carried out, in particular with respect to the tuning behaviour of said networks, and our experiment not containing other mistakes.
However, if further investigation confirms our findings, it would be consistent with the findings of one of the original dropout papers~\cite{srivastava_dropout:_2014}, in which the authors also conclude that the improvements are more noticeable on image datasets and less so on other types of data such as text. For example, the authors found that the performance improvements achieved on the Reuters RCV1 corpus were not significant in comparison with architectures that did not use dropout.
Furthermore, at least in our study we found no evidence to suggest that deep architectures performed better than shallow ones. In fact the 12 layer deep neural network architecture ranked just slightly better than our baseline classifier. Our findings also may suggest that wide architectures tend to perform better than thin ones on our training data.
It should also be pointed out that the datasets we used in this experiment were relatively small in size. Therefore, it could be argued that deep neural networks can easily overfit such data, the default parameter choices and standard procedures are not appropriate - especially since such common practice may arguably be strongly adapted to image/audio/text data.
In terms of training time, the SVC algorithm proved to be the most expensive, taking on average almost 30 min to train in our set-up. However, it should be noted that this is due to the relatively large hyper-parameter search space that we used. On the other hand, among the top five algorithms the Bagging Classifier was one of the least expensive ones to train taking an average of only 5 seconds. Our top performer, the Random Forest Classifier, was also relatively inexpensive to train taking an average of only 14 seconds.
As our main finding, however, we consider the ease with which a user may generate the above results, using MLaut. The reader may (hopefully) convince themselves of this by inspecting the code and jupyter notebooks in the repository \href{https://github.com/alan-turing-institute/mlaut/blob/master/examples/mlaut_study.zip}.
We are also very appreciative of any criticism, or suggestions for improvement, made (say, by an unconvinced reader) through the project's issue tracker.
\section{Benchmarking supervised learning strategies on multiple datasets - generative setting}
\label{sec:theory}
This section introduces the mathematical-statistical setting for the mlaut toolbox - supervised learning on multiple datasets. Once the setting is introduced, we are able to describe the suite of statistical benchmark post-hoc analyses that mlaut implements, in Section~\ref{Sec:benchmarking}. \\
\subsection{Informal workflow description}
Informally, and non-quantitatively, the workflow implemented by mlaut is as follows: multiple prediction strategies are applied to multiple datasets, where each strategy is fitted to a training set and queried for predictions on a test set. From the test set predictions, performances are computed: performances by dataset, and also overall performances across all datasets, with suitable confidence intervals. For performance across all datasets, quantifiers of comparison (``is method A better than method B overall?'') are computed, in the form statistical (frequentist) hypothesis tests, where p-values and effect sizes are reported.\\
The remainder of this Section~\ref{sec:theory} introduces the \emph{generative setting}, i.e., statistical-mathematical formalism for the data sets and future situations for which performance guarantees are to be obtained. The reporting and quantification methodology implemented in the mlaut package is described in Section~\ref{Sec:benchmarking} in mathematical language, usage and implementation of these in the mlaut package is described in Section~\ref{sec:api}.\\
From a statistical perspective, it should be noted that only a single train/test split is performed for validation. This is partly due to simplicity of implementation, and partly due to the state-of-art's incomplete understanding of how to obtain confidence intervals or variances for re-sampled performance estimates. Cross-validation strategies may be supported in future versions.\\
A reader may also wonder about whether, even if there is only a single set of folds, should there not be three folds per split (or two nested splits), into tuning-train/tuning-test/test\footnote{What we call the ``tuning-test fold'' is often, somewhat misleadingly, called a ``validation fold''. We believe the latter terminology is misleading, since it is actually the final test fold which validates the strategy, not second fold.}. The answer is: yes, if tuning via re-sample split of the training set is performed. However, in line with current state-of-art understanding and interface design, tuning is considered as part of the prediction strategy. That is, the tuning-train/tuning-test split is strategy-intrinsic. Only the train/test split is extrinsic, and part of the evaluation workflow which mlaut implements; a potential tuning split is encapsulated in the strategy. This corresponds with state-of-art usage and understanding of the wrapper/composition formalism as implemented for example with GridSearchCV in sklearn.
\subsection{Notational and mathematical conventions}
To avoid confusion between quantities which are random and non-random, we always explicitly say if a quantity is a random variable. Furthermore, instead of declaring the type of a random variable, say $X$, by writing it out as a measurable function $X:\Omega\rightarrow \mathcal{X}$, we say ``$X$ is a random variable taking values in $\mathcal{X}$'', or abbreviated ``$X$ t.v.in $\mathcal{X}$'', suppressing mention of the probability space $\Omega$ which we assume to be the same for all random variables appearing.
This allows us easily to talk about random variables taking values in certain sets of functions, for example a prediction functional obtained from fitting to a training set.
Formally, we will denote the set of functions from a set $\mathcal{X}$ to a set $\mathcal{Y}$ by the type theoretic arrow symbol $\mathcal{X} \rightarrow \mathcal{Y}$, where bracketing as in $[\mathcal{X}\rightarrow \mathcal{Y}]$ may be added for clarity and disambiguation. E.g., to clarify that we consider a function valued random variable $f$, we will say for example ``let $f$ be a random variable t.v.in $[\mathcal{X}\rightarrow \mathcal{Y}]$''.
An observant reader familiar with measure theory will notice a potential issue (others may want to skip to the next sub-section): the set $[\mathcal{X}\rightarrow \mathcal{Y}]$ is, in general, not endowed with a canonical measure. This is remedied as follows: if we talk about a random variable taking values in $[\mathcal{X}\rightarrow \mathcal{Y}]$, it is assumed that the image of the corresponding measurable function $X: \Omega \rightarrow [\mathcal{X}\rightarrow \mathcal{Y}]$, which may not be all of $[\mathcal{X}\rightarrow \mathcal{Y}]$, is a measurable space. This is, for example, the case we substitute training data random variables in a deterministic training functional $f$, which canonically endows the image of $f$ with the substitution push-forward measure.
\subsection{Setting: supervised learning on multiple datasets}
\label{sec:theory.setting}
We introduce mathematical notation to describe $D$ datasets, and $K$ prediction strategies.
As running indices, we will consistently use $i$ for the $i^{th}$ dataset, $j$ for $j^{th}$ (training or test) data point in a given data set, and $k$ for the $k^{th}$ estimator.
The data in the $i$-th dataset are assumed to be sampled from mutually independent, generative/population random variables $(X^{(i)},Y^{(i)})$, taking values in feature-label-pairs $\mathcal{X}^{(i)} \times \mathcal{Y}$, where either $\mathcal{Y} = \ensuremath{\mathbb{R}}$ (regression) or $\mathcal{Y}$ is finite (classification). In particular we assume that the label type is the same in all datasets.
The actual data are i.i.d.~samples from the population $(X^{(i)},Y^{(i)})$, which for notational convenience we assume to be split into a training set $\mathcal{D}_i = \left((X_{tr,1}^{(i)}, (X_{tr,1}^{(i)}), \dots, ((X_{tr,N_i}^{(i)}, (X_{tr,N_i}^{(i)})\right)$ and a test set $\mathcal{T}_i = \left((X_{1}^{(i)}, Y_{1}^{(i)}), \dots, (X_{M_i}^{(i)}, Y_{M_i}^{(i)})\right).$ Note that the training and test set in the $i$-th dataset are, formally, not ``sets'' (as in common diction) but ordered tuples of length $N_i$ and $M_i$. This is for notational convenience which allows easy reference to single data points.
By further convention, we will write $Y_{\star}^{(i)} := \left(Y_{1}^{(i)},\dots, Y_{M_i}^{(i)}\right)$ for the ordered tuple of test labels.
On each of the datasets, $K$ different prediction strategies are fitted to the training set: these are formalized as random prediction functionals $f_{i,k}$ t.v.in $[\mathcal{X}^{(i)} \rightarrow \mathcal{Y}]$, where $i=1\dots D$ and $k=1\dots K$. We interpret $f_{i,k}$ as the fitted prediction functional obtained from applying the $k$-th prediction strategy on the $i$-th dataset where it is fitted to the training set.
Statistically, we make mathematical assumptions to mirror the reasonable intuitive assumptions that there is no active information exchange between different strategies, a copies of a given strategy applied to different data sets: we assume that the random variable $f_{i,k}$ may depend on the training set $\mathcal{D}_i$, but is independent of all other data, i.e., the test set $\mathcal{T}_i$ of the $i$-th dataset, and training and test sets of all the other datasets. It is further assumed that $f_{i,k}$ is independent of all other fitted functionals $f_{i',k'}$ where $i'\neq i$ and $k'$ is entirely arbitrary. It is also assumed that $f_{i,k}$ is conditionally independent of all $f_{i,k'},$ where $k'\neq k$, given $\mathcal{D}_i$.
We further introduce notation for predictions $\hat{Y}_{j,k}^{(i)} := f_{i,k}(X_{j}^{(i)}),$ i.e., $\hat{Y}_{j,k}^{(i)}$ is the prediction made by the fitted prediction functional $f_{i,k}$ for the actually observed test label $Y_{j}^{(i)}$.
For convenience, the same notation is introduced for the generative random variables, i.e., $\hat{Y}_{k}^{(i)} := f_{i,k}(X^{(i)}).$
Similarly, we denote by $\hat{Y}^{(i)}_{\star,k}:=(\hat{Y}^{(i)}_{1,k},\dots, \hat{Y}^{(i)}_{M_i,k})$ the random vectors of length $M_i$ whose entries are predictions for full test sample, made by method $k$.
\subsection{Performance - which performance?}
\label{sec:theory.performance}
Benchmarking experiments produce performance and comparison quantifiers for the competitor methods. It is important to recognise that these quantifiers are computed to create guarantees for the methods' use on putative \emph{future data}. These guarantees are obtained based on mathematical theorems such as the central limit theorem, applicable under empirically justified assumptions. It is crucial to note that mathematical theorems allow establishing performance guarantees on future data, despite the future data not being available to the experimenter at all. It is also important to note that the future data for which the guarantees are created are different from, and in general not identical to, the test data.
Contrary to occasional belief, performance on the test data in isolation is empirically not useful: without a guarantee it is unrelated to the argument of algorithmic effectivity the experimenter wishes to make.
While a full argument usually \emph{does }involve computing performance on a statistically independent test set, the argumentative reason for this best practice is more subtle than being of interest by itself. It is a consequence of ``prediction'' performance on the training data not being be a fair proxy for performance on future data. Instead, ``prediction'' on an unseen (statistically independent) test set is a fair(er) proxy, as it allows for formation of performance guarantees on future data: the test set being unseen allows to leverage the central limit theorems for this purpose.
In benchmark evaluation, it is hence crucial to make precise the relation between the testing setting and the application case on future data - there are two key types of distinctions on the future data application case:
\begin{enumerate}
\itemsep-0.2em
\item[(i)] whether in the scenario, a fitted prediction function is to be re-used, or whether it is re-fitted on new data (potentially from a new data source).
\item[(ii)] whether in the scenario, the data source is identical with the source of one of the observed datasets, or whether the source is merely a source from the same population as the data sources observed.
\end{enumerate}
Being precise about these distinctions is, in fact, practically crucial: similar to the best practice of not testing on the training set, one needs to be careful about whether a \emph{data source}, or a \emph{fitted strategy} that will occur in the future test case has already been observed in the benchmarking experiment, or not.
We make the above mathematically precise (a reader interested only in an informal explanation may first like skip forward to the subsequent paragraph).
To formalize ``re-use'', distinction (i) translates to conditioning on the fitted prediction functionals $f_{i,k}$, or not. Conditioning corresponds to prior observation, hence having observed the outcome of the fitting process, therefore ``re-using'' $f_{i,k}$. Not doing so corresponds to sampling again from the random variable, hence ``re-fitting''.
To formalize the ``data source'' distinction, we will assume an i.i.d.~process $P$ (taking values in joint distributions over $\mathcal{X}^{(i)} \times \mathcal{Y}$ also selected at random), generating distributions according to which population laws are distributed, i.e., $P_1,\dots, P_D \sim P$ is an i.i.d.~sample. The $i$-th element of this sample, $P_i$ is the (generating) data source for the $i$-th data set i.e., $(X^{(i)},Y^{(i)})\sim P_i$. We stress that $P_i$ takes values in distributions, i.e., $P_i$ is a distribution which is itself random\footnote{Thus, the symbol $\sim$ is used here in its common ``distribution'' and not ``distribution of random variable'' meaning which are usually confounded by abuse of notation} and from which data are generated.
In this mathematical setting, the distinction (ii) then states whether the guarantee applies for data sampled from $(X^{(i)},Y^{(i)})$ with a specific $i$, or instead data sampled from $(X^{*},Y^{*})\sim P.$ The former is ``data from the already observed $i$-th source, the latter is ``data from a source similar to, but not identical to, the observed source''.
If the latter is the case, the same generative principle is applied to yield a prediction functional $f_{*,k}$, drawn i.i.d.~from a hypothetical generating process which yielded the $f_{i,k}$ on the $i$-th dataset. We remain notationally consistent by defining $\hat{Y}_k^{*}:=f_{*,k}(X^{*}).$
For {\bf intuitive} clarity, let us consider an {\bf example}: three supervised classification methods, a random forest, logistic regression, and the baseline ``predicting the majority class'' are benchmarked on 50 datasets, from 50 hospitals, one dataset corresponding to observations in exactly one hospital. Every dataset is a sample of patients (data frame rows) for which as variables (data frame rows) the outcome (= prediction target and data frame column) therapy success yes/no for a certain disease is recorded, plus a variety of demographic and clinical variables (data frame columns) - where what is recorded differs by hospital.
A benchmarking experiment may be asked to produce a performance quantifier for one of the following three distinct key future data scenarios:
\begin{enumerate}
\itemsep-0.2em
\item[(a)] re-using the trained classifiers (e.g., random forest), trained on the training data of hospital 42, to make predictions on future data observed in hospital 42.
\item[(b)] (re-)fitting a given classifier (e.g., random forest) to new data from hospital 42, to make predictions on further future data observed in hospital 42.
\item[(c)] obtaining future data from a new hospital 51, fitting the classifiers to that data, and using the so fitted classifiers to make predictions on further future data observed from hospital 51.
\end{enumerate}
It is crucial to note that both performances and guarantees may (and in general will) differ between these three scenarios. In hospital 42, a random forests may outperform logistic regression and the baseline, while in hospital 43 nothing outperforms the baseline. The behaviour and ranking of strategies may also be different, depending on whether classifiers are re-used, or re-fitted. This may happen in the same hospital, or when done in an average unseen hospital.
Furthermore, the same qualitative differences as for observed performances may hold for the precision of the statistical guarantees obtained from performances in a benchmarking experiment: the sample size of patients in a given hospital may be large enough or too small to observe a significant difference of performances in a given hospital, while the sample size of hospitals is the key determinant of how reliable statistical guarantees about performances and performance differences for unseen hospitals are.
In the subsequent, we introduce abbreviating {\bf terminology} for denoting the distinctions above: for (i), we will talk about \emph{re-used} (after training once) and \emph{re-trained} (on new data) prediction algorithm. For (ii), we will talk about \emph{seen} and \emph{unseen} data sources. Further, we will refer to the three future data scenarios abbreviatingly by the letters (a), (b), and (c). By terminology, in these scenarios the algorithm is: (a) re-used on seen sources, (b) re-trained on seen sources, and (c) re-trained on an unseen source (similar to but not identical to seen sources).
It should be noted that it is impossible to re-use an algorithm on an unseen source, by definition of the word ``unseen'', hence the hypothetical fourth combination of the two dichotomies re-used/re-trained and unseen/seen is logically impossible.
\subsection{Performance quantification}
Performance of the prediction strategy is measured by a variety of quantifiers which compare predictions for the test set with actual observations from the test set, the ``ground truth''. Three types of quantifiers are common:
\begin{enumerate}
\itemsep-0.2em
\item[(i)] Average loss based performance quantifiers, obtained from a comparison of one method's predictions and ground truth observations one-by-one. An example is the mean squared error on the test set, which is the average squared loss.
\item[(ii)] Aggregate performance quantifiers, obtained from a comparison of all of a given method's predictions with all of the ground truth observations. Examples are sensitivity or specifity.
\item[(iii)] Ranking based performance quantifiers, obtained from relative performance ranks of multiple methods, from a ranked comparison against each other. These are usually leveraged for comparative hypothesis tests, and may or may not involve computation of ranks based on average or aggregate performances as in (i) and (ii). Examples are the Friedman rank test to compare multiple strategies.
\end{enumerate}
The three kinds of performance quantifiers are discussed in more detail below.
\subsubsection{Average based performance quantification}
\label{subsection:loss_functions}
\label{sec:theory.performance.avg}
For this, the most widely used method is a loss (or score) function $L: \mathcal{Y}\times\mathcal{Y} \rightarrow \ensuremath{\mathbb{R}}$, which compares a single prediction (by convention the first argument) with a single observation (by convention the second argument).
Common examples for such loss/quantifier functions are listed below in Table~\ref{table:lossfunctions}.
\begin{table}[h]
\centering
\begin{tabular}{| c | c | c |}
\noalign{\hrule height 1.0pt}
task & name & loss/quantifier function \\
\noalign{\hrule height 1.0pt}
\multirow{1}{*}{classification (det.)} & MMCE & $L(\widehat{y},y) = 1- \ensuremath{\mathbbm{1}} [y = \widehat{y}]$ \\
\noalign{\hrule height 1.0pt}
\multirow{4}{*}{regression} & squared loss & $L(\widehat{y},y) = (y-\widehat{y})^2$ \\
& absolute loss & $L(\widehat{y},y) = |y-\widehat{y}|$ \\
& Q-loss & $L(\widehat{y},y) = \alpha\cdot m (\widehat{y},y) + (1-\alpha)\cdot m(y,\widehat{y})$ \\
& & where $m(x,z)=\min(x-z,0)$ \\
\noalign{\hrule height 1.0pt}
\end{tabular}
\caption{List of some popular loss functions to measure prediction goodness (2nd column) used in the most frequent supervised prediction scenarios (1st column). Above, $y$ and $\widehat{y}$ are elements of $\mathcal{Y}$. For classification, $\mathcal{Y}$ is discrete; for regression, $\mathcal{Y}=\ensuremath{\mathbb{R}}$. The symbol $\ensuremath{\mathbbm{1}} [A]$ evaluates to $1$ if the boolean expression $A$ is true, otherwise to $0$.}
\label{table:lossfunctions}
\end{table}
In direct alignment with the different future data scenarios discussed in Section~\ref{sec:theory.performance}, the distributions of three generative random variables are of interest:
\begin{enumerate}
\itemsep-0.2em
\item[(a)] The conditional random variable $L(f_{i,k}(X^{(i)}),Y^{(i)})|f_{i,k} = L(\hat{Y}_k^{(i)},Y^{(i)})|f_{i,k}$, the loss when predicting on future data from the $i$-th data source, when re-using the already trained prediction functional $f_{i,k}$. Note that formally, through conditioning $f_{i,k}$ is implicitly considered constant (not random), therefore reflects re-use of an already trained functional.
\item[(b)] The random variable $L(f_{i,k}(X^{(i)}),Y^{(i)}) = L(\hat{Y}_k^{(i)},Y^{(i)})$, the loss when re-training method $k$ on training data from the $i$-th data source, and predicting labels on future data from the $i$-th data source. Without conditioning, no re-use occurs, and this random variable reflects repeating the whole random experiment including re-training of $f_{i,k}$.
\item[(c)] The random variable $L(f_{*,k}(X^{*}),Y^{*}) = L(\hat{Y}_k^{*},Y^{*})$, the loss when training method $k$ on a completely new data source, and predicting labels on future data from the same source as that dataset.
\end{enumerate}
The distributions of the above random variables are generative, hence unknown. In practice, the validation workflow estimates summary statistics of these. Of particular interest in the mlaut workflow are related expectations, i.e., (arithmetic) population average errors. We list them below, suppressing notational dependency on $L$ for ease of notation:
\begin{enumerate}
\itemsep-0.2em
\item[(a.1)] $\eta_{i,k} := \ensuremath{\mathbb{E}}[L(\hat{Y}_k^{(i)},Y^{(i)})|f_{i,k}]$, the (training set) \emph{conditional} expected generalization error of (a re-used) $f_{i,k}$, on data source $k$.
\item[(a.2)] $\overline{\eta}_{k} := \frac{1}{D}\sum_{i=1}^D\ensuremath{\mathbb{E}}[L(\hat{Y}_k^{(i)},Y^{(i)})]|(f_{i,k})_{i=1\dots D}$, the \emph{conditional} expected generalization error of the (re-used) $k$-th strategy, averaged over all \emph{seen} data sources.
\item[(b)] $\varepsilon_{i,k} := \ensuremath{\mathbb{E}}[L(\hat{Y}_k^{(i)},Y^{(i)})]$, the \emph{unconditional} expected generalization error of (a re-trained) $f_{i,k}$, on data source $k$.
\item[(c)] $\varepsilon^*_k := \ensuremath{\mathbb{E}}[L(\hat{Y}_k^{*},Y^{*})]$, the expected generalization error on a typical (unseen) data source.
\end{enumerate}
It should be noted that $\eta_{i,k}$ and $\overline{\eta}_{k}$ are random quantities, but conditionally constant once the respective $f_{i,k}$ are known (e.g., once $f_{i,k}$ has been trained). It further holds that $\eta_{i,k} = \ensuremath{\mathbb{E}}[\varepsilon_{i,k}].$\\
The mlaut toolbox currently implements estimators for only two of the above three future data situations - namely, only for situations (a: re-used, seen) and (c: re-trained, unseen), i.e., estimators for all quantities with the exception of $\varepsilon_{i,k}$. The reason for this is that for situation (b: re-trained, seen), at the current state of literature it appears unclear how to obtain good estimates, that is, with provably favourable statistical properties independent of the data distribution or the algorithmic strategy. For situations (a) and (c), classical statistical theory may be leveraged, e.g., mean estimation and frequentist hypothesis testing.
It should also be noted that $\varepsilon_{i,k}$ is a \emph{single dataset} performance quantifier rather than a \emph{benchmark} performance quantifier, and therefore outside the scope of mlaut's core use case. While $\eta_{i,k}$ is also a single dataset quantifier, it is easy to estimate en passant while estimating the benchmark quantifier $\overline{\eta}_{k}$, hence included in discussion as well as in mlaut's functionality.
\subsubsection{Aggregate based performance quantification}
\label{sec:theory.performance.aggr}
A somewhat less frequently used alternative are aggregate loss/score functions $L: (\mathcal{Y}\times\mathcal{Y})^+ \rightarrow \ensuremath{\mathbb{R}}$, which compare a tuple of predictions with a tuple of observations in a way that is not expressible as a mean loss such as in Section~\ref{subsection:loss_functions}. Here, by slight abuse of notation, $(\mathcal{Y}\times\mathcal{Y})^+$ denotes tuples of $\mathcal{Y}$-pairs, of fixed length. The use of the symbol $L$ is discordant with the previous section and assumes a case distinction on whether an average or an aggregate is used.
The most common uses of aggregate performance quantifiers are found in deterministic binary classification, as entries of the classification contingency table. These, and further common examples are listed below in Table~\ref{table:lossfunctionsaggr}.
\begin{table}[h]
\centering
\begin{tabular}{| c | c | c |}
\noalign{\hrule height 1.0pt}
task & name & loss/quantifier function \\
\noalign{\hrule height 1.0pt}
\multirow{4}{*}{classification (det., binary)}
& sensitivity, recall & $L(\widehat{y},y) = \langle y, \widehat{y}\rangle /\|y\|_1$ \\
& specificity & $L(\widehat{y},y) = \langle \ensuremath{\mathbbm{1}}-y, \ensuremath{\mathbbm{1}}-\widehat{y}\rangle /\|1-y\|_1$ \\
& precision, PPV & $L(\widehat{y},y) = \langle y, \widehat{y}\rangle /\|\widehat{y}\|_1$ \\
& F1 score & $L(\widehat{y},y) =2 \langle y, \widehat{y}\rangle /\langle\ensuremath{\mathbbm{1}}, \widehat{y}+ y\rangle$\\
\noalign{\hrule height 1.0pt}
\multirow{1}{*}{regression} & root mean squared error & $L(y,\widehat{y}) = \|y-\widehat{y}\|_2$ \\
\noalign{\hrule height 1.0pt}
\end{tabular}
\caption{List of some popular aggregate performance measues of prediction goodness (2nd column) used in the most frequent supervised prediction scenarios (1st column). Overall, the test sample size is assumed to be $M$. Hence above, both $y$ and $\widehat{y}$ are elements of $\mathcal{Y}^M$. For binary classification, $\mathcal{Y} = \{0,1\}$ without loss of generality, $1$ being the ``positive'' class; for regression, $\mathcal{Y} =\ensuremath{\mathbb{R}}$. By convention, $y$ denotes the true value, and $\widehat{y}$ denotes the prediction. We use vector notation for brevity: $\langle.,.\rangle$ denotes the vector/scalar/inner product, $\|.\|_p$ denotes the $p$-norm, and $\ensuremath{\mathbbm{1}}$ the $M$-vector with entries all equal to the number $1$.}
\label{table:lossfunctionsaggr}
\end{table}
As before, for the different future data scenarios in Section~\ref{sec:theory.performance}, the distributions of three types of generative random variables are of interest. The main complication is that aggregate performance metrics take multiple test points and predictions as input, hence to specify a population performance one must specify a test set size. In what follows, we will fix a specific test set size, $M_i$, for the $i$-th dataset. Recall the notation $Y^{(i)}_{\star}$ for the full vector of test labels on data set $i$. In analogy, we abbreviatingly denote by $\hat{Y}^{(i)}_{\star,k}$ random vectors of length $M_i$ whose entries are predictions for full test sample, made by method $k$, i.e., having as the $j$-th entry to predictions $\hat{Y}^{(i)}_{j,k}$, as introduced in Section~\ref{sec:theory.setting}. Similarly, we denote by $Y^{*}_{\star}$ and $\hat{Y}^{*}_{\star}$ vectors whose entries, are i.i.d.~from the data generating distribution of the new data source, and both of length $M^*$, which is by assumption the sampling distribution of the $M_i$.
The population performance quantities of interest can be formulated in terms of the above:
\begin{enumerate}
\itemsep-0.2em
\item[(a.1)] $\eta_{i,k} := \ensuremath{\mathbb{E}}[L({\hat{Y}}_{\star,k}^{(i)},Y^{(i)}_{\star})|f_{i,k}]$, the (training set) \emph{conditional} expected generalization error of (a re-used) $f_{i,k}$, on data source $k$.
\item[(a.2)] $\overline{\eta}_{k} := \frac{1}{D}\sum_{i=1}^D\ensuremath{\mathbb{E}}[L({\hat{Y}}_{\star,k}^{(i)},Y^{(i)}_{\star})]|(f_{i,k})_{i=1\dots D}$, the \emph{conditional} expected generalization error of the (re-used) $k$-th strategy, averaged over all \emph{seen} data sources.
\item[(b)] $\varepsilon_{i,k} := \ensuremath{\mathbb{E}}[L({\hat{Y}}_{\star,k}^{(i)},Y^{(i)}_{\star})]$, the \emph{unconditional} expected generalization error of (a re-trained) $f_{i,k}$, on data source $k$.
\item[(c)] $\varepsilon^*_k := \ensuremath{\mathbb{E}}[L(\hat{Y}_{\star,k}^{*},Y_{\star}^{*})]$, the expected generalization error on a typical (unseen) data source.
\end{enumerate}
As before, the future data situations are (a: re-used algorithm, seen sources), (b: re-trained, seen), and (c: re-trained, unseen). In the general setting, the expectations in (a) and (b) may or may not converge to sensible values as $M_i$ approaches infinity, depending on properties of $L$. General methods of estimating these depend on availability of test data, which due to the complexities arising and the currently limited state-of-art are outside the scope of mlaut. This unfortunately leaves benchmarking quantity $\overline{\eta}_{k}$ outside the scope for aggregate performance quantifiers. For (c), classical estimation theory of the mean applies.
\subsubsection{Ranking based performance quantification}
\label{sec:theory.performance.rank}
Ranking based approaches consider, on each dataset, a performance ranking of the competitor strategies with respect to a chosen raw performance statistic, e.g., an average or an aggregate performance such as RMSE or F1-score. Performance assessment is then based on the rankings - in the case of ranking, this is most often a comparison, usually in the form of a frequentist hypothesis test.
Due to the dependence of the ranking on a raw performance statistic, it should always be understood that ranking based comparisons are with respect to the chosen raw performance statistic, and may yield different results for different raw performance statistics.
Mathematically, we introduce the population performances in question. Denote $L_{k}^{(i)}:=L(\hat{Y}_k^{(i)},Y_{j}^{(i)})$ in the case the raw statistic being an average, and denote $L_{k}^{(i)}:=L({\hat{Y}}_{\star,k}^{(i)},Y^{(i)})_{\star})$ in case it is an aggregate (on the RHS using notation of the respective previous Sections~\ref{sec:theory.performance.avg} and~\ref{sec:theory.performance.aggr}). The distribution of $L_{k}^{(i)}$ models generalization performance of the $k$-th strategy on the $i$-th dataset.
We further define rankings $R_k^{(i)}$ as the order rank of $L_{k}^{(i)}$ within the tuple $(L_{1}^{(i)},\dots, L_{K}^{(i)})$, i.e., the ranking of the performance $L_{k}^{(i)}$ within all $K$ strategies' performances on the $i$-th dataset.
Of common interest in performance quantification and benchmark comparison are the average ranks, i.e., ranks of a strategy averaged over datasets. The population quantity of interest is the expected average rank on a typical dataset, i.e.,
$r_k := \ensuremath{\mathbb{E}}[R_k^{(*)}],$ where $R_k^{(*)}$ is the population variable corresponding to sample variables $R_k^{(i)}$.
It should be noted that the average rank depends not only on what the $k$-th strategy is or does, but also on the presence of the other $(K-1)$ strategies in the benchmarking study - hence it is not an absolute performance quantifier for a single method, but a relative quantifier, to be seen in the context of the competitor field.
Common benchmarking methodology of the ranking kind quantifies relative performance on the data sets observed in the sense of future data scenario (b) or (c), where the performance is considered including (re-)fitting of the strategies.
| {'timestamp': '2019-01-14T02:21:54', 'yymm': '1901', 'arxiv_id': '1901.03678', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03678'} | arxiv |
\section{Introduction}\label{sec:introduction}}
\else
\section{Introduction}
\label{sec:introduction}
\fi
\IEEEPARstart{T}{his} demo file is intended to serve as a ``starter file''
for IEEE Computer Society journal papers produced under \LaTeX\ using
IEEEtran.cls version 1.8b and later.
I wish you the best of success.
\hfill mds
\hfill August 26, 2015
\subsection{Subsection Heading Here}
Subsection text here.
\subsubsection{Subsubsection Heading Here}
Subsubsection text here.
\section{Conclusion}
The conclusion goes here.
\appendices
\section{Proof of the First Zonklar Equation}
Appendix one text goes here.
\section{}
Appendix two text goes here.
\ifCLASSOPTIONcompsoc
\section*{Acknowledgments}
\else
\section*{Acknowledgment}
\fi
The authors would like to thank...
\ifCLASSOPTIONcaptionsoff
\newpage
\fi
\section{Introduction}
This demo file is intended to serve as a ``starter file''
for IEEE Computer Society conference papers produced under \LaTeX\ using
IEEEtran.cls version 1.8b and later.
I wish you the best of success.
\hfill mds
\hfill August 26, 2015
\subsection{Subsection Heading Here}
Subsection text here.
\subsubsection{Subsubsection Heading Here}
Subsubsection text here.
\section{Conclusion}
The conclusion goes here.
\ifCLASSOPTIONcompsoc
\section*{Acknowledgments}
\else
\section*{Acknowledgment}
\fi
The authors would like to thank...
\section{Introduction}
This demo file is intended to serve as a ``starter file''
for IEEE conference papers produced under \LaTeX\ using
IEEEtran.cls version 1.8b and later.
I wish you the best of success.
\hfill mds
\hfill August 26, 2015
\subsection{Subsection Heading Here}
Subsection text here.
\subsubsection{Subsubsection Heading Here}
Subsubsection text here.
\section{Conclusion}
The conclusion goes here.
\section*{Acknowledgment}
The authors would like to thank...
\section{Introduction}\label{sec:introduction}}
\IEEEPARstart{T}{his} demo file is intended to serve as a ``starter file''
for IEEE Computer Society journal papers produced under \LaTeX\ using
IEEEtran.cls version 1.8b and later.
I wish you the best of success.
\hfill mds
\hfill August 26, 2015
\subsection{Subsection Heading Here}
Subsection text here.
\subsubsection{Subsubsection Heading Here}
Subsubsection text here.
\section{Conclusion}
The conclusion goes here.
\appendices
\section{Proof of the First Zonklar Equation}
Appendix one text goes here.
\section{}
Appendix two text goes here.
\ifCLASSOPTIONcompsoc
\section*{Acknowledgments}
\else
\section*{Acknowledgment}
\fi
The authors would like to thank...
\ifCLASSOPTIONcaptionsoff
\newpage
\fi
\section{Introduction}
\IEEEPARstart{T}{his} demo file is intended to serve as a ``starter file''
for IEEE Communications Society journal papers produced under \LaTeX\ using
IEEEtran.cls version 1.8b and later.
I wish you the best of success.
\hfill mds
\hfill August 26, 2015
\subsection{Subsection Heading Here}
Subsection text here.
\subsubsection{Subsubsection Heading Here}
Subsubsection text here.
\section{Conclusion}
The conclusion goes here.
\appendices
\section{Proof of the First Zonklar Equation}
Appendix one text goes here.
\section{}
Appendix two text goes here.
\section*{Acknowledgment}
The authors would like to thank...
\ifCLASSOPTIONcaptionsoff
\newpage
\fi
\section{Introduction}
\IEEEPARstart{M}{ulti-object}
detection is a vital problem in computer vision, and can be viewed as the cornerstone for instance-level segmentation~\cite{Reference35,Reference11,Reference36} and multi-object tracking~\cite{Reference17,Reference29,Reference18}. In multi-object detection, several objects are usually overlapping with each other as a cluster, which is called co-occurrence~\cite{Reference30,Reference31,Reference32}. The problems that arise with co-occurrence are challenging such as occlusion, illumination changing, texture inconsistency, etc. Among these problems, occlusion is the most notorious issue. Based on whether the clusters of objects belong to the same category or not, the co-occurrence can further be classified into intra-class co-occurrence (also called crowded scene) and inter-class co-occurrence. Because different object categories usually contain different discriminative features, the problem of inter-class co-occurrence is relatively easier to solve than the one of intra-class co-occurrence.
In particular, due to the incredible contribution of deep neural network and huge training data \cite{Reference2,Reference3,Reference4,Reference13}, significant improvements have been achieved in object detection \cite{Reference5,Reference8,Reference9,Reference10,Reference14} based on the extremely accurate per-category classification in recent years, thus inter-class co-occurrence is not a big deal anymore for object detection.
However, intra-class co-occurrence still remains as a challenging problem, and most of the popular detectors fail when they come to multiple overlapping objects in crowded scenes.
\begin{center}
\begin{figure}[t]
\centering
\includegraphics[height=10.0cm,width=8.0cm]{images/post_processing.png}
\caption{Detection proposals to final bounding boxes: for object detection, on the top, (100) detection proposals (generated by Faster-RCNN) detector, will pass through a post-processing step (GreedyNMS is used by default), and acquire the final bounding boxes as shown at the bottom.}
\label{proposal_box}
\end{figure}
\end{center}
In order to understand the essence of the problem brought by intra-class co-concurrence in multi-object detection, it is necessary to know the work principle and evaluation criteria of object detection. With the developments for object detection in many years, in general, a common pipeline for object detection includes three stages: proposals generation, object detection, and post-processing (using GreedyNMS by default)~\cite{Reference21,Reference5,Reference8,Reference9}. Fig~\ref{proposal_box} shows an example from the detection proposal to the final bounding boxes. Meanwhile, for evaluation, Mean Average Precision (MAP) is used as the standard criterion~\cite{Reference12,Reference19}. The reason that detectors fail in crowded scenes is that several objects are often closed by each other and heavily occluded. The post-processing step with GreedyNMS is not suitable in such scenarios as it is only capable of achieving good performance for isolated objects in sparse scenes. Specifically, the de facto used GreedyNMS usually suppresses harshly, leading to many missed detections in crowded scenes. Despite this limitation, GreedyNMS is efficient and achieves good performance on sparse scenes, so it has long been the default post-processing step in object detection.
Targeting a more robust detector for multi-object detection, and overcoming the drawback of GreedyNMS, we propose a new NMS algorithm called Pairwise-NMS. Besides efficiently handling isolated objects like GreedyNMS does, it also takes the heavily occluded case into consideration, and dramatically improves the detection performance in crowded scenes. Specifically, for dealing with two nearby proposals, Pairwise-NMS inherits the GreedyNMS framework when the intersection over union (IoU) is smaller than a pre-defined NMS threshold $N_t$, since GreedyNMS is efficient and accurate in this case. However, when the IoU is larger than the NMS threshold $N_t$, it uses a pairwise-relationship network to predict how many objects the two proposals contain, which helps to handle the multiple overlapping objects effectively. As can be seen in the workflow of Pairwise-NMS in Figure~\ref{fig1:workflow}, comparing to GreedyNMS, Pairwise-NMS is essentially a more general form to handle multi-object detection. To sum up, the contributions of this paper are as follows.
\begin{itemize}
\item An end-to-end Pairwise-NMS relationship network is proposed for replacing the GreedyNMS, which achieves better performance for object detection without losing efficiency.
\item We evaluate the proposed method on three public datasets, both qualitative and quantitative results demonstrate that our method performs better than GreedyNMS especially in the crowded scene. The proposed method also achieves better performance than the recent Soft-NMS~\cite{Reference26}.
\item Thanks to its flexibility, Pairwise-NMS can be integrated into learning based detectors (e.g., Faster-RCNN and DPM) neatly, and pave the way for the end-to-end learning detectors.
\end{itemize}
The rest of this paper is organized as follows. Section~\ref{relatedworks} reviews the related work of post-processing for object detection. Section~\ref{methodology} introduces the methodology and the details of the proposed method. Section~\ref{sec:experiments} presents comprehensive experimental results on three public datasets as well as the ablation study. Section~\ref{sec5:conclusion} concludes the paper with future research interests.
\section{Related works}
\label{relatedworks}
\subsection{Non-Maximum Suppression (NMS)}
\textbf{Sub-Optimal Solver.}
From the mathematical perspective, non-maximum suppression can be viewed as a quadratic problem. In object detection, the inverse scores of the proposals are treated as the unary terms and IoUs between the proposals are treated as the binary terms~\cite{Reference41}. The scores are generated by detector based on the encoding of localizations between proposals and ground-truth bounding boxes. The role of GreedyNMS is to assign zero if the IoU between two proposals is smaller than a NMS threshold or infinite vice versa. By minimizing an energy function, the problem can be solved through a quadratic optimization solver. As pointed out by previous works~\cite{Reference20,Reference22,Reference23,Reference24}, instead of using GreedyNMS, which greedily iterates and acquires local minimum, using other solvers can provide better local minima. While theoretically appealing, there is an increasing in the complexity in both memory and time by using quadratic optimization solvers, especially when the number of proposals is large \cite{Reference20,Reference22,Reference23,Reference24}.
\vspace{2mm}
\noindent \textbf{Message Passing.}
Targeting at object detection in crowded scenes,
Rasmus \textit{et al.}~\cite{Reference25} propose to use a latent structured SVM to learn the weights of affinity propagation clustering between proposals. By passing messages between windows, the merging step can be executed by using clustering methods, and proposals can be re-weighted through minimizing energy function. This kind of method can handle cases which contain two objects that are very close to each other. However, it is hard to distinguish the boundary between one object and two objects.
\vspace{2mm}
\noindent \textbf{Soft-NMS.}
Both sub-optimal solver and message passing methods belong to the branch of improving the binary term, \textit{i.e.} re-weight. There are several works focus on improving the unary term, that is re-score, of the proposals. One of the interesting works is Soft-NMS~\cite{Reference26}. Comparing to GreedyNMS, Soft-NMS decreases the detection scores as an increasing function of IoUs between the target proposals and the overlapped ones, rather than setting scores of the overlapped proposals to zero. Although just one line of code is added, some gains in performance among several detection datasets were acquired. To be specific, a linear or gaussian function is employed to re-score the non-maximal proposals rather than to totally suppress them. The drawback of this method is that it has to manually tailor a corresponding function to alleviate GreedyNMS. This is troublesome since the balance between recall and precision is usually trade-off and data driven. Furthermore, as showed in the experiment section, it can not handle the heavily occluded cases very well.
\begin{center}
\begin{figure*}[t]
\centering
\includegraphics[height=8.0cm]{images/Fig1_GreedyNMS_vs_PairwiseNMS.png}
\caption{Workflow of Pairwise-NMS. Left: Detection proposals with confident scores are acquired by the detector, the one with highest score with be picked as the final detection result (the middle one, also called `the maximal' proposal), and other proposals which are overlapped with the `the maximal' one will be checked (also called `non-maximal' proposals. Middle: The proposal pairs (between the maximal one and non-maximal ones) will flow into two branches depend on if their IoUs are larger than NMS threshold $N_t$. Right: For the heavily overlapped proposal pairs (in which IoU of the proposal pair is larger than $N_t$), GreedyNMS will supress the non-maximal proposal without consideration. Pairwise-NMS will smartly decide if the non-maximal proposal should be kept depend on the number of objects that the proposal pairs contain. }
\label{fig1:workflow}
\end{figure*}
\end{center}
\vspace{2mm}
\noindent \textbf{ConvNet NMS.}
Very recently, Jan Hoang \textit{et al.}~\cite{Reference27,Reference28} propose to use a neural network to re-score the proposals. Being different from other works, they argue that NMS should be totally replaced with the convolutional neural network. The approach in ~\cite{Reference27,Reference28} can be used to learn an end-to-end solution for object detection.
However, we note that for the for sparse scenes, GreedyNMS performs well and efficient. Hence GreedyNMS should not be totally removed from an object detection pipeline. In addition, Learning-NMS~\cite{Reference28} requires a large memory cost, so it limits the number of the sampling proposals for training the network.
\vspace{2mm}
\noindent \textbf{Pairwise Prediction.}
Based on the same application scenario as~\cite{Reference25}, Tang \textit{et al.}~\cite{Reference29} use a SVM to handle the object pairs in the crowded scene, but with manually designed features. It is hard to handle the case when two nearby objects with the similar appearance.
Compare to previous works, our work also focuses on predicting object pairs like~\cite{Reference29}, but we employs a deep learning based network. In addition, rather than throwing away NMS framework totally like Learning-NMS~\cite{Reference28},
the good merits of NMS are retained while the hard constraints are mitigated. Specifically, we utilize the features of the region of interest (ROI) to pass messages between pairs. After the pairwise relationship matrix of the detections within one image was learned, only two lines of codes are added to improve the GeedyNMS (Please refer to Section~\ref{sec:couple_nms} for details). The proposed method is also simple as Soft-NMS~\cite{Reference26}, but it provides a more robust solution for multi-object detection under heavy occlusions.
\section{Methodology}
\label{methodology}
\subsection{Overview}
\label{sec:overview}
The standard way to evaluate the inference performance of an object detection method is via mean average precision (MAP). Therefore, both precision and recall are taken into account. Precision is defined as the ratio between the number of true positives and the number of detections, whereas recall is the ratio between the number of true positives and the number of ground-truth bounding boxes. The goal of detection to achieve good performance is to acquire more true positives and less false positives. As the post-processing step of detection, GreedyNMS solely relies on the detection scores to pick the highest-scored proposals while suppressing the overlapping non-maximal proposals in the surrounding. In sparse scenes, GreedyNMS is capable of achieving good performance as there are only very few overlapping objects, in which cases, the highest-scored proposals will be retained to assign to the target objects. However, in crowded scenes, several objects usually are very close to each other. As a result, a bunch of proposals which are likely to be true positives always have similar scores and form a cluster. In this case, GreedyNMS will inevitably lead to a sacrifice between precision and recall, and dramatically harm the overall performance.
In order to generate a more robust detector to handle the general scenes, a new NMS algorithm for post-processing of object detection is required. There are three points should be taken into consideration:
\begin{itemize}
\item The algorithm is not computationally expensive.
\item Heavily occluded objects should be taken into considerations.
\item It does not bring in more false positives when improving the recall.
\end{itemize}
In this paper, a new NMS framework is explored, that is Pairwise-NMS. Unlike GreedyNMS, Pairwise-NMS can hold the detection boxes for the nearby objects even when they heavily occluded with each other. Through neatly couping with GreedyNMS without losing efficiency, Pairwise-NMS provides a robust and general solution to the post-processing step for object detection.
\begin{center}
\begin{figure*}[t]
\centering
\includegraphics[height=6.0cm]{images/fig2_pairwise_network.png}
\caption{ Mapping two nearby proposals from image coordinate to high-dimension space. From left to right: The overlapped proposal pairs in image coordinates are first fed into the backbone network (VGG16), their corresponding features extracted from layer Conv4-3 are formed the RoI feature pairs, and used as the inputs of our pairwise-relationship network. Each pair will be mapped into the high-dimention (HD) space through the neural network, and the proposal pair which contain two objects will have a large distance in HD space than the proposal pair which contains zero/one object. }
\label{fig2:pairwise_relationship_network}
\end{figure*}
\end{center}
\subsection{Pairwise-NMS}
Fig~\ref{fig1:workflow} is the workflow of Pairwise-NMS. The algorithm is fed with the detection proposals before NMS as inputs. It is then divided into two branches based on NMS threshold $N_t$. For the top branch, when the IoU of two overlapping proposals is smaller than $N_t$, Pairwise-NMS inherits from GreedyNMS directly because it performs well and very efficient. For the bottom branch, when the IoU of two overlapping proposals is larger than $N_t$, GreedyNMS has a poor recall. Instead of suppressing all of the surrounding non-maximal proposals as GreedyNMS does, the proposal pairs will be fed into a pairwise-relationship network. It will make the Pairwise-NMS to know whether the proposal pairs contain two objects or other cases ( contain zero or one object). If the proposal pair contains two objects, then both of the proposals should be kept no matter how close they are. If the proposal pair contains zero or one object, then the non-maximal proposal would be merged like GreedyNMS does. By doing so, multiple overlapping objects can also be handled effectively. Therefore, Pairwise-NMS can consistently improve the recall and MAP, and considerably increase the performance especially in heavily occluded scenes.
\subsection{Pairwise Relationship Network}
The goal of pairwise-relationship network is to tell Pairwise-NMS how many objects the two overlapping proposals contain, and let the Pairwise-NMS to decide if the non-maximal proposals should be merged or not. It is challenging to differentiate two heavily overlapping objects which belong to the same category in an image, especially when they have similar shapes as well as appearances. Based on this observation, the pairwise-relationship network is designed. We expect that after mapping, two closed objects in 2D image coordinate will have a large distance in high dimensional space, as shown in Fig~\ref{fig2:pairwise_relationship_network}.
Then, based on the distance that two proposals have in high-dimension (HD) feature space, it can easily infer whether the two proposals contain two objects or not. The input of pairwise-relationship network are features of the proposals from the backbone network (here we use VGG16~\cite{Reference7} as an example, because its simplicity, while it can be replaced with a deeper network structure like ResNet~\cite{Reference13}, GooleNet ~\cite{szegedy2016rethinking} ), and the output is a distance value between the two HD vectors learned from the pairwise-relationship network.
\subsection{Define Pairs}
\label{sec3.3: define_pairs}
Considering how many objects two proposals contain and whether they are close to each other (Specifically, if IoU of two proposals is larger than NMS threshold, then we define them as ``nearby" or vice versa), there are six cases as shown in Table~\ref{table1:pair_relation}. Case1$\sim$case3 are not under considerations due to the two proposals are not overlapped with each other. For better elucidation, we define case4 and case5 as similar pairs and case6 as dissimilar pairs regarding how many objects the two proposals contain. For similar pairs, in which two proposals contain zero or one object, they should be merged into one bounding box. For dissimilar pairs, where two proposals contain two objects, both of the two proposals should be kept. The pairwise-relationship network mainly focus on predicting if two proposals are similar pairs or dissimilar pairs.
\setlength{\tabcolsep}{4.0 pt}
\begin{table}[t]
\begin{center}
\caption{Relationships between two proposals}
\label{table1:pair_relation}
\scalebox{1.2}{
\begin{tabular}{cccc}
\hline\noalign{\smallskip}
$B_i, B_j$ & nearby or not & objects & constraints in HD-space \\
\noalign{\smallskip}
\hline
\noalign{\smallskip}
case1 & no & 0 & $\parallel Z_i -Z_j \parallel \geq \epsilon_2$ \\
\noalign{\smallskip}
case2 & no & 1 & $\parallel Z_i -Z_j \parallel \geq \epsilon_2$ \\
\noalign{\smallskip}
case3 & no & 2 & $\parallel Z_i -Z_j \parallel \geq \epsilon_2$ \\
\noalign{\smallskip}
case4 & yes & 0 & $\parallel Z_i -Z_j \parallel \leq \epsilon_1$ \\
\noalign{\smallskip}
case5 & yes & 1 & $\parallel Z_i -Z_j \parallel \leq \epsilon_1$ \\
\noalign{\smallskip}
case6 & yes & 2 & $\parallel Z_i -Z_j \parallel \geq \epsilon_2$ \\
\hline
\end{tabular}
}
\end{center}
\end{table}
\setlength{\tabcolsep}{1.4pt}
\begin{center}
\begin{figure*}[t]
\centering
\includegraphics[height=6.0cm]{images/fig4_network_structure1.png}
\caption{Pairwise-relationship network structure. From left to right: The 512-dimension RoI feature pairs are used as input, after three Convolution layers, three FC layers, and one Linear layer (global average pooling\cite{Reference37} is used in our experiments), they are mapped into a 50-dimension space. Relu and Batch Normalization are applied all of the layers except the last one.}
\label{fig3:network_structures}
\end{figure*}
\end{center}
\subsection{Network and Loss}
\noindent
\textbf{Features of Proposal Pairs} The goal of pairwise-relationship network is to learn the relationship between two overlapping proposals. The inputs to the network are the corresponding ROI features of the proposal pairs. We extract ROI features from the layer Conv4\_3 of VGG16~\cite{Reference7}, the size of ROI feature is 1/8 of the corresponding proposal in raw image. The reason for sampling ROI features from Conv4\_3 is because it is small enough, which is good for the training speed and memory cost, and meanwhile carrying enough feature information that the network requires. For the purpose of training the network using the batch operation, ROIAlign~\cite{Reference11} is used to transfer the ROI proposals to the 14 $\times$ 14 fixed size tensors.
\vspace{2mm} \noindent \textbf{Network Layers}
As shown in Fig~\ref{fig3:network_structures}, the main body of the network structure is composed of three convolutional layers, three fully connected layers and a global average pooling layer~\cite{Reference37}. Each convolutional layer is followed by a Relu~\cite{Reference3} and Batch Normalization~\cite{Reference40} layer. From Conv2 to Conv3, Max-pooling is used. The feature dimension for convolutional layers is 512, and the kernel size and stride are 3 and 1, respectively. In the last FC layer, the dimension of the feature vector is reduced to 50, which is the dimension of the HD space being used to calculate the distance of the two mapped vectors.
\vspace{2mm} \noindent \textbf{Global Average Pooling}
Global average
pooling(GAP)~\cite{Reference37} is employed after the last FC layer to transfer the tensor to a HD vector. We also conduct some tests to replace the GAP layer with FC layer. Our experimental results demonstrate that GAP layer has a better performance than FC layer for the task, and a brief analysis is provided in Section \ref{sec4.4:ablation}
\vspace{2mm} \noindent
\textbf{Loss}
We use L1-norm loss because it converges fast, and the loss function is defined as following:
\begin{equation} \label{formula1}
\begin{split}
L(x_1,x_2)= & y\cdot|f(x_1)-f(x_2)|+ \\
& (1-y)\cdot\max(0,\lambda -|f(x_1)-f(x_2)|)
\end{split}
\end{equation}
In Formula~\ref{formula1}, $x_1$ and $x_2$ are ROI proposals, the label $y=1$ when the two proposals belong to similar pairs (zero or one object) and $y=0$ when the two proposals belong to dissimilar pairs (different objects). $f(x_1)$ and $f(x_2)$ are HD vectors learned from the pairwise-relationship network. A margin $\lambda =1$ is used to push the dissimilar pairs away from the similar pairs. $|f(x_1)-f(x_2)|$ is the $L_1$ distance between the two HD vectors. For similar pairs, the distance value between two HD vectors would be forced to approach to 0, while for dissimilar pairs, the distance value between two HD vectors would be forced to approach to 1.
\vspace{2mm} \noindent \textbf{Training and Inference}
For training, the optimizer is stochastic gradient descent (SGD) with momentum \cite{Reference3}. For all of the experiments, the following setting is adopted, where learning rate, momentum, weight decay and batch size are 1e-4, 0.9, 1e-5 and 1 respectively.
For inference, on each image, a symmetric and sparse pairwise relationship matrix is acquired for the detection proposals, which record the pairwise-distance of any two detection proposal within the image,
and which is used for couping with GreeyNMS. ON all of the datasets, the total sample proposal pairs during training on every image are 64 for proposals generate by DPM\cite{Reference21} and 32 for proposals generated by Faster-RCNN\cite{Reference9}, and the ratio of dissimilar pairs and similar pairs is 1:3.
\setlength{\tabcolsep}{12pt}
\begin{table*}[t]
\small
\begin{center}
\caption{Experiment setting of Pairwise-NMS and GreedyNMS on MOT15 and TUD-Crossing}
\label{table:expsetting}
\scalebox{1.0}{
\begin{tabular}{l|c|c|c|c|c|c|c|c|c|c}
\hline\noalign{\smallskip}
$E_t$ & 0.5 &0.55 & 0.6 & 0.65 & 0.7 & 0.75 &0.8 & 0.85 & 0.9 & 0.95 \\
\noalign{\smallskip}
\hline
\noalign{\smallskip}
$N_t$ & 0.55 & 0.55 & 0.55 & 0.6 & 0.65 & 0.7 & 0.8 & 0.85 & 1 & 0.95\\
\noalign{\smallskip}
\hline
\noalign{\smallskip}
$D_t$ & 1.25 & 1.25 & 1.25 & 1.4 & 1.3 & 0.65 & 0.9 & 0.5 & 0 & 0.2\\
\hline
\end{tabular}
}
\end{center}
\end{table*}
\setlength{\tabcolsep}{1.4pt}
\subsection{Coupling with GreedyNMS}
\label{sec:couple_nms}
Just like Soft-NMS\cite{Reference26}, Pairwise-NMS can also be coupled with GreedyNMS neatly. The following is the coupling code of Pairwise-NMS, after the pairwise relationship maxtrix is learned through the pairwise-relationship network. The colored parts are the differences between GreedyNMS and Pairwise-NMS. As can be seen, in GreedyNMS, all of the non-maximal proposals would be suppress, regardless how many objects it has in the surrounding area, which will inevitably cause the performance drop under the heavily occluded cases. On the contrary, our method provide an effective complementary to the GreedyNMS, that is, even when IoU of the non-maximal proposal with the selected proposal is larger than NMS threshold, those two proposals (the proposal pair) will be passed into the pairwise-relationship network, and let the network automatically decided how many objects the two proposals contain. Compared with the `blind' suppression of GreedyNMS, Pairwise-NMS is much flexible and robust for multi-object detection.
And comparing to GreedyNMS, just one line of code is added, thus no efficiency lose.
\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}
\begin{algorithm}[t]
\caption{Pusedo code of Pairwise-NMS}
\begin{algorithmic}[2]
\REQUIRE
$\beta=\{b_1,...b_N \}$, $S=\{s_1,...s_N \}$, $N_t$ \\
$\beta$ is the list of initial detection boxes \\
$S$ contains corresponding detection scores\\
$N_t$ is the NMS threshold
$D_t$ is the distance threshold
\label{coupling_pairwise_nms}
\end{algorithmic}
\Begin
{ $D \leftarrow \{\}$ \\
\While{$\beta \neq empty $}
{%
$m \leftarrow argmax \hspace{0.5em} S$ \\
$M \leftarrow b_m$ \\
$D \leftarrow D \cup M ; B \leftarrow B - M$
\For{$b_i$ in $\beta$}
{
\begin{elaboration_red}
\If {$iou(M,b_i) \geq N_t$}
{$\beta \leftarrow \beta - b_i ; S \leftarrow S - S_i $}
\hfill \textbf{GreedyNMS}
\end{elaboration_red}
\vspace{0.2cm}
\begin{elaboration_green}
\If {$iou(M,b_i) \geq N_t \wedge \\
pairDist(M,b_i) \leq D_t $
}
{$\beta \leftarrow \beta - b_i ; S \leftarrow S - S_i $}
\hfill \textbf{Pairwise-NMS}
\end{elaboration_green}
}
}
}
\end{algorithm}
\section{Experiments}
\label{sec:experiments}
\subsection{Experiment Glimpse and Evaluation}
\label{sec:evaluation}
\subsubsection{Experiment Glimpse}
\noindent
In this part, we provide extensive experiments on three different datasets, including MOT15, TUD-Crossing and PETS. The experimental results firstly demonstrate how our Pairwise-NMS outperforms GreedyNMS in crowded scenes with occlusions to different extents, especially, the gains with the increasing of the occlusions that Pairwise-NMS over GreedyNMS will be emphasized. Moreover, the comparison with Soft-NMS demonstrate our method performs better in very crowded scenes.
\subsubsection{About Evaluation}
\noindent There are two parameters to be considered during the execution of NMS related to the final detection performance. One of the parameters is NMS threshold $N_t$, and it determines to what extent the surrounding non-maximal proposals should be suppressed by the local maximal proposal. Another parameter is the evaluation threshold $E_t$, and it determines to what extent a detection bounding box could be true positive (if only one detection box is aligned to the object) or false positives (if multiple detection boxes are aligned to the same object).
When a small evaluation threshold (for example $E_t=0.5$) is used, it is much easier for the detection proposals to be true positives, since the only condition to be satisfied is that their IoUs with ground truth boxes are bigger or equal than 0.5. Meanwhile, due to the constraint that the evaluation script asking for at most one proposal to align the same object, as a result, it is prone to high recall and lower precision. On the contrary, when a large evaluation threshold (for example $E_t=0.95$) is used, it is more difficult for the detection proposals to be true positives because it relies on the detector to perform an extremely accurate localization. As a result, it will lead to high precision and low recall.
In order to perform an objective and comprehensive evaluation, especially in multi-object detection which often contains heavy occluded cases, we use the same evaluation criterion as Microsoft COCO evaluation~\cite{Reference12}, and with different evaluation thresholds to reflect the strength of Pairwise-NMS for handling heavy occlusions in crowded scenes.
\subsection{Results on MOT15}
For each evaluation criterion, one optimal NMS threshold $N_t$ and one distance threshold $D_t$ are chosen for GreedyNMS and Pairwise-NMS respectively. The specific settings for MOT15 and TUD-Crossing are listed as Table~\ref{table:expsetting}. And the setting for PETS are following \cite{Reference28} and will be explained in the Section~\ref{sect:pets}
MOT15 benchmark~\cite{Reference38} is a public dataset, which collects 11 sequences for multi-object detection and tracking from different cities. It is challenging due to the heavy occlusions, dramatic illumination changes and clustering background. MOT15 training set is used as it provides the ground-truth annotations, which facilitates the verification of the proposed Pairwise-NMS framework. The whole training set contains 5500 images, and is split with a ratio 5:1:4 for training, validation and test. For object detector, we use the Faster-RCNN code implemented by Ross Girshick\cite{Reference9}. That detector was originally trained on COCO~\cite{Reference12} and PASCAL VOC~\cite{Reference19}, both of which lack significant numbers of occluded objects. We therefore fine-tune the detector on the MOT15 training set as mentioned above. For all of the experiments, pairwise-relationship network was trained on training set and parameters were fine-tuned on validation set only.
\setlength{\tabcolsep}{4.0pt}
\begin{table}[t]
\small
\begin{center}
\caption{AP of optimal GreedyNMS vs Pairwise-NMS on MOT15}
\label{table2:mot15_ap}
\scalebox{1.0}{
\begin{tabular}{llll}
\hline\noalign{\smallskip}
Evaluation threshold & GreedyNMS & Pairwise-NMS & Outperform \\
\noalign{\smallskip}
\hline
\noalign{\smallskip}
AP @ 0.5 & 74.11 & \textbf{74.15} & 0.04 \\
\noalign{\smallskip}
AP @ 0.55 & 76.15 & \textbf{76.21} & 0.06 \\
\noalign{\smallskip}
AP @ 0.6 & 65.66 & \textbf{65.82} & 0.16 \\
\noalign{\smallskip}
AP @ 0.65 & 57.86 & 57.86 & 0.0 \\
\noalign{\smallskip}
AP @ 0.7 & 45.68 & \textbf{46.41} & 0.73 \\
\noalign{\smallskip}
AP @ 0.75 & 29.45 & \textbf{30.41} &0.96\\
\noalign{\smallskip}
AP @ 0.8 & 16.70 & \textbf{16.82} & 0.12 \\
\noalign{\smallskip}
AP @ 0.85 & 5.17 & \textbf{5.26} & 0.09 \\
\noalign{\smallskip}
AP @ 0.9 & 0.87 & 0.87 & 0.0 \\
\noalign{\smallskip}
AP @ 0.95 & 0.02 & 0.02 & 0.0 \\
\hline
\end{tabular}
}
\end{center}
\end{table}
\setlength{\tabcolsep}{1.4pt}
Table~\ref{table2:mot15_ap} shows the overall performance of GreedyNMS and Pairwise-NMS on test set. We use the same evaluation as Microsoft COCO~\cite{Reference12}, which is $AP_{0.5}$ to $AP_{0.95}$ , as the evaluation criterion. For fair comparison, the optimal NMS threshold was acquired under each evaluation threshold, and based on that, the best AP for GreedyNMS is set down as the baseline. Using the same setup with GreedyNMS, our pairwise-relationship network was trained. The pairwise matrix that is obtained using pairwise-relationship network from inference is then be coupled into GreedyNMS framework as described in Section~\ref{sec:couple_nms}.
As can be seen, Pairwise-NMS outperforms GreedyNMS is eligible for $AP_{0.5}$. However, the gap is enlarged with the increasing of evaluation threshold. For example, when $AP_{0.75}$ is used, Pairwise-NMS beats GreedyNMS about 1 percent for overall performance. This improvement also double proves that our method is good at handling heavy occlusions.
Although we have achieved consistent improvements compared to GreedyNMS using different evaluation thresholds, the gains of the overall performances seem not large. In fact, it does not like so. After a thorough investigation of datasets which have heavy occlusions including TUD-Crossing and MOT15, we discover that the number of heavily occluded objects is relatively smaller comparing to the total number of ground truth bounding boxes. Besides, the brief analysis about the factors that affect the final evaluation provided in Section~\ref{sec:evaluation} can also provide some hints.
\begin{center}
\begin{figure}[t]
\centering
\includegraphics[height=7.0cm]{images/fig5_bar_chart1.png}
\caption{Outperform percentages of Pairwise-NMS than optimal GreedyNMS under different occlusion ranges on MOT15. Using [email protected] as evalution cretion, Pairwise-NMS achive 6\% higher percent than that of GreedyNMS regarding to detection accuracy, and with the increasing of the occlusion range, the gains that Pairwise-NMS outperformed GreedyNMS is enlarged.}
\label{fig4:mot15_occlusion}
\end{figure}
\end{center}
\setlength{\tabcolsep}{4pt}
\begin{table}[t]
\small
\begin{center}
\caption{F1-score of optimal GreedyNMS vs Pairwise-NMS under different occlusion ranges on MOT15}
\label{table3:mot15_f1}
\scalebox{1.0}{
\begin{tabular}{llll}
\hline\noalign{\smallskip}
Gt overlap& GreedyNMS & Pairwise-NMS& Outperform \\
\noalign{\smallskip}
\hline
\noalign{\smallskip}
0.4 - 0.45 & 38.73 &\textbf{40.25} & 1.52\\
\noalign{\smallskip}
0.45 - 0.5 & 39.17 &\textbf{39.18} & 0.01\\
\noalign{\smallskip}
0.5 - 0.55 & 43.93 &\textbf{44.72} & 0.79\\
\noalign{\smallskip}
0.55 - 0.6 & 32.18 & \textbf{33.28} & 1.1 \\
\noalign{\smallskip}
0.6 - 0.65 & 29.03 & \textbf{30.0} & 0.97 \\
\noalign{\smallskip}
0.65 - 0.7 & 32.17 & \textbf{35.90} & 3.73 \\
\noalign{\smallskip}
0.7 - 0.75 & 39.46 & \textbf{39.73} & 0.27 \\
\noalign{\smallskip}
0.75 - 0.8 & 36.78 & 36.78 & 0.0 \\
\noalign{\smallskip}
0.8 - 0.85 & 33.65 & \textbf{34.29} & 0.64 \\
\noalign{\smallskip}
0.85 - 0.9 & 6.25 & \textbf{6.90} & 0.65 \\
\hline
\end{tabular}
}
\end{center}
\end{table}
\setlength{\tabcolsep}{1.4pt}
For better analysis about the performance of our algorithm, like the previous related papers \cite{Reference26,Reference27,Reference28}, $AP_{0.5}$ for different occlusions are acquired. Here, we use the overlap between ground-truth bounding boxes as the occlusion reference.
Fig~\ref{fig4:mot15_occlusion} shows a full comparison of outperform percentages of Pairwise-NMS than GreedyNMS under different occlusion ranges. As can be seen in Fig~\ref{fig4:mot15_occlusion}, in most cases, Pairwise-NMS beat optimial GreedyNMS. The overall trend is that the heavier the occlusions, the more gains Pairwise-NMS achieve, and the max gains is 6 percent compared with GreedyNMS.
To gain further understanding on the performance of our method under heavy occlusions, F1 scores under different occlusion ranges from 0.4 to 0.9 with interval 0.05 are outlined in Table~\ref{table3:mot15_f1}. As can ben seen, Pairwise-NMS has better F1-score than GreedyNMS in all of the thresholds. Pairwise-NMS outperforms GreedyNMS more than 3.7 percent under occlusion range between 0.65 and 0.7.
\subsection{TUD-Crossing for Generalization}
\begin{center}
\begin{figure}[t]
\centering
\includegraphics[height=6.5cm]{images/tud-crossing.png}
\caption{TUD-Crossing: the 50th, 100th, 150th, 200th frame of dataset, as can be seen, it is quite challenging as for object detection.}
\label{tud-crossing}
\end{figure}
\end{center}
In order to verify the generalization ability of the proposed method, we use TUD-Crossing~\cite{Reference39} dataset, which is composed of 201 heavily occluded images, to perform the inference based on the trained model which is obtained from MOT15, without any fine-tuning on TUD-Crossing.
In Figure~\ref{tud-crossing}, there are four images with frame no 50, 100, 150, 200 are shown out. Since TUD-Crossing dataset are capture from the side view when pedestrians are coming across the traffic light, as can be seen, in all of the images, there are always heavily occluded cases happen, regardless how many people within the camera frustum. And for the first half of the video sequence, the camera frustum usually contain a relatively higher density. Moreover, the crowding, small scale, fractional and low resolution also make the task more challenging.
The results are shown in Table~\ref{table4:tud_ap}, average precision (AP) is used as the measurement metric. And for most of the evaluation criterions, Pairwise-NMS performs better than GreedyNMS regarding to detection accuracy. Specifically, the heavier occlusions are, the more gains Pairwise-NMS achieves when compared with that of using GreedyNMS, and the maximumal overall gain is 0.95 percent, and considering the ratio of heavily occluded cases just take up small part of the overall bounding boxes, this is a large improvements for object detection. To sum up, the detection results on TUD-Crossing dataset present the similar trend as the one on MOT15, which confirms that our pairwise-relationship network has acquired the ability for handling with the heavy occlusions regarding the texture and pattern changing of the image sequence.
\setlength{\tabcolsep}{4pt}
\begin{table}[t]
\small
\begin{center}
\caption{AP of optimal GreedyNMS vs Pairwise-NMS on TUD-Crossing}
\label{table4:tud_ap}
\scalebox{1.0}{
\begin{tabular}{llll}
\hline\noalign{\smallskip}
Evaluation threshold & GreedyNMS & Pairwise-NMS & Outperform \\
\noalign{\smallskip}
\hline
\noalign{\smallskip}
AP @ 0.5 & \textbf{79.07} & 78.86 & -0.21 \\
\noalign{\smallskip}
AP @ 0.55 & \textbf{75.58} & 75.25 & -0.33 \\
\noalign{\smallskip}
AP @ 0.6 & 69.46 & \textbf{69.47} & 0.01 \\
\noalign{\smallskip}
AP @ 0.65 & 57.95 & \textbf{58.07} & 0.12 \\
\noalign{\smallskip}
AP @ 0.7 & 42.33 & \textbf{42.35} & 0.014 \\
\noalign{\smallskip}
AP @ 0.75 & 24.41 & \textbf{25.36} & 0.95\\
\noalign{\smallskip}
AP @ 0.8 & 12.40 & \textbf{12.56} & 0.16 \\
\noalign{\smallskip}
AP @ 0.85 & 4.02 & \textbf{4.10} & 0.07 \\
\noalign{\smallskip}
AP @ 0.9 & 0.51 & 0.51 & 0.0 \\
\noalign{\smallskip}
AP @ 0.95 & 0.01 & 0.01 & 0.0 \\
\hline
\end{tabular}
}
\end{center}
\end{table}
\setlength{\tabcolsep}{1.4pt}
\subsection{Results on PETS }
\label{sect:pets}
PETS~\cite{Reference42} dataset is another public dataset which consists of eight sub-sequences that are captured from different angles and views. We use the same setup to split the dataset as \cite{Reference28,Reference29}, and the detection proposals before NMS were generated by DPM~\cite{Reference21}. Table~\ref{table6:PETS} provides the statistics of PET dataset, including the sub-sequence splits, number of frames, detection proposals before NMS and the ground truth bounding boxes for training, validation and testing.
A same workflow as MOT15 for training and inference is shared.
Table~\ref{table5:pets_ap} are the results we obtain using Pairwise-NMS and GreedyNMS with different NMS thresholds, in order to be consistent with~\cite{Reference29}, all of the results, with $AP_{0.5}$ as the evaluation criterion. As can be seen, our method outperforms all of the GreedyNMS results, and beats GreedyNMS with optimal NMS threshold ($N_t=0.4$) more than 1.5 percent. It proves that, as the post-processing step, Pairwise-NMS is a good replacement for GreedyNMS and it can be integrated into any detector.
\begin{center}
\begin{figure}[t]
\centering
\includegraphics[height=6.5cm]{images/pets_test.png}
\caption{PETS test images: The 100th, 200th, 300th, 400th frame of PETS test set (S2L2 sequence) are shown out. As can be seen, the people in this scene is very crowded, quite small and affected by the light conditions, thus is extremely challenging for object detection.}
\label{pets_test}
\end{figure}
\end{center}
\setlength{\tabcolsep}{4pt}
\begin{table}[t]
\begin{center}
\caption{Statistic of PETS Dataset}
\label{table6:PETS}
\scalebox{1.0}{
\begin{tabular}{ccccc}
\hline\noalign{\smallskip}
splits & sequences & frames & proposals & gt boxes \\
\noalign{\smallskip}
\hline
\noalign{\smallskip}
\multirow{2}*{training} & S1L1-1, S1L1-2, S1L2-1 &\multirow{2}*{1696} & \multirow{2}*{5421758} & \multirow{2}*{23107} \\
& S1L2-2, S2L1, S3MF1 & & & \\
\noalign{\smallskip}
validation & S2L3 & 240 & 727964 & 4376 \\
\noalign{\smallskip}
test & S2L2 &436 & 2112655 & 10292\\
\hline
\end{tabular}
}
\end{center}
\end{table}
\setlength{\tabcolsep}{1.4pt}
\setlength{\tabcolsep}{4pt}
\begin{table}[t]
\begin{center}
\caption{AP$_{0.5}$ of Pairwise-NMS vs GreedyNMS on PETS}
\label{table5:pets_ap}
\scalebox{1.0}{
\begin{tabular}{c|c|cccc}
\hline\noalign{\smallskip}
Method & Pairwise-NMS & & GreedyNMS & & \\
\hline
\multirow{4}{*}{AP @ 0.5} &\multirow{4}{*}{\textbf{78.1}} &$N_t>$0.0 & $N_t>$0.1 &$N_t>$0.2 &$N_t>$0.3 \\
& &55.0 &66.0 & 71.4 & 75.0 \\ \cline{3-6}
& & $N_t>$0.4 &$N_t>$0.5 &$N_t>$0.6 &\\
& & 76.6& 73.4 &64.8 & \\
\hline
\end{tabular}
}
\end{center}
\end{table}
\setlength{\tabcolsep}{1.4pt}
\subsection{Comparison with Soft-NMS}
In this section, we conduct the comparison experiments between the proposed Pairwise-NMS and the state-of-the-art method Soft-NMS\cite{Reference26} on PETS test dataset.
Since the most outstanding advantage of Pairwise-NMS is capable of handling with multi-object detection especially under the heavy occluded cases. PETS dataset is chosen for the reason that it is one of the most crowded and widely used datasets for multi-object detection. Thus it should be representative and is reasonable to reflect the robustness of algorithms.
According to the Soft-NMS~\cite{Reference26} paper, instead of suppressing all of the proposals which have heavy IoUs with the targeting (maximal scored) proposal, Soft-NMS replace the hard NMS threshold used in GreedyNMS with a linear or non-linear function to re-score the overlapped proposals. And the general principle that guiding the re-scoring process is that, the IoU between the two overlapped proposals should be act as a weight for the `score-decay` of the non-maximal one. Either the linear function or Gaussian function could be utilized to execute the re-scoring process depends on their performance regarding to the dataset.
Since for both of the linear function based Soft-NMS and Gaussian function based Soft-NMS, the scores of the non-maximal proposals are continuous penalized, as a result, there will be no proposal removed from each suppression round, which will cause a long excution time compared with GreedyNMS, thus there is a parameter $\theta$ used in practical. The role of $\theta$ is to filter out the proposals which have smaller scores regardless what their originals scores are. By this way, Soft-NMS can keep the same level of efficiency with GreedyNMS. For Gaussian function based Soft-NMS, there is an extra parameter $\sigma$ which is the standard deviation of the Gaussian function, and can be viewed as a `controller` of the distribution shape of the penalty function.
\setlength{\tabcolsep}{10pt}
\begin{table*}[t]
\small
\begin{center}
\caption{Comparison results with Soft-NMS on PETS}
\label{table_soft-nms}
\scalebox{1.0}{
\begin{tabular}{ccccccccc}
\hline\noalign{\smallskip}
methods & thre & tp & fp & dt & gt & rec & prec & [email protected]\\
\noalign{\smallskip}
\hline
\noalign{\smallskip}
Soft-NMS\_L & 0.0 & 10119 & 606298 & 616417 & 10292 & 98.32 & 1.64 & 37.60\\
\noalign{\smallskip}
Soft-NMS\_L & 0.1 & 8402 & 11992 & 20394 & 10292 & 81.64 & 41.20 & 60.75\\
\noalign{\smallskip}
Soft-NMS\_L & 0.2 & 7601 & 2942 & 10543 & 10292 & 73.85 & 72.10 & \textbf{63.27}\\
\noalign{\smallskip}
Soft-NMS\_L & 0.3 & 6645 & 540 & 7185 & 10292 & 64.56 & 92.48 & 61.94\\
\noalign{\smallskip}
Soft-NMS\_L & 0.4 & 5494 & 192 & 5686 & 10292 & 53.38 & 96.62 & 52.40\\
\noalign{\smallskip}
\hline
\noalign{\smallskip}
Soft-NMS\_G & 0.1 & 7216 & 1383 & 8599 & 10292 & 70.11 & 83.92 & 68.05\\
\noalign{\smallskip}
Soft-NMS\_G & 0.2 & 7543 & 2100 & 9643 & 10292 & 73.29 & 78.22 & \textbf{70.24}\\
\noalign{\smallskip}
Soft-NMS\_G & 0.3 & 7756 & 3115 & 10871 & 10292 & 75.36 & 71.35 & 69.00\\
\noalign{\smallskip}
Soft-NMS\_G & 0.4 & 7914 & 4561 & 12475 & 10292 & 76.89 & 63.44 & 64.73\\
\noalign{\smallskip}
Soft-NMS\_G & 0.5 & 8012 & 6014 & 14026 & 10292 & 77.85 & 57.12 & 59.84\\
\noalign{\smallskip}
\hline
\noalign{\smallskip}
Pairwise-NMS & 0.7 & 9477 & 66718 & 76195 & 10292 & 92.08 & 12.44 & \textbf{78.11}\\
\hline
\end{tabular}
}
\end{center}
\end{table*}
\setlength{\tabcolsep}{1.4pt}
In Table~\ref{table_soft-nms}, on PETS dataset, we list the detection results of Soft-NMS under different settings and that of Pairwise-NMS. Specifically, with Soft-NMS\_L denotes linear function based Soft-NMS, and with Soft-NMS\_G denotes Gaussian function based Soft-NMS. For easy comparison, we unified use the 'thre' in the second column of Table~\ref{table_soft-nms} to denote the parameter $\theta,\sigma$ and $N_d$ employed in linear function based Soft-NMS, Gaussian function based Soft-NMS and Pairwise-NMS, respectively. In addition, as point out before, for Gaussian function based Soft-NMS, both the parameters $\theta$ and $\sigma$ are used, after fine tuning the $\theta$ on linear function based Soft-NMS, we fix it as 0.2, and just take $\sigma$ as the variable. In order to have a comprehensive comparison and understanding about different algorithms under various settings, some key measurements are listed, they are true positives, false positives, number of final detections, number of ground-truth bounding boxes, recall, precision and average precision with evaluation threshold 0.5 (tp, fp, dt, gt, rec, prec, [email protected]) on the first row.
\begin{figure}[t]
\centering
\includegraphics[height=7.0cm]{images/nms_curves.png}
\caption{MAP curves of Soft-NMS and Pairwise-NMS. As can be been, both of the liner function based Soft-NMS and Gaussian function based Soft-NMS have lower performance than that of Pairwise-NMS on PETS dataset regarding to detection accuracy. Form surface, it is struggle for both type of Soft-NMS to reach a good balance between reall and precision on PETS dataset. From essential, we suspect that Pairwise-NMS has superior ablity than Soft-NMS to handle the very crowded cases.}
\label{fig4_nms_curves}
\end{figure}
From observing the AP performance of different algorithms, it can be concluded that, both the linear function based Soft-NMS and the Gaussian function based Soft-NMS have lower performance than our method on PETS dataset. Specifically, Soft-NMS\_L achieves highest AP of 63.27 percent, and Soft-NMS\_G achieves highest AP of 70.24. Both of them are far behind from the performance of our proposed Pairwise-NMS. And from watching the recall and precision, it is much clear that, for Soft-NMS, it almost fails in all settings to reach a good trade-off between the precision and recall, which can be viewed as the surface explanation of the unsatisfied APs.
And from the essential, we suspect there are two reasons:
firstly, from the perspective of dataset,
both of the VOC2007 and COCO dataset used by Soft-NMS is relative sparse and contains very few crowed cases, on the contrary, PETS is very crowded and is much challenging. For example, a lot of frames contain above 30 pedestrians, and they are quite small in resolutions and heavily occluded with each other. Secondly, from the perspective of detector, in order to keep the same settings with \cite{Reference27,Reference28,Reference29}, detection proposals generated by DPM (before NMS) are used here. The detection proposals for each image easily reach several thousands. Which may cause more difficulties for Soft-NMS compared to that at most 300 detection proposals are used in the original paper of Soft-NMS\cite{Reference26}
\begin{center}
\begin{figure*}[t]
\centering
\includegraphics[height=9.0cm]{images/fig5_vis_result1.png}
\caption{Visualized detections of GreedyNMS (the first row) and Pairwise-NMS (the second row). With green box, blue box, and red box to denote true positive, false positive and false negative, respectively. As can be been, compared with the detection results acquired from GreedyNMS, the detection results acquired from Pairwise-NMS dramatically reduce the false negatives (which leads to the higher recall), and meanwhile reduce the false positives slightly (which contributes to the precision).}
\label{fig5:vis_detection}
\end{figure*}
\end{center}
In Fig~\ref{fig4_nms_curves}, the MAP curves of best Soft-NMS\_L, best Soft-NMS\_G and Pairwise-NMS are given for the better illustration and easier comparison in visual.
In conclusion, under the extremely crowded scenes, our proposed method can achieve a better balance between the recall and precision and is much robust than Soft-NMS.
\subsection{Qualitative Results}
\label{sec:qualitative_results}
In Fig
~\ref{fig5:vis_detection}, several visualized examples from MOT2015 dataset are given, the base detector is Faster-RCNN. The first row are the detection results we obtained using GreedyNMS, followed by the second row with results acquired by Pairwise-NMS. As can be seen from the legend at the top right, detections with blue-edge boxes are true positives (TP), detections with green-edge boxes are false positives (FP), and the detections with red-edge boxes are false negatives (FN).
In all of the three examples, due to the heavily overlapping between two or more person, GreedyNMS and Pairwise-NMS all failed in some cases and missing detect some targets (as denoted with the red boxes), however, compared with the results acquired from GreedyNMS, the detection obtained from Pairwise-NMS has less missing detections, which strongly prove the effectiveness of the proposed pairwise-relationship network for handling heavily occluded case. In addition, in the first image, as denoted by the blue box, Pairwise-NMS performs better in reducing false positives. To sum up, comparing to GreedyNMS, Pairwise-NMS effectively preventing the case of missing detections and discarding more false positives.
\subsection{Ablation Study}
\label{sec4.4:ablation}
\subsubsection{Sampling Policy}
\label{appendix2:sample_pairs}
\noindent Due to the imbalance between similar pairs and dissimilar pairs, it is important to make a wise policy to achieve good accuracy and to ease the learning process of pairwise-relationship network.
After a thorough investigation of datasets which contain heavy occlusions including TUD-Crossing and MOT15, we find the number of heavily occluded objects is relatively small compared with the total number of ground-truth bounding boxes. According to the analysis in Section~\ref{sec3.3: define_pairs}, the proposal pairs that contain two different objects are defined as dissimilar pairs, which should not be merged. All other cases are defined as similar pairs and should be merged. Based on our statistics on TUD-Crossing as can been seen in Table~\ref{table7:tud_pairs}, the ratio between dissimilar and similar pairs are more than 10. For the sake that the network can learn to recognize two objects, we randomly reduce the number of similar samples during training. Specifically, the ratio between dissimilar and similar pairs is kept with 1:3.
Meanwhile, among the similar pairs, considering how many objects (zero or one) the two proposals contain, a natural way of sampling pairs is to form the similar pairs based on their ratios of different cases. Because correctly predicting the similar pairs will dramatically reduce the false positives and improve the precision, the sampling ratios will also affect network's ability to differentiate the dissimilar and the similar pairs.
\vspace{4mm}
\subsubsection{Different Network Structures}
\begin{center}
\begin{figure}[t]
\centering
\includegraphics[height=6.5cm]{images/val_accuracy_siamese_fc.png}
\caption{Validation accuracy of pairwise-relationship network using FC layer.}
\label{FC_curve}
\end{figure}
\end{center}
\begin{center}
\begin{figure}[t]
\centering
\includegraphics[height=6.5cm]{images/val_accuracy_siamese_avepool.png}
\caption{Validation accuracy of pairwise-relationship network using GAP layer}
\label{GAP_curve}
\end{figure}
\end{center}
In the experiments, we discover that, for the last layer, pairwise-relationship network with GAP layer has better performance than the one with FC layer. It may due to the reason that FC layer usually carries the position information, which in turn causes confusion to the network to distinguish the case5 from case6 in Table~\ref{table1:pair_relation}. Specifically, it is difficult for the pairwise-relationship network with FC layer to differentiate the case that two proposals contain one common object and the case that two proposals contain two different objects.
In order to test the affects between using the global average pooling (GAP) layer and fully connected (FC) layer in the pairwise-relationship network. We use 80\% images of TUD-Crossing dataset to train the pairwise-relationship network with GAP layer and the pairwise-relationship network with FC layer from scratch, and use another 20\% images of TUD-Crossing as the validation set. The validation loss curves of the networks with GAP layer and FC layer are as shown in Fig~\ref{GAP_curve} and Fig~\ref{FC_curve}, respectively. In the two figures, X axis represents the number of training iteration, and Y axis is MAP ([email protected]). As can be seen, the pairwise-relationship network with GAP layer has better performance and continue learning as the training goes. Which confirm our conjecture in the section of ablation Study, and for all of the experiments in this paper, the network with GAP layer is employed.
\setlength{\tabcolsep}{3pt}
\begin{center}
\begin{table}[t]
\caption{Statistics of pairs on TUD-Crossing}
\label{table7:tud_pairs}
\scalebox{0.95}{
\begin{tabular}{llllll}
\hline\noalign{\smallskip}
proposals & IoU threshold > pairs &0 object pairs & 1 object pairs & 2 object pairs \\
\noalign{\smallskip}
\hline
\noalign{\smallskip}
300 & 0 & 537 & 980596 & 161320 & 7596\\
\noalign{\smallskip}
300 & 0.1 & 398 & 699854 & 133364 & 3061 \\
\noalign{\smallskip}
300 & 0.2 & 254 & 533469 & 74523 & 1582\\
\noalign{\smallskip}
300 & 0.3 & 150 & 391318 & 16309 & 930 \\
\noalign{\smallskip}
\hline
\end{tabular}
}
\end{table}
\end{center}
\setlength{\tabcolsep}{1.4pt}
\section{Conclusions}
\label{sec5:conclusion}
We propose a Pairwise-NMS as the post-processing step for object detection. Feeding two overlapping proposals to a pairwise-relationship network can smartly tell the Pairwise-NMS if there are two objects or one/zero object contained. It can cure the drawback of GreedyNMS for ``suppressing all'' under heavy occlusions, and is more robust than Soft-NMS in crowded scenes. Moreover, Pairwise-NMS can consistently improve the performance and neatly couple with GreedyNMS. And can be as an ingredient to be integrated into learning-based detectors including Faster-RNN, DPM without losing the efficiency. We believe that our work is beneficial to instance segmentation and multi-object tracking in crowded scenes.
In the future, there will be two research problems of our interests. One of the problems is to integrate Pairwise-NMS into learning based detectors such as Faster-RCNN, YOLO, SSD to perform joint training and inference, and the other is to explore a more general rule to handle a cluster of multiple objects at the same time.
\ifCLASSOPTIONcaptionsoff
\newpage
\fi
\bibliographystyle{IEEEtran}
\section{Introduction}
\IEEEPARstart{T}{his} demo file is intended to serve as a ``starter file''
for IEEE \textsc{Transactions on Magnetics} journal papers produced under \LaTeX\ using
IEEEtran.cls version 1.8b and later.
I wish you the best of success.
\hfill mds
\hfill August 26, 2015
\subsection{Subsection Heading Here}
Subsection text here.
\subsubsection{Subsubsection Heading Here}
Subsubsection text here.
\section{Conclusion}
The conclusion goes here.
\appendices
\section{Proof of the First Zonklar Equation}
Appendix one text goes here.
\section{}
Appendix two text goes here.
\section*{Acknowledgment}
The authors would like to thank...
\ifCLASSOPTIONcaptionsoff
\newpage
\fi
| {'timestamp': '2019-01-15T02:04:57', 'yymm': '1901', 'arxiv_id': '1901.03796', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03796'} | arxiv |
\section{Introduction}
\label{sec:introduction}
\noindent
Recent years have seen a significant interest in tractable probabilistic representations that allow exact inference on highly expressive models in polynomial time, thus overcoming the shortcomings of classical probabilistic graphical models~\cite{Koller2009}.
In particular, Sum-Product Networks (SPNs)~\cite{Poon2011}, deep probabilistic models augmenting arithmetic circuits (ACs)~\cite{Darwiche2003} with a latent variable interpretation~\cite{choiD17,Peharz2016} have been successfully employed as state-of-the-art models in many application domains such as computer vision~\cite{Gens2012,Amer2015}, speech~\cite{Zohrer2015}, natural language processing~\cite{Cheng2014,Molina2017}, and robotics \cite{Pronobis2017}.
Here, we introduce SPFlow\footnote{The latest source code and documentation are available at: \url{https://github.com/SPFlow}}, a python library intended to enable researchers on probabilistic modeling to promptly leverage efficiently implemented SPN inference routines, while at the same time allowing them to easily adapt and extend the algorithms available in the literature on SPNs.
In the following, we briefly review SPNs and some of the functions available in SPFlow. We also present a small example on how to extend the library.
\begin{SCfigure}[1.0][!t]
\begin{subfigure}{0.5\textwidth}
\centering
\includegraphics[height=4cm]{images/basicspn}
\end{subfigure}%
\par\vspace{-10pt}
\caption{An example of a valid SPN. Here, $V_{1}$, $V_{2}$ and $V_{3}$ are random variables. The structure represents the joint distribution $P(V_{1}, V_{2},V_{3})$. }
\label{fig:spnexample}
\end{SCfigure}
\section{Sum-Product Networks}
As illustrated in Fig.~\ref{fig:spnexample}, an SPN is a rooted directed acyclic graph, comprising \emph{sum}, \emph{product} or \emph{leaf} nodes.
The scope of an SPN is the set of random variables appearing on the network.
An SPN can be defined recursively as follows:
(1) a tractable univariate distribution is an SPN;
(2) a product of SPNs defined over different scopes is an SPN; and
(3), a convex combination of SPNs over the same scope is an SPN.
Thus, a product node in an SPN represents a factorization over independent distributions defined over different random variables, while a sum node stands for a mixture of distributions defined over the same variables.
From this definition, it follows that the joint distribution modeled by such an SPN is a valid probability distribution, i.e., each complete and partial evidence inference query produces a consistent probability value~\cite{Poon2011,Peharz2015a}.
To answer probabilistic queries in an SPN, we evaluate the nodes starting at the leaves.
Given some evidence, the probability output of querying leaf distributions is propagated bottom up following the respective operations.
To compute marginals, i.e., the probability of partial configurations, we set the probability at the leaves for those variables to $1$ and then proceed as before.
To compute MPE states, we replace sum by max nodes and then evaluate the graph first with a bottom-up pass, but instead of weighted sums, we pass along the weighted maximum value.
Finally, in a top-down pass, we select the paths that lead to the maximum value, finding approximate MPE states \cite{Poon2011}.
All these operations traverse the tree at most twice and therefore can be achieved in linear time w.r.t. the size of the SPN.
\section{An Overview of the SPFlow Library}
As most operations on SPNs are based on traversing the graph in a bottom-up or top-down fashion, we model the library as basic node structures and generic traversal operations on them. The rest of the SPN operations are then implemented as lambda functions that rely on the generic operations.
Therefore, the SPFlow library puts the graph structure at the center. All other operations receive or produce a graph that can be then used by the other operations. This increases the flexibility and potential uses. As an example, one can create a structure using different algorithms and then save it to disk. Later on, one can load it again and do parameter optimization using, e.g., TensorFlow~\cite{tensorflow2015-whitepaper}, and then do inference to answer probabilistic queries. All those operations can be composed as they rely only on the given structure. More specifically, the functionality of SPFlow covers:
\begin{center}
\begin{tabularx}{1\linewidth}{ X X X X } \hline
\bf Modeling & \bf Evaluation & \bf Sampling & \bf Other \\
\small
\begin{itemize}[noitemsep,topsep=0pt, leftmargin=*]
\item Domain specific\newline language (DSL)
\item Structure \mbox{Learning}
\item Random \mbox{Structures}
\item Checks for\newline \mbox{consistency} and\newline \mbox{completeness}
\end{itemize} &
\small
\begin{itemize}[noitemsep,topsep=0pt, leftmargin=*]
\item Joint queries
\item Marginal queries
\item Approximate most probable\newline explanation (MPE)
\item Parameter\newline Optimization
\end{itemize} &
\small
\begin{itemize}[noitemsep,topsep=0pt, leftmargin=*]
\item Ancestral \mbox{Sampling}
\item Conditional \mbox{Sampling}
\end{itemize} &
\small
\begin{itemize}[noitemsep,topsep=0pt, leftmargin=*]
\item Plotting
\item JSON
\item Text Formats
\item Standard Pickling
\item \mbox{Tensorflow} Graphs
\item Convert to C code
\end{itemize}
\\
\hline
\end{tabularx}
\end{center}
\newpage
\section{SPFlow Programming Examples}
To create the SPN shown already in Fig.~\ref{fig:spnexample}, one simply
writes the follow code after loading the library:
{\scriptsize \begin{lstlisting}[language=Python]
spn = 0.4 * (Categorical(p=[0.2, 0.8], scope=0) *
(0.3 * (Categorical(p=[0.3, 0.7], scope=1) *
Categorical(p=[0.4, 0.6], scope=2))
+ 0.7 * (Categorical(p=[0.5, 0.5], scope=1) *
Categorical(p=[0.6, 0.4], scope=2))))
+ 0.6 * (Categorical(p=[0.2, 0.8], scope=0) *
Categorical(p=[0.3, 0.7], scope=1) *
Categorical(p=[0.4, 0.6], scope=2))
\end{lstlisting}}
Alternatively, we can create the same spn using the following code:
{\scriptsize \begin{lstlisting}[language=Python]
p0 = Product(children=[Categorical(p=[0.3, 0.7], scope=1), Categorical(p=[0.4, 0.6], scope=2)])
p1 = Product(children=[Categorical(p=[0.5, 0.5], scope=1), Categorical(p=[0.6, 0.4], scope=2)])
s1 = Sum(weights=[0.3, 0.7], children=[p0, p1])
p2 = Product(children=[Categorical(p=[0.2, 0.8], scope=0), s1])
p3 = Product(children=[Categorical(p=[0.2, 0.8], scope=0), Categorical(p=[0.3, 0.7], scope=1)])
p4 = Product(children=[p3, Categorical(p=[0.4, 0.6], scope=2)])
spn = Sum(weights=[0.4, 0.6], children=[p2, p4])
assign_ids(spn)
rebuild_scopes_bottom_up(spn)
\end{lstlisting}}
\noindent Actually, Fig.~\ref{fig:spnexample} itself was plotted by calling
\lstinline[language=Python]{plot_spn(spn, 'basicspn.pdf')}. To evaluate the likelihood of the SPN on some data, one can use Python or TensorFlow:
{\scriptsize \begin{lstlisting}[language=Python]
test_data = np.array([1.0, 0.0, 1.0]).reshape(-1, 3)
log_likelihood(spn, test_data)
eval_tf(spn, test_data)
\end{lstlisting}}
\noindent To learn the parameters of the SPN using TensorFlow, one calls
{\scriptsize \begin{lstlisting}[language=Python]
optimized_spn = optimize_tf(spn, test_data)
log_likelihood(optimized_spn, test_data)
\end{lstlisting}}
\noindent Marginal likelihoods just require setting "nan" on the features to be marginalized:
{\scriptsize \begin{lstlisting}[language=Python]
log_likelihood(spn, np.array([1, 0, np.nan]).reshape(-1, 3)
\end{lstlisting}}
\noindent Sampling creates instances where samples are obtained for the cells that contain "nan":
{\scriptsize \begin{lstlisting}[language=Python]
sample_instances(spn, np.array([np.nan, 0, 0]).reshape(-1, 3), RandomState(123))
\end{lstlisting}}
\noindent To learn the structure of an SPN, say for binary classification, let us first create a 2D dataset with a binary label. An instance has label 0, when the features are close to the generating Gaussian with mean 5. It has label 1, when the features are closer to the generating Gaussian with a mean of 15:
{\scriptsize \begin{lstlisting}[language=Python]
train_data = np.c_[np.r_[np.random.normal(5, 1, (500, 2)),
np.random.normal(15, 1, (500, 2))],
np.r_[np.zeros((500, 1)), np.ones((500, 1))]]
\end{lstlisting}}
\noindent Now we specify the statistical types of the random variables and learn a SPN classifier:
{\scriptsize \begin{lstlisting}[language=Python]
ds_context = Context(parametric_type=[Gaussian, Gaussian, Categorical])
ds_context.add_domains(train_data)
spn = learn_classifier(train_data,ds_context,learn_parametric, 2)
\end{lstlisting}}
\noindent Doing MPE on the classification SPN gives us the classifications.
{\scriptsize \begin{lstlisting}[language=Python]
mpe(spn, np.array([3.0, 4.0, np.nan, 12.0, 18.0, np.nan]).reshape(-1, 3))
\end{lstlisting}}
\noindent The third column is the label and we can see that it behaves as expected in this synthetic example.
\newpage
\section{Extending the SPFlow library}
To illustrate the flexibility of SPflow, we show how to extend inference to other leave types. Here we implement the Pareto leaf distribution. It relies on the infrastructure already present.
{\scriptsize \begin{lstlisting}[language=Python]
class Pareto(Leaf):
def __init__(self, a, scope=None):
Leaf.__init__(self, scope=scope)
self.a = a
def pareto_likelihood(node, data, dtype=np.float64):
probs = np.ones((data.shape[0], 1), dtype=dtype)
from scipy.stats import pareto
probs[:] = pareto.pdf(data[:, node.scope], node.a)
return probs
add_node_likelihood(Pareto, pareto_likelihood)
spn = 0.3 * Pareto(2.0, scope=0) + 0.7 * Pareto(3.0, scope=0)
log_likelihood(spn, np.array([1.5]).reshape(-1, 1))
\end{lstlisting}}
\noindent The same kind of extensions are possible for all other operations. This way it is easy to extend the library, by adding new nodes or even new operations. For instance, one could easily interface probabilistic programming languages and tools such as PyMC or Pyro.
{\bf Acknowledgements.} {RP acknowledges support from the European Union's Horizon 2020 research and innovation programme under the Marie Sk\l{}odowska-Curie Grant Agreement No.~797223 --- HYBSPN. This work has benefited from the DFG project
CAML (KE 1686/3-1), as part of the SPP 1999, and from
the BMBF project MADESI (01IS18043B).}
\vskip 0.2in
\bibliographystyle{unsrt}
| {'timestamp': '2019-01-15T02:00:10', 'yymm': '1901', 'arxiv_id': '1901.03704', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03704'} | arxiv |
\section*{Article}
In the last decade or so we have seen tremendous progress in
Artificial Intelligence (AI). AI is now in the real world, powering
applications that have a large practical impact. Most of it is based
on modeling, i.e.\ machine learning of statistical models that make it
possible to predict what the right decision might be in future
situations. For example, we now have object recognition, speech
recognition, game playing, language understanding, and machine
translation systems that rival human performance, and in many cases
exceed it
\cite{russakovsky:arxiv14,hessel:arxiv17,awadalla:parity18}. In each
of these cases, massive amounts of supervised data exists, specifying
the right answer to each input case. With the massive amounts of
computation that is now available, it is possible to train neural
networks to take advantage of the data. Therefore, AI works great in
tasks where we already know what needs to be done.
The next step for AI is machine creativity. Beyond modeling there is a
large number of tasks where the correct, or even good, solutions are
not known, but need to be discovered. For instance designing
engineering solutions that perform well at low costs, or web pages
that serve the users well, or even growth recipes for agriculture in
controlled greenhouses are all tasks where human expertise is scarce
and good solutions difficult to come by
\cite{hu:aiedam08,dupuis:ijss15,ishida:bullet18,harper:biorxiv18,miikkulainen:iaai18}. Methods
for machine creativity have existed for decades. I believe we are now
in a similar situation as deep learning was a few years ago: with the
million-fold increase in computational power, those methods can now be
used to scale up to real-world tasks.
Evolutionary computation is in a unique position to take advantage of
that power, and become the next deep learning. To see why, let us
consider how humans tackle a creative task, such as engineering
design. A typical process starts with an existing design, perhaps an
earlier one that needs to be improved or extended, or a design for a
related task. The designer then makes changes to this solution and
evaluates them. S/he keeps those changes that work well and discards
those that do not, and iterates. It terminates when a desired level of
performance is met, or when no better solutions can be found---at
which point the process may be started again from a different initial
solution. Such a process can be described as a hill-climbing process
(Figure~\ref{fg:hillclimb}$a$). With good initial insight it is possible
to find good solutions, but much of the space remains unexplored and
many good solutions may be missed.
\begin{figure*}
\begin{center}
\begin{minipage}{0.5\textwidth}
\centering
\includegraphics[width=\textwidth]{hillclimb.png}\\
{\footnotesize (a) Search Space Appropriate for Hill-Climbing}
\end{minipage}
\hfill
\begin{minipage}{0.4\textwidth}
\centering
\includegraphics[width=\textwidth]{deception.png}\\
{\footnotesize (a) Search Space in a Creative Domain}
\end{minipage}
\caption{Challenge of Creative Problem Solving. Human design
process as well as deep learning and reinforcement learning can
be seen as hill-climbing processes. They work well as long as
the search space is relatively small, low-dimensional, and well
behaved. However, creative problems where solutions are not
known may require search in a large, high-dimensional spaces
with many local optima. Population-based search through
evolutionary computation is well-suited for such problems: it
discovers and utilizes partial solutions, searches along
multiple objectives, and novelty. (Image credit:
http://deap.readthedocs.io/en/latest/api/benchmarks.html)}
\label{fg:hillclimb}
\end{center}
\end{figure*}
Interestingly, current machine learning methods are also based on
hill-climbing. Neural networks and deep learning follow a gradient
that is computed based on known examples of desired behavior
\cite{schmidhuber:nn15,lecun:nature15}. The gradient specifies how
the neural network should be adjusted to make it perform slightly
better, but it also does not have a global view of the landscape,
i.e.\ where to start and which hill to climb. Similarly, reinforcement
learning starts with an individual solution and then explores
modifications around that solution, in order to estimate the gradient
\cite{salimans:arxiv17,zhang:arxiv17}. With large enough networks and
datasets and computing power, these methods have achieved remarkable
successes in recent years.
However, the search landscape in creative tasks is likely to be less
amenable to hill climbing (Figure~\ref{fg:hillclimb}$b$). There are
three challenges: (1) The space is large, consisting of too many
possible solutions to be explored fully, even with multiple restarts;
(2) the space is high-dimensional, requiring that good values are
found for many variables at once; and (3) the space is deceptive,
consisting of multiple peaks and valleys, making it difficult to make
progress through local search.
Evolutionary computation, as a population-based search technique, is
in a unique position to meet these challenges. First, it makes it
possible to explore many areas of the search space at once. In effect,
evolution performs multiple parallel searches, not a single
hill-climb. By itself such parallel search would result in only a
linear improvement, however, the main advantage is that the searches
interact: if there is a good partial solution found in one of the
searches, the others can immediately take advantage of it as
well. That is, evolution finds building blocks, or schemas, or
stepping stones, that are then combined to form better comprehensive
solutions \cite{holland:adaptation,meyerson:gecco17,forrest:foga93}.
This approach can be highly effective, as shown e.g.\ in the
multiplexer benchmark problem \cite{koza:foga91}. Multiplexers are
easy to design algorithmically: the task is to output the bit (among
$2^n$ choices) specified by an $n$-bit address. However, as a search
problem in the space of logical operations they grow very quickly, as
$2^{2^{n+2^n}}$. There is, however, structure in that space that
evolution can discover and utilize effectively. It turns out that
evolution can discover solutions in extremely large such cases,
including the 70-bit multiplexer (i.e.\ $n=6$) with a search space of
at least $2^{2^{70}}$ states. It is hard to conceptualize a number
that large, but to give an idea, imagine having the number printed on
a 10pt font on a piece of paper. It would take light 95 years to
traverse from the beginning to the end of that number.
Second, population-based search makes it possible to find solutions in
extremely high-dimensional search spaces as well. Whereas it is very
difficult to build a model with high-order interactions beyond pairs
or triples, the population represents such interactions implicitly, as
the collection of actual combinations of values that exist in the good
solutions in the population. Recombination of those solutions then
makes it possible to collect good values for a large number of
dimensions at once.
As an example, consider the problem of designing an optimal schedule
for metal casting \cite{deb:ejor17}. There are variables for number of
each type of object to be made in each heat (i.e.\ melting
process). The number of objects and heats can be grown from a few
dozen, which can be solved with standard methods, to tens of
thousands, resulting in billion variables. Yet, utilizing an
initialization process and operators customized to exploit the
structure in the problem, it is possible to find good combinations for
them, i.e.\ find near-optimal solutions in a billion-dimensional
space. Given that most search and optimization methods are limited to
six orders of magnitude fewer variables, this scaleup makes it
possible to apply optimization to entire new category of problems.
Third, population-based search can be adapted naturally to problems
that are highly deceptive. One approach is to utilize multiple
objectives \cite{deb:ppsn00}: if search gets stuck in one dimension,
it is possible to make progress among other dimensions, and thereby
get around deception. Another approach is to emphasize novelty, or
diversity, of solutions in search \cite{stanley:book15}. The search
does not simply try to maximize fitness, but also favors solutions
that are different from those that already exist. Novelty can be
expressed as part of fitness, or a separate objective, or serve as a
minimum criterion for selection, or as a criterion for mate selection
and survival \cite{cuccu:evostar11,lehman:gecco10a,mouret:evolcomp12,gomes:gecco15,mcquesten:phd02}.
For instance, in the composite novelty method \cite{shahrzad:alife18},
different objectives are defined for different aspects of performance,
and combined so that they specify an area of search space with useful
tradeoffs. Novelty is then used as the basis for selection and
survival within this area. This method was illustrated in the problem
of designing minimal sorting networks, which have to sort a set of $n$
numbers correctly, but also consist of as few comparator elements as
possible (which swap two numbers), and as few layers as possible
(where comparisons can be performed in parallel). The search space is
highly deceptive in that often the network structure needs to be
changed substantially to make it smaller. Combining multiple
objectives and novelty results in better solutions, and finds them
faster, than traditional evolution, multiobjective evolution, and
novelty search alone. The approach has already found a new minimal
network for 20 inputs \cite{shahrzad:gptp19}, and is now being
extended to larger networks.
To conclude, evolutionary computation is an AI technology that is on
the verge of a breakthrough, as a way to take machine creativity to
the real world. Like deep learning, it can take advantage of the large
amount of compute that is now becoming available. Because it is a
population-based search method, it can scale with compute better than
other machine learning approaches, which are largely based on
hill-climbing. With evolution, we should see many applications in the
near future where human creativity is augmented by evolutionary search
in discovering complex solutions, such as those in engineering,
healthcare, agriculture, financial technology, biotechnology, and
e-commerce, resulting in more complex and more powerful solutions than
are currently possible.
\small
\bibliographystyle{ACM-Reference-Format}
| {'timestamp': '2020-02-25T02:12:37', 'yymm': '1901', 'arxiv_id': '1901.03775', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03775'} | arxiv |
\section{Introduction}
{\em Explainable AI} refers to artificial intelligence and machine learning techniques that can provide human understandable justification for their behavior.
Explainability is important in situations where human operators work alongside autonomous and semi-autonomous systems because it can help build rapport, confidence, and understanding between the agent and its operator.
In the event that an autonomous system fails to complete a task or completes it in an unexpected way, explanations help the human collaborator
understand the circumstances that led to the behavior, which also allows the operator to make an informed decision on how to address the behavior.
Prior work on explainable AI (XAI) has primarily focused on non-sequential problems such as image classification and captioning ~\cite{wang2017residual,xu2015show,you2016image}.
Since these environments are episodic in nature, the model's output depends only on its input.
In sequential environments, decisions that the agent has made in the past influence future decisions.
To simplify this, agents often make locally optimal decisions by selecting actions that maximize some discrete notion of expected future reward or utility.
To generate plausible explanations in these environments, the model must unpack this local reward or utility to reason about how current actions affect future actions. On top of that, it needs to communicate the reasoning in a human understandable way, which is a difficult task.
To address this challenge of human understandable explanation in sequential environments, we introduce the alternative task of rationale generation in sequential environments.
{\em Automated rationale generation} is a process of producing a natural language explanation for agent behavior {\em as if a human had performed the behavior}~\cite{ehsan2017rationalization}.
The intuition behind rationale generation is that humans can engage in effective communication
by verbalizing plausible motivations for their action. The communication can be effective even when the verbalized reasoning does not have a consciously accessible neural correlate of
the decision-making process~\cite{block2007consciousness,block2005two,fodor1994elm}.
Whereas an explanation can be in any communication modality, rationales are natural language explanations that don't literally expose the inner workings of an intelligent system.
Explanations can be made by exposing the inner representations and data of a system, though this type of explanation may not be accessible or understandable to non-experts.
In contrast, contextually appropriate natural language rationales are
accessible and intuitive to non-experts, facilitating understanding and communicative effectiveness.
Human-like communication can also afford human factors advantages such as higher degrees of satisfaction, confidence, rapport, and willingness to use autonomous systems.
Finally, rationale generation is fast, sacrificing
an accurate view of agent decision-making for real-time response, making it appropriate for real-time human-agent collaboration.
Should deeper, more grounded and technical
explanations be necessary, rationale generation may need to be supplemented by other explanation or visualization techniques.
In preliminary work~\cite{ehsan2017rationalization} we showed that recurrent neural networks can be used to translate internal state and action representations into natural language.
That study, however, relied on synthetic natural language data for training.
In this work, we explore if human-like plausible rationales can be generated using a non-synthetic, natural language corpus of human-produced explanations.
To create this corpus, we developed a methodology for conducting remote think-aloud protocols \cite{fonteyn1993description}.
Using this corpus, we then use
a neural network based on~\cite{ehsan2017rationalization}
to translate an agent's state and action information into natural language rationales, and show how variations in model inputs can produce two different types of rationales.
Two user studies help us understand the perceived quality of the generated rationales along dimensions of human factors.
The first study indicates that our rationale generation technique produces plausible and high-quality rationales and explains the differences in user perceptions.
In addition to understanding user preferences, the second study demonstrates how the intended design behind the rationale types aligns with their user perceptions.
The philosophical and linguistic discourse around the notion of explanations~\cite{miller2017explanation, lipton2001good} is beyond the scope of this paper.
To avoid confusion, we use the word "rationale" to refer to natural language-based post-hoc explanations that are meant to sound like what a human would say in the same situation.
We opt for "rationale generation" instead of "rationalization" to signal that the agency lies with the receiver and interpreter (human being) instead of the producer (agent).
Moreover, the word rationalization may carry a connotation of making excuses~\cite{maruna2006fundamental} for an (often controversial) action, which is another reason why we opt for \textit{rationale generation} as a term of choice.
In this paper, we make the following contributions in this paper:
\begin{itemize}
\item We present a methodology for collecting high-quality human explanation data based on remote think-aloud protocols.
\item We show how this data can be used to configure neural translation models to produce two types of human-like rationales: $\left(1\right)$ concise, localized and $\left(2\right)$ detailed, holistic rationales. We demonstrate the alignment between the intended design of rationale types and the actual perceived differences between them.
\item We quantify the perceived quality of the rationales and preferences between them,
and we use qualitative data to explain these perceptions and preferences.
\end{itemize}
\section{Related Work}
Much of the previous work on explainable AI has focused on {\em interpretability}.
While there is no one definition of interpretability with respect to machine learning models, we view interpretability as a property of machine learned models that dictate the degree to which a human user---AI expert or user---can come to conclusions about the performance of the model on specific inputs.
Some types of models are inherently interpretable, meaning they require relatively little effort to understand.
Other types of models require more effort to make sense of their performance on specific inputs.
Some non-inherently interpretable models can be made interpretable in a post-hoc fashion through explanation or visualization.
Model-agnostic post-hoc methods can help to make models intelligible without custom explanation or visualization technologies and without changing the underlying model to make them more interpretable~\cite{ribeiro2016should,yosinski2015understanding}.
Explanation generation can be described as a form of {\em post-hoc interpretability}~\cite{2016arXiv160603490L, miller2017explanation}; explanations are generated on-demand based on the current state of a model and---potentially---meta-knowledge about how the algorithm works.
An important distinction between interpretability and explanation is that explanation does not elucidate precisely how a model works but aims to give useful information for practitioners and end users.
Abdul et al.~\cite{abdul2018trends} conduct a comprehensive survey on trends in explainable and intelligible systems research.
Our work on rationale generation is a model-agnostic explanation system that works by translating the internal state and action representations of an arbitrary reinforcement learning system into natural language.
Andreas, Dragan, and Klein~\cite{andreas2017translating} describe a technique that translates message-passing policies between two agents into natural language.
An alternative approach to translating internal system representations into natural language is to add explanations to a supervised training set such that a model learns to output a classification as well as an explanation~\cite{codella2018teaching}.
This technique has been applied to generating explanations about procedurally generated game level designs~\cite{guzdial2018explainable}.
Beyond the technology, user perception and acceptance matter because they influence trust in the system, which is crucial to adoption of the technology.
Established fields such as information systems enjoy a robust array of technology acceptance models such as the Technology Acceptance Model (TAM) \cite{davis1989perceived} and Unified Theory of Acceptance and Use of Technology Model (UTAUT) \cite{venkatesh2003user} whose main goal is to explain variables that influence user perceptions.
Utilizing dimensions such as perceived usefulness and perceived ease of use, the TAM model aimed to explain prospective expectations about the technological artifacts.
UTAUT uses constructs like performance expectancy, effort expectancy, etc. to understand technology acceptance. The constructs and measures in these models build on each other.
In contrast, due to a rapidly evolving domain, a robust and well-accepted user perception model of XAI agents is yet to be developed.
Until then, we can take inspiration from general acceptance models (such as TAM and UTAUT) and adapt their constructs to understand the perceptions of XAI agents.
For instance, the human-robot interaction community has used them as basis to understand users' perceptions towards robots~\cite{ezer2009attitudinal, beer2011understanding}.
While these acceptance models are informative, they often lack sociability factors such as "humanlike-ness".
Moreover, TAM-like models does not account for autonomy in systems, let alone autonomous XAI systems.
Building on some constructs from TAM-like models and original formative work, we attempt to address the gaps in understanding user perceptions of rationale-generating XAI agents.
The dearth of established methods combined with the variable conceptions of explanations make evaluation of XAI systems challenging.
Binns et al.~\cite{binns2018s} use scenario-based survey design~\cite{carroll2000making} and presented different types of hypothetical explanations for the same decision to measure perceived levels of justice.
One non-neural based network evaluates the usefulness and naturalness of generated explanations~\cite{broekens2010you}.
Rader et al.~\cite{rader2018explanations} use explanations manually generated from content analysis of Facebook's News Feed to study perceptions of algorithmic transparency.
One key differentiating factor of our approach is that our evaluation is based rationales that are actual system outputs (compared to hypothetical ones).
Moreover, user perceptions of our system's rationales directly influence the design of our rationale generation technique.
\begin{figure}[t]
\centering
\includegraphics[width=1.0\linewidth]{frogger-pipeline2.png}
\vspace{-1.5\baselineskip}
\caption{End-to-end pipeline for training a system that can generate explanations.}
\label{fig:end-to-end}
\end{figure}
\section{Learning to Generate Rationales}
We define a \textit{rationale} as an explanation that justifies an action based on how a human would think.
These rationales do not necessarily reveal the true decision making process of an agent, but still provide insights about why an agent made a decision in a form that is easy for non-experts to understand.
Rationale generation requires translating events in the game environment into natural language outputs. Our approach to rationale generation involves two steps: (1)~collect a corpus of think-aloud data from players who explained their actions in a game environment; and (2)~use this corpus to train an encoder-decoder network to generate plausible rationales for any action taken by an agent (see Figure~\ref{fig:end-to-end}).
We experiment with rationale generation using autonomous agents that play the arcade game, {\em Frogger}.
Frogger is a good candidate for our experimental design of a rationale generation pipeline for general sequential decision making tasks because it is a simple Markovian environment, making it an ideal stepping stone towards a real world environment.
Our rationale generation technique is agnostic to the type of agent or how it is trained, as long as the representations of states and actions used by the agent can be exposed to the rationale generator and serialized.
\subsection{Data Collection Interface}
There is no readily available dataset for the task of learning to generate explanations. Thus, we developed a methodology to collect live ``think-aloud'' data from players as they played through a game. This section covers the two objectives of our data collection endeavor:
\begin{enumerate}
\item Create a think-aloud protocol in which players provide natural rationales for their actions.
\item Design an intuitive player experience that facilitates accurate matching of the participants' utterances to the appropriate state in the environment.
\end{enumerate}
\begin{figure}[t]
\begin{center}
\includegraphics[width=0.75\linewidth]{Play4.png}
\end{center}
\caption{Players take an action and verbalize their rationale for that action. (1)~After taking each action, the game pauses for 10 seconds. (2)~Speech-to-text transcribes the participant's rationale for the action. (3)~Participants can view their transcribed rationales near real-time and edit if needed.}
\label{fig:Play}
\end{figure}
To train a rationale-generating explainable agent, we need data linking game states and actions to their corresponding natural language explanations. To achieve this goal, we built a modified version of Frogger in which players simultaneously play the game and also explain each of their actions.
The entire process is divided into three phases: (1)~A guided tutorial, (2)~rationale collection, and (3)~transcribed explanation review.
During the guided tutorial~(1), our interface provides instruction on how to play through the game, how to provide natural language explanations, and how to review/modify any explanations they have given.
This helps ensure that users are familiar with the interface and its use before they begin providing explanations.
For rationale collection~(2), participants play through the game while explaining their actions out loud in a turn-taking mechanism.
Figure~\ref{fig:Play} shows the game embedded into the explanation collection interface.
To help couple explanations with actions (attach annotations to concrete game states), the game pauses for 10 seconds after each action is taken.
During this time, the player's microphone automatically turns on and the player is asked to explain their most recent action while a speech-to-text library \cite{github_2017} automatically transcribes the explanation real-time.
The automatic transcription substantially reduces participant burden as it is more efficient
than typing an explanation.
Player can use more or less than the default 10-second pause to collect the explanation.
Once done explaining, they can view their transcribed text and edit it if necessary.
During pretesting with 14 players, we observed that players often repeat a move for which the explanation is the same as before.
To reduce burden of repetition, we added a "redo" button that can be used to recycle rationales for consecutive repeated actions.
When the game play is over, players move to transcribed explanation review portion ~(3). Here, they can can step through all the actions-explanation pairs. This stage allows reviewing in both a situated and global context.
The interface is designed so that no manual hand-authoring/editing of our explanation data was required before
using it to train our machine learning model. Throughout the game, players have the opportunity to organically edit their own data without impeding their work-flow. This added layer of organic
editing is crucial in ensuring that we can directly input the collected data into the network with zero manual cleaning. While we use Frogger as a test environment in our experiments, a similar user experience can be designed using other turn-based environments with minimal effort.
\begin{figure}[t]
\includegraphics[width=\linewidth]{review_with_legend.png}
\caption{Players can step-through each of their action-rationale pairs and edit if necessary. (1)~Players can watch an action-replay while editing rationales. (2)~These buttons control the flow of the step-through process. (3)~The rationale for the current action gets highlighted for review.}
\label{fig:Review}
\end{figure}
\subsection{Neural Translation Model}
We use an encoder-decoder network~\cite{bahdanau2014neural} to teach our network to generate relevant natural language explanations for any given action.
These kinds of networks are commonly used for machine translation tasks or dialogue generation, but their ability to understand sequential dependencies between the input and the output make it suitable for our task.
Our encoder decoder architecture is similar to that used in \cite{ehsan2017rationalization}.
The network learns how to translate the input game state representation
$X = x_1, x_2, ..., x_n$, comprised of the representation of the game combined with other influencing factors,
into an output rationale as a sequence of words
$Y = y_1, y_2, ..., y_m$
where $y_i$ is a word.
Thus our network learns to translate game state and action information into natural language rationales.
The encoder and decoder are both recurrent neural networks (RNN) comprised of Gated Recurrent Unit (GRU) cells since our training process involved a small amount of data.
The decoder network uses an additional attention mechanism~\cite{luong2015effective} to learn to weight the importance of different components of the input with regard to their effect on the output.
To simplify the learning process, the state of the game environment is serialized into a sequence of symbols where each symbol characterizes a sprite in the grid-based represntation of the world.
To this, we append information concerning Frogger's position, the most recent action taken, and the number of lives the player has left to create the input representation $X$.
On top of this network structure, we vary the input configurations with the intention of producing varying styles of rationales.
Empirically, we found that a reinforcement learning agent using tabular $Q$-learning \cite{watkins92} learns to play the game effectively when given a limited window for observation.
Thus a natural configuration for the rationale generator is to give it the same observation window that the agent needs to learn to play.
We refer to this configuration of the rationale generator as {\em focused-view} generator.
This view, however, potentially limits the types of rationales that can be learned since the agent will only be able to see a subset of the full state. Thus we formulated a second configuration that gives the rationale generator the ability to use all information on the board to produce rationales.
We refer to this as {\em complete-view} generator.
An underlying question is thus whether rationale generation should use the same information that the underlying black box reasoner needs to solve a problem or if more information is advantageous at the expense of making rationale generation a harder problem.
In the studies described below, we seek to understand how these configurations affect human perceptions of the agent when presented with generated rationales.
\subsubsection{Focused-view Configuration}
In the \textit{focused-view} configuration, we used a windowed representation of the grid, i.e. only a $7\times7$ window around the Frog was used in the input.
Both playing an optimal game of Frogger and generating relevant explanations based on the current action taken typically only requires this much local context.
Therefore providing the agent with only the window around Frogger helps the agent produce explanations grounded in it's neighborhood.
In this configuration, we designed the inputs such that the network is prone to prioritize short-term planning producing localized rationales instead of long-term planning.
\subsubsection{Complete-view Configuration}
The \textit{complete-view} configuration is an alternate setup that provides the entire game board as context for the rationale generation.
There are two differences between this configuration and the focused-view configuration.
First, we use the entire game screen as a part of the input. The agent now has the opportunity to learn which other long-term factors in the game may influence it's rationale.
Second, we added noise to each game state to force the network to generalize when learning, reduce the likelihood that spurious correlations are identified, and to give the model equal opportunity to consider factors from all sectors of the game screen.
In this case noise was introduced by replacing input grid values with dummy values. For each grid element, there was a $20\%$ chance that it would get replaced with a dummy value.
Given the input structure and scope, this configuration should prioritize rationales that exhibit long-term planning and consider the broader context.
\begin{table}[h]
\caption{Examples of \textit{focused-view} vs \textit{complete-view} rationales generated by our system for the same set of actions.}
\label{tab:components}
\begin{tabular}{p{0.1\columnwidth}p{0.4\columnwidth}p{0.4\columnwidth}}
\toprule
{\bf Action} & {\bf Focused-view} & {\bf Complete-view}\\
\midrule
Right & I had cars to the left and in front of me so I needed to move to the right to avoid them. & I moved right to be more centered. This way I have more time to react if a car comes from either side. \\
\rowcolor{tablerowcolor} Up & The path in front of me was clear so it was safe for me to move forward. & I moved forward making sure that the truck won\textquotesingle t hit me so I can move forward one spot. \\
Left & I move to the left so I can jump onto the next log. & I moved to the left because it looks like the logs and top or not going to reach me in time, and I\textquotesingle m going to jump off if the law goes to the right of the screen. \\
\rowcolor{tablerowcolor} Down & I had to move back so that I do not fall off. & I jumped off the log because the middle log was not going to come in time. So I need to make sure that the laws are aligned when I jump all three of them. \\
\bottomrule
\end{tabular}
\end{table}
\section{Perception Study: Candidate vs. Baseline Rationales}
In this section, we
assess whether the rationales generated using our technique are plausible and explore
how humans perceive them along various dimensions of human factors.
For our rationales to be plausible we would expect that human users indicate a strong preference for rationales generated by our system (either configuration) over those generated by a baseline rationale generator.
We also compare them to exemplary human-produced explanations to get a sense for how far from the upper bound we are.
This study aims to achieve two main objectives.
First, it seeks to confirm the hypothesis that humans prefer rationales generated by each of the configurations over randomly selected rationales across all dimensions.
While this baseline is low, it establishes that rationales generated by our technique are not nonsensical.
We can also measure the distance from the upper-bound (exemplary human rationales) for each rationale type.
Second, we attempt to understand the underlying components that influence
the perceptions of the generated rationales along four dimensions of human factors: {\em confidence}, {\em human-likeness}, {\em adequate justification}, and {\em understandability}.
\subsection{Method}
To gather the training set of game state annotations, we deployed our data collection pipeline on {\em Turk Prime}~\cite{litman2017turkprime}.
From 60 participants
we collected over 2000 samples of human actions in Frogger coupled with natural language explanations. The average duration of this task was around 36 minutes.
The parallel corpus of the collected game state images and natural language explanations was used to train the encoder-decoder network.
Each RNN in the encoder and the decoder was parameterized with GRU cells with a hidden vector size of 256.
The entire encoder-decoder network was trained for 100 epochs.
For the perception user study, we collected both within-subject and between-subject data.
We recruited 128 participants, split into two equal experimental groups through {\em TurkPrime}: Group 1 (age range = 23 - 68 years, M = 37.4, SD = 9.92) and Group 2 (age range = 24 - 59 years, M = 35.8, SD= 7.67).
On average, the task duration was approximately 49 minutes.
46\% of our participants were women, and the 93\% of participants were self-reported as from the United States while the remaining 7\% of participants were self-reported as from India.
\begin{figure}
\centering
\includegraphics[width=1.0\linewidth]{Study_Screenshot.PNG}
\caption{Screenshot from user study (setup 2) depicting the action taken and the rationales: \textit{P = Random, Q = Exemplary, R = Candidate}}
\label{fig:Study}
\end{figure}
All participants watched a counterbalanced series of five videos.
Each video depicted an action taken by Frogger accompanied by three different types of rationales that justified the action (see Figure~\ref{fig:Study}).
Participants rated each rationale on a labeled, 5-point, bipolar Likert-scale along 4 perception dimensions (described below).
Thus, each participant provided 12 ratings per action, leading to 60 perception ratings for five actions.
Actions collected from human players comprised the set of Frogger's actions. These actions were then fed into the system to generate rationales to be evaluated in the the user studies.
In order to get a balance between participant burden, fatigue, the number of actions, and regions of the game, we pretested with 12 participants.
Five actions was the limit beyond which participants' fatigue and burden substantially increased.
Therefore, we settled on five actions (up (twice), down, left, and right) in the major regions of the game-- amongst the cars, at a transition point, and amongst the logs.
This allowed us to test our rationale generation configurations in all possible action-directions in all the major sections of the game.
The study had two identical experimental conditions, differing only by type of \textit{candidate rationale}.
Group 1 evaluated the \textit{focused-view} rationale while Group 2 evaluated the \textit{complete-view} rationales.
In each video, the action was accompanied by three rationales generated by three different techniques (see Figure~\ref{fig:Results_1}):
\begin{itemize}
\item The \textit{exemplary rationale} is the rationale from our corpus that 3 researchers unanimously agreed on as the best one for a particular action. Researchers independently selected rationales they deemed best and iterated until consensus was reached.
This is provided as an upper-bound for contrast with the next two techniques.
\item The \textit{candidate rationale} is the rationale produced by our network, either the focused-view or complete-view configuration.
\item The \textit{random rationale} is a randomly chosen rationale from our corpus.
\end{itemize}
\noindent
For each rationale, participants used a 5-point Likert scale to rate their endorsement of each of following four statements, which correspond to four dimensions of interest.
\begin{enumerate}
\item \textit{Confidence:} This rationale makes me confident in the character's ability to perform it's task.
\item \textit{Human-likeness: } This rationale looks like it was made by a human.
\item \textit{Adequate justification:} This rationale adequately justifies the action taken.
\item \textit{Understandability:} This rationale helped me understand why the agent behaved as it did.
\end{enumerate}
Response options on a clearly labeled bipolar Likert scale ranged from "strongly disagree" to "strongly agree". In a mandatory free-text field, they explained their reasoning behind the ratings for a particular set of three rationales. After answering these questions, they provided demographic information.
These four dimensions emerged from an iterative filtering process that included preliminary testing of the study, informal interviews with experts and participants, and a literature review on robot and technology acceptance models. Inspired by the acceptance models, we created a set of dimensions that were contextually appropriate for our purposes.
Direct one-to-one mapping from existing models was not feasible, given the novelty and context of the Explainable AI technology.
We adapted \textit{confidence}, a dimension that impacts trust in the system \cite{kaniarasu2013robot}, from constructs like performance expectancy \cite{venkatesh2003user} (from UTAUT) and robot performance~\cite{beer2011understanding, chernova2009confidence}.
\textit{Human-likeness}, central to generating human-centered rationales, was inspired from sociability and anthropomorphization factors from HRI work on robot acceptance [\cite{nass1994machines,nass1996can,nass2000machines}.
Since our rationales are justificatory in nature, \textit{adequate justification} is a reasonable measure of output quality (transformed from TAM).
Our rationales also need to be \textit{understandable}, which can signal perceived ease of use (from TAM).
\subsection{Quantitative Analysis}
We used a multi-level model to analyze our data.
All variables were within-subjects except for one: whether the candidate style was focused-view (Group 1) or complete-view (Group 2).
This was a between-subject variable.
There were significant main effects of rationale style ($\chi^2\left(2\right) = 594.80, p<.001$) and dimension ($\chi^2\left(2\right) = 66.86, p<.001$) on the ratings.
The main effect of experimental group was not significant ($\chi^2\left(1\right) = 0.070, p=0.79$).
Figure~\ref{fig:Results_1} shows the average responses to each question for the two different experimental groups.
Our results support our hypothesis that rationales generated with the \textit{focused-view} generator and the \textit{complete-view} generator were judged significantly better across all dimensions than the random baseline
($b=1.90, t\left(252\right)=8.09,p<.001$).
In addition, exemplary rationales were judged significantly higher than candidate rationales.
Though there were significant differences between each kind of candidate rationale and the exemplary rationales, those differences were not the same.
The difference between the \textit{focused-view} candidate rationales and exemplary rationales were significantly \textit{greater} than the difference between \textit{complete-view} candidate rationales and exemplary rationales ($p=.005$).
Surprisingly, this was because the exemplary rationales were rated {\rm lower} in the presence of complete-view candidate rationales ($t\left(1530\right)=-32.12,p<.001$).
Since three rationales were presented simultaneously in each video, it is likely that participants were rating the rationales relative to each other.
We also observe that the \textit{complete-view} candidate rationales received higher ratings in general than did the \textit{focused-view} candidate rationales ($t\left(1530\right)=8.33,p<.001$).
In summary, we have confirmed our hypothesis that both configurations produce rationales that perform significantly better than the \textit{random} baseline across all dimensions.
\begin{figure}[t]
\subcaptionbox{Focus-View condition.\label{fig:Results_1a}}{\includegraphics[width=1.0\linewidth]{Bar_a_exactDimension.png}}\hfill
\subcaptionbox{Complete-View condition.\label{fig:Results_1b}}{\includegraphics[width=1.0\linewidth]{Bar_b_exactDimension.png}}\hfill
\caption{Human judgment results. }
\label{fig:Results_1}
\end{figure}
\subsection{Qualitative Findings and Discussion}
In this section, we look at the open-ended responses provided by our participants to better understand the criteria that participants used when making judgments about the \textit{confidence, human-likeness, adequate justification,} and \textit{understandability} of generated rationales.
These situated insights augment our understanding of rationale generating systems, enabling us to design better ones in the future.
We analyzed the open-ended justifications participants provided using a combination of thematic analysis \cite{aronson1994pragmatic} and grounded theory \cite{strauss1994grounded}.
We developed codes that addressed different types of reasonings behind the ratings of the four dimensions under investigation.
Next, the research team clustered the codes under emergent themes, which form the underlying \textit{components} of the dimensions. Iterating until consensus was reached, researchers settled on the five most relevant components: (1)~\textit{Contextual Accuracy}, (2)~\textit{Intelligibility}, (3)~\textit{Awareness},
(4)~\textit{Relatability}, and (5)~\textit{Strategic Detail} (see Table \ref{tab:components}).
At varying degrees, multiple components influence more than one dimension; that is, there isn't a mutually exclusive one-to-one relationship between components and dimensions.
We will now share how these components influence the dimensions of the human factors under investigation.
When providing examples of our participants' responses, we will use P$1$ to refer to participant 1, P$2$ for participant 2, etc.
To avoid priming during evaluation, we used letters (e.g., A, B, C, etc.) to refer to the different types of rationales.
For better comprehension, we have substituted the letters with appropriate rationale--focused-view, complete-view, or random-- while presenting quotes from participants below.
\subsubsection{Confidence (1)} This dimension gauges the participant's faith in the agent's ability to successfully complete it's task and has \textit{contextual accuracy}, \textit{awareness}, \textit{strategic detail}, and \textit{intelligibility} as relevant components.
With respect to \textit{contextual accuracy}, rationales that displayed ``\ldots recognition of the environmental conditions and [adaptation] to the conditions'' (P22) were a positive influence, while redundant information such as ``just stating the obvious'' (P42) hindered confidence ratings.
\begin{table}[h]
\caption{Descriptions for the emergent \textit{components} underlying the human-factor \textit{dimensions} of the generated rationales.}
\label{tab:components}
\begin{tabular}{p{0.32\columnwidth}p{0.58\columnwidth}}
\toprule
{\bf Component} & {\bf Description}\\
\midrule
Contextual Accuracy & Accurately describes pertinent events in the context of the environment.\\
\rowcolor{tablerowcolor} Intelligibility & Typically error-free and is coherent in terms of both grammar and sentence structure.\\
Awareness & Depicts and adequate understanding of the rules of the environment.\\
\rowcolor{tablerowcolor} Relatability & Expresses the justification of the action in a relatable manner and style.\\
Strategic Detail & Exhibits strategic thinking, foresight, and planning.\\
\bottomrule
\end{tabular}
\end{table}
Rationales that showed \textit{awareness} of ``upcoming dangers and what the best moves to make \ldots [and] a good way to plan'' (P17) inspired confidence from the participants.
In terms of \textit{strategic detail}, rationales that showed "\ldots long-term planning and ability to analyze information" (P28) yielded higher confidence ratings compared to those that were "short-sighted and unable to think ahead" (P14) led to lower perceptions of confidence.
\textit{Intelligibility} alone, without \textit{awareness} or \textit{strategic detail}, was not enough to yield high confidence in rationales. However, rationales that were not \textit{intelligible} (unintelligible) or coherent had a negative impact on participants' confidence:
\begin{displayquote}
The [random and focused-view rationales] include major mischaracterizations of the environment because they refer to an object not present or wrong time sequence, so I had very low confidence. (P66)
\end{displayquote}
\subsubsection{Human-likeness (2)} \textit{Intelligibility, relatability,} and \textit{strategic detail} are components that influenced participants' perception of the extent to which the rationales were made by a human.
Notably, \textit{intelligibility} had mixed influences on the human-likeness of the rationales as it depended on what participants thought ``being human'' entailed.
Some conceptualized humans as fallible beings and rated rationales with errors more \textit{humanlike} because rationales ``with typos or spelling errors \ldots seem even more likely to have been generated by a human" (P19).
Conversely, some thought error-free rationales must come from a human, citing that a ``computer just does not have the knowledge to understand what is going on'' (P24).
With respect to \textit{relatability}, rationales were often perceived as more human-like when participants felt that ``it mirrored [their] thoughts'' (P49), and ``\ldots [laid] things out in a way that [they] would have'' (P58). Affective rationales had high \textit{relatability} because they ``express human emotions including hope and doubt'' (P11).
\textit{Strategic detail} had a mixed impact on human-likeness just like \textit{intelligibility} as it also depended on participants' perception of critical thinking and logical planning. Some participants associated ``\ldots critical thinking [and ability to] predict future situations" (P6) with human-likeness whereas others associated logical planning with non-human-like, but computer-like rigid and algorithmic thinking process flow.
\subsubsection{Adequate Justification (3)} This dimension unpacks the extent to which participants think the rationale adequately justifies the action taken and is influenced by \textit{contextual accuracy}, and \textit{awareness}.
Participants downgraded rationales containing low levels of \textit{contextual accuracy} in the form of irrelevant details. As P11 puts it:
\begin{displayquote}
The [random rationale] doesn't pertain to this situation. [The complete-view] does, and is clearly the best justification for the action that Frogger took because it moves him towards his end goal.
\end{displayquote}
Beyond \textit{contextual accuracy}, rationales that showcase \textit{awareness} of surroundings score high on the \textit{adequate justification} dimension. For instance, P11 rated the \textit{random} rationale low because it showed ``no awareness of the surroundings''. For the same action, P11 rated \textit{exemplary} and \textit{focused-view} rationales high because each made the participant ``believe in the character's ability to judge their surroundings.''
\subsubsection{Understandability (4)}
For this dimension, components such as \textit{contextual accuracy} and \textit{relatability} influence participants' perceptions of how much the rationales helped them understand the motivation behind the agent's actions.
In terms of \textit{contextual accuracy},
many expressed how the contextual accuracy, not the length of the rationale, mattered when it came to understandability.
While comparing understandability of the \textit{exemplary} and \textit{focused-view} rationales, P41 made a notable observation:
\begin{displayquote}
The [exemplary and focused-view rationale] both described the activities/objects in the immediate vicinity of the frog. However, [exemplary rationale (typically lengthier than focused)] was not as applicable because the [focused-view] rationale does a better job of providing contextual understanding of the action.
\end{displayquote}
Participants put themselves in the agent's shoes and evaluated the understandability of the rationales based on how \textit{relatable} they were.
In essence, some asked ``Are these the same reasons I would [give] for this action?'' (P43).
The more relatable the rationale was, the higher it scored for understandability.
In summary, the first study establishes the plausibility of the generated rationales (compared to baselines) and their user perceptions.
However, this study does not provide direct comparison between the two configurations.
\section{Preference Study: Focused-- vs. Complete--View Rationales}
The preference study puts the rationales in direct comparison with each other.
This study
It achieves two main purposes. First, it aims to validate the alignment between the intended design of rationale types and the actual perceived differences between them.
We collect qualitative data on how participants perceived rationales produced by our \textit{focused-view} and \textit{complete-view} rationale generator.
Our expert observation is that the \textit{focused-view} configuration results in concise and localized rationales whereas the \textit{complete-view} configuration results in detailed, holistic rationales.
We seek to determine whether na\"ive users who are unaware of which configuration produced a rationale also describe the rationales in this way.
Second, we seek to understand how and why the preferences between the two styles differed along three dimensions: {\em confidence}, {\em failure}, and {\em unexpected behavior}.
\subsection{Method}
Using similar methods to the first study, we recruited and analyzed the data from 65 people (age range = 23 - 59 years, M = 38.48, SD = 10.16). 57\% percent of the participants were women with 96\% of the participants self-reporting the United States and 4\% self-reporting India as countries they were from. Participants from our first study could not partake in the second one. The average task duration was approximately 46 minutes.
The only difference in the experimental setup between perception and the preference study is the comparison groups of the rationales.
In this study, participants judged the same set of
\textit{focused-} and \textit{complete-view} rationales, however instead of judging each style against two baselines, participants evaluate the \textit{focused-} and \textit{complete-view} rationales in direction comparison with each other.
Having watched the videos and accompanying rationales, participants responded to the following questions comparing both configurations:
\begin{enumerate}
\item \textbf{Most important difference}: What do you see as the most important difference? Why is this difference important to you?
\item \textbf{Confidence}: Which style of rationale makes you more confident in the agent's ability to do its task? Was it system A or system B? Why?
\item \textbf{Failure}: If you had a companion robot that had just made a mistake, would you prefer that it provide rationales like System A or System B? Why?
\item \textbf{Unexpected Behaviour}: If you had a companion robot that took an action that was not wrong, but unexpected from your perspective, would you prefer that it provides rationales like System A or System B? Why?
\end{enumerate}
We used a similar to the process of selecting dimensions in this study as we did in the first one.
\textit{Confidence} is crucial to trust especially when failure and unexpected behavior happens \cite{chernova2009confidence, kaniarasu2013robot}.
Collaboration, tolerance, and perceived intelligence are affected by the way autonomous agents and robots communicate \textit{failure} and \textit{unexpected behavior} \cite{desai2013impact,kwon2018expressing,lee2010gracefully,mirnig2017err}.
\begin{table}[h]
\caption{Tally of how many preferred the \textit{focused-view} vs. the \textit{complete-view} for the three dimensions.}
\label{tab:components}
\begin{tabular}{ccc}
\toprule
{\bf Question} & {\bf Focused-view} & {\bf Complete-view}\\
\midrule
Confidence & 15 & 48\\
\rowcolor{tablerowcolor} Failure & 17 & 46\\
Unexpected Behaviour & 18 & 45\\
\bottomrule
\end{tabular}
\end{table}
\subsection{Quantitative Analysis}
In order to determine whether the preferences significantly favored one style or the other, we conducted
the Wilcoxon signed-rank test. It showed that preference for the \textit{complete-view} rationale was significant in all three dimensions.
Confidence in the \textit{complete-view} rationale was significantly greater than in the \textit{focused-view} ($p<.001$).
Similarly, preference for a \textit{complete-view} rationales from an agent that made a mistake was significantly greater than for \textit{focused-view} rationales ($p<.001$).
Preference for \textit{complete-view} rationales from an agent that made a mistake was also significantly greater than for \textit{focused-view} rationales ($p<.001$).
\subsection{Qualitative Findings and Discussion}
In this section, similar to the first study, we share insights gained from the open-ended responses to reveal the underlying reasons behind perceptions of the \textit{most important difference} between the two styles. We also unpack the reasoning behind the quantitative ranking preferences for \textit{confidence} in the agent's ability to do its task and communication preferences for \textit{failure} and \textit{unexpected behavior}. In this analysis, the interacting \textit{components} that influenced the dimensions of human factors in the first study return (see Table \ref{tab:components}). In particular, we use them as analytic lenses to highlight the trade-offs people make when expressing their preferences and the reasons for the perceived differences between the styles.
These insights bolster our situated understanding of the differences between the two rationale generation techniques and assist to verify if the intended design of the two configurations aligns with the perceptions of them. In essence, did the design succeed in doing what we set out to do? We analyzed the open-ended responses in the same manner as the first study. We use the same nomenclature to refer to participants.
\subsubsection{Most Important Difference (1)}
Every participant
indicted that
the \textit{level of detail and clarity} (P55)
differentiated the rationales.
Connected to the level of detail and clarity is the perceived \textit{long-} vs. \textit{short-term} planning exhibited by each rationale.
Overall, participants felt that the \textit{complete-view} rationale showed better levels of \textit{strategic detail}, \textit{awareness}, and \textit{relatability} with human-like justifications, whereas the \textit{focused-view} exhibited better \textit{intelligibility} with easy-to-understand rationales.
The following quote
illustrates
the trade-off between succinctness,
which hampers comprehension of higher-order goals, and broadness, which can be perceived as less
focused:
\begin{displayquote}
The [focused-view rationale] is extraordinarily vague and focused on the raw mechanics of the very next move \ldots [The complete-view] is more broad and less focused, but takes into account \textit{the entire picture}. So I would say the most important difference is the \textit{scope of events} that they take into account while making justifications [emphasis added] (P24)
\end{displayquote}
Beyond trade-offs, this quote highlights a powerful validating point: without any knowledge beyond what is shown on the video, the participant pointed out how the \textit{complete-view} rationale appeared to consider the "entire picture" and how the "scope of events" taken into account was the main difference.
The participant's intuition precisely aligns with the underlying network configuration design and our
research
intuitions.
Recall that the \textit{complete-view} rationale
was generated using the entire environment or "picture" whereas the \textit{focused-view} was generated using a windowed input.
In prior sections, we
speculated on the effects of the network configurations. We expected the \textit{focused-view} version
to produce
succinct, localized rationales that concentrated on the short-term. We expected the \textit{complete-view} version
to produce detailed, broader rationales that focused on the larger picture and long-term planning.
The findings of this experiment are the first validation that the outputs reflect the intended designs.
The strength of this validation was enhanced by the many descriptions of our intended attributes, given in free-form by participants who were naive to our network designs.
Connected to the level of detail and clarity is the perception of \textit{short-} vs \textit{long-term} thinking from the respective rationales.
In general, participants regarded the \textit{focused-view} rationale having low levels of \textit{awareness} and \textit{strategic detail}.
They felt
that this agent "\ldots focus[ed] only on the current step" (P44), which was perceived depicting as thinking "\ldots in the spur of the moment" (P27), giving the perception of short-term and simplistic thinking.
On the other hand, the \textit{complete-view} rationale appeared to "\ldots try to think it through" (P27), exhibiting long-term thinking as it appears to "\ldots think forward to broader strategic concerns."(P65) One participant sums it up nicely:
\begin{displayquote}
The [focused-view rationale] focused on the immediate action required. [The complete-view rationale] took into account the current situation, [but] also factored in what the next move will be and what dangers that move poses. The [focused-view] was more of a short term decision and [complete-view] focused on both short term and long term goals and objectives. (P47)
\end{displayquote}
We will notice how these differences in perception impact other dimensions such as confidence and communication preferences for failure and unexpected behavior.
\subsubsection{Confidence (2)}
Participants had more confidence in the agent's ability to do its task if the rationales exhibited high levels of \textit{strategic detail} in the form of long-term planning, \textit{awareness} via expressing knowledge of the environment, and \textit{relatability} through humanlike expressions. They associated \textit{conciseness} with confidence when the rationales did not need to be detailed given the context of the (trivial) action.
The \textit{complete-view} rationale inspired more confidence because participants perceived agents with long-term planning and high
\textit{strategic detail} as being "more predictive" and intelligent than their counterparts. Participants felt more at ease because "\ldots knowing what [the agent] was planning to do ahead of time would allow me to catch mistakes earlier before it makes them." (P31) As one participant put it:
\begin{displayquote}
The [complete-view rationale] gives me more confidence \ldots because it thinks about future steps and not just the steps you need to take in the moment. [The agent with focused-view] thinks more simply and is prone to mistakes. (P13)
\end{displayquote}
Participants felt that rationales that exhibited a better understanding of the environment, and thereby better \textit{awareness}, resulted in higher confidence scores. Unlike the \textit{focused-view} rationale that came across as "a simple reactionary move \ldots [the \textit{complete-view}] version demonstrated a more thorough understanding of the entire field of play." (P51) In addition, the \textit{complete-view} was more \textit{relatable} and confidence-inspiring "because it more closely resemble[d] human judgment" (P29).
\subsubsection{Failure (3)}
When an agent or a robot fails, the information from the failure report is mainly used to fix the issue. To build a mental model of the agent, participants preferred \textit{detailed} rationales with solid \textit{explanatory power} stemming from \textit{awareness} and \textit{relatability}. The mental model could facilitate proactive and preventative care.
The \textit{complete-view} rationale, due to relatively high \textit{strategic detail}, was preferable in communicating failure because participants could "\ldots understand the full reasoning behind the movements."(P16) Interestingly, \textit{detail} trumped \textit{intelligibility} in most circumstances. Even if the rationales had some grammatical errors or were a "\ldots little less easy to read, the details made up for it." (P62)
However, detailed rationales are not always a virtue. Simple rationales have the benefit of being easily understandable to humans, even if they cause humans to view the agent as having limited understanding capabilities. Some participants appreciated \textit{focused-view} rationales because they felt "it would be easier to figure out what went wrong by focusing on one step at a time."
Explanatory power, specifically how events are communicated, is related to \textit{awareness} and \textit{relatability}. Participants preferred relatable agents that "\ldots would talk to [them] like a person would."(P11) They expressed the need to develop a mental model, especially to "\ldots see how [a robot's] mind might be working"(P1), to effectively fix the issue. The following participant neatly summarizes the dynamics:
\begin{displayquote}
I'd want [the robot with complete-view] because I'd have a better sense of the steps taken that lead to the mistake. I could then fix a problem within that reasoning to hopefully avoid future mistakes. The [focused-view rationale] was just too basic and didn't give enough detail. (P8)
\end{displayquote}
\subsubsection{Unexpected Behavior (4)}
Unexpected behavior that is not failure makes people want to know the "why?" behind the action, especially to understand the expectancy violation.
As a result, participants preferred rationales with transparency so that they can understand and trust the robot in a situation where expectations are violated.
In general, preference was for adequate levels of \textit{detail} and \textit{explanatory power} that could provide "\ldots more diagnostic information and insight into the robot's thinking processes."(P19)
Participants wanted to develop mental models of the robots so they could understand the world from the robot's perspective.
This diagnostic motivation for a mental model is different from the re-programming or fixing needs in cases of failure.
The \textit{complete-view} rationale, due to adequate levels of \textit{strategic detail}, made participants more confident in their ability to follow the thought process and get a better understanding of the expectancy violation. One participant shared:
\begin{displayquote}
The greater clarity of thought in the [complete-view] rationale provides a more thorough picture \ldots, so that the cause of the unexpected action could be identified and explained more easily. (P51)
\end{displayquote}
With this said, where possible without sacrificing transparency, participants welcomed simple rationales that "anyone could understand, no matter what their level of education was."(P2)
This is noteworthy because the expertness level of the audience is a key concern when making accessible AI-powered technology where designers need to strike a balance between detail and succinctness.
Rationales exhibiting strong explanatory power, through \textit{awareness} and \textit{relatability}, helps to situate the unexpected behavior in an understandable manner.
Participants preferred the \textit{complete-view} rationale's style of communication because of increased transparency:
\begin{displayquote}
I prefer [the complete-view rationale style] because \ldots I am able to get a much better picture of why it is making those decisions. (P24)
\end{displayquote}
Despite similarities in the communication preferences for failure and unexpected behavior, there are differences in underlying reasons. As our analysis suggests, the mental models are desired in both cases, but for different reasons.
\section{Design Lessons and Implications}
The situated understanding of the \textit{components} and \textit{dimensions} give us a powerful set of actionable insights that can help us design better human-centered, rationale-generating, autonomous agents.
As our analysis reveals, context is king.
Depending on the context, we can tweak the input type to generate \textit{rationale sytles} that meet the needs of the task or agent persona; for instance, a companion agent that requires high \textit{relatability} for user engagement.
We should be mindful when optimizing for a certain dimension as each component comes with costs.
For instance, conciseness can improve \textit{intelligibility} and overall \textit{understandability} but comes at the cost of \textit{strategic detail}, which can hurt \textit{confidence} in the agent.
We can also engineer systems such that multiple network configurations act as modules.
For instance, if we design a companion agent or robot that interacts with a person longitudinally, the \textit{focused-view} configuration can take over
when short and simple rationales are required.
The \textit{complete-view} configuration or a hybrid one can be activated when communicating failure or unexpected behavior.
As our preference study shows, we should not only be cognizant about the level of detail, but also why the detail is necessary, especially while communicating failure and unexpected behavior.
For instance,
failure-reporting,
in a mission critical task (such as search and rescue), would have different requirements for \textit{strategic detail} and \textit{awareness}, compared to
"failure" reporting in a
less-defined, more creative task like making music.
While the focus of this paper is on textual rationale generation, rationales can be complementary to other types of explanations; for instance, a multi-modal system can combine visual cues with textual rationales to provide better contextual explanations for an agent's actions.
\section{Limitations and Future Work}
While these results are promising, there are several limitations in our approach that need to be addressed in future work.
First, our current system, by intention and design, lacks interactivity; users cannot contest a rationale or ask the agent to explain in a different way.
To a get a formative understanding, we kept the design as straight-forward as possible.
Now that we have a baseline understanding, we can vary along the dimension of interactivity for the next iteration.
For instance, contestability, the ability to either reject a reasoning or ask for another one, which has shown to improve user satisfactions \cite{hirsch2017designing,dietvorst2016overcoming} can be incorporated in the future.
Second, our data collection pipeline is currently designed to work with discrete-action games that have natural break points where the player can be asked for explanations.
In continuous-time and -action environments, we must determine how to collect the necessary data without being too intrusive to participants.
Third, all conclusions about our approach were formed based on one-time interactions with the system.
To better control for potential novelty effects that rationales could have, we need to deploy our system in a longitudinal task setting.
Fourth, to understand the feasibility of our system in larger state-action spaces, we would need to study the scalability by addressing the question of how much data is needed based on the size of environment.
Fifth, not all mistakes are created equal. Currently, the perception ratings are averaged where everything is equally weighted. For instance, a mistake during a mission critical step can lead to higher fall in confidence than the same mistake during a non-critical step. To understand the relative costs of mistakes, we need to further investigate the relationship between context of the task and the cost of the mistake.
\section{Conclusions}
While explainability has been successfully introduced for classification and captioning tasks, sequential environments offer a unique challenge for generating human understandable explanations.
The challenge stems from multiple complex factors, such as temporally connected decision-making, that contribute to making decisions in these environments.
In this paper, we introduce \textit{automated rationale generation} as a concept and explore how justificatory explanations from humans can be used to train systems to produce human-like explanations in sequential environments.
To facilitate this work, we also introduce a pipeline for automatically gathering a parallel corpus of states annotated with human explanations.
This tool enables us to systematically gather high quality data for training purposes.
We then use this data to train a model that uses machine translation technology to generate human-like rationales in the arcade game, {\em Frogger}.
Through a mixed-methods approach in evaluation, we establish the plausibility of the generated rationales and describe how intended design of rationale types lines up with the actual user perceptions of them.
We also get contextual understanding of the underlying dimensions and components that influence human perception and preferences of the generated rationales.
By enabling autonomous agents to communicate about the motivations for their actions, we envision a future where explainability not only improves human-AI collaboration, but does so in a human--centered and understandable manner.
\section{Acknowledgements}
This work was partially funded under ONR grant number N00014141000. We would like to thank Chenghann Gan and Jiahong Sun for their valuable contributions to the development of the data collection pipeline. We are also grateful to the feedback from anonymous reviewers that helped us improve the quality of the work.
\balance{}
\balance{}
\bibliographystyle{SIGCHI-Reference-Format}
| {'timestamp': '2019-01-15T02:01:00', 'yymm': '1901', 'arxiv_id': '1901.03729', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03729'} | arxiv |
\section{Introduction}\label{sec_intro}
We start by introducing the general setup of ranking surface response problems, and then describe the connection to stochastic control problems and related literature. For the purpose of consistency, we shall use the same notions as in our previous work \cite{HuLudkovski17} and refer the interested readers to it for more details of the problem background.
Denote $\mu_\ell : \mathbb{R}^d \supseteq \mathcal{X} \to \mathbb{R}$, $\ell \in \mk{L} \equiv \{1,2, \ldots, L\}$ as smooth functions over a subset $\mathcal{X}$ of $\mathbb{R}^d$. The surface ranking problem consists in assigning the index of the minimal surface to every input $x$ in the entire (usually continuous) space $\mathcal{X}$, namely, in finding the classifier
\begin{equation}\label{def_cal}
\mathcal{C}(x) := \arg\min_\ell \left\{\mu_\ell(x)\right\} \in \mk{L}, \quad \forall x \in \mathcal{X} \subseteq \mathbb{R}^d.
\end{equation}
The functions $\mu_\ell$ are {\it a priori} unknown but can be noisily sampled, {\it i.e.}, for any $x \in \mathcal{X}, \ell \in \mk{L}$, one can access $\mu_\ell(x)$ through its stochastic sampler $Y_\ell(x)$:
\begin{equation}\label{def_Y}
Y_\ell(x) = \mu_\ell(x) + \epsilon_\ell(x), \ \ell \in \mk{L},
\end{equation}
where $\epsilon_\ell$'s are independent random variables with mean zero and variance $\sigma_\ell^2(x)$.
In other words, one can sample by Monte Carlo the $L$ smooth hyper-surfaces on $\mathcal{X}$.
We are interested in accurately estimating $\mathcal{C}(x)$ using deep learning algorithms. Let $\mathcal{C}_{dl}(x)$ be the classifier produced by deep learning algorithms, and to study the performance of different network architectures and experiments designs, we evaluate the difference by the following loss metric:
\begin{equation}\label{def_loss}
\mathcal{L}(\mathcal{C}, \mathcal{C}_{dl}) = \int_{\mathcal{X}} \mathds{1}_{\{\mathcal{C}(x) \neq \mathcal{C}_{dl}(x)\}}\lambda(\mathrm{d}x),
\end{equation}
where $\lambda(\mathrm{d}x) \in \mathcal{P}(\mathcal{X})$ is a probability measure on $\mathcal{X}$ specifying the relative importance of ranking different regions. Note that when $\lambda(\mathrm{d}x) = \mathcal{U}(\mathcal{X})$ is the uniform measure, $\mathcal{L}$ gives the mis-labeled percentage. This is essentially the \emph{accuracy} metric in deep learning, often appearing as the first metric one uses to judge the performance of a neural network model/architecture.
To interpret \eqref{def_Y} in the context of dynamic programming, one can think of $x$ as system states, $\ell$ as indices of various actions available to the controller, $\mu_\ell(\cdot)$ as the expected costs-to-go and $\epsilon_\ell(\cdot)$ as simulation noises arising from pathwise evaluation of the underlying stochastic system and corresponding costs. In what follows, we will clarify this relation.
\medskip
\noindent\textbf{Motivation.} We consider the following stochastic control problems, and let $X_{(\cdot)} \equiv X_{(\cdot)}^u$ be a discrete-time stochastic state process controlled by a Markovian strategy $u_{0:T-1} \in \mk{L}^T$, following
\begin{equation}
X_{t+1}^u = F(X_t, u_t, \varepsilon_{t+1}), \quad t \in \{0,1, \cdots, T-1\},
\end{equation}
for some map $F: \mathcal{X} \times \mk{L} \times \mathbb{R} \to \mathcal{X}$, and some centered independent noise source $\varepsilon_{t+1}$. Note that we use a single subscript $t$ to represent the value of the process at time $t$, and use $t:T$ to emphasis the whole $\{\mathcal{F}_t\}$-adapted process from $t$ to $T$, $\mathcal{F}_t = \sigma(\varepsilon_1, \ldots \varepsilon_t)$. In general, the cost to be minimized is of the form
\begin{equation}\label{def_cost}
c(0,u_{0:T}) = \sum_{t = 0}^T g(t, X_t^u, u_t),
\end{equation}
where $g(t,\cdot, u_t)$ represents the running cost at stage $t$ using the strategy $u_t$. By defining the value function
\begin{equation}\label{def_V}
V(t,x) := \inf_{u_{t:T} \in \mk{L}^{T-t+1}} \mathbb{E}_{t,x}[c(t, u_{t:T})],
\end{equation}
with $E_{t,x}[\cdot] = E[\cdot \vert X_t = x]$ denoting the expectation given condition $x$, the minimized cost is represented by $V(0,x)$ and the corresponding optimal strategy is given by the minimizer $u^\ast_{0:T}$. Using dynamic programming ({\it e.g.} \cite{bjork2009arbitrage}), $V(t,x)$ satisfies:
\begin{equation}\label{eq_V}
V(t,x) = \inf_{u \in \mk{L}} \{g(t,x,u) + \mathbb{E}_{t,x}[V(t+1,X_{t+1}^u)]\}.
\end{equation}
By introducing the term $\mu_u(t,x)$, called Q-value in \cite{HuLudkovski17}:
\begin{equation}\label{def_muu}
\mu_u(t,x) = g(t,x,u) + \mathbb{E}_{t,x}[V(t+1, X_{t+1}^u)], \quad \forall u \in \mk{L},
\end{equation}
the connection to problem \eqref{def_cal}--\eqref{def_Y} now becomes clear. For each $u \in \mk{L}$, the Q-value $\mu_u(t,x)$, representing the expected cost-to-go corresponding to action $u$, is a response surface in \eqref{def_Y}. For fixed $t$, finding the optimal strategy map $x \mapsto u^\ast(t,x)$ is equivalent to identifying the classifier in \eqref{def_cal}, as $V(t,x) = \inf_{u \in \mk{L}}\left\{\mu_u(t,x)\right\}$. Then, this stochastic control problem $V(0,x)$ can be solved by backwardly identifying $u^\ast(s,\cdot)$, namely, by solving $T$ ranking problems of the form \eqref{def_cal} from stage $T$ to 1. More precisely, assuming strategy maps after time $t$, denoted by $\left\{\hat u(s,\cdot)\right\}_{s=t+1}^T$, are already generated, then $\hat u(t, \cdot)$ is determined by ranking \eqref{def_muu} across different $u$, where $\mathbb{E}_{t,x}[V(t+1, X_{t+1}^u)]$ is estimated by averaging the cost \eqref{def_cost} along trajectories $X_{(t+1):T}$ that follow the strategy $\left\{\hat u(s,\cdot)\right\}_{s=t+1}^T$.
In principle, this approach is applicable to any stochastic control problem, including continuous-time framework with a continuum of strategies, since both time and strategy space can be approximated by discretization. However, it is especially attractive when the number of actions is finite and small. For instance, in optimal stopping problems \cite{GL13},
the action space has only two elements $\mk{L} = $\{stop, continue\} and the immediate reward $\mu_{stop}$ is usually obtained at no cost, leading to only the continuation value $\mu_{cont.}(t,x)$ to be simulated. A canonical example in this case is pricing Bermudan-type options \cite{ludkovski2015kriging}. Applications that need to evaluate multiple surfaces $\mu_\ell$ arise from pricing swing options \cite{MeinshausenHambly04}, decision makings in energy markets \cite{AidLangrene12,Secomandi11} ({\it i.e.}, deciding whether to expand the productivity, to explore new energy resources or do nothing), epidemic management \cite{LudkovskiLin14,LN10,LN11wsc,MerlGramacy09}, to name a few.
\medskip
\noindent\textbf{Main approach and contribution.}
Our main contribution is to propose an alternative strategy to solve \eqref{def_cal} by deep learning algorithms. The key idea is to build up a neural network (NN) and let it learn to solve the problem of interest by itself via simulated data. This learning process, which is called the training of an NN, can be time-consuming. However, once this is accurately done, it will be computationally efficient to solve a problem of the same type. In our case, this is to say, once we use certain simulated data $Y_\ell(x)$ and its labels to train the neural network and obtain the desired accuracy, the predicted classifier $\mathcal{C}_{dl}$ of a new location $x$ will be instantaneous and accurate by mainly operations of matrix-vector multiplication. For this reason, NN is a desired approach to solve \eqref{def_cal}.
The problem of ranking response surfaces is equivalent to partitioning the entire input space $\mathcal{X}$ into parts distinguished by labels (indices of the minimal surface). We observe that, if one treats $\mathcal{X}$ as an image, then the labeling function $\mathcal{C}$ essentially divides the image into disjoint parts. This means that one can phrase the problem as image segmentation, where deep learning has been successful and become a primary and powerful tool in modern machine learning community \cite{LeCunBengioHinton15,ShelhamerLongDarrell15,RonnebergerFischerBrox15}. In the meantime, mathematical theory on deep neural networks (NNs), \emph{e.g.}, whether results produced by NN converge to the ground truth as the number of neurons/layers tends to infinity, has also been developed by analyzing the corresponding mean-field optimal control problem \cite{EHanLi19}. Compared to our previous work \cite{HuLudkovski17} where response surfaces are modeled by Gaussian process, the advantage of deep learning algorithms is that it is model-free, that is, they make the predicted labels $\hat \mathcal{C}$ no more depend on specific parameterizations of $\mu_\ell$. Moreover, through numerical studies, we find that NN algorithms also have the following advantages:
\begin{itemize}
\item It is insensitive to sampling locations. The loss $\mathcal{L}$ are comparable when $C_{dl}$ are produced using uniform samples versus sequentially designed samples \cite{HuLudkovski17} over $\mathcal{X} \times \mk{L}$. Then regarding implementation complexity and the ability of parallelism, uniform sampling is more preferable.
\item It can auto-detect wrong inputs. Since $\mu_\ell$ is only accessible by its stochastic sampler $Y_\ell$, the training input labels are $\arg\min_{\ell \in \mk{L}} Y_\ell$, which certainly contain wrong labels especially around the boundaries. The NN will try not to learn those labels correctly, and can automatically ignore those inputs.
\end{itemize}
\medskip
\noindent\textbf{Related Literature.}
Mathematically, one can view \eqref{def_cal} as a partition over the input $\mathcal{X} = \cup_{i=1}^L \mathcal{C}_i$:
\begin{equation}
\mathcal{C}_i := \{x \in \mathcal{X}, \mathcal{C}(x) = i\}, i \in \mk{L}.
\end{equation}
The problem is related to contour-finding of $\partial \mathcal{C}_i$, which has been extensively studied by numerous sequential methods \cite{GL13,Picheny10,RanjanBingham08}. For each $x$, the goal of identifying the minimal response $\arg\min_\ell\mu_\ell(x)$ corresponds to multi-armed bandits (MAB) problems. Consider the surfaces $\mu_\ell(x)$ as $L$ arms' rewards of the bandit, then \eqref{def_cal} is equivalent to exploring the extreme bandit \cite{BubeckMunos11,BubeckMunos11X,GabillonBubeck11,GrunewalderAudibert10}.
Statistically, for a tractable approximation of $\mu_\ell$, various models have been proposed, including Gaussian process (GP) \cite{HuLudkovski17}, BART \cite{chip:geor:mccu:2010}, Dynamic trees \cite{GTP-trees11}, treed GPs \cite{tgpPackage}, local GPs \cite{gramacy:apley:2013}, particle based Gaussian process \cite{GramacyPolson11}, GPs with Student-$t$ noise and $t$-processes \cite{lyu2018evaluating}.
Let us mention two recent works that are related to our paper. In our previous work \cite{HuLudkovski17}, the problem \eqref{def_cal} was tackled under the GP modeling for $\mu_\ell$ with a different loss metric:
\begin{equation}\label{eq:loss}
\mathcal{L}(\hat{\mathcal{C}}, \mathcal{C}) := \int_\mathcal{X} \left\{ \mu_{\hat{\mathcal{C}}(x)}(x) -\mu_{\mathcal{C}(x)}(x) \right\} \; \lambda(\mathrm{d} x).
\end{equation}
This is a blended criterion between marginal estimation of $\mu_\ell$ and classification. The loss is proportional to the difference between the true minimal surface and the estimated minimal one, which tolerates estimation errors of $\mu_\ell$ as long as the minimal response does not change. While in this paper, we make no model assumption on $\mu_\ell$ and treat \eqref{def_cal} as a pure classification/segmentation problem.
In \cite{BeChJe:18}, Becker, Cheridito, and Jentzen directly address the optimal stopping problem using deep learning. They learn the optimal stopping rule via maximizing the stopped payoff along each Monte Carlo path via a feedforward NN with three fully connected layers. Compared to the results in \cite{BeChJe:18}, our work distinguishes for two reasons. On the one hand, our problem setup \eqref{def_cal} is more general, and optimal stopping problems is just an application of ranking response surfaces; on the other hand, the emphasis of our work is on the architecture of neural networks, {\it i.e.}, by recasting optimal stopping as the image segmentation problem, one is allowed to use a broader class of networks with delicate architecture designed for image segmentation in computer science literature (\emph{e.g.} convolutional neural networks \cite{ShelhamerLongDarrell15}, UNet \cite{RonnebergerFischerBrox15,HaRoMyYa:18}, SegNet \cite{BadrinarayananKendallCipolla17}), from which one can choose the best performance empirically. Note that, there is no existing result in literature that rigorously discusses which architecture produces the optimal performance of image segmentation, to our best knowledge.
\medskip
\noindent\textbf{Organization of the paper.} The rest of the paper is organized as follows: In Section~\ref{sec:nn}, we introduce the design of network models and deep learning algorithms. In Section~\ref{sec:numerics}, we test the performance of deep learning by one-, two- and ten-dimensional examples of ranking response surfaces, and systematically study the dependence of deep learning algorithms on the quality of input data generated by uniform or by sequential design sampling. We apply the deep learning algorithms to Bermudan option pricing in Section~\ref{sec:Bermudan}, and make conclusive remarks in Section~\ref{sec:conclusion}.
\section{Neural networks and deep learning algorithms}\label{sec:nn}
Inspired by neurons in human brains, neural networks (NNs) are designed for computers to learn from observational data. Deep learning algorithms are techniques for accurate and efficient learning in neural networks. For interesting problems including image recognition, natural language processing, boundary detection, image classification and segmentation, neural networks and deep learning currently provide the best solutions. In what follows, we give a brief introduction to basic concepts in neural networks and how it works. Section~\ref{sec:algorithm} is dedicated to the algorithms for our ranking problem \eqref{def_cal}.
\subsection{Preliminaries on deep learning}
We start with some terminology. Basically, NNs are built up by {layers}. Each layer contains a number of {neurons}. Layers with different functions or neuron structure are called differently, including fully-connected layer, constitutional layer, pooling layer, recurrent layers, etc. Figure~\ref{fig:ffnn} below is a simple feed-forward NN with three fully-connected layers, where nodes represent neurons and arrows represent the information flow. As shown in the figure, information is constantly ``fed forward'' from one layer to the next. The first layer (leftmost column) is called the input layer, and the last layer (rightmost column) is called the output layer. Layers in between are called hidden layers, as they have no connection with the external world. In this case, there is only one hidden layer with four neurons.
\begin{figure}[H]
\centering \includegraphics[width=0.6\textwidth]{feedforward.png}
\caption{An illustration of a simple feedforward neural network. }\label{fig:ffnn}
\end{figure}
We now explain how NN learns from data. For fully-connected layers, every neuron has two kinds of parameters, the weights $w$ and the bias $b$. An input $x$ goes through a neuron outputs $f(w \cdot x + b)$, where $f$ is an activation function.
In the above illustrated NN, $x_1$, $x_2$ and $x_3$ are the input of neural network.
Nodes in the hidden layer take $\bd{x}=(x_1,x_2,x_3)$ as inputs and output $y_j = f(\bd{w}_j \cdot \bd{x} + {b}_j)$, $j=1,\cdots,4$, $\bd{w}_j=(w_{j,1},w_{j,2},w_{j,3})$. Then they are considered as inputs for the output layer, and $z_1=f(\bd{w}_z \cdot \bd{y} + {b_z})$. Based on the training data set, {\it i.e.}, known pairs of input and desired output $z(x)$, the {learning} of an NN is to find the optimal weights and biases, so that the output from the network well approximates $z$ for all training inputs $x$. Mathematically, this is done by minimizing some loss function, for instance, the mean square loss:
\begin{equation}\label{def_costfunctional}
c(w,b) = \frac{1}{2n}\sum_x \left\lVert z(x) - z\right\rVert^2,
\end{equation}
where $(w,b)$ denotes the collection of all weights and biases in the network and $n$ is the total number of training inputs.
Depending on the depth and size of the NN, training can take hours. However, when this is done, that is, the optimal or near-optimal parameters are obtained, prediction from new input $x_0$ is efficient as it will be mostly matrix-vector multiplication.
\medskip
\noindent\textbf{Activation function.} Popular types are sigmoid, Tanh, ReLU, Leaky ReLu, softmax, etc. The activation functions are not necessarily the same from layer to layer, while for the output layer, some types generally work better than others. For instance, in binary classification problems, a common choice is the {sigmoid} function $f(x) = \frac{1}{1 + e^{-x}}$, as it maps real-valued inputs to $[0,1]$. For multiple-class classification, the {softmax} function, mapping $\mathbb{R}^d$ to a probability simplex, is usually preferred. In both cases, outputs are interpreted as the probability of being in one of the categories.
\medskip
\noindent\textbf{Loss function.} Depending on the different goals, the form of loss function can be different, varying from mean squared error (MSE), mean absolute error, Kullback Leibler (KL) Divergence, $\ell_2$ norm, $\ell_1$ norm, cross entropy, hinge to squared hinge. The MSE loss is generally better suited to regression problems, while cross entropy and hinge are commonly used in classification problems. Besides,
$L_1$ or $L_2$ regularization are sometimes added to the loss function, to help to reduce overfitting.
\medskip
\noindent\textbf{Optimizer.} Finding the optimal weights and biases in \eqref{def_costfunctional} is in general a high-dimensional optimization problem. This is so-called the training of NN, which is commonly done based on stochastic gradient descent method ({\it e.g}., Adam \cite{Adam, Adamcvg}, NADAM \cite{Dozat16}).
\subsection{Deep learning algorithms}\label{sec:algorithm}
In computer vision, images segmentation is the process of partitioning a digital image into multiple segments. Each pixel in an image will be labeled for a class it belongs to. The training data consist of the RGB values of each pixel and its desired label. Considering ranking response surfaces as the segmentation of images, the ``image'' is then the entire input space $\mathcal{X}$ while the class label is the index of the minimal surface. Each point in $\mathcal{X}$ is treated as our ``pixels'', and the ``color'' of each ``pixel'' is then the coordinates of the location. With the concepts introduced above, we describe the deep learning algorithm with details in this subsection, which includes the input, output, and architecture of neural networks.
\medskip
\noindent{\bf Input and output}. The design of the input and output layers in a network is often straightforward. Recall our problem \eqref{def_cal}, we aim at training an NN using noisily sampled data $Y_\ell(x)$ at some locations $x$, so that after training it can efficiently and accurately label each location $x$ in $\mathcal{X}$ by the index of the minimal surface. The input to the network is $x^{1:J}\in\mathbb{R}^{J\times d}$ where $J$ corresponds to the number of points and $d$ is the dimensionality of the problem. The desired output should take the form:
\begin{equation}
\mathcal{C}_{\text{dl}}=(p_{j\ell}),\quad j=1,\cdots,J,\; \ell=1,\cdots,L,
\end{equation}
where $L$ is the number of response surfaces, and $p_{j\ell}$ is the probability that the $\ell^{\text{th}}$ surface is the minimal at the $j^{\text{th}}$ point. This is usually achieved by implementing the softmax activation function for the output layer.
For example, if one gets the following output
\begin{equation}\left(
\begin{matrix}
0.1 & 0.2 & 0.7 \\
0.8 & 0.1 & 0.1
\end{matrix}\right),
\end{equation}
then it means that the network believes the $3^{\text{rd}}$ surface is minimal with probability $70\%$ at the $1^{\text{st}}$ point, and that the $1^{\text{st}}$ surface is minimal with probability $80\%$ at the $2^{\text{nd}}$ point. The predicted labels for the corresponding points will be given by taking the row-wise argmax of the matrix, which produces a column vector in $\mathbb{R}^J$. In the above example, the input contains two points $x^1$ and $x^2$, and the corresponding labels are $[3,1]^\dagger$.
During the training stage, the network is told what the true labels should be for the inputs $x^{1:J}$, and it adjusts its belief according to this information via minimizing some loss function (cf. \eqref{def_costfunctional}). In the generalization stage, only locations in $\mathcal{X}$ are given, and one uses the network output as the final result. In both stages, the accuracy will be evaluated by the percentage of correctly predicted labels against the ground truth, and results are called the \emph{training accuracy} and the \emph{generalization accuracy}. This is also the loss metric \eqref{def_loss} with uniform measure $\lambda(\mathrm{d}x) = \mathrm{d}x/\abs{\mathcal{X}}$.
When training with noisy data, the ground truth is unknown and the true labels are up to our best knowledge. That is, the `` true'' label is produced by simulating $Y_\ell(x)$ for each $\ell \in \mk{L}$ and take $\arg\min_\ell Y_\ell(x)$. Of course, this leads to mis-labeling and affects both training and generalization accuracies. In Section~\ref{sec:numerics}, we present numerical studies on synthetic examples with known ground truth and study the accuracies of deep learning algorithms.
\begin{figure}[H]
\begin{tabular}{cc}
\hspace{10em}\includegraphics[width=0.21\textwidth, height = 0.5\textheight]{model_feed.png} &
\hspace{10em}\includegraphics[width=0.25\textwidth, height = 0.5\textheight]{model_netron.png}
\end{tabular}
\caption{Architectures of neural networks (NNs). Left: a feed-forward NN with 4 fully-connected hidden layers; Right: two-layered UNet. Here the dense block means a fully-connected layer. The purpose of adding an activity regularizer is to reduce the generalization error, and may not always be needed. The ``MaxPooling2D'' is for downsampling, and ``Concatenate'' merges outputs from different dense blocks, which makes the architecture look like a ``U''-shape. }\label{fig:arch}
\end{figure}
\noindent{\bf Architecture}. Although the design of the input/output layers of an NN is usually straightforward, it can be quite sophisticated to find a good architecture for the hidden layers. In particular, it is unlikely to summarize the design strategies for the middle layers with a few simple rules, for instance, how to trade off the number of hidden layers against the time required to train the network.
The global topology of the network consists of blocks and the interactions between them, which are in general described by the meta-architecture. Designing proper meta-architecture can improve the performance of networks, and in the context of ranking response surfaces, recasting the problem as image segmentation will allow us to use the meta-architecture of CNNs \cite{ShelhamerLongDarrell15}, UNet \cite{RonnebergerFischerBrox15,HaRoMyYa:18}, and SegNet \cite{BadrinarayananKendallCipolla17}, which has been considered and widely used as an efficient network structure for image segmentation.
As there is no rigorous discussion on which architecture performs the best for image segmentation, we shall focus on two architectures in this paper: feed-forward NNs and UNet visualized
in Figure~\ref{fig:arch}. They are built using Keras \cite{Keras}, a high-level neural networks API.
Main blocks are fully-connected (shown as dense in Figure~\ref{fig:arch}) layers and convolutional layers. The first (left) one is built up by dense blocks. We add an $\ell_1/\ell_2$ activity regularizer (shown as Activation) to help reduce the generalization error, which may not always be needed. ReLu is chosen as the activation function for hidden layers, while sigmoid or softmax is used for the output layer depending on the number of classifiers. In the second (right) architecture, we use a 2D convolutional layer (shown as Conv2D) with $3 \times 3$ kernel as the first hidden layer, which outputs 4D tensor. It expands the number of feature channels, which help to reduce the number of necessary feature maps leading to an improvement of computational efficiency \cite{HeZhReSu:15,SpDoBrRi:14}. ``MaxPooling2D'' is for downsampling, and ``Concatenate'' merges outputs from different dense blocks, with one before downsampling and one after upsampling so that their dimension is matched.
The ``concatenate'' action makes the architecture have a ``U''-shape. Activation functions are chosen the same as in the first architecture. We remark that, such a UNet structure can be applied for problems with any dimensionality, by merely adjusting the dimensionality of convolutional and down/up sampling layers.
Let us also mention that the neural networks used in \cite{BeChJe:18} are a feed-forward NN with two fully-connected hidden layers, and what they actually make use of NN is its ability of approximating complex relations by compositions of simple functions (by stacking fully connected layers) and finding the (sub-)optimizer with its well-developed built-in stochastic gradient descent (SGD) solvers, whose convergence has been studied in literature ({\it e.g.,} \cite{Ho:91}). While by recasting the optimal stopping problems as image segmentation, one is allowed to use a broader class of neural networks with more delicate architecture ({\it e.g.} UNet), for which the convergence theory is still unclear.
\section{Numerical experiments}\label{sec:numerics}
In this section, we first analyze the performance of deep learning algorithms (both feed-forward NNs and UNet) by studying the one- and two-dimensional examples used in \cite{HuLudkovski17}, and systematically analyze the dependence of deep learning algorithms on the input data generated by uniform or by sequential design sampling. We also present a ten-dimensional example to show the robustness of deep learning algorithms, where non-learning algorithms in general have a difficulty in computational time. As a consistency, we shall use the same notations as in \cite[ Section 4]{HuLudkovski17}.
\subsection{One-dimensional example}
We consider the one-dimensional toy model used in \cite{HuLudkovski17}, originally from \cite[Section 4.4]{kmPackage-R}. Let $L = 2, \mathcal{X} = [0, 1]$ in \eqref{def_cal}, and define the noisy responses $Y_1(x)$ and $Y_2(x)$ as
\begin{align*}
Y_1(x) &= \mu_1(x) + \epsilon_1(x) \equiv \frac{5}{8}\left(\frac{\sin(10x)}{1+x} + 2x^3\cos(5x)+0.841\right) + \sigma_1(x)Z_1, \\
Y_2(x) &= \mu_2(x) + \epsilon_2(x) \equiv 0.5 + \sigma_2(x)Z_2,
\end{align*}
where $Z_\ell$ are independent standard Gaussians, with the noise strengths fixed at $\sigma_1(x) \equiv 0.2$ and $\sigma_2(x) \equiv 0.1$, homoscedastic in $x$ but heterogenous in $\ell=1,2$. We take the uniform weights $\lambda(\mathrm{d} x)=\,\mathrm{d} x$ in the loss function on $\mathcal{X}$, which is interpreted as the percentage of mis-labeled locations.
\begin{figure}[t]
\centering\includegraphics[width=0.5\textwidth]{funcvalue_1d_2.png}
\caption{The true response surfaces $\mu_1$ and $\mu_2$ and the corresponding ranking classifier $\mathcal{C}$ for the one-dimensional example. The entire input space $[0, 1]$ is divided into three parts, with ranking classifier equal to $1$ in the middle, and equal to $2$ otherwise.}\label{fig:1d_fun}
\end{figure}
Then the true ranking classifier $\mathcal{C}(x)$ is computed as
\begin{equation}\label{def_label1d}
\mathcal{C}(x) = \left\{ {\begin{array}{*{20}{l}}
{2}& \quad \text{for } x \in [0,r_1] \cup [r_2,1], \\
{1}& \quad \text{for } {r_1 < x < r_2, } \\
\end{array}} \right.
\end{equation}
where $r_1 \approx 0.3193, r_2 \approx 0.9279.$ We visualize the true responses $\mu_1$ and $\mu_2$ and the corresponding ranking classifier $\mathcal{C}$ in Figure~\ref{fig:1d_fun}.
We first investigate the performance of feed-forward NNs, and test them for the following four cases of training data generated on uniform grids or the points produced by sequential design.
\begin{table}[H]
\centering
\caption{Summary of different design for $(x, z(x))$}\label{tbl:datadesign}
\begin{tabu}{|l|c|c|}
\hline
Name of Method & Method to generate $x \in \mathcal{X}$ & Method to generate labels \\ \tabucline[1pt]{1-3}
UNIF & uniform grids & True label $\arg\min_\ell \mu_\ell(x)$ \\ \hline
UNIF + NL & uniform grids & Noisy label $\arg\min_\ell y_\ell(x)$ \\ \hline
SD & sequential design & True label $\arg\min_\ell \mu_\ell(x)$ \\ \hline
SD + NL & sequential design & Noisy label $\arg\min_\ell y_\ell(x)$ \\ \hline
\end{tabu}
\end{table}
\noindent Let $M$ be the size of training data. For a comprehensive study, we conduct our experiments under different $M = 128, 256, 512$. Points generated by sequential design use ``Gap-SUR'' method developed in \cite{HuLudkovski17}, and are mainly concentrated near the boundaries $\partial \mathcal{C}_i$, namely, around $r_1$ and $r_2$, as well as the ``fake'' boundary $x=0$, where the two lines are quite close but do not touch each other. Then labels are generated by taking the argmin of true surfaces $\mu_\ell$ or realizations $y_\ell$ of the noisy sampler $Y_\ell$ at those points $x^{1:M}$.
To focus on the performance of data designs in Table~\ref{tbl:datadesign}, we fix the network architecture to be a feed-forward NN with two fully-connected hidden layers. Number of neurons in each hidden layer is set at $M/8$. For this binary classification problem, the output layer contains one neuron and produces the probability of Surface $1$ being the minimum it believes, by using the sigmoid activation function. The network is trained for 1500 epochs with updating each gradient using $M/2$ data. One epoch is an iteration over the entire data. We remark that all above settings can be altered for a suitable trade-off between accuracy and efficiency. However, for a purpose of comparison, we fix them in the way we explained above. Meanwhile, we do adjust the learning rate and other parameters in the optimizer, in order to better train the network within 1500 epochs.
In deep learning, two numbers are of most importance, the training accuracy and the generalization accuracy. The first one indicates how well the network learns from the training data set, calculated based on $M$ points, while the latter one measures the accuracy of the prediction for new locations $x \notin x^{1:M}$, calculated on a finer grid on $\mathcal{X}$. Also, note that the latter one is a discretized version of $1 - \mathcal{L}(\mathcal{C}, \mathcal{C}_{dl})$ where $\mathcal{L}$ is the loss defined in \eqref{def_loss} with uniform measure. For these two reasons, we report accuracies instead of loss in Table~\ref{tbl:1d} for different computational budget $M = 128, 256, 512$ and different designs listed in Table~\ref{tbl:datadesign}.
\begin{table}[H]
\centering
\caption{Training accuracy versus generalization accuracy for the 1-D example with different computational budget $M$. The acronyms used are: UNIF = uniform grids on $\mathcal{X}$, SD = grids generated by Gap-SUR in \cite{HuLudkovski17}, NL = training with noisy label. \label{tbl:1d}}
\begin{tabu}{|l|cc|cc|cc|}
\hline
{Method/Budget} & \multicolumn{2}{c|}{\textbf{M = 128}} & \multicolumn{2}{c|}{\textbf{M = 256}} & \multicolumn{2}{c|}{\textbf{M = 512}} \\
& Train. Acc. & Gen. Acc. & Train. Acc. & Gen. Acc. & Train. Acc. & Gen. Acc. \\ \tabucline[1pt]{1-7}
UNIF & 99.9\%& 99.7\%& 99.9\%&99.9\%&99.9\%& 99.9\% \\
UNIF + NL &81.25\%&98.5\%&79.3\%&98.8\%&81.0\%&99.5\%\\ \hline
SD&99.5\%&98.3\%&96.1\%&98.9\%&98.1\%& 99.5\% \\
SD + NL &64.1\%&97.3\%&57.2\%&92.3\%&58.2\%&94.2\%\\ \hline
\end{tabu}
\end{table}
We observe that, the training accuracy is higher than the generalization accuracy for NNs trained by clean data, while smaller than generalization accuracy for NNs trained by noisy data. This is because that, the generalization accuracy is tested on clean data, and the usage of noisy labels in training data set decreases the training ``accuracy'', evidenced by comparing UNIF to UNIF+NL. In fact, when there are errors in the training data set, the NN auto-detects these errors and avoid learning from them. By a careful examination, the misclassified locations in the training data set are mainly mis-labeled points due to the low signal-to-noise ratio, with a small number of points around the boundary, which are originally hard to learn. This can be understood in the sense that, although the training data with noisy labels do not contain $100\%$ accurate information, networks ``learn'' to minimize the effect of the wrong labels by not training them correctly. Secondly, by comparing UNIF+NL to SD+NL, we observe that the usage of SD further decreases the training accuracy. This is due to the fact that the input data of SD contain more errors, as points $x^{1:M}$ generated by SD are mostly concentrated around the boundaries $r_1 = 0.3193$, $r_2 = 0.9279$ and the fake boundary $x = 0$, where the signal-to-noise ratio is low, leading to a large number of mis-labeling points. Thirdly, we observe that there exists a threshold on the proportion of error in training data so that they can be auto-detect and will not influence the network's predicting accuracy. For instance, comparing SD with SD+NL at $M = 256$, the generalization accuracy significantly decreases. We interpret this phenomenon as the fact that there have been enough wrong labels which make the network believe they (the wrong labels) are the truth.
Finally, we comment that, as increasing the budget for the simulation of training data set, the results are better in the UNIF case, which is consistent with common sense: the more data, the better the learning. While in the SD case, there is a turning point in both training and generalization accuracy, \emph{i.e.}, $64.1\% \to 57.2\% \to 58.2\%$, and $97.3\% \to 92.3\% \to 94.2\%$. This is because of the Gap-SUR criterion we use, where $x^{1:M}$ are sequentially selected by reducing stepwise uncertainty. When we adaptively grow $x^{1:M}$, the algorithm will mostly pick points around the boundaries first. The additional budget from $M = 128$ to $M = 256$ mostly goes to the boundary points, which increases the percentage of wrong labels, leading to a decrease in accuracy. Once the points there become saturated (the uncertainty reduction becomes very small), Gap-SUR favors locations that have large posterior variance, usually interior points of $\partial\mathcal{C}_i$. Therefore, the additional 256 points in $M = 512$ case go to interior points more than the boundary ones, which increases the accuracy.
Below, we also plot the training and generalization accuracy versus epoch in Figure~\ref{fig:1dacc}. The predicted ranking classifiers and corresponding difference from true values are given in Figures~\ref{fig:1d} for UNIF, UNIF+NL, SD, and SD+NL using a size of $M=128$ training data.
\begin{figure}[H]
\begin{tabular}{cc}
\includegraphics[width=0.45\textwidth]{trainacc_1d.png} &
\includegraphics[width=0.45\textwidth]{genacc_1d.png}
\end{tabular}
\caption{The training and generalization accuracy versus epoch for UNIF, UNIF+NL, SD, SD+NL in the one-dimensional example, respectively. }\label{fig:1dacc}
\end{figure}
One can also notice that, in Figure~\ref{fig:1d}, the network predicts wrong classifiers not only near the boundaries but also at the ``fake'' boundary $x=0$ where the two response surfaces are close to each other. This is because, the training data points generated by SD are often near the boundaries or ``fake'' boundaries, and using noisy labels will lead to the points near boundaries or ``fake'' boundaries having wrong classifiers, which makes the networks predict wrong classifiers at these places.
\begin{figure}[t]
\subfigure[UNIF]
{\begin{minipage}[t]{0.24\linewidth}
\centering
\includegraphics*[scale = .20]{class_unif_1d.png}
\end{minipage}}
\subfigure[UNIF+NL]
{\begin{minipage}[t]{0.24\linewidth}
\centering
\includegraphics*[scale = .2]{class_unif_noise_1d.png}
\end{minipage}}
\subfigure[ SD]
{\begin{minipage}[t]{0.24\linewidth}
\centering
\includegraphics*[scale = .2]{class_seq_1d.png}
\end{minipage}}
\subfigure[SD+NL]
{\begin{minipage}[t]{0.24\linewidth}
\centering
\includegraphics*[scale = .2]{class_seq_noise_1d.png}
\end{minipage}}
{\begin{minipage}[t]{0.24\linewidth}
\centering
\includegraphics*[scale = .2]{class_unif_diff_1d.png}
\end{minipage}}
{\begin{minipage}[t]{0.24\linewidth}
\centering
\includegraphics*[scale = .2]{class_unif_noise_diff_1d.png}
\end{minipage}}
{\begin{minipage}[t]{0.24\linewidth}
\centering
\includegraphics*[scale = .2]{class_seq_diff_1d.png}
\end{minipage}}
{\begin{minipage}[t]{0.24\linewidth}
\centering
\includegraphics*[scale = .2]{class_seq_noise_diff_1d.png}
\end{minipage}}
\caption{Predicted classifiers $\hat \mathcal{C}(x)$ (blue) and corresponding difference from true classifier $\mathcal{C}(x) - \hat{\mathcal{C}}(x)$ (red) by UNIF, UNIF+NL, SD, SD+NL using a size of $M=128$ training data for one-dimensional example. The wrongly predicted classifiers are marked as `x' in subfigures in the second row.}\label{fig:1d}
\end{figure}
\subsection{Two-dimensional example}
In this subsection, we further study the sensitivity of deep learning algorithms to noisy labels, sampling locations and budget by a two-dimensional (2D) example used in \cite{HuLudkovski17}. It treats a more complex setting with $L=5$ surfaces and a 2D input space $\mathcal{X}=[-2,2]^2$, with a constant homoscedastic observation noise $\epsilon_\ell(x_1,x_2) \sim \mathcal{N}(0, \sigma_\ell^2)$, $\sigma_\ell=0.5, \; \forall \ell=1,\cdots,5$. The specific response functions for each surface and true classifier $\mathcal{C}$ of problem \eqref{def_cal} is shown in Figure~\ref{fig:2d_fun}.
\begin{minipage}{\textwidth}
\begin{minipage}[t]{0.45\textwidth}
\vspace{-125pt}
\begin{equation}
\begin{array}{lr}
\hline
\\[-0.8em]
\text{Surface}& \text{Response} \\ \hline\hline
\\ [-0.8em]
\mu_1(x_1,x_2) & 2-x_1^2 - 0.5 x_2^2 \\
\\[-0.8em]
\mu_2(x_1,x_2) & 2(x_1-1)^2 + 2x_2^2 -2 \\
\\[-0.8em]
\mu_3(x_1,x_2) & 2 \sin(2x_1)+2 \\
\\[-0.8em]
\mu_4(x_1,x_2) & 8(x_1-1)^2 + 8x_2^2 -3 \\
\\[-0.8em]
\mu_5(x_1,x_2) & 0.5(x_1+3)^2 +16x_2^2 -6 \\ \hline
\end{array}
\end{equation}
\end{minipage}%
\hspace{20pt}
\begin{minipage}[t]{0.45\textwidth}
\centering\includegraphics[width=0.9\textwidth]{class_true_2d.png}
\end{minipage}
\captionof{figure}{ Left: specific response functions for each surface; Right: the true ranking classifier for the two-dimensional example which divides the entire input space $[-2, 2]\times[-2, 2]$ into six parts.}\label{fig:2d_fun}
\end{minipage}
\begin{table}[H]
\centering
\caption{Training accuracy versus generalization accuracy for the 2-D example with different computational budget $M$. The acronyms used are: UNIF = uniform grids on $\mathcal{X}$, SD = grids generated by Gap-SUR in \cite{HuLudkovski17}, NL = training with noisy labels. \label{tbl:2d}}
\begin{tabu}{|l|cc|cc|cc|}
\hline
{Method/Budget} & \multicolumn{2}{c|}{\textbf{M = 256}} & \multicolumn{2}{c|}{\textbf{M = 576}} & \multicolumn{2}{c|}{\textbf{M = 1024}} \\
& Train. Acc. & Gen. Acc. & Train. Acc. & Gen. Acc. & Train. Acc. & Gen. Acc. \\ \tabucline[1pt]{1-7}
UNIF &99.9\% & 94.7\%&99.7\%&96.6\%&99.5\%& 97.7\% \\
UNIF + NL &98.4\%&92.8\%&93.2\%&95.1\%&90.8\%&96\%\\ \hline
SD&96.9\%&94.4\%&96.1\%&96.4\%&96.1\%& 97.4\% \\
SD + NL &82.0\%&94.1\%&71.8\%&94.6\%&66.8\%&96.8\%\\ \hline
\end{tabu}
\end{table}
We perform the same four types of training data (cf. Table~\ref{tbl:datadesign}) as in the 1D example, and show the results of accuracy in Table~\ref{tbl:2d}. We also plot the training and generalization accuracy versus epoch in Figure~\ref{fig:2dacc}. The predicted ranking classifiers and corresponding difference from true values are given in Figures~\ref{fig:2d} for UNIF, UNIF+NL, SD, and SD+NL using a size of $M=576$ training data. These testing results show a consistent conclusion with the 1D example, {\it i.e.}, the generalization accuracy is not very sensitive to the noise in the training data set; using SD for generating sampling locations $x^{1:M}$ potentially decrease the training accuracy due to more errors in the learning data set, and increasing the budget $M$ will make it even lower before points around the boundaries get saturated.
To our best knowledge, there are no theoretical results in literature indicating which type of architecture works best for specific applications. Instead, one usually implements a few architectures of NNs, and choose the best of them empirically. Remark that, considering ranking response surfaces as image segmentation allows one to use a broad class of deep neural networks. In this example, we implement the UNet architecture (right panel in Figure~\ref{fig:arch}) using $M=576$ uniform grid points with noisy labels, and show the predicted classifier in Figure~\ref{fig:UNet}. The UNet has a generalization accuracy of $96.44\%$, presenting a better performance than feed-forward NNs (corresponding to the $95.1\%$ in Table~\ref{tbl:2d}), with comparable training time. It is also visualized by comparing Figure~\ref{fig:UNet} to Figure~\ref{fig:2d} (b) (d).
\begin{figure}[t]
\begin{tabular}{cc}
\includegraphics[width=0.45\textwidth]{trainacc_2d.png} &
\includegraphics[width=0.45\textwidth]{genacc_2d.png}
\end{tabular}
\caption{The training and generalization accuracy versus epoch for UNIF, UNIF+NL, SD, SD+NL in the two-dimensional example, respectively. }\label{fig:2dacc}
\end{figure}
\begin{figure}[t]
\centering\includegraphics[width=0.6\textwidth]{class_unif_noise_2d_unet.png}
\caption{Predicted 2-D ranking classifiers on $\mathcal{X} = [-2, 2]^2$ using UNet. The solid black lines are the true classifier $\mathcal{C}(x_1, x_2)$, the colored regions indicates the estimated minimal index using $M = 576$ training data.}\label{fig:UNet}
\end{figure}
\begin{figure}[t]
\subfigure[Predicted classifier by UNIF]
{\begin{minipage}[t]{0.5\linewidth}
\centering
\includegraphics*[scale = .4]{class_unif_2d.png}
\end{minipage}}
\subfigure[Predicted classifier by UNIF+NL]
{\begin{minipage}[t]{0.5\linewidth}
\centering
\includegraphics*[scale = .4]{class_unif_noise_2d.png}
\end{minipage}}
\subfigure[Predicted classifier by SD]
{\begin{minipage}[t]{0.5\linewidth}
\centering
\includegraphics*[scale = .4]{class_seq_2d.png}
\end{minipage}}
\subfigure[Predicted classifier by SD+NL]
{\begin{minipage}[t]{0.5\linewidth}
\centering
\includegraphics*[scale = .45]{class_seq_noise_2d.png}
\end{minipage}}
\caption{Predicted 2-D ranking on $\mathcal{X} = [-2,2]^2$ using different designs: UNIF (top-left), UNIF+NL (top-right), SD (bottom-left) and SD+NL (bottom-right). The solid black lines show the true $\mathcal{C}(x_1, x_2)$, the colored regions show the estimated classifiers $\hat{\mathcal{C}}_i$ for M = 576. }\label{fig:2d}
\end{figure}
\subsection{Ten-dimensional example}
To show the robustness of deep learning algorithms, we consider a ten-dimensional synthetic example in this section, for which using the method in our previous work \cite{HuLudkovski17} will have a problem of unaffordable computational time. For an easiness of comparison, we construct the example as follows, which the true classifier $\mathcal{C}$ is accessible.
Let $L = 3$ surfaces and $\mc{X} = [-1,1]^d$ with $d = 10$. The surfaces we use include embedded Hartmann 6-D function, rescaled Styblinski-Tang function, and rescaled Trid function as described in Table~\ref{tbl:10d_func}. The Hartmann 6-D function has 6 local minima and a global minima at $$\bm x^\ast = (0.20169, 0.150011, 0.476874,0.275332,0.311652,0.6573).$$ We embed this function to ten-dimensional space as our $\mu_1(\bm x)$. The original Styblinski-Tang function $f(\bm x) = \frac{1}{2} \sum_{i=1}^d x_i^4-16x_i^2 + 5x_i$ is usually evaluated on $[-5,5]^d$ with a global minimum at $\bm{x}^\ast = (-2.903534, \ldots, -2.903534)$. We rescale the domain and the function to make it comparable with Hartmann 6. The same applies to the Trid function. We study the example using different layers of NNs trained by both clean and noisy data, and present the training and generalization accuracy in Table~\ref{tbl:10d}, where the first number is the training accuracy, and the second in parenthesis is the generalization accuracy. We notice that, similar to previous 1-D and 2-D examples, when the NNs are trained by clean data, the training accuracy is better than the generalization accuracy as in standard deep learning theory, while when the NNs are trained by noisy data, the generalization accuracy is better. This is due to a fact that, when there are errors (caused by noise) in the training data set, the NNs auto-detect these errors and avoid learning from them, which decreases the training ``accuracy'', while the used generalization data set only contains clean data.
\begin{table}[t]
\centering
\caption{The three response surface functions in the ten-dimensional example.}\label{tbl:10d_func}
\begin{equation*}
\begin{array}{ll}
\hline
\\[-0.8em]
\text{Surface}& \text{Response} \\ \hline\hline
\\ [-0.8em]
\text{Hartmann 6-D }& \mu_1(\bm x) = -\sum_{i=1}^4 \alpha_i \exp\left(-\sum_{j=1}^6 A_{ij}(x_j-P_{ij})^2\right),
\\ \vspace{5pt}
& \text{with }\alpha = \begin{bmatrix}
1\\1.2\\3.0\\3.2
\end{bmatrix},
A = \begin{bmatrix}
10 & 3 & 17 & 3.50& 1.7 & 8 \\
0.05 & 10&17& 0.1 & 8 & 14 \\
3&3.5&1.7&10&17&8 \\
17&8 & 0.05& 10 &0.1& 14
\end{bmatrix},
\\
&\qquad P = \begin{bmatrix}
0.1312 & 0.1696 & 0.5569 & 0.0124& 0.8283 & 0.5886 \\
0.2329 & 0.4135&0.8307& 0.3736 & 0.1004 & 0.9991 \\
0.2348&0.1451&0.3522&0.2883&0.3047&0.6650 \\
0.4047&0.8828 & 0.8732& 0.5743 &0.1091& 0.0381
\end{bmatrix};
\\
\\[-0.8em]
\text{Styblinski-Tang } & \mu_2(\bm x)= \frac{1}{2d}\sum_{i=1}^d 625x_i^4-400x_i^2 + 25x_i ; \\
\\[-0.8em]
\text{Trid } & \mu_3(\bm x) = \frac{1}{2}\left(\sum_{i=1}^d (x_i-1)^d - \sum_{i=2}^d x_ix_{i-1}\right)-5 . \\
\hline
\end{array}
\end{equation*}
\end{table}
\begin{table}[t]
\centering
\caption{Training accuracy versus generalization accuracy for the 10-D example using different layers of neural networks (NNs) trained by both clean and noisy data. The first number is the training accuracy, and the second in parenthesis is the generalization accuracy. Note that, when the NNs are trained by clean data, the training accuracy is better than generalization accuracy as expected, while when the NNs are trained by noisy data, the generalization accuracy is better. This is due to a fact that, when there are errors (caused by noise) in the training data set, the NNs auto-detect these errors and avoid learning from them, which decreases the training ``accuracy'', while the used generalization data set only contains clean data.}\label{tbl:10d}
\begin{tabular}{|c|c|c|c|}
\hline
{Noise Level/\# of Layers} & 2 Layers & 3 Layers & 4 Layers\\ \hline
No noise & 92.5\% (92.1\%) & 94.8\% (93.9\%) &94.5\% (92.7\%) \\ \hline
$\sigma = [0.5,0.4,0.45]$&90.5\% (91.1\%)&91.8\% (91.8\%)&93.1\%(92.4\%) \\ \hline
$\sigma = [0.7,0.75,0.8]$ &89.6\% (91.4\%)&91.0\% (92.9\%)&91.6\% (92.1\%)\\ \hline
\end{tabular}
\end{table}
\section{Bermudan option pricing}\label{sec:Bermudan}
An important problem in computational finance is pricing Bermudan/American-type options. It has been studied extensively in the literature, for instance, via regression methods \cite{Carriere96, Longstaff, tsitsiklis2001regression,kohler2010review,Belomestny11,letourneau2014refining,GoMoZa:193,GoMoZa:194} and variance reduction \cite{juneja2009variance,hepperger2013pricing,jain2015stochastic}, primal-dual formulation \cite{andersen2004primal, broadie2008improved, Bender11}, adaptive experiment designs for optimal stopping \cite{GL13,ludkovski2015kriging} and counter-finding \cite{lyu2018evaluating}, to list a few.
For Bermudan-type options, the buyer has the right to exercise at a set number of times. Assume they are discretely spaced, denoted by $\{t_0 = 0, t_1, t_2, \ldots, t_{N-1}, t_N = T\}$ bounded by the maturity date $T$, the price is determined by the maximum expected payoff over all possible $t_i$. To maximize (or optimize) buyer's profit, one wants to execute/stop the option in a way that the largest payoff will be received, based on the information known up to today. Therefore, this can be formulated as an optimal stopping problem, and is typically solved by backward induction. In other words, one first computes a value function at the expiration date, and then recursively works backward, computing value functions and making a decision on whether to execute for preceding periods. At each possible executing time $t_i$, the decision space is small, containing only two elements $\mk{L} = $\{stop, continue\}, which makes it a natural application of ranking problems. Therefore, in this section, we apply the deep learning algorithms to price Bermudan-type options.
Let $X_t \in \mathcal{X} \subset \mathbb{R}^d$ be the price of underlying assets, $\mathcal{F}_n = \sigma(X_{t_{0:n}})$ be the $\sigma-$algebra generated by $(X_{t_i})_{i=1}^n$ and $\mc{S}$ be the collection of all $(\mathcal{F}_n)$ stopping times. Then pricing Bermudan option is essentially to maximize the expected reward $h(\tau, X_\tau)$ over all stopping times $\tau \in \mc{S}$. Mathematically, denoting by $V(t,x)$ the value of such an option at time $t$ with current price $X_t = x$:
\begin{equation}
V(t,x) := \sup_{\tau \geq t, \tau \in \mc{S}} \mathbb{E}_{t,x}[h(\tau, X_\tau)],
\end{equation}
the price is given by $V(0,X_0)$. By dynamic programming,
\begin{equation}
V(t_i,x) = \max\{h(t_i, x), C_V(t_i, x)\},
\end{equation}
where $C_V(t_i, x)$ is the continuation value, corresponding to the action ``{continue}'' in $\mk{L}$:
\begin{equation}\label{def_cont}
C_V(t_i, x) := \mathbb{E}_{t_i, x}[V(t_{i+1}, X_{t_{i+1}})],
\end{equation}
and $h(t_i,x)$ is the immediate payoff if one chooses to exercise the option at $t_i$, related to the action ``{stop}'' in $\mk{L}$. Denote by $\tau^\ast(t,x)$ the stopping time when the supremum is attained, it is identified by
\begin{equation}
\{\tau^\ast(t_i,x) = t_i\} = \{x \in \mathcal{X}: h(t_i, x) \geq C_V(t_i,x)\}.
\end{equation}
Using the above formulation, one can estimate $\tau^\ast$ recursively from $t_N$ to $t_0$.
Rephrasing it in terms of our ranking problem setup, fixing time $t_i$, the choice between ``stop'' or ``continue'' is equivalent to find $\mathcal{C}(t_i, x) := \arg\max \{\mu_{stop}(t_i, x), \mu_{cont}(t_i, x)\}$ over $\mathcal{X}$, a segmentation of the input space between continuation and stopping regions. Here $\mu_{stop} = h$ can be evaluated deterministically, while a closed-form formula for $ \mu_{cont} = C_V$ is typically not available, but accessible through simulations. Moreover, its evaluation also depends on all further classifiers $\mathcal{C}(t_j, x)$, $i+1 \leq j \leq N$. To be more precise, for a given collection of estimated classifier $\hat{\mathcal{C}}(t_{i+1:N}, \cdot)$, define the pathwise stopping strategy:
\begin{equation}\label{def_tau}
\hat{\tau}(t_i,x)(\omega) := \inf\{t_j > t_i: \hat\mathcal{C}(t_j, X_{t_j}(\omega)) = stop\} \wedge T,
\end{equation}
for every path $X_{(\cdot)}(\omega)$ with initial position $X_{t_i} = x$. Now, by simulating $R$ independent paths $x^r_{t_{i:N}}$ starting from $x^r_{t_i} = x$, $r = 1, \ldots, R$, the continuation value is estimated by
\begin{equation}\label{def_approxcont}
\hat C_V(t_i, x) := \frac{1}{R} \sum_{r=1}^R h(\hat\tau(t_i, x_{(\cdot)}^r), x^r_{\hat{\tau}(t_i, x_{(\cdot)}^r)}),
\end{equation}
producing the estimated classifier $\hat \mathcal{C}(t_i, \cdot)$ at location $x$
\begin{align}\label{def_cal_fm}
\hat\mathcal{C}(t_i, x) &:= \arg\max\{\mu_{stop}(t_i, x), Y_{cont}(t_i, x)\} , \\
Y_{cont}(t_i, x) &:= C_V(t_i, x) + \epsilon_{cont}(t_i, x), \quad \epsilon_{cont} := \hat C_V - C_V.
\end{align}
The term $\epsilon_{cont} = \hat C_V - C_V$ summarizes the simulation noise from two approximations: the usage of estimated classifiers $\hat \mathcal{C}(t_{i+1:N}, \cdot)$ that determines the exercise strategy \eqref{def_tau} and the action of replacing the expectation in \eqref{def_cont} by the average over sample paths \eqref{def_approxcont}. Once the decision maps $\hat \mathcal{C}(t_{1:N}, \cdot)$ are obtained, $V(0,X_0)$ is estimated on a out-of-sample set of $M'$ realizations of $X_{(\cdot)}$.
We use deep learning algorithms for the purpose of efficient and accurate learning of $\hat \mathcal{C}$ over the entire input $\mathcal{X}$ through finite samples. Starting from the maturity time $t_N = T$, the learning is done recursively back to $t_0=0$, with each $\hat{\mathcal{C}}(t_i, \cdot)$ produced by a neural network. In practice, one can improve the label quality in the training set by increasing the number of simulations $R$ which can reduce the magnitude of $\epsilon_{cont}$. However, we remark that errors are tolerated and $R$ does not need to be too large, as long as they do not affect the ordering of $Y_{cont}$ and $h$. We describe the pricing procedure in Algorithm~\ref{def_algorithm}.
\begin{algorithm}[t]
\caption{Deep Learning for Pricing Bermudan Option \label{def_algorithm}}
\begin{algorithmic}[1]
\REQUIRE $M$ = \# of sampling locations, $R$ = \# of sample paths at each grid, $M'$ = \# of out-of-sample paths for pricing, $X_0$ = initial price
\STATE Define the classifier at maturity $t_N = T$: $\hat \mathcal{C}(t_N, x) = stop$
\FOR{$i \gets N-1$ downto $1$}
\STATE Generate sampling locations $x \in \mathcal{X}$ of size $M$
\FOR{each location $x$}
\STATE Sample $R$ paths $x^r_{t_{i:N}}$ with $x^r_{t_i} = x$, $r = 1,
\ldots, R$
\STATE Construct the pathwise stopping strategy $\hat{\tau}^r(t_i, x) := \inf\{t_j > t_i: \hat\mathcal{C}(t_j, x^r_{t_j}) = stop\}$ \label{algo_strategy}
\STATE Compute the continuation value by $\hat C_V(t_i, x) := \frac{1}{R} \sum_{r=1}^R h(\hat\tau^r(t_i, x), x^r_{\hat{\tau}^r(t_i,x)})$ \label{algo_cont}
\IF{$ \hat C_V(t_i, x) > h(t_i, x)$}
\STATE $z(x) \leftarrow continue$
\ELSE
\STATE $z(x) \leftarrow stop$
\ENDIF
\ENDFOR
\STATE Train a neural network with the previously generated samples of $(x, z(x))$ as the input and the classifier $\hat \mathcal{C}(t_i, \cdot)$ as the output
\ENDFOR
\STATE Generate $M'$ out-of-sample paths $x^r_{t_{0:N}}$ with $x_{t_0}^r = X_0$, $r = 1, \ldots, M'$
\STATE Compute $\hat C_V(t_0, X_0)$ by repeating Step \ref{algo_strategy} and \ref{algo_cont} for $(t_0, X_0)$
\RETURN Estimated price $\hat V(t_0, X_0) = \max\{h(t_0, X_0), \hat C_V(t_0, X_0)\}$.
\end{algorithmic}
\end{algorithm}
Let us also remark that, this specific application of ranking response surfaces by deep learning actually has the same setup as the problem studied in \cite{BeChJe:18}, where the backward recursive stopping decisions are approximated by a feed-forward NN. In some sense, \cite{BeChJe:18} uses the feed-forward NN as interpolation to approximate the function with values $0$ and $1$ representing ``continuation'' and ``stopping''. In our work, by recasting the problem as image segmentation, one is allowed to use the more delicate architecture of neural networks ({\it e.g.} UNet), which increases computational efficiency.
With all above efforts on reformulating Bermudan option pricing as ranking response surfaces, we perform a numerical study of 2-D max-Call $h(t,x) = e^{-rt}(\max(x_1, x_2) - K)_+$. The underlying assets $X = (X_1, X_2)$ are modeled by geometric Brownian motions,
\begin{equation}\label{def_Xi}
\,\mathrm{d} X_i(t) = (r-\delta) X_i(t) \,\mathrm{d} t + \sigma X_i(t) \,\mathrm{d} W_i(t), \quad i = 1, 2,
\end{equation}
where $(W_1, W_2)$ is a 2-D standard BM, with the parameters from \cite{andersen2004primal}:
\begin{equation}\label{def_parameter}
r = 5\%, \quad \delta = 10\%, \quad \sigma = 20\%, \quad X(0) = (90, 90), \quad K = 100, \quad T = 3, \quad N = 9, \quad t_i = i\frac{T}{N} .
\end{equation}
From the numerical tests in Section~\ref{sec:numerics}, one can notice that the generalization accuracy of UNIF (or UNIF+NL) is higher than that of SD (or SD+NL). Moreover, implementation of the UNet on uniform grids is easier than using the points generated by sequential design. Therefore, we will only use neural networks trained by data generated on uniform grids for computing the Bermudan option price. Figure~\ref{fig:fm} shows the decision maps estimated recursively by deep learning algorithms for different time slices. They are plotted backward in time, in the order of being generated. The trivial decision map at $t_N = 3$ is not included. A map at time $0$ is not needed, as we know $X(0)$. $\hat{\mathcal{C}}$ are generated by a uniform $32\times 32$ grids on $[50, 150]^2$ with $R = 100$ replication at each location. In the red area, the continuation value is higher, and thus it is optimal to keep holding the option; while in yellow regions, immediate rewards are higher, making it optimal to exercise right away. The estimated price $\hat V(0, X(0))$ is 8.05 with a standard deviation 0.029, based on $M' = 160,000$ out-of-sample paths repeating 100 times. This estimation is quite close to the true value of the option $8.075$, computed using a 2-D binomial lattice for this case \cite{Belomestny11}.
\begin{figure}[t]
\begin{tabular}{cccc}
\includegraphics[width=0.23\textwidth]{class_unif_noise_fm_0_3.png} &
\includegraphics[width=0.23\textwidth]{class_unif_noise_fm_1_3.png} &
\includegraphics[width=0.23\textwidth]{class_unif_noise_fm_2_3.png} &
\includegraphics[width=0.23\textwidth]{class_unif_noise_fm_3_3.png} \\
\includegraphics[width=0.23\textwidth]{class_unif_noise_fm_4_3.png} &
\includegraphics[width=0.23\textwidth]{class_unif_noise_fm_5_3.png} &
\includegraphics[width=0.23\textwidth]{class_unif_noise_fm_6_3.png} &
\includegraphics[width=0.23\textwidth]{class_unif_noise_fm_7_3.png}
\end{tabular}
\caption{Deep learning of the decision maps $\hat \mathcal{C}(t_i, \cdot)$ with the training data generated by UNIF+NL (cf. Table~\ref{tbl:datadesign}). Black solid lines show the estimate boundaries of $\{\text{continue}, \text{stop}\}$. The colorbar indicates the probability that the neural network outputs for the decision of ``continuation''. Darker color means more confidence of the neural network feels about the classification.}\label{fig:fm}
\end{figure}
{Next, we investigate the performance of deep learning algorithms on pricing $d$-dimensional max-Call Bermudan option, that is, the payoff function is $h(t,\bm x) = e^{-rt}(\max(x_1, \ldots, x_d)-K)_+$, $\bm x \in \mathbb{R}^d$. The underlying assets $X_i(t)$ follow dynamics \eqref{def_Xi}, for $i = 1, \ldots, d$, and the parameters follow the choice \eqref{def_parameter}. The decision maps are trained by $1024\times d$ samples on $[30, 180]^d$ with $R = 100$ replication at each location. The samples are generated using Latin Hypercube, ensuring that the set is representative. In Table~\ref{tbl:fm}, we list the computed estimated price $\hat V(0, X(0))$ and simulation time for various choices of parameters and dimensions, where our results agree well with the binomial lattice method \cite{boyle1989numerical} and primal-dual method \cite{andersen2004primal, broadie2008improved}. One can also observe that, the proposed algorithms based on deep learning can easily simulate examples of high dimensions (the highest $d=50$ in our simulations), while conventional methods usually become infeasible for examples of dimension$>5$.}
\begin{table}[t]
\centering
\caption{Results for max-call options on $d$ underlying assets with parameter chosen in \eqref{def_parameter}. The computational time are in seconds. The binomial value, and BC 95\% CI are obtained from \cite{andersen2004primal} and \cite{broadie2008improved} respectively, which are only available for low dimensional cases ($d\leq 5$). }\label{tbl:fm}
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline
d & $X(0)$ & $\hat V(0, X(0))$ & Training Time & Generalization Time & Binomial & BC 95\% CI \\ \hline
2 & 90 & 8.065 & &74.412 & 8.075 & \\
2 & 100 & 13.897 & 303.03&75.714 & 13.902&\\
2 & 110 & 21.349 & &74.195 & 21.345&\\ \hline
3 & 90 & 11.271&& 76.366 & 11.29& \\
3 & 100 & 18.659&768.33& 78.596& 18.69 & \\
3 & 110 & 27.606 && 75.895& 27.58 & \\ \hline
5 & 90 & 16.594&& 78.169 & & [16.620, 16.653]\\
5 & 100 & 26.126 &912.20&75.143 & &[26.115, 26.164] \\
5 & 110 & 36.734&& 76.267 & & [36.710, 36.798]\\ \hline
10 & 90 & 26.220&& 80.497& & \\
10 & 100 & 37.329 &1025.19& 79.402& & \\
10 & 110 & 50.557&& 79.760 & & \\ \hline
20 & 90 & 37.695 && 83.677& & \\
20 & 100 & 51.676 &1695.68&84.529& & \\
20 & 110 & 65.734&& 84.978& & \\ \hline
50 & 90 & 53.653&& 91.561 & & \\
50 & 100 & 69.130 &2594.67&90.734& & \\
50 & 110 & 84.444&& 90.878& & \\ \hline
\end{tabular}
\end{table}
In Table~\ref{tbl:fm}, the fourth column lists the time of training the classifiers $\hat \mathcal{C}(t_i, \cdot)$, and the fifth column gives the computational time of estimating price $\hat V(0, X(0))$ using out-of-sample paths. We remark that, firstly, the training only needs to be done once to price derivatives with different $X(0)$, and this is why we only report the training time for different $X(0)$ with the same dimension $d$. Secondly, the training time is related to the random initialization of network parameters. The actual training time is affected greatly by the empirical stopping criteria measured by the cross-entropy loss function and how close the initialized network parameters are to the local minimizers. Thus, this part is only for reference, and one may significantly shorten it if one starts from the pre-trained parameters. This is related to the third remark: the advantage of treating the whole problem as a classification. By doing so, one can generalize to other problem settings by using the fine-tuning, which is common in deep learning. In practice, practitioners can pre-train the neural network to identify the stopping region on a large dataset ({\it i.e.} underlying assets with all different returns, volatilities, strike price and maturity), which may take a long time. But once this is done, and if the new dataset is not drastically different from the original dataset (which is very likely), the pre-trained network will already learn some features that are relevant to the current classification problem. Thus, only fine-tuning is needed, and here are a couple of common fine-tuning techniques: 1) truncating the last layer of the pre-trained network and replacing it with a new layer, after which people only train the new layer while freezing others'; and 2) using a smaller learning rate of the stochastic gradient descent algorithm, which is usually ten times smaller than the one used for scratch training. Therefore, the generalization time is more relevant in our algorithm, which is the major cost for derivative pricing after the initial pre-training investment.
\section{Conclusion and future works}\label{sec:conclusion}
By recasting ranking response surfaces as image segmentation, we propose to use deep neural networks (NNs) with various architectures ({\it e.g.}, feed-forward NNs, UNet) as computational tools. Specifically, we consider labeling the entire input space using the index of the minimal surface, which segments the input space into distinct parts and allows one to use deep neural networks for efficient computation. This gives an alternative way of efficiently solving the problem instead of using sequential design in our previous work \cite{HuLudkovski17}. In particular, deep learning algorithms provide a scalable model and make the predicted results no more depend on the assumptions used in Gaussian process (GP) metamodels, for example, the assumptions on local/non-local kernels. Moreover, considering ranking response surfaces as image segmentation allows one to use a broad class of neural networks({\it e.g.}, CNNs, UNet, and SegNet). Although based on what we know so far, there is no existing result in literature rigorously discussing which architecture works the best for image segmentation, an allowance of a broader class of NNs will make one choose an architecture with better performance empirically. For example, in the two-dimensional synthetic test, UNet produces a better accuracy than feed-forward NNs with comparable training time. A few more examples including a ten-dimensional synthetic test and the Bermudan option pricing are presented to show the success of deep neural networks in ranking response surfaces, which makes it possible to tackle more complicated problems, {\it e.g.}, optimal stopping game. Noticing that samples around the partition boundaries usually has low signal-to-noise level and potentially increase the chance of mislabeling, a natural extension is to consider replication/batching at those locations. Recent work \cite{binois2018replication} by Binois {\it et al.} addresses this issue using GP metamodels, and we plan to study this problem by deep learning in the future. Meanwhile, the theoretical convergence of networks with delicate structures is also interesting and needs to be analyzed in the future. It will also be interesting to further investigate problem~\eqref{def_cal} with continuum action space $\mk{L}$, which can be applied to pricing variable annuities problems as recently studied in \cite{GoMoZa:192,GoMoZa:19}. To this end, advanced deep learning algorithms, possibly hybridizing with other numerical techniques to solve partial differential equations for pricing and careful discretization of $\mk{L}$ for convergence, are needed and left for future work.
\section*{Acknowledgment}
We are grateful to Professor Marcel Nutz for bringing the reference \cite{BeChJe:18} into our attention, and Jay Roberts and Kyle Mylonakis for useful discussions.
\bibliographystyle{plain}
| {'timestamp': '2020-03-12T01:06:56', 'yymm': '1901', 'arxiv_id': '1901.03478', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03478'} | arxiv |
\section{Introduction}
The drive to reduce greenhouse gas emissions and declining capital costs are precipitating rapid increases in wind and solar generation capacity. Despite their low emissions profile, wind and solar power supplies vary rapidly in time, motivating the need for additional balancing resources~\cite{budischak2013cost}.
Since some peaking power plants may take more than an hour to bring online, during times of extensive peak usage, direct load control (i.e., load shedding) has been employed to ensure the security of the power system~\cite{molina2011decentralized}.
However, the internet-connected distributed energy resources (DERs) are flexible in power demand and can be coordinated to provide ancillary services to the grid~\cite{meyn2015ancillary}.
Although the main idea underlying modern demand coordination has existed for decades~\cite{schweppe1980homeostatic}, the infrastructure required for load coordination is still in early stages, but developing rapidly~\cite{almassalkhi2018asynchronous,meyn2015ancillary,mathieu2013state}.
Packetized energy managment (PEM) introduced previously by the authors~\cite{almassalkhi2018asynchronous,Kate2019}, is one such load coordination scheme. PEM leverages protocols used to manage data packets in communication networks to regulate the aggregate power consumption of DERs. More specifically, as in digital communication systems that break data into packets before transmission, PEM enables load control devices to consume energy in the form of "energy packets" which devices request periodically using a carefully designed randomized control policy.
In PEM, the load coordinator only needs to know the aggregate power consumption and aggregate requests from the packetized-load to provide ancillary services to the grid. The energy-packet mechanism of PEM, therefore, provides a significant advantage in terms of communication overhead, over state-estimation based approaches, that require an entire histogram of states, which is addressed through observer design. Furthermore, controller complexity decreases in PEM, since the load coordinator only responds to individual requests depending upon the available flexibility as compared to more complex controllers.
By leveraging protocols that are similar to TCP/IP, PEM inherits certain properties with regard to providing statistically uniform access to the grid. PEM guarantees the quality of service (QoS) for individual DERs in the entire population through its unique opt-out mechanism. The mean-field approaches, on the other hand, ensure QoS in the mean sense of the population where individual DERs might violate the QoS~\cite{meyn2015ancillary}.
This work describes how aggregated PEM resources can be coordinated in real-time and demonstrates the applicability of the method to practical power systems applications and the role of cyber-physical systems (CPS).
Historically, balancing authorities maintain real-time supply/demand balance through automatic generation control (AGC) and load-frequency control (LFC) by implementing PI controllers in steam turbine generator systems to ensure power system operation at nominal frequency~\cite{kundur1994power}. As the amount and distribution of controllable resources increases, determining an appropriate response to unscheduled events (e.g. power imbalances due to prediction error) is more challenging for the grid operators who need new tools for decision making.
An increasing number of researchers~\cite{kardakos2016optimal,mnatsakanyan2015novel} and industry groups~\cite{Sandia} are employing virtual power plants (VPPs) to aggregate groups of DERs and then dispatch those resources into energy markets, such as frequency regulation/AGC. VPPs are formed from aggregation of flexible resources which are limited in power and energy. Since PI-control-based AGC does not take energy state estimation of VPPs into account, it may overuse the offered flexibility in short period of time (greedy) which leads to the sudden saturation of VPPs (i.e. cannot provide any more flexibility). To overcome this phenomenon, model-predictive control (MPC) can be employed. MPC is a multi-input, multi-output (MIMO), optimization-based, predictive control technique that considers system constraints explicitly~\cite{borrelli2017predictive}. MPC strategies have previously been applied in power systems for optimal coordination of controllable loads, load shedding, capacity switching, tap-changer operation, etc. The main purpose of those strategies is contingency management, voltage stability, thermal control of transmission lines, and energy management~\cite{amini2018tradingoff,hiskens2005mpc,amini2018corrective}. In this work, an MPC scheme is employed to track a secure, economically-optimal reference trajectory of generators and VPPs while responding to power imbalances and satisfying physical constraints of the power system. For frequency regulation in the power system under high penetration of renewables, MPC has several advantages over PI controllers including robustness of the system against disturbance and uncertainty~\cite{ersdal2016model}.
This paper demonstrates the benefit that MPC has on dispatching resources with limited energy supply. An HIL platform is developed that consists of a transmission grid, MPC corrective dispatch scheme and PEM-enabled DERs emulated on a high-performance PC that requests packets of energy from the aggregator. The VPPs are physically realized in a micro-controller that connects the DERs to the grid via analog signals. The experimental results demonstrate the effectiveness of the MPC in a real-time CPS, thereby validating the ability of a VPP to track challenging signals under such control.
The remainder of the paper is organized as follows. Section II details Packetized Energy Management of DERs. In Section III, we demonstrate our cyber-physical validation platform. Section IV gives an overview of the system operational and control. Implementation results are provided in Section V and Section VI concludes the paper.
\section{Packetized energy management of DERs}
Packetized energy management is a bottom-up DER coordination scheme in which the DERs submit randomized requests of energy packets. The VPP accepts or rejects these requests based on the available flexibility. The DERs considered in this work are thermostatically controlled loads (TCLs) and energy storage systems (ESS).
The PEM-enabled DERs are designed to operate in one of the four following logical states: (i) charge (ii) discharge (iii) off (iv) opt-out. The first three states (charge, discharge, off) are associated with the normal PEM operation whereas the fourth OPT-OUT state ensures quality of service (QoS). A DER in OFF stochastically requests a charge packet or a discharge packet. If a charge packet is accepted, the DER changes state from OFF to CHARGE and consumes power for a specific time interval $\delta_c$. If a discharge packet is requested and consequently accepted, the DER transitions from OFF to DISCHARGE state and discharges power into the system for a fixed time $\delta_d$. After completing a charge or discharge packet, the device automatically transitions to OFF mode and this process of stochastically requesting charge/discharge packets repeats. PEM aims to maintain the DER's state within minimum and maximum operating bounds. PEM provides QoS guarantees by enabling the devices to opt out of the \emph{packetizing} behavior when the energy state goes outside of allowable upper and lower limits.
\section{Cyber-Physical Layout}
The smart grid paradigm \cite{NISTsmartgrid2014} is largely about the transformation of power systems into full cyber-physical systems that enable bidirectional flows of energy and communications. CPS are of vital importance to the grid, especially when increasing the presence of renewable generation and smart devices, improving control \cite{7017600}, and adding resiliency to the system \cite{NationalInstituteofStandardsandTechnologySmartGridInteroperabilityPanel2010NIST-IRSecurity}. The validation of CPS require accurate models of both cyber and physical sub-systems (e.g. HIL systems communicating with one another over realistic communication protocols). In order to validate the proposed demand-side CPS scheme, a real-time HIL platform is developed consisting of a transmission system and packetized load. The OP5600 real-time digital simulator from OPAL-RT is used to simulate the HIL cyber-physical system. The OP5600 has a multi-core processor along with digital and analog I/O with the capability of interfacing to a network of PCs in order to simulate large models in real-time\footnote{Herein, real-time refers to timescales on the order of tens of milliseconds.}. The RT-Lab software allows the communication between a host PC and the target (OP5600) simulator such that a real-time physical model can run on the simulator while the controller would run on the PC where an operator could make adjustments when necessary.
``ePHASORSIM" is a tool developed by OPAL-RT to offer dynamic simulation of power systems in order to conduct power system studies and test control schemes. A grid is modeled with a standard positive-sequence equivalent single-phase constant-power AC model in ePHASORSIM, based on the Vermont Electric Power Company (VELCO) transmission system to be run in real time on the OP5600. RT-LAB and ePHASORSIM can be interfaced extremely easily with MathWorks' Simulink, which is used to develop the controls for the power system. The OPAL-RT blockset for Simulink allows a section of the Simulink block diagram to be run in real time on the OP5600 and the controls can be run asynchronously on the PC with the ability to accept user inputs when necessary. ESP8266 microchips were used to emulate VPP interconnections to the grid in real time. ESP8266 communicate with the cloud server over WIFI, while the server is being hosted on a Linux machine. Fig. \ref{fig:fullsys_overview} shows an overview of the cyber-physical platform used in this study.
\begin{figure}[h!]
\centering
\includegraphics[width=0.9\columnwidth]{Functional_spec_HILpaper.pdf}
\caption{Cyber-physical platform overview: The transmission grid is simulated on the OP5600 and MPC-corrective dispatch is realized on a host PC and generates balancing signals. ESP8266 devices are connected to a python-based server via WiFi and transmit the VPPs' states through the analog interface. The packetized load is emulated on a high performance PC and requests energy packets from the VPP through WiFi communication.}
\label{fig:fullsys_overview}
\end{figure}
\section{Energy aware dispatch of diverse energy \\resources}
Security constrained optimal power flow (SCOPF) enables grid operators to implement economic schedules for generators, flexible loads and importing power into the area for a number of hours. However, the volatility and intermittent characteristic of net-loads (i.e., demand minus renewables) results in forecast error and power imbalances. Since grid operators may pay high penalties for rescheduling generators or importing power through tie lines to balance supply and demand~\cite{arnold2011model}, power mismatches can be balanced by controlling flexible resources. This suggests a bi-level control strategy where the first level is in charge of economic scheduling and its outputs are used as a reference input to the second level which is in charge of dispatching generators and VPPs to balance the system against any disturbance. An overview of the proposed control system is provided in Fig.~\ref{fig:overview}.
\begin{figure}[t!]
\centering
\includegraphics[width=0.8\columnwidth]{controller_Hil3.pdf}
\caption{Overview of control scheme showing controller including OPF and MPC part and how each part is related to the power grid.}
\label{fig:overview}
\end{figure}
\subsection{AGC}
In the power system, safety of the electrical equipment and quality of delivered power is dependant on nominal system frequency. Therefore, the frequency should be controlled and monitored regularly and any mismatches in generation and consumption shall be corrected through load frequency control (LFC)~\cite{amini2016investigating}. Traditionally, the primary frequency regulation (speed-droop) on each generator stabilizes the power system with a steady-state frequency deviation from the desired system frequency depending on the droop characteristic and frequency sensitivity. A linear combination of frequency errors and change in imported power through tie lines from their scheduled contract basis is used as an error signal called area control error (ACE). AGC acts as a secondary control using an integral controller that sends out control signals to generators and VPPs to reduce ACE to zero in steady state. For the purposes of this work, only two areas are used for simplicity, while being effective enough to demonstrate the flow of power between different areas. The first area represents a small balancing authority (control area), and the second represents the aggregate dynamics of the external system. One machine exists in the external area and has a large inertia and capacity to emulate the properties of the rest of the interconnected power system.
\begin{figure}[ht]
\centering
\includegraphics[width=3.3in]{velco_control.pdf}
\label{fig:AGC_ControlDiagram}
\caption{Diagram showing a control schematic for the test system including all of the generation in the internal and external areas.}
\end{figure}
Fig. 3 shows the control diagram for the system modeled in this paper, which is an adapted version of the diagram from \cite{kundur1994power}. The interaction between the internal and external areas involved are shown. The external machine, one of the internal machines, and the VPPs assist in AGC/ACE, while all of these generation sources are equipped for primary frequency regulation.
\subsection{Model predictive control for power system}
Unlike conventional generators, VPPs (synthetic reserves) are energy-constrained and should be utilized considering their available flexibility. Aforementioned primary and secondary frequency controllers do not take energy states of the VPPs into account. Therefore, VPPs may reach their energy capacity limits (saturate) unexpectedly and cannot provide balancing power anymore. As a result, conventional generators must be rescheduled to provide the required balancing services, which can be expensive, or even infeasible leading to a reliability risk.
As an advanced control technique, MPC forms an alternative to the PI controllers in frequency regulation which uses a mathematical model of the power system based on the current and future information and constraints to find the optimal control actions with respect to the defined objective. Unlike a PI controller, MPC dispatches resources (generators and VPPs) at each time step considering current states and forecasted conditions while handling the energy constraints of the flexible resources. The results of this work show that the MPC is more suitable for frequency regulation and dispatching energy-constrained resources compared to the PI controllers~\cite{hermans2012assessment}. The MPC scheme can be summarized as follows:
\begin{enumerate}
\item Controller uses measured/estimated initial states to solve an open-loop optimal control problem for $M$ steps, which is known as prediction horizon, taking into account current and future constraints. This gives a sequence of optimal open loop control actions and predict output.
\item Apply receding horizon control so that only the first instance of the control sequence is given as the input to the plant.
\item Measure the actual system state after applying the first control action.
\item Go to step $1$.
\end{enumerate}
We consider a transmission system model comprising of $N_b$ buses, $N_l$ lines, $N_G$ generators, $N_L$ loads and $N_B$ VPPs. Parameters $\Omega_i^N$ and $\Omega_i^G$ refer to a set of all buses connected to bus $i$ and set of all generators at bus $i$ respectively. Since MPC relies on a linear model of the actual system, the dynamic model of the system is discretized by forward Euler method with sample time $T_s$. The MPC optimization is defined to minimize the cost of the deviation of generator outputs from the scheduled set-points $P_{G,i}^r$ considering deviation cost $c_{G,i}$
\small
\begin{mini!}[3]
{P_{G},P_{\text{ch}},P_{\text{dis}}}{ \sum_{l = k}^{k+M} \sum_{\forall i \in N_g} c_{G,i} ( P_{G,i}[l]-P_{G,i}^r[l] )^2 }
{\label{eq:optVPP}}{J^*=}
\addConstraint{\mkern-48mu P_{\text{ch},i}[l]-P_{\text{dis},i}[l]+P_{L,i}^f[l] + \sum_{j \in \Omega_i^N}f_{ij}[l] }{= \sum_{z \in \Omega_i^G}P_{G,z}[l]
\label{eq:powerbalance}}
\addConstraint{\mkern-48mu f_{ij}[l] }{ = b_{ij}(\theta_i[l] - \theta_j[l]) \label{eq:lineflow}}
\addConstraint{\mkern-48mu -\overline{f_{ij}} \leq f_{ij}[l]}{ \leq \overline{f_{ij}} \label{eq:linelimit} }
\addConstraint{\mkern-48mu \underline{P_{G,i}}\leq P_{G,i}[l]}{ \leq \overline{P_{G,i}} \label{eq:Glim}}
\addConstraint{\mkern-48mu -T_sR_{G,i} \leq P_{G,i}[l+1] - P_{G,i}[l]}{ \leq T_sR_{G,i} \label{eq:Gramp}}
\addConstraint{\mkern-48mu 0 \leq P_{\text{ch},i}[l]}{ \leq \overline{P_{\text{ch},i}} \label{eq:Clim}}
\addConstraint{\mkern-48mu 0 \leq P_{\text{dis},i}[l]}{ \leq \overline{P_{\text{dis},i}} \label{eq:Dlim}}
\addConstraint{\mkern-48mu -T_sR_{\text{ch},i} \leq P_{\text{ch},i}[l+1] - P_{\text{ch},i}[l]}{ \leq T_sR_{\text{ch},i} \label{eq:Cramp}}
\addConstraint{\mkern-48mu -T_sR_{\text{dis},i} \leq P_{\text{dis},i}[l+1] - P_{\text{dis},i}[l]}{ \leq T_sR_{\text{dis},i} \label{eq:Dramp}}
\addConstraint{\mkern-48mu S_i[l+1]}{ = S_i[l] + T_s\bigg(\eta_{\text{ch},i} P_{\text{ch},i}[l] - \eta_{\text{dis},i}^{-1} P_{\text{dis},i}[l]\bigg) \label{eq:dynSOC}}
\addConstraint{\mkern-48mu \underline{S_i} \leq S_i[l]}{ \leq \overline{S_i} \label{eq:Slim}}
\end{mini!}
\normalsize
where~\eqref{eq:powerbalance} imposes Kirchhoff's laws, implying that the net flow into a bus must equal the net flow out of that bus. Power flows on the line connecting bus $i$ and $j$ that are determined by~\eqref{eq:lineflow} must be within the power carrying capacity of the transmission line $\overline{f_{ij}}$ as shown in~\eqref{eq:linelimit}. Generators may inject power, $P_G$ and loads may consume power $P_L$ at each node $i$. Each conventional generator is described by its production state, which must be within generator upper and lower limits, $\overline{P_G}$ and $\underline{P_G}$, as shown in~\eqref{eq:Glim}. Furthermore, due to the thermal nature of the generators, their ramp rates are limited to up and down limits, $R_G$, as shown in~\eqref{eq:Gramp}. The responsive VPPs overcome limitations of generator ramping rates. Non-negative scalar $P_{\text{ch}}$ and $P_{\text{dis}}$ represent charging and discharging power of a VPP. The charging and discharging efficiencies are denoted by $\eta_{\text{ch}}$ and $\eta_{\text{dis}}$. Charging and discharging power and SOC of the VPPs are subject to constraints~\eqref{eq:Clim},~\eqref{eq:Dlim} and~\eqref{eq:Slim} where $\overline{P_{\text{ch}}}$, $\overline{P_{\text{dis}}}$, $\overline{S}$, and $\underline{S}$ represent maximum charging and discharging power and the maximum and minimum energy capacity of VPP, respectively. In general, coordination schemes do not offer instant control over all DERs in a fleet, but are subject to separate internal control, actuation, and communication loops~\cite{Duffaut2018tpwrsP2}. These cyber-physical control considerations manifest themselves as
ramp-rate limits on the charging ($R_{\text{ch}}$) and discharging ($R_{\text{dis}}$) of VPPs as shown in~\eqref{eq:Cramp} and~\eqref{eq:Dramp}. The dynamic of the VPP's SOC is shown in~\eqref{eq:dynSOC}.
\section{Results}
The section experimentally demonstrates that energy-aware dispatch of flexible VPPs enhances the AGC performance. The details of the test-setup are as follows. The transmission system consisting of 161 buses, 223 transmission lines and three generating units, is set up in ePHASORSIM and supplies a total load of 609 MW consisting of approximately $50\%$ renewable generation and remaining load is supplied from one external and two internal machines and generators. The flexibility is provided by two VPPs consisting of one bulk battery and one HIL VPP. The HIL VPP consists of real packetized-enabled DERs emulated on a high-performance PC, that requests the VPP (server) for packets of energy through web-sockets. The VPP obtains balancing signals from the grid operator and accepts/rejects the packets based on the available flexibility. ESP8266 is the physical realization of VPP that obtains the VPP's state from the server and sends it to the grid through an analog interface.
\subsection{Capacity saturation of VPP}
The HIL VPP and grid scale battery providing grid services are energy-limited and ignoring their energy capacity results in inferior AGC performance. The effect of their capacity on the ancillary services provided to the grid is demonstrated in Fig.~\ref{fig:HiL_AGC_sat}. The capacity of the battery is $45$ MWh. Fig.~\ref{fig:HiL_AGC_sat} shows that the load reduces by $50$ MW resulting in excess generation and both battery and VPP take up $45$ MW and $5$ MW respectively, of this excess generation. The battery is initially $50\%$ charged, as shown in Fig.~\ref{fig:HiL_AGC_sat} (b). After $t \approx 36$ mins, in Fig.~\ref{fig:HiL_AGC_sat} (b), the battery saturates and can no longer provide ancillary services to the grid. The power output of Gen.~2 is therefore reduced to account for the loss of $45$ MW and the system deviates from its scheduled generation (Fig.~\ref{fig:HiL_AGC_sat} (c)) in order to keep the system stable (Fig.~\ref{fig:HiL_AGC_sat} (d)).
\begin{figure}[ht!]
\centering
\includegraphics[width=0.9\columnwidth]{fig1.pdf}
\caption{(a) The HIL VPP's actual and reference power (MW) (b) Grid scale battery's actual power (MW), reference power (MW) and state of charge (SOC $\%$) during charge/discharge events (c) Generators' power output (MW) (d) Generators' mean frequency (Hz). The saturation of the VPP to a step decrease in load is shown in this figure. For the change in load, the HIL VPP and the battery charges at a continuous rate. The battery saturates at about t = $36$ mins, after which their output goes to zero and cannot support the requested flexibility.}
\label{fig:HiL_AGC_sat}
\end{figure}
\subsection{MPC with capacity saturation}
The proposed \emph{energy aware} scheme improves the performance by explicitly accounting for the energy limits of the flexible resources. Fig.~\ref{fig:HiL_MPC} shows a load change $\Delta P_L = 50$ MW that results in the HIL VPP and the battery providing the remaining slack. MPC keeps track of the current state of charge of the HIL VPP and the battery (Fig.~\ref{fig:HiL_MPC} (a) and (b)) and after $t \approx 13$ mins, gradually reduces the set-points of the battery to avoid saturation as shown, in Fig.~\ref{fig:HiL_MPC} (b). The HIL VPP and the battery can therefore supply ancillary services to the grid for over $60$ mins.
\begin{figure}[ht!]
\centering
\includegraphics[width=0.9\columnwidth]{fig2.pdf}
\caption{(a) The HIL VPP's actual power (MW) and reference power (MW) (b) Grid scale battery's actual power (MW), reference power (MW) and state of charge (SOC $\%$) during charge/discharge events (c) Generators' power output (MW) (d) Generators' mean frequency (Hz). MPC with capacity saturation takes into consideration the current state of charge of the VPP and initially ramps up to the requested $50$ MW. However, at t = $13$ mins, MPC lowers the setpoint in steps to avoid VPP saturation and provide support to the system for a longer time. }
\label{fig:HiL_MPC}
\end{figure}
\section{Discussion/Conclusion}
This paper presents a hardware-in-the-loop implementation of PEM-based cyber-physical platform and demonstrates that aggregated PEM-enabled DERs can
provide ancillary services to the grid. The system consists of emulated DERs, an aggregator realized as real live webserver, and a transmission system developed from the real data provided by VELCO. The experimental studies carried out in this work show that conventional control schemes (i.e. AGC and droop) do not take into account the state of charge of VPPs while providing ancillary services to the grid that leads to capacity saturation of the VPPs. As a result, the VPP can no longer support the requested flexibility and cause a disturbance in the grid because the generators have to ramp-up quickly to ensure stability. Conventional schemes are therefore greedy in managing flexible resources and leads to capacity saturation and unwanted disturbances. Model predictive control (MPC) responds to the unexpected disturbances by dispatching resources depending upon the hourly load forecast as well as minute-by-minute dispatch in a receding horizon. MPC is shown to proactively vary the consumption of flexible resources depending upon the SOC, which utilizes these resources for a longer time than the base case with AGC. The generators therefore operate as close as possible to their optimal limits for a much longer time.
\vspace{-0.1cm}
\section*{Acknowledgment}
The authors would like to extend thanks to Bernadette Ferndandez and Chris Root of VELCO for providing actual transmission and bus data for the Vermont system to help provide a more realistic study.
\vspace{-0.1cm}
{\small
\bibliographystyle{IEEEtran}
| {'timestamp': '2019-01-15T02:03:28', 'yymm': '1901', 'arxiv_id': '1901.03773', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03773'} | arxiv |
\section{Introduction}\label{On the Skewness of non-iid stationary data}
In a nonparametric framework, the central limit theorem (CLT) is a critical tool in drawing inference about the mean of a population. The CLT validates the use of the percentiles of the normal distribution to approximate those of the unknown sampling distribution of a centered partial sum of a given set of data.
The next important step after establishing a CLT is to characterize the departure of the sampling distribution of the underlying partial sum functional from normality and to address the speed at which it vanishes. Expressed as a function of the sample size $n$, and without restricting the distribution of the data to the symmetrical ones, the error of the CLT is generally known to be of order $O(1/\sqrt{n})$. Usually, the vanishing rate $1/\sqrt{n}$ is referred to as the first order accuracy, correctness or efficiency of the CLT. The error of the CLT has been extensively studied by several authors, mainly using the Berry-Esseen inequality and the Edgeworth expansion. Both these methods show that in the i.i.d case, the CLT is usually first order efficient (cf., e.g., Bhattacharya and Rao \cite{Bhattacharya and Rao}, Senatov \cite{Senatov} and Shorack \cite{Shorack}). The same error rate of $1/\sqrt{n}$ has also been shown to hold for some classes of weakly dependent data (cf., for example, G\"{o}tze and Hipp \cite{Gotze and Hipp}, Lahiri \cite{Lahiri 1993}).
\\
There are a number of methods in the literature that deal with the problem of how to increase the accuracy of the CLT. The tilted approximation (cf. Barndorff-Nielson and Cox \cite{Barndroff-Nielson and Cox}) is a method of reducing the error admitted by the CLT. In this method, which is of theoretical interest, the densities of the partial sums of an i.i.d. data set are approximated by some tilting expressions. The error of this approximation is of order $O(1/n)$. The drawback of the tilted approximation is that computing the tilting expressions requires the full knowledge of the cumulant generating function of the data which is usually unknown.
Also, in the context of i.i.d. data, some other error reduction techniques are built around adjusting the cut-off points, the usual percentiles of standard normal distribution, by some additive correcting factors (cf., for example, Hall \cite{Hall Edgeworth correction}). This method is called the Edgeworth correction and it requires estimating values of $r$-th moments of the data, where $r \leq k$, for some $k \geq 3$. The drawback of this method is that it tends to over-correct the coverage probability of the resulting confidence intervals, when the sample size is relatively small. This issue is the result of the significant deviation between the actual values of the moments of the population from their estimated values, when the sample is of small size. Another Edgeworth correction method was introduced in Eriksson \cite{Eriksson}. The approach is essentially a randomization via adding a simulated set of values, from a specific class of distributions, to the original data. To specify the class of distributions from which the additive values are to be generated, it is assumed that the values of the second and third moments of the original data are known. Furthermore, Eriksson \cite{Eriksson} provides only one example of the distributions which can be used to generate the additive random values from. The approach is interesting in general, however, it is unsuitable for use in a nonparametric framework.
The bootstrap (cf., for example, Efron \cite{Efron}) is another approach to reducing the error of the CLT that requires repeated re-sampling from a given set of data and, hence it can be intrinsically viewed as randomized jackknife. Despite its popularity and advantages, the bootstrap approach has some drawbacks. This approach relies on repeatedly re-sampling with replacement from a given data set which makes it computationally expensive. Furthermore, the use of the bootstrap in application poses the important question of how large the number of bootstrap replications, $B$, should be in order to achieve a higher accuracy for the CLT in contrast to its classical counterpart. While the general belief is that for achieving the goal of higher accuracy, ideally $B$ should be $\infty$ (cf. Yatracos \cite{Yatracos}), some suggest that $B=500$ to $B=1000$ suffices (cf. Efron and Tibshirani \cite{Efron and Tibshirani}), others suggest that the higher accuracy is available uniformly in $B$. This means that the higher accuracy can still be achieved with replications as small as $B=9$ or $B=19$, for instance, (cf. Hall \cite{Hall}).
It seems that there are no results in the literature that would relate the required number of bootstrap replications, $B$, to the size of the sample at hand. Furthermore, when bootstrap is to be put in use for dependent data, via re-sampling with replacement, the i.i.d. nature of the bootstrap samples fails to preserve the covariance structure of the original data (cf. Cs\"{o}rg\H{o} \textit{et al}. \cite{Csorgo and Nasari and Oul-Haye} for discussions on the effect of bootstrapping on the covariance structure of linear processes). Overcoming this issue requires some adjusted re-sampling schemes, such as over-lapping and non-overlapping block-bootstrapping techniques (cf., e.g., Lahiri \cite{Lahiri Resampling Book} and Kim and Nordman \cite{Kim and Nordman}, G\"{o}tze and K\"{u}nsch \cite{Gotze and Kunch}), and the sieve and the augmented sieve (cf., e. g., Poskitt \emph{et al.} \cite{Pos}). When dealing with long memory data these various adapted for dependant data versions of the bootstrap suffer from a significant underestimation of the variance which in turn translates in producing confidence intervals with poor coverage probability even for samples with moderate sizes (cf. numerical studies in Section \ref{Comparison to bootstrap confidence intervals for long memory linear processes}).
\\
In this paper we introduce a method to stochastically weighing a given set of data in a multiplicative way that results in more accurate CLTs for linear processes. This approach creates a framework that requires neither re-sampling nor extra knowledge on the distribution of the data except for the same commonly assumed moment conditions for the classical CLT.
\\
The idea of boosting the accuracy of the CLT via creating randomized versions of the (asymptotic) pivots of interest, that continue to possess the pivotal property for the parameter of interest, was first explored in Cs\"{o}rg\H{o} and Nasari \cite{Csorgo and Nasari} for i.i.d. data and in Cs\"{o}rg\H{o} \textit{et al.} \cite{Csorgo and Nasari and Oul-Haye} for linear processes. The viewpoint in the latter papers is to create pivots that admit CLTs with smaller magnitude of error by replacing a data set by a randomly weighted version of it, where the multiplicative weights are of the form of functionals of symmetric multinomial random variables. A broader randomization framework for i.i.d. data was introduced in Nasari \cite{Nasari}, which is flexible in the sense that it allows choosing the randomizing weights from a virtually unlimited class of random weights, including multinomial weights, with a window parameter to regulate the trade-off between the accuracy of the CLT and the volume of the resulting randomized confidence regions for the mean of the original data. The present paper constitutes a generalization of the randomization approach introduced in Nasari \cite{Nasari} for i.i.d. data to the case when the data form a short or long memory linear process.
\\
As will be seen in this paper, introducing a controlled extra source of randomness in conjunction with the random mechanism that produces the original data can enhance the accuracy of the CLT. The refinement in the accuracy results from multiplying the original data by appropriately chosen random factors which do not change the nature of the given data set. More precisely, the multiplicative stochastic weights used in this paper are so that, if the original data set is of short memory then so is their randomized version. The same continues to hold true for randomized long memory linear processes. Moreover, in the case of long memory linear processes, the randomized pivots introduced in this paper tend to yield significantly better probabilities of coverage as compared to a number of the existing bootstrap methods including the sieve and the augmented sieve (cf. Section \ref{Comparison to bootstrap confidence intervals for long memory linear processes}).
\\
We conclude this section by an outline of the topics addressed in the rest of the paper.
In Section \ref{skewness reduction} we introduce a class of randomized pivotal quantities for the value of the common mean of the population from which a linear process structured data set of size $n\geq 1$ is drawn. In Section \ref{EE Section} we derive a general Edgeworth expansion result for a class of randomly weighted linear processes which, in the univariate case, is an extension of the Edgeworth expansion obtained in G\"{o}tze and Hipp \cite{Gotze and Hipp} for sums of weakly dependent random vectors. This result, that is also of independent interest, is then used to illustrate the error reduction effect of the randomization framework in Section \ref{skewness reduction} on the CLT of the randomized pivots introduced in it.
Section \ref{The CLT} is devoted to establishing the asymptotic validity of the randomized pivots introduced in Section \ref{skewness reduction} via deriving a CLT for them under more relaxed conditions than those required for the Edgeworth expansion result in Section \ref{EE Section}. Section \ref{The CLT} also contains some discussions on the resulting randomized confidence intervals and some numerical demonstrations of their improved performance over that of their classical non-randomized counterparts. A numerical comparison of the performances of some methods of bootstrap and the randomization scheme introduced in this paper is presented in Section \ref{Comparison to bootstrap confidence intervals for long memory linear processes} for long memory data.
Further results on Studentization of the randomized pivotal quantities are given in Section \ref{Complete Studentization}. Section \ref{proofs} includes the proofs.
\section{Skewness reduction }\label{skewness reduction}
In this section we discuss the shortcoming of the leading measures of skewness which are defined primarily for i.i.d. data, when dealing with manipulations (functionals) of dependent data. Then, we consider a generalization of the criterion of skewness so that it is suitable for both stationary and i.i.d. data. This generalized definition of skewness is then used to introduce our approach to increase the accuracy of the CLT for linear processes.
\\
When the sampling distribution of the normalized partial sums of a set of $n$, $n \geq 1,$ univariate i.i.d. random variables $Y_1, \ldots, Y_n$, admits an Edgeworth expansion, the Fisher-Pearson's measure of skewness $\E (Y_1-\E(Y_1) )^3 / (\textrm{Var}(Y_1) )^{3/2}$ becomes the coefficient of an expression of order $O(1/\sqrt{n})$, as $n \to \infty$. In other words, the measure of skewness is the coefficient of the slowest vanishing term of the error admitted by the CLT. This property motivates viewing the skewness as the most important characteristic of the distribution of the data in measuring the departure from normality.
The closer the value of the skewness is to zero, the more symmetrical the sampling distribution of the underlying partial sum of a given data set will be. The commonly used measures of skewness, such as the aforementioned Fisher-Pearson, are defined for the marginal distribution of an i.i.d. set of data with a finite third moment. This definition is suitable only for the i.i.d. case, as it does not account for the dependence when a stationary and dependent data of size $n$ form the summands of a partial sum which admits the CLT. The latter observation calls for a broader definition for skewness that is to take the partial sum of a set of random variables into consideration. This means that skewness should naturally be defined for the sampling distribution of an underlying partial sum functional rather than for the marginal distribution of its summands. The need for such a definition for skewness in the context of this paper stemmed from our need for a proper measure of skewness when studying the problem of boosting the accuracy of pivotal quantities of the form of partial sums for the mean of linear processes.
Prior to defining an appropriate measure of skewness for stationary linear processes, we first set up the definition of linear processes of consideration.
To formally state our results in this section, and also for the use throughout this paper, we let $X_1,\ldots,X_n$ be the first $n\geq 1$ terms of the linear process
$\{X_t:\ t\ge1\}$ defined as
\begin{equation}\label{eq 1}
X_t=\mu+\sum_{k=0}^{\infty} a_{k} \zeta_{t-k}, \ t \geq 1,
\end{equation}
where $\mu$, $\mu \in \mathbb{R}$, is the mean of the process, $\{a_k; \ k \in \mathbb{Z} \}$ is a sequence of real numbers such that $\sum_{k=0}^{\infty} a^{2}_{k}<\infty$ and $\{\zeta_k:\ k \in \mathbb{Z} \}$ are i.i.d. white noise innovations with $\E \zeta_1=0$ and $0<\sigma^2:=\V(\zeta_1)<\infty$. Moreover, we assume that $X_t$ are non-degenerate with a finite variance $\gamma_{0}:= \E X_{1}^2-\mu^2:=\sigma^{2} \sum_{k=0}^{\infty} a^{2}_{k}-\mu^2$ and the autocovariance function
\begin{equation}\label{eq 1'}
\gamma_h:= \textrm{Cov}(X_s,X_{s+h})=\mathbb{E}[(X_{s}-\mu)(X_{s+h}-\mu)], \ h\geq 0, \ s\geq 1.
\end{equation}
In this paper we consider two types of the linear process (\ref{eq 1}). $(i)$ when $\sum_{k=0}^{\infty} |a_{k}|= \infty$. In this case we refer to $X_t$ as a long memory linear process. In particular, we consider the case when, as $k \rightarrow \infty$, for some $c>0$ we have $a_k \sim c k^{d-1}$, where $0< d <1/2$. We refer to $d$ as the memory parameter. The other type of linear processes considered in this paper is $(ii)$ when $\sum_{k=0}^{\infty} |a_{k}|< \infty$. In this case we refer to $X_t$ as a short memory linear process. To unify our notation we define the memory parameter $d$ for short memory linear processes as $d=0$.
\\
Consider the classical pivotal quantity for $\mu$, $T_{n,X}:\mathbb{R}^{n+1}\to\mathbb{R}$, that is a normalized partial sum functional, defined as
\begin{equation}\label{T_{n,X}}
T_{n,X}= \sum_{i=1}^n(X_i-\mu) \big/ \big(\textrm{Var}(\sum_{i=1}^n X_i) \big)^{1/2} .
\end{equation}
When $\E|X_1|^3<\infty$, we define the skewness measure of the pivotal quantity $T_{n,X}$ as follows:
\begin{equation}\label{skw}
\beta_{T_{n,X}}:=\mathbb{E}(T_{n,X})^3 = \E\big(\sum_{i=1}^n(X_i-\mu)\big)^3 \big/
\big(\V (\sum_{i=1}^n X_i )\big)^{3/2}.
\end{equation}
In view of the stationarity of $X_t$, and without loss of generality, we assume that $\mu=0$ and expand the skewness measure $\beta_{T_{n,X}}$ as follows:
\begin{eqnarray}\label{skewness4}
\beta_{T_{n,X}} &=& \E\Big( \sum_{i=1}^n X_i \Big)^3 \big/ \Big( \V (\sum_{i=1}^n X_i ) \Big)^{3/2}\nonumber\\
&=& \E(X_1^3)\big/ \Big( \sqrt{n}( \gamma_0+2\sum_{h=1}^n\big(1-\frac{h}{n}\big)\gamma_h )^{3/2}\Big)\nonumber\\
&+& 3 \Big( \sum_{h=1}^n (1-\frac{h}{n} )\big(\E(X_1^2X_{1+h})+\E(X_1X_{1+h}^2)\big) \Big) \big/ \Big( \sqrt{n}( \gamma_0+2\sum_{h=1}^n (1-\frac{h}{n} )\gamma_h )^{3/2} \Big) \nonumber\\
&+& 6 \Big(\sum_{h=1}^{n-1}\,\,\sum_{h'=1}^{n-h-1} (1-\frac{h+h'}{n})\E(X_1X_{1+h}X_{1+h+h'}) \Big) \big/ \Big( \sqrt{n}( \gamma_0+2\sum_{h=1}^n\big(1-\frac{h}{n}\big)\gamma_h )^{3/2}\Big).\nonumber\\
\end{eqnarray}
By virtue of the preceding representation of the skewness of $T_{n,X}$, one can readily see that $\beta_{T_{n,X}} \to 0$, as $n \to \infty$. This is in agreement with the fact that, under appropriate conditions, $T_{n,X}$ has a normal limiting distribution.
\\
We now introduce a randomization approach to construct more symmetrical, and hence more accurate (cf. Theorem \ref{Edgeworth Expansion}), versions of $T_{n,X}$, based on the data set $X_1,\ldots,X_n$, as in (\ref{eq 1}), as follows:
\begin{equation}\label{randomT}
T_{n,X,w}(\theta_n)=\big(\sum_{i=1}^n(w_i -\theta_n)(X_i-\mu)\big) \big/ \sqrt{ n \mathfrak{D}_{n,X,w}},
\end{equation}
where,
\begin{eqnarray}
\mathfrak{D}_{n,X,w} &:=& \E(w_1 -\theta_n)^2\gamma_0+2 \E \big( (w_1 -\theta_n)(w_2 -\theta_n) \big)
\sum_{h=1}^n (1-\frac{h}{n})\gamma_h \nonumber\\
&=& \V ( \sum_{i=1}^n (w_{i}-\theta_n) X_i)/n.
\end{eqnarray}
\\
The real valued constant $\theta_n$, to which we shall refer as the window constant, and the random weights used in the definition of the randomized pivot $T_{n,X,w}(\theta_n)$, as in (\ref{randomT}), are to be determined in view of the following scenario, to which we shall refer as the scheme {\textsf{(\textbf{RS})}}.
\subsection{The Randomization Scheme} \label{The Method*}
{\textsf{(\textbf{RS})}} ~~~~~~ Let $w_1,\ldots,w_n$ be either nonsymmetric and i.i.d. random variables with $\E\vert w_1\vert^3<\infty$ or have a symmetric multinomial distribution, i.e., $\mathcal{M}ultinomial(n; 1/n, \ldots, 1/n)$. Furthermore, we assume $w_{i}$ are \emph{independent} from the data $X_i$, $1\leq i \leq n$. Define
\begin{equation}\label{the factor}
\mathcal{H}_{n,X,w} (\theta):=
\frac{\E \Big( \sum_{i=1}^n (w_{i}-\theta) X_i \Big)^3}{n}. \nonumber
\end{equation}
Choose the window constant $\theta_n$, such that $\mathcal{H}_{n,X,w} (\theta_n)= 0$ or $\mathcal{H}_{n,X,w} (\theta_n) = \delta_n$, where $\delta_n \rightarrow 0 $, as $n \rightarrow \infty$.
\noindent
The following relation (\ref{Tw}) explains how the randomization scheme {\textsf{(\textbf{RS})}} results in more symmetrical pivotal quantities $T_{n,X,w}(\theta_n)$, as in (\ref{randomT}), as compared to their non-randomized counterpart $T_{n,X}$, as in (\ref{T_{n,X}}). To do so, we compute the skewness of $T_{n,X,w}(\theta_n)$. In what follows, for simplicity and without loss of generality, we assume that $\mu=0$.
\begin{eqnarray}\label{Tw}
\beta_{T_{n,X,w}} (\theta_n)&:=&
\E \Big( \sum_{i=1}^n (w_{i}-\theta_n) X_i \Big)^3 \big/ \Big( \V_{X,w}( \sum_{i=1}^n (w_{i}-\theta_n) X_i)\Big)^{3/2}\nonumber\\
&=& \mathcal{H}_{n,X,w} (\theta_n) \frac{n}{\Big( \V_{X,w}( \sum_{i=1}^n (w_{i}-\theta_n) X_i)\Big)^{3/2}}.
\end{eqnarray}
From the preceding equation, it is evident that choosing a window constant $\theta_n$ in accordance with the randomization scheme {\textsf{(\textbf{RS})}}, translates in values for $\beta_{T_{n,X,w}}(\theta_n)$ which are zero or negligible. In other words, when a window constant $\theta_n$ is chosen based on the scheme {\textsf{(\textbf{RS})}}, the randomized pivot ${T_{n,X,w}(\theta_n)}$, as in (\ref{randomT}), will be more symmetrical than its classical counterpart $T_{n,X}$ as in (\ref{T_{n,X}}). The effect of this symmetrization on the accuracy of the CLT for $T_{n,X,w}(\theta_n)$, as in (\ref{randomT}), is discussed in Section \ref{EE Section}.
\\
It is important to note that in the context of the scheme {\textsf{(\textbf{RS})}}, the skewness of the partial sum of a linear process can be made arbitral small without changing its dependence structure. The change in the dependence structure happens when the window constant equals the common mean of the weights.
This remark is formulated in the following Corollary \ref{Corollary 1}.
\begin{corollary}\label{Corollary 1}
Consider the randomization scheme {\textsf{(\textbf{RS})}}.
\\
(a) (Existence of solution) For large sample size $n$, the equation $\mathcal{H}_{n,X,w} (\theta)=0$ has at least one real valued solution $\theta_n$.
\\
(b) (Dependence structure Preservation) Let $\theta_n$ be a real solution to $\mathcal{H}_{n,X,w} (\theta)=\delta_n$, where $\delta_n \rightarrow 0$. Then, we have $\lim_{n \rightarrow \infty} \theta_n \neq E(w_{1}) $.
\end{corollary}
\begin{remark}
From Corollary \ref{Corollary 1} it is implied that $\theta_n$ cannot be equal to $E(w_1)$ in the context of the scheme {\textsf{\textrm{(}\textbf{RS}\textrm{)}}}. This results
in two important and desirable properties. Firstly, it prevents change in the covariance structure of the data after being multiplied by the non-centered random wights. More precisely, in view of {\textsf{\textrm{(}\textbf{RS}\textrm{)}}}, if the original data $X_i$ have a short memory structure then so is their randomized version $(w_{i}-\theta_n)X_i$ and the same is also true for randomized long memory data. Secondly, non-centered weights yield randomized confidence intervals, for the parameter of interest $\mu=\E(X_1)$, whose lengths vanish as the sample size increases to $\infty$ (we refer to Subsection \ref{confidence intervals} for further details in this regard).
\end{remark}
\section{The effect of scheme {\textsf{(\textbf{RS})}} on the error of the CLT for randomized linear processes}\label{EE Section}
We use the Edgeworth expansion for a class of linear processes to illustrate the refinement that results from our randomization approach {\textsf{(\textbf{RS})}}, as in Subsection \ref{The Method*}, which is primarily designed to reduce $\beta_{T_{n},X}$, the skewness of the classical pivot $T_{n,X}$, as in (\ref{skewness4}). The choice of the Edgeworth expansion is due to the fact that it provides an explicit and direct link between the skewness of a partial sum pivot and the error admitted by its CLT.
\\
The following Theorem \ref{Edgeworth Expansion} gives an Edgeworth expansion for the sampling distribution of partial sums of the random variables $(w_{i}-\theta_n)(X_{i}-\mu)$, $1\leq i \leq n$, where $X_1,\ldots,X_n$ are data from some short memory linear processes as in (\ref{eq 1}).
\begin{theorem} \label{Edgeworth Expansion}
Assume that the data $X_1, \ldots, X_n$ are as in (\ref{eq 1}). Let the weights $w_1,w_2,\cdots$, be i.i.d. random variables, that are independent from the data.
Also, let $\{\theta_n\}$ be a converging sequence of constants such that, $\lim_{n \rightarrow \infty}\theta_n \neq \E (w_1)$. Furthermore, assume that
\\ \\
$(i)~\textrm{either }\sum_{k=0}^\infty a_k (w_{k+1}-\theta_n) \neq 0,\, a.s.\, $ for all $n\geq 1$, and $\underset{u\to\infty}\limsup\left\vert\E\left(e^{iu\zeta_1}\right)\right\vert<1$,
\\
or
\\
$X_1\neq0$ a.s., and $\underset{u\to\infty}\limsup\left\vert\E\left(e^{iu w_1}\right)\right\vert<1$,
\\ \\
$
(ii)~ There\ exists\ \ell>0\ such~ that\ \vert a_k\vert\le (1/\ell)e^{- \ell k},\qquad\textrm{for all }k=0,1,\ldots,
$
\\ \\
$
(iii)~\E|\zeta_1|^5<\infty,
$
\\ \\
$(iv)~ \E|w_1|^5<\infty$.
\\
\\
Then, we have for all $x \in \mathbb{R}$,
\begin{equation}\label{EE}
P\left({T_{n,X,w}(\theta_n)}
\le x\right)-\Phi(x)= \beta_{T_{n,X,w}}(\theta_n) H(x)/\sqrt{n} + O(1/n),
\end{equation}
where $T_{n,X,w}(\theta)$ and $\beta_{T_{n,X,w}}(\theta)$ are, respectively, as in (\ref{randomT}) and (\ref{Tw}), $\Phi$ is the distribution function of the standard normal distribution and $H$ is a polynomial of degree 3.
\end{theorem}
\noindent
We note that the conditions $\underset{u\to\infty}\limsup\left\vert\E\left(e^{iu w_1}\right)\right\vert<1$ and $(iv)$ of Theorem \ref{Edgeworth Expansion}, pose no practical restriction on the choice of the random weights, as the class of random weights that satisfy these conditions is virtually unlimited.
\\
\\
In view of the randomization scheme {\textsf{(\textbf{RS})}}, as in Subsection \ref{The Method*}, and the relation (\ref{EE}), the smaller the $\beta_{T_{n,X,w}}(\theta_n)$ is, the closer the error of the CLT of $T_{n,X,w}(\theta_n)$ will be to $O(1/n)$. In the case the weights $w_i$ and the window constant $\theta_n$ are chosen in such a way that $\beta_{T_{n,X,w}}(\theta_n)=0$
then, in view of (\ref{EE}), the CLT for $T_{n,X,w}(\theta_n)$ will be second order accurate, i.e., of magnitude $O(1/n)$. On the other hand, when the linear process
$X_t$, as in (\ref{eq 1}), is so that its innovations satisfy the Cramer condition, i.e., $\underset{u\to\infty}\limsup\left\vert\E\left(e^{iu\zeta_1}\right)\right\vert<1$, and also it satisfies
conditions $(ii)$ - $(iii)$ of Theorem \ref{Edgeworth Expansion} as well as the condition
\begin{equation}\nonumber
(i^\prime)~ \sum_{k=0}^\infty a_k\neq 0, \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad
\end{equation}
then, Theorem (2.8) of G\"{o}tze and Hipp \cite{Gotze and Hipp} and its Corollary (2.9), in the univariate case, imply that, for all $x\in \mathbb{R}$, the sampling distribution of $T_{n,X}$, as in (\ref{T_{n,X}}), admits the following Edgeworth expansion:
\begin{equation}\label{EEC}
P\left(T_{n,X} \le x\right)-\Phi(x)=\beta_{T_{n,X}} \ H(x)/\sqrt{n}+O(1/n),
\end{equation}
where $\beta_{T_{n,X}}$, as in (\ref{skewness4}), is the skewness of $T_{n,X}$.
\\
To compare the Edgeworth expansion (\ref{EE}) to (\ref{EEC}), we consider linear processes whose innovations $\zeta_j$ satisfy the Cramer condition and $\sum_{k=0}^{\infty} a_k \neq 0$. We also consider weights that are non-degenerate i.i.d. and continuous with a finite fifth moment. In this case the first part of condition $(i)$ in Theorem \ref{Edgeworth Expansion} holds true. Now under the conditions $(ii)$, $(iii)$, and $(iv)$, one can see that (\ref{EE}) yields a smaller error when $\beta_{T_{n,X,w}}(\theta_n)$ is small. In particular, when $\beta_{T_{n,X,w}}(\theta_n)=0$, then the randomized pivot $T_{n,X,w}(\theta_n)$ is accurate of the second order while the classical $T_{n,X}$ remains accurate only of the first order, i.e., of order $O(1/\sqrt{n})$.
\begin{remark}\label{Advantage 1}
We note that in view of Theorem \ref{Edgeworth Expansion}, a randomly weighted partial sum of a linear process can admit an Edgeworth expansion even when the non-randomized partial sum of the original data fails to do so. This is due to the fact that in order to have the expansion (\ref{EE}), the crucial Cramer condition for the innovations $\zeta_j$, which is assumed in G\"{o}tze and Hipp \cite{Gotze and Hipp}, can now be shifted to the weights $w_i$.
In other words, when the innovations of the linear process at hand fail to satisfy the Cramer condition, then the expansion (\ref{EEC}) may no longer be valid. On the other hand, for the same linear process, using some appropriate non-centered randomizing weights, as specified in Theorem \ref{Edgeworth Expansion}, yields a valid Edgeworth expansion as in (\ref{EE}) for the resulting normalized randomized partial sum $T_{n,X,w}(\theta_n)$, provided that the original linear process is so that $X_1\neq 0$ a.s..
This constitutes an achievement in significantly enlarging the class of linear processes for which Edgewrorth expansion holds.
\end{remark}
\begin{remark}\label{Advantage 2}
Further to the advantage of randomization discussed in Remark \ref{Advantage 1},
it is also worth noting that when constructed using some continuous random weights, so that they satisfy the conventional conditions (\textit{iii}) and (\textit{iv}) of Theorem \ref{Edgeworth Expansion}, the randomized pivot $T_{n,X,w}(\theta)$ admits the Edgeworth expansion (\ref{EE}) for the linear processes (\ref{eq 1}) even when $\sum_{k=0}^\infty a_k=0$, provided that (\textit{ii}) holds true. This is true, since, in the case that the random weights are continuous, the first part of condition (\textit{i}) of Theorem \ref{Edgeworth Expansion} holds true even when $\sum_{k=0}^\infty a_k=0$. In contrast, the Edgewroth expansion (\ref{EEC}) for the classical $T_{n,X}$, as in (\ref{T_{n,X}}), is valid only for short memory linear processes (\ref{eq 1}) for which we have $\sum_{k=0}^\infty a_k \neq 0$, provided that the innovation satisfy the Cramer condition and, conditions (\textit{ii}) and (\textit{iii}) of Theorem \ref{Edgeworth Expansion} also hold true.
\end{remark}
\noindent
We conclude this section by noting that in the context of Theorem \ref{Edgeworth Expansion} and under its conditions $(i)$ and $(ii)$, when $\E|\zeta_1|^4<\infty$ and $\E|w_1|^4< \infty$, $T_{n,X,w}(\theta)$, as in (\ref{randomT}), for all $x\in \mathds{R}$, admits the expansion
\begin{equation}\label{newEE}
P\left({T_{n,X,w}(\theta_n)}
\le x\right)-\Phi(x)= \beta_{T_{n,X,w}}(\theta_n) H(x)/\sqrt{n} + o(1/\sqrt{n}).
\end{equation}
The preceding expansion is a counterpart of (\ref{EE}) on assuming the existence of a finite fourth moment for the innovations and the weights. The proof of the validity of (\ref{EE}) also results from the proof of Theorem \ref{Edgeworth Expansion} given in Section \ref{proofs}.
\\
The discussions following Theorem \ref{Edgeworth Expansion} on the error reduction effect of the scheme {\textsf{(\textbf{RS})}}, remain valid in view of (\ref{newEE}) with $o(1/\sqrt{n})$ instead of $O(1/n)$. Moreover, the advantages of the randomization discussed in
Remarks \ref{Advantage 1} and \ref{Advantage 2}, also remain valid when $T_{n,X,w}(\theta)$ admits the expansion (\ref{newEE}).
\section{CLT for randomized linear processes}\label{The CLT}
In this section we establish a CLT for the randomized pivot $T_{n,X,w}(\theta_n)$, as in (\ref{randomT}), under less stringent conditions than those assumed in
Theorem \ref{Edgeworth Expansion}. The CLT in this section is valid for the random weights and window constants as characterized in the randomization scheme {\textsf{(\textbf{RS})}} in Subsection \ref{The Method*}.
\\
For the use in Theorems \ref{CLT}, \ref{CLT G^*^stu} and \ref{Complete Studentization thm},
we let the notation $(\Omega_w,\mathcal{F}_w,P_w)$ stand for the probability space on which the triangular or non-triangular random weights are defined.
\begin{theorem}\label{CLT}
Let $X_1,\ldots, X_n$ be the first $n$ terms of the linear process (\ref{eq 1})
and consider the randomized pivot $T_{n,X,w}(\theta_n)$, as in (\ref{randomT}), with the weights $w_1,\ldots,w_n$ and the window constant $\theta_n$ be as specified in the
scheme {\textsf{(\textbf{RS})}}.
Then, as $n\to\infty$, we have for all $x \in \mathbb{R}$
\begin{equation}\label{CLT Conditional}
P\big( T_{n,X,w}(\theta_n) \leq x~ \big| w_1,\ldots,w_n \big) \longrightarrow \Phi(x) \qquad in\ probability-P_w
\end{equation}
and, consequently,
\begin{equation}\label{CLT Unconditional}
P\big( T_{n,X,w}(\theta_n) \leq x \big) \longrightarrow \Phi(x).
\end{equation}
\end{theorem}
\noindent
\subsection{Studentization}
We introduce the following $G_{n,X,w}(\theta_n,d)$ as a Studentized version of $T_{n,X,w}(\theta_n)$ that is valid for short and long memory processes as specified in Theorem \ref{CLT G^*^stu}.
\begin{equation}\label{Studentized}
G_{n,X,w}(\theta_n,d)=n^{-1/2-d} \Big(\sum_{i=1}^n(w_i-\theta_n)(X_i-\mu) \Big) \big/ \sqrt{q^{-2d} \ \mathcal{S}_{n,q,w} },
\end{equation}
where $q=O(n^{1/2})$,
\begin{equation}\nonumber
\mathcal{S}_{n,q,w}=\E (w_1-\theta_n)^2\bar\gamma_0+ \E\big( (w_1-\theta_n)(w_2-\theta_n) \big)\sum_{h=1}
^q\bar\gamma_h(1-\frac{h}{q})
\end{equation}
and $\bar{\gamma}_s:=\sum_{j=1}^{n-s}(X_j -\bar{X}_{n})(X_{j+s}-\bar{X}_n)\big/ n, \ 0\leq s \leq n-1, $ are the sample autocovariances.
\\
The Studentized pivot $G_{n,X,w}(\theta_n,d)$ can also be viewed as a randomized version of the Studentized pivotal quantity
\begin{equation}\label{classic Studentized}
T^{stu}_{n} (d):= n^{1/2 -d} ( \bar{X}_n -\mu) \Big/ \big( q^{-2d}\big( \bar{\gamma}_0 + 2 \sum_{h=1}^{q} \bar{\gamma}_{h} (1-h/q)\big) \big)^{1/2}.
\end{equation}
\noindent
Our Studentizing sequence $q^{-2d} \mathcal{S}_{n,q,w}$ for $G_{n,X,w}(\theta_n,d)$ is a generalization
of $q^{-2d} \big(\bar{\gamma}_0 + 2 \sum_{h=1}^{q} \bar{\gamma}_{h} (1-h/q)\big)$, the Studentzing sequence for the non-randomized $T^{stu}_{n} (d)$. Introduced in Abadir \textit{et al.} \cite{HACMAC}, the random sequence $ q^{-2d}\big( \bar{\gamma}_0 + 2 \sum_{h=1}^{q} \bar{\gamma}_{h} (1-h/q)\big)$ is an adaptation of Bartlett-kernel heteroscedasticity and autocorrelation consistent (HAC) estimator (see, for example, Andrews \cite{Andrews}) that allows for long memory. Although, in this paper attention is restricted to our HAC-type Studentizing sequences of the form $q^{-2d}\mathcal{S}_{n,q,w}$, we remark that it is also desirable to use other existing robust sample based estimators such as Robinson's periodogram based memory and autocorrelation consistent (MAC) estimator (cf. Robinson \cite{Robinson}), to construct Studentizing sequences for the randomized sum $n^{-1/2-d} \big(\sum_{i=1}^n(w_i-\theta_n)(X_i-\mu) \big)$.
\\
In what follows the notation $G_{n,X,w}(\theta_n,\hat d)$ in the case of a long memory process will stand for $G_{n,X,w}(\theta_n,d)$, where the memory parameter $d$ is replaced by its sample based estimate $\hat d$ as specified in the following Theorem \ref{CLT G^*^stu} which establishes the CLT for $G_{n,X,w}(\theta_n,d)$ and it reads as follows.
\begin{theorem}\label{CLT G^*^stu}
Consider $X_1, \ldots, X_n$, the first $n$ terms of the linear process (\ref{eq 1}), and let the weights $w_1,\cdots,w_n$ and the window constants $\theta_n$ be as in Theorem \ref{CLT}.
\\
\\
(A) If the linear process (\ref{eq 1}) is of short memory, i.e., $\sum_{k=0}^{\infty} |a_{k}|<\infty$, and $\E \zeta_{1}^{4}<\infty$,
then, as $n, q \to \infty$ such that $q=O(n^{1/2})$, we have, for all $x \in \mathbb{R}$,
\begin{equation}\nonumber\label{eq 18}
P\big(G_{n,X,w}(\theta_n,0)\leq x ~ \big|w_1,\ldots,w_n\big) \longrightarrow \Phi(x) \ in \ probability-P_w,
\end{equation}
and, consequently,
\begin{equation}\nonumber\label{eq 19}
P(G_{n,X,w}(\theta_n,0)\leq x) \longrightarrow \Phi(x),\ t \in \mathbb{R}.
\end{equation}
(B) Let the linear process (\ref{eq 1}) be of long memory such that $\E \zeta_{1}^{4}<\infty$ and, as $k \rightarrow \infty$, $a_k \sim c k^{d-1}$, for some $c>0$, where $0< d <1/2$. Then, as $n,q\to \infty$ such that $q=O(n^{1/2})$, we have for all $x \in \mathbb{R}$,
\begin{eqnarray*}
&&P\big(G_{n,X,w}(\theta_n,d)\leq x~ \big| w_1,\ldots,w_n\big) \longrightarrow \Phi(x) \ in \ probability-P_w,\\
&&P\big(G_{n,X,w}(\theta_n,\hat{d})\leq x ~ \big| w_1,\ldots,w_n\big) \longrightarrow \Phi(x) \ in \ probability-P_w,
\end{eqnarray*}
and, consequently,
\begin{eqnarray*}
&&P(G_{n,X,w}(\theta_n,d)\leq x) \longrightarrow \Phi(x),\ x \in \mathds{R}, \\
&&P(G_{n,X,w}(\theta_n,\hat{d})\leq x) \longrightarrow \Phi(x), \ x \in \mathds{R},
\end{eqnarray*}
where $\hat{d}$ is an estimator of the memory parameter $d$ such that $\hat{d}-d=o_{P}(1/\log n)$.
\end{theorem}
\noindent
When the linear process in Theorem \ref{CLT G^*^stu} is of long memory with memory parameter $d$, there are a number of estimators $\hat{d}$ in the literature that can be used to estimate $d$. The MLE of $d$, with the Haslett and Raftery \cite{Haslett and Raftery} method used to approximate the likelihood and, Whittle estimator (cf. K\"{u}nsch \cite{Kunch1987} and Robinson \cite{Robinson dhat}) are two examples of the estimators of the memory parameter $d$. For more on estimators
for the memory parameter and their asymptotic behavior, we refer to Bhansali and Kokoszka \cite{Bhansali and Kokoszka}, Moulines and Soulier \cite{Moulines and Soulier} and references therein.
\subsection{Randomized confidence intervals}\label{confidence intervals}
By virtue of Theorem \ref{CLT G^*^stu}, for the parameter of interest $\mu$, the mean of the linear process (\ref{eq 1}), the Studentized randomized pivotal quantity $G_{n,X,w}(\theta_n,d)$, as in (\ref{Studentized}), yields asymptotically exact size randomized confidence intervals with nominal size $100(1-\alpha)\%$, $0<\alpha<1$, which are of the form:
\begin{equation}\label{randomized CI}
I_{n,X,w}(\theta_n) := \Big[ \min\{\mathcal{A}_{n,X,w,\alpha}(\theta_n), \mathcal{B}_{n,X,w,\alpha}(\theta_n) \} , \max\{\mathcal{A}_{n,X,w,\alpha}(\theta_n), \mathcal{B}_{n,X,w,\alpha}(\theta_n)\} \Big],
\end{equation}
where
\begin{eqnarray*}
\mathcal{A}_{n,X,w,\alpha}(\theta_n) &=& \Big(\sum_{i=1}^n (w_{i}-\theta_n)X_i -z_{\alpha/2} n^{1/2+d} \sqrt{q^{-2d} \ \mathcal{S}_{n,q,w} } \Big) \big/ \Big(\sum_{i=1}^n ( w_{i} -\theta_n ) \Big)\\
\mathcal{B}_{n,X,w,\alpha}(\theta_n) &=& \Big(\sum_{i=1}^n (w_{i}-\theta_n)X_i +z_{\alpha/2} n^{1/2+d} \sqrt{q^{-2d} \ \mathcal{S}_{n,q,w} } \Big) \big/ \Big(\sum_{i=1}^n ( w_{i} -\theta_n ) \Big),
\end{eqnarray*}
and $z_{\alpha/2}$ is the $100(1-\alpha/2)$-th percentile of the standard normal distribution.
The length of the randomized confidence interval $I_{n,X,w}(\theta_n)$ is
\begin{equation}\label{length randomized CI}
length(I_{n,X,w}(\theta_n)) = 2 z_{\alpha/2} n^{1/2+d} \sqrt{q^{-2d} \mathcal{S}_{n,q,w} } \big/ \big| \sum_{i=1}^n ( w_{i} -\theta_n ) \big|.
\end{equation}
\begin{remark}\label{on the length}
Along the lines of the proof of Theorem \ref{CLT G^*^stu} in Section \ref{proofs} it is shown that
for $0 \leq d <1/2$, $q^{-2d} \mathcal{S}_{n,q,w}$ asymptotically coincides with $\textrm{Var}\big(n^{-1/2-d} \sum_{i=1}^n (w_{i}-\theta_n) X_i\big)$. In view of the latter asymptotic equivalence together with (\ref{length randomized CI}),
one can see that when $\theta_n=\E(w_{1})$, the length of the randomized confidence interval $I_{n,X,w}(\theta_n)$ fails to vanish as $n,q \to \infty$ such that $q=O(n^{1/2})$. In view of Corollary \ref{Corollary 1}, choosing $\theta_n$ to be equal to $\E(w_{1})$ is not possible in the framework of the scheme {\textsf{(\textbf{RS})}}, as in Subsection \ref{The Method*}. Therefore, {\textsf{(\textbf{RS})}} results in randomized confidence intervals whose limiting lengths is zero as $n,q \to \infty$ such that $q=O(n^{1/2})$.
\end{remark}
\noindent
Tables 1 and 2 below provide an empirical comparison of the performance of the randomized confidence interval $I_{n,X,w}(\theta_n)$, as in (\ref{randomized CI}), and that of
\begin{equation}\label{classic CI}
I_{n,X}=\bar{X}_n \pm z_{\alpha/2} n^{-1/2+d} \sqrt{q^{-2d}\big( \bar{\gamma}_0 + 2 \sum_{h=1}^{q} \bar{\gamma}_{h} (1-h/q)\big)},
\end{equation}
which is constructed based on the classical $T^{stu}_{n} (d)$, as in (\ref{classic Studentized}). The lag-length or the bandwidth $q$ was chosen based on relation (2.14) of Abadir \emph{et al}. \cite{HACMAC} in each case. More precisely, in Tables 1 and 2 we let $q$ be $ceiling(n^{1/3})$ for the examined short memory linear process.
\\
It is easy to see that the length of $I_{n,X}$ has the form:
\begin{equation}\label{length classic CI}
length(I_{n,X})= 2 z_{ \alpha/2} n^{-1/2+d} \sqrt{q^{-2d}\big( \bar{\gamma}_0 + 2 \sum_{h=1}^{q} \bar{\gamma}_{h} (1-h/q)\big)}.
\end{equation}
The results in Tables 1 and 2 are at the nominal level of \verb|95|\% with $\verb|z|_{\alpha/2}=\verb|1.96|$, and based on 2000 replications of the therein specified short memory \verb|AR(1)| data, i.e., when $X_t=\phi X_{t-1}+\zeta_t$, where $\zeta_t$ have standardized, heavily skewed, \verb|lognormal(0,1)| distribution. For the randomized confidence intervals in Tables 1 and 2, 2000 sets of therein specified random weights also generated simultaneously with the data.
We note in passing that the processes considered in Tables 1 and 2 are of the form (\ref{eq 1}).
\begin{table}[h!]\label{Table 1}
\vspace{- .2 cm}
\begin{center}
\begin{tabular}{||l|| l|| ccc}
\multicolumn{1}{c}{} & \multicolumn{1}{c}{} &$\verb|I|_{n,X,w}(\theta_n)$ & & $\verb|I|_{n,X}$ \\ \cline{1-5}
&\cellcolor[gray]{0.8}\verb|weights| &\cellcolor[gray]{0.8}\verb|Bernoulli(1/4)| & \cellcolor[gray]{0.8} &\cellcolor[gray]{0.8}\verb|NA| \\
& $\theta_n$ & \verb|1/4+0.14| & &\verb|NA| \\
\verb|n=200|
& \verb|length| & \verb|1.81| & &\verb|1.43| \\
&\cellcolor[gray]{0.8}\verb|coverage| & \cellcolor[gray]{0.8} \verb|0.9155| &\cellcolor[gray]{0.8} &\cellcolor[gray]{0.8} \verb|0.8615|\\
\hline\hline
& \cellcolor[gray]{0.8}\verb|weights| & \cellcolor[gray]{0.8}\verb|Bernoulli(1/4)| & \cellcolor[gray]{0.8}& \cellcolor[gray]{0.8}\verb|NA| \\
& $\theta_n$ & \verb|1/4+0.1| & &\verb|NA| \\
\verb|n=400|
& \verb|length| & \verb|1.68| & &\verb|1.11| \\
&\cellcolor[gray]{0.8}\verb|coverage| &\cellcolor[gray]{0.8}\verb|0.9365| & \cellcolor[gray]{0.8} & \cellcolor[gray]{0.8}\verb|0.8865|\\
\cline{1-5}
\end{tabular}
\end{center}
\vspace{-.2 cm}\caption{ AR(1) with $\phi=0.8$}
\end{table}
\begin{table}[h!]\label{Table 3}
\begin{center}
\begin{tabular}{||l|| l|| ccc}
\multicolumn{1}{c}{} & \multicolumn{1}{c}{} &$\verb|I|_{n,X,w}(\theta_n)$ & & $\verb|I|_{n,X}$ \\ \cline{1-5}
&\cellcolor[gray]{0.8}\verb|weights| &\cellcolor[gray]{0.8}\verb|Multinomial(n;1/n,...,1/n)| & \cellcolor[gray]{0.8} &\cellcolor[gray]{0.8}\verb|NA| \\
& $\theta_n$ & \verb|1-0.27| & &\verb|NA| \\
\verb|n=200|
& \verb|length| & \verb|1.91| & &\verb|1.43| \\
&\cellcolor[gray]{0.8}\verb|coverage| & \cellcolor[gray]{0.8} \verb|0.912| &\cellcolor[gray]{0.8} &\cellcolor[gray]{0.8} \verb|0.866|\\
\hline\hline
& \cellcolor[gray]{0.8}\verb|weights| & \cellcolor[gray]{0.8}\verb|Multinomial(n;1/n,...,1/n)| & \cellcolor[gray]{0.8}& \cellcolor[gray]{0.8}\verb|NA| \\
& $\theta_n$ & \verb|1+0.23| & &\verb|NA| \\
\verb|n=400|
& \verb|length| & \verb|1.59| & &\verb|1.11| \\
&\cellcolor[gray]{0.8}\verb|coverage| &\cellcolor[gray]{0.8}\verb|0.942| & \cellcolor[gray]{0.8} & \cellcolor[gray]{0.8}\verb|0.8995|\\
\cline{1-5}
\end{tabular}
\end{center}
\vspace{-.2 cm}\caption{AR(1) with $\phi=0.8$}
\end{table}
\section{Comparison to bootstrap confidence intervals for long memory linear processes}\label{Comparison to bootstrap confidence intervals for long memory linear processes}
In the context of long memory data, the residual resampling method, known as the sieve bootstrap (cf., e. g., Poskitt \cite{Pos2008}), is built around approximating a long memory process by approximating its infinite auto regressive representation by a truncated one. However, this approximation produces error terms which tend to be significant (cf. Table 3). The approximation significantly underestimates the variance of the statistic of interest, which is the sample mean in the context of this paper, based on long memory linear process structured data. The underestimation of the variance translates in poor coverage probabilities of the confidence intervals constructed using the (raw) sieve, as can be seen in Table 3. Filtered sieve introduced by Poskitt \emph{et al.} \cite{Pos} is a modification of the sieve that tends to improve upon the coverage probability of the sieve. It essentially consists of applying the raw sieve to a filtered series (basically to a truncated version of the infinite sum $(1-B)^{\hat d} X_t$, where $\hat d$ is an estimator of the long memory parameter $d$) and then unfilter the resulting bootstrapped error series $\hat\epsilon_t^*$ (again by considering the truncated sum $(1-B)^{-\hat d}\hat\epsilon_t^*$ ).
\\
The block bootstrap is another method of drawing a bootstrap sample from a given set of dependent and temporal observations with the goal of preventing the i.i.d. nature of the naive bootstrap from dismissing the dependence and chronological order of the data. The method essentially consists of first partitioning the data into a number of blocks and then ressampling from these blocks. This method was first introduced by K\"{u}nsch \cite{Kunchblock} for short memory linear processes. The validity of this resampling scheme for both short and long memory linear processes has been investigated in a number of papers, e. g., G\"{o}tze and K\"{u}nsch \cite{Gotze and Kunch} and Kim and Nordman \cite{Kim and Nordman}.
\\
Although, with a relatively large number of replications, the existing bootstrap methods tend to perform well for short memory data, it is not the case when they are applied to long memory data. In our numerical study below, we consider three methods of constructing bootstrap confidence intervals for the mean of a population from which long memory structured linear process data sets are simulated. In Table 3 we compare the performance of the resulting confidence intervals from the three bootstrap methods sieve, filtered or augmented sieve and the block bootstrap for long memory linear processes to those of the randomized confidence interval $I_{n,X,w}(.)$, as in (\ref{randomized CI}), and the classical $I_{n,X}$, as in (\ref{classic CI}), in terms of their respective empirical probabilities of coverage.
\\
In Table 3, $I_{AugSiv}$, $I_{Bloc}$ and $I_{Siv}$ stand, respectively, for the augmented sieve, block-bootstrap and the sieve confidence intervals at nominal level of 95\%. Each of these bootstrap confidence intervals is constructed based on $B=1000$ bootstrap replications to estimate the cut-off points for each of the 2000 sets of simulated data. In Table 3, $\mathcal{M}ult$ is a short hand notation for the symmetric multinomial distribution, i.e., $\mathcal{M}ultinomial(n;1/n,\cdots,1/n)$. For all examined confidence intervals, the simulated observations in Table 3, are generated from the fractionally integrated model $\verb|X|_t =\verb|(1-B)|^{-\verb|d|} \zeta_t$, where, $\verb|B|$ is the back-shift operator, i.e., $\verb|B| \zeta_t= \zeta_{t-1}$, \verb|d| is the memory parameter
and $\zeta_t$ have standardized \verb|lognormal(0,1)| distribution. Similarly to Tables 1 and 2, to construct the randomized confidence interval $I_{n,X,w} (\theta_n)$, for each simulated set of data, simultaneously, a set of random weights from symmetric multinomial distribution was generated. In Table 3 for the therein considered long memory linear process with $d=0.4$, we let $q$ be $ceiling(n^{1/2 -d})$.
\begin{table}[h!]\label{Table 3}
\begin{center}
\begin{tabular}{||l|| l|| cccccc}
\multicolumn{1}{c}{} & \multicolumn{1}{c}{} &$\verb|I|_{n,X,w}(\theta_n)$ & & $\verb|I|_{n,X}$ & $I_{Bloc}$ & $I_{AugSiv}$ & $I_{Siv}$\\ \cline{1-8}
&\cellcolor[gray]{0.8}\verb|weights| &\cellcolor[gray]{0.8} $\mathcal{M}ult$
& \cellcolor[gray]{0.8} &\cellcolor[gray]{0.8}\verb|NA| & \cellcolor[gray]{0.8} \verb|NA| & \cellcolor[gray]{0.8} \verb|NA|
& \cellcolor[gray]{0.8} \verb|NA|\\
& $\theta_n$ & \verb|1+0.97| & &\verb|NA| &\verb|NA| & \verb|NA| & \verb|NA| \\
\verb|n=100|
& \verb|length| & \verb|3.28| & &\verb|2.50| & \verb|2.26| & \verb|1.90| & \verb|0.8695|\\
&\cellcolor[gray]{0.8}\verb|coverage| & \cellcolor[gray]{0.8} \verb|0.935| &\cellcolor[gray]{0.8} &\cellcolor[gray]{0.8} \verb|0.8525| & \cellcolor[gray]{0.8} \verb|0.803| & \cellcolor[gray]{0.8} \verb|0.710| & \cellcolor[gray]{0.8} \verb|0.3795| \\
\hline\hline
& \cellcolor[gray]{0.8}\verb|weights| & \cellcolor[gray]{0.8} $\mathcal{M}ult$ & \cellcolor[gray]{0.8}& \cellcolor[gray]{0.8}\verb|NA| & \cellcolor[gray]{0.8} \verb|NA| & \cellcolor[gray]{0.8} \verb|NA| & \cellcolor[gray]{0.8} \verb|NA|\\
& $\theta_n$ & \verb|1+0.97| & &\verb|NA| & \verb|NA| & \verb|NA| & \verb|NA|\\
\verb|n=200|
& \verb|length| & \verb|3.20| & &\verb|2.45| & \verb|2.25| & \verb|1.83| & \verb|0.8| \\
&\cellcolor[gray]{0.8}\verb|coverage| &\cellcolor[gray]{0.8}\verb|0.9445| & \cellcolor[gray]{0.8} & \cellcolor[gray]{0.8}\verb| 0.864| & \cellcolor[gray]{0.8} \verb|0.823| & \cellcolor[gray]{0.8} \verb|0.739| & \cellcolor[gray]{0.8} \verb|0.4035| \\
\cline{1-8}
\end{tabular}
\end{center}
\vspace{-.2 cm}\caption{ Fractionally integrated long memory with d=0.4}
\end{table}
\begin{remark}
As it is evident from the numerical study presented in Table 3, the randomized confidence interval $I_{n,X,w}(\theta)$, introduced in this paper, as in (\ref{randomized CI}), produces significantly more accurate confidence intervals as compared to the classical $I_{n,X}$, as in (\ref{classic CI}), and the three examined bootstrap confidence intervals. It is noteworthy that the higher accuracy of $I_{n,X,w}(\theta)$ can also be achieved using other random weights than the symmetric multinomial used in Table 3, provided that they are chosen according to the skewness reduction scheme {\textsf{(\textbf{RS})}}, as in Subsection \ref{The Method*}.
\end{remark}
\section{Complete Studentization}\label{Complete Studentization}
In the Studentizing sequence $q^{-2d}\mathcal{S}_{n,q,w}$ used in the definition of the Studentized randomized pivot $G_{n,X,w}(\theta_n,d)$, as defined in (\ref{Studentized}), we used the actual values of the moments of the wights, i.e., $\E(w_{1})$, $\E(w_{1})^2$ and $\E( w_{1} w_{2})$. The motive of the use of such a partial Studentization is justified considering that in the framework created by the scheme {\textsf{(\textbf{RS})}}, the distribution of the weights are usually known. Despite the validity of this reasoning, it is also desirable to investigate the asymptotic behavior of the completely Studentized version of $G_{n,X,w}(\theta_n,d)$. In the following Theorem \ref{Complete Studentization thm} we establish a CLT result for the completely Studentized randomized pivotal quantity
\begin{equation}\label{Completely Studentized}
\hat{G}_{n,X,w}(\theta_n,d)=n^{-1/2-d} \Big(\sum_{i=1}^n(w_i-\theta_n)(X_i-\mu) \Big) \big/ \sqrt{q^{-2d} \ \hat{\mathcal{S}}_{n,q,w} },
\end{equation}
where $q=O(n^{1/2})$,
\begin{equation}\nonumber
\hat{\mathcal{S}}_{n,q,w}=\frac{1}{n}\sum_{j=1}^{n} (w_j-\theta_n)^2\bar\gamma_0+ 2 q^{-1} \sum_{h=1}^{q} \bar{\gamma}_h \sum_{j=1}^{q-h} (w_j-\theta_n)(w_{j+h}-\theta_n),
\end{equation}
where $\bar{\gamma}_s$, $ 0\leq s \leq n-1, $ are the sample autocovariances, as defined right after (\ref{Studentized}).
\begin{theorem}\label{Complete Studentization thm}
Consider $X_1, \ldots, X_n$, the first $n$ terms of the linear process (\ref{eq 1}), and let the weights $w_1,\cdots,w_n$ and the window constants $\theta_n$ be as in Theorem \ref{CLT}.
\\
\\
(A) If the linear process (\ref{eq 1}) is of short memory, i.e., $\sum_{k=0}^{\infty} |a_{k}|<\infty$, and $\E \zeta_{1}^{4}<\infty$,
then, as $n, q \to \infty$ such that $q=O(n^{1/2})$, we have, for all $x \in \mathbb{R}$,
\begin{equation}\nonumber
P\big(\hat{G}_{n,X,w}(\theta_n,0)\leq x ~ \big|w_1,\ldots,w_n\big) \longrightarrow \Phi(x) \ in \ probability-P_w,
\end{equation}
and, consequently,
\begin{equation}\nonumber
P(\hat{G}_{n,X,w}(\theta_n,0)\leq x) \longrightarrow \Phi(x),\ t \in \mathbb{R}.
\end{equation}
(B) Let the linear process (\ref{eq 1}) be of long memory such that $\E \zeta_{1}^{4}<\infty$ and, as $k \rightarrow \infty$, $a_k \sim c k^{d-1}$, for some $c>0$, where $0< d <1/2$. Then, as $n,q\to \infty$ such that $q=O(n^{1/2})$, we have for all $x \in \mathbb{R}$,
\begin{eqnarray*}
&&P\big(\hat{G}_{n,X,w}(\theta_n,d)\leq x~ \big| w_1,\ldots,w_n\big) \longrightarrow \Phi(x) \ in \ probability-P_w,\\
&&P\big(\hat{G}_{n,X,w}(\theta_n,\hat{d})\leq x ~ \big| w_1,\ldots,w_n\big) \longrightarrow \Phi(x) \ in \ probability-P_w,
\end{eqnarray*}
and, consequently,
\begin{eqnarray*}
&&P(\hat{G}_{n,X,w}(\theta_n,d)\leq x) \longrightarrow \Phi(x),\ x \in \mathds{R}, \\
&&P(\hat{G}_{n,X,w}(\theta_n,\hat{d})\leq x) \longrightarrow \Phi(x), \ x \in \mathds{R},
\end{eqnarray*}
where $\hat{d}$ is an estimator of the memory parameter $d$ such that $\hat{d}-d=o_{P}(1/\log n)$.
\end{theorem}
\noindent
The CLTs in the preceding Theorem \ref{Complete Studentization thm} are counterparts of those in Theorem \ref{CLT G^*^stu}.
\section{Proofs}\label{proofs}
\subsection*{Proof of Corollary \ref{Corollary 1}}
The third degree polynomial, in $\theta$, $\mathcal{H}_{n,X,w}(\theta)$ can be written as:
\begin{eqnarray}\label{short1}
\mathcal{H}_{n,X,w}(\theta)&=&\frac{1}{n}\mathbb{E} \big(\sum_{i=1}^n(w_i-\theta)X_i\big)^3
\nonumber\\
&=&-\frac{1}{n}\mathbb{E} \big(\sum_{i=1}^n X_i \big)^3 \theta^3 \nonumber\\
&+&\frac{3}{n}\mathbb{E} \Big( \big(\sum_{i=1}^n w_i X_i \big)
\big(\sum_{i=1}^n X_i \big)^2 \Big)\theta^2
-\frac{3}{n}\mathbb{E} \Big(\big(\sum_{i=1}^n w_i X_i \big)^2
\big(\sum_{i=1}^n X_i \big)\Big)\theta \nonumber\\
&+&\frac{1}{n}\mathbb{E} \big(\sum_{i=1}^n w_i X_i \big)^3.
\end{eqnarray}
From the preceding representation, it can be seen that $\mathcal{H}_{n,X,w}(\theta)$
will have at least one real solution if for large $n$ we have
\begin{equation}\label{real}
\frac{1}{n}\mathbb{E} \big(\sum_{i=1}^n X_i \big)^3 \neq 0.
\end{equation}
In order to show that, as $n\to\infty$, (\ref{real}) holds true, we first consider the case when the process $X_t$ is of short memory, i.e.
$$
X_t=\sum_{j=0}^\infty a_j\epsilon_{t-j},
$$
$\epsilon_t$ being i.i.d. white noise and
$$
\sum_{j=0}^\infty \vert a_j\vert<\infty\textrm{ and }\sum_{j=0}^
\infty a_j \neq 0.
$$
In this case, on assuming that the innovations are nonsymmetric such that $\mathbb{E}(\epsilon_1^3)\neq 0$, it is easy to see that, as $n\to\infty$,
$$
\frac{1}{n}\mathbb{E}\left[\left(\sum_{i=1}^nX_i\right)^3\right]\to\mathbb{E}(\epsilon_1^3)\left(\sum_{j=0}^
\infty a_j\right)^3 \neq 0.
$$
Now we consider the case when $X_t$ is of long memory, i.e.
$$
a_i\sim i^{(d-1)},\qquad\textrm{ as } i\to\infty.
$$
Without loss of generality, we assume that $a_i>0$ for all $i$, as there could only be finitely many $i$ for which $a_i \leq 0$, and such $i$'s will result in only a finite sum.
Now, similarly to the formula (\ref{Tw}), on assuming that $\mathbb{E}(\epsilon_1^3)>0$, as $n\to\infty$, we have
\begin{eqnarray*}\lefteqn{
\frac{1}{n}\mathbb{E}\left[\left(\sum_{i=1}^nX_i\right)^3\right]=\mathbb{E}(X_1^3)+3\sum_{h=1}^n\left(1
-\frac{h}{n}\right)\mathbb{E}(X_1^2X_{1+h}+X_1X^2_{1+h})}\\
&&+\sum_{h=1}^{n-1}\sum_{h'=1}^{n-h-1}
\left(1-\frac{h+h'}{n}\right)\mathbb{E}\left(X_1X_{1+h}X_{1+h+h'}\right)\\
&\ge&\sum_{h=1}^n\left(1
-\frac{h}{n}\right)\mathbb{E}(X_1^2X_{1+h})=
\sum_{h=1}^n\left(1-\frac{h}{n}\right)\mathbb{E}(\epsilon_1^3)\sum_{i=0}^\infty
a_i^2a_{i+h}\\
&\ge& a_{0}^2 \mathbb{E}(\epsilon_1^3)\sum_{h=1}^n\left(1-\frac{h}{n}\right)a_h \to\infty.
\end{eqnarray*}
In summary, we have proved that for both short and long memory, for $n$ large, (\ref{real}) holds true. This completes the proof of part (a) of this corollary.
\\
Now if we take the weights $w_i $ to be i.i.d. and nonsymmetric, with $\mathbb{E}\big(w_i -\mathbb{E}(w_i )\big)^3 \neq0$, we can see from (\ref{Tw}) that
$$
\mathcal{H}_{n,X,w}(\mathbb{E}(w_1 ))=\mathbb{E}\big(w_i -\mathbb{E}(w_i ) \big)^3 \mathbb{E}(X_1^3) \neq 0
$$
and hence $\mathbb{E}(w_1 )$ cannot be a root of the polynomial $\mathcal{H}_{n,X,w}(\theta)$.
\\
So, we conclude that there is a real root $\theta_n$ for $\mathcal{H}_{n,X,w}(\theta)$ and that this root is different from $\mathbb{E}(w_1 )$. Choosing this root as a value for $\theta$ will guarantee a second order accuracy of the Theorem \ref{Edgeworth Expansion}. Similar argument can be made when choosing the weights have a symmetric multinomial distribution. This is true since in that case, using the joint moment generating function of $(w_1,\ldots,w_n$) and the fact that $\mathbb{E}(w_i)=1$, as $n\to\infty$, we have
$$
\mathcal{H}_{n,X,w}(\mathbb{E}(w_1))\to\mathbb{E}(X_1^3)\neq0,
$$
and therefore for $n$ large, $\mathcal{H}_{n,X,w}(\mathbb{E}(w_1 )) \neq 0$, which again guarantees that the real root we are seeking to achieve a negligible skewness, in the context of scheme {\textsf{(\textbf{RS})}}, cannot be equal to $\mathbb{E}(w_1)$. This completes the proof of part (b). Now the proof of the corollary is complete. $\square$
\subsection*{Proof of Theorem \ref{Edgeworth Expansion}}
We first define the following $\sigma$-fields to be used in the proof of this theorem.
\begin{eqnarray*}
\mathcal{D}_j&:=&\sigma(w_{j-1},\zeta_j),\quad j=0,\pm1,\pm,2,\ldots,\\
\mathcal{D}_{j,n}&:=&\sigma(\zeta_n,w_{j-1},\zeta_j),\quad j=0,\pm1,\pm,2,\ldots,\\
\mathcal{D}_{p}^{q}&:=&\sigma\{\big( w_{j-1},\zeta_j \big),\quad p\leq j\leq q\}.
\end{eqnarray*}
In order for the definition of $\mathcal{D}_j$ to hold true, we extended the weights $w_1,w_2,\ldots,$ to
$$\ldots,w_{-1},w_0,w_1,\ldots.$$
Theorem \ref{Edgeworth Expansion} results from Theorem (2.8), and its Corollary (2.9), of G\"{o}tze and Hipp \cite{Gotze and Hipp}. More precisely, we show that under the conditions of Theorem \ref{Edgeworth Expansion}, conditions (2.3) - (2.6) of G\"{o}tze and Hipp \cite{Gotze and Hipp}
hold true. In our case, (2.4) of G\"{o}tze and Hipp \cite{Gotze and Hipp} holds true trivially as $\mathcal{D}_{-\infty}^{n}$ is independent from $\mathcal{D}_{n+m}^{\infty}$, for all $m\geq 1$. To see why (2.3) holds, observe that
\begin{eqnarray}\label{EEw}
\E \vert(w_n-\theta_n)\Big(X_n-\sum_{k=0}^m a_k \zeta_{n-k}\Big)\vert
&\le& \E\vert w_1-\theta_n \vert \ \E \vert X_n-\sum_{k=0}^m a_k \zeta_{n-k}\vert \nonumber\\
&\le& \E\vert w_1-\theta_n \vert\mathbb{E}\vert\xi_1\vert (1/\ell) e^{-\ell m}\le (c_n/\ell) e^{-\ell m},
\end{eqnarray}
where $c_n=\E|w_1-\theta_n| \E|\zeta_1|$. If $c_n \le 1$, then (2.3) of G\"{o}tze and Hipp \cite{Gotze and Hipp} clearly holds. If $c_n>1$, then $c_n$ will be bounded above by some constant $c>0$, therefore the right hand side of (\ref{EEw}) is bounded above by $(c/\ell) e^{-\ell m/c}$. This means that (2.3) of G\"{o}tze and Hipp \cite{Gotze and Hipp} still holds but with $\ell/c $ instead of $\ell$. In conclusion, condition (2.3) of G\"{o}tze and Hipp \cite{Gotze and Hipp} holds true in our context of Theorem \ref{Edgeworth Expansion}.
\\
We now show that (2.5) of G\"{o}tze and Hipp \cite{Gotze and Hipp} also holds true in the context of Theorem \ref{Edgeworth Expansion}, noting first that in what follows $\E(.~/\mathcal{F})$ stands for conditional expected value given the $\sigma$-field $\mathcal{F}$. Condition (2.5) of G\"{o}tze and Hipp in our context corresponds to the following statement: For any $b>0$, there exists $\ell>0$ such that for $\vert u\vert>b$ and all $m,n$ such that $1/b < m <n$, we have
\begin{eqnarray}\label{new2.5}
&&\E\Big\vert\E\Big(\exp\Big(iu\Big[(w_{n-m}-\theta_n)X_{n-m}+\cdots+(w_{n-1}-\theta_n)X_{n-1}\nonumber\\
&&~ ~ ~ ~ +(w_n-\theta_n)X_n+\cdots+(w_{n+m}-\theta_n) X_{n+m}\Big]\Big)\Big/\mathcal{D}_j,j\neq n\Big)\Big\vert\le e^{-\ell}.
\end{eqnarray}
To show that (\ref{new2.5}) holds true under the assumptions of our Theorem \ref{Edgeworth Expansion}, we let $\Psi_\zeta$ and $\Psi_w$ respectively denote the characteristic functions of $\zeta_n$ and $w_n$.
Observe now that the left hand side of (\ref{new2.5}) is bounded above by
\begin{eqnarray}
\lefteqn{
\mathbb{E}\left\vert\mathbb{E}\left(\exp\left(iu\left[\zeta_n\sum_{k=0}^m a_k (w_{n+k}-\theta_n)\right]+iu w_{n-1}X_{n-1}\right)\Big/\mathcal{D}_j,j\neq n\right)\right\vert}\nonumber\\
&&=\mathbb{E}\left\vert\mathbb{E}\left(\mathbb{E}\left(\exp\left(iu\left[\zeta_n\sum_{k=0}^m a_k (w_{n+k}-\theta_n)\right]+i u w_{n-1}X_{n-1}\right)\Big/\mathcal{D}_{j,n},j\neq n\right)\Big/\mathcal{D}_j,j\neq n\right)\right\vert \nonumber\\
&&=\mathbb{E}\left\vert\mathbb{E}\left(\exp\left(iu \left[\zeta_n\sum_{k=0}^ma_k(w_{n+k}-\theta_n)\right]\right)\mathbb{E}\left(\exp\left(iu w_{n-1}X_{n-1}\right)\Big/\mathcal{D}_{j,n},j\neq n\right)\Big/\mathcal{D}_j,j\neq n\right)\right\vert \nonumber\\
&&=
\mathbb{E}\left\vert\Psi_\zeta\left(u\sum_{k=0}^ma_k(w_{n+k}-\theta_n)\right)\Psi_w\left(uX_{n-1}\right)\right\vert
\nonumber\\
&&\longrightarrow \mathbb{E}\left\vert\Psi_w\left(uX_1\right)\right\vert\mathbb{E}\left\vert\Psi_\zeta(uZ_n)\right\vert\quad\textrm{as }m\to\infty, \label{7.2+1}
\end{eqnarray}
where
$$
Z_n=\sum_{k=0}^\infty a_k(w_{k+1}-\theta_n).
$$
The preceding statement is valid in view of the dominated convergence theorem combined with
the use of the well known fact that if $X$ and $Y$ are independent, $h(.,.)$ is a bounded function and $g(y)=\mathbb{E}(h(X,y))$ then $\mathbb{E}(h(X,Y)\vert Y)=g(Y)$.
\\
Now, if the first part of assumption $(i)$ of Theorem \ref{Edgeworth Expansion} holds then, since for all $n\geq 1$ $Z\neq 0~ a.s.$, for $\vert u\vert>b$ for a given $b$, we let $\delta>0$ and $\epsilon>0$ be such that $P(\vert u Z_n \vert>\epsilon)>1/2$ and $\vert \Psi_{\zeta} (uZ_n)\vert1_{\vert u Z_n\vert>\epsilon}\le1-2\delta$. Then we have
\begin{eqnarray*}
\mathbb{E}\left\vert\Psi_{\zeta}(uZ_n)\right\vert&=&\mathbb{E}\big( \left\vert\Psi_{\zeta}(uZ_n)\right\vert 1_{\vert uZ_n\vert>\epsilon}\big)+\mathbb{E}\big(\left\vert\Psi_{\zeta}(uZ_n)\right\vert1_{\vert u Z_n\vert\le\epsilon}\big)\\
&\le&(1-2\delta)P(\vert u Z_n\vert>\epsilon)+1-P(\vert u Z_n\vert>\epsilon)=1-2\delta P(\vert uZ_n\vert>\epsilon)<1-\delta.
\end{eqnarray*}
In summary, for any $b>0$ there exists $\delta>0$ such that for all $\vert u\vert> b$, we have $\mathbb{E}(\vert\Psi_{\zeta}(uZ_n)\vert)<1-\delta$. Therefore for $m$ sufficiently large, for all $\vert u\vert>b$, we have
$$
\mathbb{E}\left\vert\Psi_{\zeta}\left(u\sum_{k=0}^m a_k w_{k+1}\right)\right\vert\le1-\delta=e^{-\ell},
$$
for some $\ell>0$, which completes the proof of (\ref{new2.5}). We note that in our proof for (\ref{new2.5}), without loss of generality, we can take $b=\ell$ (possibly by having to work with $\zeta_j/\ell$ instead of $\zeta_j$) to be in the same context as in (2.5) of G\"{o}tze and Hipp \cite{Gotze and Hipp}. This means that (2.5) of G\"{o}tze and Hipp \cite{Gotze and Hipp} holds true under the first part of of assumption $(i)$ of Theorem \ref{Edgeworth Expansion}.
\\
Alternatively, when the second part of the assumption $(i)$ of Theorem \ref{Edgeworth Expansion} holds, we show (2.5) of G\"{o}tze and Hipp \cite{Gotze and Hipp} continues to hold true. Recalling that in this case the weights satisfy the Cramer condition rather than the innovations, to establish (2.5) of G\"{o}tze and Hipp \cite{Gotze and Hipp} in this case, we first note that the left hand side of (\ref{7.2+1}), i.e., $\mathbb{E}\left\vert\Psi_\zeta\left(u\sum_{k=0}^m a_k(w_{n+k}-\theta_n)\right)\Psi_w\left(uX_{n-1}\right)\right\vert
$, is bounded above, uniformly in $m\geq 1$, by $E|\Psi_{w}(u X_1)|$. Since in this case we have $X_1\neq 0~ a.s.$, for given $b$ and for $\vert u\vert>b$, we let $\delta>0$ and $\epsilon>0$ be such that $P(\vert u X_1\vert>\epsilon)>1/2$ and $\vert \Psi_{w} (u X_1)\vert1_{\vert u X_1\vert>\epsilon}\le1-2\delta$. Then, we have
\begin{eqnarray*}
\mathbb{E}\left\vert\Psi_{w}(u X_1)\right\vert&=&\mathbb{E}\big( \left\vert\Psi_{w}(u X_1)\right\vert 1_{\vert u X_1\vert>\epsilon}\big)+\mathbb{E}\big(\left\vert\Psi_{w}(u X_1)\right\vert1_{\vert u X_1\vert\le\epsilon}\big)\\
&\le&(1-2\delta)P(\vert u X_1\vert>\epsilon)+1-P(\vert u X_1\vert>\epsilon)=1-2\delta P(\vert u X_1\vert>\epsilon)<1-\delta.
\end{eqnarray*}
The preceding relation implies that, for any $b>0$ there exists $\delta>0$ such that for all $\vert u\vert> b$, we have $\mathbb{E}(\vert\Psi_{w}(u X_1)\vert)<1-\delta$, which implies that (2.5) of G\"{o}tze and Hipp \cite{Gotze and Hipp} holds true under the second part of of assumption $(i)$ of Theorem \ref{Edgeworth Expansion}.
\\
Finally, in our context, condition (2.6) of G\"{o}tze and Hipp \cite{Gotze and Hipp}
is clearly satisfied with our choice of $\mathcal{D}_j=\sigma(w_{j-1},\zeta_j)$ in view of the Dynkin's $\pi-\lambda$ theorem (cf., e.g., Billingsley \cite{Bill}).
\\
Now the proof of Theorem \ref{Edgeworth Expansion} is complete. $\square$
\\
We note that the preceding proof for Theorem \ref{Edgeworth Expansion} implies the validity of (\ref{EE}) when $\E|\zeta_1|^5<\infty$ and $\E|w_1|^5<\infty$, and also that of (\ref{newEE}) on assuming $\E|\zeta_1|^4<\infty$ and $\E|w_1|^4<\infty$, provided that in both cases assumptions $(i)$ and $(ii)$ of Theorem \ref{Edgeworth Expansion} hold.
\subsection*{Proof of Theorem \ref{CLT}}
Our arguments below to prove this theorem are valid for both i.i.d. and symmetric multinomial weights as specified in Theorem \ref{CLT}. We also note that we only give the proof for the conditional statement (\ref{CLT Conditional}) as it implies the unconditional statement (\ref{CLT Unconditional}), in view of the dominated convergence theorem.
\\
For the use in the proof of this theorem, as well as in the proof of Theorem \ref{CLT G^*^stu} we define
\begin{eqnarray}
K &:=&\underset{n\to\infty}{\lim} \E(w_1-\theta_n)^2, \label{K^prime-1} \\
K^{\prime} &:=&\underset{n\to\infty}{\lim}\E\Big((w_1-\theta_n)(w_2-\theta_n)\Big). \label{K^prime}
\end{eqnarray}
We note that, by virtue of Corollary \ref{Corollary 1}
$K$ and $K^{\prime}$ are positive constants and $K^{\prime}<K$.
\\
For the ease of the notation, without loss of generality we assume that $\mu=0$ and also define
\begin{eqnarray*}
\mathfrak{R}_{n,w}&:=&\gamma_0\sum_{i=1}^n(w_i-\theta_n)^2+2\sum_{h=1}^n\gamma_h\sum_{j=1}^{n-h}(w_j-\theta_n)(w_{j+h}-\theta_n)\\
&=&\V \Big(\sum_{i=1}^n\big(w_i-\theta_n)X_i \big| w_{1}, \cdots, w_{n} \Big),
\end{eqnarray*}
In view of Theorem 2.2 of Abadir {\it et al.} (2014), the proof of Theorem \ref{CLT} will result if we show that as $n\to\infty$,
\begin{equation}\label{ratio1}
\mathfrak{R}_{n,w}\big/ (n \mathfrak{D}_{n,X,w})- 1=o_{P_w}(1),
\end{equation}
\begin{equation}\label{ratio2}
\underset{1\le i\le n}{\max} \vert w_i-\theta_n \vert \big/\sqrt{n \mathfrak{D}_{n,X,w}}=o_{P_w}(1),
\end{equation}
and
\begin{equation}\label{ratio3}
\sum_{i=1}^n (w_i-\theta_n)^2 \big/ (n \mathfrak{D}_{n,X,w})=O_{P_w}(1).
\end{equation}
We remark that our condition (\ref{ratio3}) relates to condition $(ii)$ of Theorem 2.2 of Abadir \textsl{et al}. (2014). The latter condition which is intended for constant weights for linear processes reads as follows: $\exists$ $C>0$ such that
\begin{equation}\nonumber\label{abadir original condition}
\frac{1}{\sigma^2}\ \underset{n\geq 1}{\sup}\sum_{j=1}^n z^2_{nj}\le C,
\end{equation}
where $z_{nj}$ are non-random weights, $\sigma^2=\lim_{n \to \infty} \sum_{i=1}^n z_{nj} X_i$ and $X_i$, $1\leq i \leq n$, are the first $n$ terms of the linear process (\ref{eq 1}). The preceding condition can, conveniently and equivalently, be replaced by
\begin{equation}\label{abadir}
\frac{1}{\sigma^2}\sum_{j=1}^n z^2_{nj}=O(1),\qquad\textrm{as }n\to\infty.
\end{equation}
Hence, in the stochastic context of our Theorem \ref{CLT}, the deterministic statement (\ref{abadir original condition}) is replaced by condition (\ref{ratio3}).
\\
\\
We now establish (\ref{ratio1}) by writing
\begin{eqnarray}\label{ratio12}
&&\mathfrak{R}_{n,w}\big/ (n \mathfrak{D}_{n,X,w})-1\nonumber\\
&&=\frac{\gamma_0\frac{n^{-2d}}{n}\sum_{i=1}^n(w_i-\theta_n)^2+
2\frac{n^{-2d}}{n}\sum_{h=1}^n\gamma_h\sum_{j=1}^{n-h}(w_j-\theta_n)(w_{j+h}-\theta_n)}
{\gamma_0n^{-2d}\E(w_1-\theta_n)^2+2n^{-2d}\E[(w_1-\theta_n)(w_2-\theta_n)]
\sum_{h=1}^n\left(1-\frac{h}{n}\right)\gamma_h}-1\nonumber\\
&&=\Bigg[\gamma_0 n^{-2d}\left(\frac{\sum_{i=1}^n(w_i-\theta_n)^2}{n}-\E(w_1-\theta_n)^2\right)\nonumber\\
&&+2n^{-2d}\sum_{h=1}^n\gamma_h\left(\frac{1}{n}\sum_{j=1}^{n-h}(w_j-\theta_{n})(w_{j+h}-\theta_{n})-
\E\big((w_1-\theta_{n})(w_2-\theta_{n})\big)\right)\Bigg]\times\nonumber\\
&&\quad \left[\gamma_0 n^{-2d}\E(w_1-\theta_{n})^2+2 n^{-2d}\E\big( (w_1-\theta_n)(w_2-\theta_{n})\big)
\sum_{h=1}^n(1-\frac{h}{n})\gamma_h\right]^{-1}.\nonumber\\
\end{eqnarray}
Considering that, as $n\to\infty$, for i.i.d. and symmetric multinomial weights we have
\begin{eqnarray}\label{ratio13}
\lefteqn{
\gamma_0 n^{-2d}\E(w_1-\theta_n)^2+2n^{-2d}\E\Big((w_1-\theta_{n})(w_2-\theta_{n})\Big)
\sum_{h=1}^n (1-\frac{h}{n})\gamma_h}\nonumber\\
&&\to\begin{cases}\gamma_0 (K -K^{\prime})+K^{\prime} s_X^2>0,&\textrm{ when }d=0,\\\\
K^{\prime}s_X^2>0,&\textrm{ when }0<d<1/2,\end{cases}
\end{eqnarray}
where
$$
s^{2}_X:=\lim_{n\to +\infty} \V \big( n^{1/2 -d} \bar{X}_n \big)=\lim_{n\to +\infty} n^{-2d} \big\{ \gamma_0+2\sum_{h=1}^{n-1} \gamma_h (1-h/n)\big\}.
$$
From (\ref{ratio13}), the relation (\ref{ratio1}) will follow if we show that, as $n\to\infty$,
\begin{equation}\label{ratio14}
\frac{1}{n}\sum_{i=1}^n(w_i-\theta_n)^2-\E(w_1-\theta_n)^2=o_{P_w}(1)
\end{equation}
and
\begin{equation}\label{ratio15}
n^{-2d}\sum_{h=1}^n\gamma_h\frac{1}{n}\sum_{j=1}^{n-h}\Big((w_j-\theta_n)(w_{j+h}-\theta_n)-
\E \big( (w_1-\theta_n)(w_2-\theta_n)\big)\Big)\\
=o_{P_w}(1).
\end{equation}
When the weights are i.i.d., (\ref{ratio14}) is a consequence of the law of large numbers for row-wise i.i.d. triangular arrays of random variables, in view of the assumption that $ \E|w_{1}|^{3}<\infty$, as in scheme {\textsf{(\textbf{RS})}} and also in Theorem \ref{CLT}.
\\
We now prove that (\ref{ratio14}) continues to hold for the case when
\\
$(w_1,\ldots,w_n)\overset{d}{=} \mathcal{M}ultinomial(n;1/n,\cdots,1/n)$, by writing
\begin{eqnarray}
&&P\Big(\big\vert\frac{1}{n}\sum_{i=1}^n \big((w_i-\theta_n)^2-\E(w_1-\theta_n)^2\big)\big\vert>\epsilon\Big)\nonumber\\
&&\le\epsilon^{-2} \frac{n}{n^2} \E\left((w_1-\theta_n)^2-\E(w_1-\theta_n)^2\right)^2\nonumber\\
&&+\epsilon^{-2}\frac{n(n-1)}{n^2}\E\left[\left((w_1-\theta_n)^2-\E(w_1-\theta_n)^2\right)
\left((w_2-\theta_n)^2-\E(w_2-\theta_n)^2\right)\right].\nonumber\\
\label{add proof1}
\end{eqnarray}
The first expectation above on the right hand side of (\ref{add proof1}) is $O(1)$, as $n \to \infty$. This conclusion is a consequence of conditions $(i)$ of Theorem \ref{CLT}. To show the asymptotic negligibility of the right hand side of (\ref{add proof1}), it remains to show that the second expectation in it is $o(1)$, as $n \to \infty$. To do so we write,
\begin{eqnarray}
&&\E\left[\left((w_1-\theta_n)^2-\E(w_1-\theta_n)^2\right)
\left((w_2-\theta_n)^2-\E(w_2-\theta_n)^2\right)\right] \nonumber\\
&&=\E\Big((w_1-\theta_n)^2(w_2-\theta_n)^2\Big)-\E^2(w_1-\theta_n)^2 \nonumber\\
&&=\E\Big( (w_1w_2)^2-2 (w_1)^2 w_2+\theta_n^2 (w_1)^2-2\theta_n w_1(w_2)^2
+4\theta_n^2 w_1w_2-2 \theta_n^3 w_1 \nonumber\\
&&\ \ +\theta_n^2 (w_2)^2
-2\theta_n^3 w_2+\theta_n^4\Big)-\E^2(w_1)^2-4\E(w_1)\theta_n^2-\theta_n^4
+4\E^2(w_1)^2 \E(w_1)\theta_n \nonumber\\
&&\ \ -2 \E^2\left(w_1\right)+4\theta_n^3\E\left(w_1\right)\nonumber\\
&&\sim\left(4-4\theta^{*}+2(\theta^{*})^2-4 \theta^{*}+4(\theta^{*})^2-2(\theta^{*})^3+2 (\theta^{*})^2-2 (\theta^{*})^3+(\theta^{*})^4\right)\nonumber\\
&&\ \ -4-4(\theta^{*})^2-(\theta^{*})^4+8 \theta^{*} - 4 (\theta^{*})^2+4(\theta^{*})^3\nonumber\\
&&=0.\label{add proof2}
\end{eqnarray}
Therefore, (\ref{ratio14}) holds true for symmetric multinomial weights too.
\\
As for (\ref{ratio15}), when weights are i.i.d., for all $\epsilon>0$, we have
\begin{eqnarray}\label{ratio16}
&&P\left(n^{-2d}\Big\vert\sum_{h=1}^n\gamma_h\frac{1}{n}\sum_{j=1}^{n-h}\Big((w_j-\theta_n)(w_{j+h}
-\theta_n)- \E\big( (w_1-\theta_n)(w_2-\theta_n)\big)\Big)\Big\vert>\epsilon\right)\nonumber\\
&&\le\epsilon^{-1}n^{-2d}\sum_{h=1}^n\vert\gamma_h\vert
\E^{1/2}\left(\frac{1}{n}\sum_{j=1}^{n-h}\Big((w_j-\theta_n)(w_{j+h}
-\theta_n)- \E\big( (w_1-\theta_n)(w_2-\theta_n)\big)\Big)\right)^2.\nonumber\\
\end{eqnarray}
Now observe that for all $h\ge1$,
\begin{eqnarray*}
&&\E\left(\frac{1}{n}\sum_{j=1}^{n-h}\Big((w_j-\theta_n)(w_{j+h}
-\theta_n)- \E\big( (w_1-\theta_n)(w_2-\theta_n)\big)\Big)\right)^2\\
&&=\frac{1}{n^2}\sum_{j=1}^{n-h}
\E\left( (w_j-\theta_n)(w_{j+h}-\theta_n)-\E^2(w_1-\theta_n)\right)^2\\
&&=\frac{n-h}{n^2}\Big(\E\big( (w_1-\theta_n)(w_2-\theta_n)\big)^2-\E^4(w_1-\theta_n)\Big)
\\
\end{eqnarray*}
Substituting the preceding relation into the right hand side of (\ref{ratio16}), in view of conditions $(i)$ and $(ii)$ of this theorem, we conclude that
\begin{eqnarray*}
&&\epsilon^{-1}n^{-2d}\sum_{h=1}^n\vert\gamma_h\vert\frac{\sqrt{n-h}}{n}\Bigg(\E^2\left((w_1-\theta_n)^2\right)-\E^4(w_1-\theta_n)\Bigg)^{1/2}
\\
&&=o(1), \ \textrm{as}\ n\to\infty.
\end{eqnarray*}
The preceding convergence to zero holds uniformly in $h$ since
$\sup_{1\leq h \leq n-1} \sqrt{n-h}/n=\sqrt{n-1}/n\to 0$ and
$\displaystyle{n^{-2d}\sum_{h=1}^\infty\vert\gamma(h)\vert}$
is bounded.
Now the proof
of (\ref{ratio15}) in the case of i.i.d. weights is complete.
\\
The proof of (\ref{ratio15}) when the weights are symmetric multinomial also begins with the inequality (\ref{ratio16}). In this case, in view of condition $(i)$, as $n \to \infty$, we have
\begin{equation}\label{ratio16+1}
\E\Big( (w_{1}-\theta_n) (w_{2}-\theta_n) \Big)^2 - \E^2\Big( (w_{1}-\theta_n) (w_{2}-\theta_n) \Big)=O(1),
\end{equation}
\begin{eqnarray}
&&\E\Bigg\{ \Bigg( (w_{1}-\theta_n) (w_{2}-\theta_n)- \E\Big( (w_{1}-\theta_n) (w_{2}-\theta_n) \Big) \Bigg)\nonumber\\
&& \qquad \times \Bigg( (w_{3}-\theta_n) (w_{4}-\theta_n)- \E\Big( (w_{3}-\theta_n) (w_{4}-\theta_n) \Big) \Bigg) \Bigg\}\nonumber\\
&&\sim \Big\{ 1-2 \theta^{*}+(\theta^{*})^2- 2 \theta^{*} +4(\theta^{*})^2 -2(\theta^{*})^3 +(\theta^{*})^2
-2 (\theta^{*})^3 +(\theta^{*})^4 \nonumber \\
&& ~ ~ -1 -4 (\theta^{*})^2 -(\theta^{*})^4 +4 \theta^{*} -2(\theta^{*})^2 +4(\theta^{*})^3\Big\}\nonumber\\
&&= 0.\label{ratio16+2}
\end{eqnarray}
These last two approximations imply that the right hand side of (\ref{ratio16}) is, asymptotically in $n$ and uniformly in $h$, negligible which means that (\ref{ratio15}) holds for symmetric multinomial weights. This completes the proof of (\ref{ratio1}).
\\
We now give a unified argument for both i.i.d. and symmetric multinomial weights to prove (\ref{ratio2}). The proof is also valid for both short and long memory data and it begins with observing that, as $n \to \infty$, we have
\begin{equation}\label{ratio21}
\frac{1}{\sqrt{n}}\underset{1\le j\le n}{\max}\left\vert w_j-\theta_n\right\vert=o_{P_w}(1).
\end{equation}
Considering that $\theta_n$ is bounded, the weight $w_{j}$, for each $n$, are identically distributed and, since, in the scheme {\textsf{(\textbf{RS})}} the weights are so that $\sup_{n\geq 1} \E|w_{1}|^3<\infty$, the proof of (\ref{ratio21}) follows from the following argument.
\begin{eqnarray*}
P\big(\underset{1\le j\le n}{\max}(w_j )^2>n \epsilon \big)&\le&
n P \big((w_1)^2>n\epsilon \big)\\
&\le& \epsilon^{-3/2} n^{-1/2} \E|w_{1}|^3
\le \epsilon^{-3/2} n^{-1/2} \E|w_{1}|^3 \to 0.
\end{eqnarray*}
In view of the conditions $(i)$ and $(ii)$ of Theorem \ref{CLT}, for some finite number $A$, we have
\begin{eqnarray*}\lefteqn{
\E(w_1-\theta_n)^2\gamma_0+2\E \Big( (w_1-\theta_n)(w_2-\theta_n)\Big)
\sum_{h=1}^n (1-\frac{h}{n})\gamma_h}\\
&&\longrightarrow K \gamma_0+2K^{\prime}\sum_{h=1}^\infty\gamma_h=\begin{cases}A,&\textrm{when }X_j\textrm{ of short memory},\\
\infty,&\textrm{when }X_j\textrm{ of long memory}.
\end{cases}
\end{eqnarray*}
Recall that $K^{\prime} < K $. This, in turn, implies that $A >0$. This together with (\ref{ratio21}) completes the proof of (\ref{ratio2}).
\\
\\
To complete the proof of Theorem \ref{CLT}, we need to prove (\ref{ratio3}). The validity of (\ref{ratio3}), for both i.i.d. and symmetric multinomial weights, by virtue of
(\ref{ratio14}) and conditions $(ii)$ of Theorem \ref{CLT}, results from the following weak law of large numbers, as $n \to \infty$.
\begin{eqnarray*}
&&\frac{(1/n)\sum_{j=1}^n(w_j-\theta_n)^2}{\E(w_1-\theta_n)^2\gamma_0+
2\E\Big((w_1-\theta_n)(w_2-\theta_n)\Big)
\sum_{h=1}^n (1-\frac{h}{n}) \gamma_h}\\
&&\overset{P_w}{\longrightarrow}\frac{K }{\gamma_0K +2K^{\prime}\sum_{h=1}^\infty\gamma_h}
=\begin{cases}A^{\prime} > 0,&\textrm{when }X_j\textrm{ of short memory},\\
0,&\textrm{when }X_j\textrm{ of long memory}.
\end{cases}
\end{eqnarray*}
This completes the proof of (\ref{ratio3}) as well as that of Theorem \ref{CLT}. $\square$
\subsection*{Proof of Theorem \ref{CLT G^*^stu} }
In the proof of this theorem, as well as in the proof of Theorem \ref{Complete Studentization thm}, for the ease of the notation we let $P_{X|w} (.)$ stand for the conditional probability $P(. \big| w_{1},\cdots,w_{n} )$.
\\
As $n,q\to\infty$, in such a way that $q=O(n^{1/2})$, under the conditions of this theorem, from the approximation (2.10) of Theorem 2.1 of Abadir \textit{et al}. \cite{HACMAC}, that holds true for $d$ and $\hat{d}$, we have
\begin{equation}\nonumber
q^{-2d} \bar\gamma_0
+2q^{-2d} \sum_{h=1}
^q\bar\gamma_h(1-\frac{h}{q}) \longrightarrow s^{2}_X,
\end{equation}
where $s^{2}_X$ is as defined right after (\ref{ratio13}). This, in turn, implies that, as $n,q\to\infty$, in such a way that $q=O(n^{1/2})$, we also have
\begin{eqnarray}\label{berno1}
q^{-2d}\mathcal{S}_{n,q,w}&=&q^{-2d}\E(w_1-\theta_n)^2 \bar\gamma_0
+2q^{-2d}\E\Big((w_1-\theta_n)(w_2-\theta_n)\Big)\sum_{h=1}
^q\bar\gamma_h(1-\frac{h}{q})\nonumber\\
&&\overset{P}{\longrightarrow}\begin{cases}\gamma_0(K -K^{\prime})+K^{\prime}s_X^2>0,&\textrm{ when }d=0,\\\\
K^{\prime} s_X^2>0,&\textrm{ when }0<d<1/2,
\end{cases}
\end{eqnarray}
where the constant $K$ is as in (\ref{K^prime-1}) and
$K^{\prime}$ is as in (\ref{K^prime}).
The preceding convergence means that the Studentizing sequence $q^{-2d}\mathcal{S}_{n,q,w}$ asymptotically coincides with the limit of $n \mathcal{D}_{n,X,w}$, which is the normalizing sequence for $T_{n,X,w}(\theta_n)$, as in (\ref{randomT}). In Theorem \ref{CLT} we showed $T_{n,X,w}(\theta_n)$ has standard normal limiting distribution. Considering that
\begin{equation}\label{19+1}
G_{n,X,w}(\theta_n,d)= T_{n,X,w}(\theta_n) \sqrt{(n \mathcal{D}_{n,X,w})/(q^{-2d}\mathcal{S}_{n,q,w})},
\end{equation}
we conclude, from Slutsky theorem, that $G_{n,X,w}(\theta_n,d)$ also convergence to standard normal.
The relations (\ref{berno1}) and (\ref{19+1}) are also true when the memory parameter $d$ is replaced by its estimator $\hat{d}$, provided that $\hat{d}-d=o_{p}(1/\log n)$.
\\
Now the proof of Theorem \ref{CLT G^*^stu} is complete. $\square$
\subsection*{Proof of Theorem \ref{Complete Studentization thm}}
The proof of Theorem \ref{Complete Studentization thm}, for both i.i.d. and symmetric multinomial weights, will follow if we show that
\begin{eqnarray}\label{berno12}
&& P_{X\vert w} \left\{ \big|\big( (q^{-2d} \hat{\mathcal{S}}_{n,q,w}) \big/ (q^{-2d}\mathcal{S}_{n,q,w})\big) -1 \big| > \epsilon \right\}\nonumber \\
&=&P_{X\vert w}\left\{\left\vert\frac{q^{-2d}\bar\gamma_0\frac{1}{n}\sum_{j=1}^n(w_j-\theta_n)^2+2q^{-1-2d}\sum_{h=1}^q\bar\gamma_h\sum_{j=1}^{q-h}(w_j-\theta_n)(w_{j+h}-\theta_n)}
{q^{-2d}\bar\gamma_0\E(w_1-\theta_n)^2+2q^{-2d}\E\Big((w_1-\theta_n)(w_2-\theta_n)\Big)
\sum_{h=1}^q\bar\gamma_h(1-\frac{h}{q})}-1\right\vert>\epsilon\right\}\nonumber\\
&&=o_{P_w}(1),\qquad\textrm{as }n\to\infty,
\end{eqnarray}
where $\epsilon$ is an arbitrary positive constant. By virtue of (\ref{berno1}), the proof of (\ref{berno12}), as $n,q \to \infty$ such that $q=O(n^{1/2})$, will follow from (\ref{ratio14}) combined with
\begin{equation}\label{berno12+1}
P_{X|w} \big( \big| q^{-2d} \sum_{h=1}^q\bar\gamma_h B_{n,q,w}(h) \big|> \epsilon \big) =o_{P_w}(1),
\end{equation}
where
\begin{equation*}
B_{n,q,w}(h):= q^{-1} \sum_{j=1}^{q-h} \Big( (w_j-\theta_n)(w_{j+h}-\theta_n)
- \E \big((w_1-\theta_n)(w_2-\theta_n)\big) \Big).
\end{equation*}
The proof of (\ref{berno12+1}) is a modification of the proof of (6.14) in Cs\"{o}rg\H{o} \textit{et al.} \cite{Csorgo and Nasari and Oul-Haye}.
\\
For convenient reference here we give the proof of (\ref{berno12+1}) for both i.i.d. and symmetric multinomial weights. To do so, without loss of generality, we assume that $\mu=\E X_{1}=0$ and, for each $1\leq h\leq q$, we define
\begin{equation}\label{def. gamma*}
\gamma_{h}^*:=\frac{1}{n} \sum_{i=1}^{n-h} X_{i} X_{i+h}.
\end{equation}
Observe that, for $\varepsilon_1, \ \varepsilon_2>0$, we have
\begin{eqnarray}
&&P\big\{ P_{X|w}\big( q^{-2d}\big| \sum_{h=1}^q \bar{\gamma}_{h} B_{n,q,w}(h) \big|> 2\varepsilon_1 \big)>\varepsilon_2 \big\}\nonumber\\
&&\leq P\big\{ P_{X|w}\big( q^{-2d}\big| \sum_{h=1}^q (\bar{\gamma}_{h}-\gamma_{h}^*) B_{n,q,w}(h) \big|>\varepsilon_1 \big)>\varepsilon_2 \big\}\nonumber\\
&&\qquad + P\big\{ P_{X|w}\big( q^{-2d} \big| \sum_{h=1}^q \gamma_{h}^* B_{n,q,w}(h) \big|>\varepsilon_1 \big)>\varepsilon_2 \big\}.\label{eq 21 proofs}
\end{eqnarray}
We now show that the first term in (\ref{eq 21 proofs}) is asymptotically negligible, noting first that
\begin{eqnarray}
\sum_{h=1}^q (\bar{\gamma}_{h}-\gamma_{h}^*) B_{n,q,w}(h)&=&-\frac{\bar{X}_n}{n} \sum_{h=1}^q B_{n,q,w}(h) \sum_{i=1}^{n-h} X_i - \frac{\bar{X}_n}{n} \sum_{h=1}^q B_{n,q,w}(h) \sum_{i=1}^{n-h} X_{i+h}\nonumber\\
&&+
\bar{X}^2 \sum_{h=1}^q B_{n,q,w}(h)\nonumber\\
&\sim& - \bar{X}^2 \sum_{h=1}^q B_{n,q,w}(h)\ uniformly \ in \ h\ in \ probability-P_{X|w},\nonumber\\
&&\label{eq 22 proofs}
\end{eqnarray}
where, in the preceding conclusion, generically, $Y_{n}\sim Z_{n}$ in probability-$P$ means $Y_n=Z_n (1+o_{P}(1))$. The approximation in (\ref{eq 22 proofs}) is true since, for $\varepsilon>0$ we have
\begin{eqnarray*}
P\big( \cup_{1\leq h \leq q} \big| \bar{X}_{n} - \frac{\sum_{i=1}^{n-h} X_i}{n} \big|>\varepsilon \big)&\leq&q P\big( \big| \frac{\sum_{i=n-h+1}^{n} X_i}{n} \big|>\varepsilon \big)\label{newly added 1}\\
&\leq& \varepsilon^{-4} q \frac{(h-1)^4}{n^4} \E(X^{4}_1)\nonumber\\
&\leq&\varepsilon^{-4} \frac{q^5}{n^4} \E(X^{4}_1)\rightarrow 0,\ as \ n\to \infty.\nonumber
\end{eqnarray*}
The preceding is true since $1\leq h \leq q$ and $q=O(n^{1/2})$, as $n,q \to \infty$.
\\
We note that for $0\leq d <1/2$, as $n\rightarrow \infty$, we have that $n^{1/2-d} \bar{X}_{n}=O_{P}(1)$. The latter conclusion, in view of the equivalence in (\ref{eq 22 proofs}), implies that, for each $\varepsilon_1, \varepsilon_2>0$, there exists $\varepsilon>0$ such that
\begin{eqnarray}
&&P\big\{ P_{X|w}\big( q^{-2d} \big| \sum_{h=1}^q (\bar{\gamma}_{h}-\gamma_{h}^*) B_{n,q,w}(h) \big|>\varepsilon_1 \big)>\varepsilon_2 \big\}\nonumber\\
&\sim& P \big\{ \frac{q^{-2d}}{n^{1-2d}} \sum_{h=1}^q \big|B_{n,q,w}(h)\big|>\varepsilon\big\}\nonumber \\
&\leq& \varepsilon^{-1} \frac{q^{-2d}}{n^{1-2d}} \sum_{h=1}^q \E\big(\big|B_{n,q,w}(h)\big|\big). \label{change 1}
\end{eqnarray}
From condition $(ii)$ of Theorem \ref{CLT}, that is also assumed in Theorem \ref{CLT G^*^stu}, there exists a constant $\mathcal{L}$ whose value does not depend on $n$ such that $\sup_{n\geq 2}\sup_{1\leq h\leq q} \E \big(\big|B_{n,q,w}(h)\big|\big) < \mathcal{L}$. Hence, (\ref{change 1}) can be bounded above by
\begin{equation*}
\mathcal{L} \ \varepsilon^{-1} \frac{q^{1-2d}}{n^{1-2d}}\longrightarrow 0,
\end{equation*}
as $n,q \to \infty$ in such away that $q=O(n^{1/2})$. This means that the first term in (\ref{eq 21 proofs}) is asymptotically negligible. To establish (\ref{berno12}) we show that the second term in (\ref{eq 21 proofs}) is also asymptotically negligible. To prove this negligibility, we first define
\begin{equation}\label{def. of gamma**}
\gamma_{h}^{**}:=\frac{1}{n} \sum_{i=1}^n X_i X_{i+h}.
\end{equation}
Now, observe that
\begin{eqnarray}
P\big\{ \cup_{1\leq h \leq q} |\gamma_{h}^{**}-\gamma_{h}^{*}|>\varepsilon \big\}&\leq& q P\big\{ \frac{1}{n}| \sum_{i=n-h+1}^n X_i X_{i+h}|>\varepsilon \big\}\nonumber\\
&\leq& \varepsilon^{-2} \frac{q^3}{n^2} \E (X^{4}_1)\to 0,\nonumber
\end{eqnarray}
as $n,q\to \infty$ such that $q=O(n^{1/2})$, hence, as $n,q\to \infty$ such that $q=O(n^{1/2})$, using an argument similar to those used for (\ref{eq 21 proofs}) and (\ref{change 1}), with $\gamma^{*}_h$ replacing $\bar{\gamma}_h$ and $\gamma^{**}_h$ replacing $\gamma^{*}_h$ therein, we arrive at
\begin{eqnarray*}
&&P\big\{ P_{X|w}\big( q^{-2d}\big| \sum_{h=1}^q \gamma_{h}^{*} B_{n,q,w}(h) \big|>\varepsilon_1 \big)>\varepsilon_2 \big\}\\
&\sim& P\big\{ P_{X|w}\big( q^{-2d}\big| \sum_{h=1}^q \gamma_{h}^{**} B_{n,q,w}(h) \big|>\varepsilon_1 \big)>\varepsilon_2 \big\}.
\end{eqnarray*}
Therefore, in order to prove (\ref{berno12}), it suffices to show that, as $n,q\to \infty$ so that $q=O(n^{1/2})$,
\begin{equation*}\label{eq 36 proofs}
P\big\{ P_{X|w}\big( q^{-2d}\big| \sum_{h=1}^q \gamma_{h}^{**} B_{n,q,w}(h) \big|>\varepsilon_1 \big)>\varepsilon_2 \big\}\to 0,
\end{equation*}
The preceding relation, in turn, follows from the following two conclusions: as $n,q \to \infty$ so that $q=O(n^{1/2})$,
\begin{equation}\label{eq 37 proofs}
\sup_{1\leq h,h^\prime \leq q} \E\big( \big|B_{n,q,w}(h) B_{n,q}(h^{\prime}) \big| \big)=o(1)
\end{equation}
and
\begin{equation}\label{eq 38 proofs}
q^{-4d} \sum_{h=1}^q \sum_{h^{\prime}=1}^q \big| \E(\gamma_{h}^{**} \gamma_{h^{\prime}}^{**}) \big|=O(1).
\end{equation}
To prove (\ref{eq 37 proofs}), using the Cauchy inequality we write
\begin{eqnarray}
&&\E\big( \big|B_{n,q,w}(h) B_{n,q,w}(h^{\prime}) \big| \big)\nonumber\\
&\leq& \E\big( B_{n,q,w}(h) \big)^2 \nonumber\\
&\leq& \frac{q-h}{q^2} \ \E\Big( (w_{1}-\theta_n) (w_{2}- \theta_n) - \E \big( (w_{1}- \theta_n) (w_{2} - \theta_n) \big) \Big)^2 \nonumber \\
&+& \frac{(q-h)(q-h-1)}{q^2} \E \Bigg\{ \Big( (w_{1}- \theta_n) (w_{2}-\theta_n) - \E \big( (w_{1}- \theta_n) (w_{2}-\theta_n) \big) \Big) \nonumber\\
&& ~~~~~~~~~~~~~~~~~~~~~~~~~ \times \Big( (w_{3}- \theta_n) (w_{4}- \theta_n)- \E \big( (w_{3}- \theta_n) (w_{4}- \theta_n) \big) \Big) \Bigg\}. \nonumber \\
\label{added eqq1}
\end{eqnarray}
In case of i.i.d. weights, (\ref{added eqq1}) is bounded above by $q^{-1} \E^{2} (w_1 - \theta_n)^2$ that
vanishes as $q, n \to \infty$. In case of symmetric multinomial weights, from (\ref{ratio16+1}) and (\ref{ratio16+2}) we can see that (\ref{added eqq1}) has an upper bound of the form $2 K_n/q + k_n$, where $K_n=O(1)$ and $k_n=o(1)$, that also vanishes as $n,q \to \infty$. The latter conclusion completes the proof of (\ref{added eqq1}) and that of (\ref{eq 37 proofs}).
\\
In order to establish (\ref{eq 38 proofs}), we define
\begin{equation*}
H:=\lim_{s\to \infty} s^{-2d} \sum_{\ell =-s}^{s} |\gamma_{\ell}|.
\end{equation*}
Observe that $H<\infty$.
We now carry on with the proof of (\ref{eq 38 proofs}), using a generalization of an argument used in the proof of Proposition 7.3.1 of Brockwell and Davis \cite{Brockwell and Davis} as follows:
\begin{eqnarray}
q^{-4d}\sum_{h=1}^q \sum_{h^\prime=1}^q \big| \E(\gamma_{h}^{**} \gamma_{h^{\prime}}^{**}) \big|
&\leq& q^{-2d}\sum_{h=1}^q \big|\gamma_h \big|\ q^{-2d} \sum_{h^\prime=1}^q \big|\gamma_{h^\prime}|\nonumber\\
&+&(\frac{q}{n})^{1-2d} n^{-2d} \sum_{k=-n}^n \big| \gamma_h \big|\ q^{-2d} \sum_{L=-q}^q \big| \gamma_{k+L} \big|\nonumber \\
&+& \frac{1}{n} \sum_{k=-n}^n \ q^{-2d} \ \sum_{h^\prime=1}^q \big| \gamma_{k+h^\prime} \big| \ q^{-2d} \ \sum_{h=1}^q \big| \gamma_{k-h} \big|\nonumber\\
&+& \frac{q^{-2d}}{n^{1-2d}} n^{-2d} \sum_{i=1}^n \sum_{k=-n}^n |a_i a_{i+k}|\ q^{-d} \sum_{h=1}^q |a_{i+h}| \ q^{-d} \sum_{h^\prime=1}^q |a_{i+k-h^\prime}|.\label{eq 39 prroofs}
\end{eqnarray}
It is easy to see that, as $n\to \infty$, and consequently $q\to \infty$, the right hand side of the inequality (\ref{eq 39 prroofs}) converges to the finite limit $3 H^2$. Now the proof of (\ref{eq 38 proofs}) and also that of Theorem \ref{Complete Studentization thm} are complete. $\square$
| {'timestamp': '2019-01-15T02:01:34', 'yymm': '1901', 'arxiv_id': '1901.03742', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03742'} | arxiv |
\section{Introduction}
With a significant increase in area throughput, Massive \ac{MIMO} antenna communication has become an enabling technology for the upcoming fifth generation (5G) wireless mobile communication systems \cite{EmilBjoernson2017,HoydisTenBrinkMMIMO,MMIMO5GCommMag,5GTechCommMag}.
However, Massive \ac{MIMO} systems described in current research literature commonly exploit channel reciprocity and hence rely on \ac{TDD}-based approaches \cite{EmilBjoernson2017}, i.e., \ac{UL} and \ac{DL} channels share the \emph{same} frequency band in orthogonal time intervals.
Achieving such reciprocity in practice requires accurate hardware with costly calibration circuitry.
To mitigate this issue, various alternatives to a full Massive \ac{MIMO} system have been proposed such as the \emph{grid of beams} \cite{7881048} and codebook Massive \ac{MIMO} \cite{DLChannelFDD}.
As \ac{FDD} does not rely on channel reciprocity, it is a practically highly relevant topic, and both academia and industry have been striving for enabling \ac{FDD} Massive MIMO.
However, it is widely accepted as a fundamental limitation that \ac{FDD} Massive \ac{MIMO} has a prohibitive high piloting/reporting overhead related to channel estimation in both \ac{UL} and \ac{DL} direction \cite{EmilBjoernson2017}, unless certain conditions on the channel covariance structure are satisfied which, however, are rarely observed in practice \cite{6310934,8094949}.
In \ac{TDD}, the \ac{UE} sends a single pilot symbol to its $M$ antennas at the \ac{BS}, allowing the \ac{BS} to estimate the \ac{UL} channels in one time slot, and, by exploiting channel reciprocity, to re-use these \ac{UL} channel estimates for precoding in the \ac{DL}, without the need for any costly \ac{CSI} reporting feedback.
However, in \ac{FDD} systems, this reciprocity does not hold from one frequency band to another and, thus, the \ac{DL} channels from each antenna to the \ac{UE} must be estimated separately, and reported back to the \ac{BS}, incurring an overhead proportional to the number of antennas $M$ \cite{EmilBjoernson2017}.
\begin{figure}[H]
\centering
\includegraphics{NN-CSI-estimation-figure0.pdf}
\caption{Using the uplink \ac{CSI} at $f_{\text{UL}}$ to infer on downlink \ac{CSI} at $f_{\text{DL}}$.}
\label{fig:Est-Princ}
\end{figure}
On the other hand, \ac{FDD} Massive \ac{MIMO} promises compatibility to current frequency allocations for mobile communication systems and, potentially, reduces latency \cite{7402270}.
It has been shown that a compressed sensing approach \cite{8284057} achieves almost the same minimal piloting overhead as \ac{TDD} Massive \ac{MIMO}.
However, it is unclear whether the general assumption of channel sparsity holds in practice \cite{6310934,7008286}.
Other approaches such as \cite{Vasisht2016,Yang2018} rely on an underlying channel model including expert knowledge on the antenna geometry.
Further, the authors in \cite{Soltani2018} propose a super-resolution channel estimation via deep learning in such a way that the \ac{NN} interpolates subcarriers without pilots from neighboring subcarriers.
In \cite{8052521} it was proposed to replace an \ac{OFDM} channel estimation combined with data detection by a \ac{NN}.
Recently, different \ac{CSI} prediction approaches exploiting channel sparsity have been proposed in \cite{ZhiyuanJiang2018,RuichenDeng2018}.
Another particular interesting idea to reduce the piloting overhead by using a subset of antennas to predict the remaining antennas was introduced in \cite{PeihaoDong2018}.
While this approach aims at predicting the channel at a different spatial location, but on the same frequency, we try, in this work, to estimate the channel at a different frequency but for the same spatial position.
However, none of these works focus on the problem of extrapolating/prediction from one frequency band to an adjacent frequency band and, to the best of our knowledge, no general solution for the \ac{FDD} Massive \ac{MIMO} problem is known.
A \emph{classical} estimation using the channel covariance matrix, which has not resulted a practical solution yet, was approached in \cite{DLChannelFDD,DLChannelCovarianceFDDMMIMO}.
Although machine learning and, in particular, deep learning has attracted a lot of attention for a wide variation of different communication applications, it currently lacks of solutions showing practical gains.
One important contribution of our work is to show that a \ac{NN} can \emph{enable} solutions (i.e., \ac{FDD} \ac{CSI} extrapolation/prediction) for which simply no satisfactory \emph{classical} signal processing algorithm is known, or, even more so, where classic approaches (Wiener filter) would fail.
In this work, the general idea is to estimate the \ac{DL} \ac{CSI} only based on the observed \ac{UL} \ac{CSI} via deep \acp{NN} and, thus, overcome a major practical limitation for \ac{FDD} Massive \ac{MIMO}.
Our approach works for any considered scenario with adjacent frequency bands and, in contrast to compressed sensing, does not rely on channel sparsity as it also works in the \ac{SISO} scenario.
The intuition behind this prediction scheme is that the impinging waves at the \ac{UE}, generated through different scatterers, are assumed to be similar over a small frequency bandwidth, although it may be hard to describe the connection in terms of an analytical model. Therefore, a \ac{NN} should be able to \emph{approximate} such a function without the need of any a priori knowledge other than the observed measured data.
Fig.~\ref{fig:Est-Princ} illustrates the proposed scheme for an \ac{OFDM} system, extrapolating \ac{CSI} from a frequency band centered around $f_{\text{UL}}$ to a nearby frequency band centered around $f_{\text{DL}}$.
This ease in modeling and flexibility in application comes at the cost of acquisitioning large quantities of channel estimates, plus retraining whenever the radio environment changes significantly.
We believe, however, that data acquisition is not a real limitation, as a hybrid approach could use pilots whenever the \ac{BS} operates at low average load without any additional effort, allowing the continuous refinement of the \ac{NN} weights; only during high load periods the \ac{BS} may switch to the proposed \ac{CSI} prediction scheme.
Also, the training could be outsourced to a datacenter and only the updated weights need to be transmitted to the \ac{BS} whenever a performance improvement can be achieved.
In a first step, we analyze the proposed scheme with the help of several simple examples, such as the \ac{SISO} setting to demonstrate the general feasibility of \ac{CSI} prediction from \ac{UL} to \ac{DL} in the \ac{SISO} scenario.
This provides important insights into designing and training a \ac{NN} for such a signal processing task, and also allows the comparison within an analytical setup.
Next, standardized channel models such as the 3GPP 38.901 channel model (implemented by the Quadriga framework \cite{Jaeckel2014}) and measurements are evaluated to show the viability of our proposed setup in a realistic setting.
Furthermore, with our measurements we show that the spectral efficiency loss in a practical system with 32 antennas is rather moderate $(\sim$10\% in \ac{LoS}, $\sim$20\% in \ac{NLoS}), rendering our scheme to be an attractive proposition for future wireless communication systems.
The remainder of this paper is structured as follows:
Section~\ref{sec:model_and_limits} starts with fundamental limitations of \ac{FDD} Massive \ac{MIMO} and discusses different metrics needed to evaluate predicted \ac{CSI}.
Section~\ref{sec:deep_learning} provides a short introduction to deep learning and clarifies notation.
In Section~\ref{sec:siso}, we introduce the proposed \ac{NN}-based approach for the \ac{SISO} scenario, provide results for simulated and measured scenarios and compare the \ac{NN}'s performance to a Wiener filter-based approach, i.e., \emph{the} classic signal processing baseline.
The simulations and measurements are then extended to a Massive \ac{MIMO} scenario in Section~\ref{sec:mimo}; finally Section~\ref{sec:conclusions} concludes the paper.
\vskip2mm
\textit{Notations:} Boldface letters and upper-case letters denote column vectors and matrices, respectively.
The $i$th element of vector $\vec{x}$ is denoted $x_i$.
The notation
$\vec{x}^{H}$ denotes the Hermitian transpose of $\vec{x}$.
\section{System model and fundamental limitations}
\label{sec:model_and_limits}
\begin{figure}[H]
\centering
\includegraphics{NN-CSI-estimation-figure1.pdf}
\caption{The \ac{DL} \ac{CSI} extrapolation is based on a \ac{NN} trained using \ac{UL} \ac{CSI} observations.}
\label{fig:System-Model-Chan-Est}
\end{figure}
Fig.~\ref{fig:System-Model-Chan-Est} depicts the fundamental problem we tackle in this work.
The task of the \ac{BS} is to estimate the \ac{DL} \ac{CSI} $h_{\text{DL}}(\tau)$ only by observing the \ac{UL} \ac{CSI} $h_{\text{UL}}(\tau)$ (\ac{UL} pilots) as shown in Fig.~\ref{fig:System-Model-Chan-Est}.\footnote{We consider a scenario where the \ac{BS} has multiple antennas, while each \ac{UE} has a single antenna. Extensions to \acp{UE} with multiple antennas are straightforward.}
Obviously, the success of such an approach relies on whether there is an underlying physical relation between the considered frequency bands; thus, in Section~\ref{sec:siso} and Section \ref{sec:mimo}, respectively, we demonstrate the validity of this assumption for both simulated and measured scenarios.
\subsection{Approximating the channel's impulse response}
As shown in Fig.~\ref{fig:System-Model-Chan-Est}, we consider a wireless channel between two radio transceivers, referred to as \acf{UE} and \acf{BS}, which are both equipped with a single antenna.
The channel impulse response $h(\tau)$ can be written as
\begin{align}\label{eq:h}
h(\tau) = \sum_{p=1}^P a_p \delta(\tau-\tau_p)
\end{align}
where $a_p\in \mathbb R_+$ and $\tau_p\in \mathbb R_+$ for $p=1,\dots,P$ are the attenuation and propagation delay of the $p$th path, respectively.
The channel impulse response is reciprocal, i.e., it characterizes the channel between both transceivers in each directions.
Both transceivers communicate using an \ac{FDD} scheme, where one frequency band is used for \ac{UL} transmissions from the \ac{UE} to the \ac{BS}, while another frequency band is used for \ac{DL} transmissions from the \ac{BS} to the \ac{UE}.
Both frequency bands are of bandwidth $W$ and have center frequencies $f_\text{UL}$ and $f_\text{DL}$, respectively.
In the following we assume that \eqref{eq:h} is valid over a large frequency range $\left[ \min(f_\text{UL},f_\text{DL})-W/2, \max(f_\text{UL},f_\text{DL})+W/2 \right]$, sufficient to contain both the \ac{UL} and \ac{DL} frequency bands.
Following \cite{tse2005fundamentals}, the equivalent discrete time baseband model of the channel $h(\tau)$ over a frequency band of bandwidth $W$ and center frequency $f_c$ is given as
\begin{equation}\label{eq:corr_fundamental}
h_{\ell} = \sum_{p=1}^{P} a_{p} e^{-j 2\pi f_c \tau_p} \text{sinc}\left( \ell -\tau_pW\right) \quad \ell=0,\dots,L-1
\end{equation}
where $\text{sinc}(x)=\frac{\sin(\pi x)}{\pi x}$ is the normalized sinc-function and $L$ is the largest integer for which $|h_L|\ge \varepsilon$, for some threshold $\varepsilon > 0$.
Evaluating \eqref{eq:corr_fundamental} for $f_c = f_\text{UL}$ and $f_c = f_\text{DL}$, we obtain the equivalent discrete time baseband \ac{UL} and \ac{DL} channels $h_{\ell,\text{UL}}\in\mathbb C$ and $h_{\ell,\text{DL}} \in\mathbb C$, respectively.
Due to the finite sampling rate $W$, it is generally impossible to estimate the exact values of $\tau_p$ from $h_{\ell,\text{UL}}$ or $h_{\ell,\text{DL}}$ for any arbitrary $f_\text{UL}$ to $f_\text{DL}$, e.g., from \SI{1}{\giga \hertz} to \SI{6}{\giga \hertz}.
It is, therefore, also impossible to compute the exact values of $h_{\ell,\text{DL}}$ from $h_{\ell,\text{UL}}$ and vice versa.
However, a \ac{NN} can predict an \emph{approximation} of $h_{\ell,\text{DL}}$ from $h_{\ell,\text{UL}}$ (or vice versa) for a given radio environment at an adjacent frequency band.
We denote by $\vec{h}_{\text{UL}}\in\mathbb C^{N_{\text{sub}}}$ and $\vec{h}_{\text{DL}}\in\mathbb C^{N_{\text{sub}}}$ the \ac{CSI} vectors over subcarriers of an \ac{OFDM} system.
\subsection{Metrics}\label{sec:Metrics}
Throughout this work, three different performance metrics are used, each of which coming with its own strengths and weaknesses, as will be discussed next.
\subsubsection{Normalized mean squared error (NMSE)} \acused{NMSE}
We use the \ac{NMSE} as the loss function during training given as
\begin{align}
\text{NMSE} = \mathbb{E}\left[ \frac{\Vert \vec{h}_\text{DL} - \hat{\vec{h}}_\text{DL}\Vert^2_2}{\Vert \vec{h}_\text{DL}\Vert^2_2} \right].
\label{eq:nmse}
\end{align}
While the \ac{MSE} is a standard metric for regression tasks, our task requires a normalization such that the performance is independent of the path loss, i.e., $\mathbb{E} \left[ \left| \vec{h}_\text{DL} \right|^2 \right] = 1$, which would otherwise suggest misleading results.
The normalization forces the \ac{NN} to also focus on channel coefficient characteristics for distant \ac{UE} positions, where $\left| \vec{h}_{\text{DL}} \right|^2$ is comparatively small.
By only training on the \ac{MSE} without normalization, the \ac{NN} tends to learn to output a random near-zero prediction for input \ac{CSI} where $\mathbb{E} \left[ \left| \vec{h}_\text{UL} \right|^2 \right]$ is small.
However, the drawback of the \ac{NMSE} is that its interpretation is less intuitive in how the \ac{NMSE} relates to the achieved performance and, thus, we, rather, consider the correlation coefficient for most evaluations.
\subsubsection{Correlation coefficient}
We use the \textit{correlation coefficient} $\delta_{h}$ as an alternative performance metric, allowing a more intuitive interpretation.
The correlation coefficient is defined as
\begin{align}
\delta_{h}= \mathbb{E}\left[\frac{\left\Vert \vec{h}_{\text{DL}} \hat{\vec{h}}_{\text{DL}}^{H}\right\Vert_\text{2}}{\left\Vert \vec{h}_{\text{DL}} \right\Vert_{\text{2}}\Vert {\hat{\vec{h}}_{\text{DL}}}\Vert _{\text{2}}}\right] =\mathbb{E}\left[ \frac{\sum_{k=0}^{N_\text{sub}}{\Vert h_{k,\text{DL}} \hat{h}_{k,\text{DL}} \Vert_\text{2}}}{\left\Vert \vec{h}_{\text{DL}} \right\Vert_{\text{2}}\Vert {\hat{\vec{h}}_{\text{DL}}}\Vert_{2}} \right].
\label{eq:ChannelCorrDef}
\end{align}
Its main advantage is that it provides a very intuitive result, as the range is bounded by the perfect match between predicted and actual channel (i.e., $\delta_h=1$) and an uncorrelated scenario (i.e., $\delta_h=0$).
Note that, a common phase rotation for all elements of the prediction does not affect this metric. However, a constant phase offset is inherently compensated by the underlying \ac{OFDM} scheme.
In our experiments we observed, in contrast to \ac{NMSE}, that the correlation coefficient is not a suitable loss function. It converged quickly to a local minimum with unsatisfactory performance.
\subsubsection{Bit error rate (BER)}\acused{BER}
Despite the fact that the \ac{NMSE} and correlation coefficient provide good metrics for comparing the similarity of the predicted \ac{CSI}, it does not tell us anything about the resulting \ac{BER} performance.
Thus, we also evaluate the (uncoded) \ac{BER} when operating the system with the predicted channel coefficients.
This means we precode/equalize \ac{QPSK} symbols based on predicted \ac{CSI} by the \ac{NN}, and then evaluate on a channel that uses the actual \ac{CSI}.
While the \ac{BER} metric also provides a good insight into the \ac{NN}'s performance, its drawback is that, unfortunately, it cannot be directly embedded as loss function, as it requires intensive Monte-Carlo simulations per prediction, and, moreover, is not differentiable.
One could possibly use soft information, i.e., cross-entropy if needed.
\section{A primer on Deep Learning and Datasets}
\label{sec:deep_learning}
We provide a brief introduction to deep learning with the aim of clarifying notation and terminology used throughout this work.
However, we refer the interested reader to \cite{goodfellow2016} for further details on deep learning in general.
An \acf{NN} consists of weights $\boldsymbol{\theta}$, within a certain layer structure, that define a mapping
\begin{align}
\hat{f}(\vec{x};\boldsymbol{\theta}): \mathbb{R}^n \mapsto \mathbb{R}^k
\end{align}
of an input vector $\vec{x}\in\mathbb{R}^n$ to an output vector $\hat{\vec{y}}\in\mathbb{R}^k$.
The weights $\boldsymbol{\theta}$ determine the \ac{NN}'s behavior, and the process of finding good values for $\boldsymbol{\theta}$ from data to achieve a desired behavior is generally described as ``deep learning''.
In our case the input vector $\vec{x}$ is the \ac{CSI} of one channel (subcarriers) at a frequency centered around $f_\text{UL}$ and the desired behavior of the \ac{NN} is to output a prediction $\hat{\vec{y}}$ of the \ac{CSI} of another channel at another frequency band centered around $f_\text{DL}$.
This is called a regression task and we can use well-established algorithms to fit the weights to our datasets such that they minimize a certain loss metric.
A single complex-valued number is split into two consecutive real-valued numbers and used as input for the \ac{NN} and, vice versa, at the output.
We start training with small mini-batches containing only $16$ samples and increase the batchsize during the process stepwise up to $512$ to obtain more fine-grained weight updates.
During training, we also add \ac{AWGN} as regularization to the training samples to prevent overfitting.
Intuitively, the optimal training \ac{SNR} is a trade-off between high noise power, i.e., \emph{learning robustness to noisy data} and noiseless samples, i.e., \emph{learning the underlying (deterministic) channel transfer function} \cite{gruber2017}.
\subsection{Dataset}
We can easily generate large quantities of simulated or measured channel realizations on both frequency bands at $f_\text{UL}$ and $f_\text{DL}$, respectively. Our datasets contain labeled samples, i.e., a sample is a tuple of input $\vec{x} = \vec{h}_\text{UL}$ and label $\vec{y} = \vec{h}_\text{DL}$.
Our dataset contains $N$ samples denoted by $\{(\vec{h}_{\text{UL},1},\vec{h}_{\text{DL},1}),\dots,(\vec{h}_{\text{UL},N},\vec{h}_{\text{DL},N})\}$.
In all our simulations and measurements we use an \ac{OFDM} scheme with $N_{sub}=1024$ subcarriers.
Due to guard-bands, we effectively use 922 out of those $1024$ subcarriers, resulting in a \ac{CSI} vector of 922 complex channel coefficients.
We reshape those coefficients to their real-valued real and imaginary parts and also use multiple antennas in the \ac{MIMO} scenario.
Thus, the dimensionality of both the input and the label tensor is $M \times N_{\text{sub}} \times 2$ (nb.\ antennas, nb.\ subcarriers, real/imaginary part).
All datasets are randomly split into a train set, containing 90\%, and a test set, containing 10\% of all samples.
\subsection{Convolutional Layers}
Our final \ac{NN} structure mainly consists of \ac{CNN} layers, reducing the total amount of trainable parameters by order of magnitudes.
Since neighboring \ac{OFDM} channel coefficients in frequency domain are correlated within the coherence bandwidth, we figured that convolutional layers are perfectly suited to extract latent information.
Thus, we use multiple two-dimensional convolutional layers with different kernel sizes in our final \ac{NN} structure, which is similar to established models in computer vision like VGG \cite{simonyan2014very}.
Furthermore, additional pooling layers after each \ac{CNN} layer are used to reduce the dimensionality of the input tensor.
As final output we use a dense layer with linear activation to create the channel coefficients of the \ac{DL} in the desired output shape
\section{\ac{SISO} \ac{UL}-\ac{DL} channel prediction}
\label{sec:siso}
We first focus on the \ac{SISO} scenario to illustrate the differences between the previously described performance metrics, and show the viability of this concept.
However, it is important to realize that a solution for the \ac{SISO} scenario directly provides a \emph{naive} \ac{MIMO} solution (by applying $M$ independent estimators).
\subsection{Basic Example: \acf{LoS} Model}
\label{sec:siso-LoS}
If we consider a pure \ac{LoS} scenario with distance dependent pathloss, the \ac{UL} and \ac{DL} channel impulse responses for a distance $d$ between both transceivers are given by
\begin{align}
\label{eq:UplinkDownlinkEq}
h_\text{UL}(d) &= \left(\frac{c}{4\pi f_{\text{UL}}d}\right)^\beta e^{-j2\pi f_\text{UL} \frac{d}{c}}\\
h_\text{DL}(d) &= \left(\frac{c}{4\pi f_{\text{DL}}d}\right)^\beta e^{-j2\pi f_\text{DL} \frac{d}{c}}
\end{align}
where $\beta>2$ is a pathloss exponent and $c$ is the speed of light.
In this scenario, we do not use \ac{OFDM} channel coefficients, since there is only a single \ac{LoS} path, resulting in a system which is already frequency flat.
Therefore, we only consider one channel coefficient for each $f_\text{UL}$ and $f_\text{DL}$, respectively.
We also denote the \ac{UL}/\ac{DL} band separation as $\Delta f = f_\text{DL} - f_\text{UL}$ in the following.
Since the underlying channel function is known in this example, there are several approaches to tackle the task of estimating $h_\text{DL}$ from $h_\text{UL}$.
\subsubsection{Classic analytical channel estimation}
It is apparent from \eqref{eq:UplinkDownlinkEq} that the absolute value of $|h_\text{UL}|$ is only dependent on $d$.
Thus, the only difficulty is to predict the distance $d$ of $h_\text{UL}$ based on the magnitude of $h_\text{UL}$.
Since $d=\frac{c}{4\pi f_\text{UL} |h_\text{UL}(d)|^{\frac1\beta}}$, we have
\begin{align}
h_\text{DL}(d) = \left(\frac{f_{\text{UL}}}{f_{\text{DL}}}\right)^\beta |h_\text{UL}(d)| \exp \left( -j \frac{f_{\text{DL}}}{2f_{\text{UL}}|h_\text{UL}(d)|^{1/\beta}} \right). \label{eq:los-uldl}
\end{align}
This means that a \ac{NN} only needs to learn a mapping of the form $f(x) = x e^{-jK|x|^{-\frac1\beta}}$
(and the distance $d$) from the observations, which is clearly possible provided that enough training samples $\{(\vec{h}_{\text{UL},1},\vec{h}_{\text{DL},1}),\dots,(\vec{h}_{\text{UL},N},\vec{h}_{\text{DL},N})\}$ are available.
Note that this approach only works as a baseline for the pure \ac{LoS} scenario.
\subsubsection{Wiener filter estimation}
A classic approach to estimate \ac{CSI} in time and frequency domain is the Wiener filter (also referred to as \ac{LMMSE} estimator) \cite{780524}.
The Wiener filter coefficients are defined as
\begin{equation}
\vec{c}_\text{LMMSE} = \left(\vec{R}_\text{UL,UL} + \sigma^2 \bf{I} \right)^{-1} \mathbb{E}\left[\vec{h}_\text{UL} \vec{h}_\text{DL}^\text{H} \right]
\end{equation}
with noise variance $\sigma^2$ (complex noise samples) and
\begin{equation}
\vec{R}_\text{UL,UL} = \mathbb{E}\left[\vec{h}_\text{UL} \vec{h}_\text{UL}^\text{H} \right].
\end{equation}
To estimate unknown \ac{CSI}, we match the closest known validation $\vec{h}_{\text{UL}}$ point to the current test point $\vec{h}'_{\text{UL}}$ by using the correlation and by taking its filter coefficients $\vec{c}'_\text{LMMSE}$ to estimate
\begin{equation}
\hat{\vec{h}}_\text{DL} = {\vec{c}^{'\text{H}}_\text{LMMSE}} \vec{h}'_\text{UL}.
\end{equation}
\subsubsection{NN-prediction approach}
The fact that there exists a function \eqref{eq:los-uldl} that analytically solves this toy case, the universal approximation theorem \cite{cybenko1989approximation} tells us that there exists a \ac{NN} that can approximate, or \emph{learn}, this function arbitrary well.
We therefore use a basic \ac{NN} structure (shown in Table~\ref{tab:NN-LoS-SISO}) based on feed-forward dense layers to solve this task.
\begin{table}[H]
\centering
\caption{\ac{NN} architecture for \ac{LoS} experiments}
\begin{tabular}{c|c|c}
Layers: & Trainable parameters & Output dimensions \\
\hline
Input & 0 & 2 (Re/Im) \\
Dense & \num{384} & 128 \\
Dense & \num{33024} & 256 \\
Dense & \num{263168} & 1024 \\
Dense & \num{26400} & 256 \\
Dense & \num{32896} & 128 \\
Dense & \num{258} & 2 (Re/Im) \\
\end{tabular}
\label{tab:NN-LoS-SISO}
\end{table}
The \ac{NN} receives a single channel coefficient $h_\text{UL}$ as input and predicts the corresponding single channel coefficient $h_\text{DL}$ as output.
We train this \ac{NN} with samples created according to \eqref{eq:UplinkDownlinkEq}, where the \ac{UE} is randomly positioned within a radius ranging from \SI{100}{\metre} to \SI{200}{\metre} around the \ac{BS}.
Also, the results are inferred on random positions within this range.
\vskip2mm
We evaluate all three aforementioned approaches with 5,000 randomly positioned samples (\acp{UE}) based on the \ac{LoS} pathloss model \eqref{eq:UplinkDownlinkEq} and test all approaches on predicting the correct $h_\text{DL}$ from the given $h_\text{UL}$.
Then, we take the previously described \ac{BER} metric with predictions $\hat{h}_\text{DL}$ to precode/equalize \ac{QPSK} symbols transmitted over the actual channel characterized by $h_\text{DL}$.
\begin{figure}[H]
\centering
\includegraphics{NN-CSI-estimation-figure2.pdf}
\caption{\ac{BER} curves of different estimation approaches in the \ac{LoS} scenario; the \ac{NN} is trained with 4,500 samples.}
\label{fig:Comp-Est-BER-SISO_LoS}
\end{figure}
Fig~\ref{fig:Comp-Est-BER-SISO_LoS} shows the results for a \ac{UL}/\ac{DL} band separation of $\Delta f= f_\text{DL}- f_\text{UL} =\SI{1}{\mega \hertz}$ and $\Delta f= \SI{25}{\mega \hertz}$, respectively.
As expected, the analytical solution leads to optimal results, hence coincides with the uncoded \ac{QPSK} \ac{BER} curve (the same holds for the Wiener filter at $\Delta f= \SI{1}{\mega \hertz}$).
However, the more interesting observation is that the Wiener filter only works well for $\Delta f= \SI{1}{\mega \hertz}$, but not for $\Delta f=\SI{25}{\mega \hertz}$.
Intuitively, this can be explained by the fact that the Wiener filter needs to extrapolate the \ac{DL} \ac{CSI} from only one specific \ac{UL} \ac{CSI} sample depending on the actual position.
The autocorrelation matrix does not contain the spatial dependencies and, thus, the classical Wiener filter approach \emph{fails} for most tasks.
Unfortunately, to the best of our knowledge, this is the best estimator for extrapolation in frequency domain (without any further channel sparsity assumption).
The \ac{NN}, on the other hand, achieves optimal results for $\Delta f=\SI{1}{\mega \hertz}$, however, shows some degradation for $\Delta f=\SI{25}{\mega \hertz}$.
This degradation can easily be reduced by supplying more training samples.
By limiting the amount of training samples to only 4,500 for both the $\Delta f= \SI{1}{\mega \hertz}$ separation and the $\Delta f= \SI{25}{\mega \hertz}$ separation, we can see that predictions on a close-by frequency band ($\Delta f= \SI{1}{\mega \hertz}$) are \emph{easier} for the \ac{NN}.
We also achieved optimal prediction results for $\Delta f= \SI{25}{\mega \hertz}$ in this simple \ac{LoS} toy case scenario after training the \ac{NN} with $\geq$10,000 samples.
Contrary to the analytical solution, the \ac{NN} approach is completely independent of knowing the underlying channel model, whereas the analytical solution only works for this simple \ac{LoS} model.
\begin{figure}[H]
\centering
\includegraphics{NN-CSI-estimation-figure3.pdf}
\caption{NMSE versus number of training points and different frequency band separations $\Delta f$.}
\label{fig:Influe-NbPoints-Deltaf}
\end{figure}
Fig.~\ref{fig:Influe-NbPoints-Deltaf} shows the influence of different amounts of training samples for $\Delta f=\SI{15}{\mega \hertz}$ and $\Delta f=\SI{25}{\mega \hertz}$, respectively.
It takes about 400 to 600 different samples during training for the \ac{NN} to start to generalize.
Obviously, a larger frequency band separation $\Delta f$ between \ac{UL} and \ac{DL} also requires a higher number of training samples to sufficiently solve the task, as the relation between input and label appears to be more \emph{random} from the \acp{NN}'s point-of-view.
Intuitively, this can be explained due to periodicity of the phase rotation in \eqref{eq:UplinkDownlinkEq}, causing the same input phase to be projected onto more than one output phase.
Therefore, the single most relevant variable, that is, the amplitude, needs to be estimated more precisely for larger band separation $\Delta f$.
\subsection{Simulated Results: Standardized Channel Models}\label{sec:siso_sim_soph}
Next, we evaluate \ac{NN}-based channel prediction in a more realistic setting using standardized channel models provided by the Quadriga framework \cite{Jaeckel2014}, such as the \emph{Winner II}, \emph{3GPP} and \emph{Berlin} model.
\begin{figure}[H]
\centering
\includegraphics{NN-CSI-estimation-figure4.pdf}
\caption{Spatial simulation area for different channel models.}
\label{fig:SISO-Quad-SimArea}
\end{figure}
The simulation setup is depicted in Fig.~\ref{fig:SISO-Quad-SimArea}.
We use the channel models to simulate the \ac{CSI} at $f_\text{UL}$ and $f_\text{DL}$ between a fixed \ac{BS} and a \ac{UE} at random spatial positions within the same environment.
An area of $400m^2$ is simulated with an average distance per spatial \ac{UE} position of $\sim 12.5cm$ resulting in 22,500 samples.
Per \ac{UE} position, we estimate the channel for two different frequency band separations ($\Delta f=\SI{25}{\mega \hertz}$, $\Delta f=\SI{50}{\mega \hertz}$) between $f_\text{UL}$ and $f_\text{DL}$.
For this, we use an \ac{OFDM} system with 1024 subcarriers and a \ac{CP} length of 256 symbols with two dipole antennas at frequency bands centered around \SI{1.25}{\giga \hertz} and \SI{1.275}{\giga \hertz} (\SI{1.3}{\giga \hertz} for $\Delta f=\SI{50}{\mega \hertz}$, respectively) with a bandwidth of $B=\SI{20}{\mega \hertz}$ for both the UL and DL frequency band.
Note that it is necessary to enable Quadriga's \emph{spatial consistency} parameter to ensure that the simulation environment, i.e., positions of scatterers, does not change when the \ac{UE} changes its position.
Random realizations of different environments would render the channel prediction task impossible, as the \ac{NN} would not be able to learn an underlying physical channel scattering behavior.
For all \ac{SISO} results, the antenna geometry does not need to be considered and, thus, we only use 1-D convolutional layers in our \acp{NN}.
The hyperparameters of this \ac{SISO} \ac{NN} structure, as described in Tab.~\ref{tab:SISO-Quadriga-NNLayout}, was trained at an \ac{SNR}=$\Vert \vec{h} \Vert^2_\text{2}/2\sigma^2$ of \SI{10}{\decibel}, where $\sigma^2$ is the noise variance.
\begin{table}[H]
\centering
\caption{\ac{NN} architecture for \ac{SISO} experiments}
\begin{tabular}{c|c|c}
Layers: & Trainable parameters & Output dimensions \\
\hline
Input & 0 & 1024 x 2 (Re/Im) \\
Conv1D & \num{416} & 1024 x 32 \\
Average Pooling & \num{0} & 256 x 32 \\
Conv1D & \num{3088} & 256 x16 \\
Average Pooling & \num{0} & 64 x16 \\
Flatten & \num{0} & 1024 \\
Dense & \num{131200} & 128 \\
Dense & \num{16512} & 128 \\
Dense & \num{16512} & 128 \\
Dense & \num{264192} & 2048 \\
Reshape & \num{0} & 1024 x2 (Re/Im) \\
\end{tabular}
\label{tab:SISO-Quadriga-NNLayout}
\end{table}
\begin{figure}[H]
\centering
\includegraphics{NN-CSI-estimation-figure5.pdf}
\caption{\ac{NN}-based \ac{CSI}-prediction: correlation coefficient versus \ac{SNR} with different \ac{SISO} channel models at band separations $\Delta f=\SI{25}{\mega \hertz}$ (a) and $\Delta f=\SI{50}{\mega \hertz}$ (b).}
\label{fig:SISO-Corre-25MHz}
\end{figure}
Fig.~\ref{fig:SISO-Corre-25MHz} shows the correlation coefficient $\delta_h$ for a frequency band separation of $\Delta f=\SI{25}{\mega \hertz}$ (left) and $\Delta f=\SI{50}{\mega \hertz}$ (right) between the \ac{UL} and \ac{DL} versus the \ac{SNR}.
As can be seen, the \ac{NN} estimator (see Table~\ref{tab:SISO-Quadriga-NNLayout}) is able to predict the \ac{CSI} for these standardized channel models, and the \ac{NN} can generalize over a wide range of different \acp{SNR}.
In the \ac{LoS} scenario, all three different channel models lead to a reasonable performance ($\delta_h$ $\geq$ 0.8) by the \ac{NN}.
Simulations on spectral efficiency (shown later in Section~\ref{sec:mimo}) indicate that a correlation coefficient of $\delta_h=0.8$ results in an \ac{MRT} sum-rate performance loss of less than 10\%.
For the \emph{3GPP} model, the \acp{NN} performance is very similar for both the \ac{LoS} and \ac{NLoS} scenario in terms of the correlation metric.
Although the performance is worse for the \ac{NLoS} scenario with the \emph{Berlin} model, a generalization of the \ac{NN} can still be observed, resulting in a correlation coefficient of $\delta_h\sim0.6$.
The prediction does not work at all for the \ac{NLoS} scenario with the \emph{Winner II} model.
As already mentioned concerning the \emph{spatial consistency} parameter, the variations among the results of the three models can be explained by the differences between the channel models themselves:
\begin{itemize}
\item The 3GPP model uses consistency in both the spatial domain and the frequency domain in accordance to 3GPP 38.901 v14.1.0.
Therefore, the \ac{NN} can predict between close frequencies.
\item Since the Winner II model is not based on this feature \cite{Jaeckel2014}, the \ac{NN} can only learn the environment in a more or less frequency flat scenario (\ac{LoS}).
\item Although the \ac{NLoS} Berlin model is based on measurements (from which parameters were extracted, which were then used to re-simulate the measurement results) the model relies mainly on statistics rather than on actual environments (scatterers).
Thus, an underlying frequency dependency does probably not exist in this model.
\end{itemize}
As expected, when the frequency band separation increases to $\Delta f$=\SI{50}{\mega \hertz}, the correlation coefficient decreases.
Although the \ac{NN}-based prediction still works in the \ac{LoS} scenarios, no meaningful prediction can be provided for the \ac{NLoS} scenario due to a weaker frequency dependency between \ac{UL} and \ac{DL}.
However, a larger training dataset may further improve the performance.
Note again that the Wiener filter-based approach fails for all investigated scenarios.
\begin{figure}[H]
\centering
\includegraphics{NN-CSI-estimation-figure6.pdf}
\caption{Illustration of \ac{NN}-based channel prediction for varying \acp{SNR}, 3GPP 38.901 \ac{LoS} channel model.}
\label{fig:Illust-Prediction-of-simChans}
\end{figure}
To better illustrate the impact of the correlation coefficent, Fig.~\ref{fig:Illust-Prediction-of-simChans} shows a visualization of the prediction outcome and the corresponding ground truth for the \emph{3GPP} 38.901 model versus different \ac{SNR}, while the \ac{NN} was trained at SNR = \SI{10}{\decibel}.
Note that the channel can be accurately predicted between \ac{UL} and \ac{DL} frequency bands for positive values of the SNR (in dB).
Thus, as a first major result of this paper, we show that the proposed \ac{NN} architecture can predict the \ac{DL} \ac{CSI} for the \ac{SISO} scenario.\footnote{We want to emphasize that such a \ac{SISO} result directly enables naive \ac{MIMO} implementation by using $M$ independent estimators.}
\subsection{Measurement data: SISO}\label{sec:Meas-SISO}
Although the previously introduced channel models provide quite realistic test cases, and their properties have been verified through measurements by multiple independent research groups, the question whether \ac{DL} channel prediction works on \emph{actually measured} channels still remains open.
One should keep in mind that most channel models are built for system performance evaluation where exact position-dependent precision is typically unnecessary.
Further, we expect many hardware impairments in a practical system, which are difficult to cover in model-based approaches.
To address these issues, we evaluate the \ac{NN} prediction performance on measured channels, as described next.
\begin{figure}[]
\centering
\includegraphics[width=0.5\textwidth]{SISOLink.png}
\caption{Setup for the \ac{SISO} link measurement.}
\label{fig:MeasurementSetupSISOLink}
\end{figure}
To measure any combination of \ac{UL} and \ac{DL} frequencies, two \acp{USRP} (B200 + B210) \cite{USRP} are synchronized and combined on a single antenna as shown in Fig.~\ref{fig:MeasurementSetupSISOLink}.
A single antenna is needed to ensure the exact same distance $d$ between the transceivers.
Typically, \ac{FDD} systems also use the same antenna (in this case a horizontally polarized dipole) for \ac{UL} and \ac{DL} transmissions.
The \acp{USRP}s transmit at \SI{1.25}{\giga \hertz}, \SI{1.275}{\giga \hertz} and \SI{1.3}{\giga \hertz}, respectively, with \SI{20}{\mega \hertz} bandwidth each.
The radio signal is transmitted over the channel, received with the horizontally polarized dipole antenna and then sampled at the carrier frequency by a wideband digital oscilloscope.
\ac{UL} and \ac{DL} transmissions are then separated by an offline signal processing step (filtering).
An extension to multiple (\ac{MIMO}) receiver antennas is straightforward (see \cite[daughterboard concept]{Arnold2018}).
\begin{figure}[H]
\centering
\subfloat[Indoor measurement scenario]{\includegraphics{NN-CSI-estimation-figure7.pdf}}
\subfloat[Outdoor measurement scenario]{\includegraphics{NN-CSI-estimation-figure8.pdf}}
\caption{Measurement scenarios: a) indoor b) outdoor.}
\label{fig:MeasurementScenarios}
\end{figure}
To evaluate the performance in different scenarios, we distinguish between indoor and outdoor environments (see Fig.~\ref{fig:MeasurementScenarios}).
Note that, the same scenarios are also used for the \ac{MIMO} setup later in Section~\ref{sec:mimo}.
The indoor measurements include an \ac{LoS} environment, consisting of our institute's hallway, and an \ac{NLoS} environment, represented by typical office space.
Both indoor measurements were conducted within a static environment (at night), i.e., the environment did not change significantly during the measurements.
The covered area is about \SI{200}{\metre \squared} in the \ac{LoS} scenario and about \SI{80}{\metre \squared} in the \ac{NLoS} scenario.
For the outdoor measurement, a typical Rician fading scenario can be expected, in a campus environment with tall buildings surrounding the measured area of about \SI{250}{\metre \squared}.
We acquired 4,000 measurement samples per scenario.
All positions were measured in a meander-like path, however, the samples were randomly permuted during training, i.e., training and validation data were randomly selected from the entire area (90\% training and 10\% validation).
\begin{figure}[H]
\centering
\includegraphics{NN-CSI-estimation-figure9.pdf}
\caption{\ac{CDF} of the received \ac{SNR} for different measurement scenarios.}
\label{fig:SISO-Meas-SNR}
\end{figure}
To verify the measurement data, Fig.~\ref{fig:SISO-Meas-SNR} depicts the acquired channel quality.
The \ac{SNR}, calculated using the \ac{EVM} for all measurements, is around \SI{20}{\decibel} and, thus, accurate channel predictions are possible.
The different noise figures are caused by the two different \ac{USRP} devices.
\begin{table}[H]
\centering
\caption{Results of \ac{SISO} channel prediction for measured data}
\begin{tabular}{c|c|c|c}
$\Delta f$ & Indoor \ac{LoS} & Indoor \ac{NLoS} & Outdoor \ac{LoS} \\
\hline
\multirow{ 2}{*}{\SI{25}{\mega \hertz}} & $\delta_{h}$=0.95 & $\delta_{h}$=0.80 & $\delta_{h}$=0.93 \\
& NMSE=\SI{-20}{\decibel} & NMSE=\SI{-17}{\decibel} & NMSE=\SI{-23}{\decibel} \\ \hline
\multirow{ 2}{*}{\SI{50}{\mega \hertz}} & $\delta_{h}$=0.90 & $\delta_{h}$=0.77 & $\delta_{h}$=0.87 \\
& NMSE=\SI{-19}{\decibel} & NMSE=\SI{-14}{\decibel} & NMSE=\SI{-21}{\decibel} \\
\end{tabular}
\label{tab:Res-Meas-SISO}
\end{table}
\noindent
The results, in Table~\ref{tab:Res-Meas-SISO}, show that the \ac{NN} achieves reasonable precision for all scenarios studied.
As expected the indoor \ac{NLoS} scenario is worse when compared to the corresponding \ac{LoS} scenario, but, still, in a reasonable range.
One must keep in mind that these results are based on actual measurements including several impairments, e.g., caused by hardware tolerances and quantization effects.
Thus, the used labels (i.e., measured CSI) are already compromised by noise and distortion stemming from an imperfect (but unavoidable) measurement setup.
Again, the prediction quality in all three environments turns out to be sufficiently good, suggesting deployment of the proposed system in a real world physical channel in the \ac{SISO} context.
\section{\ac{MIMO} \ac{UL}-\ac{DL} channel prediction}
\label{sec:mimo}
Next, we consider the practically more relevant \ac{MIMO} scenario, i.e., we assume multiple antennas at the \ac{BS} and try to enable \ac{FDD} Massive \ac{MIMO}, without the need of imposing any sparsity constraint on the channel.
Although multiple trained \ac{SISO} estimators can be stacked to build such a \ac{MIMO} system, we want to study whether true \ac{MIMO} signal processing (i.e., exploration of correlations between antennas) can further improve prediction accuracy.
\subsection{System Model}
We consider a single-antenna \ac{UE} and a \ac{BS} equipped with $M$ antennas.
We denote the \ac{UL} and \ac{DL} channels from the \ac{UE} to the $m$-th antenna of the \ac{BS} by $\vec{h}^{(m)}_\text{UL}\in\mathbb C^{N_\text{sub}}$ and $\vec{h}^{(m)}_\text{DL}\in\mathbb C^{N_\text{sub}}$, for $m=1,\dots,M$, respectively.
The investigations of Section \ref{sec:siso} are extended to the \ac{MIMO} system model in the following.
\subsection{Simulated \ac{LoS} Model}
Similar to Section \ref{sec:siso-LoS}, we first investigate the performance of a simple \ac{LoS} Massive \ac{MIMO} system.
To verify whether the channel prediction limits the gain of the linear precoding scheme, the classic \ac{MRT} is investigated.
The received signal per subcarrier $k$ is defined as
\begin{equation}
y_{\it{k}} = \vec{h}_{\it{k}}\vec{w}_{\it{k}}^Hs_{\it{k}} + \vec{n}_{\it{k}}
\end{equation}
where $\vec{w}_{\it{k}}$ is the $1\times M$ linear precoding vector, $\vec{h}_{\it{k}}$ is the $1\times M$ channel vector, $s_{\it{k}}$ is the transmitted \ac{QPSK} symbol and $\bf{n}_{\it{k}}$ is the $1\times 1$ additive white Gaussian noise vector.
The linear precoder for \ac{MRT} is defined as
\begin{equation}
\vec{w}_{\it{k}} = \frac{\hat{\vec{h}}_{\it{k}}}{\Vert \hat{\vec{h}}_{\it{k}}\Vert_\text{2}}.
\end{equation}
We use the same settings as in Section \ref{sec:siso} with $\Delta f=\SI{25}{\mega \hertz}$ and a \ac{NN} as depicted in Table~\ref{tab:NN-LoS-SISO} (extended to the current number of antennas $M$).
We observe a growing training complexity, yet the required amount of data points does not increase with the number of antennas.
Intuitively, this can be explained by the fact, that (per antenna) the problem itself has similar complexity as in the \ac{SISO} scenario.
However, due to the increased input dimensions, the task of finding an underlying structure
from observations becomes more complex for larger input dimension (\emph{more randomness} in the input).
\begin{figure}[H]
\centering
\includegraphics{NN-CSI-estimation-figure10.pdf}
\caption{\ac{NN}-based \ac{CSI} prediction: \ac{BER} curves for \ac{LoS} \ac{MIMO}.}
\label{fig:MIMO-BER-LoS}
\end{figure}
The \ac{BER} curves in Fig.~\ref{fig:MIMO-BER-LoS} show the expected \SI{3}{\decibel} gain whenever the number of antennas is doubled.
Also, the analytical \ac{BER} curve matches with the simulated 1$\times$1 curve.
Unfortunately, the joint prediction does not seem to improve performance (same \ac{NMSE} per antenna as in the \ac{SISO} scenario), indicating that the \ac{NN} does not benefit from multiple antennas (only from \ac{MRT})
This could be explained by the fact that the antennas are assumed to be uncorrelated and, thus, each antenna needs to be predicted by itself, as the positions are also uncorrelated.
\subsection{Results for standardized \ac{MIMO} channel models}
We now extend our \ac{NN} model as given in Table~\ref{tab:MIMO-NN-Quadrigra} to the \ac{MIMO} input.
A rectangular 8$\times$8 patch antenna array is used for all simulated scenarios (8$\times$4 for the measurement scenarios) and the \ac{UL}/\ac{DL} band separation is $\Delta f=\SI{25}{\mega \hertz}$.
\begin{table}[H]
\centering
\caption{\ac{NN} architecture for \ac{MIMO} experiments}
\begin{tabular}{c|c}
Layers: & Output dimensions \\
\hline
Input & $M$ x 1024 x 2 (Re/Im) \\
Conv1D & 1024 x 32 \\
Average Pooling & 256 x 32 \\
Conv1D & 256 x16 \\
Average Pooling & 64 x16 \\
Flatten & 1024 \\
Dense & 16 \\
Dense & 32 \\
Dense & 64 \\
Dense & $M$ $\cdot$ 2048 \\
Reshape & $M$ x 1024 x2 (Re/Im) \\
\end{tabular}
\label{tab:MIMO-NN-Quadrigra}
\end{table}
Obviously, the amount of trainable parameters increases from $\sim$400,000 weights to approximately 8 million weights caused by the increased input dimensionality ($M$ antennas instead of 1).
However, somewhat to our surprise, experiments conducted with 2-D \ac{CNN} structures did not yield a significant improvement in prediction performance (occasionally even slightly worse).
One potential explanation is that, with an increased number of antennas, the environment complexity also increases, as the number of scatterers can be different.
\begin{figure}[H]
\centering
\includegraphics{NN-CSI-estimation-figure11.pdf}
\caption{NN-based CSI-prediction: correlation coefficient versus SNR with different number of antennas in 3GPP \ac{LoS}.}
\label{fig:MIMO-Corre-25MHz}
\end{figure}
The influence of different numbers of antennas on the correlation coefficient is depicted in Fig.~\ref{fig:MIMO-Corre-25MHz} for the 3GPP \ac{LoS} scenario; the training \ac{SNR} was fixed to \SI{10}{\decibel}.
It can be seen that the correlation coefficient for higher \ac{SNR} only changes slightly, but the system becomes more robust against noise with an increasing number of antennas.
Note that, due to the way we select the antennas from our dataset (without changing the aperture size), the results for 64/32 and 16/8 are similar.
\begin{figure}[H]
\centering
\includegraphics{NN-CSI-estimation-figure12.pdf}
\caption{NN-based CSI-prediction: correlation coefficient versus \ac{SNR} with different \ac{MIMO} channels using 64 antennas.}
\label{fig:MIMO-Models-25MHz}
\end{figure}
Fig. \ref{fig:MIMO-Models-25MHz} shows the correlation coefficient over \ac{SNR} for different Massive \ac{MIMO} channel models.
As can be seen, the prediction performance is comparable to the performance achieved in the \ac{SISO} scenario.
The prediction accuracy for the 3GPP model is within a reasonable region as the previously described margin of a correlation coefficient of $\delta_h=0.8$ is reached.
Moreover, the predictions for the \ac{NLoS} ``Berlin'' scenario show a better performance than their \ac{SISO} counterparts, as, potentially, antennas correlations could be exploited.
We note the second major result of this paper: The proposed \ac{NN} architecture can predict the \ac{DL} \ac{CSI} for the \ac{MIMO} scenario with a \ac{UL}/\ac{DL} band separation of $\Delta f=\SI{25}{\mega \hertz}$ (without requiring sparsity) and, therefore, enables \ac{FDD} Massive \ac{MIMO} for a wide range of different channels.
\subsection{Results for actually measured \ac{MIMO} channels}
To further illustrate the scheme's robustness against hardware impairments, we use the same measurement scenarios as in Section \ref{sec:Meas-SISO}, but now for the \ac{MIMO} case.
The \emph{subband} approach, introduced in \cite{Arnold2018}, allows us to measure ``Massive'' \ac{MIMO} with 32 Antennas arranged in a 8$\times$4 patch array configuration.
\begin{figure}[H]
\centering
\includegraphics{NN-CSI-estimation-figure13.pdf}
\caption{\ac{CDF} of the \ac{SNR} for different measurement scenarios.}
\label{fig:MIMO-SNR-Invest}
\end{figure}
Fig. \ref{fig:MIMO-SNR-Invest} shows the \ac{CDF} of the \ac{SNR} for all antennas, and for all three measurement scenarios, respectively.
The \ac{SNR} is, on average, around \SI{25}{\decibel} resulting in useful datasets of around 5,000 spatial points per scenario.
To evaluate the \ac{NN}'s prediction performance for this practical system we investigate the spectral efficiency by using different precoding schemes and numbers of users $N_\text{Users}$.
The received signal signal of all \acp{UE} on the $k$th subcarrier is given by
\begin{equation}
\vec{y}_{k,\text{RX}}=\vec{H}_k \frac{\vec{W}_k}{\Vert \vec{W}_k \Vert_\text{F}} \vec{x}_k + \vec{n}_k
\end{equation}
where $\vec{x}_k$ is the $N_\text{Users} \times1$ transmit vector at subcarrier $k$, $\vec{H}_k$ is the $N_\text{Users} \times M$ channel matrix stacked with the channel vectors $\vec{h}_{k,1..N_\text{Users}}$, $\vec{W}_k$ is the $M \times N_\text{Users}$ precoding matrix, $\vec{n}_k$ is the $N_\text{Users} \times 1$ complex gaussian noise vector, and $\vec{y}_{\text{RX}}$ is the $N_\text{Users}\times1$ receive vector.
We precode on $N_\text{Users}$ randomly picked \ac{UE} positions of the dataset, with \acf{MRT}
\begin{equation}
\vec{W}_{k,\text{MR}} = \hat{\vec{H}}_k^{\text{H}}
\end{equation}
and, alternatively, \ac{ZF} precoding
\begin{equation}
\vec{W}_{k,\text{ZF}} = \hat{\vec{H}}_k^H \left(\hat{\vec{H}}_k \hat{\vec{H}}_k^H \right)^{-1}
\end{equation}
respectively.
With this definition, the \ac{SINR} per user $u$ can be computed as
\begin{equation}
\text{SINR}_k(u)=\frac{\left\Vert \vec{h}_{k,u} \vec{w}_{k,u}\right\Vert^{2}_\text{2}}{\sum_{j=1,\,j\neq u}^{N_\text{Users}}\left\Vert \vec{h}_{k,u} \vec{w}_{k,j}\right\Vert^{2}_\text{2}+\sigma^2}.
\end{equation}
where $\text{SINR}_{k}(u)$ is the \ac{SINR} per user $u$.
The effective sum-rate is then calculated as
\begin{equation}
R =\frac{1}{N_\text{sub}}\sum_{k=0}^{N_\text{sub}-1}\sum_{u=1}^{N_\text{Users}} \log_{2}\left(1+{\text{SINR}}_{k}(u)\right).
\end{equation}
\begin{figure}[H]
\centering
\includegraphics{NN-CSI-estimation-figure14.pdf}
\caption{Simulated sum-rate versus number of antennas for the measured \ac{LoS} and \ac{NLoS} scenarios in the case of \ac{MRT} on two users; no \ac{DL} pilots used.}
\label{fig:MIMO-Meas-Sumrate}
\end{figure}
The effective sum-rate based on the \ac{NN}'s predictions is given for all three scenarios in Fig.~\ref{fig:MIMO-Meas-Sumrate}.
We precode on two users with \ac{MRT} and try to separate them.
Note that the presented upper bound is based on the measured \ac{CSI} of the \ac{DL} frequency band, i.e., includes all hardware impairments plus noise (\ac{SNR}=\SI{10}{\decibel}).
It is, thus, not achievable with a genuine \ac{TDD} system, even if we assume perfectly reciprocal hardware.
Observe that the sum-rate based on our \ac{NN}'s predictions is only slightly worse ($\leq$10\%) than the TDD-bound in both \ac{LoS} scenarios, and is still acceptable ($\leq$20\%) in the \ac{NLoS} scenario,
reaffirming that the \ac{NN}-based system is a viable solution to enable \ac{FDD} Massive \ac{MIMO}.
Furthermore it is a notable advantage that non-reciprocal hardware chains, like the one we used for these measurements, will directly be learned by our proposed \ac{NN}-based prediction system.
This means that reasonable spectral efficiency can be reached without perfectly reciprocal hardware.
\begin{figure}[H]
\centering
\includegraphics{NN-CSI-estimation-figure15.pdf}
\caption{Simulated sum-rate versus number of antennas for the measured \ac{LoS} and \ac{NLoS} scenarios in the case of \ac{ZF} precoding on two users; no \ac{DL} pilots used.}
\label{fig:MIMO-Meas-Sumrate_ZF}
\end{figure}
Fig.~\ref{fig:MIMO-Meas-Sumrate_ZF} provides results for the stricter case of \ac{ZF} precoding on two users with an \ac{SNR} of \SI{10}{\decibel}.
Since \ac{ZF} precoding tries to orthogonalize the users by forcing the interference to zero, a slight mismatch does have a more dramatic effect than in the simpler case of \ac{MRT}.
As can be seen, the \ac{ZF} sum-rate based on the \ac{NN}'s predictions is, again, only slightly worse ($\leq$20\%) than the TDD upper bound in both \ac{LoS} scenarios, and is still working ($\leq$45\% worse) in the \ac{NLoS} scenario.
There are several further improvements to the system at hand that may be considered in the future: a recurrent \ac{NN} could be used, an investigation into the sample density could be done, hyperparameter tuning of the \ac{NN} should be considered and a revision of the measurement setup could provide cleaner training data at even higher SNR.
Moreover, including the covariance matrix as expert knowledge could further improve the system performance.
\section{Conclusion and Outlook}\label{sec:conclusions}
We introduced a \ac{NN}-based scheme for extrapolating \ac{DL} \ac{CSI} from observed \ac{UL} \ac{CSI} in both \ac{SISO} and \ac{MIMO} scenarios, using simulated as well as actually measured channels.
The new scheme outperforms the classic Wiener filter-based approach, and, even more so, allows to operate the system in cases where the Wiener filter would fail.
Quantitatively, the \ac{NN}-based channel prediction method leads to a spectral efficiency loss
of only $\sim$15\% in a two-user \ac{MRT} setting when compared to a \ac{TDD}-based system that is (unrealistically) assumed to be \emph{perfect} in terms of hardware reciprocity and, thus, \ac{DL} channel estimation.
Obviously, it is key to have a large training dataset available and, by its very nature, additional retraining may be required whenever the radio environment changes significantly.
It remains open for future research to further improve the \ac{NN} architecture, e.g., by using recurrent \acp{NN}, by investigating the required sample density, by applying a Kalman filter to tackle time correlation, or by adding covariance matrix knowledge to the system.
To facilitate follow-up studies, all channel measurements as well as all simulated data will be made publicly available so that results can be reproduced and improved as research in this
practically highly relevant topic further progresses\footnote{\emph{link available after review}}.
\bibliographystyle{IEEEtran}
| {'timestamp': '2019-01-14T02:21:41', 'yymm': '1901', 'arxiv_id': '1901.03664', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03664'} | arxiv |
\section{Intruduction}
Microblogging sites such as Twitter has become a popular medium for users to express their opinion and respond to different situations. Therefore, tweets can be an important source of causality information between events and this information might play an important role in predictive event analytics. For example, the following tweet ``\textit{\textbf{A disruption in bus service in Gold Coast} due to \textbf{lack of communication between translink and event organizers}}" contains two causally related events. From this tweet it can be said that the ``lack of communication" was a cause of transport service disruption in Gold Coast. This information could be applied in prescriptive analytics by the decision makers to reduce the chance of a future transport disruption during public gatherings. Causality information can also be applied to improve automated \textit{why} question answering. For example, we can answer the question ``Why Sally Pearson is not participating today?" from the event causality information extracted from the following tweet, ``\textit{\textbf{A knee injury} caused \textbf{Sally Pearson to quit the competition}}". The uses of the above event causalities in predictive event analytics based applications are visualized in Fig. \ref{fig:app-scenerios}.
\begin{figure}
\centering
\includegraphics[scale=0.55]{app_scenario.pdf}
\vspace{-1ex}
\caption{Application of automatic event causality detection in \emph{why} question answering and predictive event analysis}
\label{fig:app-scenerios}
\vspace{-3ex}
\end{figure}
The extraction of causal relationships is an evolving area of research \cite{Blanco2008, Do2011, Ciresan2012, Riaz2013, Riaz2014, Mirza2014, Luo2016, Kruengkrai2017}. Existing approaches often apply linguistic rules or commonsense knowledge to identify causal relationship from short text. However, processing tweets is more challenging than normal short text \cite{Ritter2011}. One of the most obvious challenges is that tweets are unstructured and highly informal in nature. Hence, the linguistic rule-based approaches \cite{Luo2016, Sasaki2017}, which depend on grammatical correctness of text, perform poorly on tweets (see section \ref{sec:experiments}). Additionally, the causally related event pairs appear infrequently in tweets and the causal relationship between events lacks context information. Due to this lack of adequate context information, supervised learning based approaches such as \cite{Ponti2017} are not much effective on tweets. In this paper, we propose an automated system to detect causally related event pairs from social media short text, e.g. tweets. In our proposal, we use a feed-forward neural network to detect causal relationship between events to deal with the unstructured nature of the data. To accurately train the model, we propose a context word extension method to enhance the feature set. We extend the event keywords of both candidate causal event and candidate effect event using background knowledge before applying the model. The background knowledge is captured by creating a causal network from news article text using a set of causal cue words. To be specific, the main contributions of this paper are as follows:
\begin{enumerate
\item we propose a novel event context word extension technique that uses commonsense background knowledge extracted from news articles to enhance the feature set;
\item we develop a neural network based event causality detection method to detect causality relationship between events;
\item we perform an extensive experimental evaluation to demonstrate that our proposed event context word extension technique outperforms the method of using only the event keyword and other attribute words; and
\item we also compare the performance of our method with existing methods of causality detection from short text.
\end{enumerate}
The rest of the paper is organized as follows: Section \ref{sec:relatedwork} discuses the related work; Section \ref{sec:problem-formulation} formulates the problem studied in this paper; Section \ref{sec:proposed-metnod} illustrates the proposed method; Section \ref{sec:experiments} discusses the experimental results and finally, Section \ref{sec:conclusion} concludes the paper.
\section{Related Work}
\label{sec:relatedwork}
Causality detection approaches can be categorized into two broad categories: extracting causality between phrases and event-based causality detection. One of the early approaches that identifies explicit, implicit and non-causal relationships between verb-verb pairs is proposed in \cite{Riaz2013}. The authors propose a technique to automatically generate training corpus of causal relationship between verbs. A supervised model is trained on the corpus to predict causal strength between verbs in a pair. Later, in \cite{Riaz2014} the authors extend the previous approach and extract causality relationship between noun-verb pairs. The authors at first identify all the nouns and verbs from a sentence and then apply a supervised classifier to identify causality between grammatically connected noun-verb pairs. For training, the authors use lexical, semantic and structural features. A more recent approach \cite{Luo2016} builds a causality network of terms from a collection of web text. The authors apply linguistic rules, e.g., `A \textit{causes} B' to extract the terms with causal relations. They create a directed graph where each node represents a term, and each edge contains causal co-occurrence score. Finally, the co-occurrence scores between terms in the causal graph are used to compute the causal strength. The final causal relationship is calculated by using the co-occurrence score. This approach is extended by Sasaki et al. \cite{Sasaki2017} for multi-word terms where authors calculated causal strength not only for the pairs of single words but also for the multi-word pairs. Although the above approaches calculate causal strengths between phrases, they do not take events into account.
On the other hand, some approaches extract causal relationship betweenvent pairs. \cite{Do2011} proposes a method that uses distributional probability and discourse connectives to detect event causality. The authors represent events as $p$($a_1$, $a_2$, $a_3$,..., $a_m$), where $p$ denotes the predicate or the trigger word and $a_i$ represents the event attribute. A trigger word can be a \emph{noun} or a \emph{verb}. The authors calculate \emph{cause-effect association} score between a pair of events by calculating causal associations for predicate-predicate, predicate-argument and argument-argument. To calculate predicate-predicate association, the authors use \emph{pointwise mutual information} (PMI) \cite{Chambers2008} score along with \emph{inverse document frequency} (IDF), syntactical distance between predicates and co-occurrence probability. The average PMI score between each pair of terms is calculated to estimate the predicate-argument association. Similarly, the argument-argument association is calculated by multiplying the PMI value for each pair and then, dividing it by the multiplication of number of arguments in the two events. Additionally, the authors identify discourse relation in text using \emph{penn discourse treebank} (PDTB) \cite{Prasad2007}. However, the PMI based approaches are sensitive to co-occurance frequency and do not perform well for infrequent events\cite{turney2010}. Another approach proposed by Mirza \cite{Mirza2014} extracts temporal and causal relationships between events, and assumes that cause must precede the effect and propose a methodology to improve the temporal relation extraction between events. The work also proposes a guideline to annotate the causal relation between events. However, this approach requires dataset to be annotated with entities using their proposed annotation guideline, which is not applicable for social media short text such as tweets.
Recently, Kruengkrai et al. \cite{Kruengkrai2017} propose a method that utilizes background knowledge to determine causal relationship between two candidate events. The authors apply a \emph{multi-column neural network} \cite{Ciresan2012} to extract causal relationship between candidate phrases using archived web text. Word vectors of candidate phrases and background knowledge phrases are used as the features. However, this approach does not consider the spatial and temporal information of events. Another recent approach \cite{Rahimtoroghi2017} proposes to extract everyday events from user-generated text and identify causal relationship between events. The authors use a co-occurrence based technique to generate causal event pairs and calculate the causal strength of an event pair $(e_1, e_2)$ by calculating \emph{causal potential} (CP) as follows.
\begin{equation}
CP(e_1, e_2) = log\frac{P(e_2|e_1)}{P(e_1)} + log\frac{P(e_1\rightarrow e_2)}{P(e_2\rightarrow e_1)}
\end{equation}
Where $e_1$ and $e_2$ are two adjacent events. The adjacency is determined by applying 2-skip bigram model where two events occurring with two or less events are considered adjacent. A similar approach is used in \cite{Khan2017} to identify causal relationship between time series events extracted from computer event logs. The events have unique IDs and they may appear multiple times in the database. Authors exploit item set mining technique to detect pair of events with causal relationship. Then, the causal pairs with same effect event are merged together. Finally, the causal events for each merged relationships are sorted chronologically to generate the causal chain. One drawback of this approach is that it does not consider the causality between cause events while sorting the events for generating the causal chain. An event causality detection approach that is closely related to our approach is proposed by \cite{Ponti2017}, which uses a feed-forward neural network for detecting causality relation between events. The authors propose to enhance the feature set by calculating distances between event trigger word and other words in the sentence. However, for tweets, this positional information might not represent the causal strength properly as tweets often contain noisy characters and words e.g., emojis, hashtags and mentions and therefore, may not be applicable for event causality detection in tweets.
\begin{figure*}
\centering
\begin{adjustbox}{minipage=0.99\textwidth,precode=\dbox}
\includegraphics[scale=0.75]{system_overview.pdf
\end{adjustbox}
\vspace{-1ex}
\caption{An overview of the proposed method}
\label{fig:system-overview}
\vspace{-3ex}
\end{figure*}
\begin{table}[tb]
\setlength{\tabcolsep}{1pt}
\centering
\caption{Representation of Events}
\vspace{-2ex}
\label{tab:event-representation}
\begin{tabular}{|p{4.5cm}|p{4.2cm}|}
\Xhline{3\arrayrulewidth}
\multicolumn{1}{|c|}{\cellcolor{yellow}\textbf{Sentences}} & \multicolumn{1}{c|}{\cellcolor{green}\textbf{Events}} \\ \hline \hline
Storm \textbf{hits} Gold Coast & hit (storm, coast, gold) \\ \hline
Mike \textbf{crashed} his car in Gold Coast & crash (mike, car, coast, gold) \\ \hline
Heavy traffic \textbf{jam} in Gold Coast today & jam (traffic, today, coast, gold) \\ \hline
A \textbf{disruption} in bus service in Gold Coast due to \textbf{lack} of communication &
disruption (service, bus, coast, gold) \newline lack (communication, organizer, translink)\\
\Xhline{3\arrayrulewidth}
\end{tabular}
\vspace{-3.5ex}
\end{table}
\section{Problem Formulation}
\label{sec:problem-formulation}
An event is a set of words that represents the occurrence of a specific incident. The event keyword is the word that actually triggers the event and the event attributes are the words that are syntactically related to the event keyword. Table \ref{tab:event-representation} displays a few example events\footnote{It should be noted that a sentence may have zero or more events.}. An event is considered as \emph{causal} if the event causes another event to occur. The other event is considered as the \emph{effect} of the causal event. For Example, ``\textit{\textbf{A disruption in bus service in Gold Coast} due to \textbf{lack of communication between translink and event organizers}}" contains a causal event and an effect event. In the above example the causal event is `lack of communication' and the effect event is `a disruption in bus service', where \emph{disruption} is the event keyword of the causal event and \emph{lack} is the event keyword of the effect event. In this paper we focus on extracting such causal and effect event pairs from tweets and aim to address the following research question (RQ).
\begin{enumerate}
\setlength{\itemindent}{0.5cm}
\item[\textbf{RQ:}] \textit{How to automatically detect causally related event pairs from social media short texts such as tweets?}
\end{enumerate}
Answering the above research question is however challenging as tweets are highly informal and prone to incorrect grammatical structure. For example, ``Much more worthwhile causes to use your time for" contains a causal cue word (`causes') but it is not expressing any event causality. Due to such challenges existing rule-based methods \cite{Luo2016, Sasaki2017} are less effective in event causality detection from short texts such as tweets. In addition, the events mentioned in tweets often lack information about the context e.g., ``India defeated Australia by 5 points" does not provide any information about the name of the sport the event is referring to. Hence, existing supervised learning based techniques such as the one proposed by Ponti et al. \cite{Ponti2017} have poor performances on tweets.
We assume that causal and effect events occur in the same sentence in a tweet. We aim to detect such explicitly mentioned causal and effect event pairs. We define a candidate causal event as $e_1$ and effect event as $e_2$. Each event has a structure of $k(a_1, a_2, a_3, ..., a_n)$, where $k$ is the event keyword or trigger word and $\{a_i\}$ are the event attributes. For a candidate causal event pair $(e_1, e_2)$, our goal is to classify whether the event pairs have a causal relationship, i.e., $e_1$ causes $e_2$\footnote{Although $e_1$ causes $e_2$, it does not mean that $e_1$ is the only cause of $e_2$. There could be other causes of $e_2$, which is beyond the scope of this paper.}. Formally, we define the problem studied in this paper as follows:
\begin{equation}
\label{eq:causality-classification}
f(e_1, e_2) =
\begin{cases}
\text{Causal} & \text{if } e_1 \text{ causes } e_2,\\
\text {Not Causal} & \text{otherwise}
\end{cases}
\end{equation}
where $f$ is a function that takes two events $e_1$ and $e_2$ as input and outputs either `Causal' or `Not Causal'. The function outputs `Causal' if $e_1$ causes $e_2$ in the input event pair and it outputs `Not Causal' otherwise.
\section{Our Approach}
\label{sec:proposed-metnod}
Our proposed method utilizes background knowledge to detect event causality. The background knowledge is extracted from news articles in the form of a causal network. To apply background knowledge, we extend event context words using the causal network. The events are then converted into word vectors to train a feed-forward neural network. The trained model is then used to detect causal relationship between a new pair of candidate causal events. Fig. \ref{fig:system-overview} illustrates an overall schematic overview of the proposed method.
\begin{table*}[tb]
\setlength{\tabcolsep}{1.5pt}
\small
\centering
\caption{Causal Cue Words}
\vspace{-1ex}
\label{tab:causal_cue_wordes}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}|l|l|l|l|l|l|l|l|}
\Xhline{2\arrayrulewidth}
affect & because & causes & due to & if & induce & owing to & results from \\ \hline
affected by & because of & causing & effect of & if..., then & induced & reason for & so that \\ \hline
affects & bring on & consequently & for this reason alone & in consequence of & inducing & reason of & that's why \\ \hline
and consequently & brings on & coz & gave rise to & in response to & lead to & reasons for & the result is \\ \hline
and hence & brought on & coz of & give rise to & inasmuch as & leading to & reasons of & thereby \\ \hline
as a consequence & cause & decrease & given rise to & increase & leads to & result from & therefor \\ \hline
as a consequence of & caused & decreased by & giving rise to & increased by & led to & resulted from & thus \\ \hline
as a result of & caused by & decreases & hence & increases & on account of & resulting from & \\ \Xhline{2\arrayrulewidth}
\end{tabular*}
\normalsize
\vspace{-3ex}
\end{table*}
\subsection{Tweet Preprocessing}
\label{sec:preprocessing}
As a first step of preprocessing, tweets are split into sentences. Sentences in tweets often contain characters that are considered as noise such as emojis, repeated characters and symbols. We perform a series of preprocessing steps to remove noisy characters from sentences. These steps include removal of non-alphabetic characters such as emojis, symbols, hashtags (`\#') and mention (`@') characters, and URLs. We also discard sentences ending with question mark (`?') and normalize repeated characters in a word, e.g., `yesss' to `yes'.
\begin{figure*}[tb]
\begin{adjustbox}{minipage=0.99\textwidth,precode=\dbox}
\centering
\includegraphics[scale=0.76]{extract_event_pair.pdf}
\end{adjustbox}
\caption{An example of event pair extraction from a sentence}
\label{fig:event-pair-extraction}
\vspace{-2ex}
\end{figure*}
\begin{figure*}[tb]
\begin{adjustbox}{minipage=0.99\textwidth,precode=\dbox}
\centering
\includegraphics[scale=0.62]{causal_network.pdf}
\end{adjustbox}
\caption{Causal network construction from news articles}
\label{fig:causal-netwrok}
\vspace{-2ex}
\end{figure*}
\subsection{Event Pair Extraction}
\label{sec:event-pair-extraction}
In this step, a pair of candidate events is extracted from a sentence. At first, a sentence is split into candidate causal and effect phrases using a set of causal cue words \cite{Luo2016, Mirza2014} (please see Table \ref{tab:causal_cue_wordes}). For example, ``a disruption in bus service in gold coast due to lack of communication between translink and event organizers'' is split into ``a disruption in bus service in gold coast'' as the candidate effect phrase and ``lack of communication between translink and event organizers'' as the candidate causal phrase using the cue word \emph{due to}. Candidate cause and effect phrases are then passed to the Stanford dependency parser \cite{chen2014} to detect the root word for each phrase. The root words are considered to be the event keyword $k$ of the corresponding events $e_1$ (or $e_2$). The other words that are related to the root word via `nsubj', `nsubjpass', `amod', `dobj', `advmod', `nmod', `xcomp', `compound:prt', `compound' and `neg' relationships are extracted as the event attributes $\{a_i\}$. We also extract other words that are related to the extracted event attributes via the above relationships as the event attributes. An example of event keyword $k$ and attributes $\{a_i\}$ extraction for the sentence ``\textit{\textbf{A disruption in bus service in Gold Coast} due to \textbf{lack of communication between translink and event organizers}}" is illustrated in Fig. \ref{fig:event-pair-extraction}.
\subsection{Causal Network}
\label{sec:causal-network}
Background knowledge plays an important role in event causality detection. We use 1 million news articles\footnote{https://research.signalmedia.co/newsir16/signal-dataset.html} collected from the work of \cite{Signal1M2016} as a source of background knowledge and store the captured knowledge as causal relationships in a network called \emph{causal network}. To construct the network, first we extract the causal and effect phrases from article sentences using the causal cue words given in Table \ref{tab:causal_cue_wordes}. Then, the phrases are converted to lower cases after removing the stop words. The phrases are then tokenized and lemmatized. Each token in the either phrase represents a node in the network. A directed link from token A to token B contains frequency such that token A appeared in a causal phrase and token B appeared in the corresponding effect phrase, which is illustrated in Fig. \ref{fig:causal-netwrok}.
\subsection{Context Word Extension}
\label{sec:cotnext-word-extension}
We use the background knowledge captured in the causal network to extend candidate event context words. For example, if there is a causal relationship between `Rain' and `Flood', it can be said that in many previous occasions the word \emph{Rain} was part of causal phrases where \emph{Flood} was a part of effect phrases. This knowledge can be applied to the causality detection method for extending context words. In our approach, which is pseudocoded in Algorithm \ref{alg:context-word-extension}, we look for the corresponding effect event keyword in the causal network to extend the context word $k$ of a candidate causal event. First, we identify a list of words with inward links to effect keyword in causal network. The list is then sorted in descending order of their frequencies. From that sorted list, we take top \emph{n} words to extend the context of candidate causal event $e_1$, where n is number of words we want to extend. Similarly, to extend the context of candidate effect event $e_2$, we identify the top \emph{n} effect words from causal network. A running example is given in Fig. \ref{fig:context-word-extension} to illustrate our context word extension technique for \emph{lack} and \emph{disruption} event keywords using the causal network.
\begin{algorithm}[t]
\small
\SetKwInOut{Input}{Input}
\SetKwInOut{Output}{Output}
\SetKwInOut{Initialization}{Initialization}
\Input{$e_1$: candidate causal event, $e_2$: candidate effect event, $n$: number of context word extension, $cnet$: causal network
\Output{$({e_1}', {e_2}')$: list of events with expanded context words}
$k_1 \gets get\_event\_keyword(e_1)$\;
$k_2 \gets get\_event\_keyword(e_2)$\;
$ct \gets get\_causal\_terms(cnet, k_2)$\;
$et \gets get\_effect\_terms(cnet, k_1)$\;
${e_1}' \gets list(k_1)$ \tcp*[r]{create a list with $k_1$}
${e_2}' \gets list(k_2)$ \tcp*[r]{create a list with $k_2$}
\For{$i \gets 0$ to $n-1$} {
${e_1}' \gets {e_1}' + list(ct[i])$ \tcp*[r]{append terms}
${e_2}' \gets {e_2}' + list(et[i])$ \tcp*[r]{append terms}
}
${e_1}' \gets {e_1}' + list(get\_attributes(e_1))$\;
${e_2}' \gets {e_2}' + list(get\_attributes(e_2))$\;
return $({e_1}', {e_2}')$ \tcp*[r]{events with expanded context words}
\caption{Context Word Extension}
\label{alg:context-word-extension}
\normalsize
\end{algorithm}
\begin{figure*}[tb]
\centering
\includegraphics[scale=0.7]{context_word_extension.pdf}
\vspace{-2ex}
\caption{An example of $n$-word context word extension, where $n=2$ and the original candidate cause and effect keywords are \emph{lack} and \emph{disruption}, respectively}
\label{fig:context-word-extension}
\vspace{-3.5ex}
\end{figure*}
\subsection{Feature Extraction}
\label{sec:feateure-extraction}
In the feature extraction stage, the candidate causal event $e_1$ and the candidate effect event $e_2$ are converted into a numerical vector $v$. However, before the conversion, the context words of $e_1$ and $e_2$ are extended following the steps described in Section \ref{sec:cotnext-word-extension}, which generates $e_1'$ and $e_2'$ respectively. To convert $e_1'$ and $e_2'$ into $v$, we train a Word2vec model \cite{mikolov2013} from 1 million news articles (the same dataset that is used to build the \emph{causal network}). Then we extract the dictionary of words $\mathcal{D}$ from the trained Word2vec model. Using this dictionary we replace every word in $e_1'$ and $e_2'$ by its corresponding index in $\mathcal{D}$. The word indexes of $e_1'$ and $e_2'$ are then concatenated together to construct a single index vector $i_v$. In the next step, each index $i_v$ is replaced by its corresponding word embedding which produces a matrix of word embeddings $M$. The number of columns in $M$ is 300 and the number of rows is the same as the total words $e_1'$ and $e_2'$. Finally, the matrix $M$ is flattened by taking mean and converted to a vector $v$ of size 300. This vector $v$ is passed to the input layer of the feed-forward neural network for training and detection, which is discussed below.
\begin{figure*}[tb]
\vspace{-2ex}
\begin{adjustbox}{minipage=0.98\textwidth,precode=\dbox}
\centering
\includegraphics[scale=0.76]{feed_forward_learning.pdf}
\end{adjustbox}
\caption{Feature extraction from an event pair and different layers of the feed-forward neural network}
\label{fig:neural-network-training}
\vspace{-4ex}
\end{figure*}
\subsection{Learning and Detection}
\textbf{Learning the Detection Model}. In this step, we train a feed-forward neural network model. First, we prepare a gold standard dataset that contains event pairs where each pair is labeled as either `causal' or `not causal'. Then we extract feature for the candidate event pair following the steps described in \ref{sec:feateure-extraction}, which includes context word extension and vectorization. In context word extension step, we extend the event context word $k$ for both causal event $e_1$ and effect event $e_2$ using a pre-constructed causal network (please see Sec. \ref{sec:cotnext-word-extension}). The context word extension step generates $e_1'$ and $e_2'$ where $e_1'$ is the extended version of $e_1$ and $e_2'$ is the extended version of $e_2$. After performing the context word extension, every event pair is converted into a 300 dimensional feature vector following the steps described in Sec. \ref{sec:feateure-extraction}. Such feature vectors of all candidate event pairs and their corresponding labels (`causal' or `not causal') are passed to a feed-forward neural network for training. The trained model is then used to detect the causal relationship between the candidate event pairs in unknown tweets.
\textbf{Causal Relationship Detection}. The causal relationship detection between event pairs in an unknown tweet starts with a series of preprocessing steps as described in Section \ref{sec:preprocessing}. After preprocessing, the tweet is converted into a set of sentences where noisy characters such as emojis, hashtags (`\#') and mentions (`@') are removed. We also remove question sentences with the assumption that questions do not contains an event causal relationship. The sentences are then passed to the candidate event pair extraction steps where pairs of candidate causal events are extracted (please see Section \ref{sec:event-pair-extraction}). The next step is to extract features, where context word extension technique is applied to both candidate causal event and effect event (please see Section \ref{sec:cotnext-word-extension}). The event words are then converted into the feature vector (please see Section \ref{sec:feateure-extraction}) which is passed to the trained feed-forward neural network model for event causality detection.
The schematic diagram of causal relationship detection in candidate event pairs, which includes learning the neural network model as well as the detection of causal relationship in unknown event pairs, is illustrated in Fig. \ref{fig:neural-network-training}.
\section{Experiments}
\label{sec:experiments}
This section presents our experiments and demonstrates the effectiveness of our method on event causality detection.
\begin{figure*}[tb]
\centering
\setlength{\tabcolsep}{2pt}
\begin{tabular}{ccc}
\begin{minipage}[a]{0.32\linewidth}
\centering
\subfloat[0-word]{\includegraphics[scale=0.38]{news_model_acc_0_word.pdf}}
\end{minipage}
&
\begin{minipage}[a]{0.33\linewidth}
\centering
\subfloat[1-word]{\includegraphics[scale=0.38]{news_model_acc_1_word.pdf}}
\end{minipage}
&
\begin{minipage}[a]{0.32\linewidth}
\centering
\subfloat[2-word]{\includegraphics[scale=0.38]{news_model_acc_2_word.pdf}}
\end{minipage}\\
\begin{minipage}[a]{0.32\linewidth}
\centering
\subfloat[3-word]{\includegraphics[scale=0.38]{news_model_acc_3_word.pdf}}
\end{minipage}
&
\begin{minipage}[a]{0.32\linewidth}
\centering
\subfloat[4-word]{\includegraphics[scale=0.38]{news_model_acc_4_word.pdf}}
\end{minipage}
&
\begin{minipage}[a]{0.32\linewidth}
\centering
\subfloat[5-word]{\includegraphics[scale=0.38]{news_model_acc_5_word.pdf}}
\end{minipage}
\end{tabular}
\vspace{-1ex}
\caption{Training accuracy optimization for models from 0 to 5-word extension}
\label{fig:model-accuracy-optimization}
\vspace{-3.5ex}
\end{figure*}
\subsection{Dataset}
We collect 207,705 tweets that are related to the Commonwealth Games 2018 in Gold Coast, Australia and posted during the period from 2017-10-05 to 2018-05-07 using twitter API\footnote{https://developer.twitter.com/en/docs/tweets/search/overview}. The following hashtags are used as keywords to collect the tweets: `\#CommonwealthGames', `\#CommonwealthGames2018', `\#GC2018', and `\#ShareTheDream'. After performing the preprocessing steps mentioned in Section \ref{sec:preprocessing}, we identify 913 candidate cause and effect event pairs based on the approach described in Section \ref{sec:event-pair-extraction} and annotate them manually as either `Causal' or `Not Causal'.
We split our annotated dataset to separate 60\% data for training and 40\% for testing. We ensure that the ratio of `Causal' and `Not Causal' data remains same in both training and test data. The statistics of the tested dataset is presented in Table \ref{tab:dataset-statistics}. Among the training data (60\% of the original dataset), we use 50\% data for learning the model and the rest 50\% data for validation and parameter optimization.
\begin{table}[t]
\centering
\caption{Statistics Of The Dataset}
\label{tab:dataset-statistics}
\begin{tabular}{|l|c|c|}
\Xhline{2\arrayrulewidth}
\textbf{Set} & \textbf{Causal} & \textbf{Not causal} \\ \hline \hline
Full dataset & 459 & 457 \\ \hline
Training & 275 & 274 \\ \hline
Test & 184 & 183 \\ \hline
\Xhline{2\arrayrulewidth}
\end{tabular}
\vspace{-4ex}
\end{table}
\subsection{Setup}
We implement the proposed method in Python 3.6 and use keras python package\footnote{https://keras.io/} to implement the feed-forward neural network based causality detection method. The neural network has an input layer, two hidden layers and an output layer. The input layer contains 300 nodes and we use `ReLU' as the activation function, which accepts 300 dimensional event vectors as the input. Next to this layer we have two fully connected hidden layers that consists of 200 nodes and 16 nodes, respectively (this topology has been optimized empirically). Each node in both of the hidden layers uses `ReLU' as the activation function. The output layer is another fully connected layer that contains only one node and `sigmoid' function as the activation function. Empirically, we use ADADELTA \cite{zeiler2012} algorithm as the cost function optimizer, batch size 40. We use the evaluation metric: 'Accuracy', to optimize the parameters.
\subsection{Parameter Optimization}
\label{sec:parameter_optimization}
We optimize the learning rate of our feed-forward neural network model while keeping other parameters fixed. Initially, we set our learning rate to $0.01$ and raise the learning rate gradually if the model learns too much detail and overfit the training data. We find the best learning performance for learning rate $0.1$. We perform this experiment for $0$ to $5$ event context word extensions and run for 250 iterations. The model with 0-word extension corresponds to the model where no event context word extension is applied. Fig. \ref{fig:model-accuracy-optimization} illustrates training and validation accuracy for different number of iterations. We observe that the validation accuracy stops growing or starts to decline in between 100 to 200 iterations. As the validation accuracy of the model does not improve for more iterations and model only overfits the training data, we choose to stop training at 150 iterations.
\begin{figure}[tb]
\centering
\includegraphics[scale=0.53]{evaluation_scores_news.pdf}
\vspace{-1ex}
\caption{\label{fig:scores-word-extension-news}Evaluation scores of different settings in the proposed event context word extension technique}
\vspace{-4.5ex}
\end{figure}
\subsection{Performance Evaluation}
To evaluate the generalizability of our proposed method of event causality detection on unseen tweets, first we train the proposed neural network model on the training set (60\%) using the optimized parameters learned during the training phase (as explained in Section \ref{sec:parameter_optimization}). Then, we compare the performance of the proposed method for event context word extension against the method that uses feature vectors with no context word extension for the test dataset (40\%). Fig. \ref{fig:scores-word-extension-news} illustrates the standard evaluation scores: accuracy, precision, recall and F1-score of different settings of the event context word extension. The results suggest that we gain performance improvement across the evaluation scores for both 2 and 3-word extension compared to the model that uses 0-word extension. The model with 2-word extension achieves the best evaluation scores. We also observe that increasing the number of word extension after 3 does not perform well and the performance drops sharply. This is because the words extracted from the knowledge base become more prominent than the original event words. We also generate an ROC curve to compare the performance of our proposed method against the 0-word extension based method as given in Fig. \ref{fig:roc-curve-word-extension-news}. From Fig. \ref{fig:roc-curve-word-extension-news}, we see that the Area Under Curve (AUC) value for 2-word extension based method is higher than the 0-word extension based method. In conclusion, the 2-word extension based method is the best performer.
\begin{figure}[tb]
\centering
\includegraphics[scale=0.53]{roc_curve_news.pdf}
\vspace{-1ex}
\caption{ROC Curve of different settings in the proposed event context word extension technique}
\label{fig:roc-curve-word-extension-news}
\vspace{-1ex}
\end{figure}
\begin{table}[t]
\centering
\small
\setlength{\tabcolsep}{.23pt}
\caption{Comparison of the proposed method with existing approaches}
\vspace{-1ex}
\label{tab:comparison-with-benchmarks}
\begin{tabular}{|l|c|c|c|c|}
\Xhline{2\arrayrulewidth}
\multicolumn{1}{|c|}{\textbf{Methods}} & \multicolumn{1}{c|}{\textbf{Accuracy}} & \multicolumn{1}{c|}{\textbf{Precision}} & \multicolumn{1}{c|}{\textbf{Recall}} & \multicolumn{1}{c|}{\textbf{F1-score}} \\ \hline \hline
Commonsense \cite{Luo2016} & 50.95 & 56.67 & 9.24 & 15.89 \\ \hline
Commonsense + Multi-word \cite{Sasaki2017} & 50.14 & 54.55 & 3.26 & 6.15 \\ \hline
FFNN + Position \cite{Ponti2017} & 50.00 & 52.38 & 6.08 & 10.89 \\ \hline
FFNN + 2-word Extension (ours) & \textbf{65.94} & \textbf{67.46} & \textbf{61.96} & \textbf{64.59} \\ \hline
\Xhline{2\arrayrulewidth}
\end{tabular}
\vspace{-3.5ex}
\end{table}
To compare the performance of the proposed method with other existing methods, we implement three existing causality detection systems. We implement the commonsense causality detection method (Commonsense) proposed by Luo et al. \cite{Luo2016}. The method takes a set of candidate causal phrases as input and decides if there is a causal relationship between each pair of phrases by calculating their causal strength based on the knowledge available in the causal network. For this approach, we use the same causal network that we use for our proposed method. Additionally, we implement another approach proposed by Sasaki et al. \cite{Sasaki2017} that extends the commonsense causality detection method for multi-word phrases (Commonsense + Multi-word). Our third existing method is an event causality detection system \cite{Ponti2017} that enhances the feature set of a feed-forward neural network using the positions of words in the sentence (FFNN + Position). We set iterations to 150, learning rate to 0.1 and batch size to 10 to train the neural network for this method. The experimental results are given in Table \ref{tab:comparison-with-benchmarks}. We observe better performance of the proposed system compared to the existing state-of-the-art event causality detection systems such as Commonsense \cite{Luo2016}, Commonsense+Multi-word \cite{Sasaki2017} and FFNN+Position \cite{Ponti2017} based systems. From Table \ref{tab:comparison-with-benchmarks}, it is evident that the performance gain achieved by our method is at least 570\% and 306\% in terms of Recall and F1-score, respectively. This outcomes demonstrate that the proposed event context word extension technique is capable of overcoming the issue of insufficient context information in candidate causal event pairs in tweets.
\section{Conclusion}
\label{sec:conclusion}
This paper proposes a feature enhancement technique for supervised learning based event causality detection approach. We demonstrate that commonsense background knowledge can be used to extend event context information, which helps to enhance feature set of a supervised learning based method. We develop a neural network based event causality detection method that uses event context word extension technique to detect causality relationship between pair of events. We find that the neural network based model performs better when trained on the enhanced feature set for event causality detection in tweets. In this paper, we focus on extracting pairs of causally related events from tweets, but users often post opinionated or sarcastic posts which may contain incorrect event causality relationships. We aim to perform fact checking of event causality relationships in tweets as future works.
| {'timestamp': '2019-01-14T02:12:16', 'yymm': '1901', 'arxiv_id': '1901.03526', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03526'} | arxiv |
\section{Introduction}
\IEEEPARstart{T}{he} ideal method for generating a robot controller would be extremely data efficient, free of requirements on domain knowledge, and safe to run.
Current strategies to derive low-level controllers are effective across many platforms, but system identification often requires substantial setup and experiment time while PID tuning requires some domain knowledge and still results in dangerous roll-outs.
With the goal to reduce reliance on expert-based controller design, in this paper we investigate the question:
Is it possible to autonomously learn competitive low-level controllers for a robot, without simulation or demonstration, in a limited amount of time?
\begin{figure}[t]
\centering
\includegraphics[width=.9\columnwidth]{figures/final/SystemBlock.pdf}
\caption{The model predictive control loop used to stabilize the Crazyflie.
Using deep model-based reinforcement learning, the quadrotor reaches stable hovering with only 10,000 trained datapoints -- equivalent to 3 minutes of flight.}
\label{fig:sysblock}
\end{figure}
To answer this question, we turn to model-based reinforcement learning~(MBRL) -- a compelling approach to synthesize controllers even for systems without analytic dynamics models and with high cost per experiment~\citep{gpcontrol}.
MBRL has been shown to operate in a data-efficient manner to control robotic systems by iteratively learning a dynamics model and subsequently leveraging it to design controllers~\citep{Williams2017}.
Our contribution builds on simulated results of MBRL~\citep{Chua2018}.
We employ the quadrotor as a testing platform to broadly investigate controller generation on a highly nonlinear, challenging system, not to directly compare performance versus existing controllers.
This paper is the first demonstration of controlling a quadrotor with direct motor assignments sent from a MBRL derived controller learning only via experience.
Our work differs from recent progress in MBRL with quadrotors by exclusively using experimental data and focusing on low level control, while related applications of learning with quadrotors employ low-level control generated in simulation~\cite{Hwangbo2017} or use a dynamics model learned via experience to command on-board controllers~\cite{Bansal2016}.
Our MBRL solution, outlined in~\fig{fig:sysblock}, employs neural networks (NN) to learn a forwards dynamics model coupled with a `random shooter' MPC, which can be efficiently parallelized on a graphic processing unit~(GPU) to execute low-level, real-time control.
Using MBRL, we demonstrate controlled hover of a Crazyflie via on-board sensor measurements and application of pulse width modulation~(PWM) motor voltage signals.
Our method for quickly learning controllers from real-world data is not yet an alternative to traditional controllers such as PID, but it opens important avenues of research.
The general mapping of the forward dynamics model, in theory, allows the model to be used for control tasks beyond attitude control.
Additionally, we highlight the capability of leveraging the predictive models learned on extremely little data for working at frequencies $\leq$\SI{50}{\hertz}, while a hand tuned PID controller at this frequency failed to hover the Crazyflie.
With the benefits outlined, the current MBRL approach has limitations in performance and applicability to our goal of use with other robots.
The performance in this paper has notable room for improvement by mitigating drift.
Future applications are limited by our approach's requirement of a high power external GPU -- a prohibitively large computational footprint when compared to standard low-level controllers -- and by the method's potential for collisions when learning.
The resulting system achieves repeated stable hover of up to 6 seconds, with failures due to drift of unobserved states, within 3 minutes of fully-autonomous training data.
These results demonstrate the ability of MBRL to control robotic systems in the absence of \textit{a priori} knowledge of dynamics, pre-configured internal controllers for stability or actuator response smoothing, and expert demonstration.
\section{Related Work}
\subsection{Attitude and Hover Control of Quadrotors}
Classical controllers (e.g., PID, LQR, iLQR) in conjunction with analytic models for the rigid body dynamics of a quadrotor are often sufficient to control vehicle attitude~\cite{mahony2012multirotor}.
In addition, linearized models are sufficient to simultaneously control for global trajectory attitude setpoints using well-tuned nested PID controllers~\cite{mellinger2012trajectory}.
Standard control approaches show impressive acrobatic performance with quadrotors, but we note that we are not interested in comparing our approach to finely-tuned performance; the goal of using MBRL in this context is to highlight a solution that automatically generates a functional controller in less or equal time than initial PID hand-tuning, with no foundation of dynamics knowledge.
Research focusing on developing novel low-level attitude controllers shows functionality in extreme nonlinear cases, such as for quadrotors with a missing propeller ~\cite{zhang2016controllable}, with multiple damaged propellers~\cite{mueller2014stability}, or with the capability to dynamically tilt its propellers~\cite{ryll2012modeling}. Optimal control schemes have demonstrated results on standard quadrotors with extreme precision and robustness \cite{liu2016robust}.
Our work differs by specifically demonstrating the possibility of attitude control via real-time external MPC. Unlike other work on real-time MPC for quadrotors which focus on trajectory control~\cite{bangura2014real,abdolhosseini2013efficient}, ours uses a dynamics model derived fully from in-flight data that takes motors signals as direct inputs.
Effectively, our model encompasses only the actual dynamics of the system, while other implementations learn the dynamics conditioned on previously existing internal controllers.
The general nature of our model from sensors to actuators demonstrates the potential for use on robots with no previous controller --- we only use the quadrotor as the basis for comparison and do not expect it to be the limits of the MBRL system's functionality.
\subsection{Learning for Quadrotors}
Although learning-based approaches have been widely applied for trajectory control of quadrotors, implementations typically rely on sending controller outputs as setpoints to stable on-board attitude and thrust controllers.
Iterative learning control~(ILC) approaches~\cite{schoellig2012optimization,sferrazza2017trajectory} have demonstrated robust control of quadrotor flight trajectories but require these on-board controllers for attitude setpoints.
Learning-based model predictive control implementations, which successfully track trajectories, also wrap their control around on-board attitude controllers by directly sending Euler angle or thrust commands~\cite{bouffard2012learning,koller2018learning}.
Gaussian process-based automatic tuning of position controller gains has been demonstrated~\cite{berkenkamp2016safe}, but only in parallel with on-board controllers tuned separately.
Model-free reinforcement learning has been shown to generate control policies for quadrotors that out-performs linear MPC~\cite{Hwangbo2017}.
Although similarly motivated by a desire to generate a control policy acting directly on actuator inputs, the work used an external vision system for state error correction, operated with an internal motor speed controller enabled (i.e., thrusts were commanded and not motor voltages), and generated a large fraction of its data in simulation.
Researchers of system identification for quadrotors also apply machine learning techniques.
Bansal et al. used NN models of the Crazyflie's dynamics to plan trajectories~\cite{Bansal2016}.
Our implementation differs by directly predicting change in attitude with on-board IMU measurements and motor voltages, rather than predicting with global, motion-capture state measurements and thrust targets for the internal PIDs.
Using Bayesian Optimization to learn a linearized quadrotor dynamics model demonstrated capabilities for tuning of an optimal control scheme~\cite{Bansal2017}.
While this approach is data-efficient and is shown to outperform analytic models, the model learned is task-dependent. Our MBRL approach is task agnostic by only requiring a change in objective function and no new dynamics data for a new function.
\subsection{Model-based Reinforcement Learning}
Functionality of MBRL is evident in simulation for multiple tasks in low data regimes, including quadrupeds~\cite{clavera2018learning} and manipulation tasks~ \cite{kupcsik2017model}.
Low-level MBRL control (i.e., with direct motor input signals) of an RC car has been demonstrated experimentally, but the system is of lower dimensionality and has static stability~\cite{abbeel2008apprenticeship}.
Relatively low-level control (i.e., mostly thrust commands only passed through an internal governor before conversion to motor signals) of an autonomous helicopter has been demonstrated, but required a ground-based vision system for error correction in state estimates as well as expert demonstration for model training~\cite{abbeel2008apprenticeship}.
Properly optimized NNs trained on experimental data show test error below common analytic dynamics models for flying vehicles, but the models did not include direct actuator signals and did not include experimental validation through controller implementation~\cite{Punjani2015}.
A model predictive path integral~(MPPI) controller using a learned NN demonstrated data-efficient trajectory control of a quadrotor, but results were only shown in simulation and required the network to be initialized with 30 minutes of demonstration data with on-board controllers~\cite{Williams2017}.
MBRL with trajectory sampling for control outperforms, in terms of samples needed for convergence, the asymptotic performance of recent model free algorithms in low dimensional tasks \cite{Chua2018}.
Our work builds on strategies presented, with most influence derived from ``probabilistic'' NNs, to demonstrate functionality in an experimental setting --- i.e., in the presence of real-world higher order effects, variability, and time constraints.
NN-based dynamics models with MPC have functioned for experimental control of an under-actuated hexapod \cite{nagabandi2017neural}.
The hexapod platform does not have the same requirements on frequency or control error due to its static stability, and incorporates a GPS unit for relatively low-noise state measurements.
Our work has a similar architecture, but has improvements in the network model and model predictive controller to allow substantially higher control frequencies with noisy state data.
By demonstrating functionality without global positioning data, the procedure can be extended to more robot platforms where only internal state and actuator commands are available to create a dynamics model and control policy.
\section{Experimental Setup}
\begin{figure}[t]
\centering
\includegraphics[width=0.7\columnwidth]{figures/final/ROS_Struct_shrink.pdf}
\caption{
The ROS computer passes control signals and state data between the MPC node and the Crazyflie ROS server. The Crazyflie ROS server packages Tx PWM values to send and unpacks Rx compressed log data from the robot.}
\label{fig:ROSsystem}
\end{figure}
In this paper, we use as experimental hardware platform the open-source Crazyflie 2.0 quadrotor~\cite{bitcraze2016crazyflie}.
The Crazyflie is \SI{27}{\gram} and \SI{9}{cm^2}, so the rapid system dynamics create a need for a robust controller; by default, the internal PID controller used for attitude control runs at \SI{500}{\hertz}, with Euler angle state estimation updates at \SI{1}{kHz}.
This section specifies the ROS base-station and the firmware modifications required for external stability control of the Crazyflie.
All components we used are based on publicly available and open source projects.
We used the Crazyflie ROS interface supported here: \href{https://github.com/whoenig/crazyflie_ros}{github.com/whoenig/crazyflie\text{\_}ros}~\cite{honig2017flying}.
This interface allows for easy modification of the radio communication and employment of the learning framework.
Our ROS structure is simple, with a Crazyflie subscribing to PWM values generated by a controller node, which processes radio packets sent from the quadrotor in order to pass state variables to the model predictive controller (as shown in \fig{fig:ROSsystem}).
The Crazyradio PA USB radio is used to send commands from the ROS server; software settings in the included client increase the maximum data transmission bitrate up to \SI{2}{Mbps} and a Crazyflie firmware modification improves the maximum traffic rate from \SI{100}{\hertz} to \SI{400}{\hertz}.
In packaged radio transmissions from the ROS server we define actions directly as the pulse-width modulation~(PWM) signals sent to the motors.
To assign these PWM values directly to the motors we bypass the controller updates in the standard Crazyflie firmware by changing the motor power distribution whenever a CRTP Commander packet is received (see \fig{fig:ROSsystem}).
The Crazyflie ROS package sends empty ping packets to the Crazyflie to ask for logging data in the returning acknowledgment packet; without decreasing the logging payload and rate we could not simultaneously transmit PWM commands at the desired frequency due to radio communication constraints. We created a new internal logging block of compressed IMU data and Euler angle measurements to decrease the required bitrate for logging state information, trading state measurement precision for update frequency.
Action commands and logged state data are communicated asynchronously; the ROS server control loop has a frequency set by the ROS rate command, while state data is logged based on a separate ROS topic frequency. To verify control frequency and reconstruct state action pairs during autonomous rollouts we use a round-trip packet ID system.
\section{Learning Forward Dynamics}
\label{sec:modeltraining}
\begin{figure}[t]
\centering
\includegraphics[width=.6\columnwidth]{figures/final/nn_2layer.pdf}
\caption{The NN dynamics model predicts the mean and variance of the change in state given the past 4 state-action pairs.
We use 2 hidden layers of width 250 neurons.
}
\label{fig:nn}
\end{figure}
The foundation of a controller in MBRL is a reliable forward dynamics model for predictions.
In this paper, we refer to the current state and action as $s_t$ and $a_t$, which evolve according to the dynamics $f(s_t,a_t)$.
Generating a dynamics model for the robot often consists of training a NN to fit a parametric function $f_\theta$ to predict the next state of the robot as a discrete change in state $s_{t+1} = s_t + f_\theta(s_t,a_t)$.
In training, using a probabilistic loss function with a penalty term on the variance of estimates, as shown in \eq{pll}, better clusters predictions for more stable predictions across multiple time-steps~\cite{Chua2018}.
The probabilistic loss fits a Gaussian distribution to each output of the network, represented in total by a mean vector $\mu_\theta$ and a covariance matrix $\Sigma_\theta$
\begin{align}
\label{pll}
l = \sum_{n=1}^N & [\mu_\theta (s_n, a_n) - s_{n+1}]^T \Sigma_{\theta}^{-1} (s_n, a_n) [\mu_\theta (s_n, a_n) - s_{n+1}] \nonumber \\
& + \text{log det } \Sigma_\theta (s_n, a_n)\,.
\end{align}
The probabilistic loss function assists model convergence and the variance penalty helps maintain stable predictions on longer time horizons.
Our networks implemented in Pytorch train with the Adam optimizer~\cite{kingma2014adam} for 60 epochs with a learning rate of $.0005$ and a batch size of 32.
\fig{fig:nn} summarizes the network design.
All layers except for the output layer use the Swish activation function~\cite{ramachandran2017swish} with parameter $\beta = 1$.
The network structure was cross validated offline for prediction accuracy verses potential control frequency.
Initial validation of training parameters was done on early experiments, and the final values are held constant for each rollout in the experiments reported in \sec{sec:eval}.
The validation set is a random subset of measured $(s_t, a_t, s_{t+1})$ tuples in the pruned data.
Additional dynamics model accuracy could be gained with systematic model verification between rollouts, but experimental variation in the current setup would limit empirical insight and a lower model loss does not guarantee improved flight time.
Our initial experiments indicate improved flight performance with forward dynamics models minimizing the mean and variance of state predictions versus models minimizing mean squared prediction error, but more experiments are needed to state clear relationships between more model parameters and flight performance.
Training a probabilistic NN to approximate the dynamics model requires pruning of logged data (e.g. dropped packets) and scaling of variables to assist model convergence.
Our state~$s_t$ is the vector of Euler angles (yaw, pitch, and roll), linear accelerations, and angular accelerations, reading
\begin{equation}
s_t = \big[\dot{\omega}_x, \ \dot{\omega}_y,\ \dot{\omega}_z,\ \phi,\ \theta,\ \psi,\ \ddot{x}, \ \ddot{y}, \ \ddot{z} \big]^T.
\end{equation}
The Euler angles are from the an internal complementary filter, while the linear and angular accelerations are measured directly from the on-board MPU-9250 9-axis IMU.
In practice, for predicting across longer time horizons, modeling acceleration values as a global next state rather than a change in state increased the length of time horizon in composed predictions before the models diverged.
While the change in Euler angle predictions are stable, the change in raw accelerations vary widely with sensor noise and cause non-physical dynamics predictions, so all the linear and angular accelerations are trained to fit the global next state.
We combine the state data with the four PWM values, $a_t = [ m_1, m_2, m_3, m_4 ]^T $, to get the system information at time $t$.
The NNs are cross-validated to confirm using all state data (i.e., including the relatively noisy raw measurements) improves prediction accuracy in the change in state.
While the dynamics for a quadrotor are often represented as a linear system, for a Micro Air Vehicle (MAV) at high control frequencies motor step response and thrust asymmetry heavily impact the change in state, resulting in a heavily nonlinear dynamics model.
The step response of a Crazyflie motor RPM from PWM 0 to max or from max to 0 is on the order of \SI{250}{ms}, so our update time-step of \SI{20}{ms} is short enough for motor spin-up to contribute to learned dynamics.
To account for spin-up, we append past system information to the current state and PWMs to generate an input into the NN model that includes past time.
From the exponential step response and with a bounded possible PWM value within $p_{eq} \pm 5000$, the motors need approximately \SI{25}{ms} to reach the desired rotor speed; when operating at \SI{50}{\hertz}, the time step between updates is \SI{20}{ms}, leading us to an appended states and PWMs history of length 4. This state action history length was validated as having the lowest test error on our data-set (lengths 1 to 10 evaluated).
This yields the final input of length 52 to our NN, $\xi$, with states and actions combined to $\xi_t = \big[s_t \ s_{t-1} \ s_{t-2} \ s_{t-3} \ a_t \ a_{t-1} \ a_{t-2} \ a_{t-3} \big]^T$.
\section{Low Level Model-Based Control}
This section explains how we incorporate our learned forward dynamics model into a functional controller.
The dynamics model is used for control by predicting the state evolution given a certain action, and the MPC provides a framework for evaluating many action candidates simultaneously.
We employ a `random shooter' MPC, where a set of $N$ randomly generated actions are simulated over a time horizon~$T$.
The best action is decided by a user designed objective function that takes in the simulated trajectories $\hat{X}(a,s_t)$ and returns a best action, $a^*$, as visualized in \fig{fig:mpc}.
The objective function minimizes the receding horizon cost of each state from the end of the prediction window to the current measurement.
The candidate actions, $\{a_{i} = (a_{i,1}, a_{i,2}, a_{i,3}, a_{i,4})\}_{i=1}^N$, are 4-tuples of motor PWM values centered around the stable hover-point for the Crazyflie.
The candidate actions are constant across the prediction time horizon $T$.
For a single sample $a_{i}$, each $a_{i,j}$ is chosen from a uniform random variable on the interval $[p_{eq,j} - \sigma, p_{eq,j} + \sigma]$, where $p_{eq,j}$ is the equilibrium PWM value for motor $j$.
The range of the uniform distribution is controlled by the tuned parameter $\sigma$; this has the effect of restricting the variety of actions the Crazyflie can take.
For the given range of PWM values for each motor, $[p_{eq} - \sigma, p_{eq} + \sigma]$, we discretize the candidate PWM values to a step size of 256 to match the future compression into a radio packet.
This discretization of available action choices increases the coverage of the candidate action space.
The compression of PWM resolution, while helpful for sampling and communication, represents an uncharacterized detriment to performance.
Our investigation focuses on controlled hovering, but other tasks could be commanded with a simple change to the objective function.
The objective we designed for stability seeks to minimize pitch and roll, while adding additional cost terms to Euler angle rates.
In the cost function, $\lambda$ effects the ratio between proportional and derivative gains.
Adding cost terms to predicted accelerations did not improve performance because of the variance of the predictions.
\begin{align}
a^*
= \argmin_a \sum_{t=1}^T \lambda (\psi_{t}^2 + \theta_{t}^2) + \dot{\psi}_{t}^2 + \dot{\theta}_{t}^2 + \dot{\phi}_{t}^2\,.
\end{align}
Our MPC operates on a time horizon $T=12$ to leverage the predictive power of our model.
Higher control frequencies can run at a cost of prediction horizon, such as $T=9$ at \SI{75}{\hertz} or $T=6$ at \SI{100}{\hertz}.
The computational cost is proportional to the product of model size, number of actions ($N$), and time horizon ($T$).
At high frequencies the time spanned by the dynamics model predictions shrinks because of a smaller dynamics step in prediction and by having less computation for longer $T$, limiting performance.
At \SI{50}{\hertz}, a time horizon of 12 corresponds to a prediction of \SI{240}{ms} into the future.
Tuning the parameters of this methodology corresponds to changes in the likelihood of taking the best action, rather than modifying actuator responses, and therefore its effect on performance is less sensitive than changes to PID or standard controller parameters.
At \SI{50}{\hertz}, the predictive power is strong, but the relatively low control frequencies increases susceptibility to disturbances in between control updates.
A system running with an Nvidia Titan Xp attains a maximum control frequency of \SI{230}{\hertz} with $N= 5000, T=1$.
For testing we use locked frequencies of \SI{25}{\hertz} and \SI{50}{\hertz} at $N=5000, \ T=12$.
\begin{figure}[t!]
\centering
\includegraphics[width=.8\columnwidth]{figures/final/waterfall_final.pdf}
\caption{Predicted states for $N=50$ candidate actions with the chosen ``best action'' highlighted in red.
The predicted state evolution is expected to diverge from the ground truth for future $t$ because actions are re-planned at every step.}
\label{fig:mpc}
\end{figure}
\section{Experimental Evaluation}
\label{sec:eval}
We now describe the setting used in our experiments, the learning process of the system, and the performance summary of the control algorithm.
Videos of the flying quadrotor, and full code for controlling the Crazyflie and reproducing the experiments, are available online at \url{https://sites.google.com/berkeley.edu/mbrl-quadrotor/}
\subsection{Experimental Setting}
The performance of our controller is measured by the average flight length over each roll-out.
Failure is often due to drift induced collisions, or, as in many earlier roll-outs, when flights reach a pitch or roll angle over \SI{40}{\degree}.
In both cases, an emergency stop command is sent to the motors to minimize damage.
Additionally, the simple on-board state estimator shows heavy inconsistencies on the Euler angles following a rapid throttle ramping, which is a potential limiting factor on the length of controlled flight.
Notably, a quadrotor with internal PIDs enabled will still fail regularly due to drift on the same time frame as our controller; it is only with external inputs that the internal controllers will obtain substantially longer flights.
The drift showcases the challenge of using attitude controllers to mitigate an offset in velocity.
\begin{figure}[t]
\centering
\includegraphics[width=.8\columnwidth]{figures/final/time_final.pdf}
\caption{Mean and standard deviation of the 10 flights during each rollout learning at \SI{25}{\hertz} and \SI{50}{\hertz}. The \SI{50}{\hertz} shows a slight edge on final performance, but a much quicker learning ability per flight by having more action changes during control.}
\label{fig:learn}
\end{figure}
\begin{figure*}[t]
\centering
\includegraphics[width=.80\textwidth]{figures/final/rollcompare_final2.pdf}
\caption{The pitch over time for each flight in the first four roll-outs of learning at \SI{50}{\hertz}, showing the rapid increase in control ability on limited data.
The random and first controlled roll-out show little ability, but roll-out 3 is already flying for $>2$~seconds.
}
\label{fig:roll}
\end{figure*}
\subsection{Learning Process}
The learning process follows the RL framework of collecting data and iteratively updating the policy.
We trained an initial model $f_0$ on 124 and 394 points of dynamics data at \SI{25}{\hertz} and \SI{50}{\hertz}, respectively, from the Crazyflie being flown by a random action controller.
Starting with this initial model as the MPC plant, the Crazyflie undertakes a series of autonomous flights from the ground with a \SI{250}{ms} ramp up, open-loop takeoff followed by on-policy control while logging data via radio.
Each roll-out is a series of 10 flights, which causes large variances in flight time.
The initial roll-outs have less control authority and inherently explore more extreme attitude orientations (often during crashes), which is valuable to future iterations that wish to recover from higher pitch and/or roll.
The random and first three controlled roll-outs at \SI{50}{\hertz} are plotted in \fig{fig:roll} to show the rapid improvement of performance with little training data.
The full learning curves are shown in \fig{fig:learn}.
At both \SI{25}{\hertz} and \SI{50}{\hertz} the rate of flight improvement reaches its maximum once there is 1,000 trainable points for the dynamics model, which takes longer to collect at the lower control frequency.
The improvement is after roll-out 1 at 50Hz and roll-out 5 at 25Hz.
The longest individual flights at both control frequencies is over \SI{5}{\second}.
The final models at \SI{25}{\hertz} and \SI{50}{\hertz} are trained on 2,608 and 9,655 points respectively, but peak performance is earlier due to dynamics model convergence and hardware lifetime limitations.
\begin{figure}[t]
\centering
\includegraphics[width=.88\columnwidth]{figures/final/segment_final.pdf}
\caption{The performance of the \SI{50}{\hertz} controller. (\textit{Above}) The controlled PWM values over time, which visibly change in response to angle oscillations. (\textit{Below}) Pitch and roll.}
\label{fig:eval}
\end{figure}
\subsection{Performance Summary}
This controller demonstrates the ability to hover, following a ``clean'' open-loop takeoff, for multiple seconds (an example is shown in \fig{fig:photos}).
At both \SI{25}{\hertz} and \SI{50}{\hertz}, once reaching maximum performance in the 12 roll-outs, about $30\%$ of flights fail to drift.
The failures due to drift indicate the full potential of the MBRL solution to low-level quadrotor control.
An example of a test flight segment is shown in \fig{fig:eval}, where the control response to pitch and roll error is visible.
\begin{figure*}[t]
\centering
\includegraphics[width=.82\textwidth]{figures/final/photosv6.png}
\caption[Caption of Photos]{A full flight of Euler angle state data with frames of the corresponding video. This flight would have continued longer if not for drifting into the wall. The relation between physical orientation and pitch and roll is visible in the frames. The full video is online on the accompanying website.}
\label{fig:photos}
\end{figure*}
The basis of comparison, typical quadrotor controllers, achieve better performance, but with higher control frequencies and engineering design iterations leveraging system dynamics knowledge.
With the continued improvement of computational power, the performance of this method should be re-characterized as potential control frequencies approach that of PID controllers.
Beyond comparison to PID controllers with low computational footprints, the results warrant exploration of MBRL for new dynamical systems with or when varying goals need to be built into low level control.
In less than 10 minutes of clock time, and only 3 minutes of training data, we present comparable, but limited, performance that is encouraging for future abilities to match and surpass basic controllers.
Moving the balance of this work further towards domain specific control would likely improve performance, but the broad potential for applications to more and different robotic platforms compels exciting future use of MBRL.
\section{Discussion and Limitations}
\label{disuccsion}
The system has multiple factors contributing to short length and high variance of flights.
First, the PWM equilibrium values of the motors shift by over $10\%$ following a collision, causing the true dynamics model to shift over time.
This problem is partially mitigated by replacing the components of the Crazyflie, but any change of hardware causes dynamics model mismatch and the challenge persists.
Additionally, the internal state estimator does not track extreme changes in Euler angles accurately.
We believe that overcoming the system-level and dynamical limitations of controlling the Crazyflie in this manner showcases the expressive power of MBRL.
Improvements to the peak performance will come by identifying causes of the performance plateau.
Elements to investigate include the data-limited slow down in improvement of the dynamics model accuracy, the different collected data distributions at each roll-out, the stochasticity of NN training, and the stochasticity at running time with MPC.
Beyond improving performance, computational burden and safety hinder the applicability of MBRL with MPC to more systems.
The current method requires a GPU-enabled base-station, but the computational efficiency could be improved with intelligent action sampling methods or by combining model free techniques, such as learning a deterministic action policy based on the learned dynamics model.
We are exploring methods to generate NN control policies, such as an imitative-MPC network or a model-free variant, on the dynamics model that could reduce computation by over 1000x by only evaluating a NN once per state measurement.
In order to enhance safety, we are interested in defining safety constraints within the model predictive controller, rather than just a safety kill-switch in firmware, opening the door to fully autonomous learned control from start to finish.
\section{Conclusions and Future Work}
This work is an exploration of the capabilities of model-based reinforcement learning for low-level control of an \textit{a priori} unknown dynamic system.
The results, with the added challenges of the static instability and fast dynamics of the Crazyflie, show the capabilities and future potential of MBRL.
We detail the firmware modifications, system design, and model learning considerations required to enable the use of a MBRL-based MPC system for quadrotor control over radio.
We removed all robot-specific transforms and higher level commands to only design the controller on top of a learned dynamics model to accomplish a simple task.
The controller shows the capability to hover for multiple seconds at a time with less than 3 minutes of collected data -- approximately half of the full battery life flight time of a Crazyflie.
With learned flight in only minutes of testing, this brand of system-agnostic MBRL is an exciting solution not only due to its generalizability, but also due to its learning speed.
In parallel with addressing the limitations outlined in \sec{disuccsion}, the quadrotor results warrant investigation into low level control of other robots.
The emergent area of microrobotics combines the issues of under-characterized dynamics, weak or non-existent controllers, ``fast'' dynamics and therefore instabilities, and high cost-to-test~\cite{drew2018toward,contreras2017first}, so it is a strong candidate for MBRL experiments.
\section{Appendix}
\csvstyle{myTableStyle}{tabular=|l||c|c|c|c|c|,
table head=\hline R & Mean Time (ms) & Std. Dev. Time & Collected Points & Total Trained Points & RMS pitch \& roll \\\hline\hline,
late after line=\\\hline,
head to column names}
\subsection{Battery Voltage Context}
\label{Battery Voltage}
The Crazyflie has a short battery voltage of about 7 minutes of flight time and operation depends heavily on battery voltage, with it becoming uncontrollable on low voltages when operating on our controllers or the built in nested PID controllers.
In this experiment, we study the influence of the battery voltage to the dynamics of the Crazyflie, to understand if there is a time-varying drift that need to be compensated.
We investigate this hypothesis by logging battery voltage and adding it to the state passed to the neural network during model training to improve prediction accuracy.
\begin{figure*}[b!]
\centering
\includegraphics[width=\textwidth]{figures/final/appe-v1.png}
\caption{Demonstration of the effect of battery voltage on state predictions. The top row is the ground truth one step pitch changes, the middle is the predictions through a model trained with battery voltage included in the state, and the bottom is predictions without battery voltage included in the state. Both of the predictions show tighter grouping from the variance term on the probabilistic loss function, but there is an extremely low difference between the predictions with and the predictions without battery. The lack of difference in predictions indicates the battery voltage is latent to other variables passed into the network.}
\label{fig:vbat}
\end{figure*}
When operating the Crazyflie at control frequencies of greater than \SI{100}{\hertz}, the state dynamics become clearly biased at battery voltages less than 3,650 mV.
The biases are present at lower frequencies, but less pronounced.
The biased state dynamics can be seen in \fig{fig:vbat}, but the predictions do not improve when passing the battery voltage into the neural network dynamics model at any battery level.
The RMS error delta between a model trained with and without battery voltage is less than 1\%, indicating that the battery voltage is nearly completely captured in other variables passed to the network.
A potential explanation for the lack of model improvement with logged battery voltage is that the current battery reading is latent in other variables past into the network, and the natural charge based variations in data are not dominant.
The logged data shows a clear inverse relationship between battery voltage and current Crazyflie thrust, shown in \fig{fig:batthrust}.
The impedance of the motors changes depending on the rotor speed and drive.
This battery and thrust relationship is less likely to be apparent on quadrotors with separate motor voltage controllers, where the impedance of the motors changing with revolutions per minute would be compensated for.
\subsection{Crazyflie Lifespan}
\label{Lifespan}
\begin{figure*}[t]
\centering
\includegraphics[width=\textwidth]{figures/final/lifetimeplotv6.png}
\caption{The sensor noise on the 3 angular accelerations measured by the gyroscope of the MPU9250 of the Crazyflie before the robot takes off. The black vertical lines separate the rollouts at \SI{25}{\hertz}, \SI{50}{\hertz} and \SI{75}{\hertz} from left to right. The vertical lines indicate changes in hardware and collisions that would change the dynamics or state of the robot. The sensors clearly are subject to increasing noise over lifespan.}
\label{fig:life}
\end{figure*}
\begin{figure}[t]
\centering
\includegraphics[width=\columnwidth]{figures/final/thrustvsbattery-v4.png}
\caption{The logged battery voltage and mean PWM of the 4 motors across a flight. There is a clear inverse relationship between the logged battery voltage and the current thrust.}
\label{fig:batthrust}
\end{figure}
Extended periods of testing on individuals quadrotors demonstrated a finite lifetime.
After many flights, performance would dip inexplicably.
This is due to a combination of motor damage and or sensor decay.
Motor damage causes a measureable change in the equilibrium PWMs for a given quadrotor.
\fig{fig:life} shows the change in the noise on the gyroscope before takeoff for all of the flights taken by the quadcopter used to collect data for this publication.
The left two sections includes the data included in \ref{sec:eval}, but the data taken at a control frequency of \SI{75}{\hertz} was abandoned due to inconsistent performance.
Some initial flights at \SI{75}{\hertz} were extremely promising, but after a series of collisions via drift the quadrotor would not take off cleanly.
Future work should investigate methods of mitigating the effect of sensor drift, potentially by conditioning the dynamics model on a sensor noise measurement or enforcing more safety constraints on flight.
\subsection{Frequency Dependent Learning}
\label{frequency}
There is a trend between learned performance at both frequencies and the number of trained points for the model, as shown in \fig{fig:pts}.
The continuing upward trend between logarithmic points and flight time indicates further data collection could enhance flight performance, but is unrealistic without further progress on safe learning with the Crazyflie.
Potential future applications could leverage a combination of our results with bootstrapping data to continue to improve performance without the difficulties of logging large amoutns of experimental data on an individual robot.
\begin{figure}[h]
\centering
\includegraphics[width=\columnwidth]{figures/final/trainedptsv3.png}
\caption{Mean flight time of each rollout plotted verses the logarithm of the number of available points at train time for each model. The higher control frequency allows the controller to learn faster on wall time, but the plot indicates that there is not a notable difference between control ability when the number of trained points are equal. There is a continuing upward trend of flight time verses training points, but it is difficult to obtain more data in experiment.}
\label{fig:pts}
\end{figure}
\section*{ACKNOWLEDGMENT}
The authors thank the UC Berkeley Sensor~\&~Actuator Center (BSAC), Berkeley DeepDrive, and Nvidia Inc.
\bibliographystyle{IEEEtran}
\section{Experimental Setup}
\begin{figure}[t]
\centering
\includegraphics[width=0.7\columnwidth]{figures/final/ROS_Struct_shrink.pdf}
\caption{
The ROS computer passes control signals and state data between the MPC node and the Crazyflie ROS server. The Crazyflie ROS server packages Tx PWM values to send and unpacks Rx compressed log data from the robot.}
\label{fig:ROSsystem}
\end{figure}
In this paper, we use as experimental hardware platform the open-source Crazyflie 2.0 quadrotor~\cite{bitcraze2016crazyflie}.
The Crazyflie is \SI{27}{\gram} and \SI{9}{cm^2}, so the rapid system dynamics create a need for a robust controller; by default, the internal PID controller used for attitude control runs at \SI{500}{\hertz}, with Euler angle state estimation updates at \SI{1}{kHz}.
This section specifies the ROS base-station and the firmware modifications required for external stability control of the Crazyflie.
All components we used are based on publicly available and open source projects.
We used the Crazyflie ROS interface supported here: \href{https://github.com/whoenig/crazyflie_ros}{github.com/whoenig/crazyflie\text{\_}ros}~\cite{honig2017flying}.
This interface allows for easy modification of the radio communication and employment of the learning framework.
Our ROS structure is simple, with a Crazyflie subscribing to PWM values generated by a controller node, which processes radio packets sent from the quadrotor in order to pass state variables to the model predictive controller (as shown in \fig{fig:ROSsystem}).
The Crazyradio PA USB radio is used to send commands from the ROS server; software settings in the included client increase the maximum data transmission bitrate up to \SI{2}{Mbps} and a Crazyflie firmware modification improves the maximum traffic rate from \SI{100}{\hertz} to \SI{400}{\hertz}.
In packaged radio transmissions from the ROS server we define actions directly as the pulse-width modulation~(PWM) signals sent to the motors.
To assign these PWM values directly to the motors we bypass the controller updates in the standard Crazyflie firmware by changing the motor power distribution whenever a CRTP Commander packet is received (see \fig{fig:ROSsystem}).
The Crazyflie ROS package sends empty ping packets to the Crazyflie to ask for logging data in the returning acknowledgment packet; without decreasing the logging payload and rate we could not simultaneously transmit PWM commands at the desired frequency due to radio communication constraints. We created a new internal logging block of compressed IMU data and Euler angle measurements to decrease the required bitrate for logging state information, trading state measurement precision for update frequency.
Action commands and logged state data are communicated asynchronously; the ROS server control loop has a frequency set by the ROS rate command, while state data is logged based on a separate ROS topic frequency. To verify control frequency and reconstruct state action pairs during autonomous rollouts we use a round-trip packet ID system.
\section{Experimental Evaluation}
\label{sec:eval}
We now describe the setting used in our experiments, the learning process of the system, and the performance summary of the control algorithm.
Videos of the flying quadrotor, and full code for controlling the Crazyflie and reproducing the experiments, are available online at \url{https://sites.google.com/berkeley.edu/mbrl-quadrotor/}
\subsection{Experimental Setting}
The performance of our controller is measured by the average flight length over each roll-out.
Failure is often due to drift induced collisions, or, as in many earlier roll-outs, when flights reach a pitch or roll angle over \SI{40}{\degree}.
In both cases, an emergency stop command is sent to the motors to minimize damage.
Additionally, the simple on-board state estimator shows heavy inconsistencies on the Euler angles following a rapid throttle ramping, which is a potential limiting factor on the length of controlled flight.
Notably, a quadrotor with internal PIDs enabled will still fail regularly due to drift on the same time frame as our controller; it is only with external inputs that the internal controllers will obtain substantially longer flights.
The drift showcases the challenge of using attitude controllers to mitigate an offset in velocity.
\begin{figure}[t]
\centering
\includegraphics[width=.8\columnwidth]{figures/final/time_final.pdf}
\caption{Mean and standard deviation of the 10 flights during each rollout learning at \SI{25}{\hertz} and \SI{50}{\hertz}. The \SI{50}{\hertz} shows a slight edge on final performance, but a much quicker learning ability per flight by having more action changes during control.}
\label{fig:learn}
\end{figure}
\begin{figure*}[t]
\centering
\includegraphics[width=.80\textwidth]{figures/final/rollcompare_final2.pdf}
\caption{The pitch over time for each flight in the first four roll-outs of learning at \SI{50}{\hertz}, showing the rapid increase in control ability on limited data.
The random and first controlled roll-out show little ability, but roll-out 3 is already flying for $>2$~seconds.
}
\label{fig:roll}
\end{figure*}
\subsection{Learning Process}
The learning process follows the RL framework of collecting data and iteratively updating the policy.
We trained an initial model $f_0$ on 124 and 394 points of dynamics data at \SI{25}{\hertz} and \SI{50}{\hertz}, respectively, from the Crazyflie being flown by a random action controller.
Starting with this initial model as the MPC plant, the Crazyflie undertakes a series of autonomous flights from the ground with a \SI{250}{ms} ramp up, open-loop takeoff followed by on-policy control while logging data via radio.
Each roll-out is a series of 10 flights, which causes large variances in flight time.
The initial roll-outs have less control authority and inherently explore more extreme attitude orientations (often during crashes), which is valuable to future iterations that wish to recover from higher pitch and/or roll.
The random and first three controlled roll-outs at \SI{50}{\hertz} are plotted in \fig{fig:roll} to show the rapid improvement of performance with little training data.
The full learning curves are shown in \fig{fig:learn}.
At both \SI{25}{\hertz} and \SI{50}{\hertz} the rate of flight improvement reaches its maximum once there is 1,000 trainable points for the dynamics model, which takes longer to collect at the lower control frequency.
The improvement is after roll-out 1 at 50Hz and roll-out 5 at 25Hz.
The longest individual flights at both control frequencies is over \SI{5}{\second}.
The final models at \SI{25}{\hertz} and \SI{50}{\hertz} are trained on 2,608 and 9,655 points respectively, but peak performance is earlier due to dynamics model convergence and hardware lifetime limitations.
\begin{figure}[t]
\centering
\includegraphics[width=.88\columnwidth]{figures/final/segment_final.pdf}
\caption{The performance of the \SI{50}{\hertz} controller. (\textit{Above}) The controlled PWM values over time, which visibly change in response to angle oscillations. (\textit{Below}) Pitch and roll.}
\label{fig:eval}
\end{figure}
\subsection{Performance Summary}
This controller demonstrates the ability to hover, following a ``clean'' open-loop takeoff, for multiple seconds (an example is shown in \fig{fig:photos}).
At both \SI{25}{\hertz} and \SI{50}{\hertz}, once reaching maximum performance in the 12 roll-outs, about $30\%$ of flights fail to drift.
The failures due to drift indicate the full potential of the MBRL solution to low-level quadrotor control.
An example of a test flight segment is shown in \fig{fig:eval}, where the control response to pitch and roll error is visible.
\begin{figure*}[t]
\centering
\includegraphics[width=.82\textwidth]{figures/final/photosv6.png}
\caption[Caption of Photos]{A full flight of Euler angle state data with frames of the corresponding video. This flight would have continued longer if not for drifting into the wall. The relation between physical orientation and pitch and roll is visible in the frames. The full video is online on the accompanying website.}
\label{fig:photos}
\end{figure*}
The basis of comparison, typical quadrotor controllers, achieve better performance, but with higher control frequencies and engineering design iterations leveraging system dynamics knowledge.
With the continued improvement of computational power, the performance of this method should be re-characterized as potential control frequencies approach that of PID controllers.
Beyond comparison to PID controllers with low computational footprints, the results warrant exploration of MBRL for new dynamical systems with or when varying goals need to be built into low level control.
In less than 10 minutes of clock time, and only 3 minutes of training data, we present comparable, but limited, performance that is encouraging for future abilities to match and surpass basic controllers.
Moving the balance of this work further towards domain specific control would likely improve performance, but the broad potential for applications to more and different robotic platforms compels exciting future use of MBRL.
\section{Related Work}
\subsection{Attitude and Hover Control of Quadrotors}
Classical controllers (e.g., PID, LQR, iLQR) in conjunction with analytic models for the rigid body dynamics of a quadrotor are often sufficient to control vehicle attitude~\cite{mahony2012multirotor}.
In addition, linearized models are sufficient to simultaneously control for global trajectory attitude setpoints using well-tuned nested PID controllers~\cite{mellinger2012trajectory}.
Standard control approaches show impressive acrobatic performance with quadrotors, but we note that we are not interested in comparing our approach to finely-tuned performance; the goal of using MBRL in this context is to highlight a solution that automatically generates a functional controller in less or equal time than initial PID hand-tuning, with no foundation of dynamics knowledge.
Research focusing on developing novel low-level attitude controllers shows functionality in extreme nonlinear cases, such as for quadrotors with a missing propeller ~\cite{zhang2016controllable}, with multiple damaged propellers~\cite{mueller2014stability}, or with the capability to dynamically tilt its propellers~\cite{ryll2012modeling}. Optimal control schemes have demonstrated results on standard quadrotors with extreme precision and robustness \cite{liu2016robust}.
Our work differs by specifically demonstrating the possibility of attitude control via real-time external MPC. Unlike other work on real-time MPC for quadrotors which focus on trajectory control~\cite{bangura2014real,abdolhosseini2013efficient}, ours uses a dynamics model derived fully from in-flight data that takes motors signals as direct inputs.
Effectively, our model encompasses only the actual dynamics of the system, while other implementations learn the dynamics conditioned on previously existing internal controllers.
The general nature of our model from sensors to actuators demonstrates the potential for use on robots with no previous controller --- we only use the quadrotor as the basis for comparison and do not expect it to be the limits of the MBRL system's functionality.
\subsection{Learning for Quadrotors}
Although learning-based approaches have been widely applied for trajectory control of quadrotors, implementations typically rely on sending controller outputs as setpoints to stable on-board attitude and thrust controllers.
Iterative learning control~(ILC) approaches~\cite{schoellig2012optimization,sferrazza2017trajectory} have demonstrated robust control of quadrotor flight trajectories but require these on-board controllers for attitude setpoints.
Learning-based model predictive control implementations, which successfully track trajectories, also wrap their control around on-board attitude controllers by directly sending Euler angle or thrust commands~\cite{bouffard2012learning,koller2018learning}.
Gaussian process-based automatic tuning of position controller gains has been demonstrated~\cite{berkenkamp2016safe}, but only in parallel with on-board controllers tuned separately.
Model-free reinforcement learning has been shown to generate control policies for quadrotors that out-performs linear MPC~\cite{Hwangbo2017}.
Although similarly motivated by a desire to generate a control policy acting directly on actuator inputs, the work used an external vision system for state error correction, operated with an internal motor speed controller enabled (i.e., thrusts were commanded and not motor voltages), and generated a large fraction of its data in simulation.
Researchers of system identification for quadrotors also apply machine learning techniques.
Bansal et al. used NN models of the Crazyflie's dynamics to plan trajectories~\cite{Bansal2016}.
Our implementation differs by directly predicting change in attitude with on-board IMU measurements and motor voltages, rather than predicting with global, motion-capture state measurements and thrust targets for the internal PIDs.
Using Bayesian Optimization to learn a linearized quadrotor dynamics model demonstrated capabilities for tuning of an optimal control scheme~\cite{Bansal2017}.
While this approach is data-efficient and is shown to outperform analytic models, the model learned is task-dependent. Our MBRL approach is task agnostic by only requiring a change in objective function and no new dynamics data for a new function.
\subsection{Model-based Reinforcement Learning}
Functionality of MBRL is evident in simulation for multiple tasks in low data regimes, including quadrupeds~\cite{clavera2018learning} and manipulation tasks~ \cite{kupcsik2017model}.
Low-level MBRL control (i.e., with direct motor input signals) of an RC car has been demonstrated experimentally, but the system is of lower dimensionality and has static stability~\cite{abbeel2008apprenticeship}.
Relatively low-level control (i.e., mostly thrust commands only passed through an internal governor before conversion to motor signals) of an autonomous helicopter has been demonstrated, but required a ground-based vision system for error correction in state estimates as well as expert demonstration for model training~\cite{abbeel2008apprenticeship}.
Properly optimized NNs trained on experimental data show test error below common analytic dynamics models for flying vehicles, but the models did not include direct actuator signals and did not include experimental validation through controller implementation~\cite{Punjani2015}.
A model predictive path integral~(MPPI) controller using a learned NN demonstrated data-efficient trajectory control of a quadrotor, but results were only shown in simulation and required the network to be initialized with 30 minutes of demonstration data with on-board controllers~\cite{Williams2017}.
MBRL with trajectory sampling for control outperforms, in terms of samples needed for convergence, the asymptotic performance of recent model free algorithms in low dimensional tasks \cite{Chua2018}.
Our work builds on strategies presented, with most influence derived from ``probabilistic'' NNs, to demonstrate functionality in an experimental setting --- i.e., in the presence of real-world higher order effects, variability, and time constraints.
NN-based dynamics models with MPC have functioned for experimental control of an under-actuated hexapod \cite{nagabandi2017neural}.
The hexapod platform does not have the same requirements on frequency or control error due to its static stability, and incorporates a GPS unit for relatively low-noise state measurements.
Our work has a similar architecture, but has improvements in the network model and model predictive controller to allow substantially higher control frequencies with noisy state data.
By demonstrating functionality without global positioning data, the procedure can be extended to more robot platforms where only internal state and actuator commands are available to create a dynamics model and control policy.
\section{Learning Forward Dynamics}
\label{sec:modeltraining}
\begin{figure}[t]
\centering
\includegraphics[width=.6\columnwidth]{figures/final/nn_2layer.pdf}
\caption{The NN dynamics model predicts the mean and variance of the change in state given the past 4 state-action pairs.
We use 2 hidden layers of width 250 neurons.
}
\label{fig:nn}
\end{figure}
The foundation of a controller in MBRL is a reliable forward dynamics model for predictions.
In this paper, we refer to the current state and action as $s_t$ and $a_t$, which evolve according to the dynamics $f(s_t,a_t)$.
Generating a dynamics model for the robot often consists of training a NN to fit a parametric function $f_\theta$ to predict the next state of the robot as a discrete change in state $s_{t+1} = s_t + f_\theta(s_t,a_t)$.
In training, using a probabilistic loss function with a penalty term on the variance of estimates, as shown in \eq{pll}, better clusters predictions for more stable predictions across multiple time-steps~\cite{Chua2018}.
The probabilistic loss fits a Gaussian distribution to each output of the network, represented in total by a mean vector $\mu_\theta$ and a covariance matrix $\Sigma_\theta$
\begin{align}
\label{pll}
l = \sum_{n=1}^N & [\mu_\theta (s_n, a_n) - s_{n+1}]^T \Sigma_{\theta}^{-1} (s_n, a_n) [\mu_\theta (s_n, a_n) - s_{n+1}] \nonumber \\
& + \text{log det } \Sigma_\theta (s_n, a_n)\,.
\end{align}
The probabilistic loss function assists model convergence and the variance penalty helps maintain stable predictions on longer time horizons.
Our networks implemented in Pytorch train with the Adam optimizer~\cite{kingma2014adam} for 60 epochs with a learning rate of $.0005$ and a batch size of 32.
\fig{fig:nn} summarizes the network design.
All layers except for the output layer use the Swish activation function~\cite{ramachandran2017swish} with parameter $\beta = 1$.
The network structure was cross validated offline for prediction accuracy verses potential control frequency.
Initial validation of training parameters was done on early experiments, and the final values are held constant for each rollout in the experiments reported in \sec{sec:eval}.
The validation set is a random subset of measured $(s_t, a_t, s_{t+1})$ tuples in the pruned data.
Additional dynamics model accuracy could be gained with systematic model verification between rollouts, but experimental variation in the current setup would limit empirical insight and a lower model loss does not guarantee improved flight time.
Our initial experiments indicate improved flight performance with forward dynamics models minimizing the mean and variance of state predictions versus models minimizing mean squared prediction error, but more experiments are needed to state clear relationships between more model parameters and flight performance.
Training a probabilistic NN to approximate the dynamics model requires pruning of logged data (e.g. dropped packets) and scaling of variables to assist model convergence.
Our state~$s_t$ is the vector of Euler angles (yaw, pitch, and roll), linear accelerations, and angular accelerations, reading
\begin{equation}
s_t = \big[\dot{\omega}_x, \ \dot{\omega}_y,\ \dot{\omega}_z,\ \phi,\ \theta,\ \psi,\ \ddot{x}, \ \ddot{y}, \ \ddot{z} \big]^T.
\end{equation}
The Euler angles are from the an internal complementary filter, while the linear and angular accelerations are measured directly from the on-board MPU-9250 9-axis IMU.
In practice, for predicting across longer time horizons, modeling acceleration values as a global next state rather than a change in state increased the length of time horizon in composed predictions before the models diverged.
While the change in Euler angle predictions are stable, the change in raw accelerations vary widely with sensor noise and cause non-physical dynamics predictions, so all the linear and angular accelerations are trained to fit the global next state.
We combine the state data with the four PWM values, $a_t = [ m_1, m_2, m_3, m_4 ]^T $, to get the system information at time $t$.
The NNs are cross-validated to confirm using all state data (i.e., including the relatively noisy raw measurements) improves prediction accuracy in the change in state.
While the dynamics for a quadrotor are often represented as a linear system, for a Micro Air Vehicle (MAV) at high control frequencies motor step response and thrust asymmetry heavily impact the change in state, resulting in a heavily nonlinear dynamics model.
The step response of a Crazyflie motor RPM from PWM 0 to max or from max to 0 is on the order of \SI{250}{ms}, so our update time-step of \SI{20}{ms} is short enough for motor spin-up to contribute to learned dynamics.
To account for spin-up, we append past system information to the current state and PWMs to generate an input into the NN model that includes past time.
From the exponential step response and with a bounded possible PWM value within $p_{eq} \pm 5000$, the motors need approximately \SI{25}{ms} to reach the desired rotor speed; when operating at \SI{50}{\hertz}, the time step between updates is \SI{20}{ms}, leading us to an appended states and PWMs history of length 4. This state action history length was validated as having the lowest test error on our data-set (lengths 1 to 10 evaluated).
This yields the final input of length 52 to our NN, $\xi$, with states and actions combined to $\xi_t = \big[s_t \ s_{t-1} \ s_{t-2} \ s_{t-3} \ a_t \ a_{t-1} \ a_{t-2} \ a_{t-3} \big]^T$.
\section{Introduction}
\IEEEPARstart{T}{he} ideal method for generating a robot controller would be extremely data efficient, free of requirements on domain knowledge, and safe to run.
Current strategies to derive low-level controllers are effective across many platforms, but system identification often requires substantial setup and experiment time while PID tuning requires some domain knowledge and still results in dangerous roll-outs.
With the goal to reduce reliance on expert-based controller design, in this paper we investigate the question:
Is it possible to autonomously learn competitive low-level controllers for a robot, without simulation or demonstration, in a limited amount of time?
\begin{figure}[t]
\centering
\includegraphics[width=.9\columnwidth]{figures/final/SystemBlock.pdf}
\caption{The model predictive control loop used to stabilize the Crazyflie.
Using deep model-based reinforcement learning, the quadrotor reaches stable hovering with only 10,000 trained datapoints -- equivalent to 3 minutes of flight.}
\label{fig:sysblock}
\end{figure}
To answer this question, we turn to model-based reinforcement learning~(MBRL) -- a compelling approach to synthesize controllers even for systems without analytic dynamics models and with high cost per experiment~\citep{gpcontrol}.
MBRL has been shown to operate in a data-efficient manner to control robotic systems by iteratively learning a dynamics model and subsequently leveraging it to design controllers~\citep{Williams2017}.
Our contribution builds on simulated results of MBRL~\citep{Chua2018}.
We employ the quadrotor as a testing platform to broadly investigate controller generation on a highly nonlinear, challenging system, not to directly compare performance versus existing controllers.
This paper is the first demonstration of controlling a quadrotor with direct motor assignments sent from a MBRL derived controller learning only via experience.
Our work differs from recent progress in MBRL with quadrotors by exclusively using experimental data and focusing on low level control, while related applications of learning with quadrotors employ low-level control generated in simulation~\cite{Hwangbo2017} or use a dynamics model learned via experience to command on-board controllers~\cite{Bansal2016}.
Our MBRL solution, outlined in~\fig{fig:sysblock}, employs neural networks (NN) to learn a forwards dynamics model coupled with a `random shooter' MPC, which can be efficiently parallelized on a graphic processing unit~(GPU) to execute low-level, real-time control.
Using MBRL, we demonstrate controlled hover of a Crazyflie via on-board sensor measurements and application of pulse width modulation~(PWM) motor voltage signals.
Our method for quickly learning controllers from real-world data is not yet an alternative to traditional controllers such as PID, but it opens important avenues of research.
The general mapping of the forward dynamics model, in theory, allows the model to be used for control tasks beyond attitude control.
Additionally, we highlight the capability of leveraging the predictive models learned on extremely little data for working at frequencies $\leq$\SI{50}{\hertz}, while a hand tuned PID controller at this frequency failed to hover the Crazyflie.
With the benefits outlined, the current MBRL approach has limitations in performance and applicability to our goal of use with other robots.
The performance in this paper has notable room for improvement by mitigating drift.
Future applications are limited by our approach's requirement of a high power external GPU -- a prohibitively large computational footprint when compared to standard low-level controllers -- and by the method's potential for collisions when learning.
The resulting system achieves repeated stable hover of up to 6 seconds, with failures due to drift of unobserved states, within 3 minutes of fully-autonomous training data.
These results demonstrate the ability of MBRL to control robotic systems in the absence of \textit{a priori} knowledge of dynamics, pre-configured internal controllers for stability or actuator response smoothing, and expert demonstration.
\section*{ACKNOWLEDGMENT}
The authors thank the UC Berkeley Sensor~\&~Actuator Center (BSAC), Berkeley DeepDrive, and Nvidia Inc.
\bibliographystyle{IEEEtran}
\section{Low Level Model-Based Control}
This section explains how we incorporate our learned forward dynamics model into a functional controller.
The dynamics model is used for control by predicting the state evolution given a certain action, and the MPC provides a framework for evaluating many action candidates simultaneously.
We employ a `random shooter' MPC, where a set of $N$ randomly generated actions are simulated over a time horizon~$T$.
The best action is decided by a user designed objective function that takes in the simulated trajectories $\hat{X}(a,s_t)$ and returns a best action, $a^*$, as visualized in \fig{fig:mpc}.
The objective function minimizes the receding horizon cost of each state from the end of the prediction window to the current measurement.
The candidate actions, $\{a_{i} = (a_{i,1}, a_{i,2}, a_{i,3}, a_{i,4})\}_{i=1}^N$, are 4-tuples of motor PWM values centered around the stable hover-point for the Crazyflie.
The candidate actions are constant across the prediction time horizon $T$.
For a single sample $a_{i}$, each $a_{i,j}$ is chosen from a uniform random variable on the interval $[p_{eq,j} - \sigma, p_{eq,j} + \sigma]$, where $p_{eq,j}$ is the equilibrium PWM value for motor $j$.
The range of the uniform distribution is controlled by the tuned parameter $\sigma$; this has the effect of restricting the variety of actions the Crazyflie can take.
For the given range of PWM values for each motor, $[p_{eq} - \sigma, p_{eq} + \sigma]$, we discretize the candidate PWM values to a step size of 256 to match the future compression into a radio packet.
This discretization of available action choices increases the coverage of the candidate action space.
The compression of PWM resolution, while helpful for sampling and communication, represents an uncharacterized detriment to performance.
Our investigation focuses on controlled hovering, but other tasks could be commanded with a simple change to the objective function.
The objective we designed for stability seeks to minimize pitch and roll, while adding additional cost terms to Euler angle rates.
In the cost function, $\lambda$ effects the ratio between proportional and derivative gains.
Adding cost terms to predicted accelerations did not improve performance because of the variance of the predictions.
\begin{align}
a^*
= \argmin_a \sum_{t=1}^T \lambda (\psi_{t}^2 + \theta_{t}^2) + \dot{\psi}_{t}^2 + \dot{\theta}_{t}^2 + \dot{\phi}_{t}^2\,.
\end{align}
Our MPC operates on a time horizon $T=12$ to leverage the predictive power of our model.
Higher control frequencies can run at a cost of prediction horizon, such as $T=9$ at \SI{75}{\hertz} or $T=6$ at \SI{100}{\hertz}.
The computational cost is proportional to the product of model size, number of actions ($N$), and time horizon ($T$).
At high frequencies the time spanned by the dynamics model predictions shrinks because of a smaller dynamics step in prediction and by having less computation for longer $T$, limiting performance.
At \SI{50}{\hertz}, a time horizon of 12 corresponds to a prediction of \SI{240}{ms} into the future.
Tuning the parameters of this methodology corresponds to changes in the likelihood of taking the best action, rather than modifying actuator responses, and therefore its effect on performance is less sensitive than changes to PID or standard controller parameters.
At \SI{50}{\hertz}, the predictive power is strong, but the relatively low control frequencies increases susceptibility to disturbances in between control updates.
A system running with an Nvidia Titan Xp attains a maximum control frequency of \SI{230}{\hertz} with $N= 5000, T=1$.
For testing we use locked frequencies of \SI{25}{\hertz} and \SI{50}{\hertz} at $N=5000, \ T=12$.
\begin{figure}[t!]
\centering
\includegraphics[width=.8\columnwidth]{figures/final/waterfall_final.pdf}
\caption{Predicted states for $N=50$ candidate actions with the chosen ``best action'' highlighted in red.
The predicted state evolution is expected to diverge from the ground truth for future $t$ because actions are re-planned at every step.}
\label{fig:mpc}
\end{figure}
\section{Appendix}
\csvstyle{myTableStyle}{tabular=|l||c|c|c|c|c|,
table head=\hline R & Mean Time (ms) & Std. Dev. Time & Collected Points & Total Trained Points & RMS pitch \& roll \\\hline\hline,
late after line=\\\hline,
head to column names}
\subsection{Battery Voltage Context}
\label{Battery Voltage}
The Crazyflie has a short battery voltage of about 7 minutes of flight time and operation depends heavily on battery voltage, with it becoming uncontrollable on low voltages when operating on our controllers or the built in nested PID controllers.
In this experiment, we study the influence of the battery voltage to the dynamics of the Crazyflie, to understand if there is a time-varying drift that need to be compensated.
We investigate this hypothesis by logging battery voltage and adding it to the state passed to the neural network during model training to improve prediction accuracy.
\begin{figure*}[b!]
\centering
\includegraphics[width=\textwidth]{figures/final/appe-v1.png}
\caption{Demonstration of the effect of battery voltage on state predictions. The top row is the ground truth one step pitch changes, the middle is the predictions through a model trained with battery voltage included in the state, and the bottom is predictions without battery voltage included in the state. Both of the predictions show tighter grouping from the variance term on the probabilistic loss function, but there is an extremely low difference between the predictions with and the predictions without battery. The lack of difference in predictions indicates the battery voltage is latent to other variables passed into the network.}
\label{fig:vbat}
\end{figure*}
When operating the Crazyflie at control frequencies of greater than \SI{100}{\hertz}, the state dynamics become clearly biased at battery voltages less than 3,650 mV.
The biases are present at lower frequencies, but less pronounced.
The biased state dynamics can be seen in \fig{fig:vbat}, but the predictions do not improve when passing the battery voltage into the neural network dynamics model at any battery level.
The RMS error delta between a model trained with and without battery voltage is less than 1\%, indicating that the battery voltage is nearly completely captured in other variables passed to the network.
A potential explanation for the lack of model improvement with logged battery voltage is that the current battery reading is latent in other variables past into the network, and the natural charge based variations in data are not dominant.
The logged data shows a clear inverse relationship between battery voltage and current Crazyflie thrust, shown in \fig{fig:batthrust}.
The impedance of the motors changes depending on the rotor speed and drive.
This battery and thrust relationship is less likely to be apparent on quadrotors with separate motor voltage controllers, where the impedance of the motors changing with revolutions per minute would be compensated for.
\subsection{Crazyflie Lifespan}
\label{Lifespan}
\begin{figure*}[t]
\centering
\includegraphics[width=\textwidth]{figures/final/lifetimeplotv6.png}
\caption{The sensor noise on the 3 angular accelerations measured by the gyroscope of the MPU9250 of the Crazyflie before the robot takes off. The black vertical lines separate the rollouts at \SI{25}{\hertz}, \SI{50}{\hertz} and \SI{75}{\hertz} from left to right. The vertical lines indicate changes in hardware and collisions that would change the dynamics or state of the robot. The sensors clearly are subject to increasing noise over lifespan.}
\label{fig:life}
\end{figure*}
\begin{figure}[t]
\centering
\includegraphics[width=\columnwidth]{figures/final/thrustvsbattery-v4.png}
\caption{The logged battery voltage and mean PWM of the 4 motors across a flight. There is a clear inverse relationship between the logged battery voltage and the current thrust.}
\label{fig:batthrust}
\end{figure}
Extended periods of testing on individuals quadrotors demonstrated a finite lifetime.
After many flights, performance would dip inexplicably.
This is due to a combination of motor damage and or sensor decay.
Motor damage causes a measureable change in the equilibrium PWMs for a given quadrotor.
\fig{fig:life} shows the change in the noise on the gyroscope before takeoff for all of the flights taken by the quadcopter used to collect data for this publication.
The left two sections includes the data included in \ref{sec:eval}, but the data taken at a control frequency of \SI{75}{\hertz} was abandoned due to inconsistent performance.
Some initial flights at \SI{75}{\hertz} were extremely promising, but after a series of collisions via drift the quadrotor would not take off cleanly.
Future work should investigate methods of mitigating the effect of sensor drift, potentially by conditioning the dynamics model on a sensor noise measurement or enforcing more safety constraints on flight.
\subsection{Frequency Dependent Learning}
\label{frequency}
There is a trend between learned performance at both frequencies and the number of trained points for the model, as shown in \fig{fig:pts}.
The continuing upward trend between logarithmic points and flight time indicates further data collection could enhance flight performance, but is unrealistic without further progress on safe learning with the Crazyflie.
Potential future applications could leverage a combination of our results with bootstrapping data to continue to improve performance without the difficulties of logging large amoutns of experimental data on an individual robot.
\begin{figure}[h]
\centering
\includegraphics[width=\columnwidth]{figures/final/trainedptsv3.png}
\caption{Mean flight time of each rollout plotted verses the logarithm of the number of available points at train time for each model. The higher control frequency allows the controller to learn faster on wall time, but the plot indicates that there is not a notable difference between control ability when the number of trained points are equal. There is a continuing upward trend of flight time verses training points, but it is difficult to obtain more data in experiment.}
\label{fig:pts}
\end{figure}
\section{Conclusions and Future Work}
This work is an exploration of the capabilities of model-based reinforcement learning for low-level control of an \textit{a priori} unknown dynamic system.
The results, with the added challenges of the static instability and fast dynamics of the Crazyflie, show the capabilities and future potential of MBRL.
We detail the firmware modifications, system design, and model learning considerations required to enable the use of a MBRL-based MPC system for quadrotor control over radio.
We removed all robot-specific transforms and higher level commands to only design the controller on top of a learned dynamics model to accomplish a simple task.
The controller shows the capability to hover for multiple seconds at a time with less than 3 minutes of collected data -- approximately half of the full battery life flight time of a Crazyflie.
With learned flight in only minutes of testing, this brand of system-agnostic MBRL is an exciting solution not only due to its generalizability, but also due to its learning speed.
In parallel with addressing the limitations outlined in \sec{disuccsion}, the quadrotor results warrant investigation into low level control of other robots.
The emergent area of microrobotics combines the issues of under-characterized dynamics, weak or non-existent controllers, ``fast'' dynamics and therefore instabilities, and high cost-to-test~\cite{drew2018toward,contreras2017first}, so it is a strong candidate for MBRL experiments.
\section{Discussion and Limitations}
\label{disuccsion}
The system has multiple factors contributing to short length and high variance of flights.
First, the PWM equilibrium values of the motors shift by over $10\%$ following a collision, causing the true dynamics model to shift over time.
This problem is partially mitigated by replacing the components of the Crazyflie, but any change of hardware causes dynamics model mismatch and the challenge persists.
Additionally, the internal state estimator does not track extreme changes in Euler angles accurately.
We believe that overcoming the system-level and dynamical limitations of controlling the Crazyflie in this manner showcases the expressive power of MBRL.
Improvements to the peak performance will come by identifying causes of the performance plateau.
Elements to investigate include the data-limited slow down in improvement of the dynamics model accuracy, the different collected data distributions at each roll-out, the stochasticity of NN training, and the stochasticity at running time with MPC.
Beyond improving performance, computational burden and safety hinder the applicability of MBRL with MPC to more systems.
The current method requires a GPU-enabled base-station, but the computational efficiency could be improved with intelligent action sampling methods or by combining model free techniques, such as learning a deterministic action policy based on the learned dynamics model.
We are exploring methods to generate NN control policies, such as an imitative-MPC network or a model-free variant, on the dynamics model that could reduce computation by over 1000x by only evaluating a NN once per state measurement.
In order to enhance safety, we are interested in defining safety constraints within the model predictive controller, rather than just a safety kill-switch in firmware, opening the door to fully autonomous learned control from start to finish. | {'timestamp': '2019-07-22T02:12:31', 'yymm': '1901', 'arxiv_id': '1901.03737', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03737'} | arxiv |
\section{Introduction}
\IEEEPARstart{S}{olving} massive-scale computational tasks for machine learning algorithms and data analytics is one of the most rewarding challenges in the era of big data. Modern large-scale computational tasks cannot be solved in a single machine (or worker) anymore. Enabling large-scale computations, distributed computing systems such as MapReduce \cite{mapreduce}, Apache Spark \cite{Spark} and Amazon EC2 have received significant attention in recent years. In distributed computing systems, the large-scale computational tasks are divided into several subtasks, which are computed by different workers in parallel. This parallelization helps to reduce the overall run-time to finish the task and thus enables to handle large-scale computing tasks. However, it is observed that workers that are significantly slow than the average, called \textit{stragglers}, critically slow down the computing time in practical distributed computing systems.
To alleviate the effect of stragglers, the authors of \cite{KLee1} proposed a new framework called \textit{coded computation}, which uses error correction codes to provide redundancy in distributed matrix multiplications. By applying maximum distance separable (MDS) codes, it was shown that total computation time of the coded scheme can achieve an order-wise improvement over uncoded scheme. More recently, coded computation has been applied to various other distributed computing scenarios. In \cite{High}, the authors proposed the use of product codes for high-dimensional matrix multiplication. The authors of \cite{Pcode} also targets high-dimensional matrix multiplication by proposing the use of polynomial codes. The use of short dot product for computing large linear transforms is proposed in \cite{shortdot}, and Gradient coding is proposed with applications to distributed gradient descent in \cite{Gradient1, Gradient2, Gradient3}. Codes for convolution and Fourier transform are studied in \cite{convolution} and \cite{Fourier}, respectively. To compensate the drawback of previous studies which completely ignore the work done by stragglers, the authors of \cite{Draper1, Draper2} introduce the idea of exploiting the work completed by the stragglers.
Mitigating the effect of stragglers over more practical settings are also being studied in recent years. The authors of \cite{heterogeneous} propose an algorithm for speeding up distributed matrix multiplication over heterogeneous clusters, where a variety of computing machines coexist with different capabilities. In \cite{HPark}, a hierarchical coding scheme is proposed to combat stragglers in practical distributed computing systems with multiple racks. The authors of \cite{wireless} also consider a setting where the workers
are connected wirelessly to the master
Codes are also introduced in various studies targeting data shuffling applications \cite{SLi1,SLi2,MAttia,SLi3,wireless_datasuffling,shuffling_limit} in MapReduce style setups. In \cite{SLi3}, a unifed coding framework is proposed for distributed computing, and trade-off between latency of computation and load of communication is studied. A scalable framework is studied in \cite{wireless_datasuffling} for minimizing the communication bandwidth in wireless distributed computing scenario. In \cite{shuffling_limit}, fundamental limits of data shuffling is investigated for distributed learning.
\subsection{Motivation}
In most of the existing studies, it is assumed that the links between the master node and worker nodes are error-free. However, link failures and device failures are common in current wired/wireless networks. It is reported in \cite{Error_datacenter} that the transmitted packets
often get lost in current data centers by various factors such
as congestion or load balancer issues in current data centers. In wireless networks, the transmitted packets can be lost by channel fading or interference. Based on these observations, the authors of \cite{Erasure_storage} considered link failures in the context of distributed storage systems. In this paper, we consider link failures for modern distributed computing systems. The transmission failure
at a specific worker necessitates packet retransmission, which
would in turn increase the overall run-time for the given task. Moreover, when
the bandwidth of the system is limited, the master would not
be able to collect timely results from the workers due to link
failures. A reliable solution to deal with these problems is
required in practical distributed computing systems.
\subsection{Contribution}
In this paper, we model the links between the master node and worker nodes as packet erasure channels, which is inspired by the link failures in practical distributed computing systems. We consider straggler problems in matrix-vector multiplication which is a key computation in many machine learning algorithms. We first separate the run-time at each worker into computation time and communication time. This approach is also taken in the previous work \cite{wireless} on coded computation over wireless networks, under the error-free assumption. Compared to the setting in \cite{wireless}, in our work, packet loss and retransmissions are considered. Thus, the communication time at each worker becomes a random variable which depends on the packet erasure probability.
We analyze the latency in this setting using an $(n,k)$ MDS code. By considering the average computation/communication time and erasure probability, we obtain the overall run-time of the task by analyzing the continuous-time Markov chain for maximum $k$ (when each node computes a single inner product). We also find the lower and upper bounds on the latency in closed-forms. Based on the closed-form expressions we give insights on the bounds and show that the overall run-time becomes log$(n)$ times faster than the uncoded scheme by using $(n,k)$ MDS code. Then for general $k$, we give guidelines to design $(n,k)$ MDS code depending on the erasure probability $\epsilon$. Finally, we consider a setup where the number of retransmissions is limited due to the bandwidth constraint. By formulating practical optimization problems related to latency, transmission bandwidth and probability of successful computation, we obtain achievable performance curves as a function of packet erasure probability.
\subsection{Organization and Notations}
The rest of this paper is organized as follows. In Section \ref{sec:problem_statement}, we describe the master-worker setup with link failures and define a problem statement. Latency analysis for maximum $k$ is performed in Section \ref{sec:analysis1}, and the case for general $k$ is discussed in Section \ref{sec:analysis2}. Then in Section \ref{sec:Finite}, analysis is performed under the setting of limited number of retransmissions. Finally, concluding remarks are drawn in Section \ref{sec:conclusion}.
The definitions and notations used in this paper are summarized as follows.
For $n$ random variables, the $k^{\text{th}}$ order statistic is denoted by the $k^{\text{th}}$ smallest one of $n$. We denote the set $\{1,2,...n\}$ by $[n]$ for $n\in\mathbb{N}$, where $\mathbb{N}$ is the set of positive integers. We also denote the $k^{\text{th}}$ order statistics of $n$ independent random variables $(X_1,X_2,...X_n)$ by $X_{(k)}$. We denote $f(n)=\Theta(g(n))$ if there exist $c_1,c_2,n_0>0$ such that $\forall n>n_0$, $c_1g(n)\leq f(n) \leq c_2g(n)$.
\section{Problem Statement}\label{sec:problem_statement}
Consider a master-worker setup in wired/wireless network with $n$ worker nodes connected to a single master node. For the wireless scenario, frequency division multiple access (FDMA) can be used so that the signals sent from the workers are detected simultaneously at the master without interference. We study a matrix-vector multiplication problem, where the goal is to compute the output $\mathbf{y}=\mathbf{A}\mathbf{x}$ for a given matrix $\mathbf{A}\in \mathbb{R}^{m \times d}$ and an input vector $\mathbf{x}\in \mathbb{R}^{d\times 1}$. The matrix $\mathbf{A}$ is divided into $k$ submatrices to obtain $\mathbf{A}_i\in \mathbb{R}^{\frac{m}{k} \times d}$, $i\in [k]$. Then, an $(n, k)$ MDS code is applied to construct $\tilde{\mathbf{A}}_i\in \mathbb{R}^{\frac{m}{k} \times d}$, $i\in [n]$, which are distributed across the $n$ worker nodes ($n>k$). For a given input vector $\mathbf{x}$, each worker $i$ computes $\tilde{\mathbf{A}}_i\mathbf{x}$ and sends the result to the master. By receiving $k$ out of $n$ results, the master node can recover the desired output $\mathbf{A}\mathbf{x}$.
We assume that the required time at each worker to compute a single inner product of vectors of size $d$ follows an exponential distribution with rate $\mu_1$. Since $\frac{m}{k}$ inner products are to be computed each worker, similar to the models in \cite{wireless,heterogeneous}, we assume that $X_i$, the computation time of worker $i$ follows an exponential distribution with rate $\frac{k\mu_1}{m}$:
\begin{equation}
\text{Pr}[X_i\leq t]=1-e^{-\frac{k}{m}\mu_1t}.
\end{equation}
After completing the given task, each worker transmits its results to the master through memoryless packet erasure channels where the packets are erased independently with probability $\epsilon$. For simplicity, we assume that each packet contains a single inner product. When a packet fails to be detected at the master, the corresponding packet is retransmitted. Otherwise, the worker transmits the next packet to the master. The work is finished when the master successfully detects the results of $k$ out of $n$ workers. The communication time for $j^{\text{th}}$ transmission of the $r^{\text{th}}$ inner product at each worker, $Y_{j,r}$, is also modeled as an exponential distribution (as the same as the communication time model in \cite{HPark}) with rate $\mu_2$. Then the average time for one packet transmission becomes $\frac{1}{\mu_2}$. Since each worker transmits $\frac{m}{k}$ inner products, the total communication time of worker $i$, denoted by $S_i$, is written as
\begin{equation}
S_i=\sum_{r=1}^{\frac{m}{k}}\sum_{j=1}^{N_r}Y_{j,r} \label{eq:communication_time}
\end{equation}
where $\text{Pr}[Y_{j,r}\leq t]=1-e^{-\mu_2t}$ and $N_r$ is a geometric random variable with success probability $1-\epsilon$, i.e., $\text{Pr}[N_r=l]=(1-\epsilon)\epsilon^{l-1}$.
We define the overall run-time of the task as the sum of computation time and communication time to finish the task. Now the overall run-time using $(n, k)$ MDS code is written as
\begin{equation}\label{eq:T}
T=\underset{i\in[n]}{k^{\text{th}}\text{min}}(X_i+S_i).
\end{equation}
We are interested in the expected overall run-time $\mathbb{E}[T]$.
\section{Latency Analysis for $k=m$}\label{sec:analysis1}
We start by reviewing some useful results on the order statistics. The expected value of $k^{\text{th}}$ order statistic of $n$ exponential random variables of rate $\mu$ is $\frac{H_n-H_{n-k}}{\mu}$, where $H_k=\sum_{i=1}^{k}\frac{1}{i}$. For $k=n$, the $k^{\text{th}}$ order statistic becomes $\frac{H_n}{\mu}$. The value $H_n$ can be approximated as $H_n\simeq \text{log}(n)+\eta$ for large $n$ where $\eta$ is a fixed constant.
In this section, we assume that each worker is capable of computing a single inner product, i.e., $k=m$.
This is a realistic assumption especially when a massive number of Internet of Things (IoT) devices having small storage size coexist in the network for wireless distributed computing\cite{WDC}. The case for general $k$ will be discussed in Section \ref{sec:analysis2}.
\subsection{Exact Overall Run-Time: Markov Chain Analysis}
We derive the overall run-time in terms $\mu_1$, $\mu_2$, $\epsilon$, $n$. We first state the following result on the communication time.
\begin{lemma}\label{lemma:sum_of_geometric_exponentials}
Assuming $k=m$, the random variable $S_i$ follows exponential distribution with rate $(1-\epsilon)\mu_2$, i.e., $\text{Pr}[S_i\leq t]=1-e^{-(1-\epsilon)\mu_2t}$.
\end{lemma}
\begin{IEEEproof}
See Appendix A.
\end{IEEEproof}
\textit{Remark} 1: By erasure probability $\epsilon$ and retransmission, Lemma 1 implies that the rate of communication time at each worker decreases by a factor of $1-\epsilon$ compared to the error-free scenario. That is, the expected communication time at each worker increases by a factor of $\frac{1}{1-\epsilon}$.
Based on Lemma 1, we obtain the following theorem which shows that $\mathbb{E}[T]$ can be obtained by analyzing the hitting time of a continuous-time Markov chain.
\begin{theorem}\label{thm:Markov}
Consider a continuous-time Markov chain $\mathbb{C}$ defined over 2-dimensional state space $(u,v)\in\{0, 1, ..., n\}\times\{0, 1,..., k \}$, where the transition rates are defined as follows.
\begin{itemize}
\item The transition rate from state $(u,v)$ to state $(u+1,v)$ is $(n-u)\mu_1$ if $v\leq u<n$, and $0$ otherwise.
\item The transition rate from state $(u,v)$ to state $(u,v+1)$ is $(u-v)(1-\epsilon)\mu_2$ if $0\leq v < \text{min}(u,k)$, and $0$ otherwise.
\end{itemize}
Then, the expected hitting time of $\mathbb{C}$ from state $(0, 0)$ to the set of states $(u,v)$ with $v=k$ becomes the expected overall run-time $\mathbb{E}[T]$.
\end{theorem}
\begin{IEEEproof}
For a given time $t$, define integers $u,v$ as
\begin{equation}
u=|\{j\in[n]:X_{j} \leq t\}| \label{eq:def_u}
\end{equation}
\begin{equation}
v=|\{i\in[n]:X_{i}+S_i \leq t\}| \label{eq:def_v}
\end{equation}
Here, $u$ can be viewed as the number of workers that finished computation by time $t$. For $v$, it is the number of workers that successfully transmitted the computation result to the master by time $t$. From these definitions, $v$ can be rewritten as
\begin{equation}
v=|\{i\in[u]: X_{i}+S_i \leq t \}|. \label{eq:def_v2}
\end{equation}
From $\mathbb{E}[T]=\mathbb{E}[\underset{i\in[n]}{k^{\text{th}}\text{min}}(X_i+S_i)]$, it can be seen that the expected overall run-time is equal to the expected arrival time from $(0,0)$ to any $(u,v)$ with $v=k$. Thus, we define the state of the Markov chain $(u,v)$, over space $\{0, 1, ..., n\}\times\{0, 1,..., k \}$.
By defining $u,v$ as above, the transition rates can be described as follows. By (\ref{eq:def_u}), for a given $t$, there are $n-u$ number of integers $j\in [n]$ satisfying $X_{j}>t$ at state $(u,v)$. Since $X_j$ follows exponential distribution with rate $\mu_1$, state transistion from $(u,v)$ to $(u+1,v)$ occurs with rate $(n-u)\mu_1$. The transition from $(u,v)$ from $(u+1,v)$ is possible for $u\geq v$, by the definitions (\ref{eq:def_u}), (\ref{eq:def_v}).
Now we consider the transition rate from $(u,v)$ to $(u,v+1)$ for a fixed $t$. Among $u$ number of integers $i$ satisfying $X_i\leq t$, there are $v$ of them which satisfy $X_i+S_i\leq t$ at state $(u,v)$. Recall that $S_i$ follows exponential distribution with rate $(1-\epsilon)\mu_2$ from Lemma \ref{lemma:sum_of_geometric_exponentials}. Thus, state transition from $(u,v)$ to $(u,v+1)$ occurs with rate $(u-v)(1-\epsilon)\mu_2$. Note that $v\in\{0,1,...,\text{min}(u,k)-1\}$. The described Markov chain is identical to $\mathbb{C}$, which completes the proof.
\end{IEEEproof}
For an arbitrary state $(u,v)$, the first component $u$ can be viewed as the number of workers finished the computation, and the second component $v$ is the number of workers that successfully transmitted their result to the master. Fig. \ref{fig:Markov_example} shows an example of the transition state diagram assuming $n=5$, $k=2$. From the initial state $(0,0)$, the given task is finished when the Markov chain visits one of the states with $v=2$ for the first time. Since the computational results of a worker are
transmitted after the worker finishes the whole computation, $u\geq v$ always holds. The expected hitting time of the Markov chain can be computed performing the first-step analysis \cite{Markov_anlysis}.
\begin{figure}[t]
\centering
\includegraphics[width=0.49\textwidth, trim=-0.5cm 0 0 0]{Markov_example-eps-converted-to.pdf}
\caption{State transition diagram example with $n=5$, $k=2$.}\label{fig:Markov_example}
\end{figure}
\subsection{Lower and Upper Bounds}
While the exact $\mathbb{E}[T]$ is not derived in a closed-form, we provide the closed-form expressions of the lower and upper bounds of $\mathbb{E}[T]$ in the following theorem.
\begin{theorem}\label{thm:bounds}
Assuming $k=m$, the expected overall run-time $\mathbb{E}[T]$ is lower bounded as $\mathbb{E}[T]\geq \mathcal{L}$, where
\begin{equation}\label{eq:Lbound}
\mathcal{L}=\underset{i\in[k]}{\text{max}}(\frac{H_n-H_{n-k+i-1}}{\mu_1}+\frac{H_n-H_{n-i}}{(1-\epsilon)\mu_2}),
\end{equation}
which reduces to
\begin{equation}\label{eq:Lbound_reduced}
\mathcal{L}=\begin{dcases}
\frac{1}{n\mu_1}+\frac{H_n-H_{n-k}}{(1-\epsilon)\mu_2}, \ \ \ \ \ \ \ \ \ \ \ \epsilon\geq 1 - \frac{\mu_1}{\mu_2} \\
\frac{H_n-H_{n-k}}{\mu_1}+\frac{1}{n(1-\epsilon)\mu_2}, \ \ \ otherwise.
\end{dcases}
\end{equation}
Moreover, the expected overall run-time $\mathbb{E}[T]$ is upper bounded as $\mathbb{E}[T]\leq\mathcal{U}$, where
\begin{equation}\label{eq:Ubound}
\mathcal{U}= \underset{i\in[n]\setminus[k-1]}{\text{min}}(\frac{H_n-H_{i-k}}{\mu_1}+\frac{H_n-H_{n-i}}{(1-\epsilon)\mu_2}).
\end{equation}
\end{theorem}
\begin{IEEEproof}
See Appendix C.
\end{IEEEproof}
From (\ref{eq:Lbound}) and (\ref{eq:Ubound}), it can be seen that the lower and upper bounds of $\mathbb{E}[T]$ are decreasing functions of $\epsilon$. Note that $\epsilon$ only decreases the terms of communication time (not computation time) by a factor of $\frac{1}{1-\epsilon}$ as in (\ref{eq:Lbound}) and (\ref{eq:Ubound}). The lower bound in (\ref{eq:Lbound}) can be rewritten as (\ref{eq:Lbound_reduced}) with two regimes classifed by equation $\epsilon= 1-\frac{\mu_1}{\mu_2}$. This equation is equivalent to
\begin{equation}
\frac{1}{\mu_1}=\frac{1}{(1-\epsilon)\mu_2}
\end{equation}
which means that the average computation time is equal to the average communication time with retransmission.
For $\epsilon\geq 1-\frac{\mu_1}{\mu_2}$, the first term of the lower bound in (\ref{eq:Lbound_reduced}) is the expected value of minimum computation time among $n$ workers, while the second term is the expected value of the $k^{\text{th}}$ smallest communication time among $n$ workers. This is the case where all the workers finish the computation by time $\frac{1}{n\mu_1}$ and then start communication simultaneously, which can be viewed as an obvious lower bound. We show in Appendix C that the derived lower bound (\ref{eq:Lbound_reduced}) is the tightest among $k$ candidates of the bounds we obtained in (\ref{eq:Lbound}). For the upper bound, by defining $H_0=0$, we have $\mathcal{U}=\frac{H_n}{\mu_1}+\frac{H_n-H_{n-k}}{(1-\epsilon)\mu_2}$ by inserting $i=k$ at (\ref{eq:Ubound}). The first term $\frac{H_n}{\mu_1}$ is the expected value of maximum computation time among $n$ workers and the second term is the expected value of the $k^{\text{th}}$ smallest communication time among $n$ workers. Again, this is an obvious upper bound as it can be interpreted as the case where all $n$ workers starts communication simultaneously right after the slowest worker finishes its computation. The derived upper bound includes this kind of scenario.
\begin{figure}
\centering
\subfloat[][$\mu_1=10$, $\mu_2=1$.]{\includegraphics[height=53mm ]{latency_versus_n_mu1_10-eps-converted-to.pdf}}
\quad \quad
\subfloat[][$\mu_1=1$, $\mu_2=10$.]{\includegraphics[height=53mm]{latency_versus_n_mu1_1-eps-converted-to.pdf}}
\caption{Bounds of $\mathbb{E}[T]$ for $k=m=500$, $\epsilon=0.1$.}
\label{fig:latency_versus_n}
\end{figure}
Assume a practical scenario where the size of the task scales linearly with the number of workers, i.e., $k=\Theta(n)$. Note that $k=m$ in this section. Then for large $k$, we have $H_n\simeq \text{log}(n)+\eta$ for a fixed constant $\eta$, which leads to $H_n-H_{n-k}\simeq\text{log}\frac{n}{n-k}$. Thus, the lower bound can be rewritten as
\begin{equation}\label{eq:Lower_rwrite}
\mathcal{L}=\begin{dcases}
\frac{1}{n\mu_1}+\frac{1}{(1-\epsilon)\mu_2}\text{log}(\frac{n}{n-k}), \ \ \ \epsilon\geq 1 - \frac{\mu_1}{\mu_2} \\
\frac{1}{\mu_1}\text{log}(\frac{n}{n-k})+\frac{1}{n(1-\epsilon)\mu_2}, \ \ \ otherwise,
\end{dcases}
\end{equation}
as $k$ grows. It can be easily shown that $\mathcal{L}=\Theta(1)$. More specifically, assuming a fixed code rate $R=\frac{k}{n}$, the expression of (\ref{eq:Lower_rwrite}) settles down to $\mathcal{L}=\frac{1}{(1-\epsilon)\mu_2}\text{log}(\frac{1}{1-R})$, if $\epsilon\geq 1-\frac{\mu_1}{\mu_2}$ and $\mathcal{L}=\frac{1}{\mu_1}\text{log}(\frac{1}{1-R})$, $otherwise$, as $n$ goes to infinity.
For the upper bound, we first define
\begin{equation}\label{eq:fu}
f_U= \frac{H_n-H_{i-k}}{\mu_1}+\frac{H_n-H_{n-i}}{(1-\epsilon)\mu_2}.
\end{equation}
From $\frac{\partial f_{U}}{\partial i}=0$, $f_U$ is minimized by setting $i=i^*$, where
\begin{equation}
i^*=\frac{\mu_1k+(1-\epsilon)\mu_2n}{\mu_1+(1-\epsilon)\mu_2}
\end{equation}
Since $i^*-k=\Theta(k)$ and $n-i^*=\Theta(k)$, we can approximate $H_n-H_{i^*-k}\simeq\text{log}\frac{n}{i^*-k}$ and $H_n-H_{n-i^*}\simeq\text{log}\frac{n}{n-i^*}$ for large $k$. Thus, the upper bound in (\ref{eq:Ubound}) can be rewritten as
\begin{equation}
\mathcal{U}= \frac{1}{\mu_1}\text{log}(\frac{n}{i^*-k})+\frac{1}{(1-\epsilon)\mu_2}\text{log}(\frac{n}{n-i^*}).
\end{equation}
It can be again shown that $\mathcal{U}=\Theta(1)$. Finally, we have
\begin{equation}\label{eq:coded_speed}
\mathbb{E}[T]=\Theta(1).
\end{equation}
Note that inserting $i=\lceil i^* \rceil$ or $i=\lfloor i^* \rfloor$ at (\ref{eq:fu}) makes the upper bound since $i$ should be an integer. However, the ceiling or floor notation can be ignored for the asymptotic regime.
\begin{figure}[t]
\centering
\includegraphics[width=0.41\textwidth, trim=-0.5cm 0 0 0]{latency_versus_epsilon-eps-converted-to.pdf}
\caption{Bounds of $\mathbb{E}[T]$ versus $\epsilon$ with $k=m=500$, $\mu_1=10$, $\mu_2=1$.}\label{fig:latancy_versus_epsilon}
\end{figure}
Fig. \ref{fig:latency_versus_n} shows the lower and upper bounds along with the hitting time of the Markov chain, with varying number of workers $n$. The number of inner products to be computed is assumed to be $m=500$. Erasure probability is assumed to be $\epsilon=0.1$. It can be seen that the overall run-time to finish the task decreases as $n$ increases. Based on the Markov analysis and derived bounds, one can find the minimum number of workers $n$ to meet the latency constraint of the given system.
Fig. \ref{fig:latancy_versus_epsilon} shows the bounds of $\mathbb{E}[T]$ with different erasure probability $\epsilon$. We see by Figs. \ref{fig:latency_versus_n} and \ref{fig:latancy_versus_epsilon} that the lower bound is generally tighter than the upper bound.
\subsection{Comparison with Uncoded Scheme}
In this subsection, we give comparison between the coded and uncoded schemes. For the uncoded scheme, the overall workload ($k=m$ inner products) are equally distributed to $n$ workers. Therefore, the workload at each worker becomes less than a single inner product. More specifically, the number of multiplications and additions computed at each worker are reduced by a factor of $\frac{k}{n}$ compared to the MDS-coded scheme. The master node has to wait for the results from all $n$ workers to finish the task. Since the workload at each worker is decreased by a factor of $\frac{k}{n}$ compared to the coded scheme, the computation time at each worker follows exponential distribution with rate $\frac{n}{k}\mu_1$. For the communication time, we model the communication time for a single inner product at each worker as exponential distribution with rate $\frac{n}{k}\mu_2$, by assuming that the packet length to be transmitted at each worker also decreases by a factor of $\frac{k}{n}$. The erasure probability should be also changed depending on the packet length. Assume that the packet is lost if at least one bit is erroneous. Then, by defining $\epsilon_b$ as the fixed bit-error rate (BER) of the system, the packet erasure probability $\epsilon'$ for the uncoded scheme can be written as
\begin{equation}
\epsilon'=1-(1-\epsilon_b)^{\frac{k}{n}l}
\end{equation}
where $l$ is the packet length of the coded scheme. Note that the erasure probability for the coded scheme $\epsilon$ is
\begin{equation}
\epsilon=1-(1-\epsilon_b)^{l}.
\end{equation}
The overall run-time of the uncoded scheme denoted by $T_{\text{uncoded}}$ can be written as
\begin{equation}
T_{\text{uncoded}}=\underset{i\in[n]}{\text{max}}(X_i+S_i)
\end{equation}
where $\text{Pr}[X_i\leq t]=1-e^{-\frac{k}{n}\mu_1t}$ and $\text{Pr}[S_i\leq t]=1-e^{-\frac{k}{n}(1-\epsilon)\mu_2t}$ by Lemma 1. Similar to the proof of Theorem 2, we have $\mathcal{L}_{\text{uncoded}}\leq\mathbb{E}[T_{\text{uncoded}}]\leq\mathcal{U}_{\text{uncoded}}$ where
\begin{align*}
\mathcal{L}_{\text{uncoded}}&=\underset{i\in[n]}{\text{max}}(\frac{k(H_n-H_{i-1})}{n\mu_1}+\frac{k(H_n-H_{n-i})}{n(1-\epsilon')\mu_2})\\
&=\begin{dcases}
\frac{k}{n}(\frac{1}{n\mu_1}+\frac{H_n}{(1-\epsilon')\mu_2}), \ \ \ \ \ \ \ \epsilon'\geq 1 - \frac{\mu_1}{\mu_2} \\
\frac{k}{n}(\frac{H_n}{\mu_1}+\frac{1}{n(1-\epsilon')\mu_2}), \ \ \ \ \ \ otherwise,
\end{dcases}
\end{align*}
\begin{equation}
\mathcal{U}_{\text{uncoded}}= \frac{k}{n}(\frac{H_n}{\mu_1}+\frac{H_n}{(1-\epsilon')\mu_2}).
\end{equation}
It can be easily seen that $\mathcal{L}_{\text{uncoded}}=\Theta(\text{log}(n))$, $\mathcal{U}_{\text{uncoded}}=\Theta(\text{log}(n))$ for $k=m=\Theta(n)$, which leads to
\begin{equation}\label{eq:uncoded_speed}
\mathbb{E}[T_{\text{uncoded}}]=\Theta(\text{log}(n)).
\end{equation}
Comparing (\ref{eq:coded_speed}) and (\ref{eq:uncoded_speed}) shows that the overall run-time becomes $\Theta(\text{log}(n))$ times faster by introducing redundancy:
\begin{equation}
\frac{\mathbb{E}[T_{\text{uncoded}}]}{\mathbb{E}[T]}=\Theta(\text{log}(n)).
\end{equation}
This result is consistent with the previous works \cite{KLee1, heterogeneous} which compared coded and uncoded schemes in an error-free scenario.
\section{Latency for General $k$}\label{sec:analysis2}
In this section, we give discussions for general $k$. We provide the following theorem, which shows the lower and upper bounds of $\mathbb{E}[T]$ for general $k$.
\begin{theorem}
Let $G_i$ be an erlang random variable with shape parameter $\frac{m}{k}$ and rate parameter $1$, i.e., $\text{Pr}[G_i\leq t]=1-\sum_{p=0}^{\frac{m}{k}-1}\frac{1}{p!}e^{-t}t^p
$. Then for general $k$, we have $\mathcal{L}\leq\mathbb{E}[T]\leq\mathcal{U}$ where
\begin{equation}\label{eq:Lbound_generalk}
\mathcal{L}=\underset{i\in[k]}{\text{max}}\Big(\frac{m(H_n-H_{n-k+i-1})}{k\mu_1}+\frac{\mathbb{E}[G_{(i)}]}{(1-\epsilon)\mu_2}\Big)
\end{equation}
\begin{equation}\label{eq:Ubound_generalk}
\mathcal{U}=\underset{i\in[n]\setminus[k-1]}{\text{min}}\Big(\frac{m(H_n-H_{i-k})}{k\mu_1}+\frac{\mathbb{E}[G_{(i)}]}{(1-\epsilon)\mu_2}\Big).
\end{equation}
\end{theorem}
\begin{IEEEproof}
See Appendix C.
\end{IEEEproof}
\begin{figure*}[!t]
\normalsize
\setcounter{mytempeqncnt}{2}
\begin{equation}\label{eq:erlangmean}
\mathbb{E}[G_{(i)}]=\frac{n!}{(i-1)!(n-i)!\Gamma(\frac{m}{k})}\sum_{p=0}^{i-1}(-1)^p{{i-1}\choose{p}}\sum_{q=0}^{(\frac{m}{k}-1)(n-i+p)}a_q(\frac{m}{k},n-i+p)\frac{\Gamma(\frac{m}{k}+q+1)}{(n-i+p+1)^{\frac{m}{k}+q+1}}
\end{equation}
\hrulefill
\vspace*{4pt}
\end{figure*}
As illustrated in \cite{Gamma}, the expected value of $i^{\text{th}}$ order statistic $\mathbb{E}[G_{(i)}]$ can be written as (\ref{eq:erlangmean}) shown at the top of next page. Here, $\Gamma$ is a gamma function\footnote{For a positive integer $z$, $\Gamma(z)=(z-1)!$ is satisfied.} and $a_q(x,y)$ is the coefficient of $t^{q}$ in the expansion of $(\sum_{j=0}^{x-1}\frac{t^{j}}{j!})^{y}$ for any integer $x$, $y$.
For the uncoded scheme, we have $\mathcal{L}_{\text{uncoded}}\leq\mathbb{E}[T_{\text{uncoded}}]\leq\mathcal{U}_{\text{uncoded}}$ where
\begin{equation}
\mathcal{L}_{\text{uncoded}}=\underset{i\in[n]}{\text{max}}\Big(\frac{m(H_n-H_{i-1})}{n\mu_1}+\frac{\mathbb{E}[G'_{(i)}]}{(1-\epsilon)\mu_2}\Big)
\end{equation}
\begin{equation}
\mathcal{U}_{\text{uncoded}}=\frac{m(H_n-H_{n-k})}{n\mu_1}+\frac{\mathbb{E}[G'_{(i)}]}{(1-\epsilon)\mu_2}
\end{equation}
which are obtained by inserting $k=n$ at (\ref{eq:Lbound_generalk}) and (\ref{eq:Ubound_generalk}), respectively. Here, $G'_i$ is an erlang random variable with shape parameter $\frac{m}{n}$ and rate parameter $1$, where $\mathbb{E}[G'_{(i)}]$ can be obtained by inserting $k=n$ at (\ref{eq:erlangmean}).
\begin{figure}[t]
\centering
\includegraphics[width=0.41\textwidth, trim=-0.5cm 0 0 0]{BOUNDS_upper-eps-converted-to.pdf}
\caption{Upper bound $\mathcal{U}$ on $\mathbb{E}[T]$ versus code rate $R$ with $n=100$, $m=500$, $\mu_1=1$, $\mu_2=10$.}\label{fig:Optimal_k}
\end{figure}
\begin{figure}[t]
\centering
\includegraphics[width=0.41\textwidth, trim=-0.5cm 0 0 0]{tightnessofbounds-eps-converted-to.pdf}
\caption{Latency performance on the design targeting upper bound minimization. Here, we assume $n=100$, $m=500$, $\mu_1=1$, $\mu_2=10$.}\label{fig:tightness}
\end{figure}
While finding the exact expression of $\mathbb{E}[T]$ for general $k$ remains open, we provide numerical results to gain insights on designing $(n,k)$ MDS code. We plot the upper bound of $\mathbb{E}[T]$ versus code rate $R=\frac{k}{n}$ with $n=100$, $m=500$, $\mu_1=1$, $\mu_2=10$ in Fig. \ref{fig:Optimal_k}. It can be seen that the optimal code rate $R^*$ can be designed to minimize the upper bound $\mathcal{U}$ on $\mathbb{E}[T]$ depending on the erasure probability $\epsilon$. Fig. \ref{fig:tightness} compares the performance between the achievable $\mathbb{E}[T]$ (obtained by Monte Carlo simulations) and the MDS code with rate $R^*$. It can be seen that the performance of the MDS code with rate $R^*$ is very close to the achievable $\mathbb{E}[T]$, showing the effectiveness of the proposed design.
\section{Analysis under the Setting of Limited Number of Retransmissions}\label{sec:Finite}
\subsection{Probability of Successful Computation}
So far, we focused on latency analysis over packet erasure channels under the assumption that there is no limit on the number of transmissions at each worker. The number of transmissions can be potentially infinite on the analysis above. However, in practice, the number of transmissions cannot be potentially infinite due to the constraint on the transmission bandwidth. With limited number of transmissions, the overall computation can fail, i.e., the master node may not receive enough results (less than $k$) from the workers due to link failures.
Thus, we consider the success probability of a given task in this section. We first analyze probability of success at a specific worker. Let $\gamma$ be the maximum number of packets that is allowed to be transmitted at a specific worker. That is, the number of transmissions at each worker is limited to $\gamma$. When the number of workers is given by $n$, the total transmission bandwidth of the network is then limited to $n\gamma l$, where $l$ is the packet length. For a successful computation at a specific worker node, the master node should successfully receive $\frac{m}{k}$ out of $\gamma$ packets from that worker. Thus, probability of success at a specific worker denoted by $p$ is obtained as
\begin{align}
p&=\underbrace{(1-\epsilon)^{\frac{m}{k}}}_{0 \ \text{failure}} + \underbrace{{{\frac{m}{k}}\choose{1}}(1-\epsilon)^{\frac{m}{k}}\epsilon}_{1 \ \text{failure}} + ... \underbrace{{{\gamma-1}\choose{\gamma-\frac{m}{k}}}(1-\epsilon)^{\frac{m}{k}}\epsilon^{\gamma-\frac{m}{k}}}_{\gamma-\frac{m}{k} \ \text{failures}} \nonumber \\
&=\sum_{i=0}^{\gamma-\frac{m}{k}} {{\frac{m}{k}+i-1}\choose{i}}(1-\epsilon)^{\frac{m}{k}}\epsilon^{i}. \label{eq:p}
\end{align}
To complete the overall task, $k$ out of $n$ workers should successfully deliver their results to the master. Based on $p$, the probability of success for the overall computation, denoted by $P_s$, can be written as
\begin{equation}\label{eq:P_s}
P_s = \sum_{i=k}^{n}{{n}\choose{i}}(1-p)^{n-i}p^i.
\end{equation}
\begin{figure}[t]
\centering
\includegraphics[width=0.43\textwidth, trim=-0.5cm 0 0 0]{Ps_vs_epsilon-eps-converted-to.pdf}
\caption{$P_s$ versus $\epsilon$ assuming $n=40$, $m=120$. The scheme which uses less transmission bandwidth can have higher probability of success. Moreover, the scheme with higher probability of success in one region may have lower probability of success in the other region.}\label{fig:Ps_vs_epsilon}
\end{figure}
It can be seen from (\ref{eq:p}) that increasing $k$ also increases probability of success $p$ at each worker. This is because increasing $k$ decreases the number of packets to be transmitted at each worker, which increases $p$ for a given number of transmissions $\gamma$. However, larger $k$ increases the number of results to be detected at the master node for decoding the overall computational results. That is, for a given $p$, increasing $k$ decreases $P_s$ from (\ref{eq:P_s}). Now the question is, how to design optimal $k$? How about choosing the appropriate value of $\gamma$? We address these issues in Section V-C.
For given number of workers $n=40$ and workload $m=120$, Fig. \ref{fig:Ps_vs_epsilon} shows $P_s$ versus erasure probability $\epsilon$ with different $k$ and $\gamma$ values. It can be seen that even the case with $k=20$ uses less bandwidth compared to the case with $k=10$, it has strictly better probability of success for all $\epsilon$ values. This is because the case with $k=10$ has more packets to be transmitted compared to the case with $k=20$. It can be also seen that for $\epsilon>0.2$, the case with $k=40$ has higher $P_s$ compared to the case with $k=10$ which uses twice as many transmission bandwidth as the case with $k=40$. This example motivates us to consider the problem of choosing the best $k$ and $\gamma$ for different $\epsilon$ values under bandwidth and probability of success constraints.
\subsection{Latency}
The overall run-time to finish the task should be reconsidered with limited number of transmissions. Let $T'$ be the overall run-time for a given $\gamma$. Note that if the computation fails for a given $\gamma$, we say that the overall run-time is infinity. Thus, if $P_s<1$, the expected overall run-time $\mathbb{E}[T']$ always becomes infinity. Therefore, in this setup, instead of the expected value $\mathbb{E}[T']$, it is more reasonable to consider probability that the task would be finished within a certain required time $\tau$, $\text{Pr}[T'\leq\tau]$.
We first rewrite $T'$ from (\ref{eq:T}) for a given $\gamma$. Since the term $\gamma$ only gives effect on the communication time at each worker (not the computation time), $T'$ can be written as
\begin{equation}
T'=\underset{i\in[n]}{k^{\text{th}}\text{min}}(X_i+S_i').
\end{equation}
As in (\ref{eq:T}), the computation time at worker $i$ denoted by $X_i$, follows exponential distribution with rate $\mu_1$. The communication time at worker $i$ denoted by $S_i'$ is written as
\begin{equation}
S_i'=\sum_{j=1}^{C_i}Y_{j},
\end{equation}
where $Y_j$ follows exponential distribution with rate $\mu_2$ and $C_i$ is the number of transmissions at a specific worker until it successfully transmit $\frac{m}{k}$ number of packets, which are all independent for different workers. With probability $1-p$, the worker fails to transmit the $\frac{m}{k}$ packets so that $C_i$ is undefined and $S_i'$ becomes infinity. Thus, we have random variable $C_i$ as follows:
\begin{equation}
C_i= \begin{dcases}
\frac{m}{k} \ \ \ \ \ \ \ \ \ \text{w.p.} \ (1-\epsilon)^{\frac{m}{k}} \\
\frac{m}{k}+1 \ \ \ \ \text{w.p.} \ {{\frac{m}{k}}\choose{1}}(1-\epsilon)^{\frac{m}{k}}\epsilon}_{ \\
\vdotswithin {\text{erlang}(\frac{m}{k}+1, \mu_2) \ \text{w.p.}}\\
\gamma \ \ \ \ \ \ \ \ \ \ \text{w.p.} \ {{\gamma-1}\choose{\gamma-\frac{m}{k}}}(1-\epsilon)^{\frac{m}{k}}\epsilon^{\gamma-\frac{m}{k}}}_{ \\
\text{undefined} \ \text{w.p.} \ 1-p.
\end{dcases}\end{equation}
Based on $C_i$, random variable $S_i'$ becomes
\begin{equation}
S_i' \begin{dcases}
\sim\text{erlang}(\frac{m}{k}, \mu_2) \ \text{w.p.} \ (1-\epsilon)^{\frac{m}{k}} \\
\sim\text{erlang}(\frac{m}{k}+1, \mu_2) \ \text{w.p.} \ {{\frac{m}{k}}\choose{1}}(1-\epsilon)^{\frac{m}{k}}\epsilon}_{ \\
\vdotswithin {\text{erlang}(\frac{m}{k}+1, \mu_2) \ \text{w.p.}}\\
\sim\text{erlang}(\gamma, \mu_2) \ \text{w.p.} \ {{\gamma-1}\choose{\gamma-\frac{m}{k}}}(1-\epsilon)^{\frac{m}{k}}\epsilon^{\gamma-\frac{m}{k}}}_{ \\
=\infty \ \text{w.p.} \ 1-p.
\end{dcases}\end{equation}
\begin{figure}[t]
\centering
\includegraphics[width=0.43\textwidth, trim=-0.5cm 0 0 0]{Ps_vs_gamma-eps-converted-to.pdf}
\caption{$P_s$ versus $\gamma$ assuming $n=40$, $m=120$, $\epsilon=0.3$. The figure shows the minimum $\gamma$ satisfying $P_s\geq 1-\delta$ for different $k$ values, where $\delta$ is set to $0.01$.}\label{fig:Ps_vs_gamma}
\end{figure}
\textit{Remark} 2: As $\gamma$ increases, the probability $\text{Pr}[T'\leq \tau]$ also increases for a given $\tau$, since increasing $\gamma$ increases the probability of success. The probability $\text{Pr}[T'\leq \tau]$ converges to $\text{Pr}[T\leq \tau]$ as $\gamma$ increases, where $T$ is the asymptotic overall run-time defined in (\ref{eq:T}).
\subsection{Optimal Resource Allocation in Practical Scenarios}
For given constraints on maximum number of transmissions $\gamma$ and probability of successful computation $P_s$, we would like to minimize $T^{(\alpha)}$ which is defined as the minimum overall run-time that we can guarantee with probability $1-\alpha$, as follows:
\begin{equation}
T^{(\alpha)}=\text{min}\{\tau: \text{Pr}[T'\leq \tau]\geq 1-\alpha \}.
\end{equation}
For a given number of workers $n$, the optimization problem is formulated as
\begin{align}
\underset{k,\gamma}{\text{min}} & \ T^{(\alpha)} \\
\text{subject to } & \gamma\leq\gamma_t, \\
& P_s\geq1-\delta,
\end{align}
where $\gamma_t$ is the transmission bandwidth limit and $\delta$ shows how $P_s$ is close to 1 ($0\leq \delta \leq 1$). While it is not straightforward to find the closed-form solution of the above problem, optimal $k$ can be found by combining the results of Figs \ref{fig:Ps_vs_gamma} and \ref{fig:Prlatency_vs_k}. We first observe Fig. \ref{fig:Ps_vs_gamma}, which shows the probability successful computation $P_s$ as a function of $\gamma$. The parameters are set as $n=40$, $m=120$, $\epsilon=0.3$. Obviosly, $P_s$ increases as $\gamma$ increases. In addition, since there are $\frac{m}{k}$ packets to be transmitted at each worker, we have $P_s=0$ for $\gamma<\frac{m}{k}$. The optimal bounds shown in Fig. \ref{fig:Ps_vs_gamma} are the minimum $\gamma$ values that satisfy $P_s\geq 1-\delta$, where $\delta=0.01$. Given a success probability constraint $P_s\geq 1-\delta$ and bandwidth constraint $\gamma\leq\gamma_t$, one can find the candidates of $k$ values that satisfy the constraints. For example, if $\gamma_t=13$, $k=30$ and $k=40$ become possible candidates for the optimal solution while $k=10$ does not. Note that in Fig. \ref{fig:Ps_vs_gamma}, increasing (or decreasing) $k$ does not always indicate higher probability of success.
\begin{figure}[t]
\centering
\includegraphics[width=0.43\textwidth, trim=-0.5cm 0 0 0]{Prlatency_vs_k-eps-converted-to.pdf}
\caption{$\text{Pr}[T'\leq\tau]$ versus $k$ assuming $n=40$, $m=120$, $\gamma=13$, $\tau=8.6$, $\epsilon=0.3$, $\mu_1=1$, $\mu_2=5$.}\label{fig:Prlatency_vs_k}
\end{figure}
\begin{figure}[t]
\centering
\includegraphics[width=0.43\textwidth, trim=-0.5cm 0 0 0]{Prlatency_vs_gamma-eps-converted-to.pdf}
\caption{$\text{Pr}[T'\leq \tau_t]$ versus $k$ assuming $n=40$, $m=120$, $\tau_t=8.6$, $\epsilon=0.3$, $\mu_1=1$, $\mu_2=5$.}\label{fig:Prlatency_vs_gamma}
\end{figure}
\begin{figure}[t]
\centering
\includegraphics[width=0.43\textwidth, trim=-0.5cm 0 0 0]{Ps_vs_k-eps-converted-to.pdf}
\caption{$P_s$ versus $k$ assuming $n=40$, $m=120$, $\epsilon=0.3$, $\gamma=8$.}\label{fig:Ps_vs_k}
\end{figure}
\begin{figure}
\centering
\subfloat[][Optimal $T^{(\alpha)}-\epsilon$ curve.]{\includegraphics[height=53mm]{Optimal_curve_Talpha-eps-converted-to.pdf}}
\quad \quad
\subfloat[][Optimal $\gamma-\epsilon$ curve.]{\includegraphics[height=53mm]{Optimal_curve_gamma-eps-converted-to.pdf}}
\quad \quad
\subfloat[][Optimal $P_s-\epsilon$ curve.]{\includegraphics[height=53mm]{Optimal_curve_Ps_ver2-eps-converted-to.pdf}}
\caption{Optimal curves assuming $n=40$, $m=120$, $\mu_1=1$, $\mu_2=5$, $\gamma_t=7$, $\tau_t=10$, $\alpha=0.05$, $\delta=0.01$.}
\label{fig:Optimal_curve}
\end{figure}
Fig. \ref{fig:Prlatency_vs_k} shows $\text{Pr}[T'\leq \tau]$ versus $k$ assuming $\gamma=13$, $\tau=8.6$, where other parameters are set to be same as in Fig. \ref{fig:Ps_vs_gamma}. Among the candidates obtained from Fig. \ref{fig:Ps_vs_gamma}, one can find the optimal $k$ that minimizes $T^{(\alpha)}$. By setting $\alpha=0.03$ and $\tau=8.6$, it can be seen from Fig. \ref{fig:Prlatency_vs_k} that $\text{Pr}[T'\leq \tau]\geq 1-\alpha$ holds only for $k=20$, which means that $k=20$ is the optimal solution. Note that $k$ that minimizes $\gamma$ to satisfy $P_s\geq 1-\delta$ (in Fig. \ref{fig:Ps_vs_gamma}) does not always minimizes $T^{(\alpha)}$, which motivated us to formulate the problem (while it is not shown in Fig. \ref{fig:Ps_vs_gamma}, the case for $k=20$ has lower performance compared to the case for $k=30$).
For given constraints on probability of success and latency, one can also minimize $\gamma$:
\begin{align}
\underset{k}{\text{min}} & \ \gamma \\
\text{subject to } & P_s\geq1-\delta, \\
& T^{(\alpha)}\leq \tau_t.
\end{align}
where $\tau_t$ is the required latency constraint. For this optimization problem, it can be seen that the constraint $T^{(\alpha)}\leq \tau_t$ is equivalent to the constraint $\text{Pr}[T'\leq \tau_t]\geq 1-\alpha$. From Fig. \ref{fig:Ps_vs_gamma}, candidates of $(k,\gamma)$ pairs satisfying $P_s\geq 1-\delta$ can be obtained. Among these candidates, one can find the best $k$ that minimizes $\gamma$ from Fig. \ref{fig:Prlatency_vs_gamma}, which shows $\text{Pr}[T'\leq \tau_t]$ versus $\gamma$ with different $k$ values, where $\tau_t$ is set to $8.6$. With small number of retransmissions, $k=30$ gives the best performance while for $\gamma \geq 10$, it does not. This is because the case with $k=30$ has smaller number of packets to be transmitted compared to others, which gives higher $P_s$ for small $\gamma$. As $\gamma$ grows, the probability $\text{Pr}[T'\leq \tau_t]$ converges to $\text{Pr}[T\leq \tau_t]$ for each $k$.
At last, we formulate the following problem,
\begin{align}
\underset{k,\gamma}{\text{max}} & \ P_s \\
\text{subject to } & \gamma\leq\gamma_t, \label{eq:gamma_constraint3}\\
& T^{(\alpha)}\leq \tau_t. \label{eq:latency_constraint3}
\end{align}
aiming to maximize the probability of success with transmission bandwidth and latency constraints. We first find the candidates of $k$ that satisfy $T^{(\alpha)}\leq\tau_t$ from Fig. \ref{fig:Prlatency_vs_gamma}, and then choose optimal $k$ from Fig. \ref{fig:Ps_vs_k} which shows $P_s$ as a function of $k$.
\subsection{Achievable Curves}
Based on the solutions to the optimization problems, optimal curves as a function of $\epsilon$ are obtained in Fig. \ref{fig:Optimal_curve}, where the parameters are set as $n=40$, $m=120$, $\mu_1=1$, $\mu_2=5$, $\gamma_t=7$, $\tau_t=10$, $\alpha=0.05$, $\delta=0.01$. Fig. \ref{fig:Optimal_curve}(a) shows the achievable $T^{(\alpha)}$ as a function of $\epsilon$. We observe that the achievable $T^{(\alpha)}$ increases as $\epsilon$ grows. From Fig. \ref{fig:Optimal_curve}(b) which shows the optimal $\gamma-\epsilon$ curve, we observe that achievable $\gamma$ also increases as $\epsilon$ grows, which indicates that a larger transmission bandwidth is required for higher erasure probability. Finally in Fig. \ref{fig:Optimal_curve}(c), we can see that there exists a sharp threshold $\epsilon_t$ that makes $P_s=0$ for $\epsilon>\epsilon_t$ since the latency constraint cannot be satisfied anymore for $\epsilon$ greater than some threshold $\epsilon_t$.
\section{Concluding Remarks}\label{sec:conclusion}
We studied the problem of coded computation assuming link failures, which are a fact of life in current wired data centers and wireless networks. With maximum $k$, we showed that the asymptotic expected latency is equivalent to analyzing a continuous-time Markov chain. Closed-form expressions of lower and upper bounds on the expected latency are derived based on some key inequalities. For general $k$, we show that the performance of the coding scheme which minimizes the upper bound nearly achieves the optimal run-time, which shows the effectiveness of the proposed design. Finally, under the setting of limited number of retransmissions, we formulated practical optimization problems and obtained achievable curves as a function of packet erasure probability $\epsilon$. Considering the link failures in hierarchical computing systems \cite{HPark} or in secure distributed computing \cite{Secure} are interesting and important topics for future research.
\appendices
\section{Proof of Lemma 1}
Assuming $k=m$ (i.e., $r=1$), we have $S_i=\sum_{j=1}^{N_1}Y_{j,1}$. For fixed integer $q$, $\sum_{j=1}^{q}Y_{j,1}$ which is the sum of $q$ exponential random variables with rate $\mu_2$, follows erlang distribution with shape parameter $q$ and rate parameter $\mu_2$:
\begin{equation}
\text{Pr}[\sum_{j=1}^{q}Y_{j,1}\leq t]=1-\sum_{p=0}^{q-1}\frac{1}{p!}e^{-\mu_2t}(\mu_2t)^p.
\end{equation}
Now we can write
\begin{align*}
\text{Pr}[S_i\leq t]&=\sum_{q=1}^{\infty}\text{Pr}[N_1=q]\text{Pr}[\sum_{j=1}^{q}Y_{j,1}\leq t]\\
&=\sum_{q=1}^{\infty}((1-\epsilon)\epsilon^{q-1})(1-\sum_{p=0}^{q-1}\frac{1}{p!}e^{-\mu_2t}(\mu_2t)^p)\\
&=1-e^{-\mu_2t}\sum_{q=1}^{\infty}\sum_{p=0}^{q-1}((1-\epsilon)\epsilon^{q-1})\frac{1}{p!}(\mu_2t)^p\\
&=1-e^{-\mu_2t}\sum_{p=0}^{\infty}\sum_{q=p+1}^{\infty}((1-\epsilon)\epsilon^{q-1})\frac{1}{p!}(\mu_2t)^p\\
&=1-e^{-\mu_2t}\sum_{p=0}^{\infty}\frac{1}{p!}(\epsilon\mu_2t)^p\\
&=1-e^{-(1-\epsilon)\mu_2t}
\end{align*}
which completes the proof.
\section{Proof of Theorem 2}
\subsection{Lower bound}
We first prove the following proposition, which is illustrated as in Fig. \ref{fig:Proposition1}.
\begin{proposition}
For any two sequences $\{a_i\}_{i\in[n]}$, $\{b_i\}_{i\in[n]}$,
\begin{equation}\label{eq:prop1}
\underset{i\in[n]}{k^{\text{th}}\text{min}}(a_i+b_i)\geq\underset{i\in[k]}{\text{max}}(a_{(k-i+1)}+b_{(i)}).
\end{equation}
\end{proposition}
\begin{IEEEproof}
Define the ordering vector $\boldsymbol{\pi}\in\Pi$, where $\Pi$ is the set of permutation of $[n]$, i.e.,
\begin{equation}\label{eq:ordervector}
\Pi=\{\boldsymbol{\pi}=[\pi_1, ...,\pi_n]: \pi_i\in[n] \ \forall i\in[n], \ \pi_i\neq\pi_j \ for \ i\neq j \}.
\end{equation}
Note that the $k^{\text{th}}$ smallest value out of $n$ can be always rewritten as the maximum of $k$ smallest values. Define $\boldsymbol{\pi}=[\pi_{1}, ...,\pi_{n}]\in\Pi$ to make the set of values $\{a_{\pi_i}+b_{\pi_i}\}_{i=1}^{k}$ be the $k$ smallest among $\{a_i+b_i\}_{i=1}^{n}$. In addition, define $\boldsymbol{\pi}_1,\boldsymbol{\pi}_2\in\Pi$ to make $a_{\pi_i}=a_{(\pi_{i,1})}$ and $b_{\pi_i}=b_{(\pi_{i,1})}$ be satisfied $\forall i\in[k]$, where $\boldsymbol{\pi}_1=[\pi_{1,1}, ...,\pi_{n,1}]$, $\boldsymbol{\pi}_2=[\pi_{1,2}, ...,\pi_{n,2}]$. Then, $\underset{i\in[n]}{k^{\text{th}}\text{min}}(a_i+b_i)$ can be rewritten as
\begin{align}
\underset{i\in[n]}{k^{\text{th}}\text{min}}(a_i+b_i)&=\underset{i\in[k]}{\text{max}}(a_{\pi_i}+b_{\pi_i}) \label{eq:kthmin_L1}\\
&=\underset{i\in[k]}{\text{max}}(a_{(\pi_{i,1})}+b_{(\pi_{i,2})}). \label{eq:kthmin_L2}
\end{align}
Now define a new set of ordering vectors $\Pi^*\subseteq\Pi$, as $\Pi^*=\{\boldsymbol{\pi}\in\Pi:\pi_i\in[k] \ \forall i\in[k]\}$. Then we can always construct $\boldsymbol{\pi}_1^*, \boldsymbol{\pi}_2^*\in \Pi^*$ such that $\pi_{i,1}\geq\pi_{i,1}^*$, $\pi_{i,2}\geq\pi_{i,2}^*$ for all $i\in [k]$, which is easy to proof. Then by adequately selecting $\boldsymbol{\pi}^*\in \Pi^*$, (\ref{eq:kthmin_L2}) is lower bounded as
\begin{align}
\underset{i\in[k]}{\text{max}}(a_{(\pi_{i,1})}+b_{(\pi_{i,2})})&\geq\underset{i\in[k]}{\text{max}}(a_{(\pi_{i,1}^*)}+b_{(\pi_{i,2}^*)})\label{eq:L_inequal} \\
&=\underset{i\in[k]}{\text{max}}(a_{(\pi_i^*)}+b_{(i)})\label{eq:L_11}.
\end{align}
Equation (\ref{eq:L_inequal}) implies that the lower bound of $\underset{i\in[k]}{\text{max}}(a_{(\pi_{i,1})}+b_{(\pi_{i,2})})$ can be obtained by properly selecting the $k$ pairs $\{a_{(\pi_{i,1}^*)}+b_{(\pi_{i,2}^*)}\}_{i=1}^{k}$ all in the left region of Fig. \ref{fig:Proposition1}, and taking the maximum. This value $\underset{i\in[k]}{\text{max}}(a_{(\pi_{i,1}^*)}+b_{(\pi_{i,2}^*)})$ can be simply rewritten as (\ref{eq:L_11}). Now we want to show that for any $\boldsymbol{\pi}^*\in\Pi^*$, (\ref{eq:L_11}) cannot be smaller than $\underset{i\in[k]}{\text{max}}(a_{(k-i+1)}+b_{(i)})$, which is the lower bound illustrated in Fig. \ref{fig:Proposition1}.
Define $L$ as
\begin{equation}
L=\underset{i\in[k]}{\text{max}}(a_{(k-i+1)}+b_{(i)})=a_{(k-j+1)}+b_{(j)}
\end{equation}
for some $j\in[k]$. Suppose there exist $L'$ and an ordering vector $\boldsymbol{\pi}'=[\pi_1', ...,\pi_n']\in\Pi^*$ such that
\begin{equation}\label{eq:contr1}
\underset{i\in[k]}{\text{max}}(a_{(\pi_i')}+b_{(i)})=L'<L.
\end{equation}
We will show that the assumption of (\ref{eq:contr1}) is a contradiction, which completes the proof. By (\ref{eq:contr1}), $a_{(\pi_{j'}')}+b_{(j')}<a_{(k-j+1)}+b_{(j)}$ should be satisfied for all $j'\in[k]$. This implies $\pi_{j'}'<k-j+1$ for all $j'\in [k]\setminus[j-1]$, which is a contradiction since one-to-one mapping between $j'$ and $\pi_{j'}'$ cannot be constructed for $j'\in[k]$.
\end{IEEEproof}
\begin{figure}[t]
\centering
\includegraphics[width=0.46\textwidth, trim=-0.5cm 0 0 0]{Proposition1-eps-converted-to.pdf}
\caption{Illustration of Proposition 1.}\label{fig:Proposition1}
\end{figure}
Since $\text{Pr}[X_i\leq t]=1-e^{-\mu_1t}$ and $\text{Pr}[S_i\leq t]=1-e^{-(1-\epsilon)\mu_2t}$ for $k=m$, we have
\begin{equation}\label{eq:expected_xi}
\mathbb{E}[X_{(i)}]=\frac{H_n-H_{n-i}}{\mu_1}
\end{equation}
\begin{equation}\label{eq:expected_si}
\mathbb{E}[S_{(i)}]=\frac{H_n-H_{n-i}}{(1-\epsilon)\mu_2}.
\end{equation}
for all $i\in[n]$. Then, the lower bound is derived as
\begin{align*}
\mathbb{E}[T]&=\mathbb{E}[\underset{i\in[n]}{k^{\text{th}}\text{min}}(X_i+S_i)]\\
&\underset{(a)}{\geq} \mathbb{E}[\underset{i\in[k]}{\text{max}}(X_{(k-i+1)}+S_{(i)})]\\
&\underset{(b)}{\geq} \underset{i\in[k]}{\text{max}}(\frac{H_n-H_{n-k+i-1}}{\mu_1}+\frac{H_n-H_{n-i}}{(1-\epsilon)\mu_2})\\
&\underset{(c)}{=}\begin{dcases}
\frac{H_n-H_{n-1}}{\mu_1}+\frac{H_n-H_{n-k}}{(1-\epsilon)\mu_2}, \ \ \epsilon\geq 1-\frac{\mu_1}{\mu_2} \\
\frac{H_n-H_{n-k}}{\mu_1}+\frac{H_n-H_{n-1}}{(1-\epsilon)\mu_2}, \ \ otherwise
\end{dcases}
\end{align*}
where $(a)$ holds from Proposition 1 and $(b)$ holds from the Jensen's inequality. Now we prove $(c)$. Let
\begin{equation}
f_{L}=\frac{H_n-H_{n-k+i-1}}{\mu_1}+\frac{H_n-H_{n-i}}{(1-\epsilon)\mu_2}.
\end{equation}
Assuming $n$ is large and $k$ is linear in $n$, we can approximate $H_n\simeq\text{log}(n)$, $H_{n-k}\simeq\text{log}(n-k)$, and $H_{n-k+i-1}\simeq\text{log}(n-k+i-1)$. Then,
\begin{equation}
\frac{\partial^2 f_{L}}{\partial i^2}=\frac{1}{(n-k+i-1)^2\mu_1}+\frac{1}{(1-\epsilon)(n-i)^2\mu_2}>0
\end{equation}
which implies $f_{L}$ is a convex function of $i$. Since $i\in[k]$, the integer $i$ maximizing $f_{L}$ is either $i=1$ or $i=k$. Thus, $(c)$ is satisfied which completes the proof.
\subsection{Upper bound}
For the upper bound, we use the following proposition which is illustrated in Fig. \ref{fig:Proposition2}.
\begin{proposition}
For any two sequences $\{a_i\}_{i\in[n]}$, $\{b_i\}_{i\in[n]}$,
\begin{equation}
\underset{i\in[n]}{k^{\text{th}}\text{min}}(a_i+b_i)\leq\underset{i\in[n]\setminus[k-1]}{\text{min}}(a_{(n+k-i)}+b_{(i)}).
\end{equation}
\end{proposition}
\begin{IEEEproof}
We use the similar idea as the proof of Proposition 1. Consider a set of ordering vectors $\Pi$ defined in (\ref{eq:ordervector}). Note that the $k^{\text{th}}$ smallest value out of $n$ can be always rewritten as the minimum of $n-k+1$ largest values. We define $\boldsymbol{\pi}=[\pi_{1}, ...,\pi_{n}]\in\Pi$ to make the set of values $\{a_{\pi_i}+b_{\pi_i}\}_{i=k}^{n}$ be the $n-k+1$ largest among $\{a_i+b_i\}_{i=1}^{n}$. In addition, define $\boldsymbol{\pi}_1,\boldsymbol{\pi}_2\in\Pi$ to make $a_{\pi_i}=a_{(\pi_{i,1})}$ and $b_{\pi_i}=b_{(\pi_{i,1})}$ be satisfied $\forall i\in[n]\setminus[k-1]$, where $\boldsymbol{\pi}_1=[\pi_{1,1}, ...,\pi_{n,1}]$, $\boldsymbol{\pi}_2=[\pi_{1,2}, ...,\pi_{n,2}]$. Then, $\underset{i\in[n]}{k^{\text{th}}\text{min}}(a_i+b_i)$ can be rewritten as
\begin{figure}[t]
\centering
\includegraphics[width=0.46\textwidth, trim=-0.5cm 0 0 0]{Proposition2-eps-converted-to.pdf}
\caption{Illustration of Proposition 2.}\label{fig:Proposition2}
\end{figure}
\begin{align}
\underset{i\in[n]}{k^{\text{th}}\text{min}}(a_i+b_i)&= \underset{i\in[n]\setminus[k-1]}{\text{min}}(a_{\pi_i}+b_{\pi_i}) \label{eq:kthmin_U1}\\
&= \underset{i\in[n]\setminus[k-1]}{\text{min}}(a_{(\pi_{i,1})}+b_{(\pi_{i,2})}). \label{eq:kthmin_U2}
\end{align}
Now define another set of ordering vectors $\Pi^*\subseteq\Pi$ as $\Pi^*=\{\boldsymbol{\pi}\in\Pi:\pi_i\in[n]\setminus[k-1] \ \forall i\in[n]\setminus[k-1]\}$. Then we can always construct $\boldsymbol{\pi}_1^*, \boldsymbol{\pi}_2^*\in \Pi^*$ such that $\pi_{i,1}\leq\pi_{i,1}^*$, $\pi_{i,2}\leq\pi_{i,2}^*$ for all $i\in [n]\setminus[k-1]$, which can be proved easily. Then by adequately selecting $\boldsymbol{\pi}^*\in \Pi^*$, (\ref{eq:kthmin_U2}) is upper bounded a
\begin{align}
\underset{i\in[n]\setminus[k-1]}{\text{min}}(a_{(\pi_{i,1})}+b_{(\pi_{i,2})})&\leq\underset{i\in[n]\setminus[k-1]}{\text{min}}(a_{(\pi_{i,1}^*)}+b_{(\pi_{i,2}^*)})\label{eq:U_inequal}\\
&=\underset{i\in[n]\setminus[k-1]}{\text{min}}(a_{(\pi_i^*)}+b_{(i)})\label{eq:U_11}
\end{align}
Equation (\ref{eq:U_inequal}) implies that the upper bound of $\underset{i\in[n]\setminus[k-1]}{\text{min}}(a_{(\pi_{i,1})}+b_{(\pi_{i,2})})$ can be obtained by properly selecting the $n-k+1$ pairs $\{a_{(\pi_{i,1}^*)}+b_{(\pi_{i,2}^*)}\}_{i=k}^{n}$ all in the right region of Fig. \ref{fig:Proposition2}, and taking the minimum. This value $\underset{i\in[n]\setminus[k-1]}{\text{min}}(a_{(\pi_{i,1}^*)}+b_{(\pi_{i,2}^*)})$ can be simply rewritten as (\ref{eq:U_11}). Now we want to show that for any $\boldsymbol{\pi}^*\in\Pi^*$, (\ref{eq:U_11}) cannot be larger than $\underset{i\in[n]\setminus[k-1]}{\text{min}}(a_{(n+k-i)}+b_{(i)})$, which is the upper bound illustrated in Fig. \ref{fig:Proposition2}.
Define $U$ as
\begin{equation}
U=\underset{i\in[n]\setminus[k-1]}{\text{min}}(a_{(n+k-i)}+b_{(i)})=a_{(n+k-j)}+b_{(j)}
\end{equation}
for some $j\in[n]\setminus[k-1]$. Suppose there exist $U'$ and an ordering vector $\boldsymbol{\pi'}=[\pi_1', ...,\pi_n']\in\Pi^*$ such that
\begin{equation}\label{eq:contr2}
\underset{i\in[n]\setminus[k-1]}{\text{min}}(a_{(\pi_i')}+b_{(i)})=U'>U.
\end{equation}
We show that the assumption of (\ref{eq:contr2}) is a contradiction. By (\ref{eq:contr2}), $a_{(\pi_{j'}')}+b_{(j')}>a_{(n+k-j)}+b_{(j)}$ should be satisfied for all $j'\in[n]\setminus[k-1]$. This implies $\pi_{j'}'>n+k-j$ for all $j'\in [j]\setminus[k-1]$, which is a contradiction since one-to-one mapping between $j'$ and $\pi_{j'}'$ cannot be constructed for $j'\in[n]\setminus[k-1]$.
\end{IEEEproof}
Now from (\ref{eq:expected_xi}) and (\ref{eq:expected_si}), the upper bound is derived as
\begin{align}
\mathbb{E}[T]&=\mathbb{E}[\underset{i\in[n]}{k^{\text{th}}\text{min}}(X_i+S_i)]\\
&\underset{(d)}{\leq}\mathbb{E}[\underset{i\in[n]\setminus[k-1]}{\text{min}}(X_{(n+k-i)}+S_{(i)})]\\
&\underset{(e)}{\leq}\underset{i\in[n]\setminus[k-1]}{\text{min}}(\frac{H_n-H_{i-k}}{\mu_1}+\frac{H_n-H_{n-i}}{(1-\epsilon)\mu_2})
\end{align}
where $(d)$ holds from Proposition 2 and $(e)$ holds from the Jensen's inequality.
\section{Proof of Theorem 3}
Since $\text{Pr}[X_i\leq t]=1-e^{-\frac{k}{m}\mu_1t}$ for general $k$, we have
\begin{equation}
\mathbb{E}[X_{(i)}]=\frac{m(H_n-H_{n-i})}{k\mu_1}
\end{equation}
for all $i\in[n]$. For communication time $S_i$, we can first see from Lemma 1 that random variable $\sum_{j=1}^{N_r}Y_{j,r}$ follows exponential distribution with rate $(1-\epsilon)\mu_2$ for all $r\in[\frac{m}{k}]$. Therefore, $S_i=\sum_{r=1}^{\frac{m}{k}}\sum_{j=1}^{N_r}Y_{j,r}$ which is the sum of $\frac{m}{k}$ independent exponential random variables with rate $(1-\epsilon)\mu_2$, follows erlang distribution with shape parameter $\frac{m}{k}$ and rate parameter $(1-\epsilon)\mu_2$:
\begin{equation}
\text{Pr}[S_i\leq t]=1-\sum_{p=0}^{\frac{m}{k}-1}\frac{1}{p!}e^{-(1-\epsilon)\mu_2t}[(1-\epsilon)\mu_2t]^p.
\end{equation}
By the property of erlang distribution, $S_i$ can be rewritten as
\begin{equation}
S_i=\frac{G_i}{(1-\epsilon)\mu_2}
\end{equation}
where $G_i$ is an erlang random variable with shape parameter $\frac{m}{k}$ and rate parameter $1$. We take this approach since closed-form expression of $\mathbb{E}[G_{(i)}]$ exists as (\ref{eq:erlangmean}). Now the lower bound is derived as
\begin{align*}
\mathbb{E}[T]&=\mathbb{E}[\underset{i\in[n]}{k^{\text{th}}\text{min}}(X_i+S_i)]\\
&\underset{(a)}{\geq} \mathbb{E}[\underset{i\in[k]}{\text{max}}(X_{(k-i+1)}+S_{(i)})]\\
&\underset{(b)}{\geq} \underset{i\in[k]}{\text{max}}\Big(\frac{m(H_n-H_{n-k+i-1})}{k\mu_1}+\frac{\mathbb{E}[G_{(i)}]}{(1-\epsilon)\mu_2}\Big)\\
\end{align*}
where $(a)$ holds from Proposition 1 and $(b)$ holds from the Jensen's inequality. For the upper bound, we write
\begin{align}
\mathbb{E}[T]&=\mathbb{E}[\underset{i\in[n]}{k^{\text{th}}\text{min}}(X_i+S_i)]\\
&\underset{(d)}{\leq}\mathbb{E}[\underset{i\in[n]\setminus[k-1]}{\text{min}}(X_{(n+k-i)}+S_{(i)})]\\
&\underset{(e)}{\leq}\underset{i\in[n]\setminus[k-1]}{\text{min}}\Big(\frac{m(H_n-H_{i-k})}{k\mu_1}+\frac{\mathbb{E}[G_{(i)}]}{(1-\epsilon)\mu_2}\Big)
\end{align}
where $(d)$ holds from Proposition 2 and $(e)$ holds from the Jensen's inequality.
\ifCLASSOPTIONcaptionsoff
\newpage
\fi
\section{Introduction}
\IEEEPARstart{S}{olving} massive-scale computational tasks for machine learning algorithms and data analytics is one of the most rewarding challenges in the era of big data. Modern large-scale computational tasks cannot be solved in a single machine (or worker) anymore. Enabling large-scale computations, distributed computing systems such as MapReduce \cite{mapreduce}, Apache Spark \cite{Spark} and Amazon EC2 have received significant attention in recent years. In distributed computing systems, the large-scale computational tasks are divided into several subtasks, which are computed by different workers in parallel. This parallelization helps to reduce the overall run-time to finish the task and thus enables to handle large-scale computing tasks. However, it is observed that workers that are significantly slow than the average, called \textit{stragglers}, critically slow down the computing time in practical distributed computing systems.
To alleviate the effect of stragglers, the authors of \cite{KLee1} proposed a new framework called \textit{coded computation}, which uses error correction codes to provide redundancy in distributed matrix multiplications. By applying maximum distance separable (MDS) codes, it was shown that total computation time of the coded scheme can achieve an order-wise improvement over uncoded scheme. More recently, coded computation has been applied to various other distributed computing scenarios. In \cite{High}, the authors proposed the use of product codes for high-dimensional matrix multiplication. The authors of \cite{Pcode} also targets high-dimensional matrix multiplication by proposing the use of polynomial codes. The use of short dot product for computing large linear transforms is proposed in \cite{shortdot}, and Gradient coding is proposed with applications to distributed gradient descent in \cite{Gradient1, Gradient2, Gradient3}. Codes for convolution and Fourier transform are studied in \cite{convolution} and \cite{Fourier}, respectively. To compensate the drawback of previous studies which completely ignore the work done by stragglers, the authors of \cite{Draper1, Draper2} introduce the idea of exploiting the work completed by the stragglers.
Mitigating the effect of stragglers over more practical settings are also being studied in recent years. The authors of \cite{heterogeneous} propose an algorithm for speeding up distributed matrix multiplication over heterogeneous clusters, where a variety of computing machines coexist with different capabilities. In \cite{HPark}, a hierarchical coding scheme is proposed to combat stragglers in practical distributed computing systems with multiple racks. The authors of \cite{wireless} also consider a setting where the workers
are connected wirelessly to the master
Codes are also introduced in various studies targeting data shuffling applications \cite{SLi1,SLi2,MAttia,SLi3,wireless_datasuffling,shuffling_limit} in MapReduce style setups. In \cite{SLi3}, a unifed coding framework is proposed for distributed computing, and trade-off between latency of computation and load of communication is studied. A scalable framework is studied in \cite{wireless_datasuffling} for minimizing the communication bandwidth in wireless distributed computing scenario. In \cite{shuffling_limit}, fundamental limits of data shuffling is investigated for distributed learning.
\subsection{Motivation}
In most of the existing studies, it is assumed that the links between the master node and worker nodes are error-free. However, link failures and device failures are common in current wired/wireless networks. It is reported in \cite{Error_datacenter} that the transmitted packets
often get lost in current data centers by various factors such
as congestion or load balancer issues in current data centers. In wireless networks, the transmitted packets can be lost by channel fading or interference. Based on these observations, the authors of \cite{Erasure_storage} considered link failures in the context of distributed storage systems. In this paper, we consider link failures for modern distributed computing systems. The transmission failure
at a specific worker necessitates packet retransmission, which
would in turn increase the overall run-time for the given task. Moreover, when
the bandwidth of the system is limited, the master would not
be able to collect timely results from the workers due to link
failures. A reliable solution to deal with these problems is
required in practical distributed computing systems.
\subsection{Contribution}
In this paper, we model the links between the master node and worker nodes as packet erasure channels, which is inspired by the link failures in practical distributed computing systems. We consider straggler problems in matrix-vector multiplication which is a key computation in many machine learning algorithms. We first separate the run-time at each worker into computation time and communication time. This approach is also taken in the previous work \cite{wireless} on coded computation over wireless networks, under the error-free assumption. Compared to the setting in \cite{wireless}, in our work, packet loss and retransmissions are considered. Thus, the communication time at each worker becomes a random variable which depends on the packet erasure probability.
We analyze the latency in this setting using an $(n,k)$ MDS code. By considering the average computation/communication time and erasure probability, we obtain the overall run-time of the task by analyzing the continuous-time Markov chain for maximum $k$ (when each node computes a single inner product). We also find the lower and upper bounds on the latency in closed-forms. Based on the closed-form expressions we give insights on the bounds and show that the overall run-time becomes log$(n)$ times faster than the uncoded scheme by using $(n,k)$ MDS code. Then for general $k$, we give guidelines to design $(n,k)$ MDS code depending on the erasure probability $\epsilon$. Finally, we consider a setup where the number of retransmissions is limited due to the bandwidth constraint. By formulating practical optimization problems related to latency, transmission bandwidth and probability of successful computation, we obtain achievable performance curves as a function of packet erasure probability.
\subsection{Organization and Notations}
The rest of this paper is organized as follows. In Section \ref{sec:problem_statement}, we describe the master-worker setup with link failures and define a problem statement. Latency analysis for maximum $k$ is performed in Section \ref{sec:analysis1}, and the case for general $k$ is discussed in Section \ref{sec:analysis2}. Then in Section \ref{sec:Finite}, analysis is performed under the setting of limited number of retransmissions. Finally, concluding remarks are drawn in Section \ref{sec:conclusion}.
The definitions and notations used in this paper are summarized as follows.
For $n$ random variables, the $k^{\text{th}}$ order statistic is denoted by the $k^{\text{th}}$ smallest one of $n$. We denote the set $\{1,2,...n\}$ by $[n]$ for $n\in\mathbb{N}$, where $\mathbb{N}$ is the set of positive integers. We also denote the $k^{\text{th}}$ order statistics of $n$ independent random variables $(X_1,X_2,...X_n)$ by $X_{(k)}$. We denote $f(n)=\Theta(g(n))$ if there exist $c_1,c_2,n_0>0$ such that $\forall n>n_0$, $c_1g(n)\leq f(n) \leq c_2g(n)$.
\section{Problem Statement}\label{sec:problem_statement}
Consider a master-worker setup in wired/wireless network with $n$ worker nodes connected to a single master node. For the wireless scenario, frequency division multiple access (FDMA) can be used so that the signals sent from the workers are detected simultaneously at the master without interference. We study a matrix-vector multiplication problem, where the goal is to compute the output $\mathbf{y}=\mathbf{A}\mathbf{x}$ for a given matrix $\mathbf{A}\in \mathbb{R}^{m \times d}$ and an input vector $\mathbf{x}\in \mathbb{R}^{d\times 1}$. The matrix $\mathbf{A}$ is divided into $k$ submatrices to obtain $\mathbf{A}_i\in \mathbb{R}^{\frac{m}{k} \times d}$, $i\in [k]$. Then, an $(n, k)$ MDS code is applied to construct $\tilde{\mathbf{A}}_i\in \mathbb{R}^{\frac{m}{k} \times d}$, $i\in [n]$, which are distributed across the $n$ worker nodes ($n>k$). For a given input vector $\mathbf{x}$, each worker $i$ computes $\tilde{\mathbf{A}}_i\mathbf{x}$ and sends the result to the master. By receiving $k$ out of $n$ results, the master node can recover the desired output $\mathbf{A}\mathbf{x}$.
We assume that the required time at each worker to compute a single inner product of vectors of size $d$ follows an exponential distribution with rate $\mu_1$. Since $\frac{m}{k}$ inner products are to be computed each worker, similar to the models in \cite{wireless,heterogeneous}, we assume that $X_i$, the computation time of worker $i$ follows an exponential distribution with rate $\frac{k\mu_1}{m}$:
\begin{equation}
\text{Pr}[X_i\leq t]=1-e^{-\frac{k}{m}\mu_1t}.
\end{equation}
After completing the given task, each worker transmits its results to the master through memoryless packet erasure channels where the packets are erased independently with probability $\epsilon$. For simplicity, we assume that each packet contains a single inner product. When a packet fails to be detected at the master, the corresponding packet is retransmitted. Otherwise, the worker transmits the next packet to the master. The work is finished when the master successfully detects the results of $k$ out of $n$ workers. The communication time for $j^{\text{th}}$ transmission of the $r^{\text{th}}$ inner product at each worker, $Y_{j,r}$, is also modeled as an exponential distribution (as the same as the communication time model in \cite{HPark}) with rate $\mu_2$. Then the average time for one packet transmission becomes $\frac{1}{\mu_2}$. Since each worker transmits $\frac{m}{k}$ inner products, the total communication time of worker $i$, denoted by $S_i$, is written as
\begin{equation}
S_i=\sum_{r=1}^{\frac{m}{k}}\sum_{j=1}^{N_r}Y_{j,r} \label{eq:communication_time}
\end{equation}
where $\text{Pr}[Y_{j,r}\leq t]=1-e^{-\mu_2t}$ and $N_r$ is a geometric random variable with success probability $1-\epsilon$, i.e., $\text{Pr}[N_r=l]=(1-\epsilon)\epsilon^{l-1}$.
We define the overall run-time of the task as the sum of computation time and communication time to finish the task. Now the overall run-time using $(n, k)$ MDS code is written as
\begin{equation}\label{eq:T}
T=\underset{i\in[n]}{k^{\text{th}}\text{min}}(X_i+S_i).
\end{equation}
We are interested in the expected overall run-time $\mathbb{E}[T]$.
\section{Latency Analysis for $k=m$}\label{sec:analysis1}
We start by reviewing some useful results on the order statistics. The expected value of $k^{\text{th}}$ order statistic of $n$ exponential random variables of rate $\mu$ is $\frac{H_n-H_{n-k}}{\mu}$, where $H_k=\sum_{i=1}^{k}\frac{1}{i}$. For $k=n$, the $k^{\text{th}}$ order statistic becomes $\frac{H_n}{\mu}$. The value $H_n$ can be approximated as $H_n\simeq \text{log}(n)+\eta$ for large $n$ where $\eta$ is a fixed constant.
In this section, we assume that each worker is capable of computing a single inner product, i.e., $k=m$.
This is a realistic assumption especially when a massive number of Internet of Things (IoT) devices having small storage size coexist in the network for wireless distributed computing\cite{WDC}. The case for general $k$ will be discussed in Section \ref{sec:analysis2}.
\subsection{Exact Overall Run-Time: Markov Chain Analysis}
We derive the overall run-time in terms $\mu_1$, $\mu_2$, $\epsilon$, $n$. We first state the following result on the communication time.
\begin{lemma}\label{lemma:sum_of_geometric_exponentials}
Assuming $k=m$, the random variable $S_i$ follows exponential distribution with rate $(1-\epsilon)\mu_2$, i.e., $\text{Pr}[S_i\leq t]=1-e^{-(1-\epsilon)\mu_2t}$.
\end{lemma}
\begin{IEEEproof}
See Appendix A.
\end{IEEEproof}
\textit{Remark} 1: By erasure probability $\epsilon$ and retransmission, Lemma 1 implies that the rate of communication time at each worker decreases by a factor of $1-\epsilon$ compared to the error-free scenario. That is, the expected communication time at each worker increases by a factor of $\frac{1}{1-\epsilon}$.
Based on Lemma 1, we obtain the following theorem which shows that $\mathbb{E}[T]$ can be obtained by analyzing the hitting time of a continuous-time Markov chain.
\begin{theorem}\label{thm:Markov}
Consider a continuous-time Markov chain $\mathbb{C}$ defined over 2-dimensional state space $(u,v)\in\{0, 1, ..., n\}\times\{0, 1,..., k \}$, where the transition rates are defined as follows.
\begin{itemize}
\item The transition rate from state $(u,v)$ to state $(u+1,v)$ is $(n-u)\mu_1$ if $v\leq u<n$, and $0$ otherwise.
\item The transition rate from state $(u,v)$ to state $(u,v+1)$ is $(u-v)(1-\epsilon)\mu_2$ if $0\leq v < \text{min}(u,k)$, and $0$ otherwise.
\end{itemize}
Then, the expected hitting time of $\mathbb{C}$ from state $(0, 0)$ to the set of states $(u,v)$ with $v=k$ becomes the expected overall run-time $\mathbb{E}[T]$.
\end{theorem}
\begin{IEEEproof}
For a given time $t$, define integers $u,v$ as
\begin{equation}
u=|\{j\in[n]:X_{j} \leq t\}| \label{eq:def_u}
\end{equation}
\begin{equation}
v=|\{i\in[n]:X_{i}+S_i \leq t\}| \label{eq:def_v}
\end{equation}
Here, $u$ can be viewed as the number of workers that finished computation by time $t$. For $v$, it is the number of workers that successfully transmitted the computation result to the master by time $t$. From these definitions, $v$ can be rewritten as
\begin{equation}
v=|\{i\in[u]: X_{i}+S_i \leq t \}|. \label{eq:def_v2}
\end{equation}
From $\mathbb{E}[T]=\mathbb{E}[\underset{i\in[n]}{k^{\text{th}}\text{min}}(X_i+S_i)]$, it can be seen that the expected overall run-time is equal to the expected arrival time from $(0,0)$ to any $(u,v)$ with $v=k$. Thus, we define the state of the Markov chain $(u,v)$, over space $\{0, 1, ..., n\}\times\{0, 1,..., k \}$.
By defining $u,v$ as above, the transition rates can be described as follows. By (\ref{eq:def_u}), for a given $t$, there are $n-u$ number of integers $j\in [n]$ satisfying $X_{j}>t$ at state $(u,v)$. Since $X_j$ follows exponential distribution with rate $\mu_1$, state transistion from $(u,v)$ to $(u+1,v)$ occurs with rate $(n-u)\mu_1$. The transition from $(u,v)$ from $(u+1,v)$ is possible for $u\geq v$, by the definitions (\ref{eq:def_u}), (\ref{eq:def_v}).
Now we consider the transition rate from $(u,v)$ to $(u,v+1)$ for a fixed $t$. Among $u$ number of integers $i$ satisfying $X_i\leq t$, there are $v$ of them which satisfy $X_i+S_i\leq t$ at state $(u,v)$. Recall that $S_i$ follows exponential distribution with rate $(1-\epsilon)\mu_2$ from Lemma \ref{lemma:sum_of_geometric_exponentials}. Thus, state transition from $(u,v)$ to $(u,v+1)$ occurs with rate $(u-v)(1-\epsilon)\mu_2$. Note that $v\in\{0,1,...,\text{min}(u,k)-1\}$. The described Markov chain is identical to $\mathbb{C}$, which completes the proof.
\end{IEEEproof}
For an arbitrary state $(u,v)$, the first component $u$ can be viewed as the number of workers finished the computation, and the second component $v$ is the number of workers that successfully transmitted their result to the master. Fig. \ref{fig:Markov_example} shows an example of the transition state diagram assuming $n=5$, $k=2$. From the initial state $(0,0)$, the given task is finished when the Markov chain visits one of the states with $v=2$ for the first time. Since the computational results of a worker are
transmitted after the worker finishes the whole computation, $u\geq v$ always holds. The expected hitting time of the Markov chain can be computed performing the first-step analysis \cite{Markov_anlysis}.
\begin{figure}[t]
\centering
\includegraphics[width=0.49\textwidth, trim=-0.5cm 0 0 0]{Markov_example-eps-converted-to.pdf}
\caption{State transition diagram example with $n=5$, $k=2$.}\label{fig:Markov_example}
\end{figure}
\subsection{Lower and Upper Bounds}
While the exact $\mathbb{E}[T]$ is not derived in a closed-form, we provide the closed-form expressions of the lower and upper bounds of $\mathbb{E}[T]$ in the following theorem.
\begin{theorem}\label{thm:bounds}
Assuming $k=m$, the expected overall run-time $\mathbb{E}[T]$ is lower bounded as $\mathbb{E}[T]\geq \mathcal{L}$, where
\begin{equation}\label{eq:Lbound}
\mathcal{L}=\underset{i\in[k]}{\text{max}}(\frac{H_n-H_{n-k+i-1}}{\mu_1}+\frac{H_n-H_{n-i}}{(1-\epsilon)\mu_2}),
\end{equation}
which reduces to
\begin{equation}\label{eq:Lbound_reduced}
\mathcal{L}=\begin{dcases}
\frac{1}{n\mu_1}+\frac{H_n-H_{n-k}}{(1-\epsilon)\mu_2}, \ \ \ \ \ \ \ \ \ \ \ \epsilon\geq 1 - \frac{\mu_1}{\mu_2} \\
\frac{H_n-H_{n-k}}{\mu_1}+\frac{1}{n(1-\epsilon)\mu_2}, \ \ \ otherwise.
\end{dcases}
\end{equation}
Moreover, the expected overall run-time $\mathbb{E}[T]$ is upper bounded as $\mathbb{E}[T]\leq\mathcal{U}$, where
\begin{equation}\label{eq:Ubound}
\mathcal{U}= \underset{i\in[n]\setminus[k-1]}{\text{min}}(\frac{H_n-H_{i-k}}{\mu_1}+\frac{H_n-H_{n-i}}{(1-\epsilon)\mu_2}).
\end{equation}
\end{theorem}
\begin{IEEEproof}
See Appendix C.
\end{IEEEproof}
From (\ref{eq:Lbound}) and (\ref{eq:Ubound}), it can be seen that the lower and upper bounds of $\mathbb{E}[T]$ are decreasing functions of $\epsilon$. Note that $\epsilon$ only decreases the terms of communication time (not computation time) by a factor of $\frac{1}{1-\epsilon}$ as in (\ref{eq:Lbound}) and (\ref{eq:Ubound}). The lower bound in (\ref{eq:Lbound}) can be rewritten as (\ref{eq:Lbound_reduced}) with two regimes classifed by equation $\epsilon= 1-\frac{\mu_1}{\mu_2}$. This equation is equivalent to
\begin{equation}
\frac{1}{\mu_1}=\frac{1}{(1-\epsilon)\mu_2}
\end{equation}
which means that the average computation time is equal to the average communication time with retransmission.
For $\epsilon\geq 1-\frac{\mu_1}{\mu_2}$, the first term of the lower bound in (\ref{eq:Lbound_reduced}) is the expected value of minimum computation time among $n$ workers, while the second term is the expected value of the $k^{\text{th}}$ smallest communication time among $n$ workers. This is the case where all the workers finish the computation by time $\frac{1}{n\mu_1}$ and then start communication simultaneously, which can be viewed as an obvious lower bound. We show in Appendix C that the derived lower bound (\ref{eq:Lbound_reduced}) is the tightest among $k$ candidates of the bounds we obtained in (\ref{eq:Lbound}). For the upper bound, by defining $H_0=0$, we have $\mathcal{U}=\frac{H_n}{\mu_1}+\frac{H_n-H_{n-k}}{(1-\epsilon)\mu_2}$ by inserting $i=k$ at (\ref{eq:Ubound}). The first term $\frac{H_n}{\mu_1}$ is the expected value of maximum computation time among $n$ workers and the second term is the expected value of the $k^{\text{th}}$ smallest communication time among $n$ workers. Again, this is an obvious upper bound as it can be interpreted as the case where all $n$ workers starts communication simultaneously right after the slowest worker finishes its computation. The derived upper bound includes this kind of scenario.
\begin{figure}
\centering
\subfloat[][$\mu_1=10$, $\mu_2=1$.]{\includegraphics[height=53mm ]{latency_versus_n_mu1_10-eps-converted-to.pdf}}
\quad \quad
\subfloat[][$\mu_1=1$, $\mu_2=10$.]{\includegraphics[height=53mm]{latency_versus_n_mu1_1-eps-converted-to.pdf}}
\caption{Bounds of $\mathbb{E}[T]$ for $k=m=500$, $\epsilon=0.1$.}
\label{fig:latency_versus_n}
\end{figure}
Assume a practical scenario where the size of the task scales linearly with the number of workers, i.e., $k=\Theta(n)$. Note that $k=m$ in this section. Then for large $k$, we have $H_n\simeq \text{log}(n)+\eta$ for a fixed constant $\eta$, which leads to $H_n-H_{n-k}\simeq\text{log}\frac{n}{n-k}$. Thus, the lower bound can be rewritten as
\begin{equation}\label{eq:Lower_rwrite}
\mathcal{L}=\begin{dcases}
\frac{1}{n\mu_1}+\frac{1}{(1-\epsilon)\mu_2}\text{log}(\frac{n}{n-k}), \ \ \ \epsilon\geq 1 - \frac{\mu_1}{\mu_2} \\
\frac{1}{\mu_1}\text{log}(\frac{n}{n-k})+\frac{1}{n(1-\epsilon)\mu_2}, \ \ \ otherwise,
\end{dcases}
\end{equation}
as $k$ grows. It can be easily shown that $\mathcal{L}=\Theta(1)$. More specifically, assuming a fixed code rate $R=\frac{k}{n}$, the expression of (\ref{eq:Lower_rwrite}) settles down to $\mathcal{L}=\frac{1}{(1-\epsilon)\mu_2}\text{log}(\frac{1}{1-R})$, if $\epsilon\geq 1-\frac{\mu_1}{\mu_2}$ and $\mathcal{L}=\frac{1}{\mu_1}\text{log}(\frac{1}{1-R})$, $otherwise$, as $n$ goes to infinity.
For the upper bound, we first define
\begin{equation}\label{eq:fu}
f_U= \frac{H_n-H_{i-k}}{\mu_1}+\frac{H_n-H_{n-i}}{(1-\epsilon)\mu_2}.
\end{equation}
From $\frac{\partial f_{U}}{\partial i}=0$, $f_U$ is minimized by setting $i=i^*$, where
\begin{equation}
i^*=\frac{\mu_1k+(1-\epsilon)\mu_2n}{\mu_1+(1-\epsilon)\mu_2}
\end{equation}
Since $i^*-k=\Theta(k)$ and $n-i^*=\Theta(k)$, we can approximate $H_n-H_{i^*-k}\simeq\text{log}\frac{n}{i^*-k}$ and $H_n-H_{n-i^*}\simeq\text{log}\frac{n}{n-i^*}$ for large $k$. Thus, the upper bound in (\ref{eq:Ubound}) can be rewritten as
\begin{equation}
\mathcal{U}= \frac{1}{\mu_1}\text{log}(\frac{n}{i^*-k})+\frac{1}{(1-\epsilon)\mu_2}\text{log}(\frac{n}{n-i^*}).
\end{equation}
It can be again shown that $\mathcal{U}=\Theta(1)$. Finally, we have
\begin{equation}\label{eq:coded_speed}
\mathbb{E}[T]=\Theta(1).
\end{equation}
Note that inserting $i=\lceil i^* \rceil$ or $i=\lfloor i^* \rfloor$ at (\ref{eq:fu}) makes the upper bound since $i$ should be an integer. However, the ceiling or floor notation can be ignored for the asymptotic regime.
\begin{figure}[t]
\centering
\includegraphics[width=0.41\textwidth, trim=-0.5cm 0 0 0]{latency_versus_epsilon-eps-converted-to.pdf}
\caption{Bounds of $\mathbb{E}[T]$ versus $\epsilon$ with $k=m=500$, $\mu_1=10$, $\mu_2=1$.}\label{fig:latancy_versus_epsilon}
\end{figure}
Fig. \ref{fig:latency_versus_n} shows the lower and upper bounds along with the hitting time of the Markov chain, with varying number of workers $n$. The number of inner products to be computed is assumed to be $m=500$. Erasure probability is assumed to be $\epsilon=0.1$. It can be seen that the overall run-time to finish the task decreases as $n$ increases. Based on the Markov analysis and derived bounds, one can find the minimum number of workers $n$ to meet the latency constraint of the given system.
Fig. \ref{fig:latancy_versus_epsilon} shows the bounds of $\mathbb{E}[T]$ with different erasure probability $\epsilon$. We see by Figs. \ref{fig:latency_versus_n} and \ref{fig:latancy_versus_epsilon} that the lower bound is generally tighter than the upper bound.
\subsection{Comparison with Uncoded Scheme}
In this subsection, we give comparison between the coded and uncoded schemes. For the uncoded scheme, the overall workload ($k=m$ inner products) are equally distributed to $n$ workers. Therefore, the workload at each worker becomes less than a single inner product. More specifically, the number of multiplications and additions computed at each worker are reduced by a factor of $\frac{k}{n}$ compared to the MDS-coded scheme. The master node has to wait for the results from all $n$ workers to finish the task. Since the workload at each worker is decreased by a factor of $\frac{k}{n}$ compared to the coded scheme, the computation time at each worker follows exponential distribution with rate $\frac{n}{k}\mu_1$. For the communication time, we model the communication time for a single inner product at each worker as exponential distribution with rate $\frac{n}{k}\mu_2$, by assuming that the packet length to be transmitted at each worker also decreases by a factor of $\frac{k}{n}$. The erasure probability should be also changed depending on the packet length. Assume that the packet is lost if at least one bit is erroneous. Then, by defining $\epsilon_b$ as the fixed bit-error rate (BER) of the system, the packet erasure probability $\epsilon'$ for the uncoded scheme can be written as
\begin{equation}
\epsilon'=1-(1-\epsilon_b)^{\frac{k}{n}l}
\end{equation}
where $l$ is the packet length of the coded scheme. Note that the erasure probability for the coded scheme $\epsilon$ is
\begin{equation}
\epsilon=1-(1-\epsilon_b)^{l}.
\end{equation}
The overall run-time of the uncoded scheme denoted by $T_{\text{uncoded}}$ can be written as
\begin{equation}
T_{\text{uncoded}}=\underset{i\in[n]}{\text{max}}(X_i+S_i)
\end{equation}
where $\text{Pr}[X_i\leq t]=1-e^{-\frac{k}{n}\mu_1t}$ and $\text{Pr}[S_i\leq t]=1-e^{-\frac{k}{n}(1-\epsilon)\mu_2t}$ by Lemma 1. Similar to the proof of Theorem 2, we have $\mathcal{L}_{\text{uncoded}}\leq\mathbb{E}[T_{\text{uncoded}}]\leq\mathcal{U}_{\text{uncoded}}$ where
\begin{align*}
\mathcal{L}_{\text{uncoded}}&=\underset{i\in[n]}{\text{max}}(\frac{k(H_n-H_{i-1})}{n\mu_1}+\frac{k(H_n-H_{n-i})}{n(1-\epsilon')\mu_2})\\
&=\begin{dcases}
\frac{k}{n}(\frac{1}{n\mu_1}+\frac{H_n}{(1-\epsilon')\mu_2}), \ \ \ \ \ \ \ \epsilon'\geq 1 - \frac{\mu_1}{\mu_2} \\
\frac{k}{n}(\frac{H_n}{\mu_1}+\frac{1}{n(1-\epsilon')\mu_2}), \ \ \ \ \ \ otherwise,
\end{dcases}
\end{align*}
\begin{equation}
\mathcal{U}_{\text{uncoded}}= \frac{k}{n}(\frac{H_n}{\mu_1}+\frac{H_n}{(1-\epsilon')\mu_2}).
\end{equation}
It can be easily seen that $\mathcal{L}_{\text{uncoded}}=\Theta(\text{log}(n))$, $\mathcal{U}_{\text{uncoded}}=\Theta(\text{log}(n))$ for $k=m=\Theta(n)$, which leads to
\begin{equation}\label{eq:uncoded_speed}
\mathbb{E}[T_{\text{uncoded}}]=\Theta(\text{log}(n)).
\end{equation}
Comparing (\ref{eq:coded_speed}) and (\ref{eq:uncoded_speed}) shows that the overall run-time becomes $\Theta(\text{log}(n))$ times faster by introducing redundancy:
\begin{equation}
\frac{\mathbb{E}[T_{\text{uncoded}}]}{\mathbb{E}[T]}=\Theta(\text{log}(n)).
\end{equation}
This result is consistent with the previous works \cite{KLee1, heterogeneous} which compared coded and uncoded schemes in an error-free scenario.
\section{Latency for General $k$}\label{sec:analysis2}
In this section, we give discussions for general $k$. We provide the following theorem, which shows the lower and upper bounds of $\mathbb{E}[T]$ for general $k$.
\begin{theorem}
Let $G_i$ be an erlang random variable with shape parameter $\frac{m}{k}$ and rate parameter $1$, i.e., $\text{Pr}[G_i\leq t]=1-\sum_{p=0}^{\frac{m}{k}-1}\frac{1}{p!}e^{-t}t^p
$. Then for general $k$, we have $\mathcal{L}\leq\mathbb{E}[T]\leq\mathcal{U}$ where
\begin{equation}\label{eq:Lbound_generalk}
\mathcal{L}=\underset{i\in[k]}{\text{max}}\Big(\frac{m(H_n-H_{n-k+i-1})}{k\mu_1}+\frac{\mathbb{E}[G_{(i)}]}{(1-\epsilon)\mu_2}\Big)
\end{equation}
\begin{equation}\label{eq:Ubound_generalk}
\mathcal{U}=\underset{i\in[n]\setminus[k-1]}{\text{min}}\Big(\frac{m(H_n-H_{i-k})}{k\mu_1}+\frac{\mathbb{E}[G_{(i)}]}{(1-\epsilon)\mu_2}\Big).
\end{equation}
\end{theorem}
\begin{IEEEproof}
See Appendix C.
\end{IEEEproof}
\begin{figure*}[!t]
\normalsize
\setcounter{mytempeqncnt}{2}
\begin{equation}\label{eq:erlangmean}
\mathbb{E}[G_{(i)}]=\frac{n!}{(i-1)!(n-i)!\Gamma(\frac{m}{k})}\sum_{p=0}^{i-1}(-1)^p{{i-1}\choose{p}}\sum_{q=0}^{(\frac{m}{k}-1)(n-i+p)}a_q(\frac{m}{k},n-i+p)\frac{\Gamma(\frac{m}{k}+q+1)}{(n-i+p+1)^{\frac{m}{k}+q+1}}
\end{equation}
\hrulefill
\vspace*{4pt}
\end{figure*}
As illustrated in \cite{Gamma}, the expected value of $i^{\text{th}}$ order statistic $\mathbb{E}[G_{(i)}]$ can be written as (\ref{eq:erlangmean}) shown at the top of next page. Here, $\Gamma$ is a gamma function\footnote{For a positive integer $z$, $\Gamma(z)=(z-1)!$ is satisfied.} and $a_q(x,y)$ is the coefficient of $t^{q}$ in the expansion of $(\sum_{j=0}^{x-1}\frac{t^{j}}{j!})^{y}$ for any integer $x$, $y$.
For the uncoded scheme, we have $\mathcal{L}_{\text{uncoded}}\leq\mathbb{E}[T_{\text{uncoded}}]\leq\mathcal{U}_{\text{uncoded}}$ where
\begin{equation}
\mathcal{L}_{\text{uncoded}}=\underset{i\in[n]}{\text{max}}\Big(\frac{m(H_n-H_{i-1})}{n\mu_1}+\frac{\mathbb{E}[G'_{(i)}]}{(1-\epsilon)\mu_2}\Big)
\end{equation}
\begin{equation}
\mathcal{U}_{\text{uncoded}}=\frac{m(H_n-H_{n-k})}{n\mu_1}+\frac{\mathbb{E}[G'_{(i)}]}{(1-\epsilon)\mu_2}
\end{equation}
which are obtained by inserting $k=n$ at (\ref{eq:Lbound_generalk}) and (\ref{eq:Ubound_generalk}), respectively. Here, $G'_i$ is an erlang random variable with shape parameter $\frac{m}{n}$ and rate parameter $1$, where $\mathbb{E}[G'_{(i)}]$ can be obtained by inserting $k=n$ at (\ref{eq:erlangmean}).
\begin{figure}[t]
\centering
\includegraphics[width=0.41\textwidth, trim=-0.5cm 0 0 0]{BOUNDS_upper-eps-converted-to.pdf}
\caption{Upper bound $\mathcal{U}$ on $\mathbb{E}[T]$ versus code rate $R$ with $n=100$, $m=500$, $\mu_1=1$, $\mu_2=10$.}\label{fig:Optimal_k}
\end{figure}
\begin{figure}[t]
\centering
\includegraphics[width=0.41\textwidth, trim=-0.5cm 0 0 0]{tightnessofbounds-eps-converted-to.pdf}
\caption{Latency performance on the design targeting upper bound minimization. Here, we assume $n=100$, $m=500$, $\mu_1=1$, $\mu_2=10$.}\label{fig:tightness}
\end{figure}
While finding the exact expression of $\mathbb{E}[T]$ for general $k$ remains open, we provide numerical results to gain insights on designing $(n,k)$ MDS code. We plot the upper bound of $\mathbb{E}[T]$ versus code rate $R=\frac{k}{n}$ with $n=100$, $m=500$, $\mu_1=1$, $\mu_2=10$ in Fig. \ref{fig:Optimal_k}. It can be seen that the optimal code rate $R^*$ can be designed to minimize the upper bound $\mathcal{U}$ on $\mathbb{E}[T]$ depending on the erasure probability $\epsilon$. Fig. \ref{fig:tightness} compares the performance between the achievable $\mathbb{E}[T]$ (obtained by Monte Carlo simulations) and the MDS code with rate $R^*$. It can be seen that the performance of the MDS code with rate $R^*$ is very close to the achievable $\mathbb{E}[T]$, showing the effectiveness of the proposed design.
\section{Analysis under the Setting of Limited Number of Retransmissions}\label{sec:Finite}
\subsection{Probability of Successful Computation}
So far, we focused on latency analysis over packet erasure channels under the assumption that there is no limit on the number of transmissions at each worker. The number of transmissions can be potentially infinite on the analysis above. However, in practice, the number of transmissions cannot be potentially infinite due to the constraint on the transmission bandwidth. With limited number of transmissions, the overall computation can fail, i.e., the master node may not receive enough results (less than $k$) from the workers due to link failures.
Thus, we consider the success probability of a given task in this section. We first analyze probability of success at a specific worker. Let $\gamma$ be the maximum number of packets that is allowed to be transmitted at a specific worker. That is, the number of transmissions at each worker is limited to $\gamma$. When the number of workers is given by $n$, the total transmission bandwidth of the network is then limited to $n\gamma l$, where $l$ is the packet length. For a successful computation at a specific worker node, the master node should successfully receive $\frac{m}{k}$ out of $\gamma$ packets from that worker. Thus, probability of success at a specific worker denoted by $p$ is obtained as
\begin{align}
p&=\underbrace{(1-\epsilon)^{\frac{m}{k}}}_{0 \ \text{failure}} + \underbrace{{{\frac{m}{k}}\choose{1}}(1-\epsilon)^{\frac{m}{k}}\epsilon}_{1 \ \text{failure}} + ... \underbrace{{{\gamma-1}\choose{\gamma-\frac{m}{k}}}(1-\epsilon)^{\frac{m}{k}}\epsilon^{\gamma-\frac{m}{k}}}_{\gamma-\frac{m}{k} \ \text{failures}} \nonumber \\
&=\sum_{i=0}^{\gamma-\frac{m}{k}} {{\frac{m}{k}+i-1}\choose{i}}(1-\epsilon)^{\frac{m}{k}}\epsilon^{i}. \label{eq:p}
\end{align}
To complete the overall task, $k$ out of $n$ workers should successfully deliver their results to the master. Based on $p$, the probability of success for the overall computation, denoted by $P_s$, can be written as
\begin{equation}\label{eq:P_s}
P_s = \sum_{i=k}^{n}{{n}\choose{i}}(1-p)^{n-i}p^i.
\end{equation}
\begin{figure}[t]
\centering
\includegraphics[width=0.43\textwidth, trim=-0.5cm 0 0 0]{Ps_vs_epsilon-eps-converted-to.pdf}
\caption{$P_s$ versus $\epsilon$ assuming $n=40$, $m=120$. The scheme which uses less transmission bandwidth can have higher probability of success. Moreover, the scheme with higher probability of success in one region may have lower probability of success in the other region.}\label{fig:Ps_vs_epsilon}
\end{figure}
It can be seen from (\ref{eq:p}) that increasing $k$ also increases probability of success $p$ at each worker. This is because increasing $k$ decreases the number of packets to be transmitted at each worker, which increases $p$ for a given number of transmissions $\gamma$. However, larger $k$ increases the number of results to be detected at the master node for decoding the overall computational results. That is, for a given $p$, increasing $k$ decreases $P_s$ from (\ref{eq:P_s}). Now the question is, how to design optimal $k$? How about choosing the appropriate value of $\gamma$? We address these issues in Section V-C.
For given number of workers $n=40$ and workload $m=120$, Fig. \ref{fig:Ps_vs_epsilon} shows $P_s$ versus erasure probability $\epsilon$ with different $k$ and $\gamma$ values. It can be seen that even the case with $k=20$ uses less bandwidth compared to the case with $k=10$, it has strictly better probability of success for all $\epsilon$ values. This is because the case with $k=10$ has more packets to be transmitted compared to the case with $k=20$. It can be also seen that for $\epsilon>0.2$, the case with $k=40$ has higher $P_s$ compared to the case with $k=10$ which uses twice as many transmission bandwidth as the case with $k=40$. This example motivates us to consider the problem of choosing the best $k$ and $\gamma$ for different $\epsilon$ values under bandwidth and probability of success constraints.
\subsection{Latency}
The overall run-time to finish the task should be reconsidered with limited number of transmissions. Let $T'$ be the overall run-time for a given $\gamma$. Note that if the computation fails for a given $\gamma$, we say that the overall run-time is infinity. Thus, if $P_s<1$, the expected overall run-time $\mathbb{E}[T']$ always becomes infinity. Therefore, in this setup, instead of the expected value $\mathbb{E}[T']$, it is more reasonable to consider probability that the task would be finished within a certain required time $\tau$, $\text{Pr}[T'\leq\tau]$.
We first rewrite $T'$ from (\ref{eq:T}) for a given $\gamma$. Since the term $\gamma$ only gives effect on the communication time at each worker (not the computation time), $T'$ can be written as
\begin{equation}
T'=\underset{i\in[n]}{k^{\text{th}}\text{min}}(X_i+S_i').
\end{equation}
As in (\ref{eq:T}), the computation time at worker $i$ denoted by $X_i$, follows exponential distribution with rate $\mu_1$. The communication time at worker $i$ denoted by $S_i'$ is written as
\begin{equation}
S_i'=\sum_{j=1}^{C_i}Y_{j},
\end{equation}
where $Y_j$ follows exponential distribution with rate $\mu_2$ and $C_i$ is the number of transmissions at a specific worker until it successfully transmit $\frac{m}{k}$ number of packets, which are all independent for different workers. With probability $1-p$, the worker fails to transmit the $\frac{m}{k}$ packets so that $C_i$ is undefined and $S_i'$ becomes infinity. Thus, we have random variable $C_i$ as follows:
\begin{equation}
C_i= \begin{dcases}
\frac{m}{k} \ \ \ \ \ \ \ \ \ \text{w.p.} \ (1-\epsilon)^{\frac{m}{k}} \\
\frac{m}{k}+1 \ \ \ \ \text{w.p.} \ {{\frac{m}{k}}\choose{1}}(1-\epsilon)^{\frac{m}{k}}\epsilon}_{ \\
\vdotswithin {\text{erlang}(\frac{m}{k}+1, \mu_2) \ \text{w.p.}}\\
\gamma \ \ \ \ \ \ \ \ \ \ \text{w.p.} \ {{\gamma-1}\choose{\gamma-\frac{m}{k}}}(1-\epsilon)^{\frac{m}{k}}\epsilon^{\gamma-\frac{m}{k}}}_{ \\
\text{undefined} \ \text{w.p.} \ 1-p.
\end{dcases}\end{equation}
Based on $C_i$, random variable $S_i'$ becomes
\begin{equation}
S_i' \begin{dcases}
\sim\text{erlang}(\frac{m}{k}, \mu_2) \ \text{w.p.} \ (1-\epsilon)^{\frac{m}{k}} \\
\sim\text{erlang}(\frac{m}{k}+1, \mu_2) \ \text{w.p.} \ {{\frac{m}{k}}\choose{1}}(1-\epsilon)^{\frac{m}{k}}\epsilon}_{ \\
\vdotswithin {\text{erlang}(\frac{m}{k}+1, \mu_2) \ \text{w.p.}}\\
\sim\text{erlang}(\gamma, \mu_2) \ \text{w.p.} \ {{\gamma-1}\choose{\gamma-\frac{m}{k}}}(1-\epsilon)^{\frac{m}{k}}\epsilon^{\gamma-\frac{m}{k}}}_{ \\
=\infty \ \text{w.p.} \ 1-p.
\end{dcases}\end{equation}
\begin{figure}[t]
\centering
\includegraphics[width=0.43\textwidth, trim=-0.5cm 0 0 0]{Ps_vs_gamma-eps-converted-to.pdf}
\caption{$P_s$ versus $\gamma$ assuming $n=40$, $m=120$, $\epsilon=0.3$. The figure shows the minimum $\gamma$ satisfying $P_s\geq 1-\delta$ for different $k$ values, where $\delta$ is set to $0.01$.}\label{fig:Ps_vs_gamma}
\end{figure}
\textit{Remark} 2: As $\gamma$ increases, the probability $\text{Pr}[T'\leq \tau]$ also increases for a given $\tau$, since increasing $\gamma$ increases the probability of success. The probability $\text{Pr}[T'\leq \tau]$ converges to $\text{Pr}[T\leq \tau]$ as $\gamma$ increases, where $T$ is the asymptotic overall run-time defined in (\ref{eq:T}).
\subsection{Optimal Resource Allocation in Practical Scenarios}
For given constraints on maximum number of transmissions $\gamma$ and probability of successful computation $P_s$, we would like to minimize $T^{(\alpha)}$ which is defined as the minimum overall run-time that we can guarantee with probability $1-\alpha$, as follows:
\begin{equation}
T^{(\alpha)}=\text{min}\{\tau: \text{Pr}[T'\leq \tau]\geq 1-\alpha \}.
\end{equation}
For a given number of workers $n$, the optimization problem is formulated as
\begin{align}
\underset{k,\gamma}{\text{min}} & \ T^{(\alpha)} \\
\text{subject to } & \gamma\leq\gamma_t, \\
& P_s\geq1-\delta,
\end{align}
where $\gamma_t$ is the transmission bandwidth limit and $\delta$ shows how $P_s$ is close to 1 ($0\leq \delta \leq 1$). While it is not straightforward to find the closed-form solution of the above problem, optimal $k$ can be found by combining the results of Figs \ref{fig:Ps_vs_gamma} and \ref{fig:Prlatency_vs_k}. We first observe Fig. \ref{fig:Ps_vs_gamma}, which shows the probability successful computation $P_s$ as a function of $\gamma$. The parameters are set as $n=40$, $m=120$, $\epsilon=0.3$. Obviosly, $P_s$ increases as $\gamma$ increases. In addition, since there are $\frac{m}{k}$ packets to be transmitted at each worker, we have $P_s=0$ for $\gamma<\frac{m}{k}$. The optimal bounds shown in Fig. \ref{fig:Ps_vs_gamma} are the minimum $\gamma$ values that satisfy $P_s\geq 1-\delta$, where $\delta=0.01$. Given a success probability constraint $P_s\geq 1-\delta$ and bandwidth constraint $\gamma\leq\gamma_t$, one can find the candidates of $k$ values that satisfy the constraints. For example, if $\gamma_t=13$, $k=30$ and $k=40$ become possible candidates for the optimal solution while $k=10$ does not. Note that in Fig. \ref{fig:Ps_vs_gamma}, increasing (or decreasing) $k$ does not always indicate higher probability of success.
\begin{figure}[t]
\centering
\includegraphics[width=0.43\textwidth, trim=-0.5cm 0 0 0]{Prlatency_vs_k-eps-converted-to.pdf}
\caption{$\text{Pr}[T'\leq\tau]$ versus $k$ assuming $n=40$, $m=120$, $\gamma=13$, $\tau=8.6$, $\epsilon=0.3$, $\mu_1=1$, $\mu_2=5$.}\label{fig:Prlatency_vs_k}
\end{figure}
\begin{figure}[t]
\centering
\includegraphics[width=0.43\textwidth, trim=-0.5cm 0 0 0]{Prlatency_vs_gamma-eps-converted-to.pdf}
\caption{$\text{Pr}[T'\leq \tau_t]$ versus $k$ assuming $n=40$, $m=120$, $\tau_t=8.6$, $\epsilon=0.3$, $\mu_1=1$, $\mu_2=5$.}\label{fig:Prlatency_vs_gamma}
\end{figure}
\begin{figure}[t]
\centering
\includegraphics[width=0.43\textwidth, trim=-0.5cm 0 0 0]{Ps_vs_k-eps-converted-to.pdf}
\caption{$P_s$ versus $k$ assuming $n=40$, $m=120$, $\epsilon=0.3$, $\gamma=8$.}\label{fig:Ps_vs_k}
\end{figure}
\begin{figure}
\centering
\subfloat[][Optimal $T^{(\alpha)}-\epsilon$ curve.]{\includegraphics[height=53mm]{Optimal_curve_Talpha-eps-converted-to.pdf}}
\quad \quad
\subfloat[][Optimal $\gamma-\epsilon$ curve.]{\includegraphics[height=53mm]{Optimal_curve_gamma-eps-converted-to.pdf}}
\quad \quad
\subfloat[][Optimal $P_s-\epsilon$ curve.]{\includegraphics[height=53mm]{Optimal_curve_Ps_ver2-eps-converted-to.pdf}}
\caption{Optimal curves assuming $n=40$, $m=120$, $\mu_1=1$, $\mu_2=5$, $\gamma_t=7$, $\tau_t=10$, $\alpha=0.05$, $\delta=0.01$.}
\label{fig:Optimal_curve}
\end{figure}
Fig. \ref{fig:Prlatency_vs_k} shows $\text{Pr}[T'\leq \tau]$ versus $k$ assuming $\gamma=13$, $\tau=8.6$, where other parameters are set to be same as in Fig. \ref{fig:Ps_vs_gamma}. Among the candidates obtained from Fig. \ref{fig:Ps_vs_gamma}, one can find the optimal $k$ that minimizes $T^{(\alpha)}$. By setting $\alpha=0.03$ and $\tau=8.6$, it can be seen from Fig. \ref{fig:Prlatency_vs_k} that $\text{Pr}[T'\leq \tau]\geq 1-\alpha$ holds only for $k=20$, which means that $k=20$ is the optimal solution. Note that $k$ that minimizes $\gamma$ to satisfy $P_s\geq 1-\delta$ (in Fig. \ref{fig:Ps_vs_gamma}) does not always minimizes $T^{(\alpha)}$, which motivated us to formulate the problem (while it is not shown in Fig. \ref{fig:Ps_vs_gamma}, the case for $k=20$ has lower performance compared to the case for $k=30$).
For given constraints on probability of success and latency, one can also minimize $\gamma$:
\begin{align}
\underset{k}{\text{min}} & \ \gamma \\
\text{subject to } & P_s\geq1-\delta, \\
& T^{(\alpha)}\leq \tau_t.
\end{align}
where $\tau_t$ is the required latency constraint. For this optimization problem, it can be seen that the constraint $T^{(\alpha)}\leq \tau_t$ is equivalent to the constraint $\text{Pr}[T'\leq \tau_t]\geq 1-\alpha$. From Fig. \ref{fig:Ps_vs_gamma}, candidates of $(k,\gamma)$ pairs satisfying $P_s\geq 1-\delta$ can be obtained. Among these candidates, one can find the best $k$ that minimizes $\gamma$ from Fig. \ref{fig:Prlatency_vs_gamma}, which shows $\text{Pr}[T'\leq \tau_t]$ versus $\gamma$ with different $k$ values, where $\tau_t$ is set to $8.6$. With small number of retransmissions, $k=30$ gives the best performance while for $\gamma \geq 10$, it does not. This is because the case with $k=30$ has smaller number of packets to be transmitted compared to others, which gives higher $P_s$ for small $\gamma$. As $\gamma$ grows, the probability $\text{Pr}[T'\leq \tau_t]$ converges to $\text{Pr}[T\leq \tau_t]$ for each $k$.
At last, we formulate the following problem,
\begin{align}
\underset{k,\gamma}{\text{max}} & \ P_s \\
\text{subject to } & \gamma\leq\gamma_t, \label{eq:gamma_constraint3}\\
& T^{(\alpha)}\leq \tau_t. \label{eq:latency_constraint3}
\end{align}
aiming to maximize the probability of success with transmission bandwidth and latency constraints. We first find the candidates of $k$ that satisfy $T^{(\alpha)}\leq\tau_t$ from Fig. \ref{fig:Prlatency_vs_gamma}, and then choose optimal $k$ from Fig. \ref{fig:Ps_vs_k} which shows $P_s$ as a function of $k$.
\subsection{Achievable Curves}
Based on the solutions to the optimization problems, optimal curves as a function of $\epsilon$ are obtained in Fig. \ref{fig:Optimal_curve}, where the parameters are set as $n=40$, $m=120$, $\mu_1=1$, $\mu_2=5$, $\gamma_t=7$, $\tau_t=10$, $\alpha=0.05$, $\delta=0.01$. Fig. \ref{fig:Optimal_curve}(a) shows the achievable $T^{(\alpha)}$ as a function of $\epsilon$. We observe that the achievable $T^{(\alpha)}$ increases as $\epsilon$ grows. From Fig. \ref{fig:Optimal_curve}(b) which shows the optimal $\gamma-\epsilon$ curve, we observe that achievable $\gamma$ also increases as $\epsilon$ grows, which indicates that a larger transmission bandwidth is required for higher erasure probability. Finally in Fig. \ref{fig:Optimal_curve}(c), we can see that there exists a sharp threshold $\epsilon_t$ that makes $P_s=0$ for $\epsilon>\epsilon_t$ since the latency constraint cannot be satisfied anymore for $\epsilon$ greater than some threshold $\epsilon_t$.
\section{Concluding Remarks}\label{sec:conclusion}
We studied the problem of coded computation assuming link failures, which are a fact of life in current wired data centers and wireless networks. With maximum $k$, we showed that the asymptotic expected latency is equivalent to analyzing a continuous-time Markov chain. Closed-form expressions of lower and upper bounds on the expected latency are derived based on some key inequalities. For general $k$, we show that the performance of the coding scheme which minimizes the upper bound nearly achieves the optimal run-time, which shows the effectiveness of the proposed design. Finally, under the setting of limited number of retransmissions, we formulated practical optimization problems and obtained achievable curves as a function of packet erasure probability $\epsilon$. Considering the link failures in hierarchical computing systems \cite{HPark} or in secure distributed computing \cite{Secure} are interesting and important topics for future research.
\appendices
\section{Proof of Lemma 1}
Assuming $k=m$ (i.e., $r=1$), we have $S_i=\sum_{j=1}^{N_1}Y_{j,1}$. For fixed integer $q$, $\sum_{j=1}^{q}Y_{j,1}$ which is the sum of $q$ exponential random variables with rate $\mu_2$, follows erlang distribution with shape parameter $q$ and rate parameter $\mu_2$:
\begin{equation}
\text{Pr}[\sum_{j=1}^{q}Y_{j,1}\leq t]=1-\sum_{p=0}^{q-1}\frac{1}{p!}e^{-\mu_2t}(\mu_2t)^p.
\end{equation}
Now we can write
\begin{align*}
\text{Pr}[S_i\leq t]&=\sum_{q=1}^{\infty}\text{Pr}[N_1=q]\text{Pr}[\sum_{j=1}^{q}Y_{j,1}\leq t]\\
&=\sum_{q=1}^{\infty}((1-\epsilon)\epsilon^{q-1})(1-\sum_{p=0}^{q-1}\frac{1}{p!}e^{-\mu_2t}(\mu_2t)^p)\\
&=1-e^{-\mu_2t}\sum_{q=1}^{\infty}\sum_{p=0}^{q-1}((1-\epsilon)\epsilon^{q-1})\frac{1}{p!}(\mu_2t)^p\\
&=1-e^{-\mu_2t}\sum_{p=0}^{\infty}\sum_{q=p+1}^{\infty}((1-\epsilon)\epsilon^{q-1})\frac{1}{p!}(\mu_2t)^p\\
&=1-e^{-\mu_2t}\sum_{p=0}^{\infty}\frac{1}{p!}(\epsilon\mu_2t)^p\\
&=1-e^{-(1-\epsilon)\mu_2t}
\end{align*}
which completes the proof.
\section{Proof of Theorem 2}
\subsection{Lower bound}
We first prove the following proposition, which is illustrated as in Fig. \ref{fig:Proposition1}.
\begin{proposition}
For any two sequences $\{a_i\}_{i\in[n]}$, $\{b_i\}_{i\in[n]}$,
\begin{equation}\label{eq:prop1}
\underset{i\in[n]}{k^{\text{th}}\text{min}}(a_i+b_i)\geq\underset{i\in[k]}{\text{max}}(a_{(k-i+1)}+b_{(i)}).
\end{equation}
\end{proposition}
\begin{IEEEproof}
Define the ordering vector $\boldsymbol{\pi}\in\Pi$, where $\Pi$ is the set of permutation of $[n]$, i.e.,
\begin{equation}\label{eq:ordervector}
\Pi=\{\boldsymbol{\pi}=[\pi_1, ...,\pi_n]: \pi_i\in[n] \ \forall i\in[n], \ \pi_i\neq\pi_j \ for \ i\neq j \}.
\end{equation}
Note that the $k^{\text{th}}$ smallest value out of $n$ can be always rewritten as the maximum of $k$ smallest values. Define $\boldsymbol{\pi}=[\pi_{1}, ...,\pi_{n}]\in\Pi$ to make the set of values $\{a_{\pi_i}+b_{\pi_i}\}_{i=1}^{k}$ be the $k$ smallest among $\{a_i+b_i\}_{i=1}^{n}$. In addition, define $\boldsymbol{\pi}_1,\boldsymbol{\pi}_2\in\Pi$ to make $a_{\pi_i}=a_{(\pi_{i,1})}$ and $b_{\pi_i}=b_{(\pi_{i,1})}$ be satisfied $\forall i\in[k]$, where $\boldsymbol{\pi}_1=[\pi_{1,1}, ...,\pi_{n,1}]$, $\boldsymbol{\pi}_2=[\pi_{1,2}, ...,\pi_{n,2}]$. Then, $\underset{i\in[n]}{k^{\text{th}}\text{min}}(a_i+b_i)$ can be rewritten as
\begin{align}
\underset{i\in[n]}{k^{\text{th}}\text{min}}(a_i+b_i)&=\underset{i\in[k]}{\text{max}}(a_{\pi_i}+b_{\pi_i}) \label{eq:kthmin_L1}\\
&=\underset{i\in[k]}{\text{max}}(a_{(\pi_{i,1})}+b_{(\pi_{i,2})}). \label{eq:kthmin_L2}
\end{align}
Now define a new set of ordering vectors $\Pi^*\subseteq\Pi$, as $\Pi^*=\{\boldsymbol{\pi}\in\Pi:\pi_i\in[k] \ \forall i\in[k]\}$. Then we can always construct $\boldsymbol{\pi}_1^*, \boldsymbol{\pi}_2^*\in \Pi^*$ such that $\pi_{i,1}\geq\pi_{i,1}^*$, $\pi_{i,2}\geq\pi_{i,2}^*$ for all $i\in [k]$, which is easy to proof. Then by adequately selecting $\boldsymbol{\pi}^*\in \Pi^*$, (\ref{eq:kthmin_L2}) is lower bounded as
\begin{align}
\underset{i\in[k]}{\text{max}}(a_{(\pi_{i,1})}+b_{(\pi_{i,2})})&\geq\underset{i\in[k]}{\text{max}}(a_{(\pi_{i,1}^*)}+b_{(\pi_{i,2}^*)})\label{eq:L_inequal} \\
&=\underset{i\in[k]}{\text{max}}(a_{(\pi_i^*)}+b_{(i)})\label{eq:L_11}.
\end{align}
Equation (\ref{eq:L_inequal}) implies that the lower bound of $\underset{i\in[k]}{\text{max}}(a_{(\pi_{i,1})}+b_{(\pi_{i,2})})$ can be obtained by properly selecting the $k$ pairs $\{a_{(\pi_{i,1}^*)}+b_{(\pi_{i,2}^*)}\}_{i=1}^{k}$ all in the left region of Fig. \ref{fig:Proposition1}, and taking the maximum. This value $\underset{i\in[k]}{\text{max}}(a_{(\pi_{i,1}^*)}+b_{(\pi_{i,2}^*)})$ can be simply rewritten as (\ref{eq:L_11}). Now we want to show that for any $\boldsymbol{\pi}^*\in\Pi^*$, (\ref{eq:L_11}) cannot be smaller than $\underset{i\in[k]}{\text{max}}(a_{(k-i+1)}+b_{(i)})$, which is the lower bound illustrated in Fig. \ref{fig:Proposition1}.
Define $L$ as
\begin{equation}
L=\underset{i\in[k]}{\text{max}}(a_{(k-i+1)}+b_{(i)})=a_{(k-j+1)}+b_{(j)}
\end{equation}
for some $j\in[k]$. Suppose there exist $L'$ and an ordering vector $\boldsymbol{\pi}'=[\pi_1', ...,\pi_n']\in\Pi^*$ such that
\begin{equation}\label{eq:contr1}
\underset{i\in[k]}{\text{max}}(a_{(\pi_i')}+b_{(i)})=L'<L.
\end{equation}
We will show that the assumption of (\ref{eq:contr1}) is a contradiction, which completes the proof. By (\ref{eq:contr1}), $a_{(\pi_{j'}')}+b_{(j')}<a_{(k-j+1)}+b_{(j)}$ should be satisfied for all $j'\in[k]$. This implies $\pi_{j'}'<k-j+1$ for all $j'\in [k]\setminus[j-1]$, which is a contradiction since one-to-one mapping between $j'$ and $\pi_{j'}'$ cannot be constructed for $j'\in[k]$.
\end{IEEEproof}
\begin{figure}[t]
\centering
\includegraphics[width=0.46\textwidth, trim=-0.5cm 0 0 0]{Proposition1-eps-converted-to.pdf}
\caption{Illustration of Proposition 1.}\label{fig:Proposition1}
\end{figure}
Since $\text{Pr}[X_i\leq t]=1-e^{-\mu_1t}$ and $\text{Pr}[S_i\leq t]=1-e^{-(1-\epsilon)\mu_2t}$ for $k=m$, we have
\begin{equation}\label{eq:expected_xi}
\mathbb{E}[X_{(i)}]=\frac{H_n-H_{n-i}}{\mu_1}
\end{equation}
\begin{equation}\label{eq:expected_si}
\mathbb{E}[S_{(i)}]=\frac{H_n-H_{n-i}}{(1-\epsilon)\mu_2}.
\end{equation}
for all $i\in[n]$. Then, the lower bound is derived as
\begin{align*}
\mathbb{E}[T]&=\mathbb{E}[\underset{i\in[n]}{k^{\text{th}}\text{min}}(X_i+S_i)]\\
&\underset{(a)}{\geq} \mathbb{E}[\underset{i\in[k]}{\text{max}}(X_{(k-i+1)}+S_{(i)})]\\
&\underset{(b)}{\geq} \underset{i\in[k]}{\text{max}}(\frac{H_n-H_{n-k+i-1}}{\mu_1}+\frac{H_n-H_{n-i}}{(1-\epsilon)\mu_2})\\
&\underset{(c)}{=}\begin{dcases}
\frac{H_n-H_{n-1}}{\mu_1}+\frac{H_n-H_{n-k}}{(1-\epsilon)\mu_2}, \ \ \epsilon\geq 1-\frac{\mu_1}{\mu_2} \\
\frac{H_n-H_{n-k}}{\mu_1}+\frac{H_n-H_{n-1}}{(1-\epsilon)\mu_2}, \ \ otherwise
\end{dcases}
\end{align*}
where $(a)$ holds from Proposition 1 and $(b)$ holds from the Jensen's inequality. Now we prove $(c)$. Let
\begin{equation}
f_{L}=\frac{H_n-H_{n-k+i-1}}{\mu_1}+\frac{H_n-H_{n-i}}{(1-\epsilon)\mu_2}.
\end{equation}
Assuming $n$ is large and $k$ is linear in $n$, we can approximate $H_n\simeq\text{log}(n)$, $H_{n-k}\simeq\text{log}(n-k)$, and $H_{n-k+i-1}\simeq\text{log}(n-k+i-1)$. Then,
\begin{equation}
\frac{\partial^2 f_{L}}{\partial i^2}=\frac{1}{(n-k+i-1)^2\mu_1}+\frac{1}{(1-\epsilon)(n-i)^2\mu_2}>0
\end{equation}
which implies $f_{L}$ is a convex function of $i$. Since $i\in[k]$, the integer $i$ maximizing $f_{L}$ is either $i=1$ or $i=k$. Thus, $(c)$ is satisfied which completes the proof.
\subsection{Upper bound}
For the upper bound, we use the following proposition which is illustrated in Fig. \ref{fig:Proposition2}.
\begin{proposition}
For any two sequences $\{a_i\}_{i\in[n]}$, $\{b_i\}_{i\in[n]}$,
\begin{equation}
\underset{i\in[n]}{k^{\text{th}}\text{min}}(a_i+b_i)\leq\underset{i\in[n]\setminus[k-1]}{\text{min}}(a_{(n+k-i)}+b_{(i)}).
\end{equation}
\end{proposition}
\begin{IEEEproof}
We use the similar idea as the proof of Proposition 1. Consider a set of ordering vectors $\Pi$ defined in (\ref{eq:ordervector}). Note that the $k^{\text{th}}$ smallest value out of $n$ can be always rewritten as the minimum of $n-k+1$ largest values. We define $\boldsymbol{\pi}=[\pi_{1}, ...,\pi_{n}]\in\Pi$ to make the set of values $\{a_{\pi_i}+b_{\pi_i}\}_{i=k}^{n}$ be the $n-k+1$ largest among $\{a_i+b_i\}_{i=1}^{n}$. In addition, define $\boldsymbol{\pi}_1,\boldsymbol{\pi}_2\in\Pi$ to make $a_{\pi_i}=a_{(\pi_{i,1})}$ and $b_{\pi_i}=b_{(\pi_{i,1})}$ be satisfied $\forall i\in[n]\setminus[k-1]$, where $\boldsymbol{\pi}_1=[\pi_{1,1}, ...,\pi_{n,1}]$, $\boldsymbol{\pi}_2=[\pi_{1,2}, ...,\pi_{n,2}]$. Then, $\underset{i\in[n]}{k^{\text{th}}\text{min}}(a_i+b_i)$ can be rewritten as
\begin{figure}[t]
\centering
\includegraphics[width=0.46\textwidth, trim=-0.5cm 0 0 0]{Proposition2-eps-converted-to.pdf}
\caption{Illustration of Proposition 2.}\label{fig:Proposition2}
\end{figure}
\begin{align}
\underset{i\in[n]}{k^{\text{th}}\text{min}}(a_i+b_i)&= \underset{i\in[n]\setminus[k-1]}{\text{min}}(a_{\pi_i}+b_{\pi_i}) \label{eq:kthmin_U1}\\
&= \underset{i\in[n]\setminus[k-1]}{\text{min}}(a_{(\pi_{i,1})}+b_{(\pi_{i,2})}). \label{eq:kthmin_U2}
\end{align}
Now define another set of ordering vectors $\Pi^*\subseteq\Pi$ as $\Pi^*=\{\boldsymbol{\pi}\in\Pi:\pi_i\in[n]\setminus[k-1] \ \forall i\in[n]\setminus[k-1]\}$. Then we can always construct $\boldsymbol{\pi}_1^*, \boldsymbol{\pi}_2^*\in \Pi^*$ such that $\pi_{i,1}\leq\pi_{i,1}^*$, $\pi_{i,2}\leq\pi_{i,2}^*$ for all $i\in [n]\setminus[k-1]$, which can be proved easily. Then by adequately selecting $\boldsymbol{\pi}^*\in \Pi^*$, (\ref{eq:kthmin_U2}) is upper bounded a
\begin{align}
\underset{i\in[n]\setminus[k-1]}{\text{min}}(a_{(\pi_{i,1})}+b_{(\pi_{i,2})})&\leq\underset{i\in[n]\setminus[k-1]}{\text{min}}(a_{(\pi_{i,1}^*)}+b_{(\pi_{i,2}^*)})\label{eq:U_inequal}\\
&=\underset{i\in[n]\setminus[k-1]}{\text{min}}(a_{(\pi_i^*)}+b_{(i)})\label{eq:U_11}
\end{align}
Equation (\ref{eq:U_inequal}) implies that the upper bound of $\underset{i\in[n]\setminus[k-1]}{\text{min}}(a_{(\pi_{i,1})}+b_{(\pi_{i,2})})$ can be obtained by properly selecting the $n-k+1$ pairs $\{a_{(\pi_{i,1}^*)}+b_{(\pi_{i,2}^*)}\}_{i=k}^{n}$ all in the right region of Fig. \ref{fig:Proposition2}, and taking the minimum. This value $\underset{i\in[n]\setminus[k-1]}{\text{min}}(a_{(\pi_{i,1}^*)}+b_{(\pi_{i,2}^*)})$ can be simply rewritten as (\ref{eq:U_11}). Now we want to show that for any $\boldsymbol{\pi}^*\in\Pi^*$, (\ref{eq:U_11}) cannot be larger than $\underset{i\in[n]\setminus[k-1]}{\text{min}}(a_{(n+k-i)}+b_{(i)})$, which is the upper bound illustrated in Fig. \ref{fig:Proposition2}.
Define $U$ as
\begin{equation}
U=\underset{i\in[n]\setminus[k-1]}{\text{min}}(a_{(n+k-i)}+b_{(i)})=a_{(n+k-j)}+b_{(j)}
\end{equation}
for some $j\in[n]\setminus[k-1]$. Suppose there exist $U'$ and an ordering vector $\boldsymbol{\pi'}=[\pi_1', ...,\pi_n']\in\Pi^*$ such that
\begin{equation}\label{eq:contr2}
\underset{i\in[n]\setminus[k-1]}{\text{min}}(a_{(\pi_i')}+b_{(i)})=U'>U.
\end{equation}
We show that the assumption of (\ref{eq:contr2}) is a contradiction. By (\ref{eq:contr2}), $a_{(\pi_{j'}')}+b_{(j')}>a_{(n+k-j)}+b_{(j)}$ should be satisfied for all $j'\in[n]\setminus[k-1]$. This implies $\pi_{j'}'>n+k-j$ for all $j'\in [j]\setminus[k-1]$, which is a contradiction since one-to-one mapping between $j'$ and $\pi_{j'}'$ cannot be constructed for $j'\in[n]\setminus[k-1]$.
\end{IEEEproof}
Now from (\ref{eq:expected_xi}) and (\ref{eq:expected_si}), the upper bound is derived as
\begin{align}
\mathbb{E}[T]&=\mathbb{E}[\underset{i\in[n]}{k^{\text{th}}\text{min}}(X_i+S_i)]\\
&\underset{(d)}{\leq}\mathbb{E}[\underset{i\in[n]\setminus[k-1]}{\text{min}}(X_{(n+k-i)}+S_{(i)})]\\
&\underset{(e)}{\leq}\underset{i\in[n]\setminus[k-1]}{\text{min}}(\frac{H_n-H_{i-k}}{\mu_1}+\frac{H_n-H_{n-i}}{(1-\epsilon)\mu_2})
\end{align}
where $(d)$ holds from Proposition 2 and $(e)$ holds from the Jensen's inequality.
\section{Proof of Theorem 3}
Since $\text{Pr}[X_i\leq t]=1-e^{-\frac{k}{m}\mu_1t}$ for general $k$, we have
\begin{equation}
\mathbb{E}[X_{(i)}]=\frac{m(H_n-H_{n-i})}{k\mu_1}
\end{equation}
for all $i\in[n]$. For communication time $S_i$, we can first see from Lemma 1 that random variable $\sum_{j=1}^{N_r}Y_{j,r}$ follows exponential distribution with rate $(1-\epsilon)\mu_2$ for all $r\in[\frac{m}{k}]$. Therefore, $S_i=\sum_{r=1}^{\frac{m}{k}}\sum_{j=1}^{N_r}Y_{j,r}$ which is the sum of $\frac{m}{k}$ independent exponential random variables with rate $(1-\epsilon)\mu_2$, follows erlang distribution with shape parameter $\frac{m}{k}$ and rate parameter $(1-\epsilon)\mu_2$:
\begin{equation}
\text{Pr}[S_i\leq t]=1-\sum_{p=0}^{\frac{m}{k}-1}\frac{1}{p!}e^{-(1-\epsilon)\mu_2t}[(1-\epsilon)\mu_2t]^p.
\end{equation}
By the property of erlang distribution, $S_i$ can be rewritten as
\begin{equation}
S_i=\frac{G_i}{(1-\epsilon)\mu_2}
\end{equation}
where $G_i$ is an erlang random variable with shape parameter $\frac{m}{k}$ and rate parameter $1$. We take this approach since closed-form expression of $\mathbb{E}[G_{(i)}]$ exists as (\ref{eq:erlangmean}). Now the lower bound is derived as
\begin{align*}
\mathbb{E}[T]&=\mathbb{E}[\underset{i\in[n]}{k^{\text{th}}\text{min}}(X_i+S_i)]\\
&\underset{(a)}{\geq} \mathbb{E}[\underset{i\in[k]}{\text{max}}(X_{(k-i+1)}+S_{(i)})]\\
&\underset{(b)}{\geq} \underset{i\in[k]}{\text{max}}\Big(\frac{m(H_n-H_{n-k+i-1})}{k\mu_1}+\frac{\mathbb{E}[G_{(i)}]}{(1-\epsilon)\mu_2}\Big)\\
\end{align*}
where $(a)$ holds from Proposition 1 and $(b)$ holds from the Jensen's inequality. For the upper bound, we write
\begin{align}
\mathbb{E}[T]&=\mathbb{E}[\underset{i\in[n]}{k^{\text{th}}\text{min}}(X_i+S_i)]\\
&\underset{(d)}{\leq}\mathbb{E}[\underset{i\in[n]\setminus[k-1]}{\text{min}}(X_{(n+k-i)}+S_{(i)})]\\
&\underset{(e)}{\leq}\underset{i\in[n]\setminus[k-1]}{\text{min}}\Big(\frac{m(H_n-H_{i-k})}{k\mu_1}+\frac{\mathbb{E}[G_{(i)}]}{(1-\epsilon)\mu_2}\Big)
\end{align}
where $(d)$ holds from Proposition 2 and $(e)$ holds from the Jensen's inequality.
\ifCLASSOPTIONcaptionsoff
\newpage
\fi
| {'timestamp': '2019-01-14T02:18:03', 'yymm': '1901', 'arxiv_id': '1901.03610', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03610'} | arxiv |
\section*{Appendix}
\setcounter{theorem}{0}
\setcounter{lemma}{0}
\setcounter{proposition}{0}
\setcounter{corollary}{0}
\section{Proofs}
\label{app_proofs}
\subsection{Proofs for Forward Pass}
\begin{lemma}
Let $\mathbf{v} = ReLU\left(\mathbf{R} \mathbf{u}\right)$, where $\mathbf{u} \in \mathbb{R}^n$ and $\mathbf{R} \in \mathbb{R}^{m \times n}$. If $\mathbf{R}_{ij} \stackrel{i.i.d.}{\sim} \mathcal{N}(0,\frac{2}{m})$, then for any fixed vector $\mathbf{u}$, $\mathbb{E}[\lVert \mathbf{v} \rVert^2] = \lVert \mathbf{u} \rVert^2$.
\textbf{Proof}: Define ${a}_i = \mathbf{R}_i^{T} \mathbf{u}$, where $\mathbf{R}_i$ denotes the $i^{th}$ row of $\mathbf{R}$. Since each element $\mathbf{R}_{ij}$ is an independent sample from Gaussian distribution, each ${a}_i$ is essentially a weighted sum of these independent random variables. Thus, each ${a}_i \sim \mathcal{N}\left(0, \frac{2}{m}\lVert \mathbf{u} \rVert^2 \right)$ and independent from one another. Thus each element ${v}_i = ReLU(a_i) \sim \mathcal{N}^R\left(0, \frac{2}{m}\lVert \mathbf{u} \rVert^2 \right)$ where $\mathcal{N}^R$ denotes the rectified Normal distribution.
Our goal is to compute,
\begin{align}
\mathbb{E}[\lVert \mathbf{v} \rVert^2] &= \mathbb{E}[\sum_{i=1}^m v_i^2]\\
&= m \mathbb{E} [v_i^2]
\end{align}
From the definition of $v_i$,
\begin{align}
\mathbb{E}[v_i] &= \frac{1}{2}\cdot 0 + \frac{1}{2} \mathbb{E}[Z]
\end{align}
where $Z$ follows a half-Normal distribution corresponding to the Normal distribution $\mathcal{N}\left(0, \frac{2}{m}\lVert \mathbf{u} \rVert^2 \right)$. Thus $\mathbb{E}[Z] = \sqrt{\frac{2\lVert \mathbf{u} \rVert^2}{m}} \cdot \sqrt{\frac{2}{\pi}} = 2 \sqrt{\frac{\lVert \mathbf{u} \rVert^2}{m \pi}}$. Similarly,
\begin{align}
\mathbb{E}[v_i^2] &= 0.5\mathbb{E}[Z^2]\\
&= 0.5(var(Z) + \mathbb{E}[Z]^2)
\end{align}
Since $var(Z) = \frac{2}{m}\lVert \mathbf{u} \rVert^2 (1-\frac{2}{\pi})$, we get,
\begin{align}
\mathbb{E}[v_i^2] &= 0.5 \left(\frac{2}{m}\lVert \mathbf{u} \rVert^2 (1-\frac{2}{\pi}) + (2 \sqrt{\frac{\lVert \mathbf{u} \rVert^2}{m \pi}})^2 \right)\\
&= \frac{\lVert \mathbf{u} \rVert^2}{m}
\end{align}
Thus,
\begin{align}
m \mathbb{E} [v_i^2] = \lVert \mathbf{u} \rVert^2
\end{align}
which proves the claim. $\square$
\end{lemma}
\begin{lemma}
Let $\mathbf{v} = ReLU\left(\mathbf{R} \mathbf{u}\right)$, where $\mathbf{u} \in \mathbb{R}^n$, $\mathbf{R} \in \mathbb{R}^{m \times n}$. If $\mathbf{R}_{ij} \stackrel{i.i.d.}{\sim} \mathcal{N}(0,\frac{2}{m})$, and $\epsilon \in [0,1)$, then for any fixed vector $\mathbf{u}$,
\begin{align}
\Pr\left(|\lVert \mathbf{v}\rVert^{2} - \lVert \mathbf{u}\rVert^{2} | \leq \epsilon \lVert \mathbf{u}\rVert^{2} \right)
\geq 1 - 2\exp \left(-m \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
\textbf{Proof}: Define $\tilde{\mathbf{v}} = \frac{\sqrt{0.5m}}{\lVert \mathbf{u} \rVert} \mathbf{v}$. Then we have that each element $\tilde{{v}}_i \sim \mathcal{N}^R\left(0, 1 \right)$ and independent from one another since ${v}_i = ReLU(a_i) \sim \mathcal{N}^R\left(0, \frac{2}{m}\lVert \mathbf{u} \rVert^2 \right)$ where $\mathcal{N}^R$ denotes the rectified Normal distribution. Thus to bound the probability of failure for the R.H.S.,
\begin{align}
\Pr\left(\lVert \mathbf{v}\rVert^{2}\geq(1+\epsilon)\lVert \mathbf{u}\rVert^{2}\right) &= \Pr\left(\frac{\lVert \mathbf{u}\rVert^2}{0.5m} \lVert \tilde{\mathbf{v}}\rVert^{2}\geq(1+\epsilon)\lVert \mathbf{u}\rVert^{2}\right)\\
&= \Pr\left( \lVert \tilde{\mathbf{v}}\rVert^{2}\geq 0.5m (1+\epsilon)\right)
\end{align}
Using Chernoff's bound, we get for any $\lambda>0$,
\begin{align}
\Pr\left( \lVert \tilde{\mathbf{v}}\rVert^{2}\geq 0.5m (1+\epsilon)\right) &= \Pr\left( \exp(\lambda \lVert \tilde{\mathbf{v}}\rVert^{2})\geq \exp(\lambda 0.5m (1+\epsilon))\right)\\
&\leq \frac{\mathbb{E}[\exp(\lambda \lVert\tilde{\mathbf{v}}\rVert^{2})]}{\exp(0.5m \lambda (1+\epsilon))}\\
&= \frac{\mathbb{E}[\exp(\sum_{i=1}^m \lambda \tilde{{v}_i}^{2})]}{\exp(0.5m \lambda (1+\epsilon))}\\
&= \frac{ \Pi_{i=1}^m\mathbb{E}[\exp( \lambda \tilde{{v}_i}^{2})]}{\exp(0.5m \lambda (1+\epsilon))}\\
&= \left(\frac{ \mathbb{E}[\exp( \lambda \tilde{{v}_i}^{2})]}{\exp(0.5 \lambda (1+\epsilon))}\right)^m
\end{align}
Denote $p(\tilde{{v}_i})$ as the probability distribution of the rectified Normal random variable $\tilde{{v}_i}$. Then,
\begin{align}
\mathbb{E}[\exp( \lambda \tilde{{v}_i}^{2})] &= \int_{ -\infty}^\infty \exp( \lambda \tilde{{v}_i}^{2}) p(\tilde{{v}_i})
\end{align}
We know that the mass at $v_i=0$ is 0.5 and the density between $v_i=0$ and $v_i=\infty$ follows the Normal distribution. Thus,
\begin{align}
\mathbb{E}[\exp( \lambda \tilde{{v}_i}^{2})] &= 0.5\exp(0) + \frac{1}{\sqrt{2\pi}}\int_{0}^\infty \exp( \lambda \tilde{{v}_i}^{2} - \tilde{{v}_i}^{2}/2)\\
&= 0.5 + \frac{1}{2\sqrt{(1-2\lambda)}}\frac{\sqrt{2}}{\sqrt{\pi/(1-2\lambda)}}\int_{0}^\infty \exp( -\frac{\tilde{{v}_i}^{2}}{2}(1- 2\lambda))
\end{align}
Note that $\int_0^\infty \frac{\sqrt{2}}{\sqrt{\pi/(1-2\lambda)}}\int_{0}^\infty \exp( -\frac{\tilde{{v}_i}^{2}}{2}(1- 2\lambda))$ is the integral of a half Normal distribution corresponding to the Normal distribution $\mathcal{N}(0, 1/(1-2\lambda))$. Thus,
\begin{align}
\mathbb{E}[\exp( \lambda \tilde{{v}_i}^{2})] &= 0.5 + \frac{1}{2\sqrt{(1-2\lambda)}}
\end{align}
Hence, we get,
\begin{align}
\label{eq_fwd_lemma_lambda_ineq_rhs}
\Pr\left( \lVert \tilde{\mathbf{v}}\rVert^{2}\geq 0.5m (1+\epsilon)\right) \leq \left(0.5\left( 1 + \frac{1}{\sqrt{(1-2\lambda)}}\right)\exp(-0.5 \lambda (1+\epsilon))\right)^m
\end{align}
The above failure probability can be bounded to be smaller by finding an appropriate value of $\lambda$. We find that $\lambda \approx \frac{0.5\epsilon}{1+\epsilon}$ approximately minimizes the above bound.
Substituting this value of $\lambda$ above, we get,
\begin{align}
\Pr\left( \lVert \tilde{\mathbf{v}}\rVert^{2} \geq 0.5m (1+\epsilon)\right) &\leq \left(0.5\left( 1 + \sqrt{1+\epsilon} \right)\exp(-\frac{\epsilon}{4})\right)^m\\
&= \exp \left(-m \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
Thus,
\begin{align}
\label{eq_rectified_jl_ub}
\Pr\left(\lVert \mathbf{v}\rVert^{2}\leq(1+\epsilon)\lVert \mathbf{u}\rVert^{2}\right) \geq 1 - \exp \left(-m \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
Similarly, to prove the L.H.S. by bounding the probability of failure from the other side,
\begin{align}
\Pr\left(\lVert \mathbf{v}\rVert^{2}\leq(1-\epsilon)\lVert \mathbf{u}\rVert^{2}\right) &=
\Pr\left(-\lVert \mathbf{v}\rVert^{2}\geq -(1-\epsilon)\lVert \mathbf{u}\rVert^{2}\right)\\
&= \Pr\left(-\frac{\lVert \mathbf{u}\rVert^2}{0.5m} \lVert \tilde{\mathbf{v}}\rVert^{2}\geq - (1-\epsilon)\lVert \mathbf{u}\rVert^{2}\right)\\
&= \Pr\left( -\lVert \tilde{\mathbf{v}}\rVert^{2}\geq - 0.5m (1-\epsilon)\right)
\end{align}
Using Chernoff's bound, we get for any $\lambda>0$,
\begin{align}
\Pr\left( -\lVert \tilde{\mathbf{v}}\rVert^{2}\geq -0.5m (1-\epsilon)\right) &= \Pr\left( \exp(-\lambda \lVert \tilde{\mathbf{v}}\rVert^{2})\geq \exp(-\lambda 0.5m (1-\epsilon))\right)\\
&\leq \frac{\mathbb{E}[\exp(-\lambda \lVert\tilde{\mathbf{v}}\rVert^{2})]}{\exp(-0.5m \lambda (1-\epsilon))}\\
&= \frac{\mathbb{E}[\exp(-\sum_{i=1}^m \lambda \tilde{{v}_i}^{2})]}{\exp(-0.5m \lambda (1-\epsilon))}\\
&= \frac{ \Pi_{i=1}^m\mathbb{E}[\exp( -\lambda \tilde{{v}_i}^{2})]}{\exp(-0.5m \lambda (1-\epsilon))}\\
&= \left(\frac{ \mathbb{E}[\exp(- \lambda \tilde{{v}_i}^{2})]}{\exp(-0.5 \lambda (1-\epsilon))}\right)^m
\end{align}
Performing computations similar to those above to compute the expectation term, we get,
\begin{align}
\mathbb{E}[\exp( -\lambda \tilde{{v}_i}^{2})] &= 0.5 + \frac{1}{2\sqrt{(1+2\lambda)}}
\end{align}
Hence, we get,
\begin{align}
\Pr\left( \lVert \tilde{\mathbf{v}}\rVert^{2}\leq 0.5m (1-\epsilon)\right) \leq \left(0.5\left( 1 + \frac{1}{\sqrt{(1+2\lambda)}}\right)\exp(0.5 \lambda (1-\epsilon))\right)^m
\end{align}
Similar to the R.H.S. case, we find that $\lambda \approx \frac{0.5\epsilon}{1-\epsilon}$ approximately minimizes the failure probability,
\begin{align}
\Pr\left( \lVert \tilde{\mathbf{v}}\rVert^{2}\leq 0.5m (1-\epsilon)\right) &\leq \left(0.5\left( 1 + \sqrt{1-\epsilon} \right)\exp(\frac{\epsilon}{4})\right)^m\\
&= \exp \left(m \left( \frac{\epsilon}{4} - \log \frac{2}{1 + \sqrt{1-\epsilon}} \right)\right)
\end{align}
It can be shown that,
\begin{align}
\exp \left(m \left( \frac{\epsilon}{4} - \log \frac{2}{1 + \sqrt{1-\epsilon}} \right)\right) \leq \exp \left(-m \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
Thus,
\begin{align}
\label{eq_rectified_jl_lb}
\Pr\left(\lVert \mathbf{v}\rVert^{2}\geq(1-\epsilon)\lVert \mathbf{u}\rVert^{2}\right) \geq 1 - \exp \left(-m \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
Using union bound, Eq. (\ref{eq_rectified_jl_ub}) and (\ref{eq_rectified_jl_lb}) hold together with probability,
\begin{align}
\Pr\left((1-\epsilon)\lVert \mathbf{u}\rVert^{2} \leq \lVert \mathbf{v}\rVert^{2} \leq (1+\epsilon)\lVert \mathbf{u}\rVert^{2} \right) \geq 1 - 2\exp \left(-m \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
This proves the claim. $\square$
\end{lemma}
\begin{theorem}
Let $\mathcal{D}$ be a fixed dataset with $N$ samples and define a $L$ layer ReLU network as shown in Eq. \ref{eq_relu_layer} such that each weight matrix $\mathbf{W}^l \in \mathbb{R}^{n_l \times n_{l-1}}$ has its elements sampled as ${W}^l_{ij} \stackrel{i.i.d.}{\sim} \mathcal{N}(0,\frac{2}{n_l})$ and biases $\mathbf{b}^l$ are set to zeros. Then for any sample $(\mathbf{x}, \mathbf{y}) \in \mathcal{D}$ and $\epsilon \in [0,1)$, we have that,
\begin{align}
\Pr\left((1-\epsilon)^L\lVert \mathbf{x}\rVert^{2} \leq \lVert f_\theta(\mathbf{x})\rVert^{2} \leq (1+\epsilon)^L\lVert \mathbf{x}\rVert^{2} \right) \geq 1 - \sum_{l^\prime=1}^{L} 2N\exp \left(-n_{l^{\prime}} \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
\textbf{Proof}: When feed-forwarding a fixed input through the layers of a deep ReLU network, each hidden layer's activation corresponding to the given input is also fixed because the network is deterministic. Thus applying lemma \ref{lemma_1layer_length_preservation}, on each layer's transformation, the following holds true for each ${l} \in \{ 1,2, \cdots L \}$,
\begin{align}
\Pr\left((1-\epsilon) \lVert \mathbf{h}^{{l}-1}\rVert^{2} \leq \lVert \mathbf{h}^{l}\rVert^{2} \leq (1+\epsilon)\lVert \mathbf{h}^{l-1}\rVert^{2} \right) \geq 1 - 2\exp \left(-n_{l} \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
Thus, using union bound, we have the lengths of all the layers until layer $l$ are simultaneously preserved with probability at least,
\begin{align}
1 - \sum_{l^\prime=1}^{l} 2\exp \left(-n_{l^{\prime}} \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
Applying union bound again, all the lengths until layer $l$ are preserved simultaneously for $N$ inputs with probability,
\begin{align}
1 - \sum_{l^\prime=1}^{l} 2N\exp \left(-n_{l^{\prime}} \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
Finally, we note that the following hold true with the above probability,
\begin{align}
(1-\epsilon) \lVert \mathbf{x}\rVert^{2} \leq \lVert \mathbf{h}^{1}\rVert^{2} \leq (1+\epsilon)\lVert \mathbf{x}\rVert^{2}\\
(1-\epsilon) \lVert \mathbf{h}^{1}\rVert^{2} \leq \lVert \mathbf{h}^{2}\rVert^{2} \leq (1+\epsilon)\lVert \mathbf{h}^{1}\rVert^{2}
\end{align}
Substituting $\lVert \mathbf{h}^{1}\rVert^{2} \leq (1+\epsilon)\lVert \mathbf{x}\rVert^{2}$ in the R.H.S. of the last equation, and $(1-\epsilon) \lVert \mathbf{x}\rVert^{2} \leq \lVert \mathbf{h}^{1}\rVert^{2}$ in the L.H.S. of the last equation, we get,
\begin{align}
(1-\epsilon)^2 \lVert \mathbf{x}\rVert^{2} \leq \lVert \mathbf{h}^{2}\rVert^{2} \leq (1+\epsilon)^2\lVert \mathbf{x}\rVert^{2}
\end{align}
Performing substitutions for higher layers similarly yields the claim. $\square$
\end{theorem}
\begin{lemma}
Let $\mathcal{X}$ be a $d\leq n$ dimensional subspace of $\mathbb{R}^n$ and $\mathbf{R} \in \mathbb{R}^{m \times n}$. If $\mathbf{R}_{ij} \stackrel{i.i.d.}{\sim} \mathcal{N}(0,\frac{2}{m})$, $\epsilon \in [0,1)$, and,
\begin{align}
m \geq \frac{1}{\epsilon/12 - \log (0.5(1 + \sqrt{1+\epsilon/3})) } \cdot \left( d\log \frac{2}{\Delta} + \log \frac{4}{\delta} \right)
\end{align}
then for all vectors $\mathbf{u} \in \mathcal{X}$, with probability at least $1-\delta$,
\begin{align}
\Bigl\lvert \lVert ReLU(\mathbf{R{u}}) \rVert - \lVert \mathbf{{u}} \rVert \Bigr\rvert \leq \epsilon \lVert \mathbf{u}\rVert
\end{align}
where $\Delta := \min\{ \frac{\epsilon}{3\sqrt{d}}, \frac{\sqrt{\epsilon}}{\sqrt{3}d} \}$.
\textbf{Proof}: The core idea behind the proof is inspired by lemma 10 of \cite{sarlos2006improved}. Without any loss of generality, we will show the norm preserving property for any unit vector $\mathbf{u}$ in the $d$ dimensional subspace $\mathcal{X}$ of $\mathbb{R}^n$. This is because for any arbitrary length vector $\mathbf{u}$, $\lVert ReLU(\mathbf{Ru}) \rVert = \lVert \mathbf{u} \rVert \cdot \lVert ReLU(\mathbf{R\hat{u}}) \rVert$. The idea then is to define a grid of finite points over $\mathcal{X}$ such that every unit vector $\mathbf{\hat{u}}$ in $\mathcal{X}$ is close enough to one of the grid points. Then, if we choose the width of the layer to be large enough to approximately preserve the length of the finite number of grid points, we essentially guarantee that the length of any arbitrary vector approximately remains preserved.
To this end, we define a grid $G$ on $[-1,1]^d$ with interval of size $\Delta := \min \{\epsilon/\sqrt{d}, \sqrt\epsilon/d\}$. Note the number of points on this grid is $\left( \frac{2}{\Delta}\right)^d$. Also, let column vectors of $\mathbf{B} \in \mathbb{R}^{n \times d}$ be the orthonormal basis of $\mathcal{X}$.
We now prove the R.H.S. of the bound in the claim. If we consider any unit vector $\hat{\mathbf{u}}$ in $\mathcal{X}$, we can find a point $\mathbf{g}$ on the grid $G$ such that $\lVert \mathbf{g} \rVert \leq 1$, and it is closest to $\hat{\mathbf{u}}$ in $\ell^2$ norm, and define $\mathbf{r}^\prime := \hat{\mathbf{u}} - \mathbf{g}$.
Thus the vector $\hat{\mathbf{u}}$ can essentially be decomposed as,
\begin{align}
\hat{\mathbf{u}} = \mathbf{g} + \mathbf{r}^\prime
\end{align}
Also note that since $\mathbf{r}^\prime$ lies in the span of $\mathcal{X}$, we can represent $\mathbf{r}^\prime:= \mathbf{Br}$ for some vector $\mathbf{r}$.
Now consider the norm of the vector $\hat{\mathbf{u}}$ after the ReLU transformation give by $\lVert ReLU(\mathbf{R\hat{u}}) \rVert$. Then we have,
\begin{align}
\lVert ReLU(\mathbf{R\hat{u}}) \rVert &= \lVert ReLU(\mathbf{R}(\mathbf{g} + \mathbf{r}^\prime)) \rVert\\
&\leq \lVert ReLU(\mathbf{R}\mathbf{g}) + ReLU(\mathbf{R}\mathbf{r}^\prime)) \rVert\\
&\leq \lVert ReLU(\mathbf{R}\mathbf{g}) \rVert + \lVert ReLU(\mathbf{R}\mathbf{r}^\prime)) \rVert\\
&\leq \lVert ReLU(\mathbf{R}\mathbf{g}) \rVert + \lVert \mathbf{R}\mathbf{r}^\prime \rVert
\end{align}
Similarly, we have,
\begin{align}
\lVert ReLU(\mathbf{Rg}) \rVert &= \lVert ReLU(\mathbf{R}(\mathbf{g} + \hat{\mathbf{u}} - \hat{\mathbf{u}})) \rVert\\
&\leq \lVert ReLU(\mathbf{R}\hat{\mathbf{u}}) + ReLU(\mathbf{R}(\mathbf{g} - \hat{\mathbf{u}}))) \rVert\\
&\leq \lVert ReLU(\mathbf{R}\hat{\mathbf{u}}) \rVert + \lVert ReLU(-\mathbf{R}\mathbf{r}^\prime)) \rVert\\
&\leq \lVert ReLU(\mathbf{R}\hat{\mathbf{u}}) \rVert + \lVert \mathbf{R}\mathbf{r}^\prime \rVert
\end{align}
Therefore,
\begin{align}
\label{eq_relu_unit_bound_relu_grid}
\lVert ReLU(\mathbf{R}\mathbf{g}) \rVert -\lVert \mathbf{R}\mathbf{r}^\prime \rVert
&\leq \lVert ReLU(\mathbf{R\hat{u}}) \rVert \leq \lVert ReLU(\mathbf{R}\mathbf{g}) \rVert + \lVert \mathbf{R}\mathbf{r}^\prime \rVert
\end{align}
Applying union bound on all the points in $G$, from lemma \ref{lemma_1layer_length_preservation}, we know that with probability at least $1 - \left( \frac{2}{\Delta}\right)^d\exp \left(-m \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)$,
\begin{align}
\lVert ReLU(\mathbf{R}\mathbf{g})\rVert^{2} &\leq (1+\epsilon)\lVert \mathbf{g}\rVert^{2}\nonumber\\
&\leq 1+\epsilon\\
&\leq (1+\epsilon)^2
\end{align}
This can be substituted in the R.H.S. of Eq. (\ref{eq_relu_unit_bound_relu_grid}). Now we only need to upper bound $\lVert \mathbf{R}\mathbf{r}^\prime \rVert$. To this end, we rewrite $\lVert \mathbf{R}\mathbf{r}^\prime \rVert = \lVert \mathbf{RB}\mathbf{r} \rVert$. Then,
\begin{align}
\lVert \mathbf{RB}\mathbf{r} \rVert^2 &= \sum_{i=1}^d\sum_{j=1}^d <\mathbf{RB}_i r_i, \mathbf{RB}_j r_j>\\
&\leq 2\sum_{i=1}^d\sum_{j=1}^d |r_i| \cdot |r_j| \cdot <\frac{1}{\sqrt{2}}\mathbf{RB}_i , \frac{1}{\sqrt{2}}\mathbf{RB}_j>
\end{align}
Note that $\frac{1}{\sqrt{2}}\mathbf{R}$ is a matrix whose entries are sampled from $\mathcal{N}(0,1)$. Invoking lemma \ref{lem_inner_product} on the $d^2$ terms in the above sum, we have that with probability at least $1-2d^2 \exp\left(-\frac{m}{4}\left(\epsilon^{2}-\epsilon^{3}\right)\right)$,
\begin{align}
2\sum_{i=1}^d\sum_{j=1}^d |r_i| \cdot |r_j| \cdot <\frac{1}{\sqrt{2}}\mathbf{RB}_i , \frac{1}{\sqrt{2}}\mathbf{RB}_j> &\leq 2\sum_{i=1}^d\sum_{j=1}^d |r_i| \cdot |r_j| \cdot (<\mathbf{B}_i , \mathbf{B}_j> + \epsilon)\\
&= 2\sum_{i=1}^d r_i^2 \lVert \mathbf{B}_i \rVert^2 + 2\sum_{i=1}^d\sum_{j=1}^d |r_i| \cdot |r_j| \cdot \epsilon\\
&= 2\lVert \mathbf{r} \rVert^2 + 2\epsilon \lVert \mathbf{r} \rVert_1^2
\end{align}
Since $\mathbf{r}^\prime$, and hence $\mathbf{r}$ is a point inside one of the grid cells containing the origin, its length can be at most the length of the main diagonal of the grid cell. Formally, $\lVert \mathbf{r} \rVert \leq \sqrt{d}\Delta \leq \epsilon$, and $\lVert \mathbf{r} \rVert_1 \leq {d}\Delta \leq \sqrt\epsilon$. Subsituting these inequalities in the above equations, we get,
\begin{align}
\lVert \mathbf{RB}\mathbf{r} \rVert^2 &\leq 4\epsilon^2
\end{align}
Looking back at the R.H.S. of Eq. (\ref{eq_relu_unit_bound_relu_grid}), we have that with probability at least $1 - \left( \frac{2}{\Delta}\right)^d\exp \left(-m \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right) - 2d^2 \exp\left(-\frac{m}{4}\left(\epsilon^{2}-\epsilon^{3}\right)\right)$,
\begin{align}
\lVert ReLU(\mathbf{R\hat{u}}) \rVert &\leq 1 + \epsilon + 2\epsilon\\
&= 1 + 3\epsilon
\end{align}
To prove the L.H.S. of the claimed bound, we can similarly find a point $\mathbf{g}$ on the grid $G$ such that $\lVert \mathbf{g} \rVert \geq 1$, and it is closest to $\hat{\mathbf{u}}$ in $\ell^2$ norm, and define $\mathbf{r}^\prime := \hat{\mathbf{u}} - \mathbf{g}$. Then invoking lemma \ref{lemma_1layer_length_preservation}, we know that with probability at least $1 - \left( \frac{2}{\Delta}\right)^d\exp \left(-m \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)$,
\begin{align}
\lVert ReLU(\mathbf{R}\mathbf{g})\rVert^{2} &\geq (1-\epsilon)\lVert \mathbf{g}\rVert^{2}\nonumber\\
&\geq 1-\epsilon\\
&\geq (1-\epsilon)^2
\end{align}
This can be substituted in the L.H.S. of Eq. (\ref{eq_relu_unit_bound_relu_grid}). We then substitute the previously computed upper bound of $\lVert \mathbf{RB}\mathbf{r} \rVert^2$ once again and have that with probability at least $1 - 2\left( \frac{2}{\Delta}\right)^d\exp \left(-m \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right) - 2d^2 \exp\left(-\frac{m}{4}\left(\epsilon^{2}-\epsilon^{3}\right)\right)$,
\begin{align}
1 - 3\epsilon \leq \lVert ReLU(\mathbf{R\hat{u}}) \rVert \leq 1 + 3\epsilon
\end{align}
Scaling $\mathbf{\hat{u}}$ arbitrarily, we equivalently have,
\begin{align}
\label{eq_relu_fwd_ineq_inifinite}
(1 - 3\epsilon)\lVert \mathbf{{u}} \rVert \leq \lVert ReLU(\mathbf{R{u}}) \rVert \leq (1 + 3\epsilon)\lVert \mathbf{{u}} \rVert
\end{align}
Finally, since,
\begin{align}
\left( \frac{2}{\Delta}\right)^d\exp \left(-m \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right) \geq d^2 \exp\left(-\frac{m}{4}\left(\epsilon^{2}-\epsilon^{3}\right)\right)
\end{align}
We can further lower bound the success probability of Eq. (\ref{eq_relu_fwd_ineq_inifinite}) for mathematical ease as,
\begin{align}
1 - 4\left( \frac{2}{\Delta}\right)^d\exp \left(-m \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
Therefore to guarantee a success probability of at least $1-\delta$, we bound,
\begin{align}
1 - 4\left( \frac{2}{\Delta}\right)^d\exp \left(-m \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right) \geq 1-\delta
\end{align}
Rearranging the terms in the equality to get a lower bound on $m$ and rescaling $\epsilon$ proves the claim. $\square$
\end{lemma}
\subsection{Proofs for Backward Pass}
\begin{proposition}
If network weights are sampled i.i.d. from a Gaussian distribution with mean 0 and biases are 0 at initialization, then conditioned on $\mathbf{h}^{l-1}$, each dimension of $ \mathbbm{1}(\mathbf{a}^l)$ follows an i.i.d. Bernoulli distribution with probability 0.5 at initialization.
\textbf{Proof}: Note that $\mathbf{a}^l := \mathbf{W}^l \mathbf{h}^{l-1}$ at initialization (biases are 0) and $\mathbf{W}^l$ are sampled i.i.d. from a random distribution with mean 0. Therefore, each dimension $\mathbf{a}^l_i$ is simply a weighted sum of i.i.d. zero mean Gaussian, which is also a 0 mean Gaussian random variable.
To prove the claim, note that the indicator operator applied on a random variable with 0 mean and symmetric distribution will have equal probability mass on both sides of 0, which is the same as a Bernoulli distributed random variable with probability 0.5. Finally, each dimension of $\mathbf{a}^l$ is i.i.d. simply because all the elements of $\mathbf{W}^l$ are sampled i.i.d., and hence each dimension of $\mathbf{a}^l$ is a weighted sum of a different set of i.i.d. random variables. $\square$
\end{proposition}
\begin{lemma}
Let $\mathbf{v} = \left(\mathbf{R} \mathbf{u}\right) \odot \mathbf{z}$, where $\mathbf{u} \in \mathbb{R}^n$, $\mathbf{R} \in \mathbb{R}^{m \times n}$ and $\mathbf{z} \in \mathbb{R}^m$. If $\mathbf{R}_{ij} \stackrel{i.i.d.}{\sim} \mathcal{N}(0,\frac{1}{pm})$ and $\mathbf{z}_{i} \stackrel{i.i.d.}{\sim} \text{Bernoulli}(p)$, then for any fixed vector $\mathbf{u}$, $\mathbb{E}[\lVert \mathbf{v} \rVert^2] = \lVert \mathbf{u} \rVert^2$.
\textbf{Proof}: Define ${a}_i = \mathbf{R}_i^{T} \mathbf{u}$, where $\mathbf{R}_i$ denotes the $i^{th}$ row of $\mathbf{R}$. Since each element $\mathbf{R}_{ij}$ is an independent sample from Gaussian distribution, each ${a}_i$ is essentially a weighted sum of these independent random variables. Thus, each ${a}_i \sim \mathcal{N}\left(0, \frac{1}{pm}\lVert \mathbf{u} \rVert^2 \right)$ and independent from one another.
Our goal is to compute,
\begin{align}
\mathbb{E}[\lVert \mathbf{v} \rVert^2] &= \sum_{i=1}^{m} \mathbb{E}[({a}_i z_i)^2]\\
&= \sum_{i=1}^{m} \mathbb{E}[{a}_i^2] \mathbb{E}[ z_i^2] \\
&=m \mathbb{E}[{a}_i^2] \mathbb{E}[ z_i^2] \\
&=mp (var(a_i) + \mathbb{E}[{a}_i]^2) \\
&= \lVert \mathbf{u}\rVert^2
\end{align}
which proves the claim. $\square$
\end{lemma}
\begin{lemma}
Let $\mathbf{v} = \left(\mathbf{R} \mathbf{u}\right) \odot \mathbf{z}$, where $\mathbf{u} \in \mathbb{R}^n$, $\mathbf{z} \in \mathbb{R}^m$, and $\mathbf{R} \in \mathbb{R}^{m \times n}$. If $\mathbf{R}_{ij} \stackrel{i.i.d.}{\sim} \mathcal{N}(0,\frac{1}{0.5m})$, $\mathbf{z}_{i} \stackrel{i.i.d.}{\sim} \text{Bernoulli}(0.5)$ and $\epsilon \in [0,1)$, then for any fixed vector $\mathbf{u}$,
\begin{align}
\Pr\left(| \lVert \mathbf{v}\rVert^{2} - \lVert \mathbf{u}\rVert^{2} | \leq \epsilon \lVert \mathbf{u}\rVert^{2} \right) \geq 1 - 2\exp \left(-m \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
\textbf{Proof}: Define ${a}_i = \mathbf{R}_i^{T} \mathbf{u}$, where $\mathbf{R}_i$ denotes the $i^{th}$ row of $\mathbf{R}$. Then, each ${a}_i \sim \mathcal{N}\left(0, \frac{1}{0.5m}\lVert \mathbf{u} \rVert^2 \right)$ and independent from one another. Define $\tilde{\mathbf{a}} = \frac{\sqrt{0.5m}}{\lVert \mathbf{u} \rVert} \mathbf{a}$. Then we have that each element $\tilde{{a}}_i \sim \mathcal{N}\left(0, 1 \right)$.
Define $\tilde{\mathbf{v}}$ such that $\tilde{{v}}_i = \tilde{{a}}_i {z}_i$. Thus to bound the probability of failure for the R.H.S.,
\begin{align}
\Pr\left(\lVert \mathbf{v}\rVert^{2}\geq(1+\epsilon)\lVert \mathbf{u}\rVert^{2}\right) &= \Pr\left(\frac{\lVert \mathbf{u}\rVert^2}{0.5m} \lVert \tilde{\mathbf{v}}\rVert^{2}\geq(1+\epsilon)\lVert \mathbf{u}\rVert^{2}\right)\\
&= \Pr\left( \lVert \tilde{\mathbf{v}}\rVert^{2}\geq 0.5m (1+\epsilon)\right)
\end{align}
Using Chernoff's bound, we get for any $\lambda>0$,
\begin{align}
\Pr\left( \lVert \tilde{\mathbf{v}}\rVert^{2}\geq 0.5m (1+\epsilon)\right) &= \Pr\left( \exp(\lambda \lVert \tilde{\mathbf{v}}\rVert^{2})\geq \exp(\lambda 0.5m (1+\epsilon))\right)\\
&\leq \frac{\mathbb{E}[\exp(\lambda \lVert\tilde{\mathbf{v}}\rVert^{2})]}{\exp(0.5m \lambda (1+\epsilon))}\\
&= \frac{\mathbb{E}[\exp(\sum_{i=1}^m \lambda \tilde{{v}_i}^{2})]}{\exp(0.5m \lambda (1+\epsilon))}\\
&= \frac{ \Pi_{i=1}^m\mathbb{E}[\exp( \lambda \tilde{{v}_i}^{2})]}{\exp(0.5m \lambda (1+\epsilon))}\\
&= \left(\frac{ \mathbb{E}[\exp( \lambda \tilde{{v}_i}^{2})]}{\exp(0.5 \lambda (1+\epsilon))}\right)^m
\end{align}
Denote $p(\tilde{{a}_i})$ and $p({{z}_i})$ as the probability distribution of the random variables $\tilde{{a}_i}$ and ${{z}_i}$ respectively. Then,
\begin{align}
\mathbb{E}[\exp( \lambda \tilde{{v}_i}^{2})] &= \sum_{z_i} p({{z}_i}) \int_{ \tilde{{a}_i}} p(\tilde{{a}_i}) \exp( \lambda \tilde{{a}_i}^{2} z_i^2)
\end{align}
Substituting $p(\tilde{{a}_i})$ with a standard Normal distribution, we get,
\begin{align}
\mathbb{E}[\exp( \lambda \tilde{{v}_i}^{2})] &= \sum_{z_i} p({{z}_i}) \int_{ \tilde{{a}_i}} \frac{1}{\sqrt{2\pi}} \exp( \lambda \tilde{{a}_i}^{2} z_i^2 - \frac{\tilde{{a}_i}^{2}}{2})\\
&= \sum_{z_i} p({{z}_i}) \int_{ \tilde{{a}_i}} \frac{1}{\sqrt{2\pi}} \exp( -\frac{\tilde{{a}_i}^{2}}{2}( 1 - 2 \lambda z_i^2))\\
&= \sum_{z_i} p({{z}_i}) \int_{ \tilde{{a}_i}} \frac{1}{\sqrt{2\pi}} \cdot \frac{\sqrt{ 1 - 2 \lambda z_i^2}}{\sqrt{ 1 - 2 \lambda z_i^2}} \exp( -\frac{\tilde{{a}_i}^{2}}{2}( 1 - 2 \lambda z_i^2))\\
&= \sum_{z_i} p({{z}_i}) \cdot \frac{1}{\sqrt{ 1 - 2 \lambda z_i^2}}
\end{align}
where the last equality holds because the integral of a Gaussian distribution over its domain is 1. Finally, summing over the Bernoulli random variable $z_i$, we get,
\begin{align}
\mathbb{E}[\exp( \lambda \tilde{{v}_i}^{2})] &= (1-0.5) + \frac{1}{\sqrt{ 1 - 2 \lambda}}
\end{align}
Hence, we get,
\begin{align}
\Pr\left( \lVert \tilde{\mathbf{v}}\rVert^{2}\geq 0.5m (1+\epsilon)\right) &\leq \left(0.5\left( 1 + \frac{0.5}{\sqrt{(1-2\lambda)}}\right)\exp(-0.5 \lambda (1+\epsilon))\right)^m\\
&\leq \left(0.5\left( 1 + \frac{1}{\sqrt{(1-2\lambda)}}\right)\exp(-0.5 \lambda (1+\epsilon))\right)^m
\end{align}
We find that the above inequality is identical to that in Eq. (\ref{eq_fwd_lemma_lambda_ineq_rhs}). Thus $\lambda \approx \frac{0.5\epsilon}{1+\epsilon}$ approximately minimizes the above bound as before. Substituting this value of $\lambda$ above, we get,
\begin{align}
\Pr\left( \lVert \tilde{\mathbf{v}}\rVert^{2} \geq 0.5m (1+\epsilon)\right) &\leq \left(0.5\left( 1 + \sqrt{1+\epsilon} \right)\exp(-\frac{\epsilon}{4})\right)^m\\
&= \exp \left(-m \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
Thus,
\begin{align}
\label{eq_rectified_jl_ub_2}
\Pr\left(\lVert \mathbf{v}\rVert^{2}\leq(1+\epsilon)\lVert \mathbf{u}\rVert^{2}\right) \geq 1 - \exp \left(-m \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
Similarly, to prove the L.H.S. by bounding the probability of failure from the other side,
\begin{align}
\Pr\left(\lVert \mathbf{v}\rVert^{2}\leq(1-\epsilon)\lVert \mathbf{u}\rVert^{2}\right) &=
\Pr\left(-\lVert \mathbf{v}\rVert^{2}\geq -(1-\epsilon)\lVert \mathbf{u}\rVert^{2}\right)\\
&= \Pr\left(-\frac{\lVert \mathbf{u}\rVert^2}{0.5m} \lVert \tilde{\mathbf{v}}\rVert^{2}\geq - (1-\epsilon)\lVert \mathbf{u}\rVert^{2}\right)\\
&= \Pr\left( -\lVert \tilde{\mathbf{v}}\rVert^{2}\geq - 0.5m (1-\epsilon)\right)
\end{align}
Using Chernoff's bound, we get for any $\lambda>0$,
\begin{align}
\Pr\left( -\lVert \tilde{\mathbf{v}}\rVert^{2}\geq -0.5m (1-\epsilon)\right) &= \Pr\left( \exp(-\lambda \lVert \tilde{\mathbf{v}}\rVert^{2})\geq \exp(-\lambda 0.5m (1-\epsilon))\right)\\
&\leq \frac{\mathbb{E}[\exp(-\lambda \lVert\tilde{\mathbf{v}}\rVert^{2})]}{\exp(-0.5m \lambda (1-\epsilon))}\\
&= \frac{\mathbb{E}[\exp(-\sum_{i=1}^m \lambda \tilde{{v}_i}^{2})]}{\exp(-0.5m \lambda (1-\epsilon))}\\
&= \frac{ \Pi_{i=1}^m\mathbb{E}[\exp( -\lambda \tilde{{v}_i}^{2})]}{\exp(-0.5m \lambda (1-\epsilon))}\\
&= \left(\frac{ \mathbb{E}[\exp(- \lambda \tilde{{v}_i}^{2})]}{\exp(-0.5 \lambda (1-\epsilon))}\right)^m
\end{align}
Performing computations similar to those above to compute the expectation term, we get,
\begin{align}
\mathbb{E}[\exp( -\lambda \tilde{{v}_i}^{2})] &= 0.5 + \frac{1}{\sqrt{(1+2\lambda)}}
\end{align}
Hence, we get,
\begin{align}
\Pr\left( \lVert \tilde{\mathbf{v}}\rVert^{2}\leq 0.5m (1-\epsilon)\right) &\leq \left(0.5\left( 1 + \frac{0.5}{\sqrt{(1+2\lambda)}}\right)\exp(0.5 \lambda (1-\epsilon))\right)^m\\
&\leq \left(0.5\left( 1 + \frac{1}{\sqrt{(1+2\lambda)}}\right)\exp(0.5 \lambda (1-\epsilon))\right)^m
\end{align}
Similar to the R.H.S. case, we find that $\lambda \approx \frac{0.5\epsilon}{1-\epsilon}$ approximately minimizes the failure probability,
\begin{align}
\Pr\left( \lVert \tilde{\mathbf{v}}\rVert^{2}\leq 0.5m (1-\epsilon)\right) &\leq \left(0.5\left( 1 + \sqrt{1-\epsilon} \right)\exp(\frac{\epsilon}{4})\right)^m\\
&= \exp \left(m \left( \frac{\epsilon}{4} - \log \frac{2}{1 + \sqrt{1-\epsilon}} \right)\right)
\end{align}
It can be shown that,
\begin{align}
\exp \left(m \left( \frac{\epsilon}{4} - \log \frac{2}{1 + \sqrt{1-\epsilon}} \right)\right) \leq \exp \left(-m \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
Thus,
\begin{align}
\label{eq_rectified_jl_lb_2}
\Pr\left(\lVert \mathbf{v}\rVert^{2}\geq(1-\epsilon)\lVert \mathbf{u}\rVert^{2}\right) \geq 1 - \exp \left(-m \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
Using union bound, Eq. (\ref{eq_rectified_jl_ub_2}) and (\ref{eq_rectified_jl_lb_2}) hold together with probability,
\begin{align}
\Pr\left((1-\epsilon)\lVert \mathbf{u}\rVert^{2} \leq \lVert \mathbf{v}\rVert^{2} \leq (1+\epsilon)\lVert \mathbf{u}\rVert^{2} \right) \geq 1 - 2\exp \left(-m \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
This proves the claim. $\square$
\end{lemma}
\begin{theorem}
Let $\mathcal{D}$ be a fixed dataset with $N$ samples and define a $L$ layer ReLU network as shown in Eq. \ref{eq_relu_layer} such that each weight matrix $\mathbf{W}^l \in \mathbb{R}^{n \times n}$ has its elements sampled as ${W}^l_{ij} \stackrel{i.i.d.}{\sim} \mathcal{N}(0,\frac{2}{n})$ and biases $\mathbf{b}^l$ are set to zeros. Then for any sample $(\mathbf{x}, \mathbf{y}) \in \mathcal{D}$, $\epsilon \in [0,1)$, and for all $l \in \{ 1,2, \hdots , L \}$ with probability at least,
\begin{align}
1 - 4NL\exp \left(-n \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
the following hold true,
\begin{align}
(1-\epsilon)^L\lVert \mathbf{x}\rVert^{2} \cdot \lVert \delta(\mathbf{x},\mathbf{y}) \rVert^2 \leq \lVert \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{W}^l} \rVert^{2}
\leq (1+\epsilon)^L\lVert \mathbf{x}\rVert^{2} \cdot \lVert \delta(\mathbf{x},\mathbf{y}) \rVert^2
\end{align}
and
\begin{align}
(1-\epsilon)^l\lVert \mathbf{x}\rVert^{2} \leq \lVert \mathbf{h}^l\rVert^{2} \leq (1+\epsilon)^l\lVert \mathbf{x}\rVert^{2}
\end{align}
\textbf{Proof}: From theorem \ref{theorem_deep_relu_length_preservation}, we know that the following holds for all $l$,
\begin{align}
\label{eq_l_layer_activation_length}
\Pr\left((1-\epsilon)^{l}\lVert \mathbf{x}\rVert^{2} \leq \lVert \mathbf{h}^{l}\rVert^{2} \leq (1+\epsilon)^{l}\lVert \mathbf{x}\rVert^{2} \right) \geq 1 - 2NL\exp \left(-n \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
On the other hand, we have that,
\begin{align}
\frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{a}^{L-1}} &= \mathbbm{1}(\mathbf{a}^{L-1}) \odot \left( \mathbf{W}^{L^T} \delta(\mathbf{x},\mathbf{y}) \right)
\end{align}
From proposition \ref{proposition_preactivation_properties}, we know that each element of $\mathbbm{1}(\mathbf{a}^{L-1})$ follows a Bernoulli distribution with probability 0.5. Thus applying lemma \ref{lemma_1layer_length_preservation_bwd} to the above equation (under the assumption that $\delta(\mathbf{x},\mathbf{y})$ and $\mathbbm{1}(\mathbf{a}^{l})$ are statistically independent), the following holds for a fixed data sample $(\mathbf{x}, \mathbf{y})$,
\begin{align}
\Pr\left((1-\epsilon)\lVert \delta(\mathbf{x},\mathbf{y}) \rVert^{2} \leq \lVert \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{a}^{L-1}} \rVert^{2} \leq (1+\epsilon)\lVert \delta(\mathbf{x},\mathbf{y}) \rVert^{2} \right) \geq 1 - 2\exp \left(-n \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
Applying union bound on $N$ fixed samples, the following holds for all $N$ samples,
\begin{align}
\Pr\left((1-\epsilon)\lVert \delta(\mathbf{x},\mathbf{y}) \rVert^{2} \leq \lVert \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{a}^{L-1}} \rVert^{2} \leq (1+\epsilon)\lVert \delta(\mathbf{x},\mathbf{y}) \rVert^{2} \right) \geq 1 - 2N\exp \left(-n \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
Similarly,
\begin{align}
\Pr\left((1-\epsilon)\lVert \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{a}^{L-1}} \rVert^{2} \leq \lVert \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{a}^{L-2}} \rVert^{2} \leq (1+\epsilon)\lVert \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{a}^{L-1}} \rVert^{2} \right) \geq 1 - 2N\exp \left(-n \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
Combining the the above two results and applying union bound, we get,
\begin{align}
\Pr\left((1-\epsilon)^2\lVert \delta(\mathbf{x},\mathbf{y}) \rVert^{2} \leq \lVert \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{a}^{L-2}} \rVert^{2} \leq (1+\epsilon)^2\lVert \delta(\mathbf{x},\mathbf{y}) \rVert^{2} \right) \geq 1 - 4N\exp \left(-n \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
Extending this to all $L$ layers, we have for all $l$ that,
\begin{align}
\Pr\left((1-\epsilon)^{L-l}\lVert \delta(\mathbf{x},\mathbf{y}) \rVert^{2} \leq \lVert \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{a}^{l}} \rVert^{2} \leq (1+\epsilon)^{L-l}\lVert \delta(\mathbf{x},\mathbf{y}) \rVert^{2} \right) \geq 1 - 2NL\exp \left(-n \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
Combining the above result with Eq. (\ref{eq_l_layer_activation_length}) using union bound, we get for all $l$,
\begin{align}
\Pr\left((1-\epsilon)^{L-1}\lVert \delta(\mathbf{x},\mathbf{y}) \rVert^{2} \lVert \mathbf{x}\rVert^{2} \leq \lVert \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{a}^{l}} \rVert^{2} \lVert \mathbf{h}^{l-1}\rVert^{2} \leq (1+\epsilon)^{L-1}\lVert \delta(\mathbf{x},\mathbf{y}) \rVert^{2} \lVert \mathbf{x}\rVert^{2} \right)\nonumber \\
\geq 1 - 4NL\exp \left(-n \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
Since,
\begin{align}
\lVert \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{W}^l} \rVert_2 = \lVert \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{a}^l} \rVert_2 \cdot \lVert \mathbf{h}^{l-1} \rVert_2 \mspace{20mu} \forall l
\end{align}
we have proved the claim. $\square$
\end{theorem}
\begin{lemma} (Corollary 2.1 of \citet{inner_prod_corr})
\label{lem_inner_product}
Let $\mathbf{u_1},\mathbf{u_2} \in\mathbb{R}^{n}$ be any two fixed vectors such that $\lVert \mathbf{u}_1 \rVert \leq 1$ and $\lVert \mathbf{u}_2 \rVert \leq 1$, $\mathbf{R} \in\mathbb{R}^{m\times n}$ be a projection matrix where each element of R is drawn
i.i.d. from a standard Gaussian distribution, $R_{ij}\sim\mathcal{N}(0,\frac{1}{{m}})$
and any $\epsilon\in(0,1/2)$
\begin{align}
\Pr\left(| < \mathbf{Ru}_1,\mathbf{Ru}_2> - < \mathbf{u}_1,\mathbf{u}_2> | \leq \epsilon \right) \nonumber\\
\geq 1-4\exp\left(-\frac{m}{4}\left(\epsilon^{2}-\epsilon^{3}\right)\right)
\end{align}
\end{lemma}
\begin{lemma}
\label{lemma_inner_prod_bwd}
Let $\mathbf{v}_1 = \left(\mathbf{R} \mathbf{u}_1\right) \odot \mathbf{z}$ and $\mathbf{v}_2 = \left(\mathbf{R} \mathbf{u}_2\right) \odot \mathbf{z}$, where $\mathbf{u}_1,\mathbf{u}_2 \in \mathbb{R}^n$, $\mathbf{z} \in \mathbb{R}^m$, and $\mathbf{R} \in \mathbb{R}^{m \times n}$. If $\mathbf{R}_{ij} \stackrel{i.i.d.}{\sim} \mathcal{N}(0,\frac{1}{0.5m})$, $\mathbf{z}_{i} \stackrel{i.i.d.}{\sim} \text{Bernoulli}(0.5)$ and $\epsilon \in [0,1)$, then for any fixed vectors $\mathbf{u}_1$ and $\mathbf{u}_2$ s.t. $\lVert \mathbf{u}_1 \rVert \leq 1$ and $\lVert \mathbf{u}_2 \rVert \leq 1$,
\begin{align}
\Pr\left(| < \mathbf{v}_1, \mathbf{v}_2> - <\mathbf{u}_1,\mathbf{u}_2> | \leq \epsilon \right) \geq 1 - 4\exp \left(-m \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
\textbf{Proof}: Applying lemma \ref{lemma_1layer_length_preservation_bwd} to vectors $\mathbf{u}_1 + \mathbf{u}_2$ and $\mathbf{u}_1 - \mathbf{u}_2$, we have with probability at least $1 - 4\exp \left(-m \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)$,
\begin{align}
(1-\epsilon)\cdot \lVert \mathbf{u}_1 + \mathbf{u}_2 \rVert^2 &\leq \lVert \mathbf{z}\odot \mathbf{R} \mathbf{u}_1 + \mathbf{z}\odot \mathbf{R} \mathbf{u}_2 \rVert^2 \leq (1+\epsilon)\cdot \lVert \mathbf{u}_1 + \mathbf{u}_2 \rVert^2 \\
(1-\epsilon)\cdot \lVert \mathbf{u}_1 - \mathbf{u}_2 \rVert^2 &\leq \lVert \mathbf{z}\odot \mathbf{R} \mathbf{u}_1 - \mathbf{z}\odot \mathbf{R} \mathbf{u}_2 \rVert^2 \leq (1+\epsilon)\cdot \lVert \mathbf{u}_1 - \mathbf{u}_2 \rVert^2
\end{align}
Then notice,
\begin{align}
4< \mathbf{v}_1, \mathbf{v}_2> &= 4 <\mathbf{z}\odot \mathbf{R} \mathbf{u}_1, \mathbf{z}\odot \mathbf{R} \mathbf{u}_2>\\
&= \lVert \mathbf{z}\odot \mathbf{R} \mathbf{u}_1 + \mathbf{z}\odot \mathbf{R} \mathbf{u}_2 \rVert^2 - \lVert \mathbf{z}\odot \mathbf{R} \mathbf{u}_1 - \mathbf{z}\odot \mathbf{R} \mathbf{u}_2 \rVert^2\\
&\geq (1-\epsilon)\cdot \lVert \mathbf{u}_1 + \mathbf{u}_2 \rVert^2 - (1+\epsilon) \cdot \lVert \mathbf{u}_1 - \mathbf{u}_2 \rVert^2\\
&= 4 \cdot <\mathbf{u}_1, \mathbf{u}_2> - 2\epsilon \cdot (\lVert \mathbf{u}_1 \rVert^2 + \lVert \mathbf{u}_2 \rVert^2)\\
&\geq 4 \cdot <\mathbf{u}_1, \mathbf{u}_2> - 4\epsilon
\end{align}
Equivalently,
\begin{align}
\cdot <\mathbf{u}_1, \mathbf{u}_2> - < \mathbf{v}_1, \mathbf{v}_2> \leq \epsilon
\end{align}
The other side of the claim can be proved similarly.
\end{lemma}
\section{Introduction}
\label{sec_intro}
Deep rectifier (ReLU) networks are popular in deep learning due to their ease of training and state-of-the-art generalization. This success of deep rectifier networks can be partly attributed to \textit{good} initialization strategies (for example \citet{glorot2010understanding,he2015delving}). Essentially, good parameter initializations guarantee that there is no exploding or vanishing of information across hidden layers. These properties help gradient descent based optimization methods in navigating the complex non-linear loss landscape of deep networks by initializing them at a \textit{good} starting point where training can begin. Such favorable properties promised by these initialization strategies are (in most cases) shown to hold true in asymptotic settings where the network width tends to infinity and/or under strict assumptions made about the distribution of the input data. A detailed account of these existing papers and a contrast between these papers and our work is discussed in section \ref{sec_existing_work}.
Our paper relaxes the aforementioned assumptions made in previous papers. Further, we show novel properties that hold for deep ReLU networks at initialization when using the He initialization scheme \citep{he2015delving}. Specifically, we show that deep ReLU networks obey the following properties in the forward (Eq. \ref{eq_fwd_property}) back backward (Eq. \ref{eq_bwd_property}) pass (see section \ref{sec_unnorm_deep_relu} for notations),
\begin{align}
\label{eq_fwd_property}
\lVert \mathbf{h}^l \rVert_2 &\approx \lVert \mathbf{x} \rVert_2 \mspace{20mu} \forall l \in \{1,2, \cdots ,L \}\\
\label{eq_bwd_property}
\lVert \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{W}^l} \rVert_F &\approx \lVert \delta(\mathbf{x},\mathbf{y}) \rVert_2 \cdot \lVert \mathbf{x} \rVert_2 \mspace{20mu} \forall l \in \{1,2, \cdots ,L \}
\end{align}
We refer to the above properties as as the the \textit{activation norm equality} and the \textit{gradient norm equality} property.
Further, we derive a finite lower bound on the width of the hidden layers for which the above results hold (i.e., the network needs to be sufficiently over-parameterized) in contrast to a number of previous papers that assume infinitely wide layers.
We do not make any assumption on the data distribution as done in a number of previous papers that study initialization. Further, our results hold for an infinite stream of data for the activation norm equality property and for any finite dataset in the backward pass.
Thus we have relaxed a number of assumptions made in previous research work that focus on deriving initialization strategies for deep ReLU networks. Our results showing the connection between activation norm and input norm (and similarly the property for gradients) for deep ReLU networks can be utilized in further research studies.
\section{Relation with Existing Work}
\label{sec_existing_work}
The seminal work of \citet{glorot2010understanding} studied for the first time a principled way to initialize deep networks to avoid exploding/vanishing gradient problem (EVGP). Their analysis however is done for deep linear networks. The analysis by \citet{he2015delving} follows the derivation strategy of \citet{glorot2010understanding} except they tailor their derivation for deep ReLU networks. However, both these papers make a strong assumption that the dimensions of the input are statistically independent and that the network width is infinite. Our results do not make these assumptions.
\cite{saxe2013exact} introduce the notion of dynamical isometry which is achieved when all the singular values of the input-output Jacobian of the network is 1. They show that deep linear networks achieve dynamical isometry when initialized using orthogonal weights and this property allows fast learning in such networks.
\citet{poole2016exponential} study how the norm of hidden activations evolve when propagating an input through the network. \citet{pennington2017resurrecting,pennington2018emergence} study the exploding and vanishing gradient problem in deep ReLU networks using tools from free probability theory. Under the assumption of an infinitely wide network, they show that the average squared singular value of the input-output Jacobian for deep ReLU network is 1 when initialized appropriately. Our paper on the other hand shows that deep ReLU networks are norm preserving maps at appropriate initialization. Further, we show there exists a finite lower bound on the width of the network for which the Frobenius norm of the hidden layer-output Jacobian (equivalently the sum of its squared singular values) are equal across all hidden layers.
\cite{hanin2018start} show that for a fixed input, the variance of the squared norm of hidden layer activations are bounded from above and below for deep ReLU networks to be near the squared norm of the input such that the bound depends on the sum of reciprocal of layer widths of the network. Our paper shows a similar result in a PAC bound sense but as an important difference, we show that these results hold even for an infinite stream of data by making the bound depend on the dimensionality of the input.
\cite{hanin2018neural} show that sufficiently wide deep ReLU networks with appropriately initialized weights prevent EVGP in the sense that the fluctuation between the elements of the input-output Jacobian matrix of the network is small. This avoids EVGP because a large fluctuation between the elements of the input-output Jacobian implies a large variation in its singular values. Our paper shows that sufficiently wide deep ReLU networks avoid EVGP in the sense that the norm of the gradient for the weights of each layer is roughly equal to a fixed quantity that depends on the input and target.
Over-parameterization in deep networks has previously been shown to have advantages. \citet{neyshabur2014search,arpit2017closer} show empirically that wider networks train faster (number of epochs) and have better generalization performance. From a theoretical view point,
\cite{neyshabur2018towards} derive a generalization bound for a two layer ReLU network where they show that a wider network has a lower complexity. \citet{lee2017deep} show that infinitely wide deep networks act as a Gaussian process. \cite{arora2018optimization} show that over-parameterization in deep linear networks acts as a conditioning on the gradient leading to faster convergence, although in this case over-parameterization in terms of depth is studied. Our analysis complements this line of work by showing another advantage of over-parameterization in deep ReLU networks.
\section{Theoretical Results}
\label{sec_unnorm_deep_relu}
Let $\mathcal{D} = \{ \mathbf{x}_i, \mathbf{y}_i \}_{i=1}^N$ be $N$ training sample pairs of inputs vectors $\mathbf{x}_i \in \mathbb{R}^{n_o}$ and target vectors $\mathbf{y}_i^K$ where $\mathbf{x}_i$'s are sampled from a distribution with support $\mathcal{X}$. Define a $L$ layer deep ReLU network $f_{\mathbf{\theta}}(\mathbf{x}) = \mathbf{h}^L$ with the $l^{th}$ hidden layer's activation given by,
\begin{align}
\label{eq_relu_layer}
\mathbf{h}^l &:= ReLU(\mathbf{a}^l) \nonumber\\
\mathbf{a}^l &:= \mathbf{W}^l \mathbf{h}^{l-1} + \mathbf{b}^l \mspace{20mu} l \in \{ 1,2, \cdots L \}
\end{align}
where $\mathbf{h}^l \in \mathbb{R}^{n_l}$ are the hidden activations, $\mathbf{h}^o$ is the input to the network and can be one of the input vectors $\mathbf{x}_i$, $\mathbf{W}^l \in \mathbb{R}^{n_l \times n_{l-1}}$ are the weight matrices, $\mathbf{b} \in \mathbb{R}^{n_l}$ are the bias vectors which are initialized as 0s, $\mathbf{a}^l$ are the pre-activations and $\theta = \{ (\mathbf{W}^l,\mathbf{b}^l)\}_{l=1}^L$.
Define a loss on the deep network function for any given training data sample $(\mathbf{x},\mathbf{y})$ as,
\begin{align}
\ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})
\end{align}
where $\ell(.)$ is any desired loss function. For instance, $\ell(.)$ can be log loss for a classification problem, in which case $f_{\mathbf{\theta}}(\mathbf{x})$ is transformed using a weight matrix to have dimensions equal to the number of classes and the softmax activation is applied to yield class probabilities (i.e., a logistic regression like model on top of $f_{\mathbf{\theta}}(\mathbf{x})$). However for our purpose, we do not need to restrict $\ell(.)$ to a specific choice, we only need it to be differentiable. We will make use of the notation,
\begin{align}
\label{eq_delta_definition}
\delta(\mathbf{x},\mathbf{y}) &:= \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{a}_L}
\end{align}
We organize our theoretical results as follows. We first derive the activation norm equality property for finite datasets and then extend these results to infinite dataset setting in section \ref{sec_fwd}. We then derive the gradient norm equality property for finite datasets in section \ref{sec_back}. All formal proofs, if not shown in the main text, are available in the appendix.
\subsection{Activation Norm Equality}
\label{sec_fwd}
Consider an $L$ layer deep ReLU network and data $\mathbf{x} \in \mathcal{X}$. We show in this section that the norm of hidden layer activation of any layer is roughly equal to the norm of the input at initialization for all $\mathbf{x} \in \mathcal{X}$ if the network weights are initialized appropriately and the network width is sufficiently large but finite. Specifically we show $\forall l \in [L]$ and $\mathbf{x} \in \mathcal{X}$,
\begin{align}
\label{eq_hidden_approx_input_norm}
\lVert \mathbf{h}^l \rVert_2 \approx \lVert \mathbf{x} \rVert_2
\end{align}
To achieve this goal, we start with a very simple result-- in expectation, ReLU transformation in each layer preserves the norm of its corresponding input if the weights are sampled appropriately. Evaluating this expectation also helps determining the scale of the random initialization that leads to norm preservation.
\begin{lemma}
\label{lemma_fwd_expected_norm}
Let $\mathbf{v} = ReLU\left(\mathbf{R} \mathbf{u}\right)$, where $\mathbf{u} \in \mathbb{R}^n$, $\mathbf{R} \in \mathbb{R}^{m \times n}$. If $\mathbf{R}_{ij} \stackrel{i.i.d.}{\sim} \mathcal{N}(0,\frac{2}{m})$, then for any fixed vector $\mathbf{u}$, $\mathbb{E}[\lVert \mathbf{v} \rVert^2] = \lVert \mathbf{u} \rVert^2$.
\end{lemma}
The proof for the above lemma involves simply computing the expectation analytically by exploting the fact that each dimension of the vector $\mathbf{u}$ is a weighted sum of Gaussian random variables. The above result thus shows that for each layer, initializing its weights from an i.i.d. Gaussian distribution with 0 mean and $2/\text{fan-out}$ variance (viz. He initialization \citep{he2015delving}) preserves the norm of its input in expectation. We now derive a lower bound on the width of a ReLU layer so that it can preserve the norm of the input for a single fixed input with $\epsilon$ error margin.
\begin{lemma}
\label{lemma_1layer_length_preservation}
Let $\mathbf{v} = ReLU\left(\mathbf{R} \mathbf{u}\right)$, where $\mathbf{u} \in \mathbb{R}^n$, $\mathbf{R} \in \mathbb{R}^{m \times n}$. If $\mathbf{R}_{ij} \stackrel{i.i.d.}{\sim} \mathcal{N}(0,\frac{2}{m})$, and $\epsilon \in [0,1)$, then for any fixed vector $\mathbf{u}$,
\begin{align}
\Pr\left(|\lVert \mathbf{v}\rVert^{2} - \lVert \mathbf{u}\rVert^{2} | \leq \epsilon \lVert \mathbf{u}\rVert^{2} \right) \geq 1 - 2\exp \left(-m \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
\end{lemma}
The proof of this lemma involves a direct application of the Chernoff bounding technique. Now we use the above lemma to show that the norm of hidden activations equal the norm of inputs within a specified margin and for a finite size dataset for a deep ReLU network.
\begin{theorem}
\label{theorem_deep_relu_length_preservation}
Let $\mathcal{D}$ be a fixed dataset with $N$ samples and define a $L$ layer ReLU network $f_\theta(.)$ as shown in Eq. \ref{eq_relu_layer} such that each weight matrix $\mathbf{W}^l \in \mathbb{R}^{n_l \times n_{l-1}}$ has its elements sampled as ${W}^l_{ij} \stackrel{i.i.d.}{\sim} \mathcal{N}(0,\frac{2}{n_l})$ and biases $\mathbf{b}^l$ are set to zeros. Then for any sample $(\mathbf{x}, \mathbf{y}) \in \mathcal{D}$ and $\epsilon \in [0,1)$, we have that,
\begin{align}
\Pr\left((1-\epsilon)^L\lVert \mathbf{x}\rVert^{2} \leq \lVert f_\theta(\mathbf{x})\rVert^{2} \leq (1+\epsilon)^L\lVert \mathbf{x}\rVert^{2} \right) \nonumber\\
\geq 1 - \sum_{l^\prime=1}^{L} 2N\exp \left(-n_{l^{\prime}} \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
\end{theorem}
While the statement of the above theorem only talks about the norm of the final output of the network, it equally applies to any hidden layer $l$ as well since the theorem can be applied equivalently to a $l$ layer network.
Having proved the activation norm equality property in the finite dataset setting above, we now turn our attention to the case of infinite dataset case. To do so, we first prove a non-trivial result where we use lemma \ref{lemma_1layer_length_preservation} to show how a lower bound on the width of an individual ReLU layer can be computed such that this layer preserves the norm of an infinite stream of inputs.
\begin{lemma}
\label{theorem_infinite_data_fwd}
Let $\mathcal{X}$ be a $d\leq n$ dimensional subspace of $\mathbb{R}^n$ and $\mathbf{R} \in \mathbb{R}^{m \times n}$. If $\mathbf{R}_{ij} \stackrel{i.i.d.}{\sim} \mathcal{N}(0,\frac{2}{m})$, $\epsilon \in [0,1)$, and,
\begin{align}
m \geq \frac{1}{\epsilon/12 - \log (0.5(1 + \sqrt{1+\epsilon/3})) } \cdot \left( d\log \frac{2}{\Delta} + \log \frac{4}{\delta} \right)
\end{align}
then with probability at least $1-\delta$,
\begin{align}
(1-\epsilon) \lVert \mathbf{u}\rVert^2 \leq \lVert ReLU(\mathbf{R{u}}) \rVert^2 \leq (1+\epsilon) \lVert \mathbf{u}\rVert^2 \mspace{20mu} \forall \mathbf{u} \in \mathcal{X}
\end{align}
where $\Delta := \min\{ \frac{\epsilon}{3\sqrt{d}}, \frac{\sqrt{\epsilon}}{\sqrt{3}d} \}$.
\textbf{Proof Sketch}: The core idea behind the proof is inspired by lemma 10 of \cite{sarlos2006improved}. Without any loss of generality, we will show the norm preserving property for any unit vector $\mathbf{u}$ in the $d$ dimensional subspace $\mathcal{X}$ of $\mathbb{R}^n$. This is because for any arbitrary length vector $\mathbf{u}$, $\lVert ReLU(\mathbf{Ru}) \rVert = \lVert \mathbf{u} \rVert \cdot \lVert ReLU(\mathbf{R\hat{u}}) \rVert$. The idea then is to define a grid of finite points over $\mathcal{X}$ on $[-1,1]^d$ with interval size depending on $\epsilon$, such that every unit vector $\mathbf{\hat{u}}$ in $\mathcal{X}$ is close enough to one of the grid points. Then, if we choose the width of the layer to be large enough to approximately preserve the length of the finite number of grid points, we can guarantee that the length of any arbitrary unit vector approximately remains preserved as well within the derived margin of error. The formal proof can be found in the appendix.
\end{lemma}
We now extend the above lemma to a deep ReLU network and show our main result for the forward pass that the norm of hidden activations equal the norm of input within some distortion margin, for an infinite stream of input data for a sufficiently large (but finite) width deep ReLU network.
\begin{theorem}
Define a $L$ layer ReLU network $f_\theta(.)$ as shown in Eq. \ref{eq_relu_layer} such that each weight matrix $\mathbf{W}^l \in \mathbb{R}^{n_l \times n_{l-1}}$ has its elements sampled as ${W}^l_{ij} \stackrel{i.i.d.}{\sim} \mathcal{N}(0,\frac{2}{n_l})$ and biases $\mathbf{b}^l$ are set to zeros. Let $\mathcal{X}$ be a $d\leq n$ dimensional subspace of $\mathbb{R}^n$. If ${W}^l_{ij} \stackrel{i.i.d.}{\sim} \mathcal{N}(0,\frac{2}{n_l})$, $\epsilon \in [0,1)$, and,
\begin{align}
n_l \geq \frac{1}{\epsilon/12 - \log (0.5(1 + \sqrt{1+\epsilon/3})) } \cdot \left( d\log \frac{2}{\Delta} + \log \frac{4L}{\delta} \right) \mspace{20mu} \forall l \in [L]
\end{align}
then with probability at least $1-\delta$,
\begin{align}
(1-\epsilon)^l\lVert \mathbf{x}\rVert^{2} \leq \lVert \mathbf{h}^l\rVert^{2} \leq (1+\epsilon)^l\lVert \mathbf{x}\rVert^{2} \mspace{20mu} \forall \mathbf{x} \in \mathcal{X} \mspace{20mu} \forall l \in [L]
\end{align}
\textbf{Proof}: Since the input lies on a $d$ dimensional subspace of $\mathbb{R}^n$, we apply theorem \ref{theorem_infinite_data_fwd} to the first layer and get the guarantee that the norm of all inputs on the $d$ dimensional subspace are preserved by this layer. Next, we show that since each layer is a linear transform followed by pointwise ReLU non-linearity, and the input takes values in a set defined by the $d$ dimensional subspace of $\mathbb{R}^n$, the output of the first layer will take values in a set that is strictly a subset of a $d$ dimensional subspace. To see this, let $\mathbf{B} \in \mathbb{R}^{n \times d}$ denote a matrix with orthonormal columns describing the basis of the subspace $\mathcal{X}$ on which the input lies, and let $\mathbf{z} \in \mathbb{R}^{d}$. Then we have that,
\begin{align}
\mathbf{x} \in \{ \mathbf{Bz} | \mathbf{z} \in \mathbb{R}^{d} \}
\end{align}
The first layer transforms any input $\mathbf{x}$ as
\begin{align}
\mathbf{h}^1 &= ReLU(\mathbf{W}^0\mathbf{x})\\
&= ReLU(\mathbf{W}^0 \mathbf{Bz})
\end{align}
Denote $\mathbf{B}^\prime = \mathbf{W}^0 \mathbf{B}$. Then note that rank($\mathbf{B}^\prime$) $\leq d$. Let $S_1$ denote the set of values that $\mathbf{h}^1$ can take. Then we have that,
\begin{align}
S_1 = \{ \mathbf{B^\prime z} | \mathbf{z} \in \mathbb{R}^{d} \} \cap \mathbb{R}^{n_1^+}
\end{align}
where $\mathbb{R}^{n^+}$ denote the subset of $\mathbb{R}^{n}$ where all dimensions take non-negative values. This shows that $\mathbf{h}^1$ takes values in a set that is strictly a subset of a $d$ dimensional subspace of $\mathbb{R}^{n_1}$.
Having proved this for first layer, we can recursively apply this strategy to all higher layers since the output of each layer lies on a subset of a subspace. Notice that while doing so, the lower bound on the width of each layer depends only on the subspace dimensionality $d$. Applying union bound over the result of theorem \ref{theorem_infinite_data_fwd} for $L$ layers proves the claim. $\square$
\end{theorem}
We note that the lower bound on width derived above depends on two quantities-- the depth of the network $L$, and the dimensionality of the subspace $d$ on which the input lies. Specifically, the lower bound on the width becomes larger for larger input dimensionality $d$ and larger network depth $L$ irrespective of the number of data samples, meaning that a wider network is needed as the depth of the network and/or the intrinsic input dimensionality increases.
\subsection{Gradient Norm Equality}
\label{sec_back}
Consider any given loss function $\ell(.)$ and a data sample $(\mathbf{x}, \mathbf{y})$, we show in this section that the norm of gradient for the parameter $\mathbf{W}^l$ of the $l^{th}$ layer depends only on the input and output.
Specifically, for a wide enough network, the following holds at initialization for all $l \in \{ 1,2, \hdots ,L \}$ and $\forall \mathbf{x} \in \mathcal{D}$,
\begin{align}
\label{eq_grad_norm_approx_decomposition}
\lVert \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{W}^l} \rVert_F \approx \lVert \delta(\mathbf{x},\mathbf{y}) \rVert_2 \cdot \lVert \mathbf{x} \rVert_2 \mspace{20mu} \forall l
\end{align}
As a first step, we note that the gradient for a parameter $\mathbf{W}^l$ for a sample $(\mathbf{x}, \mathbf{y})$ is given,
\begin{align}
\frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{W}^l} = diag \left(\frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{a}^l} \right) \cdot \mathcal{M}_{n_{l}}(\mathbf{h}^{l-1})
\end{align}
where $\mathcal{M}_{n_{l}}(\mathbf{h}^{l-1})$ is a matrix of size $n_{l} \times n_{l-1}$ such that each row is the vector $\mathbf{h}^{l-1}$. Therefore, a simple algebraic manipulation shows that,
\begin{align}
\label{eq_grad_norm_decomposition}
\lVert \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{W}^l} \rVert_F = \lVert \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{a}^l} \rVert_2 \cdot \lVert \mathbf{h}^{l-1} \rVert_2
\end{align}
In the previous section, we showed that for a sufficiently wide network, $\lVert \mathbf{h}^{l} \rVert_2 \approx \lVert \mathbf{x} \rVert_2$ $\forall l$ with high probability. To show that gradient norms of parameters are preserved in the sense shown in Eq. (\ref{eq_grad_norm_approx_decomposition}), we essentially show that $\lVert \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{a}^l} \rVert_2 \approx \lVert \delta(\mathbf{x},\mathbf{y}) \rVert_2$ $\forall l$ with high probability for sufficiently wide networks.
Note that $\lVert \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{a}^L} \rVert_2 = \lVert \delta(\mathbf{x},\mathbf{y}) \rVert_2$ by definition. To show the norm is preserved for all layers, we begin by noting that,
\begin{align}
\label{eq_dlda_decomposition}
\frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{a}^l} &= \frac{\partial \mathbf{h}^{l}}{\partial \mathbf{a}^{l}} \odot \left( \frac{\partial \mathbf{a}^{l+1}}{\partial \mathbf{h}^{l}}^T \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{a}^{l+1}} \right)\nonumber\\
&= \mathbbm{1}(\mathbf{a}^l) \odot \left( \mathbf{W}^{l+1^T} \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{a}^{l+1}} \right)
\end{align}
where $\odot$ is the point-wise product (or Hadamard product) and $\mathbbm{1}(.)$ is the heaviside step function. The following proposition shows that $\mathbbm{1}(.)$ follows a Bernoulli distribution w.r.t. the weights given any fixed input at the previous layer.
\begin{proposition}
\label{proposition_preactivation_properties}
If network weights are sampled i.i.d. from a Gaussian distribution with mean 0 and biases are 0 at initialization, then conditioned on $\mathbf{h}^{l-1}$, each dimension of $ \mathbbm{1}(\mathbf{a}^l)$ follows an i.i.d. Bernoulli distribution with probability 0.5 at initialization.
\end{proposition}
Given this property of $ \mathbbm{1}(\mathbf{a}^l)$, we show below that the transformation of type shown in Eq. (\ref{eq_dlda_decomposition}) is norm preserving in expectation.
\begin{lemma}
\label{lemma_bwd_expected_norm}
Let $\mathbf{v} = \left(\mathbf{R} \mathbf{u}\right) \odot \mathbf{z}$, where $\mathbf{u} \in \mathbb{R}^n$, $\mathbf{R} \in \mathbb{R}^{m \times n}$ and $\mathbf{z} \in \mathbb{R}^m$. If $\mathbf{R}_{ij} \stackrel{i.i.d.}{\sim} \mathcal{N}(0,\frac{1}{pm})$ and $\mathbf{z}_{i} \stackrel{i.i.d.}{\sim} \text{Bernoulli}(p)$, then for any fixed vector $\mathbf{u}$, $\mathbb{E}[\lVert \mathbf{v} \rVert^2] = \lVert \mathbf{u} \rVert^2$.
\end{lemma}
The proof of this lemma involves analytically computing the expectation of the vector norm by exploiting the fact that each dimension of $\mathbf{v}$ is a sum of Gaussian random variables multiplied to an independent Bernoulli random variable. This lemma reveals the variance of the 0 mean Gaussian distribution from which the weights must be sampled in order for the vector norm to be preserved in expectation. Since $ \mathbbm{1}(\mathbf{a}^l)$ is sampled from a 0.5 probability Bernoulli, we have that the weights must be sampled from a Gaussian with variance $2/m$. We now show this property holds for a finite width network.
\begin{lemma}
\label{lemma_1layer_length_preservation_bwd}
Let $\mathbf{v} = \left(\mathbf{R} \mathbf{u}\right) \odot \mathbf{z}$, where $\mathbf{u} \in \mathbb{R}^n$, $\mathbf{z} \in \mathbb{R}^m$, and $\mathbf{R} \in \mathbb{R}^{m \times n}$. If $\mathbf{R}_{ij} \stackrel{i.i.d.}{\sim} \mathcal{N}(0,\frac{1}{0.5m})$, $\mathbf{z}_{i} \stackrel{i.i.d.}{\sim} \text{Bernoulli}(0.5)$ and $\epsilon \in [0,1)$, then for any fixed vector $\mathbf{u}$,
\begin{align}
\Pr\left(| \lVert \mathbf{v}\rVert^{2} - \lVert \mathbf{u}\rVert^{2} | \leq \epsilon \lVert \mathbf{u}\rVert^{2} \right) \nonumber\\
\geq 1 - 2\exp \left(-m \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
\end{lemma}
The proof of this lemma involves a direct application of the Chernoff bounding technique. Having shown that a finite width ReLU layer can preserve gradient norm, we now note that we need to apply this result to Eq. (\ref{eq_dlda_decomposition}). In this case, we must substitute the matrix $\mathbf{R}$ in the above lemma with the network's weight matrix $\mathbf{W}^{{l+1}^T}$. In the previous subsection, we showed that each element of the matrix $\mathbf{W}^{l+1}$ must be sampled from $\mathcal{N}(0,2/n_{l+1})$ in order for the norm of the input vector to be preserved. However, in order for the Jacobian norm to be preserved, we require $\mathbf{W}^{l+1}$ to be sampled from $\mathcal{N}(0,2/n_{l})$ as per the above lemma. This suggests that if we want the norms to be preserved in the forward and backward pass for a single layer simultaneously, it is beneficial for the width of the network to be close to uniform. The reason we want them to simultaneously hold is because as shown in Eq. (\ref{eq_grad_norm_decomposition}), in order for the parameter gradient norm to be same for all layers, we need the norm of both the Jacobian $\lVert \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{a}^l} \rVert_2$ as well as the hidden activation $\lVert \mathbf{h}^{l-1} \rVert_2 $ to be preserved throughout the hidden layers. Therefore, assuming the network has a uniform width, we now prove that in deep ReLU networks with He initialization, the norm of weight gradient for each layer is simply a product of norm of the input and norm of the error at output.
\begin{theorem}
\label{theorem_deep_relu_grad_preservation}\footnote{Similar to \cite{he2016deep}, we have assumed that $\frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{a}^{l+1}}$ in independent from $ \mathbbm{1}(\mathbf{a}^l)$ and $\mathbf{W}^{l+1}$ at initialization.}
Let $\mathcal{D}$ be a fixed dataset with $N$ samples and define a $L$ layer ReLU network as shown in Eq. \ref{eq_relu_layer} such that each weight matrix $\mathbf{W}^l \in \mathbb{R}^{n \times n}$ has its elements sampled as ${W}^l_{ij} \stackrel{i.i.d.}{\sim} \mathcal{N}(0,\frac{2}{n})$ and biases $\mathbf{b}^l$ are set to zeros. Then for any sample $(\mathbf{x}, \mathbf{y}) \in \mathcal{D}$, $\epsilon \in [0,1)$, and for all $l \in \{ 1,2, \hdots , L \}$ with probability at least,
\begin{align}
1 - 4NL\exp \left(-n \left( \frac{\epsilon}{4} + \log \frac{2}{1 + \sqrt{1+\epsilon}} \right)\right)
\end{align}
the following hold true,
\begin{align}
(1-\epsilon)^L\lVert \mathbf{x}\rVert^{2} \cdot \lVert \delta(\mathbf{x},\mathbf{y}) \rVert^2 \leq \lVert \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{W}^l} \rVert^{2} \nonumber\\
\leq (1+\epsilon)^L\lVert \mathbf{x}\rVert^{2} \cdot \lVert \delta(\mathbf{x},\mathbf{y}) \rVert^2
\end{align}
and
\begin{align}
(1-\epsilon)^l\lVert \mathbf{x}\rVert^{2} \leq \lVert \mathbf{h}^l\rVert^{2} \leq (1+\epsilon)^l\lVert \mathbf{x}\rVert^{2}
\end{align}
\end{theorem}
We note that even though the theorem relies on the specified independence assumption similar to \cite{he2016deep}, we show that our predictions hold in practice in the next section.
\section{Empirical Verification}
\subsection{Norm Preservation of Activation and Gradients}
\label{sec_norm_preservation_exp}
In this section, we verify the hidden activations have the same norm as input norm $\frac{\lVert \mathbf{h}^i \rVert_2}{\lVert \mathbf{x} \rVert_2} \approx 1$ (Eq. \ref{eq_hidden_approx_input_norm}), and the parameter gradient norm approximately equal the product of input norm and output error norm $\frac{\lVert \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{W}^i} \rVert_F}{ \lVert \delta(\mathbf{x},\mathbf{y}) \rVert_2 \cdot \lVert \mathbf{x} \rVert_2} \approx 1$ (Eq. \ref{eq_grad_norm_approx_decomposition})
for all layer indices $i$ for sufficiently wide deep ReLU networks. For this experiment we choose a 10 layer network with 2000 randomly generated input samples in $\mathbf{R}^{500}$ and randomly generated target labels in $\mathbf{R}^{20}$ and cross-entropy loss. We add a linear layer along with softmax activation to the ReLU network's outputs to make the final output in $\mathbf{R}^{20}$. We use network width from the set $\{100,500,2000,4060\}$. We show results for both He initialization \citep{he2015delving} which we theoretically show is optimal, as well as Glorot initialization \citep{glorot2010understanding} which is not optimal for deep ReLU nets. As can be seen in figure \ref{fig:norm_per_layer} (left), the mean ratio of hidden activation norm to the input norm over the dataset is roughly 1 with a small standard deviation for He initializaiton. This approximation becomes better with larger width. On the other hand, Glorot initialization fails at preserving activation norm for deep ReLU nets. A similar result can be seen for parameter gradients norms (figure \ref{fig:norm_per_layer} (right)). In the figure we denote $\frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{W}^i}$ by $\partial \mathbf{W}^i$. Here we find for He initialization that the norm of weight gradient for each layer is roughly equal to the product of norm of input and norm of error at output, and this approximation becomes stronger for wider networks. Once again Glorot initialization does not have this property.
\begin{figure}
\centering
\includegraphics[width=0.45\linewidth]{figs/norm_per_layer_fwd.png}
\hfill
\includegraphics[width=0.45\linewidth]{figs/norm_per_layer_bwd.png}
\caption{For He initialization, the norm of hidden activation $ \mathbf{h}^i$ roughly equals the norm of input $ \mathbf{x}$; and the norm of weight gradient $\partial \mathbf{W}^i := \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{W}^i}$ roughly equals the product of norm of input $ \mathbf{x}$ and the norm of output error $\delta(\mathbf{x},\mathbf{y})$ when width is sufficiently large. Glorot initialization does not have this property.}
\label{fig:norm_per_layer}
\vspace{8pt}
\end{figure}
\begin{figure}[t]
\centering
\includegraphics[width=0.45\linewidth]{figs/bound_comparison.png}
\hfill
\includegraphics[width=0.45\linewidth]{figs/bound_comparison_bwd.png}
\caption{Tightness of lower bounds on network width derived in lemma \ref{lemma_1layer_length_preservation} and lemma \ref{lemma_1layer_length_preservation_bwd} shown in the left sub-figure and right sub-figure respectively. See text for more details.}
\label{fig:bound_comparison}
\end{figure}
\subsection{Tightness of Bound}
In the following experiment we verify the tightness of the bound in lemma \ref{lemma_1layer_length_preservation} (for forward pass) and lemma \ref{lemma_1layer_length_preservation_bwd} (for backward pass). To do so, we vary the network width of a one hidden layer ReLU transformation from 500 to 4000, and feed 2000 randomly sampled inputs $\mathbf{x}$ through it. For each sample we measure the distortion $\epsilon$ defined as,
\begin{align}
\epsilon := \bigg| 1 - \frac{\lVert \mathbf{h} \rVert}{\lVert \mathbf{x} \rVert} \bigg|
\end{align}
for the forward pass, and,
\begin{align}
\epsilon := \bigg| 1 - \frac{\lVert \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{W}^i} \rVert_F}{ \lVert \delta(\mathbf{x},\mathbf{y}) \rVert_2 \cdot \lVert \mathbf{x} \rVert_2} \bigg|
\end{align}
for the backward pass. Here $\mathbf{h}$ is the output of the one hidden layer ReLU transformation. We compute the mean value of $\epsilon$ for the 2000 examples and plot them against the network width used. We call this the empirical estimate. We simultaneously plot the values of $\epsilon$ predicted by lemma \ref{lemma_1layer_length_preservation} and lemma \ref{lemma_1layer_length_preservation_bwd} for failure probability $\delta=0.05$. We call this the theoretical value. The plot for the forward pass is shown in figure \ref{fig:bound_comparison} (left). As can be seen, our lower bound on width is an over-estimation but becomes tighter for smaller values of $\epsilon$. A similar result can be seen for lemma \ref{lemma_1layer_length_preservation_bwd} in figure \ref{fig:bound_comparison} (right). Thus our proposed bounds can be improved and we leave that as future work.
\begin{figure}[t]
\centering
\includegraphics[width=0.9\linewidth]{figs/width_variation.pdf}
\caption{Effect of non-uniformity of width in deep ReLU network on the gradient norm equality property. For each of the three networks, width of each layer is selected independently from $\mathcal{U}(1000-v, 1000+v)$, where $v$ is the width variation shown in the plot. Gradient norm equality holds more accurately when width variation is smaller.}
\label{fig:width_variation}
\end{figure}
\subsection{Effect of Non-uniformity of Width on Gradient Norm Equality}
As discussed in section \ref{sec_back}, gradient norm equality property holds more accurately when deep networks have a more uniform width throughout the layers. To verify this, we construct a 20 layer deep ReLU network such that the width of each layer is determined by independently sampling uniformly between $1000-v$ and $1000+v$, where $v$ denotes the amount of width variation chosen for a particular experiment. Once the network architecture is fixed, we initialize the weights with He initialization. We then generate 1000 pairs of input samples and output error similar to the process described in section \ref{sec_norm_preservation_exp} and compute the ratio $\frac{\lVert \frac{\partial \ell(f_{\mathbf{\theta}}(\mathbf{x}), \mathbf{y})}{\partial \mathbf{W}^i} \rVert_F}{ \lVert \delta(\mathbf{x},\mathbf{y}) \rVert_2 \cdot \lVert \mathbf{x} \rVert_2}$. The mean and standard deviation of this value across samples are shown in figure \ref{fig:width_variation} for $v \in \{1,200,500 \}$. It can be seen that the ratio is closer to 1 with smaller variance when width variation $v$ is small, thus verifying our theoretical prediction.
\section{Conclusion}
We derived novel properties that are possessed by deep ReLU networks initialized with He initialization. Specifically, we show that the norm of hidden activations and the norm of weight gradients are a function of the norm of input data and error at output. While deriving these properties, we relaxed most of the assumptions (such as those on input distribution and width of network) made by previous work that study weight initialization in deep ReLU networks. Thus our work establishes that He initialization optimally preserves the flow of information in the forward and backward directions in a stronger setting, and uncovers novel properties.
\section*{Acknowledgments}
We would like to thank Giancarlo Kerg for proofreading the paper and Alex Trott for helpful feedback on writing. DA was supported by IVADO during his time at Mila.
| {'timestamp': '2019-10-03T02:18:19', 'yymm': '1901', 'arxiv_id': '1901.03611', 'language': 'en', 'url': 'https://arxiv.org/abs/1901.03611'} | arxiv |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.