\subsection{Observables}
\label{sec:observables}
This research explores the Higgs boson $h$ leptonically decay to $\tau\tau$ in Large Hadrons Collider (LHC) $p p$ collisions with Higgs boson production mode independently.  Yukawa coupling is put forward to parametrize the interactions between the two handedness of fermions and the Higgs field. Especially, the general model-independent effective Yukawa interactions of $h$ with $\tau$ leptons can be described as follows[Berge:2015nua]:
%
\begin{equation}
	\mathcal{L}_{h\tau\tau} = - \frac{m_{\tau}}{v} \kappa_{\tau} (\cos\phi_{\tau}\bar{\tau}\tau + \sin \phi_{\tau}\bar{\tau}i\gamma_{5}\tau)h
\end{equation}
%
where $v=246\,Gev$, $\kappa_{\tau}>0$ is the reduced Yukawa coupling
strength, and \PhiTau $\in [-\pi/2, \pi/2]$ is the "\CP -mixing" angle that parameterizes the relative contributions of the \CP -even and \CP -odd components to the \htt coupling. Fig.\ref{fig:observables:angular} shows $\tau$ decay products in $\tau\tau$ Zero momentum frame (ZMF) where the $\tau\tau$ system is at rest with (a) scalar and (b) pseudo-scalar \htt couplings respectively. Accordingly, within scalar coupling, \PhiTau $= 0$ and the visible products tend to be anti-parallel, which are described thoroughly in SM theory. While within pseudo-scalar coupling, \PhiTau $= \pi/2$ and the visible products tend to be parallel, which is the indication of maximally parity-violating weak interaction in the $\tau$ decay. Naturally, \PhiTau $\in (-\pi/2, \pi/2)$ corresponds to the \CP-odd and \CP-even mixed state.
%
\begin{figure}[h!]
	\begin{center}
		\begin{tabular}{ccc}
			\includegraphics[width=.6\textwidth]{figures/observables/Angular correlations}
		\end{tabular}
	\end{center}
	\caption{Angular correlations of the tau decay products from $h^0/A^0$ $\rightarrow \tau^+\tau^-$ decays in case of a (a) scalar or (b) pseudo-scalar Higgs boson (taken from [Berge\_BonnSeminar])}
	\label{fig:observables:angular}
\end{figure}

\begin{figure}[h!]
	\begin{center}
		\begin{tabular}{ccc}
			\includegraphics[width=.3\textwidth]{figures/observables/phiCP.jpg}
		\end{tabular}
	\end{center}
	\caption{Schematic diagram of a $h\rightarrow \tau^{\pm} \rightarrow \pi^{\pm} + 2 \nu$ decay in the \tautau Zero Momentum Frame}
	\label{fig:observables:phiCP}
\end{figure}
%

The differential decay width of $h \rightarrow \tau^+\tau^-$ is proportional to:
%
\begin{equation}
	d\mathrm{\Gamma}_{h\tau\tau} \propto 1 - s_{z}^{-}s_{z}^{+} + \cos(2\phi_{\tau})(s_{\perp}^{-}\cdot s_{\perp}^{+}) + \sin(2\phi_{\tau})[(s_{\perp}^{-}\times s_{\perp}^{+})\cdot\hat{k}^{-}]
	\label{eq:decay_width_htt}
\end{equation}
%
where $\hat{k}^{-}$ is the normalised $\tau^{-}$ spatial momentum in
the Higgs boson rest frame, $\hat{s}^{\pm}$ are the unit spin vectors
of $\tau^{\pm}$ in their respective tau rest frames, and
$s_{z}^{\pm}(s_{\perp}^{\pm})$ are the longitudinal (transverse)
components of $\hat{s}^{\pm}$ with respect to $\hat{k}^{-}$.

From Eq.\ref{eq:decay_width_htt}, the observable acoplanarity angle \phiCP can be introduced:
%
\begin{equation}
	\frac{1}{\mathrm{\Gamma}}\frac{d\mathrm{\Gamma}(h\rightarrow \tau\tau \rightarrow \pi^+\pi^-+2\nu)}{d\phi_{CP}} \propto 1 - \frac{\pi^2}{16}\cos(\phi_{CP}-2\phi_{\tau})
	\label{eq:phistar_distribution}
\end{equation}
%
where \phiCP $\in[0,2\pi]$ is the acoplanarity angle between the tau leptons decay
planes spanned by the $\tau^{\pm}$ spatial momentum in the Higgs boson
rest frame and the $\pi^{\pm}$ spatial momentum in the $\tau^{\pm}$
rest frame, as shown in Fig~\ref{fig:observables:phiCP}.

However, in $h\rightarrow \tau^{\pm} \rightarrow \pi^{\pm} + 2 \nu$ decay, the invisible neutrinos lead to the Higgs boson ZMF and \tautau ZMF unreachable. Therefore the approximate \tautau ZMF is built based on the visible part of the \tautau lepton decay (charged and neutral pions), in which the quantities are denoted with an asterisk (*). \phistarCP is therefore the acoplanarity angle defined in this visible \tautau system ZMF.


\section{Graphs}

\frame{
{Part 1: Graph Definitions}

\tableofcontents[currentsection,hideallsubsections, firstsection=1, sections={1-3}]
}

\subsection{Motivations}

\begin{frame}{Using Graphs to Solve Problems}{Course Registration}

  We can represent a list of courses in a university, and their requirements, using a graph structure. For example, to take \emph{"Computer Graphics"}, you need to take \emph{"Programming Theory"} and \emph{"Linear Algebra"} first.\medskip

  If you take two lectures per semester, how long would it take you to graduate? Why?

  \begin{tabular}{p{.1\textwidth}|p{.45\textwidth}||p{.3\textwidth}}
    \hline
    Code & Lecture & Prerequisites \\
    \hline
    0000 & {\small Social Questions} & \emph{none} \\
    0001 & {\small Intro to Programming} & \emph{none} \\
    0002 & {\small Calculus I} & \emph{none} \\
    0003 & {\small Programming Theory} & \emph{0001} \\
    0004 & {\small Linear Algebra} & \emph{0000, 0002} \\
    0005 & {\small Programming Challenges} & \emph{0000, 0001, 0003} \\
    0006 & {\small Computer Graphics} & \emph{0003, 0004} \\
    \hline
  \end{tabular}
\end{frame}

\begin{frame}{Using Graphs to Solve Problems}{Course Registration}

  The university proposes a new lecture, \emph{"Maths for Computer Science"}. The updated table is below. \medskip

  How long does it take to graduate now? Why?

  \begin{tabular}{p{.1\textwidth}|p{.45\textwidth}||p{.3\textwidth}}
    \hline
    Code & Lecture & Prerequisites \\
    \hline
    0000 & {\small Social Questions} & \emph{none} \\
    0001 & {\small Intro to Programming} & \emph{none} \\
    0002 & {\small Calculus I} & \emph{none} \\
    0003 & {\small Programming Theory} & \emph{0001, {\bf 0007}} \\
    0004 & {\small Linear Algebra} & \emph{0000, 0002} \\
    0005 & {\small Programming Challenges} & \emph{0000, 0001, 0003} \\
    0006 & {\small Computer Graphics} & \emph{0003, 0004} \\
    {\bf 0007} & {\small {\bf Maths for Computer Science}} & {\bf\emph{0005}} \\
    \hline
  \end{tabular}
\end{frame}

\begin{frame}{Using Graphs to Solve Problems}{Airplane}
  \begin{columns}

    \column{0.3\textwidth}
    In an airport, each airplane needs a gate when it is on the ground.\medskip

    If we know the landing and departing time of each plane, what is the minimum number of gates necessary?
    \column{0.7\textwidth}
    \includegraphics[width=\textwidth]{../img/gatetable}
  \end{columns}
\end{frame}

\begin{frame}[t]{Problems as Graphs}
  Many problems that can be described by the \emph{relationship} betwene entities in the problem can be represented as graphs.\bigskip

  \begin{itemize}
    \item A course is a prerequisite to another one;
    \item Two planes are landed at the same time;
    \item Webpages and the links between them;
  \end{itemize}\bigskip

  These relationships can be described mathematically using a graph structure.
\end{frame}

\subsection{Definitions}

\begin{frame}[t]{Graph Basic Definitions}

    \begin{columns}
      \column{0.4\textwidth}
      \begin{center}
        \input{../graphs/simple_dag.tex}
      \end{center}

      \column{0.6\textwidth}
        A {\bf graph} $G$ is defined by a set of vertices $V$, and a set of edges $E$.\bigskip

        \begin{itemize}
          \item $G = (V,E)$
          \item $V = \{a,b,c,d\}$
          \item $E = \{(a,b), (a,c), (c,b), (d,c), (d,a)\}$
        \end{itemize}\bigskip

         A {\bf directed graph (digraph)} is a graph where each edge has a {\bf direction}.\medskip

         An {\bf undirected graph} is a graph where the edges do not have a direction ($(a,b) \iff (b,a)$).
    \end{columns}
\end{frame}

\begin{frame}{Graphs and Relations}{Remember Lecture 2?}

  \begin{columns}
    \column{0.4\textwidth}
    \begin{center}
      \begin{tikzpicture}[scale=3,auto,swap]
      \tikzset{edge/.style = {->,>=latex'}}
      \node[vertex] (a) at (0,1) {a};
      \node[vertex] (b) at (1,1) {b};
      \node[vertex] (c) at (1,0) {c};
      \node[vertex] (d) at (0,0) {d};
      \draw[edge] (a) to (c);
      \draw[edge] (a) to (b);
      \draw[edge] (c) to (b);
      \end{tikzpicture}
    \end{center}
    \column{0.6\textwidth}

    Graph $G = (V, E)$
    \begin{itemize}
      \item $V = \{a,b,c,d\}$
      \item $E = \{(a,c),(a,b),(c,b)\}$
    \end{itemize}\bigskip

    A digraph with vertices $V$ can be understood as a \structure{binary relation $V \to V$}\bigskip

    In the same way, every \structure{binary relation} can be written as a directed graph too.
  \end{columns}
\end{frame}

\begin{frame}{Matrix Representation of a Digraph}

  \begin{columns}
    \column{0.5\textwidth}
    \begin{center}
    \begin{tikzpicture}[scale=1.5,auto,swap]
      \tikzset{edge/.style = {->,>=latex'}}
      \node[vertex] (a) at (0,1) {a};
      \node[vertex] (b) at (0,0) {b};
      \node[vertex] (c) at (0,-1) {c};
      \node[vertex] (d) at (2,0) {d};
      \node[vertex] (e) at (3,1) {e};
      \node[vertex] (f) at (3,-1) {f};
      \draw[edge] (a) to (b);
      \draw[edge] (c) to (b);
      \draw[edge] (b) to (d);
      \draw[edge] (d) to (a);
      \draw[edge] (c) to (d);
      \draw[edge] (d) to (e);
      \draw[edge] (e) to (f);
      \draw[edge] (f) to (d);
    \end{tikzpicture}
  \end{center}

    \column{0.5\textwidth}

    {\larger
      \begin{tabular}{c|cccccc}
        & a & b & c & d & e & f \\
        \hline
        a &0&1&0&0&0&0\\
        b &0&0&0&1&0&0\\
        c &0&1&0&1&0&0\\
        d &1&0&0&0&1&0\\
        e &0&0&0&0&0&1\\
        f &0&0&0&1&0&0\\
      \end{tabular}
    }\medskip

    {\bf Adjacency Matrix}
  \end{columns}
  \bigskip

  An \structure{Adjacency Matrix} A represents a digraph, when $A_{i,j}$ is 1 if $v_i \to v_j$, and 0 if not.

  \begin{equation*}
    A(v_i,v_j) = 1 \iff E(v_i) = v_j
  \end{equation*}
\end{frame}


% !TEX TS-program = pdflatexmk
\documentclass{article} % For LaTeX2e
\usepackage{nips15submit_e,times}
\usepackage{hyperref}
\usepackage{url}
%\documentstyle[nips14submit_09,times,art10]{article} % For LaTeX 2.09

\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}

\newtheorem{theorem}{Theorem}
\newtheorem{corollary}{Corollary}[theorem]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{example}{Example}[theorem]

\theoremstyle{definition}
\newtheorem{definition}{Definition}

\newcommand\myeq{\stackrel{\mathclap{\tiny\mbox{d}}}{=}}

\newcommand\mb{\mathbf}
\newcommand\mc{\mathcal}
\newcommand\bs{\boldsymbol}

\title{Gaussian Process Tensor Factorisation}

\author{
Dongwoo Kim
}

% The \author macro works with any number of authors. There are two commands
% used to separate the names and addresses of multiple authors: \And and \AND.
%
% Using \And between authors leaves it to \LaTeX{} to determine where to break
% the lines. Using \AND forces a linebreak at that point. So, if \LaTeX{}
% puts 3 of 4 authors names on the first line, and the last on the second
% line, try using \AND instead of \And before the third author name.

\newcommand{\fix}{\marginpar{FIX}}
\newcommand{\new}{\marginpar{NEW}}

\nipsfinalcopy % Uncomment for camera-ready version

\begin{document}

\maketitle

\begin{abstract}
This is abstract.
\end{abstract}

\section{Gaussian Process Regression}

\subsection{Notations}
We denote scalars by lower case letters (e.g. $x$), vectors by bold lower case letters (e.g. $\mb x$), matrices by upper case letters (e.g. $A$), and tensors by calligraphic upper case letters (e.g. $\mc A$). The calligraphic letters are also used for probability distributions (e.g. $\mc{N}(\mu, \sigma^2)$).
We use $X_{ij}$ and $\mc{X}_{ijk}$ to represent the $(i,j)$ and $(i,j,k)$ entry of matrix $X$ and tensor $\mc{X}$, respectively.
\subsection{Linear Regression to GP}

From linear model to Gaussian Process (GP).

Bayesian analysis of the standard linear regression model with Gaussian noise is
\begin{equation}
f(\mb{x}) = \mb{x}^\top \mb{w}, \quad \quad y = f(\mb{x}) + \epsilon,
\end{equation}
where $\mb{x} \in \mathbb{R}^p$ is the input vector, $\mb{w}$ is a vector of weights, and $y$ is the observed target value. In general, the additional noise $\epsilon$ is distributed i.i.d Gaussian distribution with zero mean and variance $\sigma^2$
\begin{equation}
\epsilon \sim \mc{N}(0, \sigma^2).
\end{equation}

With an additional assumption on the prior distribution over $\mb{w}$, we can fully specify the Bayesian linear regression model. We put a zero mean Gaussian prior with covariance matrix $\Sigma$ on the weights
\begin{equation}
\mb{w} \sim \mc{N}(\mb{0}, \Sigma).
\end{equation}
The joint distribution of multiple observations $\mc{D} = \{(\mb{x}_i, y_i)|i=1,...,n\}$ is
\begin{align}
p(\mb{y}|X, \mb{w}) = \prod_{i=1}^{n} p(y_i|\mb{x}_i, \mb{w}) = \prod_{i=1}^{n} \frac{1}{\sqrt{2\pi}\sigma}\exp(-\frac{(y_i - \mb{x}_i^\top \mb{w})^2 }{2\sigma}),
\end{align}
where $X \in \mathbb{R}^{n \times p}$ is a collection of vector $\bf x$, and then the posterior is
\begin{align}
p(\mb{w}|X, \mb{y}) = \frac{p(\mb{y}|X,\mb{w})p(\mb{w})}{p(\mb{y}|X)}.
\end{align}
Important properties of this linear model is its marginal and predictive distributions. First, the marginal distribution follows
\begin{align}
p(\mb{y}|X) & = \int p(\mb{y}, \mb{w}|X) d\mb{w} = \int p(\mb{y} | \mb{w}, X) p(\mb{w}) d\mb{w} \\
& =  \mc{N}(\mb{y} | \mb{0}, \frac{1}{\sigma^{2}}I + X\Sigma X^\top)
\end{align}
If we project the input vector $x$ into feature space through a basis function $\phi$, then there exists a function $\psi$ such that kernel $\kappa(\mb{x}, \mb{x}') = \phi(\mb{x})\Sigma\phi(\mb{x}')$ can be represented by a simple dot product $\kappa(\mb{x}, \mb{x}') = \psi(\mb{x})\psi(\mb{x}')$, and this corresponds to the GP with zero mean function.

\section{Gaussian Process Matrix Factorisation}
We now consider the GP for a matrix factorisation. Given an observed matrix $X \in \mathbb{R}^{n\times m}$, suppose there are latent factor $\mb{u}_i$ for $i$-th row and $\mb{v}_j$ for $j$-th row and feature mapping $\phi$ from the factor space to the feature space. Let matrix $U \in \mathbb{R}^{n \times d}$ and $V \in \mathbb{R}^{m \times d}$ are the collection of feature representation of the latent factors. We extend the linear model to bi-linear model as follow:
\begin{align}
F = U^\top W V \quad X_{ij} = F_{ij} + \epsilon,
\end{align}
where weight matrix $W$ models the interaction between two latent factors $U_i$ and $V_j$, and again $\epsilon$ represents an independent zero-mean Gaussian noise with variance $\sigma^2$. We put a zero mean matrix-normal prior on the weight
\begin{align}
W \sim \mc{N}_{n\times m}(\mb{0}, \Sigma_{1}, \Sigma_{2})
\end{align}
or equivalently
\begin{align}
\text{vec}(W) \sim \mc{N}(\mb{0}, \Sigma_{1} \otimes \Sigma_{2}).
\end{align}
The marginal distribution of $F$ given $U$ and $V$ without noise $\epsilon$ is
\begin{align}
p(F|U,V) & = \int p(F|U,V,W)p(W) dW \\
& =  \mc{N}(\text{vec}(F)|\mb{0}, (U\otimes V)(\Sigma_{1} \otimes \Sigma_{2})(U\otimes V)^\top)\\
& =  \mc{N}(\text{vec}(F)|\mb{0}, (U \Sigma_{1} U^\top) \otimes (V \Sigma_{2} V^\top) )\\
& =  \mc{N}_{n\times m}(F|\mb{0}, (U \Sigma_{1} U^\top), (V \Sigma_{2} V^\top) ) \label{eqn:matrix_gp},
\end{align}
which is again a matrix normal distribution.
If we simplify the covariance matrices and use identity matrices, then the bilinear model corresponds to the GP model with a product kernel, each of which has a simple dot product representation. One could define a kernel function between latent factors directly instead. For example, in \cite{Lloyd2013}, they use an exponential squared euclidean distance between two entries $(i,j)$ and $(i',j')$ (RBF),
\begin{align}
\kappa((U_i, V_j), (U_{i'}, V_{j'})) = s^2 \exp\bigg(-\frac{(U_i - U_{i'})^2 + (V_j - V_{j'})^2}{2\ell^2}\bigg),
\end{align}
as a kernel function to model a random graph structure.

\section{Gaussian Process Tensor Factorisation}
We generalise the matrix case to $K$-mode tensor $\mc{Y} \in \mathbb{R}^{n_1 \times n_2 \times ... \times n_k}$. The Tucker family of tensor decomposition methods factorise the observed tensor into the latent space
\begin{align}
\mc{Y} = \mc{W} \times_{k=1}^{K} U^{(k)}
\end{align}
where $\mc{W} \in \mathbb{R}^{d_1 \times d_2 \times ... \times d_K}$ is a core tensor, and $U^{(k)} \in \mathbb{R}^{n_{k} \times d_k}$ is the $k$ latent factor matrix. For the prior of the core tensor $\mc{W}$, we assume that every entry of the tensor is independent, and the tensor follows a zero-mean tensor-variate normal distribution
\begin{align}
\mc{W} \sim \mc{TN}_{n_1 \times n_2 \times ... \times n_k}(\mb{0}, \{\Sigma^{(k)}\}_{k=1}^{K})
\end{align}
which is equivalent to
\begin{align}
\text{vec}(\mc{W}) \sim \mc{N}(\mb{0}, \otimes_{k=1}^{K} \Sigma^{(k)}).
\end{align}
We also assume independent Gaussian noise for each entry of tensor $\mc{Y}$ as follow:
\begin{align}
p(y_{i_1i_2...i_k}|\mc{W}, \{U^{(k)}\}_{k=1}^{K}) = \mc{N}(y_{i_1i_2...i_k}|\sum_{r_k=1}^{d_K}...\sum_{r_2=1}^{d_2}\sum_{r_1=1}^{d_1} w_{r_{1}r_{2}...r_{k}} U^{(1)}_{i_1r_1}U^{(2)}_{i_2r_2}...U^{(k)}_{i_kr_k}, \sigma^2)
\end{align}
Again, we can marginalise the core tensor $\mc{W}$ via Gaussian identity
\begin{align}
p(\mc{Y}|\{U^{(k)}\}_{k=1}^{K}, \{\Sigma^{(k)}\}_{k=1}^{K}) & = \mc{N}(\text{vec}(\mc{Y})| \mb{0}, \otimes_{k=1}^{K}U^{k} \otimes_{k=1}^{K}\Sigma^{(k)} {\otimes_{k=1}^{K}U^{k}}^\top) \\
& = \mc{TN}_{n_1 \times n_2 \times ... \times n_k}(\mc{Y}| \mb{0}, \{U^{(k)}\Sigma^{(k)}{U^{(k)}}^\top \}_{k=1}^{K})
\end{align}
This generalise the matrix case in Equation \ref{eqn:matrix_gp} to the tensor case.

\appendix
\section{Conditional and Marginal Gaussian}
Given a joint distribution Gaussian distribution $\mc{N}(\mb{x}|\bs{\mu}, \bs{\Sigma})$ where
\begin{align}
\mb{x} =
 \begin{pmatrix}
  \mb{x}_{a} \\
  \mb{x}_{b}
 \end{pmatrix},
\quad
\bs{\mu} =
 \begin{pmatrix}
  \bs{\mu}_{a} \\
  \bs{\mu}_{b}
 \end{pmatrix},
\quad
\bs{\Sigma} =
 \begin{pmatrix}
  \bs{\Sigma}_{aa} & \bs{\Sigma}_{ab} \\
  \bs{\Sigma}_{ba} & \bs{\Sigma}_{bb}
 \end{pmatrix},
\end{align}
the conditional distribution of $\mb{x}_a$ given partial observations $\mb{x}_b$ follows
\begin{align}
p(\mb{x}_a|\mb{x}_b) = \mc{N}(\mb{x}_a|\bs{\mu}_{a|b}, \bs{\Sigma}_{a|b}),
\end{align}
where
\begin{align}
\bs{\mu}_{a|b} &= \bs\mu_{a} - \bs\Sigma_{ab}\bs\Sigma_{bb}^{-1}(\mb{x}_b - \bs{\mu}_b) \\
\bs{\Sigma}_{a|b} &= \bs\Sigma_{aa} - \bs\Sigma_{ab}\bs\Sigma_{bb}^{-1}\bs\Sigma_{ba}.
\end{align}

The marginal distribution of $\mb{x}_a$ is given by
\begin{align}
p(\mb{x}_a) = \mathcal{N}(\mb{x}_a|\bs\mu_a,\bs\Sigma_{aa}).
\end{align}

\section{Bayes' theorem for Gaussian variables}
Let $p(\mb{x}) = \mc{N}(\bs\mu, \Lambda^{-1})$ and $p(\mb{y}|\mb{x}) = \mc{N}(\mb{y}|A\mb{x} + \mb{b}, L^{-1})$ where $\mb{x}$ and $\mb{y}$ are both gaussian distributed and $\mb{x}$ is a prior of $\mb{y}$. The marginal distribution of $\mb{y}$ is given by
\begin{align}
p(\mb{y}) = \mc{N}(\mb{y}|A\bs\mu + \mb b, L^{-1} + A\Lambda^{-1}A^\top),
\end{align}
and the conditional of $\mb{x}$ given $\mb{y}$ is given by
\begin{align}
p(\mb{x}|\mb{y}) = \mc{N}(\mb{x}|\Sigma(A^\top L(\mb y - \mb b) + \Lambda \bs\mu), \Sigma),
\end{align}
where $\Sigma = (\Lambda + A^\top L A)^{-1}$.

\bibliographystyle{apalike}
\bibliography{ref}

\end{document}


\section{Latency}

% An algorithm for closed-loop brain stimulation needs to be \emph{fast}, that is, have low latency between the onset of the event in the brain and the time of stimulation. In this section, we characterise this closed-loop latency.

% We base our latency analysis on a representative set of closed-loop disruption systems from the hippocampus literature \cite{Girardeau2009,Ego-Stengel2009,Jadhav2012,Girardeau2014,Talakoub2016,Ciliberti2017,Dutta2018}. For a detailed description of the systems used in these labs, and the differences and similarities between them, see \cref{A:real_systems}.

% We decompose the latency into a sequence of steps. Next, we estimate the time cost of each step. Finally, we propose what would constitute a good latency improvement, taking into account the state of the art in sharp-wave ripple detection, the biological effect of stimulus onset time, and the typical duration of an SWR event.

% % \subsection{Overview}
% \subsection{System description}

% \subsection{Transmission latencies}

% \subsection{Algorithmic latencies}

% The algorithmic latency of a linear filter can be accurately estimated a priori when the filter weights are known, using the filter's \emph{group delay} function. The following paragraph describes how this is done (see also \cref{fig:grpdelay}). We find that this technique matches the empirically observed latency well (compare \cref{fig:grpdelay} and fig. X).
% % todo: reference figure with empirical causal_IIR detection latency.

% For each frequency of the output signal that is used for event detection (i.e. all frequencies in the ripple band for ripple detection), we calculate the group delay $G(f)$ (\cref{fig:grpdelay-plot}). We define it as:
% \[
% 	G(f) = f_S\ \tau\left( 2 \pi \frac{f}{f_N} \right),
% \]
% with
% \[
% 	\tau(\omega) = - \dv{\omega}\ \angle H(\omega).
% \]
% $\angle H$ is the frequency-domain phase response of the bandpass filter, $\omega$ is a normalised angular frequency, \gls{fs} is the sampling frequency of the filtered signal, and \gls{fnyq} $= \frac{f_S}{2}$ is the corresponding Nyquist frequency. $G(f)$ then yields the delay, in seconds, of a frequency $f$ after passing through the linear filter \cite{Oppenheim2009,Lyons2010}. Calculating this delay for every frequency in the ripple band yields a delay distribution (\cref{fig:grpdelay-dist}), from which we can directly infer the algorithmic filter latency of the bandpass-filter-based SWR detector.

% \begin{figure}
% \begin{subfigure}{0.48\textwidth}
% 	\caption{Group delay $G(f)$ for the bandpass filter in a ripple detector}
% 	% todo: reference used filter
% 	\includegraphics[width=\textwidth]{plot/group_delay}
% 	\label{fig:grpdelay-plot}
% \end{subfigure}
% \hfill
% \begin{subfigure}{0.48\textwidth}
% 	\caption{Group delay distribution for frequencies in the ripple band}
% 	\includegraphics[width=\textwidth]{plot/delay_dist}
% 	\label{fig:grpdelay-dist}
% \end{subfigure}
% \caption{The latency introduced by linear bandpass filters can be accurately estimated a priori using the filter's group delay. \subref{fig:grpdelay-plot} The   The ripple band was defined here as 100--200 Hz (see section X). % todo
% (Boxplot whiskers extend to the 5th and the 95th percentiles of the data. `N' is the number of frequencies in the ripple band for which the group delay was calculated. Density estimate calculated with an exponential kernel (see \cref{sec:kde-kernels}). Kernel bandwidth selected using Silverman's rule of thumb \cite{Silverman1986}).}
% \label{fig:grpdelay}
% \end{figure}

% \subsection{Computational latencies}

% These are the latencies caused by the physical execution of the detection algorithm in hardware.

% % We assume that the signal processing algorithm is executed on a microcontroller or on a microprocessor (where the algorithm is specified in a programming language like C and runs as a sequence of steps), and not on an FPGA\footnotemark[1] or an ASIC\footnotemark[2] (where the algorithm is specified in a hardware description language and runs in parallel). As we will see

% % \footnotetext[1]{Field-Programmable Gate Array}
% % \footnotetext[2]{Application Specific Integrated Circuit}

% \subsection{State of the art}

% \subsection{Biological effect of stimulus time}

% % late: no deal

% \subsection{SWR event duration}

% \subsection{Conclusion}


\documentclass{article}
\usepackage{fullpage}
\usepackage{nopageno}
\usepackage{amsmath}
\usepackage{amssymb}
\allowdisplaybreaks

\newcommand{\abs}[1]{\left\lvert #1 \right\rvert}

\begin{document}
\title{Notes}
\date{February 21, 2014}
\maketitle

last time, we derived Pascal's equation:
\begin{align*}
  \binom{n}{k}&=\binom{n-1}{k-1}+\binom{n-1}{k}
\end{align*}
\section*{combinatorial proof:}

$\binom{n}{k}$ counts the number of $k$-elt subsets $S$ of $[n]$. 2 cases.
\subsubsection*{case 1}
$n\in S$ then the remaining elts of $S$ are chosen from $[n-1]$ in $\binom{n-1}{k-1}$ ways
\subsubsection*{case 2}
$n\not\in S$ then $S$ is made up of $k$-elts from $[n-1]$. There are $\binom{n-1}{k}$ such subsets.

Therefore $\binom{n}{k}=\binom{n-1}{k-1}+\binom{n-1}{k}$
$\Box$

\section*{fibanacci in pascal's triangle}
neat
\section*{combinatorial proof of binomial theorem}
$\overbrace{(x+y)(x+y)\dots(x+y)}^{n\text{-factors}}=(x+1)^n$. Each term in the sum arises from picking $x$ or $y$ in each of the $n$ factors. The coefficients of $x^ky^{n-k}$ counts the number of ways to pick $k$ $x$'s. This is counted by $\binom{n}{k}$
\section*{moving on}
notice if you set $x-y=1$, you obtain:
\begin{align*}
  2^n&=\sum\limits_{k=0}^n{\binom{n}{k}}
\end{align*}
if you set $y=1$ you get
\begin{align*}
  (1+x)^n&=\sum\limits_{k=0}^n{\binom{n}{k}x^k}
\end{align*}
\subsection*{wksht 6}
$x=3, y=1$ in binomial theorem.
\begin{align*}
  (3+1)^{10}&=\sum\limits_{k=0}^{10}{\binom{10}{k}3^k1^{10-k}}
  &=4^{10}
\end{align*}
\subsection*{wksht 7}
\subsection*{wksht 8}
Vandermonde convolution:
\begin{align*}
  000&\dots0&m\text{ things}\\
  000&\dots0&n\text{ things}\\
\end{align*}
choose k things
\subsection*{wksht 9}
calculus proof
\begin{align*}
  \sum\limits_{k=0}^n{k\binom{n}{k}x^{k-1}}&=\frac{\mathrm{d}}{\mathrm{d}x}\sum\limits_{k=0}^n{\binom{n}{k}x^k}\\
  &=\frac{\mathrm{d}}{\mathrm{d}x}(1+n)^n\\
  &=n(1+x)^{n-1}
\end{align*}
set $x=1$ $\sum\limits_{k=0}^n{k\binom{n}{k}}=n(1+1)^{n-1}=n2^{n-1}$
\section*{question}
What does this sum equal:
$\binom{n}{0}^2+\binom{n}{1}^2+\binom{n}{2}^2+\dots+\binom{n}{n}^2$
\begin{align*}
  \sum\limits_{k=0}^n{\binom{n}{k}^2}&=\sum\limits_{k=0}^n{\binom{n}{k}\binom{n}{n-k}}\\
  &=\binom{2n}{n}
\end{align*}
\section*{sidebar}
\subsection*{question:}is there any meaning to something like $\binom{12/7}{3}$?
\subsection*{answer}
for and $n\in\mathbb{R},k\in\mathbb{Z}$ let $\binom{n}{k}=\begin{cases}\frac{\overbrace{n(n-1)(n-2)\dots(n-k+1)}^{k \text{ factors}}}{k!}&\text{if } k\ge1\\1&\text{if }k=0\\0&\text{if }k\le-1\end{cases}$
\begin{align*}
  \binom{12/7}{3}&=\frac{12/7(12/7-1)(12/7-2)}{3!}=\frac{-20}{7^3}
\end{align*}
Is it a good definition? yes. e.g. it is true that
\begin{align*}
  \binom{12/7}{3}&=\binom{5/7}{2}+\binom{5/7}{3}
\end{align*}
\section*{iterate pascal's identity:}
\begin{align*}
  \binom{n}{k}&=\binom{n-1}{k}+\binom{n-1}{k-1}\\
  \binom{n}{k}&=\binom{n-1}{k}+\binom{n-1}{k-1}+\binom{n-2}{k-2}\\
\end{align*}
\end{document}


\paragraph{Soundness} When a  property is violated, if the method terminates, it always states that the property is violated
\paragraph{Completeness} When a property holds, the method is able to prove it
\paragraph{Incompleteness} When a property holds, the method might not be able to prove it (e.g. bounds propagation with convex relaxations)
\subsection*{Box Abstract Transformers}
\begin{itemize}
    \item $[a, b] \Sharp{+} [c, d] = [a+c, b+d]$
    \item $\Sharp{-} [a, b] = [-b, -a]$
    \item $\Sharp{ReLU}([a, b]) = [ReLU(a), ReLU(b)]$
    \item $\lambda \Sharp{\cdot} [a, b] = [\lambda \cdot a, \lambda \cdot b]$ for $\lambda \ge 0$
    \item $[a, b] \Sharp{\cdot} [c, d] = [\min(ac, ad, bc, bd), \max(ac, ad, bc, bc)]$
\end{itemize}


\section{Overview of the Up-Scaling Methodology}
The goal of the up-scaling methodology is to identify the parameters of a continuum constitutive model (macroscale model) that best emulates the average response in the DEM REV (microscale model). Let the displacement, strain and stress of the DEM REV (microscale) model be denoted by $\mathbf{u}^m$, $\boldsymbol{\epsilon}^m$, and $\boldsymbol{\sigma}^m$, respectively. Let the homogenized (averaged) strain and stress in the DEM REV model be denoted by  $\left<\boldsymbol{\epsilon}\right>$ and $\left<\boldsymbol{\sigma}\right>$, respectively.  Finally, let the strain and stress from the continuum (Macroscale) constitutive model be denoted as $\boldsymbol{\epsilon}^M$ and $\boldsymbol{\sigma}^M$, respectively. The rate of macroscale stress, $\dot{\boldsymbol{\sigma}}^M=\dot{\boldsymbol{\sigma}}^M\left(\dot{\boldsymbol{\epsilon}}^M, \boldsymbol{\chi},\mathbf{h}\right)$, is defined in terms of the rate of macroscale strain, $\dot{\boldsymbol{\epsilon}}^M$, a set of material parameters $\boldsymbol{\chi}$ and a set of internal history variables $\mathbf{h}$.

The up-scaling methodology has five steps:
\begin{enumerate}
    \item Identify the DEM REV for the NFR.
	\item Exercise the DEM REV using multiple load paths. Store $\mathbf{u}^m$, $\boldsymbol{\epsilon}^m$, and $\boldsymbol{\sigma}^m$ for each load path.
	\item Apply homogenization algorithms to the microscale results ($\mathbf{u}^m$, $\boldsymbol{\epsilon}^m$, and $\boldsymbol{\sigma}^m$) to determine the average stress-strain response of the REV, i.e., $\left<\boldsymbol{\sigma}\right>$-$\left<\boldsymbol{\epsilon}\right>$, for each load path.
	\item Identify a continuum constitutive model, $\dot{\boldsymbol{\sigma}}^M=\dot{\boldsymbol{\sigma}}^M\left(\dot{\boldsymbol{\epsilon}}^M, \boldsymbol{\chi},\mathbf{h}\right)$, that captures the salient features of NFR mechanics.
	\item Run parameter estimation algorithms to identify the parameters, $\boldsymbol{\chi}$, that minimize the difference between $\left<\boldsymbol{\sigma}\right>$-$\left<\boldsymbol{\epsilon}\right>$ and $\boldsymbol{\sigma}^M$-$\boldsymbol{\epsilon}^M$ over all load paths.
\end{enumerate}

Once an optimal parameter set, $\boldsymbol{\chi}$, for the desired model, $\dot{\boldsymbol{\sigma}}^M=\dot{\boldsymbol{\sigma}}^M\left(\dot{\boldsymbol{\epsilon}}^M, \boldsymbol{\chi},\mathbf{h}\right)$, has been identified, the newly established constitutive model can be used in Finite Element Method (FEM) models or with other suitable numerical or analytical simulations.

\subsection{Software Implementation}
The up-scaling framework that is presented here consists of four main software components (Figure \ref{fig:workflow}): a DEM simulator, a homogenization module, a FEM simulator, and a parameter estimation module. In procedural order, the first software component involved is a DEM simulation package, which is used to directly model the NFR. The DEM software accepts as inputs the geometry of the DFN, the material properties of the rock and the natural fractures, and the load paths. The DEM REV is exercised for different load-paths in a way that is akin to conducting multiple triaxial tests on physical specimens to characterize the full range of material behaviour. The DEM software outputs the microscale displacement, $\mathbf{u}^m$, and stress-strain, $\boldsymbol{\sigma}^m$-$\boldsymbol{\epsilon}^m$, responses for each load path.  This microscale data is subsequently fed into the homogenization module to compute the average stress-strain response, $\left<\boldsymbol{\sigma}\right>$-$\left<\boldsymbol{\epsilon}\right>$,  for each load path. Next, the homogenized stress-strain data, $\left<\boldsymbol{\sigma}\right>$-$\left<\boldsymbol{\epsilon}\right>$, is used by the parameter estimation software as observation data (i.e., laboratory/field data). The parameter estimation module iteratively executes a constitutive model, $\dot{\boldsymbol{\sigma}}^M=\dot{\boldsymbol{\sigma}}^M\left(\dot{\boldsymbol{\epsilon}}^M, \boldsymbol{\chi},\mathbf{h}\right)$, embedded in the FEM simulator for each load path using different parameter sets, $\boldsymbol{\chi}^i$, while attempting to minimize the error between the homogenized microscale, $\left<\boldsymbol{\sigma}\right>$-$\left<\boldsymbol{\epsilon}\right>$, and macroscale, $\boldsymbol{\sigma}^M$-$\boldsymbol{\epsilon}^M$,  stress-strain curves. Eventually, the algorithm converges to a near-optimal parameter set, $\boldsymbol{\chi}$, that can be viewed to be the best estimate of the NFR responses by the given continuum model. In our implementation, UDEC\textsuperscript{TM} was used as the DEM simulator and ABAQUS\textsuperscript{TM} was used as the FEM simulator. In ABAQUS\textsuperscript{TM} single element simulations were performed with a strain-history is prescribed through displacement boundary conditions for a given set of material parameters and the stress is obtained as the output. There is nothing particularly special about the DEM or FEM simulators chosen; each could easily be replaced to overcome any inherent limitations.  More over, a FEM simulator is not actually needed, since its inclusion in this framework is simply to gain access to the constitutive models within. The FEM simulator could easily be replaced by a FDM simulator or simply by a material subroutine.  OSTRICH, a model-independent optimization package \citep{matott_ostrich:_2016}, is used for the parameter estimation module. The homogenization module was written in-house in Python. Python was also used to interface and drive the various components of the up-scaling framework.


\chapter{Gravitational Force Models}

\section{Non-Gravitational Force Models}

\subsection{Solar Radiation Force Models}
The magnitude of the SRP acting on the satellite depends on a wide range of parameters.
The distance to the Sun and the position of the satellite with respect to Earth and Sun (regarding possible eclipses) define the intensity of the incoming radiation.
The geometry of the satellite, the optical properties of the external surfaces, and the actual orientation with respect to the Sun largely influence the orientation and magnitude of the evolving SRP.Therefore any SRP model depends on an accurate implementation of the satellite orbit, the attitude, and the geometric/physical properties of the satellite structure.

\subsection{Cannonball}
\label{sec:cannonball_srp}
The most basic approach with regard to its analytic development is referred to as the cannonball
model.The cannonball model provides a useful, first-order approximation, however, due to its homogeneous material properties and symmetrical shape approximation. We recommend its use as an apriori model, before estimation.

\subsection{ECOM I}
The ECOM I model has been widely used for a cubic-like satellite and is formed by three unit vectors as defined in the following:
\begin{equation}
e_d = r_{sun} - r_{sat} / |r_{sun} - r_{sat}|
\end{equation}
\begin{equation}
e_y = r_z \times e_d / |r_z \times e_d|
\end{equation}
\begin{equation}
e_b = e_d \times e_y
\end{equation}

Where
$e_d$ denotes the satellite-sun vector,
$e_y$ denotes the vector along the axis of the solar panel,
$e_b$ is given by the right-hand rule of ed and ey.
The total SRP acceleration $\ddot{r}_{srp}$ is expressed as

\begin{equation}
\ddot{r}_{srp} = D \cdot e_d + Y \cdot e_y + B \cdot e_b
\end{equation}
Where
$D$ denotes the total acceleration in ed,
$Y$ denotes the total acceleration in ey,
$B$ denotes the total acceleration in eb.
The D, Y and B can be expressed as

\begin{equation}
D = D_0 + D_C \cdot cos \Delta u + D_S \cdot sin \Delta u
\end{equation}
\begin{equation}
Y = Y_0 + Y_C \cdot cos \Delta u + Y_S \cdot sin \Delta u
\end{equation}
\begin{equation}
B = B_0 + B_C \cdot cos \Delta u + B_S \cdot sin \Delta u
\end{equation}

Where
$\Delta u$ denotes the argument of latitude of the satellite with respect to the Sun.

\subsection{ECOM II}
The ECOM II model has been widely used for an elongate-like satellite and is also formed by ed, ey and eb. The parameters of the ECOM II are different from the ECOM I:

\begin{equation}
\begin{split}
D = D_0 &+ D_2C \cdot cos 2\Delta u + D_2S \cdot sin 2\Delta u \\
        &+ D_4C \cdot cos 4\Delta u + D_4S \cdot sin 4\Delta u
\end{split}
\end{equation}
\begin{equation}
Y = Y_0
\end{equation}
\begin{equation}
B = B_0 + B_C \cdot cos \Delta u + B_S \cdot sin \Delta u
\end{equation}

\subsection{ECOM C}
The ECOM C model is resulted from the combination of ECOM I and ECOM II. The idea is to add the even periodic terms from the ECOM II to the ECOM I. This is because some Block types of satellites are sensitive to the even periodic terms in the SRP model and this ECOM C model might be potentially applied to multi-GNSS constellations. The parameters of the ECOM C are expressed as

\begin{equation}
\begin{split}
D = D_0 &+ D_C  \cdot cos  \Delta u + D_S  \cdot sin  \Delta u \\
        &+ D_2C \cdot cos 2\Delta u + D_2S \cdot sin 2\Delta u \\
        &+ D_4C \cdot cos 4\Delta u + D_4S \cdot sin 4\Delta u
\end{split}
\end{equation}
\begin{equation}
Y = Y_0 + Y_C \cdot cos \Delta u + Y_S \cdot sin \Delta u
\end{equation}
\begin{equation}
B = B_0 + B_C \cdot cos \Delta u + B_S \cdot sin \Delta u
\end{equation}

\subsection{Box Wing}
The SRP effect also can be handled by a so-called box-wing model that takes satellite bus areas, solar panel area, satellite attitude and interactions between photons and optical properties. The box-wing model $\ddot{r}_{boxw}$ used for a flat surface of satellite bus with thermal effect can be expressed as
\begin{equation}
\ddot{r}_{boxw} = -(A \cdot S_0)/(M \cdot C) cos \theta
                   [(\alpha + \delta)(e_d+2/3 \cdot e_N) + 2\rho cos \theta \cdot e_N]
\end{equation}
Where
$A$ denotes the cross-section area,
$S_{0}$ denotes the solar irradince at 1 AU $(1367W/m^2)$,
$M$ denotes the mass of satellite,
$C$ denotes the speed of light,
$\alpha$ denotes the absorption coefficient,
$\delta$ denotes the diffusion coefficient,
$\rho$ denotes the reflection coefficient,
$e_N$ denotes the normal vector of the surface,
$cos \theta$ denotes the angle between the $e_d$ and $e_N$.

\subsection{Antenna Thrust}
The navigation antenna produces a re-bouncing acceleration when the signal is transmitted. This is called as antenna thrust, which generates a constant acceleration in the radial direction of satellite orbit and can be model as
\begin{equation}
\ddot{r}_{ant} = W/(M \cdot C)
\end{equation}
Where
$W$ denotes the emitted power in watt.

\subsection{Albedo}
The earth radiation pressure (ERP), called albedo, also creates a small acceleration on navigation satellites. The ERP acceleration can be expressed as
For satellite bus and solar panel mast

\section{Transformation between Celestial and Terrestrial Reference Systems}

The variational equations obtained from the POD need to be transformed into the terrestrial reference frame so that the adjustments can be made in the ECEF frame that the PEA operates in.

\begin{equation}
    [CRS] = Q(t)R(t)W(t)[TRS]
\end{equation}

Where,
$CRS$ is the Celestial Reference System
$TRS$ is the Terrestrial Reference Systems
$Q(t)$ is the Celestial Pole motion (Precession-Nutation) matrix
$R(t)$ is the Earth Rotation matrix
$W(t)$ is the Polar motion matrix
\\
\begin{equation}
Q(t) =
\begin{bmatrix}
1-aX^2  & -aXY     & X \\
 -aXY   & 1 - aY^2 & Y \\
 -X     & -Y       & 1-a(X^2+Y^2)
\end{bmatrix}
\end{equation}
\\
\begin{equation}
R(t) = R_2(-\theta) =
\begin{bmatrix}
cos \theta & -sin \theta & 0 \\
sin \Theta & cos \theta  & 0 \\
0 & 0 1
\end{bmatrix}
\end{equation}
%\\
%\begin{equation}
%    W(t) = R_z (-s^') R_y(x_p) R_x(y_p)
%\end{equation}


\documentclass[letterpaper, 10 pt, conference]{ieeeconf}
\IEEEoverridecommandlockouts
\usepackage{graphicx}
\usepackage{hyperref}

\overrideIEEEmargins

\title{\Huge Motion Detection Using Simple Image Filtering}

\author{Jiyu Tian}

\begin{document}

\maketitle
\thispagestyle{empty}
\pagestyle{empty}

%-------------------------------------------------------------------------

\section{INTRODUCTION}
In this project we implemented a simple technique for motion detection and explored various factors that affect the efficiency. The stationary camera capture image sequences where most of the pixels belong to a stationary background and relatively small moving objects pass in front of the camera. In this case, the intensity values observed at a pixel over time is a constant or slowly varying signal, except when a moving object begins to pass through that pixel, in which case the intensity of the background is replaced by the intensity of the foreground object. Thus, we can detect a moving object by looking at large gradients in the temporal evolution of the pixel values.

%-------------------------------------------------------------------------
\section{ALGORITHMS DESCRIPTION}
Our motion detection algorithm is designed to contain 5 steps in total, including
\begin{itemize}
    \item Grayscale Conversion
    \item Spatial Smoothing
    \item Temporal Derivation
    \item Threshold Selection
    \item Result Generation
\end{itemize}
\subsection{Grayscale Conversion}
After reading in a sequence of image frames, we first make them grayscale. As shown in Fig \ref{gray}, we apply the grayscale conversion as the following eqaution:

\begin{equation}
Gray = 0.299 \times R + 0.587 \times G + 0.114 \times B
\end{equation}

\begin{figure}[thpb]
\centering
\includegraphics[width=0.46\textwidth]{lenagray2.png}
\caption{Grayscale Conversion}
\label{gray}
\end{figure}
If, in the worst case, some input frames do not have all the $R,\ G,\ B$ values, we simply regard the first channel as its grayscale value.

\subsection{Spatial Smoothing}
The possible bacground noise of original frames could have significant negative effects on accurate motion detection. And thus a 2D spatial smoothing filter is considered to be applied to the frames before applying the temporal derivative filter. Here we tried $3\times3$, $5\times5$ box filters, and $2D$ Gaussian filter with different standard deviation $\sigma$.

\subsection{Temporal Derivation}
Since the temporal derivatives of each pixel are to be analyzed for large gradients, different temporal derivative filter has different corresponding result. Here we make a comparison between $1st$ and $2nd$ discrete differential as well as $1D$ Gaussian filter with different standard deviation $\sigma$.

\subsection{Threshold Selection}
As shown in Fig \ref{thres}, pixels at different location has different overall behaviours. Those pixels located where no moving objects passed through tend to distribute with in a rather small value range, especially after spatial smoothing. While those pixels contains moving objects tend to have several extreme peaks.

\begin{figure}[thpb]
\centering
\includegraphics[width=0.46\textwidth]{pixel.png}
\caption{Temporal Derivation of Different Pixels}
\label{thres}
\end{figure}

The threshold selection is of vital importance for accurate motion detection. A threshold which is too high may results in mis-detection of moving objects, while a threshold which is too low can lead to high false alarm rates.

Our threshold selection strategy is based on the assumption that the given frame sequences always contains some percentage of pixels that have no moving objects passing through from start to end. We can then model these pixels as Gaussian zero mean noise based on their standard deviation, and come out with a relatively reasonable overall threshold.

\subsection{Result Generation}
Once threshold is selected, pixels of each frame can be determined as whether moving or not, and thus we can generate a mask on the original frame to indicate the moving objects.

\begin{equation}
Mask = \left\{
     \begin{array}{cc}
     1, & derivation > threshold\\
     0, & derivation \leq threshold\\
     \end{array}
\right.
\end{equation}

%-------------------------------------------------------------------------
\section{EXPERIMENTAL RESULTS}
\subsection{Temporal Derivative Filter}
We use $0.5[-1\ 0\ 1]$ as derivative filter, and use $1D$ Gaussian filter with standard deviation of $\sigma=1, 1.6, 2.5$. After convolved with Gaussian filter, the extreme peaks becomes much smooth, because the overall background noise is reduced. The height of peaks also decreases, which indicates that the mean and standard deviation of each pixel are also reduced. Intensity values of pixels without motion tend to distributed within a smaller range and could be easier to be separated.

\begin{figure}[thpb]
\centering
\includegraphics[width=0.4\textwidth]{derivative.png}
\caption{Temporal Derivative Filter}
\label{der}
\end{figure}

\subsection{Spatial Smoothing Filter}
We utilized four spatial filters for comparison: $3\times3$ Box, $5\times5$ Box, Gaussian $\sigma = 1.4$ and Gaussian $\sigma = 1.8$. A spatial smoothing filter can filter out high frequency noise and also blur frames. We picked one frame from \textit{Office} folder.

\begin{figure}[thpb]
\centering
\includegraphics[width=0.3\textwidth]{ssf.jpg}
\caption{Original Frame}
\label{ssf}
\end{figure}

As shown in Fig \ref{dssf}, the background noise is significant before spatial smoothing, and thus the result mask contains several noise spots. As the amount of blur increase, the number of noise point spots decreases and the margins become smooth. Background noise still remains after $3\times3$ box filter, but it almost disappears after $5\times5$ box filter and Gaussian filters. The result is then much more better after spatial smoothing filters as it reduces background noise and separate the moving object.

However, we should note that though spatial smoothing filter reduces background noise, it also lose details of object. As the amount of blur increase, object tends to `collapse' into a huge pixel, where we cannot separate glasses, face and pleats.

\begin{figure}[thpb]
\centering
\includegraphics[width=0.46\textwidth]{no.png}
\caption{Different Spatial Smoothing Filters}
\label{dssf}
\end{figure}

\subsection{Threshold Selection}
For each pixel we compute it overall mean and standard deviation, and ascending re-sort them respectively. As assumed that a particular percentage of pixels that contains no moving objects, our threshold selection strategy depends only on the percentage. Once percentage is determined, e.g. $10\%$, the threshold is then determined as $M + 3\Sigma$, where $M$ is the maximum of first $10\%$ mean and $\Sigma$ is the maximum of first $10\%$ standard deviation. Here in Gaussian, less than $1\times 10^{-6}$ samples located outside range $\mu\pm5\sigma$.

As we increase the percentage in Fig \ref{threshold}, the detector is less sensitive to change of intensity values, and the boundaries in mask becomes narrower. We select $10\%$ as our general threshold.

\begin{figure}[thpb]
\centering
\includegraphics[width=0.5\textwidth]{threshold.png}
\caption{Different Threshold}
\label{threshold}
\end{figure}

\subsection{Limitation}
One of the key limitations of our current motion detection method is that since the motion is detected based on its intensity values, slight changes of light can result in false positive. The frame sequences in Fig \ref{light} demonstrates a mis-detection of light instead of motion.
\begin{figure}[thpb]
\centering
\includegraphics[width=0.46\textwidth]{light.png}
\caption{Light Detection}
\label{light}
\end{figure}

Another weakness of the algorithm is that it tends to capture the motion of object edges but lefts aside in-between. We can always generate masks as shown in Fig \ref{bound}, where the texture of desk even appears inside the human body!

\begin{figure}[thpb]
\centering
\includegraphics[width=0.46\textwidth]{margin.png}
\caption{Boundaries}
\label{bound}
\end{figure}

%-------------------------------------------------------------------------
\section{CONCLUSION}
Motion detection based on change of the intensity values is a straight forward method and is also efficient. We do not need to consider correlation of different part of moving object and other dynamic factors, which makes the algorithm ease to implement.

The algorithm may be accurate on some simple cases, but it limitation is also significant. If we are to realize more applicable motion detection, more complicated algorithms are to be explored.

\end{document}